hexsubdiv.hh

Go to the documentation of this file.
1 
7 #ifndef hexsubdiv_hh
8 #define hexsubdiv_hh
9 
10 #include <iostream>
11 #include "strategyChange.hh"
12 #include "subdivision.hh"
13 
14 namespace concepts {
15 
16  // forward declaration
17  class Hexahedron;
18  class Z2;
19  class Z4;
20  class Quad;
21  class Vertex;
22 
23  // ******************************************************** HexSubdivision **
24 
40  class HexSubdivision : public Subdivision {
41  public:
44  virtual void createChildren(Hexahedron& q) const = 0;
48  virtual void removeChildren(Hexahedron& q) const = 0;
49  protected:
51 
67  void subFace0011(Quad& q, Z2 rho, Z4 tau, Quad*& A, Quad*& B) const;
68  void subFace1100(Quad& q, Z2 rho, Z4 tau, Quad*& A, Quad*& B) const;
69  void subFace0110(Quad& q, Z2 rho, Z4 tau, Quad*& A, Quad*& B) const;
70  void subFace1001(Quad& q, Z2 rho, Z4 tau, Quad*& A, Quad*& B) const;
72 
73 
89  void subFace0123(Quad& q, Z2 rho, Z4 tau, Quad*& A, Quad*& B,
90  Quad*& C, Quad*& D) const;
91  void subFace1230(Quad& q, Z2 rho, Z4 tau, Quad*& A, Quad*& B,
92  Quad*& C, Quad*& D) const;
93  void subFace2301(Quad& q, Z2 rho, Z4 tau, Quad*& A, Quad*& B,
94  Quad*& C, Quad*& D) const;
96 
110  bool faceSubdiv4(Quad& q) const throw(StrategyChange);
111 
127  Quad* findFace(const Vertex* const v, Quad* const q[4],
128  const unsigned int tau, const unsigned int rho, const unsigned int vtxIdx) const;
130 
142  void subdivFace0(Hexahedron& h, Quad*& A, Quad*& B,
143  Quad*& C, Quad*& D, bool normal) const;
144  void subdivFace1(Hexahedron& h, Quad*& A, Quad*& B,
145  Quad*& C, Quad*& D, bool normal) const;
146  void subdivFace2(Hexahedron& h, Quad*& A, Quad*& B,
147  Quad*& C, Quad*& D, bool normal) const;
148  void subdivFace3(Hexahedron& h, Quad*& A, Quad*& B,
149  Quad*& C, Quad*& D, bool normal) const;
150  void subdivFace4(Hexahedron& h, Quad*& A, Quad*& B,
151  Quad*& C, Quad*& D, bool normal) const;
152  void subdivFace5(Hexahedron& h, Quad*& A, Quad*& B,
153  Quad*& C, Quad*& D, bool normal) const;
155  };
156 
157  // ************************************************************ HexSubdiv8 **
158 
167  class HexSubdiv8 : public HexSubdivision {
168  public:
169  virtual void createChildren(Hexahedron& q) const;
170  virtual void removeChildren(Hexahedron& q) const;
171  static const HexSubdiv8* instance();
172  virtual ~HexSubdiv8();
173  protected:
174  virtual std::ostream& info(std::ostream& os) const;
175  private:
176  static std::unique_ptr<HexSubdiv8> instance_;
177  };
178 
179  // *********************************************************** HexSubdiv2x **
180 
189  class HexSubdiv2x : public HexSubdivision {
190  public:
191  virtual void createChildren(Hexahedron& q) const;
192  virtual void removeChildren(Hexahedron& q) const;
193  static const HexSubdiv2x* instance();
194  virtual ~HexSubdiv2x();
195  protected:
196  virtual std::ostream& info(std::ostream& os) const;
197  private:
198  static std::unique_ptr<HexSubdiv2x> instance_;
199  };
200 
201  // *********************************************************** HexSubdiv2y **
202 
211  class HexSubdiv2y : public HexSubdivision {
212  public:
213  virtual void createChildren(Hexahedron& q) const;
214  virtual void removeChildren(Hexahedron& q) const;
215  static const HexSubdiv2y* instance();
216  virtual ~HexSubdiv2y();
217  protected:
218  virtual std::ostream& info(std::ostream& os) const;
219  private:
220  static std::unique_ptr<HexSubdiv2y> instance_;
221  };
222 
223  // *********************************************************** HexSubdiv2z **
224 
233  class HexSubdiv2z : public HexSubdivision {
234  public:
235  virtual void createChildren(Hexahedron& q) const;
236  virtual void removeChildren(Hexahedron& q) const;
237  static const HexSubdiv2z* instance();
238  virtual ~HexSubdiv2z();
239  protected:
240  virtual std::ostream& info(std::ostream& os) const;
241  private:
242  static std::unique_ptr<HexSubdiv2z> instance_;
243  };
244 
245  // *********************************************************** HexSubdiv4x **
246 
255  class HexSubdiv4x : public HexSubdivision {
256  public:
257  virtual void createChildren(Hexahedron& q) const;
258  virtual void removeChildren(Hexahedron& q) const;
259  static const HexSubdiv4x* instance();
260  virtual ~HexSubdiv4x();
261  protected:
262  virtual std::ostream& info(std::ostream& os) const;
263  private:
264  static std::unique_ptr<HexSubdiv4x> instance_;
265  };
266 
267  // *********************************************************** HexSubdiv4y **
268 
277  class HexSubdiv4y : public HexSubdivision {
278  public:
279  virtual void createChildren(Hexahedron& q) const;
280  virtual void removeChildren(Hexahedron& q) const;
281  static const HexSubdiv4y* instance();
282  virtual ~HexSubdiv4y();
283  protected:
284  virtual std::ostream& info(std::ostream& os) const;
285  private:
286  static std::unique_ptr<HexSubdiv4y> instance_;
287  };
288 
289  // *********************************************************** HexSubdiv4z **
290 
299  class HexSubdiv4z : public HexSubdivision {
300  public:
301  virtual void createChildren(Hexahedron& q) const;
302  virtual void removeChildren(Hexahedron& q) const;
303  static const HexSubdiv4z* instance();
304  virtual ~HexSubdiv4z();
305  protected:
306  virtual std::ostream& info(std::ostream& os) const;
307  private:
308  static std::unique_ptr<HexSubdiv4z> instance_;
309  };
310 
311 } // namespace concepts
312 
313 #endif // hexsubdiv_hh
void subdivFace0(Hexahedron &h, Quad *&A, Quad *&B, Quad *&C, Quad *&D, bool normal) const
Subdivides a face of a hexehedron h into 4 children.
virtual void removeChildren(Hexahedron &q) const
If there are children, they are removed.
virtual void removeChildren(Hexahedron &q) const =0
If there are children, they are removed.
bool faceSubdiv4(Quad &q) const
Takes a face and tries to subdivide it into 4 (by setting the strategy to QuadSubdiv4).
static const HexSubdiv4x * instance()
Subdivision strategy for hexahedrons which generates 2 children perpendicular the y direction.
Definition: hexsubdiv.hh:211
virtual void createChildren(Hexahedron &q) const
If no children of q exist, they are created.
virtual void createChildren(Hexahedron &q) const
If no children of q exist, they are created.
Interface for topological subdivision strategies for hexahedrons.
Definition: hexsubdiv.hh:40
virtual void createChildren(Hexahedron &q) const =0
If no children of q exist, they are created.
static const HexSubdiv4y * instance()
virtual void createChildren(Hexahedron &q) const
If no children of q exist, they are created.
virtual void removeChildren(Hexahedron &q) const
If there are children, they are removed.
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Common base class for QuadSubdivision and HexSubdivision.
Definition: subdivision.hh:20
static const HexSubdiv2x * instance()
static std::unique_ptr< HexSubdiv8 > instance_
Definition: hexsubdiv.hh:176
A quadrilateral in the topology.
Definition: topology.hh:272
static const HexSubdiv8 * instance()
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
void subFace0123(Quad &q, Z2 rho, Z4 tau, Quad *&A, Quad *&B, Quad *&C, Quad *&D) const
Gets the four children of q and sorts them.
virtual void removeChildren(Hexahedron &q) const
If there are children, they are removed.
Subdivision strategy for hexahedrons which generates 4 children along the x direction.
Definition: hexsubdiv.hh:255
Exception indicating that changing the subdivision strategy is not allowed (but was tried anyway).
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
virtual void removeChildren(Hexahedron &q) const
If there are children, they are removed.
virtual void createChildren(Hexahedron &q) const
If no children of q exist, they are created.
void subdivFace4(Hexahedron &h, Quad *&A, Quad *&B, Quad *&C, Quad *&D, bool normal) const
Subdivision strategy for hexahedrons which generates 2 children perpendicular to the x direction.
Definition: hexsubdiv.hh:189
void subdivFace2(Hexahedron &h, Quad *&A, Quad *&B, Quad *&C, Quad *&D, bool normal) const
static std::unique_ptr< HexSubdiv2y > instance_
Definition: hexsubdiv.hh:220
void subFace1230(Quad &q, Z2 rho, Z4 tau, Quad *&A, Quad *&B, Quad *&C, Quad *&D) const
static const HexSubdiv2z * instance()
Quad * findFace(const Vertex *const v, Quad *const q[4], const unsigned int tau, const unsigned int rho, const unsigned int vtxIdx) const
Looks for the quad in q which contains the vertex v.
A hexahedron in the topology.
Definition: topology3D.hh:134
Subdivision strategy for hexahedrons which generates 8 children.
Definition: hexsubdiv.hh:167
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
void subdivFace3(Hexahedron &h, Quad *&A, Quad *&B, Quad *&C, Quad *&D, bool normal) const
A vertex in the topology.
Definition: topology.hh:40
virtual void createChildren(Hexahedron &q) const
If no children of q exist, they are created.
static const HexSubdiv2y * instance()
static std::unique_ptr< HexSubdiv4x > instance_
Definition: hexsubdiv.hh:264
static std::unique_ptr< HexSubdiv2z > instance_
Definition: hexsubdiv.hh:242
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
static std::unique_ptr< HexSubdiv4y > instance_
Definition: hexsubdiv.hh:286
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
void subFace2301(Quad &q, Z2 rho, Z4 tau, Quad *&A, Quad *&B, Quad *&C, Quad *&D) const
static std::unique_ptr< HexSubdiv4z > instance_
Definition: hexsubdiv.hh:308
void subdivFace5(Hexahedron &h, Quad *&A, Quad *&B, Quad *&C, Quad *&D, bool normal) const
Subdivision strategy for hexahedrons which generates 4 children along the z direction.
Definition: hexsubdiv.hh:299
void subFace1001(Quad &q, Z2 rho, Z4 tau, Quad *&A, Quad *&B) const
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
static std::unique_ptr< HexSubdiv2x > instance_
Definition: hexsubdiv.hh:198
void subFace1100(Quad &q, Z2 rho, Z4 tau, Quad *&A, Quad *&B) const
void subdivFace1(Hexahedron &h, Quad *&A, Quad *&B, Quad *&C, Quad *&D, bool normal) const
virtual void createChildren(Hexahedron &q) const
If no children of q exist, they are created.
virtual void removeChildren(Hexahedron &q) const
If there are children, they are removed.
static const HexSubdiv4z * instance()
virtual void removeChildren(Hexahedron &q) const
If there are children, they are removed.
Subdivision strategy for hexahedrons which generates 2 children perpendicular to the z direction.
Definition: hexsubdiv.hh:233
void subFace0110(Quad &q, Z2 rho, Z4 tau, Quad *&A, Quad *&B) const
virtual void createChildren(Hexahedron &q) const
If no children of q exist, they are created.
Binary group (algebraic): only the values 0 and 1 are represented.
Definition: Zm.hh:16
Algebraic group with four elements: 0, 1, 2 and 3.
Definition: Zm.hh:68
Subdivision strategy for hexahedrons which generates 4 children along the y direction.
Definition: hexsubdiv.hh:277
virtual void removeChildren(Hexahedron &q) const
If there are children, they are removed.
Basic namespace for Concepts-2.
Definition: pml_formula.h:16
void subFace0011(Quad &q, Z2 rho, Z4 tau, Quad *&A, Quad *&B) const
Gets the two children of q and sorts them.
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich