55 #include "../epetra_test_err.h"
59 int main(
int argc,
char *argv[]) {
67 MPI_Init(&argc,&argv);
70 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
84 if (argc>1)
if (argv[1][0]==
'-' && argv[1][1]==
'v') verbose =
true;
91 int MyPID = Comm.
MyPID();
94 if (verbose && MyPID==0)
97 if (verbose) cout << Comm <<endl;
99 bool verbose1 = verbose;
102 if (verbose && rank!=0) verbose =
false;
104 int NumMyElements = 10000;
105 int NumMyElements1 = NumMyElements;
106 int NumGlobalElements = NumMyElements*NumProc+
EPETRA_MIN(NumProc,3);
107 if (MyPID < 3) NumMyElements++;
115 if (verbose) cout <<
"\n*********************************************************" << endl;
116 if (verbose) cout <<
"Checking Epetra_LocalMap(NumMyElements1, IndexBase, Comm)" << endl;
117 if (verbose) cout <<
" and Epetra_BlockMap(NumGlobalElements, ElementSize, IndexBase, Comm)" << endl;
118 if (verbose) cout <<
"*********************************************************" << endl;
129 if (verbose) cout <<
"\n*********************************************************" << endl;
130 if (verbose) cout <<
"Checking Epetra_BlockMap(NumGlobalElements, NumMyElements, ElementSize, IndexBase, Comm)" << endl;
131 if (verbose) cout <<
"*********************************************************" << endl;
133 BlockMap =
new Epetra_BlockMap(NumGlobalElements, NumMyElements, ElementSize, IndexBase, Comm);
142 int * MyGlobalElements =
new int[NumMyElements];
143 int MaxMyGID = (Comm.
MyPID()+1)*NumMyElements-1+IndexBase;
144 if (Comm.
MyPID()>2) MaxMyGID+=3;
145 for (i = 0; i<NumMyElements; i++) MyGlobalElements[i] = MaxMyGID-i;
147 if (verbose) cout <<
"\n*********************************************************" << endl;
148 if (verbose) cout <<
"Checking Epetra_BlockMap(NumGlobalElements, NumMyElements, MyGlobalElements, ElementSize, IndexBase, Comm)" << endl;
149 if (verbose) cout <<
"*********************************************************" << endl;
151 BlockMap =
new Epetra_BlockMap(NumGlobalElements, NumMyElements, MyGlobalElements, ElementSize,
157 int * ElementSizeList =
new int[NumMyElements];
158 int NumMyEquations = 0;
159 int NumGlobalEquations = 0;
160 for (i = 0; i<NumMyElements; i++)
162 ElementSizeList[i] = i%6+2;
163 NumMyEquations += ElementSizeList[i];
166 NumGlobalEquations = Comm.
NumProc()*NumMyEquations;
172 NumGlobalEquations += 3*((NumMyElements)%6+2);
174 NumGlobalEquations -= (Comm.
NumProc()-3)*((NumMyElements-1)%6+2);
177 if (verbose) cout <<
"\n*********************************************************" << endl;
178 if (verbose) cout <<
"Checking Epetra_BlockMap(NumGlobalElements, NumMyElements, MyGlobalElements, ElementSizeList, IndexBase, Comm)" << endl;
179 if (verbose) cout <<
"*********************************************************" << endl;
181 BlockMap =
new Epetra_BlockMap(NumGlobalElements, NumMyElements, MyGlobalElements, ElementSizeList,
187 if (verbose) cout <<
"\n*********************************************************" << endl;
188 if (verbose) cout <<
"Checking Epetra_BlockMap(*BlockMap)" << endl;
189 if (verbose) cout <<
"*********************************************************" << endl;
195 delete [] ElementSizeList;
196 delete [] MyGlobalElements;
203 if (verbose) cout <<
"\n*********************************************************" << endl;
204 if (verbose) cout <<
"Checking Epetra_Map(NumGlobalElements, IndexBase, Comm)" << endl;
205 if (verbose) cout <<
"*********************************************************" << endl;
214 if (verbose) cout <<
"\n*********************************************************" << endl;
215 if (verbose) cout <<
"Checking Epetra_Map(NumGlobalElements, NumMyElements, IndexBase, Comm)" << endl;
216 if (verbose) cout <<
"*********************************************************" << endl;
218 Map =
new Epetra_Map(NumGlobalElements, NumMyElements, IndexBase, Comm);
227 MyGlobalElements =
new int[NumMyElements];
228 MaxMyGID = (Comm.
MyPID()+1)*NumMyElements-1+IndexBase;
229 if (Comm.
MyPID()>2) MaxMyGID+=3;
230 for (i = 0; i<NumMyElements; i++) MyGlobalElements[i] = MaxMyGID-i;
232 if (verbose) cout <<
"\n*********************************************************" << endl;
233 if (verbose) cout <<
"Checking Epetra_Map(NumGlobalElements, NumMyElements, MyGlobalElements, IndexBase, Comm)" << endl;
234 if (verbose) cout <<
"*********************************************************" << endl;
236 Map =
new Epetra_Map(NumGlobalElements, NumMyElements, MyGlobalElements,
242 if (verbose) cout <<
"\n*********************************************************" << endl;
243 if (verbose) cout <<
"Checking Epetra_Map(*Map)" << endl;
244 if (verbose) cout <<
"*********************************************************" << endl;
250 delete [] MyGlobalElements;
260 int * Ip =
new int[200];
262 for (i=0; i<100; i++)
263 Ip[i+j*100] = i+j*100;
266 if (verbose) cout <<
"\n\nTesting ostream operator: Multivector should be 100-by-2 and print i,j indices"
272 if (verbose) cout <<
"\n\nTesting ostream operator: Same Multivector as before except using BlockMap of 25x4"
276 if (verbose) cout <<
"Traceback Mode value = " << I.
GetTracebackMode() << endl;
Epetra_Map: A class for partitioning vectors and matrices.
#define EPETRA_TEST_ERR(a, b)
static void SetTracebackMode(int TracebackModeValue)
Set the value of the Epetra_Object error traceback report mode.
Epetra_IntMultiVector: A class for constructing and using dense multi-vectors, vectors and matrices i...
int MyPID() const
Return my process ID.
Epetra_MpiComm: The Epetra MPI Communication Class.
std::string Epetra_Version()
int IntMultiVectorTests(const Epetra_BlockMap &Map, int NumVectors, bool verbose)
Epetra_BlockMap: A class for partitioning block element vectors and matrices.
int NumProc() const
Returns total number of processes (always returns 1 for SerialComm).
Epetra_SerialComm: The Epetra Serial Communication Class.
static int GetTracebackMode()
Get the value of the Epetra_Object error report mode.
int main(int argc, char *argv[])
Epetra_LocalMap: A class for replicating vectors and matrices across multiple processors.