44 #include "Epetra_Object.h"
45 #include "Epetra_Comm.h"
46 #include "Epetra_Import.h"
48 #include <Teuchos_ParameterList.hpp>
54 DomainMap_(Graph_in.DomainMap()),
55 RangeMap_(Graph_in.RangeMap()),
56 Comm_(Graph_in.Comm()),
57 LevelFill_(LevelFill_in),
58 LevelOverlap_(LevelOverlap_in),
59 IndexBase_(Graph_in.IndexBase64()),
60 NumGlobalRows_(Graph_in.NumGlobalRows64()),
61 NumGlobalCols_(Graph_in.NumGlobalCols64()),
62 NumGlobalBlockRows_(Graph_in.NumGlobalBlockRows64()),
63 NumGlobalBlockCols_(Graph_in.NumGlobalBlockCols64()),
64 NumGlobalBlockDiagonals_(0),
65 NumGlobalNonzeros_(0),
67 NumMyBlockRows_(Graph_in.NumMyBlockRows()),
68 NumMyBlockCols_(Graph_in.NumMyBlockCols()),
69 NumMyRows_(Graph_in.NumMyRows()),
70 NumMyCols_(Graph_in.NumMyCols()),
71 NumMyBlockDiagonals_(0),
79 : Graph_(Graph_in.Graph_),
80 DomainMap_(Graph_in.DomainMap()),
81 RangeMap_(Graph_in.RangeMap()),
82 Comm_(Graph_in.Comm()),
83 OverlapGraph_(Graph_in.OverlapGraph_),
84 OverlapRowMap_(Graph_in.OverlapRowMap_),
85 OverlapImporter_(Graph_in.OverlapImporter_),
86 LevelFill_(Graph_in.LevelFill_),
87 LevelOverlap_(Graph_in.LevelOverlap_),
88 IndexBase_(Graph_in.IndexBase_),
89 NumGlobalRows_(Graph_in.NumGlobalRows_),
90 NumGlobalCols_(Graph_in.NumGlobalCols_),
91 NumGlobalBlockRows_(Graph_in.NumGlobalBlockRows_),
92 NumGlobalBlockCols_(Graph_in.NumGlobalBlockCols_),
93 NumGlobalBlockDiagonals_(Graph_in.NumGlobalBlockDiagonals_),
94 NumGlobalNonzeros_(Graph_in.NumGlobalNonzeros_),
95 NumGlobalEntries_(Graph_in.NumGlobalEntries_),
96 NumMyBlockRows_(Graph_in.NumMyBlockRows_),
97 NumMyBlockCols_(Graph_in.NumMyBlockCols_),
98 NumMyRows_(Graph_in.NumMyRows_),
99 NumMyCols_(Graph_in.NumMyCols_),
100 NumMyBlockDiagonals_(Graph_in.NumMyBlockDiagonals_),
101 NumMyNonzeros_(Graph_in.NumMyNonzeros_),
102 NumMyEntries_(Graph_in.NumMyEntries_)
117 bool cerr_warning_if_unused)
138 Teuchos::RefCountPtr<Epetra_CrsGraph> OldGraph;
139 Teuchos::RefCountPtr<Epetra_BlockMap> OldRowMap;
184 int NumIn, NumL, NumU;
197 std::vector<int> L(MaxNumIndices);
198 std::vector<int> U(MaxNumIndices);
214 for (j=0; j< NumIn; j++) {
217 if (k<NumMyBlockRows_) {
219 if (k==i) DiagFound =
true;
235 if (NumL)
L_Graph_->InsertMyIndices(i, NumL, &L[0]);
236 if (NumU)
U_Graph_->InsertMyIndices(i, NumU, &U[0]);
255 std::vector<std::vector<int> > Levels(MaxRC);
256 std::vector<int> LinkList(MaxRC);
257 std::vector<int> CurrentLevel(MaxRC);
258 std::vector<int> CurrentRow(MaxRC);
259 std::vector<int> LevelsRowU(MaxRC);
267 int LenL =
L_Graph_->NumMyIndices(i);
268 int LenU =
U_Graph_->NumMyIndices(i);
269 int Len = LenL + LenU + 1;
272 CurrentRow[LenL] = i;
277 ierr1 =
U_Graph_->ExtractMyRowCopy(i, LenU, LenU, &CurrentRow[LenL+1]);
280 cout <<
"ierr1 = "<< ierr1 << endl;
281 cout <<
"i = " << i << endl;
282 cout <<
"NumMyBlockRows_ = " <<
U_Graph_->NumMyBlockRows() << endl;
287 for (j=0; j<Len-1; j++) {
288 LinkList[CurrentRow[j]] = CurrentRow[j+1];
289 CurrentLevel[CurrentRow[j]] = 0;
293 CurrentLevel[CurrentRow[Len-1]] = 0;
297 First = CurrentRow[0];
301 int PrevInList = Next;
302 int NextInList = LinkList[Next];
313 for (ii=0; ii<LengthRowU; )
315 int CurInList = IndicesU[ii];
316 if (CurInList < NextInList)
319 int NewLevel = CurrentLevel[RowU] + Levels[RowU][ii+1] + 1;
322 LinkList[PrevInList] = CurInList;
323 LinkList[CurInList] = NextInList;
324 PrevInList = CurInList;
325 CurrentLevel[CurInList] = NewLevel;
329 else if (CurInList == NextInList)
331 PrevInList = NextInList;
332 NextInList = LinkList[PrevInList];
333 int NewLevel = CurrentLevel[RowU] + Levels[RowU][ii+1] + 1;
334 CurrentLevel[CurInList] =
EPETRA_MIN(CurrentLevel[CurInList], NewLevel);
339 PrevInList = NextInList;
340 NextInList = LinkList[PrevInList];
343 Next = LinkList[Next];
355 CurrentRow[LenL++] = Next;
356 Next = LinkList[Next];
360 int ierr11 =
L_Graph_->InsertMyIndices(i, LenL, &CurrentRow[0]);
365 if (Next != i)
return(-2);
367 LevelsRowU[0] = CurrentLevel[Next];
368 Next = LinkList[Next];
375 while (Next < NumMyBlockRows_)
377 LevelsRowU[LenU+1] = CurrentLevel[Next];
378 CurrentRow[LenU++] = Next;
379 Next = LinkList[Next];
383 int ierr2 =
U_Graph_->InsertMyIndices(i, LenU, &CurrentRow[0]);
387 Levels[i] = std::vector<int>(LenU+1);
388 for (
int jj=0; jj<LenU+1; jj++) Levels[i][jj] = LevelsRowU[jj];
433 os <<
" Level of Fill = "; os << LevelFill;
437 os <<
" Graph of L = ";
442 os <<
" Graph of U = ";
const Epetra_BlockMap & RangeMap() const
bool DistributedGlobal() const
Ifpack_IlukGraph(const Epetra_CrsGraph &Graph_in, int LevelFill_in, int LevelOverlap_in)
Ifpack_IlukGraph constuctor.
int int_params[LAST_INT_PARAM-FIRST_INT_PARAM+1]
long long NumGlobalBlockDiagonals_
virtual Epetra_CrsGraph & L_Graph()
Returns the graph of lower triangle of the ILU(k) graph as a Epetra_CrsGraph.
int SetParameters(const Teuchos::ParameterList ¶meterlist, bool cerr_warning_if_unused=false)
Set parameters using Teuchos::ParameterList object.
Teuchos::RefCountPtr< Epetra_Import > OverlapImporter_
#define EPETRA_CHK_ERR(a)
Teuchos::RefCountPtr< Epetra_CrsGraph > U_Graph_
Ifpack_IlukGraph: A class for constructing level filled graphs for use with ILU(k) class precondition...
long long NumGlobalEntries_
Teuchos::RefCountPtr< Epetra_CrsGraph > L_Graph_
const Epetra_BlockMap & DomainMap() const
Teuchos::RefCountPtr< Epetra_BlockMap > OverlapRowMap_
virtual int LevelFill() const
Returns the level of fill used to construct this graph.
virtual int ConstructOverlapGraph()
Does the actual construction of the overlap matrix graph.
virtual Epetra_CrsGraph & U_Graph()
Returns the graph of upper triangle of the ILU(k) graph as a Epetra_CrsGraph.
long long NumGlobalNonzeros_
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
const Epetra_CrsGraph & Graph_
const Epetra_BlockMap & RowMap() const
std::ostream & operator<<(std::ostream &os, const Ifpack_Container &obj)
Teuchos::RefCountPtr< Epetra_CrsGraph > OverlapGraph_
void set_parameters(const Teuchos::ParameterList ¶meterlist, param_struct ¶ms, bool cerr_warning_if_unused)
virtual ~Ifpack_IlukGraph()
Ifpack_IlukGraph Destructor.
virtual int ConstructFilledGraph()
Does the actual construction of the graph.