CGAL 6.1 - CGAL and the Boost Graph Library

Loading...
Searching...
No Matches
List of all members | Public Types | Public Member Functions
CGAL::Face_filtered_graph< Graph, FIMap, VIMap, HIMap > Struct Template Reference
Reference Manual » Graph Adaptors

`#include <CGAL/boost/graph/Face_filtered_graph.h>`

## Definition

template<typename Graph, typename FIMap = Default, typename VIMap = Default, typename HIMap = Default>
struct CGAL::Face_filtered_graph< Graph, FIMap, VIMap, HIMap >

The class `Face_filtered_graph` is an adaptor that creates a filtered view of a graph by restricting it to a subset of faces.

Contrary to `boost::filtered_graph`, this class only requires a way to access the selected faces and will automatically select the edges/halfedges and vertices present in the adapted graph. A vertex is selected if it is incident to at least one selected face. An edge is selected if it is incident to at least a selected face. A halfedge is selected if its edge is selected.

Since this class is a model of the `FaceGraph` concept, there is a restriction on the set of selected faces: the adapted graph must define a manifold mesh. In order to check that this condition is verified, you can use the function `is_selection_valid()`.

There are two different ways to initialize this class: you can directly provide a set of selected faces, or provide a set of patch identifiers as well as a map between faces and patch identifiers. The latter option is convenient if you want to access some connected components of a graph after having called `CGAL::Polygon_mesh_processing::connected_components()`, or if you want to select only faces of a given color, for example.

The documented interface of this class is limited on purpose and free functions of the concept this class is a model of must be used to manipulate it.

A BGL-like named parameter mechanism is used in the constructors of this class. Default values are available but if you need to set them, you can pass for `np` `CGAL::parameters::face_index_map(fim).halfedge_index_map(him).vertex_index_map(vim)` where `fim`, `him`, and `vim` are the respective index maps. The order of the arguments is not important and any of them can be missing if the default is fine.

Template Parameters

  Graph | must be a model of a `FaceListGraph`, `HalfedgeListGraph`, and `VertexListGraph`.
  FIMap | a model of `ReadablePropertyMap` with `graph_traits<Graph>::face_descriptor` as key and `graph_traits<Graph>::faces_size_type` as value
  VIMap | a model of `ReadablePropertyMap` with `graph_traits<Graph>::vertex_descriptor` as key and `graph_traits<Graph>::vertices_size_type` as value
  HIMap | a model of `ReadablePropertyMap` with `graph_traits<Graph>::halfedge_descriptor` as key and `graph_traits<Graph>::halfedges_size_type` as value

Is model of
  `FaceListGraph`
  `HalfedgeListGraph`
  `` `VertexListGraph`

Examples
  BGL_surface_mesh/surface_mesh_partition.cpp, Polygon_mesh_processing/face_filtered_graph_example.cpp, and Surface_mesh_segmentation/extract_segmentation_into_mesh_example.cpp.

## Public Types
typedef boost::graph_traits< Graph >::vertex_descriptor | vertex_descriptor
| Vertex descriptor type.
typedef boost::graph_traits< Graph >::halfedge_descriptor | halfedge_descriptor
| Halfedge descriptor type.
typedef boost::graph_traits< Graph >::edge_descriptor | edge_descriptor
| Edge descriptor type.
typedef boost::graph_traits< Graph >::face_descriptor | face_descriptor
| Face descriptor type.
typedef unspecified_type | size_type
| Size type.

