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::Dart_range Dart_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 INVALID_MARK = NB_MARKS;
|
||||
|
||||
|
|
@ -199,8 +200,8 @@ namespace CGAL {
|
|||
typename Converters, typename DartInfoConverter,
|
||||
typename PointConverter>
|
||||
void generic_copy(GMap2& amap,
|
||||
std::unordered_map<Dart_handle_2, Dart_handle>* origin_to_copy,
|
||||
std::unordered_map<Dart_handle, Dart_handle_2>* copy_to_origin,
|
||||
std::unordered_map<Dart_handle_2, Dart_handle,Hash_function>* origin_to_copy,
|
||||
std::unordered_map<Dart_handle, Dart_handle_2,Hash_function>* copy_to_origin,
|
||||
const Converters& converters,
|
||||
const DartInfoConverter& dartinfoconverter,
|
||||
const PointConverter& pointconverter,
|
||||
|
|
@ -231,7 +232,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...
|
||||
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
|
||||
{ origin_to_copy=&local_dartmap; }
|
||||
|
||||
|
|
@ -269,7 +270,7 @@ namespace CGAL {
|
|||
|
||||
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();
|
||||
for (dartmap_iter=origin_to_copy->begin(); dartmap_iter!=dartmap_iter_end;
|
||||
++dartmap_iter)
|
||||
|
|
@ -305,9 +306,9 @@ namespace CGAL {
|
|||
typename PointConverter>
|
||||
void copy(GMap2& amap,
|
||||
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
|
||||
<Dart_handle, typename GMap2::Dart_handle>* copy_to_origin,
|
||||
<Dart_handle, typename GMap2::Dart_handle, Hash_function>* copy_to_origin,
|
||||
const Converters& converters,
|
||||
const DartInfoConverter& dartinfoconverter,
|
||||
const PointConverter& pointconverter,
|
||||
|
|
@ -327,9 +328,9 @@ namespace CGAL {
|
|||
typename PointConverter>
|
||||
void copy_from_const(const GMap2& amap,
|
||||
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
|
||||
<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 DartInfoConverter& dartinfoconverter,
|
||||
const PointConverter& pointconverter,
|
||||
|
|
@ -348,9 +349,9 @@ namespace CGAL {
|
|||
template<typename GMap2, typename Converters, typename DartInfoConverter>
|
||||
void copy(GMap2& amap,
|
||||
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
|
||||
<Dart_handle, typename GMap2::Dart_handle>* copy_to_origin,
|
||||
<Dart_handle, typename GMap2::Dart_handle, Hash_function>* copy_to_origin,
|
||||
const Converters& converters,
|
||||
const DartInfoConverter& dartinfoconverter,
|
||||
bool copy_marks=true,
|
||||
|
|
@ -368,9 +369,9 @@ namespace CGAL {
|
|||
template <typename GMap2, typename Converters, typename DartInfoConverter>
|
||||
void copy_from_const(const GMap2& amap,
|
||||
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
|
||||
<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 DartInfoConverter& dartinfoconverter,
|
||||
bool copy_marks=true,
|
||||
|
|
@ -388,9 +389,9 @@ namespace CGAL {
|
|||
template<typename GMap2, typename Converters>
|
||||
void copy(GMap2& amap,
|
||||
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
|
||||
<Dart_handle, typename GMap2::Dart_handle>* copy_to_origin,
|
||||
<Dart_handle, typename GMap2::Dart_handle, Hash_function>* copy_to_origin,
|
||||
const Converters& converters,
|
||||
bool copy_marks=true,
|
||||
bool copy_perforated_darts=false,
|
||||
|
|
@ -405,9 +406,9 @@ namespace CGAL {
|
|||
template <typename GMap2, typename Converters>
|
||||
void copy_from_const(const GMap2& amap,
|
||||
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
|
||||
<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,
|
||||
bool copy_marks=true,
|
||||
bool copy_perforated_darts=false,
|
||||
|
|
@ -422,9 +423,9 @@ namespace CGAL {
|
|||
template<typename GMap2>
|
||||
void copy(GMap2& amap,
|
||||
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
|
||||
<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_perforated_darts=false,
|
||||
size_type mark_perforated=INVALID_MARK)
|
||||
|
|
@ -438,9 +439,9 @@ namespace CGAL {
|
|||
template <typename GMap2>
|
||||
void copy_from_const(const GMap2& amap,
|
||||
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
|
||||
<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_perforated_darts=false,
|
||||
size_type mark_perforated=INVALID_MARK)
|
||||
|
|
@ -2488,8 +2489,7 @@ namespace CGAL {
|
|||
{
|
||||
CGAL_assertion( is_without_boundary(dimension) );
|
||||
|
||||
CGAL::Unique_hash_map< Dart_handle, Dart_handle,
|
||||
typename Self::Hash_function > dual;
|
||||
CGAL::Unique_hash_map< Dart_handle, Dart_handle,Hash_function > dual;
|
||||
Dart_handle d, d2, res = amap.null_handle;
|
||||
|
||||
// We clear amap. TODO return a new amap ?
|
||||
|
|
@ -2582,7 +2582,7 @@ namespace CGAL {
|
|||
unsigned int i = 0;
|
||||
CGAL::Unique_hash_map<Dart_const_handle,
|
||||
typename Map2::Dart_const_handle,
|
||||
typename Self::Hash_function> bijection;
|
||||
Hash_function> bijection;
|
||||
|
||||
while (match && !toTreat1.empty())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ bool test_GMAP_3()
|
|||
|
||||
trace_test_begin();
|
||||
InitDartInfo<GMAP>::run(gmap);
|
||||
/* TODO GMAP gmap2(gmap);
|
||||
GMAP gmap2(gmap);
|
||||
if ( !check_number_of_cells_3(gmap2, 12, 20, 9, 2, 1) )
|
||||
return false;
|
||||
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";
|
||||
assert(false);
|
||||
return false;
|
||||
} */
|
||||
}
|
||||
|
||||
trace_test_begin();
|
||||
gmap.template close<2>();
|
||||
|
|
@ -143,12 +143,12 @@ bool test_GMAP_3()
|
|||
gmap.template remove_cell<2>(gmap.alpha(dh9, 1, 0, 1, 2));
|
||||
if ( !check_number_of_cells_3(gmap, 12, 20, 9, 2, 1) )
|
||||
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";
|
||||
assert(false);
|
||||
return false;
|
||||
} */
|
||||
}
|
||||
gmap.clear();
|
||||
|
||||
if (!test_vertex_insertion(gmap))
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ bool test_GMAP_4()
|
|||
|
||||
trace_test_begin();
|
||||
InitDartInfo<GMAP>::run(gmap);
|
||||
/* TODO GMAP gmap2(gmap);
|
||||
GMAP gmap2(gmap);
|
||||
if ( !check_number_of_cells_4(gmap2, 12, 20, 9, 2, 2, 1) )
|
||||
return false;
|
||||
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";
|
||||
assert(false);
|
||||
return false;
|
||||
} */
|
||||
}
|
||||
|
||||
trace_test_begin();
|
||||
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) )
|
||||
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";
|
||||
assert(false);
|
||||
return false;
|
||||
} */
|
||||
}
|
||||
gmap.clear();
|
||||
|
||||
if (!test_vertex_insertion(gmap))
|
||||
|
|
|
|||
Loading…
Reference in New Issue