ispatest_epetra_utils.hpp

Go to the documentation of this file.
00001 //@HEADER
00002 /*
00003 ************************************************************************
00004 
00005               Isorropia: Partitioning and Load Balancing Package
00006                 Copyright (2006) Sandia Corporation
00007 
00008 Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00009 license for use of this work by or on behalf of the U.S. Government.
00010 
00011 This library is free software; you can redistribute it and/or modify
00012 it under the terms of the GNU Lesser General Public License as
00013 published by the Free Software Foundation; either version 2.1 of the
00014 License, or (at your option) any later version.
00015 
00016 This library is distributed in the hope that it will be useful, but
00017 WITHOUT ANY WARRANTY; without even the implied warranty of
00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019 Lesser General Public License for more details.
00020 
00021 You should have received a copy of the GNU Lesser General Public
00022 License along with this library; if not, write to the Free Software
00023 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00024 USA
00025 
00026 ************************************************************************
00027 */
00028 //@HEADER
00029 
00030 #ifndef _ispatest_epetra_test_utils_hpp_
00031 #define _ispatest_epetra_test_utils_hpp_
00032 
00033 #include <Isorropia_ConfigDefs.hpp>
00034 #include <string>
00035 #include <vector>
00036 #include <ostream>
00037 
00038 #ifdef HAVE_EPETRA
00039 
00040 class Epetra_CrsGraph;
00041 class Epetra_RowMatrix;
00042 class Epetra_LinearProblem;
00043 class Epetra_CrsMatrix;
00044 class Epetra_MultiVector;
00045 class Epetra_Map;
00046 class Epetra_BlockMap;
00047 class Epetra_Comm;
00048 
00049 namespace ispatest {
00050 
00057 int fill_matrix(Epetra_CrsMatrix& matrix,
00058                 int numNonzerosPerRow,
00059                 bool verbose);
00060 
00066 int fill_graph(Epetra_CrsGraph& graph,
00067                 int numNonzerosPerRow,
00068                 bool verbose);
00069 
00081 bool test_matrix_vector_multiply(Epetra_CrsMatrix &A);
00082 
00092 bool test_row_matrix_vector_multiply(Epetra_RowMatrix &R);
00093 
00105 bool test_matrix_vector_multiply(Epetra_CrsGraph &G);
00106 
00121 bool test_matrix_vector_multiply(Epetra_LinearProblem &LP);
00122 
00128 Epetra_Map *map_from_blockmap(const Epetra_BlockMap &b);
00129 
00142 int readCoordFile(const std::string &fname,
00143          std::vector<double> &x, std::vector<double> &y, std::vector<double> &z);
00144 
00152 Epetra_MultiVector *makeWeights(const Epetra_BlockMap &map, double (*wFunc)(const int, const int, const int, const int));
00153 
00156 double unitWeights(const int id, const int me, const int nids, const int nprocs);
00157 
00161 double veeWeights(const int id, const int me, const int nids, const int nprocs);
00162 
00165 double alternateWeights(const int id, const int me, const int nids, const int nprocs);
00166 
00170 Epetra_MultiVector *file2multivector(const Epetra_Comm &comm, const std::string &fname);
00171 
00175 int printMultiVector(const Epetra_MultiVector mv, std::ostream &os, 
00176                      const char *s, int max=1000);
00177 
00178 } //namespace ispatest
00179 
00180 #endif //HAVE_EPETRA
00181 
00182 #endif
00183