X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FRENUMBER%2FRENUMBER_BOOSTRenumbering.cxx;h=a46e06c4d9aec935c4f6cbee02af31a243708c0a;hb=80e6c46cd239ea82990b1aaa02edee7902a872ce;hp=60d5eec3d8dd83030849905759133f89c98b5e07;hpb=a71c52ef015f2e1a4ab6cc4a75ba1fac36f06513;p=tools%2Fmedcoupling.git diff --git a/src/RENUMBER/RENUMBER_BOOSTRenumbering.cxx b/src/RENUMBER/RENUMBER_BOOSTRenumbering.cxx index 60d5eec3d..a46e06c4d 100644 --- a/src/RENUMBER/RENUMBER_BOOSTRenumbering.cxx +++ b/src/RENUMBER/RENUMBER_BOOSTRenumbering.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D +// Copyright (C) 2007-2014 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 @@ -17,32 +17,39 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +#include "RENUMBER_BOOSTRenumbering.hxx" + +#include "MEDCouplingMemArray.hxx" +#include "MEDCouplingAutoRefCountObjectPtr.hxx" + #include #include #include #include #include -#include "RENUMBER_BOOSTRenumbering.hxx" - -void BOOSTRenumbering::renumber(const int* graph,const int* index_graph,int nb_cell,std::vector& iperm,std::vector& perm) +void BOOSTRenumbering::renumber(const int *graph, const int *index_graph, int nbCell, ParaMEDMEM::DataArrayInt *&iperm, ParaMEDMEM::DataArrayInt *&perm) { - iperm.resize(nb_cell,0); - perm.resize(nb_cell,0); - + ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr out0(ParaMEDMEM::DataArrayInt::New()),out1(ParaMEDMEM::DataArrayInt::New()); + out0->alloc(nbCell,1); out1->alloc(nbCell,1); + out0->fillWithZero(); out1->fillWithZero(); + // typedef boost::adjacency_list > > Graph; typedef boost::graph_traits::vertex_descriptor Vertex; typedef boost::graph_traits::vertices_size_type size_type; - Graph G(nb_cell); - for (int i=0;i::type index_map = boost::get(boost::vertex_index, G); - boost::cuthill_mckee_ordering(G, iperm.rbegin(), boost::get(boost::vertex_color, G), + boost::cuthill_mckee_ordering(G, out0->getPointer(), boost::get(boost::vertex_color, G), boost::make_degree_map(G)); - for (size_type c = 0; c != iperm.size(); ++c) - perm[index_map[iperm[c]]] = c; + int *out0Ptr(out0->getPointer()),*out1Ptr(out1->getPointer()); + for(int c=0;c!=nbCell;++c) + out1Ptr[index_map[out0Ptr[nbCell-c-1]]]=c; + out0->reverse(); + iperm=out0.retn(); perm=out1.retn(); }