MEPP2 Project
AIFFace.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 <iostream>
14 #include <vector>
15 //#include <set>
16 #include <stdexcept>
17 #include <boost/shared_ptr.hpp>
18 #include <boost/range/iterator_range.hpp>
19 
20 
21 namespace FEVV {
22 namespace DataStructures {
23 namespace AIF {
24 
25 class AIFVertex;
26 class AIFEdge;
27 class AIFFace;
28 
29 } // namespace AIF
30 } // namespace DataStructures
31 } // namespace FEVV
32 
33 
34 namespace FEVV {
35 namespace DataStructures {
36 namespace AIF {
37 
45 class AIFFace
46 {
47 public:
48  friend class AIFTopologyHelpers;
49 
50 public:
51  typedef AIFFace self;
52  typedef boost::shared_ptr< self > ptr;
53  typedef boost::shared_ptr< self > ptr_face;
54 
56  typedef AIFEdge edge_type;
57  typedef boost::shared_ptr< vertex_type > ptr_vertex;
58  typedef boost::shared_ptr< edge_type > ptr_edge;
59 
60  typedef std::vector< ptr_vertex > VertexContainerType;
61  typedef std::vector< ptr_edge > EdgeContainerType;
62  typedef std::vector< ptr_face > FaceContainerType;
63 
64  typedef double NormalCoordinateType;
65 
66 private:
70  std::size_t m_Index;
75 
76 private:
83 
88 
89 private:
96  {
97  }
103  AIFFace(const self &other)
104  : m_Index(other.m_Index),
105  m_Incident_PtrEdges(), // incidence relations are not copied
106  m_Incident_PtrVertices(), // incidence relations are not copied
108  {
109  }
110 
111 public:
116  static ptr_face New();
117 
123  static ptr_face New(const self &other);
124 
130  std::size_t GetIndex() const { return m_Index; }
135  void SetIndex(std::size_t idx) { m_Index = idx; }
136 
142  boost::iterator_range< VertexContainerType::const_iterator >
143  GetIncidentVertices(); // cannot be const since it updates vertex incidency
144  // caching when necessary
145 
151  boost::iterator_range< EdgeContainerType::const_iterator >
153  {
154  return boost::make_iterator_range(m_Incident_PtrEdges.cbegin(),
155  m_Incident_PtrEdges.cend());
156  }
157 
163  boost::iterator_range< EdgeContainerType::iterator > GetIncidentEdges()
164  {
165  return boost::make_iterator_range(m_Incident_PtrEdges.begin(),
166  m_Incident_PtrEdges.end());
167  }
168 
173  unsigned int GetDegree()
174  {
175  return static_cast< unsigned int >(m_Incident_PtrEdges.size());
176  }
181  void Print() const;
182 
187  {
188  // DBG std::cout << "clear face-incident-vertices cache for face " << this
189  // << std::endl;
191  m_Incident_PtrVertices.clear();
192  }
193 
200  bool operator<(const self &other) const { return this < &other; }
207  bool operator==(const self &other) const { return this == &other; }
214  bool operator!=(const self &other) const { return !(*this == other); }
221  bool operator<=(const self &other) const
222  {
223  return (*this < other) || (*this == other);
224  }
231  bool operator>=(const self &other) const { return !(*this < other); }
238  bool operator>(const self &other) const { return (other < *this); }
239 };
240 
241 } // namespace AIF
242 } // namespace DataStructures
243 } // namespace FEVV
244 
245 
FEVV::DataStructures::AIF::AIFFace::NormalCoordinateType
double NormalCoordinateType
Definition: AIFFace.hpp:64
FEVV::DataStructures::AIF::AIFFace::GetIncidentEdges
boost::iterator_range< EdgeContainerType::iterator > GetIncidentEdges()
Definition: AIFFace.hpp:163
FEVV::DataStructures::AIF::AIFFace::ptr_edge
boost::shared_ptr< edge_type > ptr_edge
Definition: AIFFace.hpp:58
FEVV::DataStructures::AIF::AIFFace::GetIndex
std::size_t GetIndex() const
Definition: AIFFace.hpp:130
FEVV::DataStructures::AIF::AIFFace::Print
void Print() const
Definition: AIFFace.inl:35
FEVV::DataStructures::AIF::AIFFace::edge_type
AIFEdge edge_type
Definition: AIFFace.hpp:56
FEVV::DataStructures::AIF::AIFVertex
This class represents a vertex used by AIFMesh objects. An AIFVertex natively saves relations with it...
Definition: AIFVertex.hpp:41
FEVV::DataStructures::AIF::AIFFace::m_Incident_PtrVertices
VertexContainerType m_Incident_PtrVertices
Definition: AIFFace.hpp:82
FEVV::DataStructures::AIF::AIFFace::GetDegree
unsigned int GetDegree()
Definition: AIFFace.hpp:173
FEVV::DataStructures::AIF::AIFFace::m_Incident_PtrEdges
EdgeContainerType m_Incident_PtrEdges
Definition: AIFFace.hpp:74
FEVV::DataStructures::AIF::AIFFace::SetIndex
void SetIndex(std::size_t idx)
Definition: AIFFace.hpp:135
FEVV::DataStructures::AIF::AIFFace::AIFFace
AIFFace(const self &other)
Definition: AIFFace.hpp:103
FEVV::DataStructures::AIF::AIFFace
This class represents a face used by AIFMesh objects. An AIFFace natively saves relations with its in...
Definition: AIFFace.hpp:46
FEVV::DataStructures::AIF::AIFFace::ptr
boost::shared_ptr< self > ptr
Definition: AIFFace.hpp:52
FEVV::DataStructures::AIF::AIFFace::m_Is_Incident_PtrVertices_Computed
bool m_Is_Incident_PtrVertices_Computed
Definition: AIFFace.hpp:87
FEVV::DataStructures::AIF::AIFFace::EdgeContainerType
std::vector< ptr_edge > EdgeContainerType
Definition: AIFFace.hpp:61
FEVV::DataStructures::AIF::AIFFace::VertexContainerType
std::vector< ptr_vertex > VertexContainerType
Definition: AIFFace.hpp:60
FEVV::DataStructures::AIF::AIFFace::operator==
bool operator==(const self &other) const
Definition: AIFFace.hpp:207
FEVV::DataStructures::AIF::AIFFace::ptr_face
boost::shared_ptr< self > ptr_face
Definition: AIFFace.hpp:53
FEVV
Interfaces for plugins These interfaces will be used for different plugins.
Definition: Assert.h:16
FEVV::DataStructures::AIF::AIFFace::GetIncidentEdges
boost::iterator_range< EdgeContainerType::const_iterator > GetIncidentEdges() const
Definition: AIFFace.hpp:152
AIFFace.inl
FEVV::DataStructures::AIF::AIFFace::ptr_vertex
boost::shared_ptr< vertex_type > ptr_vertex
Definition: AIFFace.hpp:57
FEVV::DataStructures::AIF::AIFFace::m_Index
std::size_t m_Index
Definition: AIFFace.hpp:70
FEVV::DataStructures::AIF::AIFFace::AIFFace
AIFFace()
Definition: AIFFace.hpp:93
FEVV::DataStructures::AIF::AIFFace::FaceContainerType
std::vector< ptr_face > FaceContainerType
Definition: AIFFace.hpp:62
FEVV::DataStructures::AIF::AIFFace::operator<=
bool operator<=(const self &other) const
Definition: AIFFace.hpp:221
FEVV::DataStructures::AIF::AIFFace::operator!=
bool operator!=(const self &other) const
Definition: AIFFace.hpp:214
FEVV::DataStructures::AIF::AIFTopologyHelpers
This class is an helper class associated to the AIFMesh structure. AIFTopologyHelpers implements all ...
Definition: AIFTopologyHelpers.h:57
FEVV::DataStructures::AIF::AIFEdge
This class represents an edge used by AIFMesh objects. An AIFEdge natively saves relations with its i...
Definition: AIFEdge.hpp:49
FEVV::DataStructures::AIF::AIFFace::New
static ptr_face New()
Definition: AIFFace.inl:19
FEVV::DataStructures::AIF::AIFFace::operator<
bool operator<(const self &other) const
Definition: AIFFace.hpp:200
FEVV::DataStructures::AIF::AIFFace::vertex_type
AIFVertex vertex_type
Definition: AIFFace.hpp:55
FEVV::DataStructures::AIF::AIFFace::operator>
bool operator>(const self &other) const
Definition: AIFFace.hpp:238
FEVV::DataStructures::AIF::AIFFace::GetIncidentVertices
boost::iterator_range< VertexContainerType::const_iterator > GetIncidentVertices()
Definition: AIFFace.inl:47
FEVV::DataStructures::AIF::AIFFace::operator>=
bool operator>=(const self &other) const
Definition: AIFFace.hpp:231
FEVV::DataStructures::AIF::AIFFace::clear_vertex_incidency
void clear_vertex_incidency()
Definition: AIFFace.hpp:186