46 #include "Epetra_MpiComm.h" 48 #include "Epetra_SerialComm.h" 50 #include "Epetra_Comm.h" 51 #include "Epetra_Map.h" 52 #include "Epetra_MultiVector.h" 53 #include "Epetra_CrsMatrix.h" 59 void Test(
const std::string what, Epetra_RowMatrix& A)
66 bool UseTranspose =
true;
72 Epetra_MultiVector LHS_exact(A.OperatorDomainMap(), 2);
73 Epetra_MultiVector LHS(A.OperatorDomainMap(), 2);
74 Epetra_MultiVector
RHS(A.OperatorRangeMap(), 2);
76 LHS_exact.Random(); LHS.PutScalar(0.0);
78 A.Multiply(UseTranspose, LHS_exact,
RHS);
80 Prec.ApplyInverse(
RHS, LHS);
82 LHS.Update(1.0, LHS_exact, -1.0);
90 cout << what <<
": Test failed: norm = " << norm[0] << endl;
94 cout << what <<
": Test passed: norm = " << norm[0] << endl;
101 int main(
int argc,
char *argv[])
104 MPI_Init(&argc,&argv);
105 Epetra_MpiComm Comm (MPI_COMM_WORLD);
107 Epetra_SerialComm Comm;
110 if (Comm.NumProc() != 1)
112 cerr <<
"To be run with one processor only" << endl;
119 Epetra_Map Map(8, 0, Comm);
121 Epetra_CrsMatrix A(Copy, Map, 0);
125 for (
int row = 0; row < 8; ++row)
127 double value = 2.0 + row;
128 A.InsertGlobalValues(row, 1, &value, &row);
133 A.InsertGlobalValues(row, 1, &value, &col);
136 if (row != Map.NumGlobalElements() - 1)
140 A.InsertGlobalValues(row, 1, &value, &col);
147 Test<Ifpack_ILU>(
"Ifpack_ILU", A);
148 Test<Ifpack_ILUT>(
"Ifpack_ILUT", A);
149 Test<Ifpack_AdditiveSchwarz<Ifpack_ILU> >(
"AS, Ifpack_ILU", A);
150 Test<Ifpack_AdditiveSchwarz<Ifpack_ILUT> >(
"AS, Ifpack_ILUT", A);
156 return(EXIT_SUCCESS);
#define IFPACK_CHK_ERRV(ifpack_err)
int main(int argc, char *argv[])
void Test(const std::string what, Epetra_RowMatrix &A)