From 6fbbb70b20906cfc7d7e6f0ec5a2272d92071cb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 12 Jul 2023 14:39:03 +0200 Subject: [PATCH] Generalize FFG doc: the selection's value_type needs not be faces_size_type --- .../CGAL/boost/graph/Face_filtered_graph.h | 82 +++++++++---------- BGL/test/BGL/test_Face_filtered_graph.cpp | 2 +- 2 files changed, 41 insertions(+), 43 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/Face_filtered_graph.h b/BGL/include/CGAL/boost/graph/Face_filtered_graph.h index e6f4136481d..a412755576e 100644 --- a/BGL/include/CGAL/boost/graph/Face_filtered_graph.h +++ b/BGL/include/CGAL/boost/graph/Face_filtered_graph.h @@ -162,15 +162,14 @@ struct Face_filtered_graph /*! * \brief Constructor where the set of selected faces is specified as a range of patch ids. * - * \tparam FacePatchIndexMap a model of `ReadablePropertyMap` with - `face_descriptor` as key type and - `graph_traits::%faces_size_type` as value type. - * \tparam FacePatchIndexRange a model of `ConstRange` with `boost::property_traits::%value_type` as value type. + * \tparam FacePatchIDMap a model of `ReadablePropertyMap` with `face_descriptor` as key type + * and whose value type is a model of `Hashable`. + * \tparam FacePatchIDRange a model of `ConstRange` with `boost::property_traits::%value_type` as value type. * \tparam NamedParameters a sequence of named parameters * * \param graph the underlying graph - * \param face_patch_index_map the property map that assigns a patch index to each face - * \param selected_face_patch_indices a range of the face patch indices to select + * \param face_patch_id_map the property map that assigns a patch index to each face + * \param selected_face_patch_ids a range of the face patch indices to select * \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below * * \cgalNamedParamsBegin @@ -208,14 +207,14 @@ struct Face_filtered_graph * \cgalParamNEnd * \cgalNamedParamsEnd */ - template + template Face_filtered_graph(const Graph& graph, - const FacePatchIndexRange& selected_face_patch_indices, - FacePatchIndexMap face_patch_index_map, + const FacePatchIDRange& selected_face_patch_ids, + FacePatchIDMap face_patch_id_map, const CGAL_NP_CLASS& np #ifndef DOXYGEN_RUNNING , std::enable_if_t< - boost::has_range_const_iterator::value + boost::has_range_const_iterator::value >* = 0 #endif ) @@ -224,15 +223,15 @@ struct Face_filtered_graph vimap(CGAL::get_initialized_vertex_index_map(graph, np)), himap(CGAL::get_initialized_halfedge_index_map(graph, np)) { - set_selected_faces(selected_face_patch_indices, face_patch_index_map); + set_selected_faces(selected_face_patch_ids, face_patch_id_map); } - template + template Face_filtered_graph(const Graph& graph, - const FacePatchIndexRange& selected_face_patch_indices, - FacePatchIndexMap face_patch_index_map + const FacePatchIDRange& selected_face_patch_ids, + FacePatchIDMap face_patch_id_map , std::enable_if_t< - boost::has_range_const_iterator::value + boost::has_range_const_iterator::value >* = 0 ) : _graph(const_cast(graph)), @@ -240,19 +239,18 @@ struct Face_filtered_graph vimap(CGAL::get_initialized_vertex_index_map(graph)), himap(CGAL::get_initialized_halfedge_index_map(graph)) { - set_selected_faces(selected_face_patch_indices, face_patch_index_map); + set_selected_faces(selected_face_patch_ids, face_patch_id_map); } /*! * \brief Constructor where the set of selected faces is specified as a patch id. * - * \tparam FacePatchIndexMap a model of `ReadablePropertyMap` with - `face_descriptor` as key type and - `graph_traits::%faces_size_type` as value type. + * \tparam FacePatchIDMap a model of `ReadablePropertyMap` with `face_descriptor` as key type + * and whose value type is a model of `Hashable`. * \tparam NamedParameters a sequence of named parameters * * \param graph the underlying graph. - * \param face_patch_index_map the property map that assigns a patch index to each face - * \param selected_face_patch_index the index of the face patch selected + * \param face_patch_id_map the property map that assigns a patch index to each face + * \param selected_face_patch_id the index of the face patch selected * \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below * * \cgalNamedParamsBegin @@ -290,29 +288,29 @@ struct Face_filtered_graph * \cgalParamNEnd * \cgalNamedParamsEnd */ - template + template Face_filtered_graph(const Graph& graph, - typename boost::property_traits::value_type selected_face_patch_index, - FacePatchIndexMap face_patch_index_map, + typename boost::property_traits::value_type selected_face_patch_id, + FacePatchIDMap face_patch_id_map, const CGAL_NP_CLASS& np) : _graph(const_cast(graph)), fimap(CGAL::get_initialized_face_index_map(graph, np)), vimap(CGAL::get_initialized_vertex_index_map(graph, np)), himap(CGAL::get_initialized_halfedge_index_map(graph, np)) { - set_selected_faces(selected_face_patch_index, face_patch_index_map); + set_selected_faces(selected_face_patch_id, face_patch_id_map); } - template + template Face_filtered_graph(const Graph& graph, - typename boost::property_traits::value_type pid, - FacePatchIndexMap face_patch_index_map) + typename boost::property_traits::value_type pid, + FacePatchIDMap face_patch_id_map) : _graph(const_cast(graph)), fimap(CGAL::get_initialized_face_index_map(graph)), vimap(CGAL::get_initialized_vertex_index_map(graph)), himap(CGAL::get_initialized_halfedge_index_map(graph)) { - set_selected_faces(pid, face_patch_index_map); + set_selected_faces(pid, face_patch_id_map); } /*! @@ -438,9 +436,9 @@ struct Face_filtered_graph } /// changes the set of selected faces using a patch id. - template - void set_selected_faces(typename boost::property_traits::value_type face_patch_id, - FacePatchIndexMap face_patch_index_map) + template + void set_selected_faces(typename boost::property_traits::value_type face_patch_id, + FacePatchIDMap face_patch_id_map) { selected_faces.resize(num_faces(_graph)); selected_vertices.resize(num_vertices(_graph)); @@ -452,7 +450,7 @@ struct Face_filtered_graph for(face_descriptor fd : faces(_graph) ) { - if(get(face_patch_index_map, fd) == face_patch_id) + if(get(face_patch_id_map, fd) == face_patch_id) { selected_faces.set(get(fimap, fd)); for(halfedge_descriptor hd : halfedges_around_face(halfedge(fd, _graph), _graph)) @@ -467,12 +465,12 @@ struct Face_filtered_graph reset_indices(); } /// changes the set of selected faces using a range of patch ids - template - void set_selected_faces(const FacePatchIndexRange& selected_face_patch_indices, - FacePatchIndexMap face_patch_index_map + template + void set_selected_faces(const FacePatchIDRange& selected_face_patch_ids, + FacePatchIDMap face_patch_id_map #ifndef DOXYGEN_RUNNING , std::enable_if_t< - boost::has_range_const_iterator::value + boost::has_range_const_iterator::value >* = 0 #endif ) @@ -485,13 +483,13 @@ struct Face_filtered_graph selected_vertices.reset(); selected_halfedges.reset(); - typedef typename boost::property_traits::value_type Patch_index; - std::unordered_set pids(std::begin(selected_face_patch_indices), - std::end(selected_face_patch_indices)); + typedef typename boost::property_traits::value_type Patch_ID; + std::unordered_set pids(std::begin(selected_face_patch_ids), + std::end(selected_face_patch_ids)); - for(face_descriptor fd : faces(_graph) ) + for(face_descriptor fd : faces(_graph)) { - if(pids.count(get(face_patch_index_map, fd)) != 0) + if(pids.count(get(face_patch_id_map, fd)) != 0) { selected_faces.set(get(fimap, fd)); for(halfedge_descriptor hd : halfedges_around_face(halfedge(fd, _graph), _graph)) diff --git a/BGL/test/BGL/test_Face_filtered_graph.cpp b/BGL/test/BGL/test_Face_filtered_graph.cpp index 5dd6521bb02..3cd95dc5668 100644 --- a/BGL/test/BGL/test_Face_filtered_graph.cpp +++ b/BGL/test/BGL/test_Face_filtered_graph.cpp @@ -20,7 +20,7 @@ typedef std::unordered_set id_map; namespace PMP = CGAL::Polygon_mesh_processing; template -void test_halfedge_around_vertex_iterator(const Graph& g) +void test_halfedge_around_vertex_iterator(const Graph& g) { typedef typename boost::graph_traits::face_descriptor g_face_descriptor; typedef CGAL::Face_filtered_graph Adapter;