Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)

app-pfrauenf/cube.hh
Go to the documentation of this file.
00001 /* cube made out of one or two hexahedron
00002  */
00003 
00004 #ifndef cube_hh
00005 #define cube_hh
00006 
00007 #include "basics/typedefs.hh"
00008 #include "geometry.hh"
00009 #include "hp3D.hh"
00010 
00011 using concepts::Real;
00012 
00013 // ******************************************************************** Cube **
00014 
00018 class Cube : public concepts::Mesh3 {
00019 public:
00020   static const uint ncell_ = 1;
00021   Cube(const Real sizex = 1.0, const Real sizey = 1.0, const Real sizez = 1.0);
00022   virtual ~Cube();
00023 
00024   inline uint ncell() const { return ncell_; }
00025   inline concepts::Scan3* scan() { return new S(cell_); }
00026 
00027   virtual std::ostream& info(std::ostream& os) const;
00028 private:
00029   class S : public concepts::Scan<concepts::Cell3> {
00030     uint idx_;
00031     concepts::Hexahedron3d *(&cell_)[ncell_];
00032   public:
00033     inline S(concepts::Hexahedron3d *(&cell)[ncell_]) : idx_(0), cell_(cell) {}
00034     inline S(const S &scan) : idx_(scan.idx_), cell_(scan.cell_) {}
00035 
00036     inline bool eos() const { return idx_ == ncell_; }
00037     inline concepts::Cell3& operator++(int) { return *cell_[idx_++]; }
00038 
00039     inline concepts::Scan3* clone() const { return new S(*this); }
00040   };
00041 
00042   concepts::Vertex* vtx_[8];
00043   concepts::Edge* edg_[12];
00044   concepts::Quad* quad_[6];
00045   concepts::Hexahedron* hex_[ncell_];
00046 
00047   concepts::Hexahedron3d* cell_[ncell_];
00048 };
00049 
00050 // ******************************************************************* Cube2 **
00051 
00055 class Cube2 : public concepts::Mesh3 {
00056 public:
00057   Cube2(const uint variant = 0);
00058   virtual ~Cube2();
00059 
00060   inline uint ncell() const { return 2; }
00061   inline concepts::Scan3* scan() { return new S(cell_); }
00062 
00063   virtual std::ostream& info(std::ostream& os) const;
00064 private:
00065   class S : public concepts::Scan<concepts::Cell3> {
00066     uint idx_;
00067     concepts::Hexahedron3d *(&cell_)[2];
00068   public:
00069     inline S(concepts::Hexahedron3d *(&cell)[2]) : idx_(0), cell_(cell) {}
00070     inline S(const S &scan) : idx_(scan.idx_), cell_(scan.cell_) {}
00071 
00072     inline bool eos() const { return idx_ == 2; }
00073     inline concepts::Cell3& operator++(int) { return *cell_[idx_++]; }
00074 
00075     inline concepts::Scan3* clone() const { return new S(*this); }
00076   };
00077 
00078   concepts::Vertex* vtx_[12];
00079   concepts::Edge* edg_[20];
00080   concepts::Quad* quad_[11];
00081   concepts::Hexahedron* hex_[2];
00082 
00083   concepts::Hexahedron3d* cell_[2];
00084 };
00085 
00086 // ******************************************************************* Cube3 **
00087 
00091 class Cube3 : public concepts::Mesh3 {
00092 public:
00093   Cube3();
00094   virtual ~Cube3();
00095 
00096   inline uint ncell() const { return 2; }
00097   inline concepts::Scan3* scan() { return new S(cell_); }
00098 
00099   virtual std::ostream& info(std::ostream& os) const;
00100 private:
00101   class S : public concepts::Scan<concepts::Cell3> {
00102     uint idx_;
00103     concepts::Hexahedron3d *(&cell_)[2];
00104   public:
00105     inline S(concepts::Hexahedron3d *(&cell)[2]) : idx_(0), cell_(cell) {}
00106     inline S(const S &scan) : idx_(scan.idx_), cell_(scan.cell_) {}
00107 
00108     inline bool eos() const { return idx_ == 2; }
00109     inline concepts::Cell3& operator++(int) { return *cell_[idx_++]; }
00110 
00111     inline concepts::Scan3* clone() const { return new S(*this); }
00112   };
00113 
00114   concepts::Vertex* vtx_[12];
00115   concepts::Edge* edg_[20];
00116   concepts::Quad* quad_[11];
00117   concepts::Hexahedron* hex_[2];
00118 
00119   concepts::Hexahedron3d* cell_[2];
00120 };
00121 
00122 #endif // cube_hh

Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)