55 #include "Trilinos_Util_CrsMatrixGallery.h"
57 using namespace Trilinos_Util;
62 int main(
int argc,
char *argv[])
64 int ierr = 0, i, forierr = 0;
71 MPI_Init(&argc,&argv);
74 MPI_Comm_size(MPI_COMM_WORLD, &size);
75 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
89 if (argc>1)
if (argv[1][0]==
'-' && argv[1][1]==
'v') verbose =
true;
96 int MyPID = Comm.
MyPID();
99 if(verbose && MyPID==0)
102 if (verbose) cout <<
"Processor "<<MyPID<<
" of "<< NumProc
103 <<
" is alive."<<endl;
106 CrsMatrixGallery laplace_2d(
"laplace_2d", Comm);
109 if (verbose) cout <<
"Orig matrix = " << *laplace_2d_matrix << endl;
110 const Epetra_Map * origRowMap = laplace_2d.GetMap();
115 int numNewRowGids = 0;
117 newRowMapGids[numNewRowGids++] = origGids[i];
118 Epetra_Map newRowMap(-1, numNewRowGids, newRowMapGids.Values(), 0, origRowMap->
Comm());
126 if (verbose) cout <<
"Sub matrix (every other row/column) = " << subA << endl;
130 (*laplace_2d_matrix)[0][0] = 12.0;
131 if (verbose) cout <<
"Orig matrix = " << *laplace_2d_matrix << endl;
132 subMatrixTransform.fwd();
133 assert(subA[0][0]==12.0);
134 if (verbose) cout <<
"Sub matrix (every other row/column) = " << subA << endl;
139 if (verbose) cout <<
"Sub matrix (every other row/column) = " << subA << endl;
140 subMatrixTransform.rvs();
141 assert((*laplace_2d_matrix)[0][0]==24.0);
142 if (verbose) cout <<
"Orig matrix = " << *laplace_2d_matrix << endl;
144 if (Comm.
MyPID()==0) cout <<
"EpetraExt::CrsMatrix_SubCopy tests passed." << endl;
int MyGlobalElements(int *MyGlobalElementList) const
std::string Epetra_Version()
Generates a sub-block view of a Epetra_CrsMatrix.
int main(int argc, char **argv)
int NumMyElements() const
const Epetra_Comm & Comm() const