Class documentation of Concepts

Loading...
Searching...
No Matches
vertexList.hh
Go to the documentation of this file.
1
6#ifndef geoLists_hh
7#define geoLists_hh
8
9#include <iostream>
11#include "toolbox/hashMap.hh"
12#include "toolbox/hashSet.hh"
13#include "space/postProcess.hh"
14
15namespace concepts {
16 // forward declarations
17} // namespace concepts
18
19namespace graphics {
20
21 using concepts::Real;
22
23 // ************************************************************ VertexInfo **
24
35 class VertexInfo {
36 friend std::ostream& operator<< (std::ostream& os, const VertexInfo& v);
37 public:
42 VertexInfo(concepts::Real3d coord, uint index = 0) :
43 index_(index), coord_(coord) {}
44
46 void addEdge(uint edge) { edges_.insert(edge); }
47
49 void addFace(uint face) { faces_.insert(face); }
50
52 void addVolume(uint volume) { volumes_.insert(volume); }
53
55 uint& index() { return index_; }
57 uint index() const { return index_; }
58
60 concepts::Real3d coordinates() const { return coord_; }
61 private:
67 uint index_;
68
70 concepts::Real3d coord_;
71
73 std::unordered_set<uint> edges_;
74
76 std::unordered_set<uint> faces_;
77
79 std::unordered_set<uint> volumes_;
80 };
81
82 // ************************************************************ VertexList **
83
98 public:
99 typedef std::unordered_map<uint, VertexInfo>::iterator iterator;
100 typedef std::unordered_map<uint, VertexInfo>::const_iterator
101 const_iterator;
102
109 enum vtxInfo { COORD = 0, EDGES = 1, FACES = 2, VOLUMES = 4, ALL = 7 };
110
113 VertexList(enum vtxInfo info = ALL) : vtxInfo_(info) {}
114
117
118 virtual ~VertexList() {}
119
125
132
134 uint size() const { return vertices_.size(); }
135
137 iterator begin() { return vertices_.begin(); }
138 const_iterator begin() const { return vertices_.begin(); }
139
141 iterator end() { return vertices_.end(); }
142 const_iterator end() const { return vertices_.end(); }
143
145 iterator find(uint k) { return vertices_.find(k); }
146 const_iterator find(uint k) const { return vertices_.find(k); }
147
153 virtual void operator() (const concepts::Cell& cell);
154
160 virtual void operator() (const concepts::Element<Real>& elm);
161
163 enum vtxInfo vertexInfo() const { return vtxInfo_; }
164 protected:
165 virtual std::ostream& info(std::ostream& os) const;
166 private:
168 std::unordered_map<uint, VertexInfo> vertices_;
169
171 enum vtxInfo vtxInfo_;
172 };
173
174} // namespace graphics
175
176#endif // geoLists_hh
uint & index()
Sets the index of the vertex.
Definition vertexList.hh:55
void addVolume(uint volume)
Adds a volume to the list of volumes.
Definition vertexList.hh:52
concepts::Real3d coordinates() const
Returns the coordinates.
Definition vertexList.hh:60
void addFace(uint face)
Adds a face to the list of faces.
Definition vertexList.hh:49
VertexInfo(concepts::Real3d coord, uint index=0)
Definition vertexList.hh:42
uint index() const
Returns the index of the vertex.
Definition vertexList.hh:57
void addEdge(uint edge)
Adds an edge to the list of edges.
Definition vertexList.hh:46
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
VertexList(enum vtxInfo info=ALL)
iterator find(uint k)
Finds a vertex in the list.
iterator begin()
Beginning of the list.
VertexList(const VertexList &vl)
Copy constructor.
VertexInfo * vertex(uint v)
virtual void operator()(const concepts::Cell &cell)
uint size() const
Returns the size of the list.
VertexInfo * addVertex(uint v, concepts::Real3d coord)
enum vtxInfo vertexInfo() const
Returns vtxInfo_.
iterator end()
End of the list.
double Real
Definition typedefs.hh:39