43 #include "Ifpack_ConfigDefs.h" 44 #include "Ifpack_Preconditioner.h" 46 #include "Epetra_Comm.h" 47 #include "Epetra_CrsMatrix.h" 48 #include "Epetra_CrsGraph.h" 49 #include "Epetra_Map.h" 50 #include "Epetra_BlockMap.h" 51 #include "Epetra_Import.h" 52 #include "Epetra_MultiVector.h" 53 #include "Epetra_Vector.h" 57 cout <<
"================================================================================" << endl;
65 if (Comm.MyPID() == 0) cout <<
"Host and Process Ids for tasks" << endl;
66 for (
int i = 0; i <Comm.NumProc() ; i++) {
67 if (i == Comm.MyPID() ) {
68 #if defined(TFLOP) || defined(JANUS_STLPORT) 69 sprintf(buf,
"Host: %s PID: %d",
"janus", getpid());
71 sprintf(buf,
"Windows compiler, unknown hostname and PID!");
73 gethostname(hostname,
sizeof(hostname));
74 sprintf(buf,
"Host: %s\tComm.MyPID(): %d\tPID: %d",
75 hostname, Comm.MyPID(), getpid());
79 #if !( defined(_WIN32) ) 84 if(Comm.MyPID() == 0) {
86 printf(
"** Pausing to attach debugger...\n");
87 printf(
"** You may now attach debugger to the processes listed above.\n");
89 printf(
"** Enter a character to continue > "); fflush(stdout);
100 const int OverlappingLevel)
103 if (OverlappingLevel == 0)
105 if (Matrix->Comm().NumProc() == 1)
108 Epetra_CrsMatrix* OverlappingMatrix;
109 OverlappingMatrix = 0;
110 Epetra_Map* OverlappingMap;
111 OverlappingMap = (Epetra_Map*)&(Matrix->RowMatrixRowMap());
113 const Epetra_RowMatrix* OldMatrix;
114 const Epetra_Map* DomainMap = &(Matrix->OperatorDomainMap());
115 const Epetra_Map* RangeMap = &(Matrix->OperatorRangeMap());
117 for (
int level = 1; level <= OverlappingLevel ; ++level) {
119 if (OverlappingMatrix)
120 OldMatrix = OverlappingMatrix;
124 Epetra_Import* OverlappingImporter;
125 OverlappingImporter = (Epetra_Import*)OldMatrix->RowMatrixImporter();
126 int NumMyElements = OverlappingImporter->TargetMap().NumMyElements();
127 int* MyGlobalElements = OverlappingImporter->TargetMap().MyGlobalElements();
132 OverlappingMap =
new Epetra_Map(-1,NumMyElements,MyGlobalElements,
135 if (level < OverlappingLevel)
136 OverlappingMatrix =
new Epetra_CrsMatrix(Copy, *OverlappingMap, 0);
141 OverlappingMatrix =
new Epetra_CrsMatrix(Copy, *OverlappingMap,
144 OverlappingMatrix->Import(*OldMatrix, *OverlappingImporter, Insert);
145 if (level < OverlappingLevel) {
146 OverlappingMatrix->FillComplete(*DomainMap, *RangeMap);
149 OverlappingMatrix->FillComplete(*DomainMap, *RangeMap);
152 delete OverlappingMap;
157 OverlappingMatrix->FillComplete();
161 return(OverlappingMatrix);
166 const int OverlappingLevel)
169 if (OverlappingLevel == 0)
171 if (Graph->Comm().NumProc() == 1)
174 Epetra_CrsGraph* OverlappingGraph;
175 Epetra_BlockMap* OverlappingMap;
176 OverlappingGraph =
const_cast<Epetra_CrsGraph*
>(Graph);
177 OverlappingMap =
const_cast<Epetra_BlockMap*
>(&(Graph->RowMap()));
179 Epetra_CrsGraph* OldGraph;
180 Epetra_BlockMap* OldMap;
181 const Epetra_BlockMap* DomainMap = &(Graph->DomainMap());
182 const Epetra_BlockMap* RangeMap = &(Graph->RangeMap());
184 for (
int level = 1; level <= OverlappingLevel ; ++level) {
186 OldGraph = OverlappingGraph;
187 OldMap = OverlappingMap;
189 Epetra_Import* OverlappingImporter;
190 OverlappingImporter =
const_cast<Epetra_Import*
>(OldGraph->Importer());
191 OverlappingMap =
new Epetra_BlockMap(OverlappingImporter->TargetMap());
193 if (level < OverlappingLevel)
194 OverlappingGraph =
new Epetra_CrsGraph(Copy, *OverlappingMap, 0);
199 OverlappingGraph =
new Epetra_CrsGraph(Copy, *OverlappingMap,
202 OverlappingGraph->Import(*OldGraph, *OverlappingImporter, Insert);
203 if (level < OverlappingLevel)
204 OverlappingGraph->FillComplete(*DomainMap, *RangeMap);
207 OverlappingImporter =
new Epetra_Import(*OverlappingMap, *DomainMap);
208 OverlappingGraph->FillComplete(*DomainMap, *RangeMap);
216 delete OverlappingMap;
217 OverlappingGraph->FillComplete();
221 return(OverlappingGraph);
242 const Epetra_MultiVector& X,
const Epetra_MultiVector&Y)
244 if (X.Comm().MyPID() == 0) {
245 cout <<
"***** " << Label << endl;
254 const Epetra_MultiVector& X,
const Epetra_MultiVector&Y)
256 Epetra_MultiVector RHS(X);
257 std::vector<double> Norm2;
258 Norm2.resize(X.NumVectors());
260 IFPACK_CHK_ERR(A.Multiply(
false,X,RHS));
261 RHS.Update(1.0, Y, -1.0);
263 RHS.Norm2(&Norm2[0]);
265 if (X.Comm().MyPID() == 0) {
266 cout <<
"***** iter: " << iter <<
": ||Ax - b||_2 = " 276 void Ifpack_PrintSparsity_Simple(
const Epetra_RowMatrix& A)
278 int MaxEntries = A.MaxNumEntries();
279 vector<int> Indices(MaxEntries);
280 vector<double> Values(MaxEntries);
281 vector<bool> FullRow(A.NumMyRows());
284 for (
int j = 0 ; j < A.NumMyRows() ; ++j)
286 cout <<
"-+" << endl;
288 for (
int i = 0 ; i < A.NumMyRows() ; ++i) {
291 A.ExtractMyRowCopy(i,MaxEntries,Length,
292 &Values[0], &Indices[0]);
294 for (
int j = 0 ; j < A.NumMyRows() ; ++j)
297 for (
int j = 0 ; j < Length ; ++j) {
298 FullRow[Indices[j]] =
true;
302 for (
int j = 0 ; j < A.NumMyRows() ; ++j) {
308 cout <<
" |" << endl;
312 for (
int j = 0 ; j < A.NumMyRows() ; ++j)
314 cout <<
"-+" << endl << endl;
320 double Ifpack_FrobeniusNorm(
const Epetra_RowMatrix& A)
322 double MyNorm = 0.0, GlobalNorm;
324 vector<int> colInd(A.MaxNumEntries());
325 vector<double> colVal(A.MaxNumEntries());
327 for (
int i = 0 ; i < A.NumMyRows() ; ++i) {
330 IFPACK_CHK_ERR(A.ExtractMyRowCopy(i,A.MaxNumEntries(),Nnz,
331 &colVal[0],&colInd[0]));
333 for (
int j = 0 ; j < Nnz ; ++j) {
334 MyNorm += colVal[j] * colVal[j];
338 A.Comm().SumAll(&MyNorm,&GlobalNorm,1);
340 return(sqrt(GlobalNorm));
350 static void print(
const char str[], T val)
352 cout.width(30); cout.setf(ios::left);
354 cout <<
" = " << val << endl;
358 static void print(
const char str[], T val,
double percentage)
360 cout.width(30); cout.setf(ios::left);
363 cout.width(20); cout.setf(ios::left);
365 cout <<
" ( " << percentage <<
" %)" << endl;
368 static void print(
const char str[], T one, T two, T three,
bool equal =
true)
370 cout.width(30); cout.setf(ios::left);
376 cout.width(15); cout.setf(ios::left);
378 cout.width(15); cout.setf(ios::left);
380 cout.width(15); cout.setf(ios::left);
388 #include "Epetra_FECrsMatrix.h" 391 const int NumPDEEqns)
394 int NumMyRows = A.NumMyRows();
395 int NumGlobalRows = A.NumGlobalRows();
396 int NumGlobalCols = A.NumGlobalCols();
397 int MyBandwidth = 0, GlobalBandwidth;
398 int MyLowerNonzeros = 0, MyUpperNonzeros = 0;
399 int GlobalLowerNonzeros, GlobalUpperNonzeros;
400 int MyDiagonallyDominant = 0, GlobalDiagonallyDominant;
401 int MyWeaklyDiagonallyDominant = 0, GlobalWeaklyDiagonallyDominant;
402 double MyMin, MyAvg, MyMax;
403 double GlobalMin, GlobalAvg, GlobalMax;
406 bool verbose = (A.Comm().MyPID() == 0);
408 GlobalStorage =
sizeof(
int*) * NumGlobalRows +
409 sizeof(
int) * A.NumGlobalNonzeros() +
410 sizeof(double) * A.NumGlobalNonzeros();
415 print<const char*>(
"Label", A.Label());
416 print<int>(
"Global rows", NumGlobalRows);
417 print<int>(
"Global columns", NumGlobalCols);
418 print<int>(
"Stored nonzeros", A.NumGlobalNonzeros());
419 print<int>(
"Nonzeros / row", A.NumGlobalNonzeros() / NumGlobalRows);
420 print<double>(
"Estimated storage (Mbytes)", 1.0e-6 * GlobalStorage);
423 int NumMyActualNonzeros = 0, NumGlobalActualNonzeros;
424 int NumMyEmptyRows = 0, NumGlobalEmptyRows;
425 int NumMyDirichletRows = 0, NumGlobalDirichletRows;
427 vector<int> colInd(A.MaxNumEntries());
428 vector<double> colVal(A.MaxNumEntries());
430 Epetra_Vector Diag(A.RowMatrixRowMap());
431 Epetra_Vector RowSum(A.RowMatrixRowMap());
433 RowSum.PutScalar(0.0);
435 for (
int i = 0 ; i < NumMyRows ; ++i) {
437 int GRID = A.RowMatrixRowMap().GID(i);
439 IFPACK_CHK_ERR(A.ExtractMyRowCopy(i,A.MaxNumEntries(),Nnz,
440 &colVal[0],&colInd[0]));
446 NumMyDirichletRows++;
448 for (
int j = 0 ; j < Nnz ; ++j) {
450 double v = colVal[j];
452 if (colVal[j] != 0.0)
453 NumMyActualNonzeros++;
455 int GCID = A.RowMatrixColMap().GID(colInd[j]);
464 else if (GCID > GRID)
472 if (Diag[i] > RowSum[i])
473 MyDiagonallyDominant++;
475 if (Diag[i] >= RowSum[i])
476 MyWeaklyDiagonallyDominant++;
478 RowSum[i] += Diag[i];
485 A.Comm().SumAll(&MyDiagonallyDominant,&GlobalDiagonallyDominant,1);
486 A.Comm().SumAll(&MyWeaklyDiagonallyDominant,&GlobalWeaklyDiagonallyDominant,1);
487 A.Comm().SumAll(&NumMyActualNonzeros, &NumGlobalActualNonzeros, 1);
488 A.Comm().SumAll(&NumMyEmptyRows, &NumGlobalEmptyRows, 1);
489 A.Comm().SumAll(&NumMyDirichletRows, &NumGlobalDirichletRows, 1);
490 A.Comm().SumAll(&MyBandwidth, &GlobalBandwidth, 1);
491 A.Comm().SumAll(&MyLowerNonzeros, &GlobalLowerNonzeros, 1);
492 A.Comm().SumAll(&MyUpperNonzeros, &GlobalUpperNonzeros, 1);
493 A.Comm().SumAll(&MyDiagonallyDominant, &GlobalDiagonallyDominant, 1);
494 A.Comm().SumAll(&MyWeaklyDiagonallyDominant, &GlobalWeaklyDiagonallyDominant, 1);
496 double NormOne = A.NormOne();
497 double NormInf = A.NormInf();
498 double NormF = Ifpack_FrobeniusNorm(A);
502 print<int>(
"Actual nonzeros", NumGlobalActualNonzeros);
503 print<int>(
"Nonzeros in strict lower part", GlobalLowerNonzeros);
504 print<int>(
"Nonzeros in strict upper part", GlobalUpperNonzeros);
506 print<int>(
"Empty rows", NumGlobalEmptyRows,
507 100.0 * NumGlobalEmptyRows / NumGlobalRows);
508 print<int>(
"Dirichlet rows", NumGlobalDirichletRows,
509 100.0 * NumGlobalDirichletRows / NumGlobalRows);
510 print<int>(
"Diagonally dominant rows", GlobalDiagonallyDominant,
511 100.0 * GlobalDiagonallyDominant / NumGlobalRows);
512 print<int>(
"Weakly diag. dominant rows",
513 GlobalWeaklyDiagonallyDominant,
514 100.0 * GlobalWeaklyDiagonallyDominant / NumGlobalRows);
516 print<int>(
"Maximum bandwidth", GlobalBandwidth);
519 print(
"",
"one-norm",
"inf-norm",
"Frobenius",
false);
520 print(
"",
"========",
"========",
"=========",
false);
523 print<double>(
"A", NormOne, NormInf, NormF);
526 if (Cheap ==
false) {
530 Epetra_FECrsMatrix AplusAT(Copy, A.RowMatrixRowMap(), 0);
531 Epetra_FECrsMatrix AminusAT(Copy, A.RowMatrixRowMap(), 0);
533 for (
int i = 0 ; i < NumMyRows ; ++i) {
535 int GRID = A.RowMatrixRowMap().GID(i);
539 IFPACK_CHK_ERR(A.ExtractMyRowCopy(i,A.MaxNumEntries(),Nnz,
540 &colVal[0],&colInd[0]));
542 for (
int j = 0 ; j < Nnz ; ++j) {
544 int GCID = A.RowMatrixColMap().GID(colInd[j]);
547 double plus_val = colVal[j];
548 double minus_val = -colVal[j];
550 if (AplusAT.SumIntoGlobalValues(1,&GRID,1,&GCID,&plus_val) != 0) {
551 IFPACK_CHK_ERR(AplusAT.InsertGlobalValues(1,&GRID,1,&GCID,&plus_val));
554 if (AplusAT.SumIntoGlobalValues(1,&GCID,1,&GRID,&plus_val) != 0) {
555 IFPACK_CHK_ERR(AplusAT.InsertGlobalValues(1,&GCID,1,&GRID,&plus_val));
558 if (AminusAT.SumIntoGlobalValues(1,&GRID,1,&GCID,&plus_val) != 0) {
559 IFPACK_CHK_ERR(AminusAT.InsertGlobalValues(1,&GRID,1,&GCID,&plus_val));
562 if (AminusAT.SumIntoGlobalValues(1,&GCID,1,&GRID,&minus_val) != 0) {
563 IFPACK_CHK_ERR(AminusAT.InsertGlobalValues(1,&GCID,1,&GRID,&minus_val));
569 AplusAT.FillComplete();
570 AminusAT.FillComplete();
575 NormOne = AplusAT.NormOne();
576 NormInf = AplusAT.NormInf();
577 NormF = Ifpack_FrobeniusNorm(AplusAT);
580 print<double>(
"A + A^T", NormOne, NormInf, NormF);
583 NormOne = AminusAT.NormOne();
584 NormInf = AminusAT.NormInf();
585 NormF = Ifpack_FrobeniusNorm(AminusAT);
588 print<double>(
"A - A^T", NormOne, NormInf, NormF);
594 print<const char*>(
"",
"min",
"avg",
"max",
false);
595 print<const char*>(
"",
"===",
"===",
"===",
false);
602 for (
int i = 0 ; i < NumMyRows ; ++i) {
605 IFPACK_CHK_ERR(A.ExtractMyRowCopy(i,A.MaxNumEntries(),Nnz,
606 &colVal[0],&colInd[0]));
608 for (
int j = 0 ; j < Nnz ; ++j) {
610 if (colVal[j] > MyMax) MyMax = colVal[j];
611 if (colVal[j] < MyMin) MyMin = colVal[j];
615 A.Comm().MaxAll(&MyMax, &GlobalMax, 1);
616 A.Comm().MinAll(&MyMin, &GlobalMin, 1);
617 A.Comm().SumAll(&MyAvg, &GlobalAvg, 1);
618 GlobalAvg /= A.NumGlobalNonzeros();
622 print<double>(
" A(i,j)", GlobalMin, GlobalAvg, GlobalMax);
629 for (
int i = 0 ; i < NumMyRows ; ++i) {
632 IFPACK_CHK_ERR(A.ExtractMyRowCopy(i,A.MaxNumEntries(),Nnz,
633 &colVal[0],&colInd[0]));
635 for (
int j = 0 ; j < Nnz ; ++j) {
636 double v = colVal[j];
639 if (colVal[j] > MyMax) MyMax = v;
640 if (colVal[j] < MyMin) MyMin = v;
644 A.Comm().MaxAll(&MyMax, &GlobalMax, 1);
645 A.Comm().MinAll(&MyMin, &GlobalMin, 1);
646 A.Comm().SumAll(&MyAvg, &GlobalAvg, 1);
647 GlobalAvg /= A.NumGlobalNonzeros();
650 print<double>(
"|A(i,j)|", GlobalMin, GlobalAvg, GlobalMax);
657 Diag.MinValue(&GlobalMin);
658 Diag.MaxValue(&GlobalMax);
659 Diag.MeanValue(&GlobalAvg);
663 print<double>(
" A(k,k)", GlobalMin, GlobalAvg, GlobalMax);
667 Diag.MinValue(&GlobalMin);
668 Diag.MaxValue(&GlobalMax);
669 Diag.MeanValue(&GlobalAvg);
671 print<double>(
"|A(k,k)|", GlobalMin, GlobalAvg, GlobalMax);
678 if (NumPDEEqns > 1 ) {
680 if (verbose) print();
682 for (
int ie = 0 ; ie < NumPDEEqns ; ie++) {
688 for (
int i = ie ; i < Diag.MyLength() ; i += NumPDEEqns) {
696 A.Comm().MinAll(&MyMin, &GlobalMin, 1);
697 A.Comm().MaxAll(&MyMax, &GlobalMax, 1);
698 A.Comm().SumAll(&MyAvg, &GlobalAvg, 1);
701 GlobalAvg /= (Diag.GlobalLength() / NumPDEEqns);
705 sprintf(str,
" A(k,k), eq %d", ie);
706 print<double>(str, GlobalMin, GlobalAvg, GlobalMax);
715 RowSum.MinValue(&GlobalMin);
716 RowSum.MaxValue(&GlobalMax);
717 RowSum.MeanValue(&GlobalAvg);
721 print<double>(
" sum_j A(k,j)", GlobalMin, GlobalAvg, GlobalMax);
728 if (NumPDEEqns > 1 ) {
730 if (verbose) print();
732 for (
int ie = 0 ; ie < NumPDEEqns ; ie++) {
738 for (
int i = ie ; i < Diag.MyLength() ; i += NumPDEEqns) {
739 double d = RowSum[i];
746 A.Comm().MinAll(&MyMin, &GlobalMin, 1);
747 A.Comm().MaxAll(&MyMax, &GlobalMax, 1);
748 A.Comm().SumAll(&MyAvg, &GlobalAvg, 1);
751 GlobalAvg /= (Diag.GlobalLength() / NumPDEEqns);
755 sprintf(str,
" sum_j A(k,j), eq %d", ie);
756 print<double>(str, GlobalMin, GlobalAvg, GlobalMax);
768 const bool abs,
const int steps)
771 bool verbose = (Diagonal.Comm().MyPID() == 0);
772 double min_val = DBL_MAX;
773 double max_val = -DBL_MAX;
775 for (
int i = 0 ; i < Diagonal.MyLength() ; ++i) {
776 double v = Diagonal[i];
788 cout <<
"Vector label = " << Diagonal.Label() << endl;
792 double delta = (max_val - min_val) / steps;
793 for (
int k = 0 ; k < steps ; ++k) {
795 double below = delta * k + min_val;
796 double above = below + delta;
797 int MyBelow = 0, GlobalBelow;
799 for (
int i = 0 ; i < Diagonal.MyLength() ; ++i) {
800 double v = Diagonal[i];
802 if (v >= below && v < above) MyBelow++;
805 Diagonal.Comm().SumAll(&MyBelow, &GlobalBelow, 1);
808 printf(
"Elements in [%+7e, %+7e) = %10d ( = %5.2f %%)\n",
809 below, above, GlobalBelow,
810 100.0 * GlobalBelow / Diagonal.GlobalLength());
825 const bool abs,
const int steps)
828 bool verbose = (A.Comm().MyPID() == 0);
829 double min_val = DBL_MAX;
830 double max_val = -DBL_MAX;
832 vector<int> colInd(A.MaxNumEntries());
833 vector<double> colVal(A.MaxNumEntries());
835 for (
int i = 0 ; i < A.NumMyRows() ; ++i) {
838 IFPACK_CHK_ERR(A.ExtractMyRowCopy(i,A.MaxNumEntries(),Nnz,
839 &colVal[0],&colInd[0]));
841 for (
int j = 0 ; j < Nnz ; ++j) {
842 double v = colVal[j];
855 cout <<
"Label of matrix = " << A.Label() << endl;
859 double delta = (max_val - min_val) / steps;
860 for (
int k = 0 ; k < steps ; ++k) {
862 double below = delta * k + min_val;
863 double above = below + delta;
864 int MyBelow = 0, GlobalBelow;
866 for (
int i = 0 ; i < A.NumMyRows() ; ++i) {
869 IFPACK_CHK_ERR(A.ExtractMyRowCopy(i,A.MaxNumEntries(),Nnz,
870 &colVal[0],&colInd[0]));
872 for (
int j = 0 ; j < Nnz ; ++j) {
873 double v = colVal[j];
876 if (v >= below && v < above) MyBelow++;
880 A.Comm().SumAll(&MyBelow, &GlobalBelow, 1);
882 printf(
"Elements in [%+7e, %+7e) = %10d ( = %5.2f %%)\n",
883 below, above, GlobalBelow,
884 100.0 * GlobalBelow / A.NumGlobalNonzeros());
897 int Ifpack_PrintSparsity(
const Epetra_RowMatrix& A,
const char* InputFileName,
898 const int NumPDEEqns)
901 int m,nc,nr,maxdim,ltit;
902 double lrmrgn,botmrgn,xtit,ytit,ytitof,fnstit,siz = 0.0;
903 double xl,xr, yb,yt, scfct,u2dot,frlw,delt,paperx;
921 const Epetra_Comm& Comm = A.Comm();
925 if (strlen(A.Label()) != 0)
926 strcpy(title, A.Label());
928 sprintf(title,
"%s",
"matrix");
930 if (InputFileName == 0)
931 sprintf(FileName,
"%s.ps", title);
933 strcpy(FileName, InputFileName);
935 MyPID = Comm.MyPID();
936 NumProc = Comm.NumProc();
938 NumMyRows = A.NumMyRows();
941 NumGlobalRows = A.NumGlobalRows();
942 NumGlobalCols = A.NumGlobalCols();
944 if (NumGlobalRows != NumGlobalCols)
948 maxdim = (NumGlobalRows>NumGlobalCols)?NumGlobalRows:NumGlobalCols;
949 maxdim /= NumPDEEqns;
952 nr = NumGlobalRows / NumPDEEqns + 1;
953 nc = NumGlobalCols / NumPDEEqns + 1;
968 lrmrgn = (paperx-siz)/2.0;
984 ltit = strlen(title);
990 ytit = botmrgn+siz*nr/m + ytitof;
992 xl = lrmrgn*u2dot - scfct*frlw/2;
993 xr = (lrmrgn+siz)*u2dot + scfct*frlw/2;
994 yb = botmrgn*u2dot - scfct*frlw/2;
995 yt = (botmrgn+siz*nr/m)*u2dot + scfct*frlw/2;
997 yt = yt + (ytitof+fnstit*0.70)*u2dot;
1007 if ((ptitle == 0) && (ltit == 0)) {
1008 ytit = botmrgn + fnstit*0.3;
1009 botmrgn = botmrgn + ytitof + fnstit*0.7;
1016 fp = fopen(FileName,
"w");
1018 fprintf(fp,
"%s",
"%%!PS-Adobe-2.0\n");
1019 fprintf(fp,
"%s",
"%%Creator: IFPACK\n");
1020 fprintf(fp,
"%%%%BoundingBox: %f %f %f %f\n",
1022 fprintf(fp,
"%s",
"%%EndComments\n");
1023 fprintf(fp,
"%s",
"/cm {72 mul 2.54 div} def\n");
1024 fprintf(fp,
"%s",
"/mc {72 div 2.54 mul} def\n");
1025 fprintf(fp,
"%s",
"/pnum { 72 div 2.54 mul 20 string ");
1026 fprintf(fp,
"%s",
"cvs print ( ) print} def\n");
1027 fprintf(fp,
"%s",
"/Cshow {dup stringwidth pop -2 div 0 rmoveto show} def\n");
1031 fprintf(fp,
"%s",
"gsave\n");
1033 fprintf(fp,
"/Helvetica findfont %e cm scalefont setfont\n",
1035 fprintf(fp,
"%f cm %f cm moveto\n",
1037 fprintf(fp,
"(%s) Cshow\n", title);
1038 fprintf(fp,
"%f cm %f cm translate\n",
1041 fprintf(fp,
"%f cm %d div dup scale \n",
1045 fprintf(fp,
"%f setlinewidth\n",
1047 fprintf(fp,
"%s",
"newpath\n");
1048 fprintf(fp,
"%s",
"0 0 moveto ");
1050 printf(
"------------------- %d\n",m);
1051 fprintf(fp,
"%d %d lineto\n",
1053 fprintf(fp,
"%d %d lineto\n",
1055 fprintf(fp,
"%d %d lineto\n",
1059 fprintf(fp,
"%d %d lineto\n",
1061 fprintf(fp,
"%d %d lineto\n",
1063 fprintf(fp,
"%d %d lineto\n",
1066 fprintf(fp,
"%s",
"closepath stroke\n");
1070 fprintf(fp,
"%s",
"1 1 translate\n");
1071 fprintf(fp,
"%s",
"0.8 setlinewidth\n");
1072 fprintf(fp,
"%s",
"/p {moveto 0 -.40 rmoveto \n");
1073 fprintf(fp,
"%s",
" 0 .80 rlineto stroke} def\n");
1078 int MaxEntries = A.MaxNumEntries();
1079 vector<int> Indices(MaxEntries);
1080 vector<double> Values(MaxEntries);
1082 for (
int pid = 0 ; pid < NumProc ; ++pid) {
1086 fp = fopen(FileName,
"a");
1088 fprintf(stderr,
"%s",
"ERROR\n");
1092 for (
int i = 0 ; i < NumMyRows ; ++i) {
1094 if (i % NumPDEEqns)
continue;
1097 A.ExtractMyRowCopy(i,MaxEntries,Nnz,&Values[0],&Indices[0]);
1099 int grow = A.RowMatrixRowMap().GID(i);
1101 for (
int j = 0 ; j < Nnz ; ++j) {
1102 int col = Indices[j];
1103 if (col % NumPDEEqns == 0) {
1104 int gcol = A.RowMatrixColMap().GID(Indices[j]);
1107 fprintf(fp,
"%d %d p\n",
1108 gcol, NumGlobalRows - grow - 1);
1113 fprintf(fp,
"%s",
"%end of data for this process\n");
1115 if( pid == NumProc - 1 )
1116 fprintf(fp,
"%s",
"showpage\n");
int Ifpack_Analyze(const Epetra_RowMatrix &A, const bool Cheap=false, const int NumPDEEqns=1)
Analyzes the basic properties of the input matrix A; see Usage of Ifpack_Analyze()..
string Ifpack_toString(const int &x)
Convertes an integer to string.
int Ifpack_AnalyzeVectorElements(const Epetra_Vector &Diagonal, const bool abs=false, const int steps=10)
Analyzes the distribution of values of the input vector Diagonal.
int Ifpack_AnalyzeMatrixElements(const Epetra_RowMatrix &A, const bool abs=false, const int steps=10)
Analyzes the distribution of values of the input matrix A.
void Ifpack_PrintLine()
Prints a line of `=' on cout.
Epetra_CrsMatrix * Ifpack_CreateOverlappingCrsMatrix(const Epetra_RowMatrix *Matrix, const int OverlappingLevel)
Creates an overlapping Epetra_CrsMatrix. Returns 0 if OverlappingLevel is 0.
void Ifpack_BreakForDebugger(Epetra_Comm &Comm)
Stops the execution of code, so that a debugger can be attached.
int Ifpack_PrintResidual(char *Label, const Epetra_RowMatrix &A, const Epetra_MultiVector &X, const Epetra_MultiVector &Y)
Prints on cout the true residual.