46 #include "Epetra_MpiComm.h"
48 #include "Epetra_SerialComm.h"
49 #include "Epetra_CrsMatrix.h"
50 #include "Epetra_Vector.h"
51 #include "Epetra_LinearProblem.h"
52 #include "Galeri_Maps.h"
53 #include "Galeri_CrsMatrices.h"
54 #include "Galeri_Utils.h"
55 #include "Teuchos_ParameterList.hpp"
56 #include "Teuchos_RefCountPtr.hpp"
65 bool TestContainer(std::string Type,
const Teuchos::RefCountPtr<Epetra_RowMatrix>&
A)
68 int NumMyRows = A->NumMyRows();
73 LHS_exact.Random(); LHS.PutScalar(0.0);
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;
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];
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;
138 int main(
int argc,
char *argv[])
142 MPI_Init(&argc,&argv);
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) );
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);
ParameterList & set(std::string const &name, T &&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_SparseContainer: a class for storing and solving linear systems using sparse matrices...
Ifpack_LocalFilter a class for light-weight extraction of the submatrix corresponding to local rows a...
int main(int argc, char *argv[])
Ifpack_DenseContainer: a class to define containers for dense matrices.
bool TestContainer(std::string Type, const Teuchos::RefCountPtr< Epetra_RowMatrix > &A)
#define IFPACK_CHK_ERR(ifpack_err)