46#include "Epetra_MpiComm.h"
48#include "Epetra_SerialComm.h"
50#include "Epetra_CrsMatrix.h"
51#include "Epetra_Vector.h"
52#include "Epetra_LinearProblem.h"
53#include "Epetra_Map.h"
54#include "Epetra_Import.h"
55#include "Epetra_Time.h"
56#include "Galeri_Maps.h"
57#include "Galeri_CrsMatrices.h"
58#include "Teuchos_ParameterList.hpp"
59#include "Teuchos_RefCountPtr.hpp"
64int main(
int argc,
char *argv[])
67 MPI_Init(&argc,&argv);
78 cout <<
"Test `TestOverlappingRowMatrix.exe' passed!" << endl;
82 Teuchos::ParameterList GaleriList;
84 GaleriList.set(
"n", nx * nx);
85 GaleriList.set(
"nx", nx);
86 GaleriList.set(
"ny", nx);
87 Teuchos::RefCountPtr<Epetra_Map> Map = Teuchos::rcp( Galeri::CreateMap64(
"Linear", Comm, GaleriList) );
88 Teuchos::RefCountPtr<Epetra_CrsMatrix> A = Teuchos::rcp( Galeri::CreateCrsMatrix(
"Laplace2D", &*Map, GaleriList) );
100 if (Comm.
MyPID() == 0)
101 cout <<
"Time to create B = " << Time.
ElapsedTime() << endl;
108 for (
int i = 0 ; i < A->NumMyRows() ; ++i)
109 X[i] = 1.0* A->RowMatrixRowMap().GID64(i);
122 if (Comm.
MyPID() == 0)
123 cout <<
"Norm of Y using B = " << Norm_B << endl;
132 if (Comm.
MyPID() == 0)
133 cout <<
"Time to create C = " << Time.
ElapsedTime() << endl;
138 if (NumGlobalRowsB != NumGlobalRowsC) {
139 std::ostringstream os;
140 os <<
"NumGlobalRowsB = " << NumGlobalRowsB
141 <<
" != NumGlobalRowsC = " << NumGlobalRowsC <<
".";
142 throw std::logic_error (os.str ());
144 if (NumGlobalNonzerosB != NumGlobalNonzerosC) {
145 std::ostringstream os;
146 os <<
"NumGlobalNonzerosB = " << NumGlobalNonzerosB
147 <<
" != NumGlobalNonzerosC = " << NumGlobalNonzerosC <<
".";
148 throw std::logic_error (os.str ());
160 if (Comm.
MyPID() == 0)
161 cout <<
"Norm of Y using C = " << Norm_C << endl;
176 if (Comm.
MyPID() == 0)
177 cout <<
"Test `TestOverlappingRowMatrix.exe' passed!" << endl;
179 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.
long long NumGlobalRows64() const
long long NumGlobalNonzeros64() const
int Multiply(bool TransA, const Epetra_Vector &x, Epetra_Vector &y) const
const Epetra_Map & RowMatrixRowMap() const
int Norm2(double *Result) const
int PutScalar(double ScalarConstant)
void ResetStartTime(void)
double ElapsedTime(void) const
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 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.
virtual long long NumGlobalNonzeros64() const
Returns the number of nonzero entries in the global matrix.
virtual long long NumGlobalRows64() const
Returns the number of global matrix rows.
int main(int argc, char *argv[])