mirror of https://github.com/CGAL/cgal
Add hashing to the concurent compact container
This commit is contained in:
parent
da3d119acb
commit
2b43a79e0a
|
|
@ -5,6 +5,7 @@
|
||||||
#include <CGAL/Polyhedron_3.h>
|
#include <CGAL/Polyhedron_3.h>
|
||||||
#include <CGAL/Surface_mesh.h>
|
#include <CGAL/Surface_mesh.h>
|
||||||
#include <CGAL/Triangulation_2.h>
|
#include <CGAL/Triangulation_2.h>
|
||||||
|
#include <CGAL/Delaunay_triangulation_3.h>
|
||||||
#include <CGAL/Linear_cell_complex.h>
|
#include <CGAL/Linear_cell_complex.h>
|
||||||
#include <CGAL/boost/graph/graph_traits_Arrangement_2.h>
|
#include <CGAL/boost/graph/graph_traits_Arrangement_2.h>
|
||||||
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
|
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
|
||||||
|
|
@ -20,6 +21,14 @@ typedef CGAL::Arrangement_2<Arrangement_traits_2> Arrangement_2;
|
||||||
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
|
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
|
||||||
typedef CGAL::Surface_mesh<Kernel::Point_3> Surface_mesh;
|
typedef CGAL::Surface_mesh<Kernel::Point_3> Surface_mesh;
|
||||||
typedef CGAL::Triangulation_2<Kernel> Triangulation_2;
|
typedef CGAL::Triangulation_2<Kernel> Triangulation_2;
|
||||||
|
#ifdef CGAL_LINKED_WITH_TBB
|
||||||
|
typedef CGAL::Triangulation_data_structure_3<
|
||||||
|
CGAL::Triangulation_vertex_base_3<Kernel>,
|
||||||
|
CGAL::Triangulation_cell_base_3<Kernel>,
|
||||||
|
CGAL::Parallel_tag> Tds;
|
||||||
|
typedef CGAL::Delaunay_triangulation_3<Kernel, Tds> Triangulation_3;
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef CGAL::Linear_cell_complex<3, 3> Linear_cell_complex_3;
|
typedef CGAL::Linear_cell_complex<3, 3> Linear_cell_complex_3;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -59,6 +68,20 @@ void fct2()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename P>
|
||||||
|
void
|
||||||
|
fct3(const P& )
|
||||||
|
{
|
||||||
|
typedef typename P::Vertex_handle vertex_descriptor;
|
||||||
|
|
||||||
|
std::map<vertex_descriptor,int> M;
|
||||||
|
vertex_descriptor vd;
|
||||||
|
M.find(vd);
|
||||||
|
|
||||||
|
boost::unordered_map<vertex_descriptor, int> U;
|
||||||
|
U[vd] = 12;
|
||||||
|
}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
Arrangement_2 A;
|
Arrangement_2 A;
|
||||||
|
|
@ -75,6 +98,10 @@ int main()
|
||||||
|
|
||||||
fct2();
|
fct2();
|
||||||
|
|
||||||
|
#ifdef CGAL_LINKED_WITH_TBB
|
||||||
|
Triangulation_3 T3;
|
||||||
|
fct3(T3);
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1022,9 +1022,39 @@ namespace CCC_internal {
|
||||||
return rhs.operator->() != NULL;
|
return rhs.operator->() != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class CCC, bool Const>
|
||||||
|
std::size_t hash_value(const CCC_iterator<CCC, Const>& i)
|
||||||
|
{
|
||||||
|
return reinterpret_cast<std::size_t>(&*i) / sizeof(typename CCC::value_type);
|
||||||
|
}
|
||||||
} // namespace CCC_internal
|
} // namespace CCC_internal
|
||||||
|
|
||||||
} //namespace CGAL
|
} //namespace CGAL
|
||||||
|
namespace std {
|
||||||
|
|
||||||
|
#if defined(BOOST_MSVC)
|
||||||
|
# pragma warning(push)
|
||||||
|
# pragma warning(disable:4099) // For VC10 it is class hash
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CGAL_CFG_NO_STD_HASH
|
||||||
|
|
||||||
|
template < class CCC, bool Const >
|
||||||
|
struct hash<CGAL::CCC_internal::CCC_iterator<CCC, Const> >
|
||||||
|
: public std::unary_function<CGAL::CCC_internal::CCC_iterator<CCC, Const>, std::size_t> {
|
||||||
|
|
||||||
|
std::size_t operator()(const CGAL::CCC_internal::CCC_iterator<CCC, Const>& i) const
|
||||||
|
{
|
||||||
|
return reinterpret_cast<std::size_t>(&*i) / sizeof(typename CCC::value_type);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
#endif // CGAL_CFG_NO_STD_HASH
|
||||||
|
|
||||||
|
#if defined(BOOST_MSVC)
|
||||||
|
# pragma warning(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} // namespace std
|
||||||
|
|
||||||
#endif // CGAL_CONCURRENT_COMPACT_CONTAINER_H
|
#endif // CGAL_CONCURRENT_COMPACT_CONTAINER_H
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue