49 #include "Epetra_Comm.h"
50 #include "Epetra_MultiVector.h"
51 #include "Epetra_CrsGraph.h"
52 #include "Epetra_Map.h"
53 #include "Teuchos_ParameterList.hpp"
56 #ifdef HAVE_IFPACK_METIS
59 int *numflag,
int *options,
int *perm,
int *iperm);
65 UseSymmetricGraph_(
false),
87 Teuchos::RefCountPtr<Epetra_CrsGraph> SymGraph;
88 Teuchos::RefCountPtr<Epetra_Map> SymMap;
89 Teuchos::RefCountPtr<Ifpack_Graph_Epetra_CrsGraph> SymIFPACKGraph;
92 int Length = 2 *
Graph.MaxMyNumEntries();
94 std::vector<int> Indices;
95 Indices.resize(Length);
97 std::vector<int> options;
101 #ifdef HAVE_IFPACK_METIS
107 #if !defined(EPETRA_NO_32BIT_GLOBAL_INDICES) || !defined(EPETRA_NO_64BIT_GLOBAL_INDICES)
116 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
117 if(SymGraph->RowMap().GlobalIndicesInt()) {
120 ierr =
Graph.ExtractMyRowCopy(i, Length, NumIndices,
124 for (
int j = 0 ; j < NumIndices ; ++j) {
128 SymGraph->InsertGlobalIndices(i,1,&jj);
129 SymGraph->InsertGlobalIndices(jj,1,&i);
136 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
137 if(SymGraph->RowMap().GlobalIndicesLongLong()) {
141 ierr =
Graph.ExtractMyRowCopy(i, Length, NumIndices,
145 for (
int j = 0 ; j < NumIndices ; ++j) {
146 long long jj = Indices[j];
149 SymGraph->InsertGlobalIndices(i_LL,1,&jj);
150 SymGraph->InsertGlobalIndices(jj,1,&i_LL);
157 throw "Ifpack_METISReordering::Compute: GlobalIndices type unknown";
162 IFPACKGraph = SymIFPACKGraph;
166 std::vector<idxtype> xadj;
169 std::vector<idxtype> adjncy;
170 adjncy.resize(
Graph.NumMyNonzeros());
178 xadj[count2+1] = xadj[count2];
180 ierr = IFPACKGraph->ExtractMyRowCopy(i, Length, NumIndices, &Indices[0]);
183 for (
int j = 0 ; j < NumIndices ; ++j) {
186 adjncy[count++] = jj;
193 #ifdef HAVE_IFPACK_METIS
200 METIS_NodeND(&
NumMyRows_, &xadj[0], &adjncy[0],
201 &numflag, &options[0],
207 cerr <<
"Please configure with --enable-ifpack-metis" << endl;
208 cerr <<
"to use METIS Reordering." << endl;
259 X[j][np] = Xorig[j][i];
275 X[j][i] = Xorig[j][np];
287 os <<
"*** Ifpack_METISReordering" << endl << endl;
289 os <<
"*** Reordering not yet computed." << endl;
291 os <<
"*** Number of local rows = " <<
NumMyRows_ << endl;
292 os <<
"Local Row\tReorder[i]\tInvReorder[i]" << endl;