58 #include "../epetra_test_err.h"
67 int main(
int argc,
char *argv[]) {
77 MPI_Init(&argc,&argv);
86 if (argv[1][0]==
'-' && argv[1][1]==
'v') verbose =
true;
90 int verbose_int = verbose ? 1 : 0;
92 verbose = verbose_int==1 ?
true :
false;
95 Comm.SetTracebackMode(0);
98 if (verbose && Comm.
MyPID()==0)
125 int MyPID = Comm.
MyPID();
129 bool verbose1 = verbose;
131 if (verbose) verbose = (MyPID==0);
134 cerr <<
"================check_rowpermute_crsmatrix_local_diagonal=========="
138 int NumMyElements = 5;
139 int NumGlobalElements = NumMyElements*NumProc;
141 Epetra_Map Map(NumGlobalElements, NumMyElements, 0, Comm);
143 int* p =
new int[NumMyElements];
144 int firstGlobalRow = MyPID*NumMyElements;
150 cout <<
"Permutation P:"<<endl;
155 for(i=0; i<NumMyElements; ++i) {
156 p[i] = firstGlobalRow+NumMyElements-1-i;
158 cout <<
"p["<<firstGlobalRow+i<<
"]: "<<p[i]<<endl;
170 for(i=0; i<NumMyElements; ++i) {
171 int row = firstGlobalRow+i;
181 cout <<
"********** matrix A: **************"<<endl;
190 cout <<
"************ permuted matrix B: ***************"<<endl;
201 int MyPID = Comm.
MyPID();
205 bool verbose1 = verbose;
207 if (verbose) verbose = (MyPID==0);
210 cerr <<
"================check_rowpermute_crsgraph_local_diagonal=========="
214 int NumMyElements = 5;
215 int NumGlobalElements = NumMyElements*NumProc;
217 Epetra_Map Map(NumGlobalElements, NumMyElements, 0, Comm);
219 int* p =
new int[NumMyElements];
220 int firstGlobalRow = MyPID*NumMyElements;
226 cout <<
"Permutation P:"<<endl;
231 for(i=0; i<NumMyElements; ++i) {
232 p[i] = firstGlobalRow+NumMyElements-1-i;
234 cout <<
"p["<<firstGlobalRow+i<<
"]: "<<p[i]<<endl;
245 for(i=0; i<NumMyElements; ++i) {
246 int row = firstGlobalRow+i;
255 cout <<
"*************** graph Agrph: ********************"<<endl;
256 cout << Agrph << endl;
264 cout <<
"************* permuted graph Bgrph: ****************"<<endl;
265 cout << Bgrph << endl;
275 int MyPID = Comm.
MyPID();
279 bool verbose1 = verbose;
281 if (verbose) verbose = (MyPID==0);
284 cerr <<
"================check_colpermute_crsgraph=========="
288 int NumMyElements = 5;
289 int NumGlobalElements = NumMyElements*NumProc;
291 Epetra_Map Map(NumGlobalElements, NumMyElements, 0, Comm);
293 int* p =
new int[NumMyElements];
294 int firstGlobalRow = MyPID*NumMyElements;
297 cout <<
"Permutation P:"<<endl;
302 for(i=0; i<NumMyElements; ++i) {
303 int row = firstGlobalRow+i;
304 p[i] = NumGlobalElements - row - 1;
306 cout <<
"p["<<firstGlobalRow+i<<
"]: "<<p[i]<<endl;
316 for(i=0; i<NumMyElements; ++i) {
317 int row = firstGlobalRow+i;
318 col = NumGlobalElements - row - 1;
327 if (col < NumGlobalElements-1) {
336 cout <<
"*************** graph Agrph: ********************"<<endl;
337 cout << Agrph << endl;
342 bool column_permutation =
true;
346 cout <<
"************* column-permuted graph Bgrph: ****************"<<endl;
347 cout << Bgrph << endl;
359 int MyPID = Comm.
MyPID();
363 bool verbose1 = verbose;
365 if (verbose) verbose = (MyPID==0);
368 cerr <<
"================check_rowpermute_crsmatrix_global_diagonal=========="
372 int NumMyElements = 5;
373 int NumGlobalElements = NumMyElements*NumProc;
375 Epetra_Map Map(NumGlobalElements, NumMyElements, 0, Comm);
377 int* p =
new int[NumMyElements];
378 int firstGlobalRow = MyPID*NumMyElements;
394 for(i=0; i<NumMyElements; ++i) {
395 int row = firstGlobalRow+i;
405 cout <<
"******************* matrix A: ****************************"<<endl;
410 cout <<
"Permutation P:"<<endl;
413 for(i=0; i<NumMyElements; ++i) {
414 int globalrow = NumGlobalElements-(firstGlobalRow+i)-1;
417 cout <<
"p["<<firstGlobalRow+i<<
"]: "<<p[i]<<endl;
426 cout <<
"******************* permuted matrix Bglobal: *******************" <<endl;
427 cout << Bglobal << endl;
437 int MyPID = Comm.
MyPID();
441 bool verbose1 = verbose;
443 if (verbose) verbose = (MyPID==0);
446 cerr <<
"================check_colpermute_crsmatrix=========="
450 int NumMyElements = 5;
451 int NumGlobalElements = NumMyElements*NumProc;
453 Epetra_Map Map(NumGlobalElements, NumMyElements, 0, Comm);
455 int* p =
new int[NumMyElements];
456 int firstGlobalRow = MyPID*NumMyElements;
459 cout <<
"Permutation P:"<<endl;
464 for(i=0; i<NumMyElements; ++i) {
465 int row = firstGlobalRow+i;
466 p[i] = NumGlobalElements - row - 1;
468 cout <<
"p["<<firstGlobalRow+i<<
"]: "<<p[i]<<endl;
479 for(i=0; i<NumMyElements; ++i) {
480 int row = firstGlobalRow+i;
481 col = NumGlobalElements - row - 1;
492 if (col < NumGlobalElements-1) {
502 cout <<
"*************** matrix A: ********************"<<endl;
508 bool column_permutation =
true;
512 cout <<
"************* column-permuted matrix B: ****************"<<endl;
525 int MyPID = Comm.
MyPID();
529 bool verbose1 = verbose;
531 if (verbose) verbose = (MyPID==0);
534 cerr <<
"================check_rowpermute_multivector_local=========="
538 int NumMyElements = 5;
539 int NumGlobalElements = NumMyElements*NumProc;
541 Epetra_Map Map(NumGlobalElements, NumMyElements, 0, Comm);
543 int* p =
new int[NumMyElements];
544 int firstGlobalRow = MyPID*NumMyElements;
550 cout <<
"Permutation P:"<<endl;
555 for(i=0; i<NumMyElements; ++i) {
556 p[i] = firstGlobalRow+NumMyElements-1-i;
558 cout <<
"p["<<firstGlobalRow+i<<
"]: "<<p[i]<<endl;
568 for(i=0; i<NumMyElements; ++i) {
569 v0[i] = 1.0*(firstGlobalRow+i) + 0.1;
570 v1[i] = 1.0*(firstGlobalRow+i) + 0.2;
571 v2[i] = 1.0*(firstGlobalRow+i) + 0.3;
575 cout <<
"*************** MultiVector v: ********************"<<endl;
584 cout <<
"************* permuted MultiVector Pv: ****************"<<endl;
virtual int InsertGlobalValues(int GlobalRow, int NumEntries, const double *Values, const int *Indices)
#define EPETRA_CHK_ERR(a)
std::string EpetraExt_Version()
virtual void Barrier() const =0
int InsertGlobalIndices(int_type GlobalRow, int NumIndices, int_type *Indices)
int check_colpermute_crsgraph(Epetra_Comm &Comm, bool verbose)
virtual int MyPID() const =0
int FillComplete(bool OptimizeDataStorage=true)
int main(int argc, char **argv)
int check_rowpermute_crsmatrix_global_diagonal(Epetra_Comm &Comm, bool verbose)
int check_rowpermute_crsmatrix_local_diagonal(Epetra_Comm &Comm, bool verbose)
virtual int NumProc() const =0
int check_rowpermute_crsgraph_local_diagonal(Epetra_Comm &Comm, bool verbose)
int Broadcast(double *MyVals, int Count, int Root) const
int check_rowpermute_multivector_local(Epetra_Comm &Comm, bool verbose)
int check_colpermute_crsmatrix(Epetra_Comm &Comm, bool verbose)