Salome HOME
Indices are stored as mcIdType type instead of int to support switch to 64bits indexing
[tools/medcoupling.git] / src / MEDPartitioner / MEDPARTITIONER_MetisGraph.cxx
index 561d366ec68b2fc4ff7b4a65a99349f2052d8d31..6f20908ee86c10200474fe49e886bf904f372e95 100644 (file)
@@ -55,10 +55,17 @@ void METISGraph::partGraph(int ndomain,
     std::cout << "proc " << MyGlobals::_Rank << " : METISGraph::partGraph" << std::endl;
   
   //number of graph vertices
-  int n=_graph->getNumberOf();
+  int n=FromIdType<int>(_graph->getNumberOf());
   //graph
+#ifdef MEDCOUPLING_USE_64BIT_IDS
+  std::vector<int> indexVec( _graph->getIndex(), _graph->getIndexArray()->end() );
+  std::vector<int> valueVec( _graph->getValues(), _graph->getValuesArray()->end() );
+  int * xadj=indexVec.data();
+  int * adjncy=valueVec.data();
+#else
   int * xadj=const_cast<int*>(_graph->getIndex());
   int * adjncy=const_cast<int*>(_graph->getValues());
+#endif
   //constraints
   int * vwgt=_cell_weight;
   int * adjwgt=_edge_weight;
@@ -100,13 +107,13 @@ void METISGraph::partGraph(int ndomain,
       for (int i=0; i<n; i++)
         partition[i]=0;
     }
-  vector<int> index(n+1);
-  vector<int> value(n);
+  vector<mcIdType> index(n+1);
+  vector<mcIdType> value(n);
   index[0]=0;
   for (int i=0; i<n; i++)
     {
       index[i+1]=index[i]+1;
-      value[i]=partition[i];
+      value[i]=ToIdType(partition[i]);
     }
   delete [] partition;