mirror of https://github.com/CGAL/cgal
Add hash function to unordered_map; TODO is it possible to do that automaticallY?
This commit is contained in:
parent
7498a60167
commit
b04d6ebc67
|
|
@ -103,7 +103,8 @@ namespace CGAL {
|
||||||
typedef typename Base::Use_index Use_index;
|
typedef typename Base::Use_index Use_index;
|
||||||
typedef typename Base::Dart_range Dart_range;
|
typedef typename Base::Dart_range Dart_range;
|
||||||
typedef typename Base::Dart_const_range Dart_const_range;
|
typedef typename Base::Dart_const_range Dart_const_range;
|
||||||
|
using Hash_function=typename Base::Hash_function;
|
||||||
|
|
||||||
static const size_type NB_MARKS = Base::NB_MARKS;
|
static const size_type NB_MARKS = Base::NB_MARKS;
|
||||||
static const size_type INVALID_MARK = NB_MARKS;
|
static const size_type INVALID_MARK = NB_MARKS;
|
||||||
|
|
||||||
|
|
@ -199,8 +200,8 @@ namespace CGAL {
|
||||||
typename Converters, typename DartInfoConverter,
|
typename Converters, typename DartInfoConverter,
|
||||||
typename PointConverter>
|
typename PointConverter>
|
||||||
void generic_copy(GMap2& amap,
|
void generic_copy(GMap2& amap,
|
||||||
std::unordered_map<Dart_handle_2, Dart_handle>* origin_to_copy,
|
std::unordered_map<Dart_handle_2, Dart_handle,Hash_function>* origin_to_copy,
|
||||||
std::unordered_map<Dart_handle, Dart_handle_2>* copy_to_origin,
|
std::unordered_map<Dart_handle, Dart_handle_2,Hash_function>* copy_to_origin,
|
||||||
const Converters& converters,
|
const Converters& converters,
|
||||||
const DartInfoConverter& dartinfoconverter,
|
const DartInfoConverter& dartinfoconverter,
|
||||||
const PointConverter& pointconverter,
|
const PointConverter& pointconverter,
|
||||||
|
|
@ -231,7 +232,7 @@ namespace CGAL {
|
||||||
// Create an mapping between darts of the two maps (originals->copies).
|
// Create an mapping between darts of the two maps (originals->copies).
|
||||||
// (here we cannot use CGAL::Unique_hash_map because it does not provide
|
// (here we cannot use CGAL::Unique_hash_map because it does not provide
|
||||||
// iterators...
|
// iterators...
|
||||||
std::unordered_map<Dart_handle_2, Dart_handle> local_dartmap;
|
std::unordered_map<Dart_handle_2, Dart_handle,Hash_function> local_dartmap;
|
||||||
if (origin_to_copy==nullptr) // Use local_dartmap if user does not provides its own unordered_map
|
if (origin_to_copy==nullptr) // Use local_dartmap if user does not provides its own unordered_map
|
||||||
{ origin_to_copy=&local_dartmap; }
|
{ origin_to_copy=&local_dartmap; }
|
||||||
|
|
||||||
|
|
@ -269,7 +270,7 @@ namespace CGAL {
|
||||||
|
|
||||||
unsigned int min_dim=(dimension<amap.dimension?dimension:amap.dimension);
|
unsigned int min_dim=(dimension<amap.dimension?dimension:amap.dimension);
|
||||||
|
|
||||||
typename std::unordered_map<Dart_handle_2, Dart_handle>::iterator
|
typename std::unordered_map<Dart_handle_2, Dart_handle, Hash_function>::iterator
|
||||||
dartmap_iter, dartmap_iter_end=origin_to_copy->end();
|
dartmap_iter, dartmap_iter_end=origin_to_copy->end();
|
||||||
for (dartmap_iter=origin_to_copy->begin(); dartmap_iter!=dartmap_iter_end;
|
for (dartmap_iter=origin_to_copy->begin(); dartmap_iter!=dartmap_iter_end;
|
||||||
++dartmap_iter)
|
++dartmap_iter)
|
||||||
|
|
@ -305,9 +306,9 @@ namespace CGAL {
|
||||||
typename PointConverter>
|
typename PointConverter>
|
||||||
void copy(GMap2& amap,
|
void copy(GMap2& amap,
|
||||||
std::unordered_map
|
std::unordered_map
|
||||||
<typename GMap2::Dart_handle, Dart_handle>* origin_to_copy,
|
<typename GMap2::Dart_handle, Dart_handle, Hash_function>* origin_to_copy,
|
||||||
std::unordered_map
|
std::unordered_map
|
||||||
<Dart_handle, typename GMap2::Dart_handle>* copy_to_origin,
|
<Dart_handle, typename GMap2::Dart_handle, Hash_function>* copy_to_origin,
|
||||||
const Converters& converters,
|
const Converters& converters,
|
||||||
const DartInfoConverter& dartinfoconverter,
|
const DartInfoConverter& dartinfoconverter,
|
||||||
const PointConverter& pointconverter,
|
const PointConverter& pointconverter,
|
||||||
|
|
@ -327,9 +328,9 @@ namespace CGAL {
|
||||||
typename PointConverter>
|
typename PointConverter>
|
||||||
void copy_from_const(const GMap2& amap,
|
void copy_from_const(const GMap2& amap,
|
||||||
std::unordered_map
|
std::unordered_map
|
||||||
<typename GMap2::Dart_const_handle, Dart_handle>* origin_to_copy,
|
<typename GMap2::Dart_const_handle, Dart_handle, Hash_function>* origin_to_copy,
|
||||||
std::unordered_map
|
std::unordered_map
|
||||||
<Dart_handle, typename GMap2::Dart_const_handle>* copy_to_origin,
|
<Dart_handle, typename GMap2::Dart_const_handle, Hash_function>* copy_to_origin,
|
||||||
const Converters& converters,
|
const Converters& converters,
|
||||||
const DartInfoConverter& dartinfoconverter,
|
const DartInfoConverter& dartinfoconverter,
|
||||||
const PointConverter& pointconverter,
|
const PointConverter& pointconverter,
|
||||||
|
|
@ -348,9 +349,9 @@ namespace CGAL {
|
||||||
template<typename GMap2, typename Converters, typename DartInfoConverter>
|
template<typename GMap2, typename Converters, typename DartInfoConverter>
|
||||||
void copy(GMap2& amap,
|
void copy(GMap2& amap,
|
||||||
std::unordered_map
|
std::unordered_map
|
||||||
<typename GMap2::Dart_handle, Dart_handle>* origin_to_copy,
|
<typename GMap2::Dart_handle, Dart_handle, Hash_function>* origin_to_copy,
|
||||||
std::unordered_map
|
std::unordered_map
|
||||||
<Dart_handle, typename GMap2::Dart_handle>* copy_to_origin,
|
<Dart_handle, typename GMap2::Dart_handle, Hash_function>* copy_to_origin,
|
||||||
const Converters& converters,
|
const Converters& converters,
|
||||||
const DartInfoConverter& dartinfoconverter,
|
const DartInfoConverter& dartinfoconverter,
|
||||||
bool copy_marks=true,
|
bool copy_marks=true,
|
||||||
|
|
@ -368,9 +369,9 @@ namespace CGAL {
|
||||||
template <typename GMap2, typename Converters, typename DartInfoConverter>
|
template <typename GMap2, typename Converters, typename DartInfoConverter>
|
||||||
void copy_from_const(const GMap2& amap,
|
void copy_from_const(const GMap2& amap,
|
||||||
std::unordered_map
|
std::unordered_map
|
||||||
<typename GMap2::Dart_const_handle, Dart_handle>* origin_to_copy,
|
<typename GMap2::Dart_const_handle, Dart_handle, Hash_function>* origin_to_copy,
|
||||||
std::unordered_map
|
std::unordered_map
|
||||||
<Dart_handle, typename GMap2::Dart_const_handle>* copy_to_origin,
|
<Dart_handle, typename GMap2::Dart_const_handle, Hash_function>* copy_to_origin,
|
||||||
const Converters& converters,
|
const Converters& converters,
|
||||||
const DartInfoConverter& dartinfoconverter,
|
const DartInfoConverter& dartinfoconverter,
|
||||||
bool copy_marks=true,
|
bool copy_marks=true,
|
||||||
|
|
@ -388,9 +389,9 @@ namespace CGAL {
|
||||||
template<typename GMap2, typename Converters>
|
template<typename GMap2, typename Converters>
|
||||||
void copy(GMap2& amap,
|
void copy(GMap2& amap,
|
||||||
std::unordered_map
|
std::unordered_map
|
||||||
<typename GMap2::Dart_handle, Dart_handle>* origin_to_copy,
|
<typename GMap2::Dart_handle, Dart_handle, Hash_function>* origin_to_copy,
|
||||||
std::unordered_map
|
std::unordered_map
|
||||||
<Dart_handle, typename GMap2::Dart_handle>* copy_to_origin,
|
<Dart_handle, typename GMap2::Dart_handle, Hash_function>* copy_to_origin,
|
||||||
const Converters& converters,
|
const Converters& converters,
|
||||||
bool copy_marks=true,
|
bool copy_marks=true,
|
||||||
bool copy_perforated_darts=false,
|
bool copy_perforated_darts=false,
|
||||||
|
|
@ -405,9 +406,9 @@ namespace CGAL {
|
||||||
template <typename GMap2, typename Converters>
|
template <typename GMap2, typename Converters>
|
||||||
void copy_from_const(const GMap2& amap,
|
void copy_from_const(const GMap2& amap,
|
||||||
std::unordered_map
|
std::unordered_map
|
||||||
<typename GMap2::Dart_const_handle, Dart_handle>* origin_to_copy,
|
<typename GMap2::Dart_const_handle, Dart_handle, Hash_function>* origin_to_copy,
|
||||||
std::unordered_map
|
std::unordered_map
|
||||||
<Dart_handle, typename GMap2::Dart_const_handle>* copy_to_origin,
|
<Dart_handle, typename GMap2::Dart_const_handle, Hash_function>* copy_to_origin,
|
||||||
const Converters& converters,
|
const Converters& converters,
|
||||||
bool copy_marks=true,
|
bool copy_marks=true,
|
||||||
bool copy_perforated_darts=false,
|
bool copy_perforated_darts=false,
|
||||||
|
|
@ -422,9 +423,9 @@ namespace CGAL {
|
||||||
template<typename GMap2>
|
template<typename GMap2>
|
||||||
void copy(GMap2& amap,
|
void copy(GMap2& amap,
|
||||||
std::unordered_map
|
std::unordered_map
|
||||||
<typename GMap2::Dart_handle, Dart_handle>* origin_to_copy=nullptr,
|
<typename GMap2::Dart_handle, Dart_handle, Hash_function>* origin_to_copy=nullptr,
|
||||||
std::unordered_map
|
std::unordered_map
|
||||||
<Dart_handle, typename GMap2::Dart_handle>* copy_to_origin=nullptr,
|
<Dart_handle, typename GMap2::Dart_handle, Hash_function>* copy_to_origin=nullptr,
|
||||||
bool copy_marks=true,
|
bool copy_marks=true,
|
||||||
bool copy_perforated_darts=false,
|
bool copy_perforated_darts=false,
|
||||||
size_type mark_perforated=INVALID_MARK)
|
size_type mark_perforated=INVALID_MARK)
|
||||||
|
|
@ -438,9 +439,9 @@ namespace CGAL {
|
||||||
template <typename GMap2>
|
template <typename GMap2>
|
||||||
void copy_from_const(const GMap2& amap,
|
void copy_from_const(const GMap2& amap,
|
||||||
std::unordered_map
|
std::unordered_map
|
||||||
<typename GMap2::Dart_const_handle, Dart_handle>* origin_to_copy=nullptr,
|
<typename GMap2::Dart_const_handle, Dart_handle, Hash_function>* origin_to_copy=nullptr,
|
||||||
std::unordered_map
|
std::unordered_map
|
||||||
<Dart_handle, typename GMap2::Dart_const_handle>* copy_to_origin=nullptr,
|
<Dart_handle, typename GMap2::Dart_const_handle, Hash_function>* copy_to_origin=nullptr,
|
||||||
bool copy_marks=true,
|
bool copy_marks=true,
|
||||||
bool copy_perforated_darts=false,
|
bool copy_perforated_darts=false,
|
||||||
size_type mark_perforated=INVALID_MARK)
|
size_type mark_perforated=INVALID_MARK)
|
||||||
|
|
@ -2488,8 +2489,7 @@ namespace CGAL {
|
||||||
{
|
{
|
||||||
CGAL_assertion( is_without_boundary(dimension) );
|
CGAL_assertion( is_without_boundary(dimension) );
|
||||||
|
|
||||||
CGAL::Unique_hash_map< Dart_handle, Dart_handle,
|
CGAL::Unique_hash_map< Dart_handle, Dart_handle,Hash_function > dual;
|
||||||
typename Self::Hash_function > dual;
|
|
||||||
Dart_handle d, d2, res = amap.null_handle;
|
Dart_handle d, d2, res = amap.null_handle;
|
||||||
|
|
||||||
// We clear amap. TODO return a new amap ?
|
// We clear amap. TODO return a new amap ?
|
||||||
|
|
@ -2582,7 +2582,7 @@ namespace CGAL {
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
CGAL::Unique_hash_map<Dart_const_handle,
|
CGAL::Unique_hash_map<Dart_const_handle,
|
||||||
typename Map2::Dart_const_handle,
|
typename Map2::Dart_const_handle,
|
||||||
typename Self::Hash_function> bijection;
|
Hash_function> bijection;
|
||||||
|
|
||||||
while (match && !toTreat1.empty())
|
while (match && !toTreat1.empty())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ bool test_GMAP_3()
|
||||||
|
|
||||||
trace_test_begin();
|
trace_test_begin();
|
||||||
InitDartInfo<GMAP>::run(gmap);
|
InitDartInfo<GMAP>::run(gmap);
|
||||||
/* TODO GMAP gmap2(gmap);
|
GMAP gmap2(gmap);
|
||||||
if ( !check_number_of_cells_3(gmap2, 12, 20, 9, 2, 1) )
|
if ( !check_number_of_cells_3(gmap2, 12, 20, 9, 2, 1) )
|
||||||
return false;
|
return false;
|
||||||
if ( !gmap.is_isomorphic_to(gmap2) )
|
if ( !gmap.is_isomorphic_to(gmap2) )
|
||||||
|
|
@ -115,7 +115,7 @@ bool test_GMAP_3()
|
||||||
std::cout<<"Error: gmap and gmap2 are not isomorphic (after copy).\n";
|
std::cout<<"Error: gmap and gmap2 are not isomorphic (after copy).\n";
|
||||||
assert(false);
|
assert(false);
|
||||||
return false;
|
return false;
|
||||||
} */
|
}
|
||||||
|
|
||||||
trace_test_begin();
|
trace_test_begin();
|
||||||
gmap.template close<2>();
|
gmap.template close<2>();
|
||||||
|
|
@ -143,12 +143,12 @@ bool test_GMAP_3()
|
||||||
gmap.template remove_cell<2>(gmap.alpha(dh9, 1, 0, 1, 2));
|
gmap.template remove_cell<2>(gmap.alpha(dh9, 1, 0, 1, 2));
|
||||||
if ( !check_number_of_cells_3(gmap, 12, 20, 9, 2, 1) )
|
if ( !check_number_of_cells_3(gmap, 12, 20, 9, 2, 1) )
|
||||||
return false;
|
return false;
|
||||||
/*TODO if ( !gmap.is_isomorphic_to(gmap2) )
|
if ( !gmap.is_isomorphic_to(gmap2) )
|
||||||
{
|
{
|
||||||
std::cout<<"Error: gmap and gmap2 are not isomorphic (after close and removals).\n";
|
std::cout<<"Error: gmap and gmap2 are not isomorphic (after close and removals).\n";
|
||||||
assert(false);
|
assert(false);
|
||||||
return false;
|
return false;
|
||||||
} */
|
}
|
||||||
gmap.clear();
|
gmap.clear();
|
||||||
|
|
||||||
if (!test_vertex_insertion(gmap))
|
if (!test_vertex_insertion(gmap))
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ bool test_GMAP_4()
|
||||||
|
|
||||||
trace_test_begin();
|
trace_test_begin();
|
||||||
InitDartInfo<GMAP>::run(gmap);
|
InitDartInfo<GMAP>::run(gmap);
|
||||||
/* TODO GMAP gmap2(gmap);
|
GMAP gmap2(gmap);
|
||||||
if ( !check_number_of_cells_4(gmap2, 12, 20, 9, 2, 2, 1) )
|
if ( !check_number_of_cells_4(gmap2, 12, 20, 9, 2, 2, 1) )
|
||||||
return false;
|
return false;
|
||||||
if ( !gmap.is_isomorphic_to(gmap2) )
|
if ( !gmap.is_isomorphic_to(gmap2) )
|
||||||
|
|
@ -116,7 +116,7 @@ bool test_GMAP_4()
|
||||||
std::cout<<"Error: gmap and gmap2 are not isomorphic (after copy).\n";
|
std::cout<<"Error: gmap and gmap2 are not isomorphic (after copy).\n";
|
||||||
assert(false);
|
assert(false);
|
||||||
return false;
|
return false;
|
||||||
} */
|
}
|
||||||
|
|
||||||
trace_test_begin();
|
trace_test_begin();
|
||||||
gmap.template close<2>();
|
gmap.template close<2>();
|
||||||
|
|
@ -156,12 +156,12 @@ bool test_GMAP_4()
|
||||||
if ( !check_number_of_cells_4(gmap, 12, 20, 9, 2, 2, 1) )
|
if ( !check_number_of_cells_4(gmap, 12, 20, 9, 2, 2, 1) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* if ( !gmap.is_isomorphic_to(gmap2) )
|
if ( !gmap.is_isomorphic_to(gmap2) )
|
||||||
{
|
{
|
||||||
std::cout<<"Error: gmap and gmap2 are not isomorphic (after close and removals).\n";
|
std::cout<<"Error: gmap and gmap2 are not isomorphic (after close and removals).\n";
|
||||||
assert(false);
|
assert(false);
|
||||||
return false;
|
return false;
|
||||||
} */
|
}
|
||||||
gmap.clear();
|
gmap.clear();
|
||||||
|
|
||||||
if (!test_vertex_insertion(gmap))
|
if (!test_vertex_insertion(gmap))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue