MEPP2 Project
AIFVertex.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 <cmath>
14 #include <iostream>
15 #include <algorithm>
16 #include <vector>
17 #include <limits>
18 #include <stdexcept>
19 #include <map>
20 #include <memory> // for unique_ptr
21 #include <array>
22 #include <boost/shared_ptr.hpp>
23 #include <boost/range/iterator_range.hpp>
24 #include <boost/property_map/property_map.hpp>
25 
26 
27 namespace FEVV {
28 namespace DataStructures {
29 namespace AIF {
30 
31 class AIFEdge;
32 class AIFFace;
33 
40 class AIFVertex
41 {
42 public:
43  friend class AIFTopologyHelpers;
44 
45 public:
46  typedef AIFVertex self;
47  typedef boost::shared_ptr< self > ptr;
48  typedef boost::shared_ptr< self > ptr_vertex;
49 
50  typedef AIFEdge edge_type;
51  typedef AIFFace face_type;
52  typedef boost::shared_ptr< edge_type > ptr_edge;
53  typedef boost::shared_ptr< face_type > ptr_face;
54 
55  typedef std::vector< ptr_vertex > VertexContainerType;
56  typedef std::vector< ptr_edge > EdgeContainerType;
57  typedef std::vector< ptr_face > FaceContainerType;
58 
59  typedef double CoordinateType;
61 
62 private:
66  std::size_t m_Index;
71 
72  static const unsigned int m_d = 3;
73 
74 private:
80  FaceContainerType m_Incident_PtrFaces; // is managed via AIFTopologyHelpers
85  bool m_Incident_PtrFaces_Computed; // is managed via AIFTopologyHelpers
91  VertexContainerType m_One_Ring_Vertices; // is managed via AIFTopologyHelpers
96  bool m_Is_One_Ring_Vertices_Computed; // is managed via AIFTopologyHelpers
97 
98 private:
106  {
107  }
108 
114  AIFVertex(const self &other)
115  : m_Index(other.m_Index), // same index for the time being (this should be
116  // the case only in the Clone method)
117  m_Incident_PtrEdges(), // incidence relations are not copied for
118  // vertices
119  m_Incident_PtrFaces(), // incidence relations are not copied for
120  // vertices
123  {
124  }
125 
126 public:
131  static ptr_vertex New();
137  static ptr_vertex New(const self &other);
142  std::size_t GetIndex() const { return m_Index; }
147  void SetIndex(std::size_t idx) { m_Index = idx; }
153  boost::iterator_range< EdgeContainerType::const_iterator > GetIncidentEdges()
154  {
155  return boost::make_iterator_range(m_Incident_PtrEdges.cbegin(),
156  m_Incident_PtrEdges.cend());
157  }
158 
163  unsigned int GetDegree()
164  {
165  return static_cast< unsigned int >(m_Incident_PtrEdges.size());
166  }
167 
172  void Print() const;
173 
180  bool operator<(const self &other) const { return this < &other; }
187  bool operator==(const self &other) const { return this == &other; }
194  bool operator!=(const self &other) const { return !(*this == other); }
201  bool operator<=(const self &other) const
202  {
203  return (*this < other) || (*this == other);
204  }
211  bool operator>=(const self &other) const { return !(*this < other); }
218  bool operator>(const self &other) const { return (other < *this); }
219 };
220 
221 } // namespace AIF
222 } // namespace DataStructures
223 } // namespace FEVV
224 
225 
FEVV::DataStructures::AIF::AIFVertex::ptr
boost::shared_ptr< self > ptr
Definition: AIFVertex.hpp:47
FEVV::DataStructures::AIF::AIFFace::NormalCoordinateType
double NormalCoordinateType
Definition: AIFFace.hpp:64
FEVV::DataStructures::AIF::AIFVertex::operator<=
bool operator<=(const self &other) const
Definition: AIFVertex.hpp:201
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::AIFVertex::VertexContainerType
std::vector< ptr_vertex > VertexContainerType
Definition: AIFVertex.hpp:55
FEVV::DataStructures::AIF::AIFVertex::face_type
AIFFace face_type
Definition: AIFVertex.hpp:51
FEVV::DataStructures::AIF::AIFVertex::GetIncidentEdges
boost::iterator_range< EdgeContainerType::const_iterator > GetIncidentEdges()
Definition: AIFVertex.hpp:153
FEVV::DataStructures::AIF::AIFVertex::operator!=
bool operator!=(const self &other) const
Definition: AIFVertex.hpp:194
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::AIFVertex::Print
void Print() const
Definition: AIFVertex.inl:33
FEVV::DataStructures::AIF::AIFVertex::m_Incident_PtrFaces
FaceContainerType m_Incident_PtrFaces
Definition: AIFVertex.hpp:80
FEVV::DataStructures::AIF::AIFVertex::m_Is_One_Ring_Vertices_Computed
bool m_Is_One_Ring_Vertices_Computed
Definition: AIFVertex.hpp:96
FEVV::DataStructures::AIF::AIFVertex::operator>
bool operator>(const self &other) const
Definition: AIFVertex.hpp:218
FEVV::DataStructures::AIF::AIFVertex::m_Incident_PtrEdges
EdgeContainerType m_Incident_PtrEdges
Definition: AIFVertex.hpp:70
FEVV::DataStructures::AIF::AIFVertex::AIFVertex
AIFVertex(const self &other)
Definition: AIFVertex.hpp:114
FEVV::DataStructures::AIF::AIFVertex::m_Incident_PtrFaces_Computed
bool m_Incident_PtrFaces_Computed
Definition: AIFVertex.hpp:85
FEVV::DataStructures::AIF::AIFVertex::NormalCoordinateType
face_type::NormalCoordinateType NormalCoordinateType
Definition: AIFVertex.hpp:60
FEVV
Interfaces for plugins These interfaces will be used for different plugins.
Definition: Assert.h:16
FEVV::DataStructures::AIF::AIFVertex::CoordinateType
double CoordinateType
Definition: AIFVertex.hpp:59
FEVV::DataStructures::AIF::AIFVertex::ptr_vertex
boost::shared_ptr< self > ptr_vertex
Definition: AIFVertex.hpp:48
FEVV::DataStructures::AIF::AIFVertex::operator>=
bool operator>=(const self &other) const
Definition: AIFVertex.hpp:211
FEVV::DataStructures::AIF::AIFVertex::edge_type
AIFEdge edge_type
Definition: AIFVertex.hpp:50
FEVV::DataStructures::AIF::AIFVertex::GetIndex
std::size_t GetIndex() const
Definition: AIFVertex.hpp:142
FEVV::DataStructures::AIF::AIFVertex::m_One_Ring_Vertices
VertexContainerType m_One_Ring_Vertices
Definition: AIFVertex.hpp:91
FEVV::DataStructures::AIF::AIFVertex::New
static ptr_vertex New()
Definition: AIFVertex.inl:17
FEVV::DataStructures::AIF::AIFVertex::m_Index
std::size_t m_Index
Definition: AIFVertex.hpp:66
FEVV::DataStructures::AIF::AIFVertex::ptr_face
boost::shared_ptr< face_type > ptr_face
Definition: AIFVertex.hpp:53
FEVV::DataStructures::AIF::AIFVertex::operator<
bool operator<(const self &other) const
Definition: AIFVertex.hpp:180
FEVV::DataStructures::AIF::AIFVertex::m_d
static const unsigned int m_d
Definition: AIFVertex.hpp:72
FEVV::DataStructures::AIF::AIFVertex::SetIndex
void SetIndex(std::size_t idx)
Definition: AIFVertex.hpp:147
FEVV::DataStructures::AIF::AIFTopologyHelpers
This class is an helper class associated to the AIFMesh structure. AIFTopologyHelpers implements all ...
Definition: AIFTopologyHelpers.h:57
AIFVertex.inl
FEVV::DataStructures::AIF::AIFVertex::ptr_edge
boost::shared_ptr< edge_type > ptr_edge
Definition: AIFVertex.hpp:52
FEVV::DataStructures::AIF::AIFVertex::operator==
bool operator==(const self &other) const
Definition: AIFVertex.hpp:187
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::AIFVertex::FaceContainerType
std::vector< ptr_face > FaceContainerType
Definition: AIFVertex.hpp:57
FEVV::DataStructures::AIF::AIFVertex::AIFVertex
AIFVertex()
Definition: AIFVertex.hpp:102
FEVV::DataStructures::AIF::AIFVertex::EdgeContainerType
std::vector< ptr_edge > EdgeContainerType
Definition: AIFVertex.hpp:56
FEVV::DataStructures::AIF::AIFVertex::GetDegree
unsigned int GetDegree()
Definition: AIFVertex.hpp:163