MEPP2 Project
utils_retrieve_vertex.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 vertex 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 vertex.
23  * \return When found, the vertex with target index.
24  */
25 template<typename MutableFaceGraph>
27 retrieve_vertex( MutableFaceGraph& g,
28  int target_index )
29 {
30  typedef boost::graph_traits<MutableFaceGraph> GraphTraits;
31  typedef typename GraphTraits::vertex_iterator vertex_iterator;
33 
34  vertex_iterator v = vertices(g).first; // g.vertices_begin() cannot be used here,
35  // because it is not defined in any concept
36 
37  vertex_descriptor dst = *boost::next(v, target_index);
38 
39  return dst;
40 }
FEVV::DataStructures::AIF::vertices
std::pair< typename boost::graph_traits< FEVV::DataStructures::AIF::AIFMesh >::vertex_iterator, typename boost::graph_traits< FEVV::DataStructures::AIF::AIFMesh >::vertex_iterator > vertices(const FEVV::DataStructures::AIF::AIFMesh &sm)
Returns the iterator range of the vertices of the mesh.
Definition: Graph_traits_aif.h:172
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
retrieve_vertex
boost::graph_traits< MutableFaceGraph >::vertex_descriptor retrieve_vertex(MutableFaceGraph &g, int target_index)
Definition: utils_retrieve_vertex.h:27
msdm2::vertex_descriptor
boost::graph_traits< MeshT >::vertex_descriptor vertex_descriptor
Definition: msdm2_surfacemesh.h:33