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" 76 bool UseTranspose =
false;
78 Epetra_MultiVector LHS(Matrix->OperatorDomainMap(),
NumVectors);
79 Epetra_MultiVector
RHS(Matrix->OperatorRangeMap(),
NumVectors);
80 Epetra_MultiVector LHSexact(Matrix->OperatorDomainMap(),
NumVectors);
84 Matrix->Multiply(UseTranspose,LHSexact,
RHS);
86 Epetra_LinearProblem Problem(&*Matrix,&LHS,&
RHS);
88 Teuchos::RefCountPtr<T> Prec;
91 assert(Prec != Teuchos::null);
98 AztecOO AztecOOSolver(Problem);
101 AztecOOSolver.SetAztecOption(AZ_solver,AZ_gmres);
102 AztecOOSolver.SetAztecOption(AZ_output,32);
104 AztecOOSolver.SetPrecOperator(&*Prec);
108 AztecOOSolver.Iterate(1550,1e-8);
113 LHS.Update(1.0,LHSexact,-1.0);
116 cout <<
"Norm[" << i <<
"] = " << Norm[i] << endl;
124 int main(
int argc,
char *argv[])
128 MPI_Init(&argc,&argv);
129 Epetra_MpiComm Comm(MPI_COMM_WORLD);
131 Epetra_SerialComm Comm;
134 bool verbose = (Comm.MyPID() == 0);
138 GaleriList.
set(
"n", nx * nx);
139 GaleriList.
set(
"nx", nx);
140 GaleriList.
set(
"ny", nx);
141 Teuchos::RefCountPtr<Epetra_Map> Map =
Teuchos::rcp( Galeri::CreateMap64(
"Linear", Comm, GaleriList) );
142 Teuchos::RefCountPtr<Epetra_RowMatrix> Matrix =
Teuchos::rcp( Galeri::CreateCrsMatrix(
"Laplace2D", &*Map, GaleriList) );
147 int TestPassed =
true;
149 if (!Test<Ifpack_Chebyshev>(Matrix,List))
154 List.
set(
"polynomial: degree",3);
155 if (!Test<Ifpack_Polynomial>(Matrix,List))
161 List.
set(
"krylov: tolerance", 1e-14);
162 List.
set(
"krylov: iterations", 100);
163 List.
set(
"krylov: preconditioner", 2);
164 List.
set(
"krylov: block size", 9);
165 List.
set(
"krylov: number of sweeps", 2);
166 if (!Test<Ifpack_Krylov>(Matrix,List))
175 if (!Test<Ifpack_Amesos>(Matrix,List))
189 List.
set(
"relaxation: type",
"Gauss-Seidel");
190 if (!Test<Ifpack_PointRelaxation>(Matrix,List)) {
196 List.
set(
"relaxation: type",
"symmetric Gauss-Seidel");
197 List.
set(
"relaxation: sweeps", 5);
198 List.
set(
"partitioner: local parts", 128);
199 List.
set(
"partitioner: type",
"linear");
206 List.
set(
"relaxation: type",
"symmetric Gauss-Seidel");
207 List.
set(
"partitioner: local parts", 128);
208 List.
set(
"partitioner: type",
"linear");
215 List.
set(
"relaxation: type",
"symmetric Gauss-Seidel");
216 List.
set(
"partitioner: local parts", 128);
217 List.
set(
"partitioner: type",
"linear");
222 cerr <<
"Test `TestAll.exe' FAILED!" << endl;
230 cout <<
"Test `TestAll.exe' passed!" << endl;
232 return(EXIT_SUCCESS);
Ifpack_BlockRelaxation: a class to define block relaxation preconditioners of Epetra_RowMatrix's.
int main(int argc, char *argv[])
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...
bool Test(const Teuchos::RefCountPtr< Epetra_RowMatrix > &Matrix, Teuchos::ParameterList &List)
#define IFPACK_CHK_ERR(ifpack_err)