From 2782bf0816e7a986b5563f2e6def77690167df65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 13 Mar 2020 06:01:10 +0100 Subject: [PATCH 01/16] add better overloads matching to avoid ambiguity with dynamic tags --- .../CGAL/boost/graph/Face_filtered_graph.h | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/BGL/include/CGAL/boost/graph/Face_filtered_graph.h b/BGL/include/CGAL/boost/graph/Face_filtered_graph.h index ffd943fb9c4..e61a5d7257c 100644 --- a/BGL/include/CGAL/boost/graph/Face_filtered_graph.h +++ b/BGL/include/CGAL/boost/graph/Face_filtered_graph.h @@ -1043,6 +1043,36 @@ get(PropertyTag ptag, Face_filtered_graph& w) return get(ptag, w.graph()); } +#define CGAL_FFG_DYNAMIC_PMAP_SPEC(TAG) \ +template \ +typename boost::property_map >::const_type \ +get(TAG ptag, const Face_filtered_graph& w) \ +{ \ + return get(ptag, w.graph()); \ +} \ +\ +template \ +typename boost::property_map >::type \ +get(TAG ptag, Face_filtered_graph& w) \ +{ \ + return get(ptag, w.graph()); \ +} + +CGAL_FFG_DYNAMIC_PMAP_SPEC(dynamic_vertex_property_t) +CGAL_FFG_DYNAMIC_PMAP_SPEC(dynamic_halfedge_property_t) +CGAL_FFG_DYNAMIC_PMAP_SPEC(dynamic_edge_property_t) +CGAL_FFG_DYNAMIC_PMAP_SPEC(dynamic_face_property_t) + +#undef CGAL_FFG_DYNAMIC_PMAP_SPEC + //specializations for indices template Date: Fri, 13 Mar 2020 06:01:39 +0100 Subject: [PATCH 02/16] use dynamic maps instead of "old" workaround --- .../CGAL/boost/graph/copy_face_graph.h | 88 +++++-------------- 1 file changed, 22 insertions(+), 66 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/copy_face_graph.h b/BGL/include/CGAL/boost/graph/copy_face_graph.h index 5eafa161533..291598a41d0 100644 --- a/BGL/include/CGAL/boost/graph/copy_face_graph.h +++ b/BGL/include/CGAL/boost/graph/copy_face_graph.h @@ -32,13 +32,11 @@ namespace CGAL { namespace internal { template -void copy_face_graph_impl(const SourceMesh& sm, TargetMesh& tm, - Hmap hmap, - V2V v2v, H2H h2h, F2F f2f, - Src_vpm sm_vpm, Tgt_vpm tm_vpm ) +void copy_face_graph(const SourceMesh& sm, TargetMesh& tm, + V2V v2v, H2H h2h, F2F f2f, + Src_vpm sm_vpm, Tgt_vpm tm_vpm ) { typedef typename boost::graph_traits::vertex_descriptor sm_vertex_descriptor; typedef typename boost::graph_traits::vertex_descriptor tm_vertex_descriptor; @@ -57,6 +55,9 @@ void copy_face_graph_impl(const SourceMesh& sm, TargetMesh& tm, typename Kernel_traits::value_type>::type > conv; + typedef CGAL::dynamic_halfedge_property_t Dyn_h_tag; + typename boost::property_map::const_type hmap = get(Dyn_h_tag(), sm); + std::vector tm_border_halfedges; std::vector sm_border_halfedges; @@ -169,50 +170,6 @@ void copy_face_graph_impl(const SourceMesh& sm, TargetMesh& tm, } } -template -void copy_face_graph(const SourceMesh& sm, TargetMesh& tm, - Tag_false, - V2V v2v, H2H h2h, F2F f2f, - Src_vpm sm_vpm, Tgt_vpm tm_vpm ) -{ - typedef typename boost::graph_traits::halfedge_descriptor sm_halfedge_descriptor; - typedef typename boost::graph_traits::halfedge_descriptor tm_halfedge_descriptor; - - boost::unordered_map hash_map(num_halfedges(sm)); - copy_face_graph_impl(sm, tm, - boost::make_assoc_property_map(hash_map), - v2v, h2h, f2f, - sm_vpm, tm_vpm); -} - -template -void copy_face_graph(const SourceMesh& sm, TargetMesh& tm, - Tag_true, - V2V v2v, H2H h2h, F2F f2f, - Src_vpm sm_vpm, Tgt_vpm tm_vpm ) -{ - typedef typename boost::graph_traits::halfedge_descriptor tm_halfedge_descriptor; - std::vector hedges(num_halfedges(sm)); - - // init halfedge index map - /// \TODO shall we keep that? - helpers::init_halfedge_indices(const_cast(sm), - get(boost::halfedge_index, sm)); - - copy_face_graph_impl(sm, tm, - bind_property_maps(get(boost::halfedge_index, sm), - make_property_map(hedges)), - v2v, h2h, f2f, - sm_vpm, tm_vpm); -} - - - } // end of namespace internal namespace impl { @@ -230,9 +187,9 @@ struct Output_iterator_functor { put(map, pair.first, pair.second); } - + }; - + template boost::function_output_iterator > make_functor(PMAP map) { @@ -260,13 +217,13 @@ inline Emptyset_iterator make_functor(const internal_np::Param_not_found&) \tparam TargetMesh a model of `FaceListGraph` \tparam NamedParameters1 a sequence of \ref pmp_namedparameters "Named Parameters" \tparam NamedParameters2 a sequence of \ref pmp_namedparameters "Named Parameters" - + The types `sm_vertex_descriptor` and `sm_face_descriptor` must be models of the concept `Hashable`. \param sm the source mesh \param tm the target mesh \param np1 optional sequence of \ref pmp_namedparameters "Named Parameters" among the ones listed below - + \cgalNamedParamsBegin \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `sm` . @@ -274,30 +231,30 @@ inline Emptyset_iterator make_functor(const internal_np::Param_not_found&) `CGAL::vertex_point_t` should be available in `SourceMesh` \cgalParamEnd \cgalParamBegin{vertex_to_vertex_output_iterator} an `OutputIterator` containing the - pairs source-vertex, target-vertex. If this parameter is given, then + pairs source-vertex, target-vertex. If this parameter is given, then `vertex_to_vertex_map` cannot be used. \cgalParamEnd \cgalParamBegin{halfedge_to_halfedge_output_iterator} an `OutputIterator` containing the - pairs source-halfedge, target-halfedge. If this parameter is given, then + pairs source-halfedge, target-halfedge. If this parameter is given, then `halfedge_to_halfedge_map` cannot be used. \cgalParamEnd \cgalParamBegin{face_to_face_output_iterator} an `OutputIterator` containing the - pairs source-face, target-face. If this parameter is given, then + pairs source-face, target-face. If this parameter is given, then `face_to_face_map` cannot be used. \cgalParamEnd \cgalParamBegin{vertex_to_vertex_map} a `ReadWritePropertyMap` containing the - pairs source-vertex, target-vertex. + pairs source-vertex, target-vertex. \cgalParamEnd \cgalParamBegin{halfedge_to_halfedge_map} a `ReadWritePropertyMap` containing the - pairs source-halfedge, target-halfedge. + pairs source-halfedge, target-halfedge. \cgalParamEnd \cgalParamBegin{face_to_face_map} a `ReadWritePropertyMap` containing the - pairs source-face, target-face. + pairs source-face, target-face. \cgalParamEnd \cgalNamedParamsEnd - + \param np2 optional sequence of \ref pmp_namedparameters "Named Parameters" among the ones listed below - + \cgalNamedParamsBegin \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `tm`. @@ -315,7 +272,7 @@ inline Emptyset_iterator make_functor(const internal_np::Param_not_found&) */ template (), choose_parameter(get_parameter(np1, internal_np::vertex_to_vertex_output_iterator), impl::make_functor(get_parameter(np1, internal_np::vertex_to_vertex_map))), choose_parameter(get_parameter(np1, internal_np::halfedge_to_halfedge_output_iterator), @@ -353,9 +310,9 @@ void copy_face_graph(const SourceMesh& sm, TargetMesh& tm) copy_face_graph(sm, tm, parameters::all_default(), parameters::all_default()); } -template -void copy_face_graph(const SourceMesh& sm, TargetMesh& tm, +void copy_face_graph(const SourceMesh& sm, TargetMesh& tm, const CGAL::Named_function_parameters& np) { copy_face_graph(sm, tm, np, parameters::all_default()); @@ -370,7 +327,6 @@ void copy_face_graph(const SourceMesh& sm, TargetMesh& tm, Src_vpm sm_vpm, Tgt_vpm tm_vpm ) { internal::copy_face_graph(sm, tm, - CGAL::graph_has_property(), v2v, h2h, f2f, sm_vpm, tm_vpm); } From af913f781aed1095ceb09e7ff644bcfc57d6b0f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 13 Mar 2020 12:28:02 +0100 Subject: [PATCH 03/16] fix dynamic properties for LCC --- ...inear_cell_complex_for_combinatorial_map.h | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/Linear_cell_complex/include/CGAL/boost/graph/properties_Linear_cell_complex_for_combinatorial_map.h b/Linear_cell_complex/include/CGAL/boost/graph/properties_Linear_cell_complex_for_combinatorial_map.h index 75159df0901..6f24f6f6d7a 100644 --- a/Linear_cell_complex/include/CGAL/boost/graph/properties_Linear_cell_complex_for_combinatorial_map.h +++ b/Linear_cell_complex/include/CGAL/boost/graph/properties_Linear_cell_complex_for_combinatorial_map.h @@ -17,6 +17,7 @@ #include #include #include +#include #define CGAL_LCC_ARGS unsigned int d_, unsigned int ambient_dim, \ @@ -402,6 +403,76 @@ struct property_map } // namespace boost +// dynamic property map ambiguity resolution +#define CGAL_LCC_DYNAMIC_PMAP_SPEC(TAG, DESC) \ +namespace boost { \ +template \ + class CMap, \ + class Storage_,\ + class T>\ +struct property_map< \ + CGAL::Linear_cell_complex_for_combinatorial_map,\ + TAG > \ +{\ + typedef CGAL::Linear_cell_complex_for_combinatorial_map\ + LCC;\ + typedef typename boost::graph_traits::DESC DESC;\ + typedef CGAL::internal::Dynamic_property_map type;\ + typedef type const_type;\ +};\ +} \ +\ +namespace CGAL { \ +template \ + class CMap, \ + class Storage_,\ + class T> \ +typename boost::property_map< \ + Linear_cell_complex_for_combinatorial_map, \ + TAG >::const_type \ +get(TAG ptag, const Linear_cell_complex_for_combinatorial_map&) \ +{ \ + typedef Linear_cell_complex_for_combinatorial_map LCC;\ + typedef typename boost::graph_traits::DESC DESC; \ + return internal::Dynamic_property_map();\ +} \ +\ +template \ + class CMap, \ + class Storage_,\ + class T> \ +typename boost::property_map< \ + Linear_cell_complex_for_combinatorial_map, \ + TAG >::type \ +get(TAG ptag, Linear_cell_complex_for_combinatorial_map&) \ +{ \ + typedef Linear_cell_complex_for_combinatorial_map LCC;\ + typedef typename boost::graph_traits::DESC DESC; \ + return internal::Dynamic_property_map();\ +} \ +} + +CGAL_LCC_DYNAMIC_PMAP_SPEC(CGAL::dynamic_vertex_property_t, vertex_descriptor) +CGAL_LCC_DYNAMIC_PMAP_SPEC(CGAL::dynamic_halfedge_property_t, halfedge_descriptor) +CGAL_LCC_DYNAMIC_PMAP_SPEC(CGAL::dynamic_edge_property_t, edge_descriptor) +CGAL_LCC_DYNAMIC_PMAP_SPEC(CGAL::dynamic_face_property_t, face_descriptor) + +#undef CGAL_LCC_DYNAMIC_PMAP_SPEC + + +#undef CGAL_NAME_LCC_ARGS #undef CGAL_LCC_ARGS #undef CGAL_LCC_TYPE From 4c2990ed6aebdc5488395ea5138d83d6df29e6b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 13 Mar 2020 12:28:59 +0100 Subject: [PATCH 04/16] add test failing due to non-manifold vertices --- BGL/test/BGL/test_Euler_operations.cpp | 32 +++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/BGL/test/BGL/test_Euler_operations.cpp b/BGL/test/BGL/test_Euler_operations.cpp index 7b5439470a8..09a708ffad4 100644 --- a/BGL/test/BGL/test_Euler_operations.cpp +++ b/BGL/test/BGL/test_Euler_operations.cpp @@ -2,6 +2,35 @@ #include "test_Prefix.h" #include #include +#include + +template +void +test_copy_face_graph_nm_umbrella() +{ + CGAL_GRAPH_TRAITS_MEMBERS(T); + + T g; + Kernel::Point_3 p; + + CGAL::make_tetrahedron(p, p, p, p, g); + CGAL::make_tetrahedron(p, p, p, p, g); + + std::vector verts(vertices(g).begin(), vertices(g).end()); + + //merge verts[0] and verts[4] + for (halfedge_descriptor h : CGAL::halfedges_around_target(verts[4], g)) + set_target(h, verts[0], g); + remove_vertex(verts[4], g); + + T g_copy; + CGAL::copy_face_graph(g, g_copy); + + for (halfedge_descriptor h : halfedges(g_copy)) + { + assert( target(h, g_copy) != Traits::null_vertex() ); + } +} template void @@ -405,7 +434,8 @@ test_swap_edges() template void test_Euler_operations() -{ +{ + test_copy_face_graph_nm_umbrella(); join_face_test(); add_vertex_and_face_to_border_test(); add_face_to_border_test(); From 1040a5f1e4e63949d8ee8e16a063a093a769f85b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 13 Mar 2020 12:30:20 +0100 Subject: [PATCH 05/16] workaround to update the vertex of non-manifold umbrellas --- .../CGAL/boost/graph/copy_face_graph.h | 53 +++++++++++++++---- 1 file changed, 42 insertions(+), 11 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/copy_face_graph.h b/BGL/include/CGAL/boost/graph/copy_face_graph.h index 291598a41d0..912e279a601 100644 --- a/BGL/include/CGAL/boost/graph/copy_face_graph.h +++ b/BGL/include/CGAL/boost/graph/copy_face_graph.h @@ -40,7 +40,7 @@ void copy_face_graph(const SourceMesh& sm, TargetMesh& tm, { typedef typename boost::graph_traits::vertex_descriptor sm_vertex_descriptor; typedef typename boost::graph_traits::vertex_descriptor tm_vertex_descriptor; - typedef typename boost::graph_traits::vertex_iterator tm_vertex_iterator; + typedef typename boost::graph_traits::halfedge_iterator tm_halfedge_iterator; typedef typename boost::graph_traits::face_descriptor sm_face_descriptor; typedef typename boost::graph_traits::face_descriptor tm_face_descriptor; @@ -56,12 +56,13 @@ void copy_face_graph(const SourceMesh& sm, TargetMesh& tm, conv; typedef CGAL::dynamic_halfedge_property_t Dyn_h_tag; - typename boost::property_map::const_type hmap = get(Dyn_h_tag(), sm); + typename boost::property_map::const_type hs_to_ht = get(Dyn_h_tag(), sm); std::vector tm_border_halfedges; std::vector sm_border_halfedges; - tm_face_descriptor tm_null_face = boost::graph_traits::null_face(); + const tm_face_descriptor tm_null_face = boost::graph_traits::null_face(); + const tm_vertex_descriptor tm_null_vertex = boost::graph_traits::null_vertex(); reserve(tm, static_cast::vertices_size_type>(vertices(sm).size()), static_cast::edges_size_type>(edges(sm).size()), @@ -78,8 +79,8 @@ void copy_face_graph(const SourceMesh& sm, TargetMesh& tm, set_next( tm_h, tm_h, tm ); set_next( tm_h_opp, tm_h_opp, tm ); - put(hmap, sm_h, tm_h); - put(hmap, sm_h_opp, tm_h_opp); + put(hs_to_ht, sm_h, tm_h); + put(hs_to_ht, sm_h_opp, tm_h_opp); *h2h++=std::make_pair(sm_h, tm_h); *h2h++=std::make_pair(sm_h_opp, tm_h_opp); @@ -107,6 +108,8 @@ void copy_face_graph(const SourceMesh& sm, TargetMesh& tm, set_target(tm_h, tm_h_tgt, tm); put(tm_vpm, tm_h_tgt, conv(get(sm_vpm, sm_h_tgt))); } + else + set_target(tm_h, tm_null_vertex, tm); if ( halfedge(sm_h_src,sm)==sm_h_opp ) { tm_vertex_descriptor tm_h_src = add_vertex(tm); @@ -115,6 +118,8 @@ void copy_face_graph(const SourceMesh& sm, TargetMesh& tm, set_target(tm_h_opp, tm_h_src, tm); put(tm_vpm, tm_h_src, conv(get(sm_vpm, sm_h_src))); } + else + set_target(tm_h_opp, tm_null_vertex, tm); } //create faces and connect halfedges for(sm_face_descriptor sm_f : faces(sm)) @@ -123,13 +128,13 @@ void copy_face_graph(const SourceMesh& sm, TargetMesh& tm, *f2f++=std::make_pair(sm_f, tm_f); sm_halfedge_descriptor sm_h_i=halfedge(sm_f, sm); - tm_halfedge_descriptor tm_h_prev = get(hmap, prev(sm_h_i, sm)); + tm_halfedge_descriptor tm_h_prev = get(hs_to_ht, prev(sm_h_i, sm)); set_halfedge(tm_f, tm_h_prev, tm); CGAL_precondition(*halfedges_around_face(sm_h_i, sm).first == sm_h_i); for(sm_halfedge_descriptor sm_h : halfedges_around_face(sm_h_i, sm)) { - tm_halfedge_descriptor tm_h = get(hmap, sm_h); + tm_halfedge_descriptor tm_h = get(hs_to_ht, sm_h); set_next(tm_h_prev, tm_h, tm); set_face(tm_h, tm_f, tm); tm_h_prev=tm_h; @@ -151,16 +156,14 @@ void copy_face_graph(const SourceMesh& sm, TargetMesh& tm, halfedges_around_face(next(sm_border_halfedges[i], sm), sm)) { CGAL_assertion(next(tm_h_prev, tm) == tm_h_prev); - tm_h = get(hmap, sm_h); + tm_h = get(hs_to_ht, sm_h); set_next(tm_h_prev, tm_h, tm); tm_h_prev=tm_h; } } // update halfedge vertex of all but the vertex halfedge - for(tm_vertex_iterator vit = vertices(tm).first; - vit != vertices(tm).second; ++vit) + for(tm_vertex_descriptor v : vertices(tm)) { - tm_vertex_descriptor v = *vit; tm_halfedge_descriptor h = halfedge(v, tm); tm_halfedge_descriptor next_around_vertex=h; do{ @@ -168,6 +171,34 @@ void copy_face_graph(const SourceMesh& sm, TargetMesh& tm, set_target(next_around_vertex, v, tm); }while(h != next_around_vertex); } + + // detect if there are some non-manifold umbrellas and fix missing halfedge target pointers + for (tm_halfedge_iterator it=halfedges(tm).first; it!=halfedges(tm).second; ++it) + { + if (target(*it, tm) == tm_null_vertex) + { + // create and fill a map from target halfedge to source halfedge + typedef CGAL::dynamic_halfedge_property_t Dyn_th_tag; + typename boost::property_map::type ht_to_hs = get(Dyn_th_tag(), tm); + for (sm_halfedge_descriptor hs : halfedges(sm)) + put(ht_to_hs, get(hs_to_ht, hs), hs); + + for(; it!=halfedges(tm).second; ++it) + { + if (target(*it, tm) == tm_null_vertex) + { + // we recover tm_v using the halfedge associated to the target vertex of + // the halfedge in sm corresponding to *it. This is working because we + // set the vertex halfedge pointer to the "same" halfedges. + tm_vertex_descriptor tm_v = + target( get(hs_to_ht, halfedge(target(get(ht_to_hs, *it), sm), sm)), tm); + for(tm_halfedge_descriptor ht : halfedges_around_target(*it, tm)) + set_target(ht, tm_v, tm); + } + } + break; + } + } } } // end of namespace internal From ed2067f461aed868d6dbc4ae743d2e7c0131ee93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 17 Mar 2020 17:08:32 +0100 Subject: [PATCH 06/16] using new API --- .../CGAL/Polygon_mesh_processing/extrude.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/extrude.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/extrude.h index a12e35e711d..a3e5849d0b4 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/extrude.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/extrude.h @@ -184,9 +184,10 @@ void extrude_mesh(const InputMesh& input, std::vector > bottom_v2v; std::vector > bottom_h2h; - copy_face_graph(input, output, std::back_inserter(bottom_v2v), - std::back_inserter(bottom_h2h), Emptyset_iterator(), - input_vpm, output_vpm); + copy_face_graph(input, output, parameters::vertex_point_map(input_vpm) + .vertex_to_vertex_output_iterator(std::back_inserter(bottom_v2v)) + .halfedge_to_halfedge_output_iterator(std::back_inserter(bottom_h2h)), + parameters::vertex_point_map(output_vpm)); // create the offset for the other side for(std::size_t i = 0; i< bottom_v2v.size(); ++i) @@ -198,9 +199,11 @@ void extrude_mesh(const InputMesh& input, // collect border halfedges for the creation of the triangle strip std::vector > top_v2v; std::vector > top_h2h; - copy_face_graph(input, output, std::inserter(top_v2v, top_v2v.end()), - std::inserter(top_h2h, top_h2h.end()), Emptyset_iterator(), - input_vpm, output_vpm); + copy_face_graph(input, output, parameters::vertex_point_map(input_vpm) + .vertex_to_vertex_output_iterator(std::inserter(top_v2v, top_v2v.end())) + .halfedge_to_halfedge_output_iterator(std::inserter(top_h2h, top_h2h.end())), + parameters::vertex_point_map(output_vpm)); + for(std::size_t i = 0; i< top_v2v.size(); ++i) { top(top_v2v[i].first, top_v2v[i].second); From 09039464efaff078b7b84cecdc5e87435edec0cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 17 Mar 2020 17:53:21 +0100 Subject: [PATCH 07/16] restrict partial specialization to avoid grab everything --- .../graph/graph_traits_HalfedgeDS_default.h | 28 ++++++-------- .../internal/properties_2D_triangulation.h | 38 +++++++++++-------- ...roperties_Triangulation_data_structure_2.h | 38 +++++++++++-------- 3 files changed, 57 insertions(+), 47 deletions(-) diff --git a/HalfedgeDS/include/CGAL/boost/graph/graph_traits_HalfedgeDS_default.h b/HalfedgeDS/include/CGAL/boost/graph/graph_traits_HalfedgeDS_default.h index f644ac13676..d6e9574fd87 100644 --- a/HalfedgeDS/include/CGAL/boost/graph/graph_traits_HalfedgeDS_default.h +++ b/HalfedgeDS/include/CGAL/boost/graph/graph_traits_HalfedgeDS_default.h @@ -475,25 +475,19 @@ void reserve(HalfedgeDS_default& p, }// namespace CGAL namespace boost { -// property_map dispatcher into Polyhedron -template -struct property_map, Tag> -{ - typedef typename CGAL::HDS_property_map:: - template bind_ map_gen; - typedef typename map_gen::type type; - typedef typename map_gen::const_type const_type; +#define CGAL_PM_SPECIALIZATION(TAG) \ +template \ +struct property_map, TAG> \ +{\ + typedef typename CGAL::HDS_property_map:: \ + template bind_ map_gen; \ + typedef typename map_gen::type type; \ + typedef typename map_gen::const_type const_type; \ }; -// property_map dispatcher into const Polyhedron -template -struct property_map, Tag> -{ - typedef typename CGAL::HDS_property_map:: - template bind_ map_gen; - typedef typename map_gen::type type; - typedef typename map_gen::const_type const_type; -}; +CGAL_PM_SPECIALIZATION(vertex_point_t) + +#undef CGAL_PM_SPECIALIZATION } // namespace boost diff --git a/Triangulation_2/include/CGAL/boost/graph/internal/properties_2D_triangulation.h b/Triangulation_2/include/CGAL/boost/graph/internal/properties_2D_triangulation.h index 6bad3c9aa0c..c95d50f470d 100644 --- a/Triangulation_2/include/CGAL/boost/graph/internal/properties_2D_triangulation.h +++ b/Triangulation_2/include/CGAL/boost/graph/internal/properties_2D_triangulation.h @@ -239,23 +239,31 @@ struct T2_property_map // overloads and specializations in the boost namespace namespace boost { -// g++ 'enumeral_type' in template unification not implemented workaround -template -struct property_map -{ - typedef typename CGAL::internal::T2_property_map map_gen; - typedef typename map_gen::type type; - typedef typename map_gen::const_type const_type; +#define CGAL_PM_SPECIALIZATION(TAG) \ +template \ +struct property_map \ +{ \ + typedef typename CGAL::internal::T2_property_map map_gen; \ + typedef typename map_gen::type type; \ + typedef typename map_gen::const_type const_type; \ +}; \ +\ +template \ +struct property_map \ +{ \ + typedef typename CGAL::internal::T2_property_map map_gen; \ + typedef typename map_gen::type type; \ + typedef typename map_gen::const_type const_type; \ }; -// see struct property_map in Polyehdron for an explanation -template -struct property_map -{ - typedef typename CGAL::internal::T2_property_map map_gen; - typedef typename map_gen::type type; - typedef typename map_gen::const_type const_type; -}; +CGAL_PM_SPECIALIZATION(vertex_point_t) +CGAL_PM_SPECIALIZATION(edge_weight_t) +CGAL_PM_SPECIALIZATION(vertex_index_t) +CGAL_PM_SPECIALIZATION(halfedge_index_t) +CGAL_PM_SPECIALIZATION(edge_index_t) +CGAL_PM_SPECIALIZATION(face_index_t) + +#undef CGAL_PM_SPECIALIZATION } // end namespace boost diff --git a/Triangulation_2/include/CGAL/boost/graph/properties_Triangulation_data_structure_2.h b/Triangulation_2/include/CGAL/boost/graph/properties_Triangulation_data_structure_2.h index c8d01f3f239..d5583e000b8 100644 --- a/Triangulation_2/include/CGAL/boost/graph/properties_Triangulation_data_structure_2.h +++ b/Triangulation_2/include/CGAL/boost/graph/properties_Triangulation_data_structure_2.h @@ -284,23 +284,31 @@ get(boost::face_index_t, const Triangulation_data_structure_2&) namespace boost { -// g++ 'enumeral_type' in template unification not implemented workaround -template -struct property_map, Tag> -{ - typedef typename CGAL::internal::TDS2_property_map map_gen; - typedef typename map_gen::type type; - typedef typename map_gen::const_type const_type; +#define CGAL_PM_SPECIALIZATION(TAG) \ +template \ +struct property_map, TAG> \ +{ \ + typedef typename CGAL::internal::TDS2_property_map map_gen; \ + typedef typename map_gen::type type; \ + typedef typename map_gen::const_type const_type; \ +}; \ +\ +template \ +struct property_map, TAG> \ +{ \ + typedef typename CGAL::internal::TDS2_property_map map_gen; \ + typedef typename map_gen::type type; \ + typedef typename map_gen::const_type const_type; \ }; -// see struct property_map in Polyehdron for an explanation -template -struct property_map, Tag> -{ - typedef typename CGAL::internal::TDS2_property_map map_gen; - typedef typename map_gen::type type; - typedef typename map_gen::const_type const_type; -}; +CGAL_PM_SPECIALIZATION(vertex_point_t) +CGAL_PM_SPECIALIZATION(edge_weight_t) +CGAL_PM_SPECIALIZATION(vertex_index_t) +CGAL_PM_SPECIALIZATION(halfedge_index_t) +CGAL_PM_SPECIALIZATION(edge_index_t) +CGAL_PM_SPECIALIZATION(face_index_t) + +#undef CGAL_PM_SPECIALIZATION } // namespace boost From 437dec193ee0cd2ace3b60c780423f5deb10760b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 20 Mar 2020 15:42:48 +0100 Subject: [PATCH 08/16] fix ambiguity --- .../CGAL/boost/graph/copy_face_graph.h | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/copy_face_graph.h b/BGL/include/CGAL/boost/graph/copy_face_graph.h index 912e279a601..9a240f42655 100644 --- a/BGL/include/CGAL/boost/graph/copy_face_graph.h +++ b/BGL/include/CGAL/boost/graph/copy_face_graph.h @@ -34,9 +34,9 @@ namespace internal { template -void copy_face_graph(const SourceMesh& sm, TargetMesh& tm, - V2V v2v, H2H h2h, F2F f2f, - Src_vpm sm_vpm, Tgt_vpm tm_vpm ) +void copy_face_graph_impl(const SourceMesh& sm, TargetMesh& tm, + V2V v2v, H2H h2h, F2F f2f, + Src_vpm sm_vpm, Tgt_vpm tm_vpm ) { typedef typename boost::graph_traits::vertex_descriptor sm_vertex_descriptor; typedef typename boost::graph_traits::vertex_descriptor tm_vertex_descriptor; @@ -322,17 +322,19 @@ void copy_face_graph(const SourceMesh& sm, TargetMesh& tm, using parameters::choose_parameter; using parameters::get_parameter; - internal::copy_face_graph(sm, tm, - choose_parameter(get_parameter(np1, internal_np::vertex_to_vertex_output_iterator), - impl::make_functor(get_parameter(np1, internal_np::vertex_to_vertex_map))), - choose_parameter(get_parameter(np1, internal_np::halfedge_to_halfedge_output_iterator), - impl::make_functor(get_parameter(np1, internal_np::halfedge_to_halfedge_map))), - choose_parameter(get_parameter(np1, internal_np::face_to_face_output_iterator), - impl::make_functor(get_parameter(np1, internal_np::face_to_face_map))), - choose_parameter(get_parameter(np1, internal_np::vertex_point), - get(vertex_point, sm)), - choose_parameter(get_parameter(np2, internal_np::vertex_point), - get(vertex_point, tm))); + internal::copy_face_graph_impl( + sm, + tm, + choose_parameter(get_parameter(np1, internal_np::vertex_to_vertex_output_iterator), + impl::make_functor(get_parameter(np1, internal_np::vertex_to_vertex_map))), + choose_parameter(get_parameter(np1, internal_np::halfedge_to_halfedge_output_iterator), + impl::make_functor(get_parameter(np1, internal_np::halfedge_to_halfedge_map))), + choose_parameter(get_parameter(np1, internal_np::face_to_face_output_iterator), + impl::make_functor(get_parameter(np1, internal_np::face_to_face_map))), + choose_parameter(get_parameter(np1, internal_np::vertex_point), + get(vertex_point, sm)), + choose_parameter(get_parameter(np2, internal_np::vertex_point), + get(vertex_point, tm))); } template @@ -349,7 +351,7 @@ void copy_face_graph(const SourceMesh& sm, TargetMesh& tm, copy_face_graph(sm, tm, np, parameters::all_default()); } -#if !defined(DOXYGEN_RUNNING) +#if !defined(DOXYGEN_RUNNING) && !defined(CGAL_NO_DEPRECATED_CODE) template @@ -357,9 +359,9 @@ void copy_face_graph(const SourceMesh& sm, TargetMesh& tm, V2V v2v, H2H h2h, F2F f2f, Src_vpm sm_vpm, Tgt_vpm tm_vpm ) { - internal::copy_face_graph(sm, tm, - v2v, h2h, f2f, - sm_vpm, tm_vpm); + internal::copy_face_graph_impl(sm, tm, + v2v, h2h, f2f, + sm_vpm, tm_vpm); } From 400ca786907ffb29862e71e519ed7ed7b479e982 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 20 Mar 2020 15:43:01 +0100 Subject: [PATCH 09/16] restrict properties for Dual I totally removed the generic put as I don't see any generic usage --- BGL/include/CGAL/boost/graph/Dual.h | 75 +++++++++++++---------------- BGL/test/BGL/graph_concept_Dual.cpp | 4 +- 2 files changed, 35 insertions(+), 44 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/Dual.h b/BGL/include/CGAL/boost/graph/Dual.h index cff6ba4e6b2..1f240d1fead 100644 --- a/BGL/include/CGAL/boost/graph/Dual.h +++ b/BGL/include/CGAL/boost/graph/Dual.h @@ -158,19 +158,15 @@ struct Dual_face_index_pmap{ } }; -template::type>::value> -struct Dual_property_maps : boost::property_map {}; - -template< typename P, typename Property> -struct Dual_property_maps {}; - } //end of namespace internal -template -struct property_map, Property> - : internal::Dual_property_maps {}; +template +struct property_map, halfedge_index_t> + : boost::property_map {}; + +template +struct property_map, edge_index_t> + : boost::property_map {}; template struct property_map, boost::vertex_index_t> @@ -190,53 +186,48 @@ struct property_map, boost::face_index_t> namespace CGAL { -template -typename boost::property_map::type -get(Property p, Dual

