44 #include "Galeri_Maps.h"
45 #include "Galeri_CrsMatrices.h"
47 using namespace Teuchos;
48 using namespace Galeri;
52 const bool transpose,
const bool distribute,
64 FILE *in_file = fopen( in_filename,
"r");
68 filename = &in_filename[1] ;
71 filename = in_filename ;
76 std::string FileName = filename ;
78 int FN_Size = FileName.size() ;
79 std::string LastFiveBytes = FileName.substr(
EPETRA_MAX(0,FN_Size-5), FN_Size );
80 std::string LastFourBytes = FileName.substr(
EPETRA_MAX(0,FN_Size-4), FN_Size );
82 if ( LastFiveBytes ==
".triU" ) {
84 EPETRA_CHK_ERR( Trilinos_Util_ReadTriples2Epetra( filename,
false, Comm, readMap, readA, readx,
88 if ( LastFiveBytes ==
".triS" ) {
90 EPETRA_CHK_ERR( Trilinos_Util_ReadTriples2Epetra( filename,
true, Comm, readMap, readA, readx,
94 if ( LastFourBytes ==
".mtx" ) {
95 EPETRA_CHK_ERR( Trilinos_Util_ReadMatrixMarket2Epetra( filename, Comm, readMap,
96 readA, readx, readb, readxexact) );
97 FILE* in_file = fopen( filename,
"r");
98 assert (in_file != NULL) ;
100 char buffer[BUFSIZE] ;
101 fgets( buffer, BUFSIZE, in_file ) ;
102 std::string headerline1 = buffer;
104 if ( headerline1.find(
"symmetric") < BUFSIZE ) symmetric =
true;
106 if ( headerline1.find(
"symmetric") != std::string::npos) symmetric =
true;
113 Trilinos_Util_ReadHb2Epetra( filename, Comm, readMap, readA, readx,
115 if ( LastFourBytes ==
".rsa" ) symmetric = true ;
121 if ( readb )
delete readb;
122 if ( readx )
delete readx;
123 if ( readxexact )
delete readxexact;
131 serialA = transposeA ;
138 assert( (
void *) &serialA->
Graph() ) ;
139 assert( (
void *) &serialA->
RowMap() ) ;
150 Amat->Export(*serialA, exporter,
Add);
190 int main(
int argc,
char *argv[])
193 MPI_Init(&argc, &argv);
200 double TotalResidual = 0.0;
208 GaleriList.
set(
"nx", 4);
209 GaleriList.
set(
"ny", 4);
211 GaleriList.
set(
"mx", 1);
212 GaleriList.
set(
"my", 1);
214 Epetra_Map* Map = CreateMap(
"Cartesian3D", Comm, GaleriList);
224 bool transpose = false ;
225 bool distribute = false ;
229 CreateCrsMatrix(
"ibm.triU", Comm, Map, transpose, distribute, &symmetric, Matrix ) ;
248 List.
set(
"PrintTiming",
true);
249 List.
set(
"PrintStatus",
true);
252 std::vector<std::string> SolverType;
253 SolverType.push_back(
"Amesos_Paraklete");
263 for (
unsigned int i = 0 ; i < SolverType.size() ; ++i)
266 if (Factory.
Query(SolverType[i]))
279 assert (Solver != 0);
297 if (TotalResidual > 1e-9)
304 return(EXIT_SUCCESS);
int NumGlobalElements() const
bool SameAs(const Epetra_BlockMap &Map) const
int Multiply(bool TransA, const Epetra_Vector &x, Epetra_Vector &y) const
virtual int SymbolicFactorization()=0
Performs SymbolicFactorization on the matrix A.
virtual int SetParameters(Teuchos::ParameterList &ParameterList)=0
Updates internal variables.
int CrsMatrixTranspose(Epetra_CrsMatrix *In, Epetra_CrsMatrix *Out)
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
int FillComplete(bool OptimizeDataStorage=true)
const Epetra_Map & RowMap() const
#define AMESOS_CHK_ERR(a)
int main(int argc, char *argv[])
Factory for binding a third party direct solver to an Epetra_LinearProblem.
#define EPETRA_CHK_ERR(xxx)
int CreateCrsMatrix(const char *in_filename, const Epetra_Comm &Comm, Epetra_Map *&readMap, const bool transpose, const bool distribute, bool &symmetric, Epetra_CrsMatrix *&Matrix)
Amesos_BaseSolver * Create(const char *ClassType, const Epetra_LinearProblem &LinearProblem)
Amesos Create method.
int MyCreateCrsMatrix(const char *in_filename, const Epetra_Comm &Comm, Epetra_Map *&readMap, const bool transpose, const bool distribute, bool &symmetric, Epetra_CrsMatrix *&Matrix)
const Epetra_CrsGraph & Graph() const
Amesos_BaseSolver: A pure virtual class for direct solution of real-valued double-precision operators...
void ResetStartTime(void)
bool Query(const char *ClassType)
Queries whether a given interface is available or not.