Salome HOME
new "medcoupling" python module to gether into a single module all the MEDCoupling...
[tools/medcoupling.git] / src / RENUMBER / RENUMBER_METISRenumbering.cxx
index 7373fc8cfe39c9b4973749f169dea1891a30ab65..b89d793e53ffa61f68b41239a5f2dc0a87abfc95 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2007-2012  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2016  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
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -28,13 +28,18 @@ extern "C"
 #include "metis.h"
 }
 
+#include "MEDCouplingMemArray.hxx"
+#include "MCAuto.hxx"
+
 #include "RENUMBER_METISRenumbering.hxx"
 
-void METISRenumbering::renumber(const int* graph,const int* index_graph,int nb_cell,std::vector<int>& iperm,std::vector<int>& perm)
+void METISRenumbering::renumber(const int *graph, const int *index_graph, int nbCell, MEDCoupling::DataArrayInt *&iperm, MEDCoupling::DataArrayInt *&perm)
 {
-  iperm.resize(nb_cell,0);
-  perm.resize(nb_cell,0);
+  MEDCoupling::MCAuto<MEDCoupling::DataArrayInt> out0(MEDCoupling::DataArrayInt::New()),out1(MEDCoupling::DataArrayInt::New());
+  out0->alloc(nbCell,1); out1->alloc(nbCell,1);
+  out0->fillWithZero(); out1->fillWithZero();
   int num_flag=1;
   int options=0;
-  METIS_NodeND(&nb_cell,(int*)index_graph,(int*)graph,&num_flag,&options,&iperm[0],&perm[0]);
+  METIS_NodeND(&nbCell,(int*)index_graph,(int*)graph,&num_flag,&options,out0->getPointer(),out1->getPointer());
+  iperm=out0.retn(); perm=out1.retn();
 }