## Public Member Functions
template<class NamedParameters = CGAL::parameters::Default_named_parameters>
| Face_filtered_graph (const Graph &graph, const NamedParameters &np=parameters::default_values())
| constructs an empty face filtered graph (no face is selected)
template<typename FacePatchIDMap , class FacePatchIDRange , class NamedParameters = CGAL::parameters::Default_named_parameters>
| Face_filtered_graph (const Graph &graph, const FacePatchIDRange &selected_face_patch_ids, FacePatchIDMap face_patch_id_map, const NamedParameters &np)
| Constructor where the set of selected faces is specified as a range of patch ids.
template<typename FacePatchIDMap , class NamedParameters = CGAL::parameters::Default_named_parameters>
| Face_filtered_graph (const Graph &graph, typename boost::property_traits< FacePatchIDMap >::value_type selected_face_patch_id, FacePatchIDMap face_patch_id_map, const NamedParameters &np)
| Constructor where the set of selected faces is specified as a patch id.
template<typename FaceRange , class NamedParameters = CGAL::parameters::Default_named_parameters>
| Face_filtered_graph (const Graph &graph, const FaceRange &selected_faces, const NamedParameters &np)
| Constructor where the set of selected faces is specified as a range of face descriptors.
const Graph & | graph () const
| returns a const reference to the underlying graph.
Graph & | graph ()
| returns a reference to the underlying graph.
template<class FacePatchIDMap >
void | set_selected_faces (typename boost::property_traits< FacePatchIDMap >::value_type face_patch_id, FacePatchIDMap face_patch_id_map)
| changes the set of selected faces using a patch id.
template<class FacePatchIDRange , class FacePatchIDMap >
void | set_selected_faces (const FacePatchIDRange &selected_face_patch_ids, FacePatchIDMap face_patch_id_map)
| changes the set of selected faces using a range of patch ids
template<class FaceRange >
void | set_selected_faces (const FaceRange &selection)
| changes the set of selected faces using a range of face descriptors.
size_type | number_of_faces () const
| returns the number of selected faces.
size_type | number_of_vertices () const
| returns the number of selected vertices.
size_type | number_of_halfedges () const
| returns the number of selected halfedges.
bool | is_selection_valid () const
| returns `true` if around any vertex of a selected face there is at most a single umbrella
void | invert_selection ()
| inverts the selected status of faces.

## Constructor & Destructor Documentation

## ◆ Face_filtered_graph() [1/4]

template<typename Graph , typename FIMap = Default, typename VIMap = Default, typename HIMap = Default>
template<class NamedParameters = CGAL::parameters::Default_named_parameters>

CGAL::Face_filtered_graph< Graph, FIMap, VIMap, HIMap >::Face_filtered_graph | ( | const Graph & | graph,
|  | const NamedParameters & | np = `parameters::default_values()`
| ) |  |

constructs an empty face filtered graph (no face is selected)

Template Parameters

  NamedParameters | a sequence of named parameters

Parameters

  graph | the underlying graph.
  np | optional sequence of named parameters among the ones listed below

Optional Named Parameters

  a property map associating to each vertex of `graph` a unique index between `0` and `num_vertices(graph) - 1` Type: a class model of `ReadablePropertyMap` with `boost::graph_traits<Graph>::vertex_descriptor` as key type and `std::size_t` as value type Default: an automatically indexed internal map Extra: If this parameter is not passed, internal machinery will create and initialize a face index property map, either using the internal property map if it exists or using an external map. The latter might result in - slightly - worsened performance in case of non-constant complexity for index access. |
  a property map associating to each halfedge of `graph` a unique index between `0` and `num_halfedges(graph) - 1` Type: a class model of `ReadablePropertyMap` with `boost::graph_traits<Graph>::halfedge_descriptor` as key type and `std::size_t` as value type Default: an automatically indexed internal map Extra: If this parameter is not passed, internal machinery will create and initialize a face index property map, either using the internal property map if it exists or using an external map. The latter might result in - slightly - worsened performance in case of non-constant complexity for index access. |
  a property map associating to each face of `graph` a unique index between `0` and `num_faces(graph) - 1` Type: a class model of `ReadablePropertyMap` with `boost::graph_traits<Graph>::face_descriptor` as key type and `std::size_t` as value type Default: an automatically indexed internal map Extra: If this parameter is not passed, internal machinery will create and initialize a face index property map, either using the internal property map if it exists or using an external map. The latter might result in - slightly - worsened performance in case of non-constant complexity for index access. |

