65bool TestContainer(std::string Type,
const Teuchos::RefCountPtr<Epetra_RowMatrix>& A)
71 int NumMyRows = A->NumMyRows();
77 A->Multiply(
false, LHS_exact,
RHS);
82 cout <<
"Container type = " << Type << endl;
83 cout <<
"NumMyRows = " << NumMyRows <<
", NumVectors = " <<
NumVectors << endl;
87 Teuchos::RefCountPtr<Ifpack_Container> Container;
92 Container = Teuchos::rcp(
new Ifpack_SparseContainer<Ifpack_Amesos>(A->NumMyRows(),
NumVectors) );
94 assert (Container != Teuchos::null);
98 for (
int i = 0 ; i < A->NumMyRows() ; ++i)
106 for (
int i = 0 ; i < A->NumMyRows() ; ++i)
108 Container->RHS(i,j) =
RHS[j][i];
109 Container->LHS(i,j) = LHS[j][i];
113 Teuchos::ParameterList List;
114 List.set(
"amesos: solver type", Type);
121 for (
int i = 0 ; i < A->NumMyRows() ; ++i)
123 LHS[j][i] = Container->LHS(i,j);
126 double residual = Galeri::ComputeNorm(&LHS, &LHS_exact);
128 if (A->Comm().MyPID() == 0 &&
verbose) {
129 cout <<
"||x_exact - x||_2 = " << residual << endl;
141int main(
int argc,
char *argv[])
147 MPI_Init(&argc,&argv);
157 Teuchos::ParameterList GaleriList;
158 GaleriList.set(
"n", nx * nx);
159 GaleriList.set(
"nx", nx);
160 GaleriList.set(
"ny", nx);
162 Teuchos::RefCountPtr<Epetra_Map> Map = Teuchos::rcp( Galeri::CreateMap64(
"Linear", Comm, GaleriList) );
163 Teuchos::RefCountPtr<Epetra_RowMatrix> Matrix = Teuchos::rcp( Galeri::CreateCrsMatrix(
"Laplace2D", &*Map, GaleriList) );
165 Teuchos::RefCountPtr<Ifpack_LocalFilter> LocalMatrix = Teuchos::rcp(
new Ifpack_LocalFilter(Matrix) );
166 int TestPassed =
true;
169 if (!
TestContainer(
"sparse",LocalMatrix)) TestPassed =
false;
174 cout <<
"Test `TestContainer.exe' passed!" << endl;
177 cout <<
"Test `TestContainer.exe' FAILED!" << endl;
185 return(EXIT_SUCCESS);
bool TestContainer(std::string Type, const Teuchos::RefCountPtr< Epetra_RowMatrix > &A)
int main(int argc, char *argv[])