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)
71 int NumMyRows = A->NumMyRows();
76 LHS_exact.Random(); LHS.PutScalar(0.0);
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;
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];
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;
141 int main(
int argc,
char *argv[])
147 MPI_Init(&argc,&argv);
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) );
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);
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_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)