## ◆ Face_filtered_graph() [2/4]

template<typename Graph , typename FIMap = Default, typename VIMap = Default, typename HIMap = Default>
template<typename FacePatchIDMap , class FacePatchIDRange , class NamedParameters = CGAL::parameters::Default_named_parameters>

CGAL::Face_filtered_graph< Graph, FIMap, VIMap, HIMap >::Face_filtered_graph | ( | const Graph & | graph,
|  | const FacePatchIDRange & | selected_face_patch_ids,
|  | FacePatchIDMap | face_patch_id_map,
|  | const NamedParameters & | np
| ) |  |

Constructor where the set of selected faces is specified as a range of patch ids.

Template Parameters

  FacePatchIDMap | a model of `ReadablePropertyMap` with `face_descriptor` as key type and whose value type is a model of `Hashable`.
  FacePatchIDRange | a model of `ConstRange` with `boost::property_traits<FacePatchIDMap>::value_type` as value type.
  NamedParameters | a sequence of named parameters

Parameters

  graph | the underlying graph
  face_patch_id_map | the property map that assigns a patch ID to each face
  selected_face_patch_ids | a range of the face patch identifiers to select
  np | an optional sequence of Named Parameters among the ones listed below

Optional Named Parameters

  a property map associating to each vertex of `graph` a unique index between `0` and `num_vertices(graph) - 1` Type: a class model of `ReadablePropertyMap` with `boost::graph_traits<Graph>::vertex_descriptor` as key type and `std::size_t` as value type Default: an automatically indexed internal map Extra: If this parameter is not passed, internal machinery will create and initialize a face index property map, either using the internal property map if it exists or using an external map. The latter might result in - slightly - worsened performance in case of non-constant complexity for index access. |
  a property map associating to each halfedge of `graph` a unique index between `0` and `num_halfedges(graph) - 1` Type: a class model of `ReadablePropertyMap` with `boost::graph_traits<Graph>::halfedge_descriptor` as key type and `std::size_t` as value type Default: an automatically indexed internal map Extra: If this parameter is not passed, internal machinery will create and initialize a face index property map, either using the internal property map if it exists or using an external map. The latter might result in - slightly - worsened performance in case of non-constant complexity for index access. |
  a property map associating to each face of `graph` a unique index between `0` and `num_faces(graph) - 1` Type: a class model of `ReadablePropertyMap` with `boost::graph_traits<Graph>::face_descriptor` as key type and `std::size_t` as value type Default: an automatically indexed internal map Extra: If this parameter is not passed, internal machinery will create and initialize a face index property map, either using the internal property map if it exists or using an external map. The latter might result in - slightly - worsened performance in case of non-constant complexity for index access. |

## ◆ Face_filtered_graph() [3/4]

template<typename Graph , typename FIMap = Default, typename VIMap = Default, typename HIMap = Default>
template<typename FacePatchIDMap , class NamedParameters = CGAL::parameters::Default_named_parameters>

CGAL::Face_filtered_graph< Graph, FIMap, VIMap, HIMap >::Face_filtered_graph | ( | const Graph & | graph,
|  | typename boost::property_traits< FacePatchIDMap >::value_type | selected_face_patch_id,
|  | FacePatchIDMap | face_patch_id_map,
|  | const NamedParameters & | np
| ) |  |

Constructor where the set of selected faces is specified as a patch id.

Template Parameters

  FacePatchIDMap | a model of `ReadablePropertyMap` with `face_descriptor` as key type and whose value type is a model of `Hashable`.
  NamedParameters | a sequence of named parameters

