//============================================================================== Ifpack_IlukGraph::Ifpack_IlukGraph(const Ifpack_IlukGraph & Graph_in) : Graph_(Graph_in.Graph_), DomainMap_(Graph_in.DomainMap()), RangeMap_(Graph_in.RangeMap()), Comm_(Graph_in.Comm()), OverlapGraph_(Graph_in.OverlapGraph_), OverlapRowMap_(Graph_in.OverlapRowMap_), OverlapImporter_(Graph_in.OverlapImporter_), LevelFill_(Graph_in.LevelFill_), LevelOverlap_(Graph_in.LevelOverlap_), IndexBase_(Graph_in.IndexBase_), NumGlobalRows_(Graph_in.NumGlobalRows_), NumGlobalCols_(Graph_in.NumGlobalCols_), NumGlobalBlockRows_(Graph_in.NumGlobalBlockRows_), NumGlobalBlockCols_(Graph_in.NumGlobalBlockCols_), NumGlobalBlockDiagonals_(Graph_in.NumGlobalBlockDiagonals_), NumGlobalNonzeros_(Graph_in.NumGlobalNonzeros_), NumGlobalEntries_(Graph_in.NumGlobalEntries_), NumMyBlockRows_(Graph_in.NumMyBlockRows_), NumMyBlockCols_(Graph_in.NumMyBlockCols_), NumMyRows_(Graph_in.NumMyRows_), NumMyCols_(Graph_in.NumMyCols_), NumMyBlockDiagonals_(Graph_in.NumMyBlockDiagonals_), NumMyNonzeros_(Graph_in.NumMyNonzeros_), NumMyEntries_(Graph_in.NumMyEntries_) { Epetra_CrsGraph & L_Graph_In = Graph_in.L_Graph(); Epetra_CrsGraph & U_Graph_In = Graph_in.U_Graph(); L_Graph_ = Teuchos::rcp( new Epetra_CrsGraph(L_Graph_In) ); U_Graph_ = Teuchos::rcp( new Epetra_CrsGraph(U_Graph_In) ); }
int check(Epetra_CrsGraph& L, Epetra_CrsGraph& U, Ifpack_IlukGraph& LU, int NumGlobalRows1, int NumMyRows1, int LevelFill1, bool verbose) { using std::cout; using std::endl; int i, j; int NumIndices, * Indices; int NumIndices1, * Indices1; bool debug = true; Epetra_CrsGraph& L1 = LU.L_Graph(); Epetra_CrsGraph& U1 = LU.U_Graph(); // Test entries and count nonzeros int Nout = 0; for (i=0; i<LU.NumMyRows(); i++) { assert(L.ExtractMyRowView(i, NumIndices, Indices)==0); assert(L1.ExtractMyRowView(i, NumIndices1, Indices1)==0); assert(NumIndices==NumIndices1); for (j=0; j<NumIndices1; j++) { if (debug &&(Indices[j]!=Indices1[j])) { int MyPID = L.RowMap().Comm().MyPID(); cout << "Proc " << MyPID << " Local Row = " << i << " L.Indices["<< j <<"] = " << Indices[j] << " L1.Indices["<< j <<"] = " << Indices1[j] << endl; } assert(Indices[j]==Indices1[j]); } Nout += (NumIndices-NumIndices1); assert(U.ExtractMyRowView(i, NumIndices, Indices)==0); assert(U1.ExtractMyRowView(i, NumIndices1, Indices1)==0); assert(NumIndices==NumIndices1); for (j=0; j<NumIndices1; j++) { if (debug &&(Indices[j]!=Indices1[j])) { int MyPID = L.RowMap().Comm().MyPID(); cout << "Proc " << MyPID << " Local Row = " << i << " U.Indices["<< j <<"] = " << Indices[j] << " U1.Indices["<< j <<"] = " << Indices1[j] << endl; } assert(Indices[j]==Indices1[j]); } Nout += (NumIndices-NumIndices1); } // Test query functions int NumGlobalRows = LU.NumGlobalRows(); if (verbose) cout << "\n\nNumber of Global Rows = " << NumGlobalRows << endl<< endl; assert(NumGlobalRows==NumGlobalRows1); int NumGlobalNonzeros = LU.NumGlobalNonzeros(); if (verbose) cout << "\n\nNumber of Global Nonzero entries = " << NumGlobalNonzeros << endl<< endl; int NoutG = 0; L.RowMap().Comm().SumAll(&Nout, &NoutG, 1); assert(NumGlobalNonzeros==L.NumGlobalNonzeros()+U.NumGlobalNonzeros()-NoutG); int NumMyRows = LU.NumMyRows(); if (verbose) cout << "\n\nNumber of Rows = " << NumMyRows << endl<< endl; assert(NumMyRows==NumMyRows1); int NumMyNonzeros = LU.NumMyNonzeros(); if (verbose) cout << "\n\nNumber of Nonzero entries = " << NumMyNonzeros << endl<< endl; assert(NumMyNonzeros==L.NumMyNonzeros()+U.NumMyNonzeros()-Nout); if (verbose) cout << "\n\nLU check OK" << endl<< endl; return(0); }