00001 /* square made out of one or two hexahedron 00002 */ 00003 00004 #ifndef threequads_hh 00005 #define threequads_hh 00006 00007 #include "basics/typedefs.hh" 00008 #include "geometry/mesh.hh" 00009 #include "geometry/topology.hh" 00010 #include "geometry/cell2D.hh" 00011 00012 namespace concepts { 00013 00014 // ***************************************************************** Square3 ** 00015 00022 class ThreeQuads : public Mesh2 { 00023 static const uint ncell_ = 3; 00024 public: 00025 ThreeQuads(); 00028 ThreeQuads(Array<uint> attrib); 00029 virtual ~ThreeQuads(); 00030 00031 inline uint ncell() const { return ncell_; } 00032 inline Scan2* scan() { return new S(cell_); } 00033 00034 virtual std::ostream& info(std::ostream& os) const; 00035 private: 00036 class S : public Scan<Cell2> { 00037 uint idx_; 00038 Quad2d *(&cell_)[ncell_]; 00039 public: 00040 inline S(Quad2d *(&cell)[ncell_]) : idx_(0), cell_(cell) {} 00041 inline S(const S &scan) : idx_(scan.idx_), cell_(scan.cell_) {} 00042 00043 inline bool eos() const { return idx_ == ncell_; } 00044 inline Cell2& operator++(int) { return *cell_[idx_++]; } 00045 00046 inline Scan2* clone() const { return new S(*this); } 00047 }; 00048 00049 void construct_(const Array<uint>& attrib); 00050 00051 00052 Vertex* vtx_[7]; 00053 Edge* edg_[9]; 00054 Quad* quad_[ncell_]; 00055 00056 Quad2d* cell_[ncell_]; 00057 }; 00058 00059 } // namespace concepts 00060 00061 #endif // square_hh