Class documentation of Concepts

Loading...
Searching...
No Matches
continuityData.hh
Go to the documentation of this file.
1
7#ifndef continuityData_hh
8#define continuityData_hh
9
10#include <iostream>
11#include <map>
12#include "basics/exceptions.hh"
13#include "toolbox/hashMap.hh"
14#include "toolbox/set.hh"
15#include "cell.hh"
16#include "connector.hh"
17#include "connectorSet.hh"
18
19namespace concepts {
20
21 class CellData;
22
23 // ******************************************************** WrongRelations **
24
28 class WrongRelations : public ExceptionBase {};
29
30
31 // ********************************************************* ConnectorData **
32
40 public:
42 typedef std::map<uint, const CellData*>::iterator iterator;
44 typedef std::map<uint, const CellData*>::const_iterator const_iterator;
45
52 void addCell(const CellData& c);
54 bool hasCell(const Connector& c) const;
60 void replaceCell(const CellData& remove, const CellData& add);
61
63 iterator begin() { return cells_.begin(); }
65 const_iterator begin() const { return cells_.begin(); }
67 iterator end() { return cells_.end(); }
69 const_iterator end() const { return cells_.end(); }
70 protected:
72 std::map<uint, const CellData*> cells_;
73 };
74
75 // ************************************************************** CellData **
76
80 class CellData {
81 public:
87 cell_(cell) {
89 cntrData_.addCell(*this);
90 }
92 const Connector& cell() const { return cell_; }
94 const Connector1* edge(const uint i) const;
96 const Connector2* face(const uint i) const;
98 bool hasFace(const Connector2& f) const;
100 bool hasEdge(const Connector1& e) const;
102 const CellData* father() const {
103 if (father_.begin()==father_.end()) {
104 return 0;
105 }
106 else return father_.begin()->second;
107 }
109 ConnectorData fathers() const { return father_; }
115 const CellData* father(uint i) const;
119 const ConnectorData fathers(uint i) const;
123 int related(const CellData& c) const {
124 return cell_.related(c.cell()); }
126 Key key() const { return cell_.key(); }
127 private:
129 const Connector& cell_;
131 ConnectorData father_;
133 ConnectorData cntrData_;
134 };
135
136 std::ostream& operator<<(std::ostream& os, const CellData& c);
137
138 // ************************************************************** FaceData **
139
143 class FaceData : public ConnectorData {
144 friend std::ostream& operator<<(std::ostream& os, const FaceData& f);
145 public:
149 FaceData(const Connector2& face) : face_(face) {}
151 const Connector2& face() const { return face_; }
153 int related(const FaceData& f) const {
154 return face_.related(f.face()); }
156 Key key() const { return face_.key(); }
162 static void checkRelatedFaces(std::map<uint, FaceData>& faceList);
163 private:
165 const Connector2& face_;
166 };
167
168 // ************************************************************** EdgeData **
169
173 class EdgeData : public ConnectorData {
174 friend std::ostream& operator<<(std::ostream& os, const EdgeData& e);
175 public:
179 EdgeData(const Connector1& edge) : edge_(edge), io_(false) {}
181 const Connector1& edge() const { return edge_; }
183 int related(const EdgeData& e) const {
184 return edge_.related(e.edge()); }
186 void addFace(const FaceData& f);
192 static bool doCheckRelations(std::map<uint, EdgeData>& edgeList);
219 Key key() const { return edge_.key(); }
226 static void checkRelatedEdges(std::map<uint, EdgeData>& edgeList);
227 private:
229 const Connector1& edge_;
233 bool io_;
235 std::map<uint, FaceData> faces_;
239 void recreateFaceList_();
241 const CellData* findCommonCell_(const FaceData& face) const;
242 };
243
244 // ************************************************************ VertexData **
245
249 class VertexData : public ConnectorData {
250 friend std::ostream& operator<<(std::ostream& os, const VertexData& e);
251 public:
255 VertexData(const Connector0& vertex) : vertex_(vertex), io_(false) {}
257 const Connector0& vertex() const { return vertex_; }
259 void addEdge(const EdgeData& e);
265 static bool doCheckRelations(std::map<uint, VertexData>& vertexList);
292 Key key() const { return vertex_.key(); }
293 private:
295 const Connector0& vertex_;
299 bool io_;
301 std::map<uint, EdgeData> edges_;
305 void recreateEdgeList_();
307 const CellData* findCommonCell_(const EdgeData& edge) const;
308 };
309
310 // ******************************************************* EdgesOfVertices **
311
317 class EdgesOfVertices : public HashMap<Set<Connector1*> > {
318 public:
324 void addCell(const concepts::Connector2& cell);
325 };
326
327} // namespace concepts
328
329#endif // continuityData_hh
void addFather(const CellData *father)
Adds a father, if its not 0.
const Connector1 * edge(const uint i) const
Returns the ith edge of the cell.
bool hasFace(const Connector2 &f) const
Returns true if face f exists.
const ConnectorData fathers(uint i) const
const Connector2 * face(const uint i) const
Returns the ith face of the cell.
const CellData * father(uint i) const
ConnectorData fathers() const
Returns father_ (might be 0)
bool hasEdge(const Connector1 &e) const
Returns true if edge e exists.
CellData(const Connector &cell, const CellData *father)
const Connector & cell() const
Returns cell_.
Key key() const
Returns the key of the cell.
const CellData * father() const
Returns the (1st) father (might be 0)
int related(const CellData &c) const
Calls Connector::related.
iterator end()
Returns the STL end of the list of cells.
void addCell(const CellData &c)
const_iterator end() const
Returns the STL end of the list of cells.
iterator begin()
Returns the STL beginning of the list of cells.
std::map< uint, constCellData * >::iterator iterator
The STL iterator over the list of cells.
bool hasCell(const Connector &c) const
Returns true if c is in the list of cells.
void replaceCell(const CellData &remove, const CellData &add)
const_iterator begin() const
Returns the STL beginning of the list of cells.
std::map< uint, const CellData * > cells_
List of cells.
std::map< uint, constCellData * >::const_iterator const_iterator
The constant STL iterator over the list of cells.
int related(const Connector &conn) const
const Key & key() const
Returns the key of the connector.
Definition connector.hh:105
static void checkRelatedEdges(std::map< uint, EdgeData > &edgeList)
Key key() const
Returns the key of the edge.
void addFace(const FaceData &f)
Adds f to faces_ whithout check.
const Connector1 & edge() const
Returns edge_.
static bool doCheckRelations(std::map< uint, EdgeData > &edgeList)
int related(const EdgeData &e) const
Calls Connector::related.
EdgeData(const Connector1 &edge)
EdgesOfVertices(const concepts::Connector2 &cell)
Constructor.
EdgesOfVertices()
Standard constructor.
void addCell(const concepts::Connector2 &cell)
adds the vertices and belonging edges of cell to the mapping
int related(const FaceData &f) const
Calls Connector::related.
static void checkRelatedFaces(std::map< uint, FaceData > &faceList)
const Connector2 & face() const
Returns face_.
FaceData(const Connector2 &face)
Key key() const
Returns the key of the face.
static bool doCheckRelations(std::map< uint, VertexData > &vertexList)
void addEdge(const EdgeData &e)
Adds e to edges_ whithout check.
VertexData(const Connector0 &vertex)
const Connector0 & vertex() const
Rerturns c vertex_.
Key key() const
Returns the key of the vertex.
Set< F > makeSet(uint n, const F &first,...)
Definition set.hh:320