00001 //periodicRect.hh 00002 00003 #pragma once 00004 00005 #include "basics.hh" 00006 #include "function.hh" 00007 #include "geometry.hh" 00008 #include "graphics.hh" 00009 #include "operator.hh" 00010 #include "space.hh" 00011 00012 00013 class PeriodicRect : public concepts::Mesh2 { 00014 public: 00015 PeriodicRect(float L) { 00016 new(this) PeriodicRect(L, L); 00017 } 00018 PeriodicRect(float L1, float L2); 00019 virtual ~PeriodicRect(); 00020 unsigned int ncell() const { return N_CELL; } 00021 concepts::Scan2* scan() { return new S(cell); } 00022 virtual std::ostream& info(std::ostream& os) const; 00023 00024 private: 00025 static const uint N_VERT = 1; 00026 static const uint N_EDGE = 2; 00027 static const uint N_CELL = 1; 00028 00029 concepts::Vertex *vtx[N_VERT]; 00030 concepts::Edge *edg[N_EDGE]; 00031 concepts::Quad *quad[N_CELL]; 00032 concepts::Cell2 *cell[N_CELL]; 00033 00034 class S : public concepts::Scan<concepts::Cell2> { 00035 unsigned int idx_; 00036 concepts::Cell2 *(&cell_)[N_CELL]; 00037 public: 00038 S(concepts::Cell2 *(&cell)[N_CELL]) : idx_(0), cell_(cell) {} 00039 S(const S& scan) : idx_(scan.idx_), cell_(scan.cell_) {} 00040 bool eos() const { return idx_ == N_CELL; } 00041 concepts::Cell2& operator++(int) { return *cell_[idx_++]; } 00042 concepts::Scan2* clone() const { return new S(*this); } 00043 }; 00044 }; 00045