cube.hh

Go to the documentation of this file.
1 
6 #ifndef cube_hh
7 #define cube_hh
8 
9 #include "basics/typedefs.hh"
10 #include "geometry/mesh.hh"
11 
12 using concepts::Real;
13 
14 // ******************************************************************** Cube **
15 
19 class Cube : public concepts::Mesh3 {
20 public:
21  static const uint ncell_ = 1;
22  Cube(const Real sizex = 1.0, const Real sizey = 1.0, const Real sizez = 1.0);
23  virtual ~Cube();
24 
25  inline uint ncell() const { return ncell_; }
26  inline concepts::Scan3* scan() { return new S(cell_); }
27 
28  virtual std::ostream& info(std::ostream& os) const;
29 private:
30  class S : public concepts::Scan<concepts::Cell3> {
31  uint idx_;
33  public:
34  inline S(concepts::Hexahedron3d *(&cell)[ncell_]) : idx_(0), cell_(cell) {}
35  inline S(const S &scan) : idx_(scan.idx_), cell_(scan.cell_) {}
36 
37  inline bool eos() const { return idx_ == ncell_; }
38  inline concepts::Cell3& operator++(int) { return *cell_[idx_++]; }
39 
40  inline concepts::Scan3* clone() const { return new S(*this); }
41  };
42 
47 
49 };
50 
51 // ******************************************************************* Cube2 **
52 
56 class Cube2 : public concepts::Mesh3 {
57 public:
58  Cube2(const uint variant = 0);
59  virtual ~Cube2();
60 
61  inline uint ncell() const { return 2; }
62  inline concepts::Scan3* scan() { return new S(cell_); }
63 
64  virtual std::ostream& info(std::ostream& os) const;
65 private:
66  class S : public concepts::Scan<concepts::Cell3> {
67  uint idx_;
69  public:
70  inline S(concepts::Hexahedron3d *(&cell)[2]) : idx_(0), cell_(cell) {}
71  inline S(const S &scan) : idx_(scan.idx_), cell_(scan.cell_) {}
72 
73  inline bool eos() const { return idx_ == 2; }
74  inline concepts::Cell3& operator++(int) { return *cell_[idx_++]; }
75 
76  inline concepts::Scan3* clone() const { return new S(*this); }
77  };
78 
83 
85 };
86 
87 // ******************************************************************* Cube3 **
88 
92 class Cube3 : public concepts::Mesh3 {
93 public:
94  Cube3();
95  virtual ~Cube3();
96 
97  inline uint ncell() const { return 2; }
98  inline concepts::Scan3* scan() { return new S(cell_); }
99 
100  virtual std::ostream& info(std::ostream& os) const;
101 private:
102  class S : public concepts::Scan<concepts::Cell3> {
103  uint idx_;
105  public:
106  inline S(concepts::Hexahedron3d *(&cell)[2]) : idx_(0), cell_(cell) {}
107  inline S(const S &scan) : idx_(scan.idx_), cell_(scan.cell_) {}
108 
109  inline bool eos() const { return idx_ == 2; }
110  inline concepts::Cell3& operator++(int) { return *cell_[idx_++]; }
111 
112  inline concepts::Scan3* clone() const { return new S(*this); }
113  };
114 
119 
121 };
122 
123 #endif // cube_hh
in one hexahedron.
Definition: cube.hh:19
S(const S &scan)
Definition: cube.hh:107
concepts::Quad * quad_[11]
Definition: cube.hh:117
bool eos() const
Definition: cube.hh:109
S(const S &scan)
Definition: cube.hh:35
concepts::Scan3 * clone() const
Definition: cube.hh:40
S(concepts::Hexahedron3d *(&cell)[2])
Definition: cube.hh:70
S(const S &scan)
Definition: cube.hh:71
A scanner for a 3D mesh.
Definition: mesh.hh:52
A quadrilateral in the topology.
Definition: topology.hh:272
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
An abstract class for 3D meshes.
Definition: mesh.hh:112
concepts::Scan3 * clone() const
Definition: cube.hh:76
A 3D cell: hexahedron.
Definition: cell3D.hh:317
Three dimensional cell.
Definition: cell.hh:112
concepts::Scan3 * scan()
Returns a scanner over the cells of the mesh.
Definition: cube.hh:98
concepts::Hexahedron3d * cell_[2]
Definition: cube.hh:84
S(concepts::Hexahedron3d *(&cell)[2])
Definition: cube.hh:106
virtual ~Cube3()
concepts::Hexahedron3d * cell_[ncell_]
Definition: cube.hh:48
concepts::Scan3 * clone() const
Definition: cube.hh:112
[0,1]3 in two hexahedra.
Definition: cube.hh:56
concepts::Edge * edg_[20]
Definition: cube.hh:116
concepts::Edge * edg_[20]
Definition: cube.hh:80
concepts::Vertex * vtx_[12]
Definition: cube.hh:79
concepts::Scan3 * scan()
Returns a scanner over the cells of the mesh.
Definition: cube.hh:62
Definition: cube.hh:30
S(concepts::Hexahedron3d *(&cell)[ncell_])
Definition: cube.hh:34
concepts::Hexahedron3d *(& cell_)[2]
Definition: cube.hh:104
concepts::Cell3 & operator++(int)
Returns the next element in the scanned set.
Definition: cube.hh:110
A hexahedron in the topology.
Definition: topology3D.hh:134
static const uint ncell_
Definition: cube.hh:21
A vertex in the topology.
Definition: topology.hh:40
concepts::Quad * quad_[11]
Definition: cube.hh:81
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
concepts::Hexahedron * hex_[2]
Definition: cube.hh:82
concepts::Cell3 & operator++(int)
Returns the next element in the scanned set.
Definition: cube.hh:38
uint ncell() const
Returns the number of cells in the mesh.
Definition: cube.hh:25
An abstract class for scanning a mesh (a set of cells) or a space (a set of elements).
uint idx_
Definition: cube.hh:103
concepts::Scan3 * scan()
Returns a scanner over the cells of the mesh.
Definition: cube.hh:26
concepts::Cell3 & operator++(int)
Returns the next element in the scanned set.
Definition: cube.hh:74
virtual ~Cube2()
uint ncell() const
Returns the number of cells in the mesh.
Definition: cube.hh:61
concepts::Hexahedron * hex_[ncell_]
Definition: cube.hh:46
in two hexahedra.
Definition: cube.hh:92
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
concepts::Hexahedron * hex_[2]
Definition: cube.hh:118
concepts::Hexahedron3d *(& cell_)[ncell_]
Definition: cube.hh:32
uint ncell() const
Returns the number of cells in the mesh.
Definition: cube.hh:97
Cube(const Real sizex=1.0, const Real sizey=1.0, const Real sizez=1.0)
concepts::Vertex * vtx_[12]
Definition: cube.hh:115
concepts::Hexahedron3d * cell_[2]
Definition: cube.hh:120
Definition: cube.hh:66
uint idx_
Definition: cube.hh:31
uint idx_
Definition: cube.hh:67
Cube2(const uint variant=0)
concepts::Vertex * vtx_[8]
Definition: cube.hh:43
An edge in the topology.
Definition: topology.hh:73
virtual ~Cube()
bool eos() const
Definition: cube.hh:37
concepts::Quad * quad_[6]
Definition: cube.hh:45
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
concepts::Edge * edg_[12]
Definition: cube.hh:44
bool eos() const
Definition: cube.hh:73
concepts::Hexahedron3d *(& cell_)[2]
Definition: cube.hh:68
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich