MEPP2 Project
is_triangle_mesh.hpp
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/graph/graph_traits.hpp>
14 
15 namespace FEVV {
16 namespace Filters {
17 
27 template< typename FaceGraph >
28 inline bool
29 is_triangle_mesh(const FaceGraph &g)
30 {
31  auto face_range_pair = faces(g);
32  auto iter = face_range_pair.first;
33  for(; iter != face_range_pair.second; ++iter)
34  {
35  if(degree(*iter, g) != 3)
36  return false;
37  }
38  return true;
39 }
40 
41 } // namespace Filters
42 } // namespace FEVV
43 
FEVV::DataStructures::AIF::degree
boost::graph_traits< FEVV::DataStructures::AIF::AIFMesh >::degree_size_type degree(typename boost::graph_traits< FEVV::DataStructures::AIF::AIFMesh >::vertex_descriptor u, const FEVV::DataStructures::AIF::AIFMesh &)
Definition: Graph_traits_aif.h:548
FEVV
Interfaces for plugins These interfaces will be used for different plugins.
Definition: Assert.h:16
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
FEVV::Filters::is_triangle_mesh
bool is_triangle_mesh(const FaceGraph &g)
Function determining if mesh g is a pure triangular mesh.
Definition: is_triangle_mesh.hpp:29