46 #include "Epetra_MpiComm.h"
48 #include "Epetra_SerialComm.h"
50 #include "Epetra_CrsMatrix.h"
51 #include "Epetra_Vector.h"
52 #include "Epetra_LinearProblem.h"
53 #include "Galeri_Maps.h"
54 #include "Galeri_CrsMatrices.h"
55 #include "Teuchos_ParameterList.hpp"
56 #include "Teuchos_RefCountPtr.hpp"
74 bool UseTranspose =
false;
82 Matrix->Multiply(UseTranspose,LHSexact,
RHS);
86 Teuchos::RefCountPtr<T> Prec;
96 AztecOO AztecOOSolver(Problem);
99 AztecOOSolver.SetAztecOption(AZ_solver,AZ_gmres);
100 AztecOOSolver.SetAztecOption(AZ_output,32);
102 AztecOOSolver.SetPrecOperator(&*Prec);
106 AztecOOSolver.Iterate(1550,1e-8);
110 std::vector<double> Norm(NumVectors);
111 LHS.Update(1.0,LHSexact,-1.0);
114 cout <<
"Norm[" << i <<
"] = " << Norm[i] << endl;
122 int main(
int argc,
char *argv[])
126 MPI_Init(&argc,&argv);
136 GaleriList.
set(
"n", nx * nx);
137 GaleriList.
set(
"nx", nx);
138 GaleriList.
set(
"ny", nx);
139 Teuchos::RefCountPtr<Epetra_Map> Map =
Teuchos::rcp( Galeri::CreateMap(
"Linear", Comm, GaleriList) );
140 Teuchos::RefCountPtr<Epetra_RowMatrix> Matrix =
Teuchos::rcp( Galeri::CreateCrsMatrix(
"Laplace2D", &*Map, GaleriList) );
145 int TestPassed =
true;
147 if (!Test<Ifpack_Chebyshev>(Matrix,List))
152 List.
set(
"polynomial: degree",3);
153 if (!Test<Ifpack_Polynomial>(Matrix,List))
159 List.
set(
"krylov: tolerance", 1e-14);
160 List.
set(
"krylov: iterations", 100);
161 List.
set(
"krylov: preconditioner", 2);
162 List.
set(
"krylov: block size", 9);
163 List.
set(
"krylov: number of sweeps", 2);
164 if (!Test<Ifpack_Krylov>(Matrix,List))
174 if (!Test<Ifpack_Amesos>(Matrix,List))
188 List.
set(
"relaxation: type",
"Gauss-Seidel");
189 if (!Test<Ifpack_PointRelaxation>(Matrix,List)) {
195 List.
set(
"relaxation: type",
"symmetric Gauss-Seidel");
196 List.
set(
"relaxation: sweeps", 5);
197 List.
set(
"partitioner: local parts", 128);
198 List.
set(
"partitioner: type",
"linear");
205 List.
set(
"relaxation: type",
"symmetric Gauss-Seidel");
206 List.
set(
"partitioner: local parts", 128);
207 List.
set(
"partitioner: type",
"linear");
214 List.
set(
"relaxation: type",
"symmetric Gauss-Seidel");
215 List.
set(
"partitioner: local parts", 128);
216 List.
set(
"partitioner: type",
"linear");
221 cerr <<
"Test `TestAll.exe' FAILED!" << endl;
229 cout <<
"Test `TestAll.exe' passed!" << endl;
231 return(EXIT_SUCCESS);
bool Test(const Teuchos::RefCountPtr< Epetra_RowMatrix > &Matrix, Teuchos::ParameterList &List)
Ifpack_BlockRelaxation: a class to define block relaxation preconditioners of Epetra_RowMatrix's.
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Ifpack_AdditiveSchwarz: a class to define Additive Schwarz preconditioners of Epetra_RowMatrix's.
Ifpack_SparseContainer: a class for storing and solving linear systems using sparse matrices...
int main(int argc, char *argv[])
#define IFPACK_CHK_ERR(ifpack_err)