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;
203 int MyPID = Comm.
MyPID();
207 bool verbose1 = verbose;
209 if (verbose) verbose = (MyPID==0);
212 cerr <<
"================check_rowpermute_crsgraph_local_diagonal=========="
216 int NumMyElements = 5;
217 int NumGlobalElements = NumMyElements*NumProc;
219 Epetra_Map Map(NumGlobalElements, NumMyElements, 0, Comm);
221 int* p =
new int[NumMyElements];
222 int firstGlobalRow = MyPID*NumMyElements;
228 cout <<
"Permutation P:"<<endl;
233 for(i=0; i<NumMyElements; ++i) {
234 p[i] = firstGlobalRow+NumMyElements-1-i;
236 cout <<
"p["<<firstGlobalRow+i<<
"]: "<<p[i]<<endl;
247 for(i=0; i<NumMyElements; ++i) {
248 int row = firstGlobalRow+i;
257 cout <<
"*************** graph Agrph: ********************"<<endl;
258 cout << Agrph << endl;
266 cout <<
"************* permuted graph Bgrph: ****************"<<endl;
267 cout << Bgrph << endl;
279 int MyPID = Comm.
MyPID();
283 bool verbose1 = verbose;
285 if (verbose) verbose = (MyPID==0);
288 cerr <<
"================check_colpermute_crsgraph=========="
292 int NumMyElements = 5;
293 int NumGlobalElements = NumMyElements*NumProc;
295 Epetra_Map Map(NumGlobalElements, NumMyElements, 0, Comm);
297 int* p =
new int[NumMyElements];
298 int firstGlobalRow = MyPID*NumMyElements;
301 cout <<
"Permutation P:"<<endl;
306 for(i=0; i<NumMyElements; ++i) {
307 int row = firstGlobalRow+i;
308 p[i] = NumGlobalElements - row - 1;
310 cout <<
"p["<<firstGlobalRow+i<<
"]: "<<p[i]<<endl;
320 for(i=0; i<NumMyElements; ++i) {
321 int row = firstGlobalRow+i;
322 col = NumGlobalElements - row - 1;
331 if (col < NumGlobalElements-1) {
340 cout <<
"*************** graph Agrph: ********************"<<endl;
341 cout << Agrph << endl;
346 bool column_permutation =
true;
350 cout <<
"************* column-permuted graph Bgrph: ****************"<<endl;
351 cout << Bgrph << endl;
363 int MyPID = Comm.
MyPID();
367 bool verbose1 = verbose;
369 if (verbose) verbose = (MyPID==0);
372 cerr <<
"================check_rowpermute_crsmatrix_global_diagonal=========="
376 int NumMyElements = 5;
377 int NumGlobalElements = NumMyElements*NumProc;
379 Epetra_Map Map(NumGlobalElements, NumMyElements, 0, Comm);
381 int* p =
new int[NumMyElements];
382 int firstGlobalRow = MyPID*NumMyElements;
398 for(i=0; i<NumMyElements; ++i) {
399 int row = firstGlobalRow+i;
409 cout <<
"******************* matrix A: ****************************"<<endl;
414 cout <<
"Permutation P:"<<endl;
417 for(i=0; i<NumMyElements; ++i) {
418 int globalrow = NumGlobalElements-(firstGlobalRow+i)-1;
421 cout <<
"p["<<firstGlobalRow+i<<
"]: "<<p[i]<<endl;
430 cout <<
"******************* permuted matrix Bglobal: *******************" <<endl;
431 cout << Bglobal << endl;
443 int MyPID = Comm.
MyPID();
447 bool verbose1 = verbose;
449 if (verbose) verbose = (MyPID==0);
452 cerr <<
"================check_colpermute_crsmatrix=========="
456 int NumMyElements = 5;
457 int NumGlobalElements = NumMyElements*NumProc;
459 Epetra_Map Map(NumGlobalElements, NumMyElements, 0, Comm);
461 int* p =
new int[NumMyElements];
462 int firstGlobalRow = MyPID*NumMyElements;
465 cout <<
"Permutation P:"<<endl;
470 for(i=0; i<NumMyElements; ++i) {
471 int row = firstGlobalRow+i;
472 p[i] = NumGlobalElements - row - 1;
474 cout <<
"p["<<firstGlobalRow+i<<
"]: "<<p[i]<<endl;
485 for(i=0; i<NumMyElements; ++i) {
486 int row = firstGlobalRow+i;
487 col = NumGlobalElements - row - 1;
498 if (col < NumGlobalElements-1) {
508 cout <<
"*************** matrix A: ********************"<<endl;
514 bool column_permutation =
true;
518 cout <<
"************* column-permuted matrix B: ****************"<<endl;
531 int MyPID = Comm.
MyPID();
535 bool verbose1 = verbose;
537 if (verbose) verbose = (MyPID==0);
540 cerr <<
"================check_rowpermute_multivector_local=========="
544 int NumMyElements = 5;
545 int NumGlobalElements = NumMyElements*NumProc;
547 Epetra_Map Map(NumGlobalElements, NumMyElements, 0, Comm);
549 int* p =
new int[NumMyElements];
550 int firstGlobalRow = MyPID*NumMyElements;
556 cout <<
"Permutation P:"<<endl;
561 for(i=0; i<NumMyElements; ++i) {
562 p[i] = firstGlobalRow+NumMyElements-1-i;
564 cout <<
"p["<<firstGlobalRow+i<<
"]: "<<p[i]<<endl;
574 for(i=0; i<NumMyElements; ++i) {
575 v0[i] = 1.0*(firstGlobalRow+i) + 0.1;
576 v1[i] = 1.0*(firstGlobalRow+i) + 0.2;
577 v2[i] = 1.0*(firstGlobalRow+i) + 0.3;
581 cout <<
"*************** MultiVector v: ********************"<<endl;
590 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)