MEPP2 Project
utils_retrieve_face.h
Go to the documentation of this file.
1 // Copyright (c) 2012-2019 University of Lyon and CNRS (France).
2 // All rights reserved.
3 //
4 // This file is part of MEPP2; you can redistribute it and/or modify
5 // it under the terms of the GNU Lesser General Public License as
6 // published by the Free Software Foundation; either version 3 of
7 // the License, or (at your option) any later version.
8 //
9 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
10 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11 #pragma once
12 
13 #include <boost/fusion/iterator/next.hpp>
14 #include <boost/fusion/include/next.hpp>
15 
16 /*
17  * \brief Utility functions that retrieves the face out
18  * of its index.
19  * \tparam MutableFaceGraph Any mesh type having a boost::graph_traits
20  * specialisation.
21  * \param g The graph which which to search for.
22  * \param target_index The index of the target face.
23  * \return When found, the face with target index.
24  */
25 template<typename MutableFaceGraph>
26 typename boost::graph_traits<MutableFaceGraph>::face_descriptor
27 retrieve_face( MutableFaceGraph& g,
28  int target_index )
29 {
30  typedef boost::graph_traits<MutableFaceGraph> GraphTraits;
31  typedef typename GraphTraits::face_iterator face_iterator;
32  typedef typename GraphTraits::face_descriptor face_descriptor;
33 
34  face_iterator f = faces(g).first;
35 
36  face_descriptor dst = *boost::next(f, target_index);
37 
38  return dst;
39 }
FEVV::DataStructures::AIF::next
boost::graph_traits< FEVV::DataStructures::AIF::AIFMesh >::halfedge_descriptor next(typename boost::graph_traits< FEVV::DataStructures::AIF::AIFMesh >::halfedge_descriptor h, const FEVV::DataStructures::AIF::AIFMesh &sm)
Returns the next halfedge around its face.
Definition: Graph_traits_aif.h:599
FEVV::DataStructures::AIF::faces
std::pair< typename boost::graph_traits< FEVV::DataStructures::AIF::AIFMesh >::face_iterator, typename boost::graph_traits< FEVV::DataStructures::AIF::AIFMesh >::face_iterator > faces(const FEVV::DataStructures::AIF::AIFMesh &sm)
Returns an iterator range over all faces of the mesh.
Definition: Graph_traits_aif.h:679
retrieve_face
boost::graph_traits< MutableFaceGraph >::face_descriptor retrieve_face(MutableFaceGraph &g, int target_index)
Definition: utils_retrieve_face.h:27