MEPP2 Project
resolve_similar_faces.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>
15 
16 namespace FEVV {
17 namespace Filters {
18 
29 template< typename MutableFaceIncidentGraph >
30 static void
31 resolve_similar_faces(MutableFaceIncidentGraph &g,
32  bool take_into_account_face_rientation = false)
33 {
34  typedef
35  typename boost::graph_traits< MutableFaceIncidentGraph >::face_descriptor
36  face_descriptor;
37  std::vector< face_descriptor > faces_to_remove;
39  auto faces_range_pair = faces(g);
40  auto iter_f = faces_range_pair.first;
41  for(; iter_f != faces_range_pair.second; ++iter_f)
42  {
43  if(std::find(faces_to_remove.begin(), faces_to_remove.end(), *iter_f) !=
44  faces_to_remove.end())
45  continue;
46  auto iter_f_bis = iter_f;
47  ++iter_f_bis;
48  for(; iter_f_bis != faces_range_pair.second; ++iter_f_bis)
49  {
51  *iter_f, *iter_f_bis, g, take_into_account_face_rientation))
52  {
53  faces_to_remove.push_back(*iter_f_bis);
54  }
55  }
56  }
58  typename std::vector< face_descriptor >::iterator it_f(
59  faces_to_remove.begin()),
60  it_fe(faces_to_remove.end());
61  for(; it_f != it_fe; ++it_f)
62  remove_face(*it_f, g); // REDUNDANT FACES ARE REMOVED
63  faces_to_remove.clear();
64 }
65 
66 } // namespace Filters
67 } // namespace FEVV
FEVV::Operators::are_similar_faces
static bool are_similar_faces(const typename boost::graph_traits< FaceIncidentGraph >::face_descriptor f1, const typename boost::graph_traits< FaceIncidentGraph >::face_descriptor f2, const FaceIncidentGraph &g, bool take_into_account_face_rientation=false)
Function determining if the arguments are similar faces (parallel faces).
Definition: topology_predicates.hpp:99
topology_predicates.hpp
FEVV::Filters::resolve_similar_faces
static void resolve_similar_faces(MutableFaceIncidentGraph &g, bool take_into_account_face_rientation=false)
Remove/resolve similar faces for the given mesh g.
Definition: resolve_similar_faces.hpp:31
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::DataStructures::AIF::remove_face
void remove_face(typename boost::graph_traits< FEVV::DataStructures::AIF::AIFMesh >::face_descriptor f, FEVV::DataStructures::AIF::AIFMesh &sm)
Removes f from the mesh.
Definition: Graph_traits_aif.h:971