Generalize FFG doc: the selection's value_type needs not be faces_size_type

This commit is contained in:
Mael Rouxel-Labbé 2023-07-12 14:39:03 +02:00
parent 602d022c7e
commit 6fbbb70b20
2 changed files with 41 additions and 43 deletions

View File

@ -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<Graph>::%faces_size_type` as value type.
* \tparam FacePatchIndexRange a model of `ConstRange` with `boost::property_traits<FacePatchIndexMap>::%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<FacePatchIDMap>::%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 <typename FacePatchIndexMap, class FacePatchIndexRange, class CGAL_NP_TEMPLATE_PARAMETERS>
template <typename FacePatchIDMap, class FacePatchIDRange, class CGAL_NP_TEMPLATE_PARAMETERS>
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<FacePatchIndexRange>::value
boost::has_range_const_iterator<FacePatchIDRange>::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 <typename FacePatchIndexMap, class FacePatchIndexRange>
template <typename FacePatchIDMap, class FacePatchIDRange>
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<FacePatchIndexRange>::value
boost::has_range_const_iterator<FacePatchIDRange>::value
>* = 0
)
: _graph(const_cast<Graph&>(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<Graph>::%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 <typename FacePatchIndexMap, class CGAL_NP_TEMPLATE_PARAMETERS>
template <typename FacePatchIDMap, class CGAL_NP_TEMPLATE_PARAMETERS>
Face_filtered_graph(const Graph& graph,
typename boost::property_traits<FacePatchIndexMap>::value_type selected_face_patch_index,
FacePatchIndexMap face_patch_index_map,
typename boost::property_traits<FacePatchIDMap>::value_type selected_face_patch_id,
FacePatchIDMap face_patch_id_map,
const CGAL_NP_CLASS& np)
: _graph(const_cast<Graph&>(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 <typename FacePatchIndexMap>
template <typename FacePatchIDMap>
Face_filtered_graph(const Graph& graph,
typename boost::property_traits<FacePatchIndexMap>::value_type pid,
FacePatchIndexMap face_patch_index_map)
typename boost::property_traits<FacePatchIDMap>::value_type pid,
FacePatchIDMap face_patch_id_map)
: _graph(const_cast<Graph&>(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<class FacePatchIndexMap>
void set_selected_faces(typename boost::property_traits<FacePatchIndexMap>::value_type face_patch_id,
FacePatchIndexMap face_patch_index_map)
template<class FacePatchIDMap>
void set_selected_faces(typename boost::property_traits<FacePatchIDMap>::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<class FacePatchIndexRange, class FacePatchIndexMap>
void set_selected_faces(const FacePatchIndexRange& selected_face_patch_indices,
FacePatchIndexMap face_patch_index_map
template<class FacePatchIDRange, class FacePatchIDMap>
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<FacePatchIndexRange>::value
boost::has_range_const_iterator<FacePatchIDRange>::value
>* = 0
#endif
)
@ -485,13 +483,13 @@ struct Face_filtered_graph
selected_vertices.reset();
selected_halfedges.reset();
typedef typename boost::property_traits<FacePatchIndexMap>::value_type Patch_index;
std::unordered_set<Patch_index> pids(std::begin(selected_face_patch_indices),
std::end(selected_face_patch_indices));
typedef typename boost::property_traits<FacePatchIDMap>::value_type Patch_ID;
std::unordered_set<Patch_ID> 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))

View File

@ -20,7 +20,7 @@ typedef std::unordered_set<std::size_t> id_map;
namespace PMP = CGAL::Polygon_mesh_processing;
template <typename Graph>
void test_halfedge_around_vertex_iterator(const Graph& g)
void test_halfedge_around_vertex_iterator(const Graph& g)
{
typedef typename boost::graph_traits<Graph>::face_descriptor g_face_descriptor;
typedef CGAL::Face_filtered_graph<Graph> Adapter;