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 
14 namespace 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_;
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];
80 
82  };
83 
84  // ***************************************************************** Square2 **
85 
110  class Square2 : public Mesh2 {
111  static const uint ncell_ = 2;
112  public:
118  Square2(Array<uint> attrib, Array<uint>* elmAttrib=0);
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_;
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 
143  Edge* edg_[7];
145 
147  };
148 
149 } // namespace concepts
150 
151 #endif // square_hh
S(const S &scan)
Definition: square.hh:66
A 2D cell: quadrilateral.
Definition: cell2D.hh:378
virtual ~Square2()
Quad * quad_[ncell_]
Definition: square.hh:79
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Cell2 & operator++(int)
Returns the next cell.
Definition: square.hh:134
bool eos() const
Definition: square.hh:133
static const uint ncell_
Definition: square.hh:23
Scan2 * clone() const
Definition: square.hh:71
A quadrilateral in the topology.
Definition: topology.hh:272
S(const S &scan)
Definition: square.hh:131
A scanner for a 2D mesh.
Definition: mesh.hh:44
Edge * edg_[4]
Definition: square.hh:78
Scan2 * clone() const
Definition: square.hh:136
S(Quad2d *(&cell)[ncell_])
Definition: square.hh:130
Square2(Array< uint > attrib, Array< uint > *elmAttrib=0)
Constructor with attributes of the (seven) edges added by Robert :
Vertex * vtx_[4]
Definition: square.hh:77
uint ncell() const
Returns the number of cells in the mesh.
Definition: square.hh:56
Quad2d * cell_[ncell_]
Definition: square.hh:146
uint ncell() const
Returns the number of cells in the mesh.
Definition: square.hh:121
Cell2 & operator++(int)
Returns the next cell.
Definition: square.hh:69
A vertex in the topology.
Definition: topology.hh:40
An abstract class for scanning a mesh (a set of cells) or a space (a set of elements).
An abstract class for 2D meshes.
Definition: mesh.hh:103
Two dimensional cell.
Definition: cell.hh:89
Mesh for with one quadrilateral.
Definition: square.hh:22
Quad * quad_[ncell_]
Definition: square.hh:144
Quad2d *(& cell_)[ncell_]
Definition: square.hh:128
Square(const Real sizex=1.0, const Real sizey=1.0, const uint attrib=0)
Constructor for rectangular cell.
Quad2d * cell_[ncell_]
Definition: square.hh:81
Vertex * vtx_[6]
Definition: square.hh:142
static const uint ncell_
Definition: square.hh:111
S(Quad2d *(&cell)[ncell_])
Definition: square.hh:65
void construct_(const Array< Real2d > &coord, const Array< uint > &attrib, const Array< uint > *vattrib=0)
virtual ~Square()
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)
Constructor for arbitrary quadrilateral.
Scan2 * scan()
Returns a scanner over the cells of the mesh.
Definition: square.hh:57
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Edge * edg_[7]
Definition: square.hh:143
Square(const Real sizex, const Real sizey, const Array< uint > &attrib, const Array< uint > *vattrib=0)
Constructor for rectangular cell.
An edge in the topology.
Definition: topology.hh:73
Quad2d *(& cell_)[ncell_]
Definition: square.hh:63
Mesh for with two quadrilaterals.
Definition: square.hh:110
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)
Constructor for arbitrary quadrilateral.
bool eos() const
Definition: square.hh:68
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
void construct_(const Array< uint > &attrib, const Array< uint > &elmAttrib)
Basic namespace for Concepts-2.
Definition: pml_formula.h:16
Scan2 * scan()
Returns a scanner over the cells of the mesh.
Definition: square.hh:122
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich