44 #include "Galeri_Maps.h" 45 #include "Galeri_CrsMatrices.h" 52 const bool transpose,
const bool distribute,
64 FILE *in_file = fopen( in_filename,
"r");
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" ) {
88 if ( LastFiveBytes ==
".triS" ) {
94 if ( LastFourBytes ==
".mtx" ) {
96 readA, readx, readb, readxexact) );
97 FILE* in_file = fopen(
filename,
"r");
98 assert (in_file !=
NULL) ;
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() ) ;
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);
210 GaleriList.
set(
"nz", 4 *
Comm.NumProc());
211 GaleriList.
set(
"mx", 1);
212 GaleriList.
set(
"my", 1);
213 GaleriList.
set(
"mz",
Comm.NumProc());
225 bool distribute = false ;
248 List.
set(
"PrintTiming",
true);
249 List.
set(
"PrintStatus",
true);
250 List.
set(
"MaxProcs",
Comm.NumProc());
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]))
281 Solver->SetParameters(List);
285 Time.ResetStartTime();
297 if (TotalResidual > 1e-9)
304 return(EXIT_SUCCESS);
const Epetra_Map & RowMap() const
int main(int argc, char *argv[])
const Epetra_CrsGraph & Graph() const
int Multiply(bool TransA, const Epetra_Vector &x, Epetra_Vector &y) const
bool SameAs(const Epetra_BlockMap &Map) const
cholmod_sparse *CHOLMOD() transpose(cholmod_sparse *A, int values, cholmod_common *Common)
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
int PutScalar(double ScalarConstant)
int CrsMatrixTranspose(Epetra_CrsMatrix *In, Epetra_CrsMatrix *Out)
int FillComplete(bool OptimizeDataStorage=true)
int Export(const Epetra_SrcDistObject &A, const Epetra_Import &Importer, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex *Indexor=0)
#define AMESOS_CHK_ERR(a)
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)
int MyCreateCrsMatrix(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 NumGlobalElements() const
Amesos_BaseSolver: A pure virtual class for direct solution of real-valued double-precision operators...
bool Query(const char *ClassType)
Queries whether a given interface is available or not.