MEPP2 Project
AIFEdge.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 #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829
14 #include <boost/property_map/property_map.hpp>
15 #endif
16 
17 #include <iostream>
18 #include <vector>
19 #include <array>
20 #include <utility>
21 #include <stdexcept>
22 #include <boost/shared_ptr.hpp>
23 #include <boost/range/iterator_range.hpp>
24 
26 
27 
28 namespace FEVV {
29 namespace DataStructures {
30 namespace AIF {
31 class AIFEdge;
32 class AIFFace;
33 } // namespace AIF
34 } // namespace DataStructures
35 } // namespace FEVV
36 
37 namespace FEVV {
38 namespace DataStructures {
39 namespace AIF {
40 
48 class AIFEdge
49 {
50 public:
51  friend class AIFEdgeComparator;
52  friend class AIFTopologyHelpers;
53 
54 public:
55  typedef AIFEdge self;
56  typedef boost::shared_ptr< self > ptr;
57  typedef boost::shared_ptr< self > ptr_edge;
58 
60  typedef AIFFace face_type;
61  typedef boost::shared_ptr< vertex_type > ptr_vertex;
62  typedef boost::shared_ptr< face_type > ptr_face;
63 
64  typedef std::array< ptr_vertex, 2 > VertexContainerType;
65  typedef std::vector< ptr_edge > EdgeContainerType;
66  typedef std::vector< ptr_face > FaceContainerType;
67 
68 private:
72  std::size_t m_Index;
81 
82 private:
87 
93  AIFEdge(const self &other)
94  : m_Index(other.m_Index),
95  m_incident_vertices(), // vertex incidence relations are not copied
96  m_incident_PtrFaces() // face incidence relations are not copied
97  {
98  }
99 
100 public:
105  static ptr_edge New();
111  static ptr_edge New(const self &other);
117  boost::iterator_range< VertexContainerType::const_iterator >
119  {
120  return boost::make_iterator_range(m_incident_vertices.cbegin(),
121  m_incident_vertices.cend());
122  }
128  boost::iterator_range< FaceContainerType::const_iterator >
130  {
131  return boost::make_iterator_range(m_incident_PtrFaces.cbegin(),
132  m_incident_PtrFaces.cend());
133  }
134 
140  boost::iterator_range< FaceContainerType::iterator > GetIncidentFaces()
141  {
142  return boost::make_iterator_range(m_incident_PtrFaces.begin(),
143  m_incident_PtrFaces.end());
144  }
145 
150  unsigned int GetDegree()
151  {
152  return static_cast< unsigned int >(m_incident_PtrFaces.size());
153  }
159 
165 
170  std::size_t GetIndex() const { return m_Index; }
175  void SetIndex(std::size_t idx) { m_Index = idx; }
190  void Print() const;
191 
198  bool operator<(const self &other) const;
205  bool operator==(const self &other) const;
212  bool operator!=(const self &other) const { return !(*this == other); }
219  bool operator<=(const self &other) const
220  {
221  return (*this < other) || (*this == other);
222  }
229  bool operator>=(const self &other) const { return !(*this < other); }
236  bool operator>(const self &other) const { return (other < *this); }
237 };
238 
239 } // namespace AIF
240 } // namespace DataStructures
241 } // namespace FEVV
242 
243 
FEVV::DataStructures::AIF::AIFEdge::SetIndex
void SetIndex(std::size_t idx)
Definition: AIFEdge.hpp:175
FEVV::DataStructures::AIF::AIFEdge::VertexContainerType
std::array< ptr_vertex, 2 > VertexContainerType
Definition: AIFEdge.hpp:64
FEVV::DataStructures::AIF::AIFEdge::get_second_vertex
ptr_vertex get_second_vertex() const
Definition: AIFEdge.hpp:164
AIFEdge.inl
FEVV::DataStructures::AIF::AIFEdge::Print
void Print() const
Definition: AIFEdge.inl:53
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::AIFEdge::operator==
bool operator==(const self &other) const
Definition: AIFEdge.inl:46
FEVV::DataStructures::AIF::AIFEdge::GetIndex
std::size_t GetIndex() const
Definition: AIFEdge.hpp:170
FEVV::DataStructures::AIF::AIFEdge::vertex_type
AIFVertex vertex_type
Definition: AIFEdge.hpp:59
FEVV::DataStructures::AIF::AIFEdge::ptr_edge
boost::shared_ptr< self > ptr_edge
Definition: AIFEdge.hpp:57
FEVV::DataStructures::AIF::AIFEdge::m_incident_vertices
VertexContainerType m_incident_vertices
Definition: AIFEdge.hpp:76
FEVV::DataStructures::AIF::AIFEdge::set_first_vertex
void set_first_vertex(ptr_vertex V1)
Definition: AIFEdge.hpp:180
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::AIFEdge::operator>
bool operator>(const self &other) const
Definition: AIFEdge.hpp:236
FEVV::DataStructures::AIF::AIFEdge::operator!=
bool operator!=(const self &other) const
Definition: AIFEdge.hpp:212
FEVV::DataStructures::AIF::AIFEdge::operator<=
bool operator<=(const self &other) const
Definition: AIFEdge.hpp:219
FEVV::DataStructures::AIF::AIFEdge::ptr_face
boost::shared_ptr< face_type > ptr_face
Definition: AIFEdge.hpp:62
FEVV::DataStructures::AIF::AIFEdge::New
static ptr_edge New()
Definition: AIFEdge.inl:22
FEVV::DataStructures::AIF::AIFEdge::GetDegree
unsigned int GetDegree()
Definition: AIFEdge.hpp:150
FEVV::DataStructures::AIF::AIFEdge::operator<
bool operator<(const self &other) const
Definition: AIFEdge.inl:38
FEVV::DataStructures::AIF::AIFEdge::GetIncidentFaces
boost::iterator_range< FaceContainerType::const_iterator > GetIncidentFaces() const
Definition: AIFEdge.hpp:129
FEVV
Interfaces for plugins These interfaces will be used for different plugins.
Definition: Assert.h:16
FEVV::DataStructures::AIF::AIFEdge::AIFEdge
AIFEdge()
Definition: AIFEdge.hpp:86
FEVV::DataStructures::AIF::AIFEdge::face_type
AIFFace face_type
Definition: AIFEdge.hpp:60
FEVV::DataStructures::AIF::AIFEdge::set_second_vertex
void set_second_vertex(ptr_vertex V2)
Definition: AIFEdge.hpp:185
FEVV::DataStructures::AIF::AIFEdge::get_first_vertex
ptr_vertex get_first_vertex() const
Definition: AIFEdge.hpp:158
FEVV::DataStructures::AIF::AIFEdge::GetIncidentVertices
boost::iterator_range< VertexContainerType::const_iterator > GetIncidentVertices()
Definition: AIFEdge.hpp:118
FEVV::DataStructures::AIF::AIFEdge::GetIncidentFaces
boost::iterator_range< FaceContainerType::iterator > GetIncidentFaces()
Definition: AIFEdge.hpp:140
FEVV::DataStructures::AIF::AIFEdge::ptr
boost::shared_ptr< self > ptr
Definition: AIFEdge.hpp:56
FEVV::DataStructures::AIF::AIFEdgeComparator
This class represents an edge comparator used to compare AIFEdge objects.
Definition: AIFEdgeComparator.hpp:26
FEVV::DataStructures::AIF::AIFEdge::FaceContainerType
std::vector< ptr_face > FaceContainerType
Definition: AIFEdge.hpp:66
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::m_incident_PtrFaces
FaceContainerType m_incident_PtrFaces
Definition: AIFEdge.hpp:80
FEVV::DataStructures::AIF::AIFEdge::operator>=
bool operator>=(const self &other) const
Definition: AIFEdge.hpp:229
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
AIFVertex.hpp
FEVV::DataStructures::AIF::AIFEdge::EdgeContainerType
std::vector< ptr_edge > EdgeContainerType
Definition: AIFEdge.hpp:65
FEVV::DataStructures::AIF::AIFEdge::ptr_vertex
boost::shared_ptr< vertex_type > ptr_vertex
Definition: AIFEdge.hpp:61
FEVV::DataStructures::AIF::AIFEdge::m_Index
std::size_t m_Index
Definition: AIFEdge.hpp:72
FEVV::DataStructures::AIF::AIFEdge::AIFEdge
AIFEdge(const self &other)
Definition: AIFEdge.hpp:93