16 #include "Galeri_Maps.h"
17 #include "Galeri_CrsMatrices.h"
19 using namespace Galeri;
42 Abase = Afactory.
Create(ProblemType,Problem );
75 residual.Update( 1.0, temp, -1.0, b, 0.0 ) ;
78 residual.Norm2( norm_residual.
getRawPtr() ) ;
81 std::cout <<
"norm2(A^3 x-b) = " << norm_residual << std::endl ;
93 int main(
int argc,
char *argv[]) {
96 MPI_Init(&argc, &argv);
105 GaleriList.
set(
"nx", 8);
107 GaleriList.
set(
"mx", 1);
110 Epetra_Map* Map = CreateMap(
"Cartesian2D", Comm, GaleriList);
115 std::vector<std::string> SolverType;
117 SolverType.push_back(
"Amesos_Klu");
118 SolverType.push_back(
"Amesos_Umfpack");
119 SolverType.push_back(
"Amesos_Pardiso");
120 SolverType.push_back(
"Amesos_Taucs");
121 SolverType.push_back(
"Amesos_Superlu");
122 SolverType.push_back(
"Amesos_Superludist");
123 SolverType.push_back(
"Amesos_Mumps");
124 SolverType.push_back(
"Amesos_Dscpack");
126 bool TestPassed =
true;
128 for (
unsigned int i = 0 ; i < SolverType.size() ; ++i) {
129 std::string
Solver = SolverType[i];
130 std::cout << Solver <<
" next " << std::endl;
131 if (Factory.
Query((
char*)Solver.c_str())) {
132 if (Comm.
MyPID() == 0)
133 std::cout <<
"Testing " << Solver << std::endl;
134 if(
TestAmesos((
char*)Solver.c_str(), *A, NumVectors) ==
false) {
135 std::cout << Solver <<
" Failed " << std::endl;
138 std::cout << Solver <<
" Passed " << std::endl;
141 if (Comm.
MyPID() == 0) {
142 std::cerr << std::endl;
143 std::cerr <<
"WARNING: SOLVER `" << Solver <<
"' NOT TESTED" << std::endl;
144 std::cerr << std::endl;
156 if (Comm.
MyPID() == 0)
157 std::cout <<
"TESTS PASSED!" << std::endl;
158 return( EXIT_SUCCESS );
161 if (Comm.
MyPID() == 0)
162 std::cout <<
"TESTS FAILED!" << std::endl;
163 return( EXIT_FAILURE );
void SetLHS(Epetra_MultiVector *X)
void SetOperator(Epetra_RowMatrix *A)
bool TestAmesos(char ProblemType[], Teuchos::ParameterList &AmesosList, bool UseTranspose, Epetra_RowMatrix *A, Epetra_MultiVector *lhs, Epetra_MultiVector *rhs)
virtual int Solve()=0
Solves A X = B (or AT x = B)
virtual int NumericFactorization()=0
Performs NumericFactorization on the matrix A.
virtual int SymbolicFactorization()=0
Performs SymbolicFactorization on the matrix A.
virtual const Epetra_Map & OperatorDomainMap() const =0
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
virtual int MyPID() const =0
virtual const Epetra_Comm & Comm() const =0
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)
std::vector< T >::const_iterator const_iterator
virtual int Multiply(bool TransA, const Epetra_MultiVector &X, Epetra_MultiVector &Y) const =0
void SetRHS(Epetra_MultiVector *B)
Amesos_BaseSolver * Create(const char *ClassType, const Epetra_LinearProblem &LinearProblem)
Amesos Create method.
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.