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 
19 namespace concepts {
20 
21  class CellData;
22 
23  // ******************************************************** WrongRelations **
24 
28  class WrongRelations : public ExceptionBase {};
29 
30 
31  // ********************************************************* ConnectorData **
32 
39  class ConnectorData {
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;
121  void addFather(const CellData* father);
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_;
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:
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:
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:
233  bool io_;
235  std::map<uint, FaceData> faces_;
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:
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:
299  bool io_;
301  std::map<uint, EdgeData> edges_;
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
int related(const EdgeData &e) const
Calls Connector::related.
Key key() const
Returns the key of the face.
bool io_
Is set to true if the edge is okay.
std::map< uint, const CellData * > cells_
List of cells.
const Connector & cell_
Cell.
EdgeData(const Connector1 &edge)
Constructor.
const Connector1 & edge_
Edge.
Base class for exceptions.
Definition: exceptions.hh:86
const Connector2 & face() const
Returns face_.
iterator end()
Returns the STL end of the list of cells.
std::map< uint, FaceData > faces_
List of faces of this edge.
int related(const CellData &c) const
Calls Connector::related.
void replaceCell(const CellData &remove, const CellData &add)
Removes remove from the list of cells and tries to add add to this list using addCell.
Key key() const
Returns the key of the vertex.
void addEdge(const EdgeData &e)
Adds e to edges_ whithout check.
bool hasEdge(const Connector1 &e) const
Returns true if edge e exists.
Stores additional information on a cell, namely its father.
std::map< uint, const CellData * >::iterator iterator
The STL iterator over the list of cells.
const Connector1 * edge(const uint i) const
Returns the ith edge of the cell.
const ConnectorData fathers(uint i) const
Returns the fathers of the i.th level Its assumed, that all the fathers have common grandfathers.
Key key() const
Returns the key of the edge.
VertexData(const Connector0 &vertex)
Constructor.
const CellData * father() const
Returns the (1st) father (might be 0)
friend std::ostream & operator<<(std::ostream &os, const FaceData &f)
void addCell(const CellData &c)
Adds c to the list of cells.
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.
CellData(const Connector &cell, const CellData *father)
Constructor.
const CellData * father(uint i) const
Returns the (1st) father of the i.th level i = 0 : returns itself i = 1 : returns the fathers i = 2 :...
std::map< uint, const CellData * >::const_iterator const_iterator
The constant STL iterator over the list of cells.
Stores additional information on a vertex, namely its cells and edges.
bool hasFace(const Connector2 &f) const
Returns true if face f exists.
const_iterator end() const
Returns the STL end of the list of cells.
const Connector0 & vertex_
Vertex.
Stores additional information on a face, namely its cells.
std::map< uint, EdgeData > edges_
List of edges of this vertex.
const Key & key() const
Returns the key of the connector.
Definition: connector.hh:105
friend std::ostream & operator<<(std::ostream &os, const VertexData &e)
EdgesOfVertices(const concepts::Connector2 &cell)
Constructor.
const CellData * findCommonCell_(const EdgeData &edge) const
Finds a cell which is common to this vertex and the edge.
std::ostream & operator<<(std::ostream &os, const Level< dim > &c)
A 2D element of the topology.
Definition: connector.hh:226
Build a mapping from vertices (over their key) in a cell to the edges their belong to.
bool checkRelations()
Checks the relations in faces_.
Generalization of the class which store additional information for topological entities.
const CellData * findCommonCell_(const FaceData &face) const
Finds a cell which is common to this edge and the face.
bool checkRelations()
Checks the relations in edges_.
void recreateFaceList_()
Removes the faces in faces_ and rebuilds this list from the cells in cells_.
static bool doCheckRelations(std::map< uint, EdgeData > &edgeList)
Calls checkRelations for each edge in the edgeList.
int related(const Connector &conn) const
Checks if this connector is related to conn.
const_iterator begin() const
Returns the STL beginning of the list of cells.
void recreateEdgeList_()
Removes the edges in edges_ and rebuilds this list from the cells in cells_.
Stores additional information on an edge, namely its cells and faces.
void addFace(const FaceData &f)
Adds f to faces_ whithout check.
ConnectorData fathers() const
Returns father_ (might be 0)
static void checkRelatedEdges(std::map< uint, EdgeData > &edgeList)
Checks if there are edges with relations in edgeList.
ConnectorData father_
List of fathers of the cell (might be no father)
const Connector2 * face(const uint i) const
Returns the ith face of the cell.
friend std::ostream & operator<<(std::ostream &os, const EdgeData &e)
A 1D element of the topology.
Definition: connector.hh:182
static void checkRelatedFaces(std::map< uint, FaceData > &faceList)
Checks if there are faces with relations in faceList.
const Connector0 & vertex() const
Rerturns c vertex_.
const Connector2 & face_
Face.
static bool doCheckRelations(std::map< uint, VertexData > &vertexList)
Calls checkRelations for each vertex in the vertexList.
Exception class to express an illegal relation within topological lists.
bool hasCell(const Connector &c) const
Returns true if c is in the list of cells.
Key key() const
Returns the key of the cell.
Key class.
Definition: connector.hh:53
iterator begin()
Returns the STL beginning of the list of cells.
EdgesOfVertices()
Standard constructor.
bool io_
Is set to true if the vertex is okay.
ConnectorData cntrData_
Link to the 0.th father (cell itself)
An abstract class for elements of the topology.
Definition: connector.hh:85
void addFather(const CellData *father)
Adds a father, if its not 0.
const Connector & cell() const
Returns cell_.
A 0D element of the topology.
Definition: connector.hh:147
const Connector1 & edge() const
Returns edge_.
Basic namespace for Concepts-2.
Definition: pml_formula.h:16
FaceData(const Connector2 &face)
Constructor.
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich