Class documentation of Concepts

Loading...
Searching...
No Matches
square.hh
Go to the documentation of this file.
1
6#ifndef square_hh
7#define square_hh
8
9#include "basics/typedefs.hh"
10#include "mesh.hh"
11#include "topology.hh"
12#include "cell2D.hh"
13
14namespace concepts {
15
16 // ****************************************************************** Square **
17
22 class Square : public Mesh2 {
23 static const uint ncell_ = 1;
24 public:
29 Square(const Real sizex = 1.0, const Real sizey = 1.0,
30 const uint attrib = 0);
35 Square(const Real x0, const Real y0, const Real x1, const Real y1,
36 const Real x2, const Real y2, const Real x3, const Real y3,
37 const uint attrib = 0);
43 Square(const Real sizex, const Real sizey,
44 const Array<uint>& attrib,
45 const Array<uint>* vattrib = 0);
50 Square(const Real x0, const Real y0, const Real x1, const Real y1,
51 const Real x2, const Real y2, const Real x3, const Real y3,
52 const Array<uint>& attrib,
53 const Array<uint>* vattrib = 0);
54 virtual ~Square();
55
56 inline uint ncell() const { return ncell_; }
57 inline Scan2* scan() { return new S(cell_); }
58
59 virtual std::ostream& info(std::ostream& os) const;
60 private:
61 class S : public Scan<Cell2> {
62 uint idx_;
63 Quad2d *(&cell_)[ncell_];
64 public:
65 inline S(Quad2d *(&cell)[ncell_]) : idx_(0), cell_(cell) {}
66 inline S(const S &scan) : idx_(scan.idx_), cell_(scan.cell_) {}
67
68 inline bool eos() const { return idx_ == ncell_; }
69 inline Cell2& operator++(int) { return *cell_[idx_++]; }
70
71 inline Scan2* clone() const { return new S(*this); }
72 };
73 void construct_(const Array<Real2d>& coord,
74 const Array<uint>& attrib,
75 const Array<uint>* vattrib = 0);
76
77 Vertex* vtx_[4];
78 Edge* edg_[4];
79 Quad* quad_[ncell_];
80
81 Quad2d* cell_[ncell_];
82 };
83
84 // ***************************************************************** Square2 **
85
110 class Square2 : public Mesh2 {
111 static const uint ncell_ = 2;
112 public:
113 Square2();
119 virtual ~Square2();
120
121 inline uint ncell() const { return ncell_; }
122 inline Scan2* scan() { return new S(cell_); }
123
124 virtual std::ostream& info(std::ostream& os) const;
125 private:
126 class S : public Scan<Cell2> {
127 uint idx_;
128 Quad2d *(&cell_)[ncell_];
129 public:
130 inline S(Quad2d *(&cell)[ncell_]) : idx_(0), cell_(cell) {}
131 inline S(const S &scan) : idx_(scan.idx_), cell_(scan.cell_) {}
132
133 inline bool eos() const { return idx_ == ncell_; }
134 inline Cell2& operator++(int) { return *cell_[idx_++]; }
135
136 inline Scan2* clone() const { return new S(*this); }
137 };
138
139 void construct_(const Array<uint>& attrib,const Array<uint>& elmAttrib);
140
141
142 Vertex* vtx_[6];
143 Edge* edg_[7];
144 Quad* quad_[ncell_];
145
146 Quad2d* cell_[ncell_];
147 };
148
149} // namespace concepts
150
151#endif // square_hh
A scanner for a 2D mesh.
Definition mesh.hh:44
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
uint ncell() const
Returns the number of cells in the mesh.
Definition square.hh:121
Scan2 * scan()
Definition square.hh:122
Square2(Array< uint > attrib, Array< uint > *elmAttrib=0)
Square(const Real x0, const Real y0, const Real x1, const Real y1, const Real x2, const Real y2, const Real x3, const Real y3, const Array< uint > &attrib, const Array< uint > *vattrib=0)
Square(const Real sizex, const Real sizey, const Array< uint > &attrib, const Array< uint > *vattrib=0)
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Scan2 * scan()
Definition square.hh:57
Square(const Real sizex=1.0, const Real sizey=1.0, const uint attrib=0)
Square(const Real x0, const Real y0, const Real x1, const Real y1, const Real x2, const Real y2, const Real x3, const Real y3, const uint attrib=0)
uint ncell() const
Returns the number of cells in the mesh.
Definition square.hh:56
Scan< Cell2 > Scan2
A scanner for a 2D mesh.
Definition mesh.hh:62
double Real
Definition typedefs.hh:39
Set< F > makeSet(uint n, const F &first,...)
Definition set.hh:320