Use std::unorderd_map everywhere in CMap, GMap and LCC.

This commit is contained in:
Guillaume Damiand 2021-10-14 17:53:01 +02:00
parent 3fb45bdd5a
commit 2f5841e179
6 changed files with 61 additions and 61 deletions

View File

@ -44,7 +44,6 @@
#include <tuple>
#include <unordered_map>
#include <boost/type_traits/is_same.hpp>
#include <boost/unordered_map.hpp>
#include <boost/graph/graph_traits.hpp>
#include <CGAL/boost/graph/helpers.h>
@ -231,8 +230,8 @@ namespace CGAL {
typename Converters, typename DartInfoConverter,
typename PointConverter>
void generic_copy(CMap2& amap,
boost::unordered_map<Dart_handle_2, Dart_handle>* origin_to_copy,
boost::unordered_map<Dart_handle, Dart_handle_2>* copy_to_origin,
std::unordered_map<Dart_handle_2, Dart_handle>* origin_to_copy,
std::unordered_map<Dart_handle, Dart_handle_2>* copy_to_origin,
const Converters& converters,
const DartInfoConverter& dartinfoconverter,
const PointConverter& pointconverter,
@ -260,7 +259,7 @@ namespace CGAL {
// Create an mapping between darts of the two maps (originals->copies).
// (here we cannot use CGAL::Unique_hash_map because it does not provide
// iterators...
boost::unordered_map<Dart_handle_2, Dart_handle> local_dartmap;
std::unordered_map<Dart_handle_2, Dart_handle> local_dartmap;
if (origin_to_copy==NULL) // Use local_dartmap if user does not provides its own unordered_map
{ origin_to_copy=&local_dartmap; }
@ -288,7 +287,7 @@ namespace CGAL {
unsigned int min_dim=(dimension<amap.dimension?dimension:amap.dimension);
typename boost::unordered_map<Dart_handle_2,Dart_handle>::iterator
typename std::unordered_map<Dart_handle_2,Dart_handle>::iterator
dartmap_iter, dartmap_iter_end=origin_to_copy->end();
for (dartmap_iter=origin_to_copy->begin(); dartmap_iter!=dartmap_iter_end;
++dartmap_iter)
@ -323,9 +322,9 @@ namespace CGAL {
template<typename CMap2, typename Converters, typename DartInfoConverter,
typename PointConverter>
void copy(CMap2& amap,
boost::unordered_map
std::unordered_map
<typename CMap2::Dart_handle, Dart_handle>* origin_to_copy,
boost::unordered_map
std::unordered_map
<Dart_handle, typename CMap2::Dart_handle>* copy_to_origin,
const Converters& converters,
const DartInfoConverter& dartinfoconverter,
@ -344,9 +343,9 @@ namespace CGAL {
template<typename CMap2, typename Converters, typename DartInfoConverter,
typename PointConverter>
void copy_from_const(const CMap2& amap,
boost::unordered_map
std::unordered_map
<typename CMap2::Dart_const_handle, Dart_handle>* origin_to_copy,
boost::unordered_map
std::unordered_map
<Dart_handle, typename CMap2::Dart_const_handle>* copy_to_origin,
const Converters& converters,
const DartInfoConverter& dartinfoconverter,
@ -364,9 +363,9 @@ namespace CGAL {
// (2a) copy(amap, converters, dartinfoconverter)
template<typename CMap2, typename Converters, typename DartInfoConverter>
void copy(CMap2& amap,
boost::unordered_map
std::unordered_map
<typename CMap2::Dart_handle, Dart_handle>* origin_to_copy,
boost::unordered_map
std::unordered_map
<Dart_handle, typename CMap2::Dart_handle>* copy_to_origin,
const Converters& converters,
const DartInfoConverter& dartinfoconverter,
@ -383,9 +382,9 @@ namespace CGAL {
// (2b) copy_from_const(const amap, converters, dartinfoconverter)
template <typename CMap2, typename Converters, typename DartInfoConverter>
void copy_from_const(const CMap2& amap,
boost::unordered_map
std::unordered_map
<typename CMap2::Dart_const_handle, Dart_handle>* origin_to_copy,
boost::unordered_map
std::unordered_map
<Dart_handle, typename CMap2::Dart_const_handle>* copy_to_origin,
const Converters& converters,
const DartInfoConverter& dartinfoconverter,
@ -402,9 +401,9 @@ namespace CGAL {
// (3a) copy(amap, converters)
template<typename CMap2, typename Converters>
void copy(CMap2& amap,
boost::unordered_map
std::unordered_map
<typename CMap2::Dart_handle, Dart_handle>* origin_to_copy,
boost::unordered_map
std::unordered_map
<Dart_handle, typename CMap2::Dart_handle>* copy_to_origin,
const Converters& converters,
bool copy_perforated_darts=false,
@ -418,9 +417,9 @@ namespace CGAL {
// (3b) copy_from_const(const amap, converters)
template <typename CMap2, typename Converters>
void copy_from_const(const CMap2& amap,
boost::unordered_map
std::unordered_map
<typename CMap2::Dart_const_handle, Dart_handle>* origin_to_copy,
boost::unordered_map
std::unordered_map
<Dart_handle, typename CMap2::Dart_const_handle>* copy_to_origin,
const Converters& converters,
bool copy_perforated_darts=false,
@ -434,9 +433,9 @@ namespace CGAL {
// (4a) copy(amap)
template<typename CMap2>
void copy(CMap2& amap,
boost::unordered_map
std::unordered_map
<typename CMap2::Dart_handle, Dart_handle>* origin_to_copy=nullptr,
boost::unordered_map
std::unordered_map
<Dart_handle, typename CMap2::Dart_handle>* copy_to_origin=nullptr,
bool copy_perforated_darts=false,
size_type mark_perforated=INVALID_MARK)
@ -449,9 +448,9 @@ namespace CGAL {
// (4b) copy_from_const(const amap)
template <typename CMap2>
void copy_from_const(const CMap2& amap,
boost::unordered_map
std::unordered_map
<typename CMap2::Dart_const_handle, Dart_handle>* origin_to_copy=nullptr,
boost::unordered_map
std::unordered_map
<Dart_handle, typename CMap2::Dart_const_handle>* copy_to_origin=nullptr,
bool copy_perforated_darts=false,
size_type mark_perforated=INVALID_MARK)
@ -555,10 +554,10 @@ namespace CGAL {
/** Import the given hds which should be a model of an halfedge graph. */
template<class HEG>
void import_from_halfedge_graph(const HEG& heg,
boost::unordered_map
std::unordered_map
<typename boost::graph_traits<HEG>::halfedge_descriptor,
Dart_handle>* origin_to_copy=NULL,
boost::unordered_map
std::unordered_map
<Dart_handle,
typename boost::graph_traits<HEG>::halfedge_descriptor>*
copy_to_origin=NULL,
@ -568,7 +567,7 @@ namespace CGAL {
// Create an mapping between darts of the two maps (originals->copies).
// (here we cannot use CGAL::Unique_hash_map because it does not provide
// iterators...
boost::unordered_map
std::unordered_map
<typename boost::graph_traits<HEG>::halfedge_descriptor,
Dart_handle> local_dartmap;
if (origin_to_copy==NULL) // Used local_dartmap if user does not provides its own unordered_map
@ -591,7 +590,7 @@ namespace CGAL {
}
}
typename boost::unordered_map
typename std::unordered_map
<typename boost::graph_traits<HEG>::halfedge_descriptor,
Dart_handle>::iterator dartmap_iter, dartmap_iter_end=origin_to_copy->end();
for (dartmap_iter=origin_to_copy->begin(); dartmap_iter!=dartmap_iter_end;

View File

@ -196,8 +196,8 @@ namespace CGAL {
typename Converters, typename DartInfoConverter,
typename PointConverter>
void generic_copy(GMap2& amap,
boost::unordered_map<Dart_handle_2, Dart_handle>* origin_to_copy,
boost::unordered_map<Dart_handle, Dart_handle_2>* copy_to_origin,
std::unordered_map<Dart_handle_2, Dart_handle>* origin_to_copy,
std::unordered_map<Dart_handle, Dart_handle_2>* copy_to_origin,
const Converters& converters,
const DartInfoConverter& dartinfoconverter,
const PointConverter& pointconverter,
@ -223,7 +223,7 @@ namespace CGAL {
// Create an mapping between darts of the two maps (originals->copies).
// (here we cannot use CGAL::Unique_hash_map because it does not provide
// iterators...
boost::unordered_map<Dart_handle_2, Dart_handle> local_dartmap;
std::unordered_map<Dart_handle_2, Dart_handle> local_dartmap;
if (origin_to_copy==NULL) // Use local_dartmap if user does not provides its own unordered_map
{ origin_to_copy=&local_dartmap; }
@ -251,7 +251,7 @@ namespace CGAL {
unsigned int min_dim=(dimension<amap.dimension?dimension:amap.dimension);
typename boost::unordered_map<Dart_handle_2, Dart_handle>::iterator
typename std::unordered_map<Dart_handle_2, Dart_handle>::iterator
dartmap_iter, dartmap_iter_end=origin_to_copy->end();
for (dartmap_iter=origin_to_copy->begin(); dartmap_iter!=dartmap_iter_end;
++dartmap_iter)
@ -286,9 +286,9 @@ namespace CGAL {
template<typename GMap2, typename Converters, typename DartInfoConverter,
typename PointConverter>
void copy(GMap2& amap,
boost::unordered_map
std::unordered_map
<typename GMap2::Dart_handle, Dart_handle>* origin_to_copy,
boost::unordered_map
std::unordered_map
<Dart_handle, typename GMap2::Dart_handle>* copy_to_origin,
const Converters& converters,
const DartInfoConverter& dartinfoconverter,
@ -307,9 +307,9 @@ namespace CGAL {
template<typename GMap2, typename Converters, typename DartInfoConverter,
typename PointConverter>
void copy_from_const(const GMap2& amap,
boost::unordered_map
std::unordered_map
<typename GMap2::Dart_const_handle, Dart_handle>* origin_to_copy,
boost::unordered_map
std::unordered_map
<Dart_handle, typename GMap2::Dart_const_handle>* copy_to_origin,
const Converters& converters,
const DartInfoConverter& dartinfoconverter,
@ -327,9 +327,9 @@ namespace CGAL {
// (2a) copy(amap, converters, dartinfoconverter)
template<typename GMap2, typename Converters, typename DartInfoConverter>
void copy(GMap2& amap,
boost::unordered_map
std::unordered_map
<typename GMap2::Dart_handle, Dart_handle>* origin_to_copy,
boost::unordered_map
std::unordered_map
<Dart_handle, typename GMap2::Dart_handle>* copy_to_origin,
const Converters& converters,
const DartInfoConverter& dartinfoconverter,
@ -346,9 +346,9 @@ namespace CGAL {
// (2b) copy_from_const(const amap, converters, dartinfoconverter)
template <typename GMap2, typename Converters, typename DartInfoConverter>
void copy_from_const(const GMap2& amap,
boost::unordered_map
std::unordered_map
<typename GMap2::Dart_const_handle, Dart_handle>* origin_to_copy,
boost::unordered_map
std::unordered_map
<Dart_handle, typename GMap2::Dart_const_handle>* copy_to_origin,
const Converters& converters,
const DartInfoConverter& dartinfoconverter,
@ -365,9 +365,9 @@ namespace CGAL {
// (3a) copy(amap, converters)
template<typename GMap2, typename Converters>
void copy(GMap2& amap,
boost::unordered_map
std::unordered_map
<typename GMap2::Dart_handle, Dart_handle>* origin_to_copy,
boost::unordered_map
std::unordered_map
<Dart_handle, typename GMap2::Dart_handle>* copy_to_origin,
const Converters& converters,
bool copy_perforated_darts=false,
@ -381,9 +381,9 @@ namespace CGAL {
// (3b) copy_from_const(const amap, converters)
template <typename GMap2, typename Converters>
void copy_from_const(const GMap2& amap,
boost::unordered_map
std::unordered_map
<typename GMap2::Dart_const_handle, Dart_handle>* origin_to_copy,
boost::unordered_map
std::unordered_map
<Dart_handle, typename GMap2::Dart_const_handle>* copy_to_origin,
const Converters& converters,
bool copy_perforated_darts=false,
@ -397,9 +397,9 @@ namespace CGAL {
// (4a) copy(amap)
template<typename GMap2>
void copy(GMap2& amap,
boost::unordered_map
std::unordered_map
<typename GMap2::Dart_handle, Dart_handle>* origin_to_copy=nullptr,
boost::unordered_map
std::unordered_map
<Dart_handle, typename GMap2::Dart_handle>* copy_to_origin=nullptr,
bool copy_perforated_darts=false,
size_type mark_perforated=INVALID_MARK)
@ -412,9 +412,9 @@ namespace CGAL {
// (4b) copy_from_const(const amap)
template <typename GMap2>
void copy_from_const(const GMap2& amap,
boost::unordered_map
std::unordered_map
<typename GMap2::Dart_const_handle, Dart_handle>* origin_to_copy=nullptr,
boost::unordered_map
std::unordered_map
<Dart_handle, typename GMap2::Dart_const_handle>* copy_to_origin=nullptr,
bool copy_perforated_darts=false,
size_type mark_perforated=INVALID_MARK)

View File

@ -19,6 +19,7 @@
#include <CGAL/Combinatorial_map.h>
#include <CGAL/CMap_linear_cell_complex_storages.h>
#include <CGAL/boost/graph/properties.h>
#include <unordered_map>
namespace CGAL {
@ -162,16 +163,16 @@ namespace CGAL {
template<class HEG, class PointConverter>
void import_from_halfedge_graph(const HEG& heg ,
const PointConverter& pointconverter,
boost::unordered_map
std::unordered_map
<typename boost::graph_traits<HEG>::halfedge_descriptor,
Dart_handle>* origin_to_copy=NULL,
boost::unordered_map
std::unordered_map
<Dart_handle,
typename boost::graph_traits<HEG>::halfedge_descriptor>*
copy_to_origin=NULL)
{
boost::unordered_map
std::unordered_map
<typename boost::graph_traits<HEG>::halfedge_descriptor,
Dart_handle> local_dartmap;
if (origin_to_copy==NULL) // Used local_dartmap if user does not provides its own unordered_map
@ -183,7 +184,7 @@ namespace CGAL {
Point_property_map;
Point_property_map ppmap = get(CGAL::vertex_point, heg);
typename boost::unordered_map
typename std::unordered_map
<typename boost::graph_traits<HEG>::halfedge_descriptor,
Dart_handle>::iterator dartmap_iter, dartmap_iter_end=origin_to_copy->end();
for (dartmap_iter=origin_to_copy->begin(); dartmap_iter!=dartmap_iter_end;
@ -202,10 +203,10 @@ namespace CGAL {
/** Import the given hds which should be a model of an halfedge graph. */
template<class HEG>
void import_from_halfedge_graph(const HEG& heg,
boost::unordered_map
std::unordered_map
<typename boost::graph_traits<HEG>::halfedge_descriptor,
Dart_handle>* origin_to_copy=NULL,
boost::unordered_map
std::unordered_map
<Dart_handle,
typename boost::graph_traits<HEG>::halfedge_descriptor>*
copy_to_origin=NULL)

View File

@ -8,7 +8,7 @@
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <unordered_set>
#include <unordered_map>
using LCC_3 =CGAL::Linear_cell_complex_for_generalized_map<2, 3>;
using Dart_handle =LCC_3::Dart_handle;
@ -97,7 +97,7 @@ int main(int argc, char* argv[])
CGAL::load_off(lccoriginal, inp);
std::cout<<"File '"<<filename<<"' loaded. Running the main program..."<<std::endl;
boost::unordered_map<Dart_handle, Dart_handle> origin_to_copy;
std::unordered_map<Dart_handle, Dart_handle> origin_to_copy;
lcccopy.copy(lccoriginal, &origin_to_copy, nullptr);
LCC_3::size_type is_root=lccoriginal.get_new_mark();

View File

@ -44,9 +44,9 @@ namespace internal {
using Mesh_original = Mesh_;
using Generic_map = CGAL::Generalized_map<2, Items_>;
using Dart_const_handle_original = typename Mesh_original::Dart_const_handle;
using Copy_to_origin_map = boost::unordered_map<typename Generic_map::Dart_handle,
using Copy_to_origin_map = std::unordered_map<typename Generic_map::Dart_handle,
Dart_const_handle_original>;
using Origin_to_copy_map = boost::unordered_map<Dart_const_handle_original,
using Origin_to_copy_map = std::unordered_map<Dart_const_handle_original,
typename Generic_map::Dart_handle>;
static void copy(Generic_map& target, const Mesh_original& source,
@ -64,9 +64,9 @@ namespace internal {
using Mesh_original = Mesh_;
using Generic_map = CGAL::Combinatorial_map<2, Items_>;
using Dart_const_handle_original = typename Mesh_original::Dart_const_handle;
using Copy_to_origin_map = boost::unordered_map<typename Generic_map::Dart_handle,
using Copy_to_origin_map = std::unordered_map<typename Generic_map::Dart_handle,
Dart_const_handle_original>;
using Origin_to_copy_map = boost::unordered_map<Dart_const_handle_original,
using Origin_to_copy_map = std::unordered_map<Dart_const_handle_original,
typename Generic_map::Dart_handle>;
static void copy(Generic_map& target, const Mesh_original& source,
@ -83,9 +83,9 @@ namespace internal {
using Mesh_original = Mesh_;
using Generic_map = CGAL::Combinatorial_map<2, Items_>;
using Dart_const_handle_original = typename boost::graph_traits<Mesh_original>::halfedge_descriptor;
using Copy_to_origin_map = boost::unordered_map<typename Generic_map::Dart_handle,
using Copy_to_origin_map = std::unordered_map<typename Generic_map::Dart_handle,
Dart_const_handle_original>;
using Origin_to_copy_map = boost::unordered_map<Dart_const_handle_original,
using Origin_to_copy_map = std::unordered_map<Dart_const_handle_original,
typename Generic_map::Dart_handle>;
static void copy(Generic_map& target, const Mesh_original& source,

View File

@ -65,8 +65,8 @@ public:
using Path =CGAL::Surface_mesh_topology::Path_on_surface<Mesh>;
// Associations between original darts and their copy.
using Origin_to_copy=boost::unordered_map<Original_dart_const_handle, Dart_handle>;
using Copy_to_origin=boost::unordered_map<Dart_handle, Original_dart_const_handle>;
using Origin_to_copy=std::unordered_map<Original_dart_const_handle, Dart_handle>;
using Copy_to_origin=std::unordered_map<Dart_handle, Original_dart_const_handle>;
/// @return the local map
const Local_map& get_local_map() const