81#ifdef HAVE_IFPACK_METIS
85 Teuchos::RefCountPtr<Epetra_CrsGraph> SymGraph ;
86 Teuchos::RefCountPtr<Epetra_Map> SymMap;
87 Teuchos::RefCountPtr<Ifpack_Graph_Epetra_CrsGraph> SymIFPACKGraph;
88 Teuchos::RefCountPtr<Ifpack_Graph> IFPACKGraph = Teuchos::rcp( (
Ifpack_Graph*)
Graph_,
false );
92 std::vector<int> Indices;
93 Indices.resize(Length);
98 std::vector<idxtype> wgtflag;
101 std::vector<int> options;
108#if !defined(EPETRA_NO_32BIT_GLOBAL_INDICES) || !defined(EPETRA_NO_64BIT_GLOBAL_INDICES)
117#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
118 if(SymGraph->RowMap().GlobalIndicesInt()) {
121 ierr =
Graph_->ExtractMyRowCopy(i, Length, NumIndices, &Indices[0]);
124 for (
int j = 0 ; j < NumIndices ; ++j) {
127 SymGraph->InsertGlobalIndices(i,1,&jj);
128 SymGraph->InsertGlobalIndices(jj,1,&i);
135#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
136 if(SymGraph->RowMap().GlobalIndicesLongLong()) {
140 ierr =
Graph_->ExtractMyRowCopy(i, Length, NumIndices, &Indices[0]);
143 for (
int j = 0 ; j < NumIndices ; ++j) {
144 long long jj = Indices[j];
146 SymGraph->InsertGlobalIndices(i_LL,1,&jj);
147 SymGraph->InsertGlobalIndices(jj,1,&i_LL);
154 throw "Ifpack_METISPartitioner::ComputePartitions: GlobalIndices type unknown";
158 IFPACKGraph = SymIFPACKGraph;
170 std::vector<idxtype> xadj;
173 std::vector<idxtype> adjncy;
182 xadj[count2+1] = xadj[count2];
184 ierr = IFPACKGraph->ExtractMyRowCopy(i, Length, NumIndices, &Indices[0]);
187 for (
int j = 0 ; j < NumIndices ; ++j) {
190 adjncy[count++] = jj;
197 std::vector<idxtype> NodesInSubgraph;
226#ifdef HAVE_IFPACK_METIS
232 METIS_PartGraphRecursive(&j, &xadj[0], &adjncy[0],
240 METIS_PartGraphKway (&j, &xadj[0], &adjncy[0],
242 NULL, &wgtflag[0], &numflag,
247 numflag = numflag * 2;
248 if (
Graph_->Comm().MyPID() == 0) {
249 cerr <<
"METIS was not linked; now I put all" << endl;
250 cerr <<
"the local nodes in the same partition." << endl;
260 NodesInSubgraph[i] = 0;
262 for (
int i = 0 ; i <
NumMyRows() ; ++i) {
268 else NodesInSubgraph[j]++;
272 if( NodesInSubgraph[i] == 0 ) {
279 cerr <<
"Specified number of subgraphs ("
281 cerr <<
"Now I recall METIS with NumLocalParts_ = "