mirror of https://github.com/CGAL/cgal
Const correctness for shortest non contractible cycle ok.
This commit is contained in:
parent
4095cda512
commit
7b65cb0004
|
|
@ -9,8 +9,8 @@
|
|||
|
||||
using LCC_3 =CGAL::Linear_cell_complex_for_combinatorial_map<2, 3>;
|
||||
using CST =CGAL::Surface_mesh_topology::Curves_on_surface_topology<LCC_3>;
|
||||
using Path_on_surface=CGAL::Surface_mesh_topology::Path_on_surface<LCC_3>;
|
||||
using Dart_handle =LCC_3::Dart_handle;
|
||||
using Path_on_surface =CGAL::Surface_mesh_topology::Path_on_surface<LCC_3>;
|
||||
using Dart_const_handle=LCC_3::Dart_const_handle;
|
||||
|
||||
struct Draw_functor : public CGAL::DefaultDrawingFunctorLCC
|
||||
{
|
||||
|
|
@ -71,7 +71,7 @@ int main(int argc, char* argv[])
|
|||
std::cout<<"File '"<<filename<<"' loaded. Finding the facewidth..."<<std::endl;
|
||||
|
||||
CST cst(lcc, true);
|
||||
std::vector<Dart_handle> cycle = cst.compute_facewidth(true);
|
||||
std::vector<Dart_const_handle> cycle=cst.compute_facewidth(true);
|
||||
|
||||
if (cycle.size()==0)
|
||||
{ std::cout<<" Cannot find such cycle. Stop."<<std::endl; }
|
||||
|
|
|
|||
|
|
@ -34,7 +34,8 @@ public:
|
|||
// Types for shortest noncontractible cycle
|
||||
using Shortest_noncontractible_cycle=typename internal::Shortest_noncontractible_cycle<Mesh>;
|
||||
using Facewidth =typename internal::Facewidth<Mesh>;
|
||||
using Dart_handle =typename Shortest_noncontractible_cycle::Original_dart_const_handle;
|
||||
using Dart_const_handle =typename Shortest_noncontractible_cycle::Original_dart_const_handle;
|
||||
using halfedge_descriptor =Dart_const_handle ; // To be compatible with BGL
|
||||
|
||||
// Constructor
|
||||
Curves_on_surface_topology(const Mesh& amesh, bool /* display_time */=false) :
|
||||
|
|
@ -114,28 +115,19 @@ public:
|
|||
|
||||
template <class WeightFunctor>
|
||||
Path_on_surface<Mesh> compute_shortest_noncontractible_cycle_with_basepoint
|
||||
(Dart_handle dh, const WeightFunctor& wf, bool display_time=false) const
|
||||
(Dart_const_handle dh, const WeightFunctor& wf, bool display_time=false) const
|
||||
{
|
||||
compute_shortest_noncontractible_cycle_representation(display_time);
|
||||
return m_shortest_noncontractible_cycle->compute_cycle(dh, NULL, wf, display_time);
|
||||
}
|
||||
|
||||
Path_on_surface<Mesh> compute_shortest_noncontractible_cycle_with_basepoint
|
||||
(Dart_handle dh, bool display_time=false) const
|
||||
(Dart_const_handle dh, bool display_time=false) const
|
||||
{
|
||||
compute_shortest_noncontractible_cycle_representation(display_time);
|
||||
return m_shortest_noncontractible_cycle->compute_cycle(dh, display_time);
|
||||
}
|
||||
|
||||
bool is_facewidth_representation_computed() const
|
||||
{ return m_facewidth!=nullptr; }
|
||||
|
||||
void compute_facewidth_representation(bool display_time=false) const
|
||||
{
|
||||
if (m_facewidth==nullptr)
|
||||
{ m_facewidth=std::make_unique<Facewidth>(m_original_mesh, display_time); }
|
||||
}
|
||||
|
||||
template <class WeightFunctor>
|
||||
Path_on_surface<Mesh> compute_edgewidth(const WeightFunctor& wf, bool display_time=false) const
|
||||
{
|
||||
|
|
@ -149,7 +141,16 @@ public:
|
|||
return m_shortest_noncontractible_cycle->compute_edgewidth(display_time);
|
||||
}
|
||||
|
||||
std::vector<Dart_handle> compute_facewidth(bool display_time=false) const
|
||||
bool is_facewidth_representation_computed() const
|
||||
{ return m_facewidth!=nullptr; }
|
||||
|
||||
void compute_facewidth_representation(bool display_time=false) const
|
||||
{
|
||||
if (m_facewidth==nullptr)
|
||||
{ m_facewidth=std::make_unique<Facewidth>(m_original_mesh, display_time); }
|
||||
}
|
||||
|
||||
std::vector<Dart_const_handle> compute_facewidth(bool display_time=false) const
|
||||
{
|
||||
compute_facewidth_representation(display_time);
|
||||
return m_facewidth->compute_facewidth(display_time);
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public:
|
|||
using Mesh=Mesh_;
|
||||
|
||||
using Original_map_wrapper=internal::Generic_map_selector<Mesh>;
|
||||
using Original_dart_const_handle=typename Original_map_wrapper::Dart_handle_original; // TODO SOLVE const problem with copy
|
||||
using Original_dart_const_handle=typename Original_map_wrapper::Dart_const_handle_original;
|
||||
|
||||
using Local_map =typename Original_map_wrapper::Generic_map;
|
||||
using Dart_handle =typename Local_map::Dart_handle;
|
||||
|
|
|
|||
|
|
@ -38,15 +38,15 @@ namespace internal {
|
|||
struct SNC_for_generalized_map {
|
||||
using Mesh_original = Mesh_;
|
||||
using Generic_map = CGAL::Generalized_map<2, Shortest_noncontractible_cycle_local_map_items>;
|
||||
using Dart_handle_original = typename Mesh_original::Dart_handle;
|
||||
using Dart_const_handle_original = typename Mesh_original::Dart_const_handle;
|
||||
using Copy_to_origin_map = boost::unordered_map<typename Generic_map::Dart_handle,
|
||||
Dart_handle_original>;
|
||||
using Origin_to_copy_map = boost::unordered_map<Dart_handle_original,
|
||||
Dart_const_handle_original>;
|
||||
using Origin_to_copy_map = boost::unordered_map<Dart_const_handle_original,
|
||||
typename Generic_map::Dart_handle>;
|
||||
|
||||
static void copy(Generic_map& target, Mesh_original& source,
|
||||
Origin_to_copy_map& origin_to_copy, Copy_to_origin_map& copy_to_origin,
|
||||
static void copy(Generic_map& target, const Mesh_original& source,
|
||||
Origin_to_copy_map& origin_to_copy,
|
||||
Copy_to_origin_map& copy_to_origin,
|
||||
Generic_map::size_type mark_perforated)
|
||||
{
|
||||
target.copy(source, &origin_to_copy, ©_to_origin, true, mark_perforated);
|
||||
|
|
@ -57,14 +57,13 @@ namespace internal {
|
|||
struct SNC_for_combinatorial_map {
|
||||
using Mesh_original = Mesh_;
|
||||
using Generic_map = CGAL::Combinatorial_map<2, Shortest_noncontractible_cycle_local_map_items>;
|
||||
using Dart_handle_original = typename Mesh_original::Dart_handle;
|
||||
using Dart_const_handle_original = typename Mesh_original::Dart_const_handle;
|
||||
using Copy_to_origin_map = boost::unordered_map<typename Generic_map::Dart_handle,
|
||||
Dart_handle_original>;
|
||||
using Origin_to_copy_map = boost::unordered_map<Dart_handle_original,
|
||||
Dart_const_handle_original>;
|
||||
using Origin_to_copy_map = boost::unordered_map<Dart_const_handle_original,
|
||||
typename Generic_map::Dart_handle>;
|
||||
|
||||
static void copy(Generic_map& target, Mesh_original& source,
|
||||
static void copy(Generic_map& target, const Mesh_original& source,
|
||||
Origin_to_copy_map& origin_to_copy, Copy_to_origin_map& copy_to_origin,
|
||||
Generic_map::size_type mark_perforated)
|
||||
{
|
||||
|
|
@ -76,14 +75,13 @@ namespace internal {
|
|||
struct Generic_map_selector {
|
||||
using Mesh_original = Mesh_;
|
||||
using Generic_map = CGAL::Combinatorial_map<2, Shortest_noncontractible_cycle_local_map_items>;
|
||||
using Dart_handle_original = typename boost::graph_traits<Mesh_original>::halfedge_descriptor;
|
||||
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,
|
||||
Dart_handle_original>;
|
||||
using Origin_to_copy_map = boost::unordered_map<Dart_handle_original,
|
||||
Dart_const_handle_original>;
|
||||
using Origin_to_copy_map = boost::unordered_map<Dart_const_handle_original,
|
||||
typename Generic_map::Dart_handle>;
|
||||
|
||||
static void copy(Generic_map& target, Mesh_original& source,
|
||||
static void copy(Generic_map& target, const Mesh_original& source,
|
||||
Origin_to_copy_map& origin_to_copy, Copy_to_origin_map& copy_to_origin,
|
||||
Generic_map::size_type mark_perforated)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public:
|
|||
using Mesh=Mesh_;
|
||||
|
||||
using Original_map_wrapper=internal::Generic_map_selector<Mesh>;
|
||||
using Original_dart_const_handle=typename Original_map_wrapper::Dart_handle_original; // TODO SOLVE const problem with copy
|
||||
using Original_dart_const_handle=typename Original_map_wrapper::Dart_const_handle_original;
|
||||
|
||||
using Local_map =typename Original_map_wrapper::Generic_map;
|
||||
using Dart_handle =typename Local_map::Dart_handle;
|
||||
|
|
|
|||
Loading…
Reference in New Issue