Parameters

  graph | the underlying graph.
  face_patch_id_map | the property map that assigns a patch ID to each face
  selected_face_patch_id | the identifier of the face patch selected
  np | an optional sequence of Named Parameters among the ones listed below

Optional Named Parameters

  a property map associating to each vertex of `graph` a unique index between `0` and `num_vertices(graph) - 1` Type: a class model of `ReadablePropertyMap` with `boost::graph_traits<Graph>::vertex_descriptor` as key type and `std::size_t` as value type Default: an automatically indexed internal map Extra: If this parameter is not passed, internal machinery will create and initialize a face index property map, either using the internal property map if it exists or using an external map. The latter might result in - slightly - worsened performance in case of non-constant complexity for index access. |
  a property map associating to each halfedge of `graph` a unique index between `0` and `num_halfedges(graph) - 1` Type: a class model of `ReadablePropertyMap` with `boost::graph_traits<Graph>::halfedge_descriptor` as key type and `std::size_t` as value type Default: an automatically indexed internal map Extra: If this parameter is not passed, internal machinery will create and initialize a face index property map, either using the internal property map if it exists or using an external map. The latter might result in - slightly - worsened performance in case of non-constant complexity for index access. |
  a property map associating to each face of `graph` a unique index between `0` and `num_faces(graph) - 1` Type: a class model of `ReadablePropertyMap` with `boost::graph_traits<Graph>::face_descriptor` as key type and `std::size_t` as value type Default: an automatically indexed internal map Extra: If this parameter is not passed, internal machinery will create and initialize a face index property map, either using the internal property map if it exists or using an external map. The latter might result in - slightly - worsened performance in case of non-constant complexity for index access. |

## ◆ Face_filtered_graph() [4/4]

template<typename Graph , typename FIMap = Default, typename VIMap = Default, typename HIMap = Default>
template<typename FaceRange , class NamedParameters = CGAL::parameters::Default_named_parameters>

CGAL::Face_filtered_graph< Graph, FIMap, VIMap, HIMap >::Face_filtered_graph | ( | const Graph & | graph,
|  | const FaceRange & | selected_faces,
|  | const NamedParameters & | np
| ) |  |

Constructor where the set of selected faces is specified as a range of face descriptors.

Template Parameters

  FaceRange | a model of `ConstRange` with `face_descriptor` as value type.
  NamedParameters | a sequence of named parameters

Parameters

  graph | the graph containing the wanted patch
  selected_faces | the set of selected faces
  np | an optional sequence of Named Parameters among the ones listed below

Optional Named Parameters

  a property map associating to each vertex of `graph` a unique index between `0` and `num_vertices(graph) - 1` Type: a class model of `ReadablePropertyMap` with `boost::graph_traits<Graph>::vertex_descriptor` as key type and `std::size_t` as value type Default: an automatically indexed internal map Extra: If this parameter is not passed, internal machinery will create and initialize a face index property map, either using the internal property map if it exists or using an external map. The latter might result in - slightly - worsened performance in case of non-constant complexity for index access. |
  a property map associating to each halfedge of `graph` a unique index between `0` and `num_halfedges(graph) - 1` Type: a class model of `ReadablePropertyMap` with `boost::graph_traits<Graph>::halfedge_descriptor` as key type and `std::size_t` as value type Default: an automatically indexed internal map Extra: If this parameter is not passed, internal machinery will create and initialize a face index property map, either using the internal property map if it exists or using an external map. The latter might result in - slightly - worsened performance in case of non-constant complexity for index access. |
  a property map associating to each face of `graph` a unique index between `0` and `num_faces(graph) - 1` Type: a class model of `ReadablePropertyMap` with `boost::graph_traits<Graph>::face_descriptor` as key type and `std::size_t` as value type Default: an automatically indexed internal map Extra: If this parameter is not passed, internal machinery will create and initialize a face index property map, either using the internal property map if it exists or using an external map. The latter might result in - slightly - worsened performance in case of non-constant complexity for index access. |