65bool TestContainer(std::string Type,
const Teuchos::RefCountPtr<Epetra_RowMatrix>& A)
68 int NumMyRows = A->NumMyRows();
74 A->Multiply(
false, LHS_exact,
RHS);
79 cout <<
"Container type = " << Type << endl;
80 cout <<
"NumMyRows = " << NumMyRows <<
", NumVectors = " <<
NumVectors << endl;
84 Teuchos::RefCountPtr<Ifpack_Container> Container;
89 Container = Teuchos::rcp(
new Ifpack_SparseContainer<Ifpack_Amesos>(A->NumMyRows(),
NumVectors) );
91 assert (Container != Teuchos::null);
95 for (
int i = 0 ; i < A->NumMyRows() ; ++i)
103 for (
int i = 0 ; i < A->NumMyRows() ; ++i)
105 Container->RHS(i,j) =
RHS[j][i];
106 Container->LHS(i,j) = LHS[j][i];
110 Teuchos::ParameterList List;
111 List.set(
"amesos: solver type", Type);
118 for (
int i = 0 ; i < A->NumMyRows() ; ++i)
120 LHS[j][i] = Container->LHS(i,j);
123 double residual = Galeri::ComputeNorm(&LHS, &LHS_exact);
125 if (A->Comm().MyPID() == 0 &&
verbose) {
126 cout <<
"||x_exact - x||_2 = " << residual << endl;
138int main(
int argc,
char *argv[])
142 MPI_Init(&argc,&argv);
152 Teuchos::ParameterList GaleriList;
153 GaleriList.set(
"n", nx * nx);
154 GaleriList.set(
"nx", nx);
155 GaleriList.set(
"ny", nx);
157 Teuchos::RefCountPtr<Epetra_Map> Map = Teuchos::rcp( Galeri::CreateMap(
"Linear", Comm, GaleriList) );
158 Teuchos::RefCountPtr<Epetra_RowMatrix> Matrix = Teuchos::rcp( Galeri::CreateCrsMatrix(
"Laplace2D", &*Map, GaleriList) );
160 Teuchos::RefCountPtr<Ifpack_LocalFilter> LocalMatrix = Teuchos::rcp(
new Ifpack_LocalFilter(Matrix) );
161 int TestPassed =
true;
164 if (!
TestContainer(
"sparse",LocalMatrix)) TestPassed =
false;
171 cout <<
"Test `TestContainer.exe' passed!" << endl;
174 cout <<
"Test `TestContainer.exe' FAILED!" << endl;
182 return(EXIT_SUCCESS);
bool TestContainer(std::string Type, const Teuchos::RefCountPtr< Epetra_RowMatrix > &A)
int main(int argc, char *argv[])