& dual) -{ - return get(p, dual.primal()); +#define CGAL_GET_OVERLOADS(Property) \ +\ +template \ +typename boost::property_map::type \ +get(Property p, Dual

& dual) \ +{ \ + return get(p, dual.primal()); \ +} \ +\ +template \ +typename boost::property_map::const_type \ +get(Property p, const Dual

& dual) \ +{ \ + return get(p, dual.primal()); \ +} \ +\ +template \ +typename boost::property_map_value::type \ +get(Property p, const Dual

& dual, const Key& k) \ +{ \ + return get(p, dual.primal(), k); \ } -template -typename boost::property_map::const_type -get(Property p, const Dual

& dual) -{ - return get(p, dual.primal()); -} +CGAL_GET_OVERLOADS(boost::edge_index_t) +CGAL_GET_OVERLOADS(boost::halfedge_index_t) -template -typename boost::property_map_value::type -get(Property p, const Dual

& dual, const Key& k) -{ - return get(p, dual.primal(), k); -} - -template -struct Property_map_value_dummy { - typedef typename boost::property_map_value::type type; -}; +#undef CGAL_GET_OVERLOADS template -typename Property_map_value_dummy, boost::vertex_index_t, Key>::type +typename boost::property_map_value, boost::vertex_index_t>::type get(boost::vertex_index_t, const Dual

