Class documentation of Concepts

Loading...
Searching...
No Matches
topology.hh
Go to the documentation of this file.
1
7#ifndef topology_hh
8#define topology_hh
9
10#include <memory>
11#include <map>
12#include "basics/typedefs.hh"
13#include "basics/Zm.hh"
14#include "basics/debug.hh"
16#include "connector.hh"
17#include "quadsubdiv.hh"
18#include "strategyChange.hh"
19
20#define VertexConstr_D 0
21
22namespace concepts {
23
24 // ***************************************************************** match **
25
30 int match(const Connector1& edg0, const Connector1& edg1, int idx[]);
31
32
33 // **************************************************************** Vertex **
34
40 class Vertex : public Connector0 {
41 public:
44 DEBUGL(VertexConstr_D, key());
45 }
46
47 virtual ~Vertex();
48
49 virtual Vertex* child(uint i, bool mode = 0) { return this; }
50 virtual const Vertex* child(uint) const { return this; }
51
55 inline Vertex* clone() const;
56 protected:
57 virtual std::ostream& info(std::ostream& os) const;
58 private:
60 Vertex(const Attribute attrib, const Key& key) : Connector0(attrib, key) {}
61 };
62
64 return new Vertex(attrib(), key());
65 }
66
67 // ****************************************************************** Edge **
68
73 class Edge : public Connector1 {
74
75 public:
85 virtual ~Edge();
86
100 virtual Edge* child(uint i, bool mode = 0);
101 virtual const Edge* child(uint i) const;
102
103 Vertex* vertex(uint i) const { return i < 2 ? vtx_[i] : 0; }
104
108 inline Edge* clone(Vertex& vtx0, Vertex& vtx1) const;
109 protected:
112
113 virtual std::ostream& info(std::ostream& os) const;
116
121
124
130 };
131
133 return new Edge(vtx0, vtx1, attrib(), key());
134 }
135
136 // ********************************************************** InfiniteEdge **
137
143 class InfiniteEdge : public Connector1 {
144
145 public:
152 virtual ~InfiniteEdge();
153
165 virtual Connector1* child(uint i, bool mode = 0);
166 virtual const Connector1* child(uint i) const;
167
168 Vertex* vertex(uint i = 0) const { return i < 1 ? vtx_ : 0; }
169 protected:
170 virtual std::ostream& info(std::ostream& os) const;
173
178
181 };
182
183 // ************************************************************** Triangle **
184
193 class Triangle : public Connector2 {
194 public:
207 const Attribute attrib = Attribute());
208 virtual ~Triangle();
209
221 virtual Triangle* child(uint i, bool mode = 0);
222 virtual const Triangle* child(uint i) const;
223
224 Edge* edge(uint i) const { return i < 3 ? edg_[i] : 0; }
225 Vertex* vertex(uint i) const { return i<3 ? edg_[i]->vertex(rho_[i]) : 0; }
226
230 Z2 rho(int i) const { return rho_[i]; }
231
235 inline Triangle* clone(Edge& edg0, Edge& edg1, Edge& edg2) const;
236 protected:
237 virtual std::ostream& info(std::ostream& os) const;
238 private:
241 const Attribute attrib, const Key& key, const Z2 rho[]);
242
244 Triangle* lnk_;
245
249 Triangle* chld_;
250
252 Edge* edg_[3];
253
255 Z2 rho_[3];
256 };
257
259 return new Triangle(edg0, edg1, edg2, attrib(), key(), rho_);
260 }
261
262 // ****************************************************************** Quad **
263
272 class Quad : public Connector2 {
273 friend class QuadSubdiv4;
274 friend class QuadSubdiv2H;
275 friend class QuadSubdiv2V;
276 public:
291 const Attribute attrib = Attribute());
297 Quad(const Quad& quad, uint i);
299 virtual ~Quad();
300
313 virtual Quad* child(uint i, bool mode = 0);
314 virtual const Quad* child(uint i) const;
315
316 Edge* edge(uint i) const { return i < 4 ? edg_[i] : 0; }
317 Vertex* vertex(uint i) const { return i<4 ? edg_[i]->vertex(rho_[i]) : 0; }
318
319 int numVertices() const {
320 return 4;
321 }
322
323 int numEdges() const {
324 return 4;
325 }
326
334 Z2 rho(int i) const { return rho_[i]; }
335
336 bool regular() const { return regular_; }
337
341 inline Quad* clone(Edge& edg0, Edge& edg1, Edge& edg2, Edge& edg3) const;
342
355
361 const QuadSubdivision* getStrategy() const { return subdivStrategy_; }
362 protected:
363 virtual std::ostream& info(std::ostream& os) const;
364
367 const Attribute attrib, const Key& key, const Z2 rho[]);
368
371
374
377
380
382 static std::map<Key, Z2> rhoTriv_;
383
386
388 inline Scan<Quad>* children_() const {
389 return new concepts::PListScan<Quad>(*chld_);
390 }
391
393 void edgeAssertion_() const;
394 };
395
397 return new Quad(edg0, edg1, edg2, edg3, attrib(), key(), rho_);
398 }
399
400
401 // ********************************************************** InfiniteQuad **
402
422 class InfiniteQuad : public Connector2 {
423 friend class InfQuadSubdiv2V;
424 public:
437 const Attribute attrib = Attribute());
439 virtual ~InfiniteQuad();
440
453 virtual Connector2* child(uint i, bool mode = 0);
454 virtual const Connector2* child(uint i) const;
455
457 Vertex* vertex(uint i) const { return i<2 ? infEdg_[i]->vertex() : 0; }
458
459 int numVertices() const {
460 return 2;
461 }
462
463 int numEdges() const {
464 return 3;
465 }
466
472 Z2 rho() const { return rho_; }
473
478 InfiniteEdge& edg2) const;
479
492
499 protected:
500 virtual std::ostream& info(std::ostream& os) const;
501
504 const Attribute attrib, const Key& key, const Z2 rho);
505
508
511
514
517
520
522 inline Scan<Connector2>* children_() const {
524 }
525
527 void edgeAssertion_() const;
528};
529
534
535} // namespace concepts
536
537#endif
const Key & key() const
Returns the key of the connector.
Definition connector.hh:105
const Attribute & attrib() const
Returns the attribute of the connector.
Definition connector.hh:108
Edge(Edge &edg0, Edge &edg1)
Construct a "parent" edge of the edges edg0 and edg1.
Edge(Vertex &vtx0, Vertex &vtx1, const Attribute attrib, const Key &key)
Constructor used by clone()
Edge * clone(Vertex &vtx0, Vertex &vtx1) const
Definition topology.hh:132
Edge(Vertex &vtx0, Vertex &vtx1, const Attribute attrib=Attribute())
Edge * lnk_
Pointer to a sibling.
Definition topology.hh:115
virtual Edge * child(uint i, bool mode=0)
Vertex * vtx_[2]
Array of the vertices.
Definition topology.hh:123
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Vertex * vertex(uint i) const
Definition topology.hh:103
InfiniteEdge * chld_
Definition topology.hh:177
Vertex * vertex(uint i=0) const
Definition topology.hh:168
InfiniteEdge(Vertex &vtx, const Attribute attrib=Attribute())
Edge * lnk_
Pointer to a sibling.
Definition topology.hh:172
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Vertex * vtx_
Array of the vertices.
Definition topology.hh:180
virtual Connector1 * child(uint i, bool mode=0)
InfiniteQuad(InfiniteEdge &edg0, Edge &edg1, InfiniteEdge &edg2, const Attribute attrib, const Key &key, const Z2 rho)
Constructor used by clone()
Vertex * vertex(uint i) const
Definition topology.hh:457
virtual ~InfiniteQuad()
Destructor.
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
InfiniteQuad(InfiniteEdge &edg0, Edge &edg1, InfiniteEdge &edg2, const Attribute attrib=Attribute())
const InfQuadSubdivision * subdivStrategy_
Subdivision strategy for the quadrilateral.
Definition topology.hh:519
Connector1 * edge(uint i) const
virtual Connector2 * child(uint i, bool mode=0)
void edgeAssertion_() const
Assert, that the vertices of the four edges match properly.
void setStrategy(const InfQuadSubdivision *strategy=0)
InfiniteEdge * infEdg_[2]
Finite edge.
Definition topology.hh:513
Edge * edg_
Finite edge.
Definition topology.hh:510
Z2 rho_
Orientation flags for the finite edge.
Definition topology.hh:516
Scan< Connector2 > * children_() const
Scanner over the children.
Definition topology.hh:522
const InfQuadSubdivision * getStrategy() const
Definition topology.hh:498
InfiniteQuad * clone(InfiniteEdge &edg0, Edge &edg1, InfiniteEdge &edg2) const
Definition topology.hh:530
concepts::Joiner< Connector2 *, 1 > * chld_
List of Pointers to the children.
Definition topology.hh:507
Quad(Edge &edg0, Edge &edg1, Edge &edg2, Edge &edg3, const Attribute attrib, const Key &key, const Z2 rho[])
Constructor used by clone()
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
const QuadSubdivision * getStrategy() const
Definition topology.hh:361
Quad * clone(Edge &edg0, Edge &edg1, Edge &edg2, Edge &edg3) const
Definition topology.hh:396
Edge * edge(uint i) const
Definition topology.hh:316
virtual ~Quad()
Destructor.
const QuadSubdivision * subdivStrategy_
Subdivision strategy for the quadrilateral.
Definition topology.hh:385
Vertex * vertex(uint i) const
Definition topology.hh:317
static std::map< Key, Z2 > rhoTriv_
orientation of trivial edges (with idential vertices)
Definition topology.hh:382
Scan< Quad > * children_() const
Scanner over the children.
Definition topology.hh:388
Quad(Edge &edg0, Edge &edg1, Edge &edg2, Edge &edg3, const Attribute attrib=Attribute())
bool regular_
Regular Cell, deleting of children possible.
Definition topology.hh:373
void edgeAssertion_() const
Assert, that the vertices of the four edges match properly.
Z2 rho(int i) const
Definition topology.hh:334
virtual Quad * child(uint i, bool mode=0)
void setStrategy(const QuadSubdivision *strategy=0)
Edge * edg_[4]
Array of the edges.
Definition topology.hh:376
Z2 rho_[4]
Array of the orientation flags for the edges.
Definition topology.hh:379
Quad(const Quad &quad, uint i)
concepts::Joiner< Quad *, 1 > * chld_
List of Pointers to the children.
Definition topology.hh:370
virtual Triangle * child(uint i, bool mode=0)
Z2 rho(int i) const
Definition topology.hh:230
Triangle * clone(Edge &edg0, Edge &edg1, Edge &edg2) const
Definition topology.hh:258
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Edge * edge(uint i) const
Definition topology.hh:224
Vertex * vertex(uint i) const
Definition topology.hh:225
Triangle(Edge &edg0, Edge &edg1, Edge &edg2, const Attribute attrib=Attribute())
Vertex(const Attribute attrib=Attribute())
Default constructor.
Definition topology.hh:43
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Vertex * clone() const
Definition topology.hh:63
virtual Vertex * child(uint i, bool mode=0)
Definition topology.hh:49
#define DEBUGL(doit, msg)
Definition debug.hh:40
Set< F > makeSet(uint n, const F &first,...)
Definition set.hh:320
int match(const Connector1 &edg0, const Connector1 &edg1, int idx[])