14 #include "Teuchos_ParameterList.hpp" 15 #include "Teuchos_Array.hpp" 16 #include "Galeri_Maps.h" 17 #include "Galeri_CrsMatrices.h" 35 Teuchos::ParameterList ParamList ;
42 Abase = Afactory.
Create(ProblemType,Problem );
75 residual.
Update( 1.0, temp, -1.0, b, 0.0 ) ;
77 Teuchos::Array<double> norm_residual(NumVectors);
78 residual.
Norm2( norm_residual.getRawPtr() ) ;
81 std::cout <<
"norm2(A^3 x-b) = " << norm_residual << std::endl ;
86 for (Teuchos::Array<double>::const_iterator it = norm_residual.begin(); it != norm_residual.end(); ++it) {
93 int main(
int argc,
char *argv[]) {
96 MPI_Init(&argc, &argv);
104 Teuchos::ParameterList GaleriList;
105 GaleriList.set(
"nx", 8);
106 GaleriList.set(
"ny", 8 * Comm.
NumProc());
107 GaleriList.set(
"mx", 1);
108 GaleriList.set(
"my", Comm.
NumProc());
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;
132 if (Comm.
MyPID() == 0)
133 std::cout <<
"Testing " <<
Solver << std::endl;
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 );
int Norm2(double *Result) const
void SetLHS(Epetra_MultiVector *X)
void SetOperator(Epetra_RowMatrix *A)
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
virtual int MyPID() const=0
virtual const Epetra_Comm & Comm() const=0
Factory for binding a third party direct solver to an Epetra_LinearProblem.
int main(int argc, char *argv[])
#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)
bool TestAmesos(char ProblemType[], Epetra_RowMatrix &A, int NumVectors)
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.
int Update(double ScalarA, const Epetra_MultiVector &A, double ScalarThis)
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.