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"
64 int main(
int argc,
char *argv[])
67 MPI_Init(&argc,&argv);
68 Epetra_MpiComm Comm( MPI_COMM_WORLD );
70 Epetra_SerialComm Comm;
73 if (Comm.NumProc() == 1)
78 cout <<
"Test `TestOverlappingRowMatrix.exe' passed!" << endl;
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::CreateMap(
"Linear", Comm, GaleriList) );
88 Teuchos::RefCountPtr<Epetra_CrsMatrix>
A =
Teuchos::rcp( Galeri::CreateCrsMatrix(
"Laplace2D", &*Map, GaleriList) );
91 Epetra_Time Time(Comm);
98 Time.ResetStartTime();
100 if (Comm.MyPID() == 0)
101 cout <<
"Time to create B = " << Time.ElapsedTime() << endl;
103 int NumGlobalRowsB =
B.NumGlobalRows();
104 int NumGlobalNonzerosB =
B.NumGlobalNonzeros();
106 Epetra_Vector X(
A->RowMatrixRowMap());
107 Epetra_Vector Y(
A->RowMatrixRowMap());
108 for (
int i = 0 ; i <
A->NumMyRows() ; ++i)
109 X[i] = 1.0*
A->RowMatrixRowMap().GID(i);
112 Epetra_Vector ExtX_B(
B.RowMatrixRowMap());
113 Epetra_Vector ExtY_B(
B.RowMatrixRowMap());
114 ExtY_B.PutScalar(0.0);
122 if (Comm.MyPID() == 0)
123 cout <<
"Norm of Y using B = " << Norm_B << endl;
129 Time.ResetStartTime();
130 Epetra_CrsMatrix&
C =
132 if (Comm.MyPID() == 0)
133 cout <<
"Time to create C = " << Time.ElapsedTime() << endl;
136 int NumGlobalRowsC =
C.NumGlobalRows();
137 int NumGlobalNonzerosC =
C.NumGlobalNonzeros();
138 assert (NumGlobalRowsB == NumGlobalRowsC);
139 assert (NumGlobalNonzerosB == NumGlobalNonzerosC);
141 Epetra_Vector ExtX_C(
C.RowMatrixRowMap());
142 Epetra_Vector ExtY_C(
C.RowMatrixRowMap());
143 ExtY_C.PutScalar(0.0);
150 if (Comm.MyPID() == 0)
151 cout <<
"Norm of Y using C = " << Norm_C << endl;
166 if (Comm.MyPID() == 0)
167 cout <<
"Test `TestOverlappingRowMatrix.exe' passed!" << endl;
169 return(EXIT_SUCCESS);