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 long long NumGlobalElements = ((
long long)NumMyElements)*NumProc;
141 Epetra_Map Map(NumGlobalElements, NumMyElements, 0, Comm);
143 long long* p =
new long long[NumMyElements];
144 long long firstGlobalRow = ((
long long)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 long long row = firstGlobalRow+i;
175 A.InsertGlobalValues(row, 1, &val, &col);
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 long long NumGlobalElements = ((
long long)NumMyElements)*NumProc;
217 Epetra_Map Map(NumGlobalElements, NumMyElements, 0, Comm);
219 long long* p =
new long long[NumMyElements];
220 long long firstGlobalRow = ((
long long)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 long long row = firstGlobalRow+i;
249 Agrph.InsertGlobalIndices(row, 1, &col);
252 Agrph.FillComplete();
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 long long NumGlobalElements = ((
long long)NumMyElements)*NumProc;
291 Epetra_Map Map(NumGlobalElements, NumMyElements, 0, Comm);
293 long long* p =
new long long[NumMyElements];
294 long long firstGlobalRow = ((
long long)MyPID)*NumMyElements;
297 cout <<
"Permutation P:"<<endl;
302 for(i=0; i<NumMyElements; ++i) {
303 long long 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 long long row = firstGlobalRow+i;
318 col = NumGlobalElements - row - 1;
320 Agrph.InsertGlobalIndices(row, 1, &col);
323 long long colm1 = col-1;
324 Agrph.InsertGlobalIndices(row, 1, &colm1);
327 if (col < NumGlobalElements-1) {
328 long long colp1 = col+1;
329 Agrph.InsertGlobalIndices(row, 1, &colp1);
333 Agrph.FillComplete();
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 long long NumGlobalElements = ((
long long)NumMyElements)*NumProc;
375 Epetra_Map Map(NumGlobalElements, NumMyElements, 0, Comm);
377 long long* p =
new long long[NumMyElements];
378 long long firstGlobalRow = ((
long long)MyPID)*NumMyElements;
394 for(i=0; i<NumMyElements; ++i) {
395 long long row = firstGlobalRow+i;
399 A.InsertGlobalValues(row, 1, &val, &col);
405 cout <<
"******************* matrix A: ****************************"<<endl;
410 cout <<
"Permutation P:"<<endl;
413 for(i=0; i<NumMyElements; ++i) {
414 long long 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 long long NumGlobalElements = ((
long long)NumMyElements)*NumProc;
453 Epetra_Map Map(NumGlobalElements, NumMyElements, 0, Comm);
455 long long* p =
new long long[NumMyElements];
456 long long firstGlobalRow = ((
long long)MyPID)*NumMyElements;
459 cout <<
"Permutation P:"<<endl;
464 for(i=0; i<NumMyElements; ++i) {
465 long long 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 long long row = firstGlobalRow+i;
481 col = NumGlobalElements - row - 1;
484 A.InsertGlobalValues(row, 1, &val, &col);
487 long long colm1 = col-1;
489 A.InsertGlobalValues(row, 1, &val, &colm1);
492 if (col < NumGlobalElements-1) {
493 long long colp1 = col+1;
495 A.InsertGlobalValues(row, 1, &val, &colp1);
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 long long NumGlobalElements = ((
long long)NumMyElements)*NumProc;
541 Epetra_Map Map(NumGlobalElements, NumMyElements, 0, Comm);
543 long long* p =
new long long[NumMyElements];
544 long long firstGlobalRow = ((
long long)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;
#define EPETRA_CHK_ERR(a)
std::string EpetraExt_Version()
virtual void Barrier() const =0
int check_colpermute_crsgraph(Epetra_Comm &Comm, bool verbose)
virtual int MyPID() const =0
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)