Salome HOME
Keep track of datetime of configuration
[tools/medcoupling.git] / src / RENUMBER / RENUMBER_BOOSTRenumbering.cxx
index 34c98685f0e83e475a3c105871810f2f9cceecec..b6d7f1a1a526797ee447eb21ab37e28b1978ffc5 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2022  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
@@ -20,7 +20,7 @@
 #include "RENUMBER_BOOSTRenumbering.hxx"
 
 #include "MEDCouplingMemArray.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
 
 #include <boost/config.hpp>
 #include <boost/graph/adjacency_list.hpp>
 #include <boost/graph/properties.hpp>
 #include <boost/graph/bandwidth.hpp>
 
-void BOOSTRenumbering::renumber(const int *graph, const int *index_graph, int nbCell, ParaMEDMEM::DataArrayInt *&iperm, ParaMEDMEM::DataArrayInt *&perm)
+void BOOSTRenumbering::renumber(const mcIdType *graph, const mcIdType *index_graph, mcIdType nbCell, MEDCoupling::DataArrayIdType *&iperm, MEDCoupling::DataArrayIdType *&perm)
 {
-  ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr<ParaMEDMEM::DataArrayInt> out0(ParaMEDMEM::DataArrayInt::New()),out1(ParaMEDMEM::DataArrayInt::New());
+  MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> out0(MEDCoupling::DataArrayIdType::New()),out1(MEDCoupling::DataArrayIdType::New());
   out0->alloc(nbCell,1); out1->alloc(nbCell,1);
   out0->fillWithZero(); out1->fillWithZero();
   //
   typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, 
      boost::property<boost::vertex_color_t, boost::default_color_type,
-       boost::property<boost::vertex_degree_t,int> > > Graph;
-  typedef boost::graph_traits<Graph>::vertex_descriptor Vertex;
-  typedef boost::graph_traits<Graph>::vertices_size_type size_type;
+       boost::property<boost::vertex_degree_t,mcIdType> > > Graph;
   Graph G(nbCell);
-  for (int i=0;i<nbCell;++i)
-    for (int j=index_graph[i];j<index_graph[i+1];++j)
+  for (mcIdType i=0;i<nbCell;++i)
+    for (mcIdType j=index_graph[i];j<index_graph[i+1];++j)
       add_edge(i,graph[j],G);
   boost::property_map<Graph, boost::vertex_index_t>::type
     index_map = boost::get(boost::vertex_index, G);
   boost::cuthill_mckee_ordering(G, out0->getPointer(), boost::get(boost::vertex_color, G),
                            boost::make_degree_map(G));
-  int *out0Ptr(out0->getPointer()),*out1Ptr(out1->getPointer());
-  for(int c=0;c!=nbCell;++c)
+  mcIdType *out0Ptr(out0->getPointer()),*out1Ptr(out1->getPointer());
+  for(mcIdType c=0;c!=nbCell;++c)
     out1Ptr[index_map[out0Ptr[nbCell-c-1]]]=c;
   out0->reverse();
   iperm=out0.retn(); perm=out1.retn();