diff --git a/Surface_mesh_topology/examples/Surface_mesh_topology/facewidth_on_unweighted_map.cpp b/Surface_mesh_topology/examples/Surface_mesh_topology/facewidth_on_unweighted_map.cpp index c939af3aac9..8d761ae0bd4 100644 --- a/Surface_mesh_topology/examples/Surface_mesh_topology/facewidth_on_unweighted_map.cpp +++ b/Surface_mesh_topology/examples/Surface_mesh_topology/facewidth_on_unweighted_map.cpp @@ -7,10 +7,10 @@ #include #include -using LCC_3 =CGAL::Linear_cell_complex_for_combinatorial_map<2, 3>; -using CST =CGAL::Surface_mesh_topology::Curves_on_surface_topology; -using Path_on_surface=CGAL::Surface_mesh_topology::Path_on_surface; -using Dart_handle =LCC_3::Dart_handle; +using LCC_3 =CGAL::Linear_cell_complex_for_combinatorial_map<2, 3>; +using CST =CGAL::Surface_mesh_topology::Curves_on_surface_topology; +using Path_on_surface =CGAL::Surface_mesh_topology::Path_on_surface; +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 '"< cycle = cst.compute_facewidth(true); + std::vector cycle=cst.compute_facewidth(true); if (cycle.size()==0) { std::cout<<" Cannot find such cycle. Stop."<; using Facewidth =typename internal::Facewidth; - 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 Path_on_surface 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 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(m_original_mesh, display_time); } - } - template Path_on_surface 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 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(m_original_mesh, display_time); } + } + + std::vector compute_facewidth(bool display_time=false) const { compute_facewidth_representation(display_time); return m_facewidth->compute_facewidth(display_time); diff --git a/Surface_mesh_topology/include/CGAL/Surface_mesh_topology/internal/Facewidth.h b/Surface_mesh_topology/include/CGAL/Surface_mesh_topology/internal/Facewidth.h index de302b84530..f4a44b81fcf 100644 --- a/Surface_mesh_topology/include/CGAL/Surface_mesh_topology/internal/Facewidth.h +++ b/Surface_mesh_topology/include/CGAL/Surface_mesh_topology/internal/Facewidth.h @@ -31,7 +31,7 @@ public: using Mesh=Mesh_; using Original_map_wrapper=internal::Generic_map_selector; - 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; diff --git a/Surface_mesh_topology/include/CGAL/Surface_mesh_topology/internal/Generic_map_selector.h b/Surface_mesh_topology/include/CGAL/Surface_mesh_topology/internal/Generic_map_selector.h index f411e94cd79..d4502177556 100644 --- a/Surface_mesh_topology/include/CGAL/Surface_mesh_topology/internal/Generic_map_selector.h +++ b/Surface_mesh_topology/include/CGAL/Surface_mesh_topology/internal/Generic_map_selector.h @@ -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; - using Origin_to_copy_map = boost::unordered_map; + using Origin_to_copy_map = boost::unordered_map; - 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; - using Origin_to_copy_map = boost::unordered_map; + using Origin_to_copy_map = boost::unordered_map; - 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::halfedge_descriptor; using Dart_const_handle_original = typename boost::graph_traits::halfedge_descriptor; using Copy_to_origin_map = boost::unordered_map; - using Origin_to_copy_map = boost::unordered_map; + using Origin_to_copy_map = boost::unordered_map; - 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) { diff --git a/Surface_mesh_topology/include/CGAL/Surface_mesh_topology/internal/Shortest_noncontractible_cycle.h b/Surface_mesh_topology/include/CGAL/Surface_mesh_topology/internal/Shortest_noncontractible_cycle.h index 4fbfadef888..84827fc5c8c 100644 --- a/Surface_mesh_topology/include/CGAL/Surface_mesh_topology/internal/Shortest_noncontractible_cycle.h +++ b/Surface_mesh_topology/include/CGAL/Surface_mesh_topology/internal/Shortest_noncontractible_cycle.h @@ -43,7 +43,7 @@ public: using Mesh=Mesh_; using Original_map_wrapper=internal::Generic_map_selector; - 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;