Salome HOME
MEDFileCurveLinearMesh -> getSpaceDimension() was missing
[tools/medcoupling.git] / src / MEDPartitioner / MEDPARTITIONER_ParMetisGraph.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 04fb030..a17bd6f
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2020  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -21,6 +21,7 @@
 #include "MEDPARTITIONER_ParaDomainSelector.hxx"
 #include "MEDPARTITIONER_Utils.hxx"
 
+#include "MEDCouplingSkyLineArray.hxx"
 #include "InterpKernelException.hxx"
 
 #include <iostream>
@@ -38,7 +39,7 @@ ParMETISGraph::ParMETISGraph():Graph()
 {
 }
 
-ParMETISGraph::ParMETISGraph(MEDPARTITIONER::SkyLineArray* graph, int* edgeweight)
+ParMETISGraph::ParMETISGraph(MEDCoupling::MEDCouplingSkyLineArray* graph, int* edgeweight)
   :Graph(graph,edgeweight)
 {
 }
@@ -58,10 +59,17 @@ void ParMETISGraph::partGraph(int ndomain,
     std::cout << "proc " << MyGlobals::_Rank << " : ParMETISGraph::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->getValue());
+  int * adjncy=const_cast<int*>(_graph->getValues());
+#endif
   //constraints
   int * vwgt=_cell_weight;
   int * adjwgt=_edge_weight;
@@ -109,8 +117,8 @@ void ParMETISGraph::partGraph(int ndomain,
     MPI_Comm *comm);
   */
 
-  vector<int> index(n+1);
-  vector<int> value(n);
+  vector<mcIdType> index(n+1);
+  vector<mcIdType> value(n);
   index[0]=0;
   if (ran.size()>0 && MyGlobals::_Atomize==0) //there is randomize
     {
@@ -119,7 +127,7 @@ void ParMETISGraph::partGraph(int ndomain,
       for (int i=0; i<n; i++)
         {
           index[i+1]=index[i]+1;
-          value[ran[i]]=partition[i];
+          value[ran[i]]=ToIdType(partition[i]);
         }
     }
   else
@@ -127,7 +135,7 @@ void ParMETISGraph::partGraph(int ndomain,
       for (int i=0; i<n; i++)
         {
           index[i+1]=index[i]+1;
-          value[i]=partition[i];
+          value[i]=ToIdType(partition[i]);
         }
     }
   delete [] partition;
@@ -136,7 +144,7 @@ void ParMETISGraph::partGraph(int ndomain,
   //the fifth argument true specifies that only the pointers are passed 
   //to the object
   
-  _partition = new MEDPARTITIONER::SkyLineArray(index,value);
+  _partition = MEDCoupling::MEDCouplingSkyLineArray::New(index,value);
 #endif
 }