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 "integration.hh" 00010 #include "operator.hh" 00011 #include "space.hh" 00012 #include "toolbox.hh" 00013 #include "linearFEM.hh" 00014 #include "new" 00015 00016 00017 namespace concepts { 00018 namespace gfem { 00019 00020 class PeriodicRect : public concepts::Mesh2 { 00021 public: 00022 PeriodicRect(float L) { 00023 new(this) PeriodicRect(L, L); 00024 } 00025 PeriodicRect(float L1, float L2); 00026 virtual ~PeriodicRect(); 00027 unsigned int ncell() const { return N_CELL; } 00028 concepts::Scan2* scan() { return new S(cell); } 00029 virtual std::ostream& info(std::ostream& os) const; 00030 00031 Quad2d** getQuads() { return cell; } 00032 00033 private: 00034 static const uint N_VERT = 1; 00035 static const uint N_EDGE = 2; 00036 static const uint N_CELL = 1; 00037 00038 concepts::Vertex* vtx[N_VERT]; 00039 concepts::Edge * edg[N_EDGE]; 00040 concepts::Quad* quad[N_CELL]; 00041 concepts::Quad2d* cell[N_CELL]; 00042 00043 class S : public concepts::Scan<concepts::Cell2> { 00044 unsigned int idx_; 00045 concepts::Quad2d* (&cell_)[N_CELL]; 00046 public: 00047 S(concepts::Quad2d* (&cell)[N_CELL]) : idx_(0), cell_(cell) {} 00048 S(const S& scan) : idx_(scan.idx_), cell_(scan.cell_) {} 00049 bool eos() const { return idx_ == N_CELL; } 00050 concepts::Cell2& operator++(int) { return *cell_[idx_++]; } 00051 concepts::Scan2* clone() const { return new S(*this); } 00052 }; 00053 }; 00054 00055 } 00056 }