& dual, const Key& k) { return get(typename boost::internal::Dual_vertex_index_pmap

(dual.primal()), k); } template -typename Property_map_value_dummy, boost::face_index_t, Key>::type +typename boost::property_map_value, boost::face_index_t>::type get(boost::face_index_t, const Dual

& dual, const Key& k) { return get(typename boost::internal::Dual_face_index_pmap

(dual.primal()), k); } -template -void -put(Property p, const Dual

& dual, const Key& k, const Value& val) -{ - put(p, dual.primal(), k, val); -} - template typename boost::internal::Dual_vertex_index_pmap

get(boost::vertex_index_t, const Dual

& dual) diff --git a/BGL/test/BGL/graph_concept_Dual.cpp b/BGL/test/BGL/graph_concept_Dual.cpp index 6c29ab3fd57..cbf02488e33 100644 --- a/BGL/test/BGL/graph_concept_Dual.cpp +++ b/BGL/test/BGL/graph_concept_Dual.cpp @@ -37,8 +37,8 @@ void concept_check_dual() { Graph, face_descriptor, boost::face_index_t> >(); // edge properties should be forwarded - boost::function_requires< boost::concepts::ReadablePropertyGraph< - Graph, edge_descriptor, boost::edge_weight_t> >(); + //boost::function_requires< boost::concepts::ReadablePropertyGraph< + // Graph, edge_descriptor, boost::edge_weight_t> >(); // boost::function_requires< boost::concepts::PropertyGraph< // Graph, halfedge_descriptor, CGAL::halfedge_index_t> >(); From 620dfa40fc8f7505855c9519665822bb993960a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 27 Mar 2020 08:37:32 +0100 Subject: [PATCH 10/16] extra run of the script to remove tabs and trailing whitespaces --- BGL/include/CGAL/boost/graph/Dual.h | 46 +++++++++---------- BGL/test/BGL/graph_concept_Dual.cpp | 2 +- .../graph/graph_traits_HalfedgeDS_default.h | 30 ++++++------ ...inear_cell_complex_for_combinatorial_map.h | 4 +- 4 files changed, 41 insertions(+), 41 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/Dual.h b/BGL/include/CGAL/boost/graph/Dual.h index 1f240d1fead..bf90734a024 100644 --- a/BGL/include/CGAL/boost/graph/Dual.h +++ b/BGL/include/CGAL/boost/graph/Dual.h @@ -91,7 +91,7 @@ public: typedef typename GTP::halfedge_descriptor halfedge_descriptor; typedef typename GTP::edge_descriptor edge_descriptor; typedef typename GTP::directed_category directed_category; - typedef boost::allow_parallel_edge_tag edge_parallel_category; + typedef boost::allow_parallel_edge_tag edge_parallel_category; typedef typename GTP::traversal_category traversal_category; typedef typename GTP::faces_size_type vertices_size_type; @@ -112,11 +112,11 @@ public: static face_descriptor null_face() { return face_descriptor(); } static halfedge_descriptor null_halfedge() { return halfedge_descriptor(); } }; - + template -struct graph_traits< const CGAL::Dual

> +struct graph_traits< const CGAL::Dual

> : public graph_traits< CGAL::Dual

> -{}; +{}; namespace internal{ @@ -262,7 +262,7 @@ num_halfedges(const CGAL::Dual

& dual) { return num_halfedges(dual.primal()); } - + template typename boost::graph_traits >::faces_size_type num_faces(const CGAL::Dual

& dual) @@ -274,34 +274,34 @@ template Iterator_range >::vertex_iterator> vertices(const CGAL::Dual

& dual) { - return faces(dual.primal()); + return faces(dual.primal()); } template Iterator_range >::face_iterator> faces(const CGAL::Dual

& dual) { - return vertices(dual.primal()); + return vertices(dual.primal()); } - + template Iterator_range >::halfedge_iterator> halfedges(const CGAL::Dual

& dual) { - return halfedges(dual.primal()); + return halfedges(dual.primal()); } - + template Iterator_range >::edge_iterator> edges(const CGAL::Dual

& dual) { - return edges(dual.primal()); + return edges(dual.primal()); } template std::pair >::edge_descriptor, bool> -edge(typename boost::graph_traits >::vertex_descriptor u, - typename boost::graph_traits >::vertex_descriptor v, +edge(typename boost::graph_traits >::vertex_descriptor u, + typename boost::graph_traits >::vertex_descriptor v, const Dual

& dual) { typename boost::graph_traits >::out_edge_iterator e, e_end; @@ -309,7 +309,7 @@ edge(typename boost::graph_traits >::vertex_descriptor u, if(target(*e, dual) == v) return std::make_pair(*e, true); } - + return std::make_pair(typename boost::graph_traits >::edge_descriptor(), false); } @@ -329,7 +329,7 @@ source(typename boost::graph_traits >::halfedge_descriptor h, const typename Dual

::Primal& primal = dual.primal(); return face(h,primal); } - + template typename boost::graph_traits >::vertex_descriptor target(typename boost::graph_traits >::halfedge_descriptor h, @@ -338,7 +338,7 @@ target(typename boost::graph_traits >::halfedge_descriptor h, const typename Dual

::Primal& primal = dual.primal(); return face(opposite(h,primal),primal); } - + template typename boost::graph_traits >::vertex_descriptor @@ -348,7 +348,7 @@ source(typename boost::graph_traits >::edge_descriptor h, const typename Dual

::Primal& primal = dual.primal(); return face(halfedge(h,primal),primal); } - + template typename boost::graph_traits >::vertex_descriptor target(typename boost::graph_traits >::edge_descriptor h, @@ -394,7 +394,7 @@ halfedge(typename boost::graph_traits >::vertex_descriptor u, if(target(*e, dual) == v) return std::make_pair(halfedge(*e, dual), true); } - + return std::make_pair(boost::graph_traits >::null_halfedge(), false); } @@ -422,7 +422,7 @@ next(typename boost::graph_traits >::halfedge_descriptor h, { const typename Dual

::Primal& primal = dual.primal(); return prev(opposite(h,primal),primal); -} +} template typename boost::graph_traits >::halfedge_descriptor @@ -431,7 +431,7 @@ prev(typename boost::graph_traits >::halfedge_descriptor h, { const typename Dual

::Primal& primal = dual.primal(); return opposite(next(h,primal),primal); -} +} template Iterator_range >::out_edge_iterator> @@ -450,7 +450,7 @@ in_edges(typename boost::graph_traits >::vertex_descriptor v, const typename Dual

::Primal& primal = dual.primal(); return opposite_edges_around_face(halfedge(v,primal),primal); } - + template typename boost::graph_traits >::degree_size_type out_degree(typename boost::graph_traits >::vertex_descriptor v, @@ -467,8 +467,8 @@ in_degree(typename boost::graph_traits >::vertex_descriptor v, { return out_degree(v,dual); } - - + + } // namespace CGAL #include diff --git a/BGL/test/BGL/graph_concept_Dual.cpp b/BGL/test/BGL/graph_concept_Dual.cpp index cbf02488e33..cc88b547231 100644 --- a/BGL/test/BGL/graph_concept_Dual.cpp +++ b/BGL/test/BGL/graph_concept_Dual.cpp @@ -8,7 +8,7 @@ typedef CGAL::Simple_cartesian Kernel; typedef CGAL::Polyhedron_3 Polyhedron; -template +template void concept_check_dual() { typedef CGAL::Dual Graph; typedef boost::graph_traits Traits; diff --git a/HalfedgeDS/include/CGAL/boost/graph/graph_traits_HalfedgeDS_default.h b/HalfedgeDS/include/CGAL/boost/graph/graph_traits_HalfedgeDS_default.h index d6e9574fd87..ecafa701d1d 100644 --- a/HalfedgeDS/include/CGAL/boost/graph/graph_traits_HalfedgeDS_default.h +++ b/HalfedgeDS/include/CGAL/boost/graph/graph_traits_HalfedgeDS_default.h @@ -21,14 +21,14 @@ namespace CGAL { -template class HalfedgeDS_default; } // namespace CGAL namespace boost { - + template struct graph_traits< CGAL::HalfedgeDS_default > @@ -45,7 +45,7 @@ struct graph_traits< CGAL::HalfedgeDS_default const > } // namespace boost namespace CGAL { - + template typename boost::graph_traits< HalfedgeDS_default const>::vertices_size_type num_vertices(const HalfedgeDS_default& p) @@ -174,7 +174,7 @@ out_edges( typename boost::graph_traits< HalfedgeDS_default const>::verte // // MutableHalfedgeGraph -// +// template typename boost::graph_traits< HalfedgeDS_default >::vertex_descriptor @@ -203,9 +203,9 @@ remove_vertex(typename boost::graph_traits< HalfedgeDS_default >::vertex_ template typename boost::graph_traits< HalfedgeDS_default >::edge_descriptor add_edge(HalfedgeDS_default& g) -{ +{ return typename boost::graph_traits< HalfedgeDS_default >::edge_descriptor( - g.edges_push_back(typename HalfedgeDS_default::Halfedge(), + g.edges_push_back(typename HalfedgeDS_default::Halfedge(), typename HalfedgeDS_default::Halfedge())); } @@ -245,7 +245,7 @@ set_next(typename boost::graph_traits< HalfedgeDS_default >::halfedge_des } // -// MutableFaceGraph +// MutableFaceGraph // template @@ -265,7 +265,7 @@ add_face(InputIterator begin, InputIterator end, HalfedgeDS_default& g) template void remove_face(typename boost::graph_traits< HalfedgeDS_default >::face_descriptor f - , HalfedgeDS_default& g) + , HalfedgeDS_default& g) { g.faces_erase(f); } @@ -314,7 +314,7 @@ template typename boost::graph_traits< HalfedgeDS_default >::edge_descriptor edge(typename boost::graph_traits< HalfedgeDS_default >::halfedge_descriptor h , const HalfedgeDS_default&) -{ +{ return typename boost::graph_traits< HalfedgeDS_default >::edge_descriptor(h); } @@ -322,7 +322,7 @@ template typename boost::graph_traits< HalfedgeDS_default >::halfedge_descriptor halfedge(typename boost::graph_traits< HalfedgeDS_default >::edge_descriptor e , const HalfedgeDS_default&) -{ +{ return e.halfedge(); } @@ -330,7 +330,7 @@ template typename boost::graph_traits< HalfedgeDS_default >::halfedge_descriptor halfedge(typename boost::graph_traits< HalfedgeDS_default >::vertex_descriptor v , const HalfedgeDS_default&) -{ +{ return v->halfedge(); } @@ -340,7 +340,7 @@ std::pair< typename boost::graph_traits< HalfedgeDS_default >::halfedge_d halfedge(typename boost::graph_traits< HalfedgeDS_default >::vertex_descriptor u , typename boost::graph_traits< HalfedgeDS_default >::vertex_descriptor v , const HalfedgeDS_default& g) -{ +{ std::pair< typename boost::graph_traits< HalfedgeDS_default >::edge_descriptor , bool> e = edge(u, v, g); return std::make_pair(e.first.halfedge(), e.second); @@ -411,7 +411,7 @@ num_halfedges(const HalfedgeDS_default& p) template typename boost::graph_traits< HalfedgeDS_default >::face_descriptor face(typename boost::graph_traits< HalfedgeDS_default >::halfedge_descriptor h - , const HalfedgeDS_default&) + , const HalfedgeDS_default&) { return h->face(); } @@ -419,7 +419,7 @@ face(typename boost::graph_traits< HalfedgeDS_default >::halfedge_descrip template typename boost::graph_traits< HalfedgeDS_default >::halfedge_descriptor halfedge(typename boost::graph_traits< HalfedgeDS_default >::face_descriptor f - , const HalfedgeDS_default&) + , const HalfedgeDS_default&) { return f->halfedge(); } @@ -442,7 +442,7 @@ num_faces(const HalfedgeDS_default& p) template struct HDS_property_map; - + template <> struct HDS_property_map { diff --git a/Linear_cell_complex/include/CGAL/boost/graph/properties_Linear_cell_complex_for_combinatorial_map.h b/Linear_cell_complex/include/CGAL/boost/graph/properties_Linear_cell_complex_for_combinatorial_map.h index 6f24f6f6d7a..279334c6e69 100644 --- a/Linear_cell_complex/include/CGAL/boost/graph/properties_Linear_cell_complex_for_combinatorial_map.h +++ b/Linear_cell_complex/include/CGAL/boost/graph/properties_Linear_cell_complex_for_combinatorial_map.h @@ -236,7 +236,7 @@ get(boost::halfedge_external_index_t, CGAL_LCC_TYPE const&) { CGAL_LCC_TYPE& ncmap=const_cast(cmap); return typename boost::property_map:: - const_type(halfedges(ncmap).begin(), halfedges(ncmap).end(), num_halfedges(ncmap)); + const_type(halfedges(ncmap).begin(), halfedges(ncmap).end(), num_halfedges(ncmap)); } template @@ -245,7 +245,7 @@ get(boost::vertex_external_index_t, CGAL_LCC_TYPE const&) { CGAL_LCC_TYPE& ncmap=const_cast(cmap); return typename boost::property_map:: - const_type(vertices(ncmap).begin(), vertices(ncmap).end(), num_vertices(ncmap)); + const_type(vertices(ncmap).begin(), vertices(ncmap).end(), num_vertices(ncmap)); } template From b4c0e6ef2950bcd187ed03f8c95a0aa0da3082f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 27 Mar 2020 19:12:07 +0100 Subject: [PATCH 11/16] remove unused parameter --- .../properties_Linear_cell_complex_for_combinatorial_map.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Linear_cell_complex/include/CGAL/boost/graph/properties_Linear_cell_complex_for_combinatorial_map.h b/Linear_cell_complex/include/CGAL/boost/graph/properties_Linear_cell_complex_for_combinatorial_map.h index 279334c6e69..ff980a8c53e 100644 --- a/Linear_cell_complex/include/CGAL/boost/graph/properties_Linear_cell_complex_for_combinatorial_map.h +++ b/Linear_cell_complex/include/CGAL/boost/graph/properties_Linear_cell_complex_for_combinatorial_map.h @@ -438,7 +438,7 @@ template , \ TAG >::const_type \ -get(TAG ptag, const Linear_cell_complex_for_combinatorial_map&) \ +get(TAG, const Linear_cell_complex_for_combinatorial_map&) \ { \ typedef Linear_cell_complex_for_combinatorial_map LCC;\ typedef typename boost::graph_traits::DESC DESC; \ @@ -456,7 +456,7 @@ template , \ TAG >::type \ -get(TAG ptag, Linear_cell_complex_for_combinatorial_map&) \ +get(TAG, Linear_cell_complex_for_combinatorial_map&) \ { \ typedef Linear_cell_complex_for_combinatorial_map LCC;\ typedef typename boost::graph_traits::DESC DESC; \ From 4476663eba5d362526f3650942acdd9dbfc07575 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 8 Apr 2020 16:14:44 +0200 Subject: [PATCH 12/16] fix compilation error... --- Kernel_23/include/CGAL/Kernel/function_objects.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index 48ea406cd52..cd335df94fc 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -3333,8 +3333,7 @@ namespace CommonKernelFunctors { CGAL_kernel_assertion_msg(bool(optional) == true, "the segment does not intersect the supporting" " plane"); - using boost::get; - const Point_3* p = get(&*optional); + const Point_3* p = boost::get(&*optional); CGAL_kernel_assertion_msg(p != 0, "the segment intersection with the plane is " "not a point"); From 2dd06eb29659c5f8e090cd0fe7b55d63a5626902 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 13 Apr 2020 10:44:26 +0200 Subject: [PATCH 13/16] add overload for point --- BGL/include/CGAL/boost/graph/Dual.h | 1 + 1 file changed, 1 insertion(+) diff --git a/BGL/include/CGAL/boost/graph/Dual.h b/BGL/include/CGAL/boost/graph/Dual.h index bf90734a024..0238fb143e8 100644 --- a/BGL/include/CGAL/boost/graph/Dual.h +++ b/BGL/include/CGAL/boost/graph/Dual.h @@ -211,6 +211,7 @@ get(Property p, const Dual

& dual, const Key& k) \ CGAL_GET_OVERLOADS(boost::edge_index_t) CGAL_GET_OVERLOADS(boost::halfedge_index_t) +CGAL_GET_OVERLOADS(boost::vertex_point_t) #undef CGAL_GET_OVERLOADS From c559af48eb9c459e925d19ebb7962d816fe4aeb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 14 Apr 2020 16:02:24 +0200 Subject: [PATCH 14/16] use non deprecated API --- .../test/Polygon_mesh_processing/triangulate_faces_test.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/triangulate_faces_test.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/triangulate_faces_test.cpp index 33495e08415..bbc980a25dd 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/triangulate_faces_test.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/triangulate_faces_test.cpp @@ -230,10 +230,8 @@ test_dual_with_various_faces() // copy dual to a sm Surface_mesh sm_dual; CGAL::copy_face_graph(dual, sm_dual, - CGAL::Emptyset_iterator(), - CGAL::Emptyset_iterator(), - CGAL::Emptyset_iterator(), - Dual_vpm(mesh, vpmap)); + CGAL::parameters::vertex_point_map( + Dual_vpm(mesh, vpmap))); for(typename boost::graph_traits::face_descriptor fit : faces(sm_dual)) { From b4343e730bf2334bcddacfcb1b241f755247a98a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 15 Apr 2020 16:13:44 +0200 Subject: [PATCH 15/16] do not use deprecated function --- BGL/examples/BGL_polyhedron_3/copy_polyhedron.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/BGL/examples/BGL_polyhedron_3/copy_polyhedron.cpp b/BGL/examples/BGL_polyhedron_3/copy_polyhedron.cpp index 8ec14dff022..413ed46e558 100644 --- a/BGL/examples/BGL_polyhedron_3/copy_polyhedron.cpp +++ b/BGL/examples/BGL_polyhedron_3/copy_polyhedron.cpp @@ -79,7 +79,6 @@ int main(int argc, char* argv[]) boost::unordered_map v2v; boost::unordered_map h2h; boost::unordered_map f2f; - CGAL::copy_face_graph(T1, S, std::inserter(v2v, v2v.end()), std::inserter(h2h, h2h.end())); std::ofstream out("reverse.off"); out << S; CGAL::copy_face_graph(T1, S, CGAL::parameters::vertex_to_vertex_map(boost::make_assoc_property_map(v2v)) From 93cf5f4845fb8615ff9459ffe2ef3f3e454a4ec2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 15 Apr 2020 16:38:33 +0200 Subject: [PATCH 16/16] remove useless code and add assertions --- .../BGL_polyhedron_3/copy_polyhedron.cpp | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/BGL/examples/BGL_polyhedron_3/copy_polyhedron.cpp b/BGL/examples/BGL_polyhedron_3/copy_polyhedron.cpp index 413ed46e558..9a4f25b5548 100644 --- a/BGL/examples/BGL_polyhedron_3/copy_polyhedron.cpp +++ b/BGL/examples/BGL_polyhedron_3/copy_polyhedron.cpp @@ -35,16 +35,17 @@ int main(int argc, char* argv[]) std::ifstream in((argc>1)?argv[1]:"cube.off"); in >> S; + assert( CGAL::is_valid_polygon_mesh(S) ); // Note that the vertex_point property of the Source and Target1 // come from different kernels. typedef CGAL::Surface_mesh Target1; Target1 T1; - { - CGAL::copy_face_graph(S, T1); - std::ofstream out("sm.off"); - out << T1; - } + CGAL::copy_face_graph(S, T1); + assert( CGAL::is_valid_polygon_mesh(T1) ); + assert( vertices(S).size()==vertices(T1).size() ); + assert( halfedges(S).size()==halfedges(T1).size() ); + assert( faces(S).size()==faces(T1).size() ); #if defined(CGAL_USE_OPENMESH) typedef OpenMesh::PolyMesh_ArrayKernelT Target2; @@ -62,7 +63,13 @@ int main(int argc, char* argv[]) CGAL::copy_face_graph(S, T2, CGAL::parameters::vertex_to_vertex_output_iterator(std::inserter(v2v, v2v.end())) .halfedge_to_halfedge_output_iterator(std::inserter(h2h, h2h.end())) .face_to_face_output_iterator(std::inserter(f2f, f2f.end()))); - OpenMesh::IO::write_mesh(T2, "om.off"); + assert( CGAL::is_valid_polygon_mesh(T2) ); + assert( v2v.size()==vertices(T2).size() ); + assert( h2h.size()==halfedges(T2).size() ); + assert( f2f.size()==faces(T2).size() ); + assert( vertices(S).size()==vertices(T2).size() ); + assert( halfedges(S).size()==halfedges(T2).size() ); + assert( faces(S).size()==faces(T2).size() ); } #endif S.clear(); @@ -79,11 +86,14 @@ int main(int argc, char* argv[]) boost::unordered_map v2v; boost::unordered_map h2h; boost::unordered_map f2f; - std::ofstream out("reverse.off"); - out << S; CGAL::copy_face_graph(T1, S, CGAL::parameters::vertex_to_vertex_map(boost::make_assoc_property_map(v2v)) .halfedge_to_halfedge_output_iterator(std::inserter(h2h, h2h.end())) .face_to_face_map(boost::make_assoc_property_map(f2f))); + + assert( CGAL::is_valid_polygon_mesh(S) ); + assert( vertices(S).size()==vertices(T1).size() ); + assert( halfedges(S).size()==halfedges(T1).size() ); + assert( faces(S).size()==faces(T1).size() ); } return 0; }