X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FRENUMBER%2FRENUMBER_METISRenumbering.cxx;h=6f7771b16dba96bf83ce0685d872c20cc2d64d79;hb=e45700b6697d69af3421a2fd5c6fb588f49b7a18;hp=dfbe5d18abe09c1be37524296d045369266994af;hpb=378cb2ebe08f8f4543ef632b2bd5f77fe180f978;p=tools%2Fmedcoupling.git diff --git a/src/RENUMBER/RENUMBER_METISRenumbering.cxx b/src/RENUMBER/RENUMBER_METISRenumbering.cxx old mode 100755 new mode 100644 index dfbe5d18a..6f7771b16 --- a/src/RENUMBER/RENUMBER_METISRenumbering.cxx +++ b/src/RENUMBER/RENUMBER_METISRenumbering.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 CEA/DEN, EDF R&D +// Copyright (C) 2007-2021 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 @@ -29,17 +29,40 @@ extern "C" } #include "MEDCouplingMemArray.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "RENUMBER_METISRenumbering.hxx" -void METISRenumbering::renumber(const int *graph, const int *index_graph, int nbCell, ParaMEDMEM::DataArrayInt *&iperm, ParaMEDMEM::DataArrayInt *&perm) +#ifdef MEDCOUPLING_USE_64BIT_IDS +#define ID_TYPE_SIZE 64 +#else +#define ID_TYPE_SIZE 32 +#endif + +void METISRenumbering::renumber(const mcIdType *graph, const mcIdType *index_graph, mcIdType nbCell, MEDCoupling::DataArrayIdType *&iperm, MEDCoupling::DataArrayIdType *&perm) { - ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr out0(ParaMEDMEM::DataArrayInt::New()),out1(ParaMEDMEM::DataArrayInt::New()); + MEDCoupling::MCAuto out0(MEDCoupling::DataArrayIdType::New()),out1(MEDCoupling::DataArrayIdType::New()); out0->alloc(nbCell,1); out1->alloc(nbCell,1); out0->fillWithZero(); out1->fillWithZero(); int num_flag=1; int options=0; - METIS_NodeND(&nbCell,(int*)index_graph,(int*)graph,&num_flag,&options,out0->getPointer(),out1->getPointer()); + +#if ID_TYPE_SIZE == IDXTYPEWIDTH + + METIS_NodeND(&nbCell,(idx_t*)index_graph,(idx_t*)graph,&num_flag,&options,out0->getPointer(),out1->getPointer()); + +#else + + mcIdType indexSize = nbCell + 1, graphSize = index_graph[indexSize]; + std::vector indexVec( index_graph, index_graph + indexSize ); + std::vector graphVec( graph, graph + graphSize ); + std::vector out0Vec( nbCell ), out1Vec( nbCell ); + idx_t nb = static_cast( nbCell ); + METIS_NodeND(&nb,indexVec.data(),graphVec.data(),&num_flag,&options,out0Vec.data(),out1Vec.data()); + std::copy( out0Vec.begin(),out0Vec.end(),out0->getPointer() ); + std::copy( out1Vec.begin(),out1Vec.end(),out1->getPointer() ); + +#endif + iperm=out0.retn(); perm=out1.retn(); }