56#include "Galeri_Maps.h"
57#include "Galeri_CrsMatrices.h"
58#include "Teuchos_ParameterList.hpp"
59#include "Teuchos_RCP.hpp"
66int main(
int argc,
char *argv[])
69 MPI_Init(&argc,&argv);
80 cout <<
"Test `TestOverlappingRowMatrix.exe' passed!" << endl;
84 Teuchos::ParameterList GaleriList;
86 GaleriList.set(
"n", nx * nx);
87 GaleriList.set(
"nx", nx);
88 GaleriList.set(
"ny", nx);
89 Teuchos::RCP<Epetra_Map> Map
90 (Galeri::CreateMap (
"Linear", Comm, GaleriList));
91 Teuchos::RCP<Epetra_CrsMatrix> A
92 (Galeri::CreateCrsMatrix (
"Laplace2D", Map.getRawPtr (), GaleriList));
102 Time.ResetStartTime();
104 if (Comm.
MyPID() == 0)
105 cout <<
"Time to create B = " << Time.ElapsedTime() << endl;
112 for (
int i = 0 ; i < A->NumMyRows() ; ++i)
113 X[i] = 1.0* A->RowMatrixRowMap().GID(i);
118 ExtY_B.PutScalar(0.0);
126 if (Comm.
MyPID() == 0)
127 cout <<
"Norm of Y using B = " << Norm_B << endl;
133 Time.ResetStartTime();
136 if (Comm.
MyPID() == 0)
137 cout <<
"Time to create C = " << Time.ElapsedTime() << endl;
143 if (NumGlobalRowsB != NumGlobalRowsC) {
144 std::ostringstream os;
145 os <<
"NumGlobalRowsB = " << NumGlobalRowsB
146 <<
" != NumGlobalRowsC = " << NumGlobalRowsC
148 throw std::logic_error (os.str ());
150 if (NumGlobalNonzerosB != NumGlobalNonzerosC) {
151 std::ostringstream os;
152 os <<
"NumGlobalNonzerosB = " << NumGlobalNonzerosB
153 <<
" != NumGlobalNonzerosC = " << NumGlobalNonzerosC
155 throw std::logic_error (os.str ());
160 ExtY_C.PutScalar(0.0);
167 if (Comm.
MyPID() == 0)
168 cout <<
"Norm of Y using C = " << Norm_C << endl;
183 if (Comm.
MyPID() == 0)
184 cout <<
"Test `TestOverlappingRowMatrix.exe' passed!" << endl;
186 return(EXIT_SUCCESS);
#define IFPACK_CHK_ERR(ifpack_err)
Epetra_CrsMatrix * Ifpack_CreateOverlappingCrsMatrix(const Epetra_RowMatrix *Matrix, const int OverlappingLevel)
Creates an overlapping Epetra_CrsMatrix. Returns 0 if OverlappingLevel is 0.
int NumGlobalNonzeros() const
int NumGlobalRows() const
int Multiply(bool TransA, const Epetra_Vector &x, Epetra_Vector &y) const
const Epetra_Map & RowMatrixRowMap() const
int PutScalar(double ScalarConstant)
Ifpack_LocalFilter a class for light-weight extraction of the submatrix corresponding to local rows a...
Ifpack_OverlappingRowMatrix: matrix with ghost rows, based on Epetra_RowMatrix.
int ExportMultiVector(const Epetra_MultiVector &OvX, Epetra_MultiVector &X, Epetra_CombineMode CM=Add)
int ImportMultiVector(const Epetra_MultiVector &X, Epetra_MultiVector &OvX, Epetra_CombineMode CM=Insert)
virtual int NumGlobalNonzeros() const
Returns the number of nonzero entries in the global matrix.
virtual int NumGlobalRows() const
Returns the number of global matrix rows.
virtual const Epetra_Map & RowMatrixRowMap() const
Returns the Epetra_Map object associated with the rows of this matrix.
virtual int Multiply(bool TransA, const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Returns the result of a Epetra_RowMatrix multiplied by a Epetra_MultiVector X in Y.
int main(int argc, char *argv[])