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

geometry/edgeMeshes.hh
Go to the documentation of this file.
00001 
00006 #ifndef edgeMeshes_hh
00007 #define edgeMeshes_hh
00008 
00009 #include "toolbox/array.hh"
00010 #include "toolbox/sequence.hh"
00011 #include "cell1D.hh"
00012 #include "elementMaps.hh"
00013 #include "mesh.hh"
00014 #include "topology.hh"
00015 
00016 namespace concepts {
00017 
00018   // ************************************************************** EdgeMesh **
00019 
00027   class EdgeMesh : public Mesh1 {
00028   public:
00036     EdgeMesh(const uint n, bool closed,
00037              const Sequence<MappingEdge2d*>& maps,
00038              Attribute attrib = Attribute());
00039 
00045     EdgeMesh(const MappingEdge2d* map, Attribute attrib = Attribute());
00046 
00047     virtual ~EdgeMesh();
00048 
00049     inline uint   ncell() const { return ncell_; }
00050     inline Scan1* scan()        { return new S(&cell_); }
00051 
00052     inline const Sequence<Edge2d*>& cells() const { return cell_; }
00053   protected:
00054     virtual std::ostream& info(std::ostream& os) const;
00055     
00056     const uint n_;
00057     uint ncell_;
00058 
00060     Array<MappingEdge2d*> edges_;
00061 
00063     Sequence<Edge2d*> cell_;
00064   private:
00065     Array<Vertex*> vtx_;
00066     Array<Edge*>   edg_;
00067 
00069     class S : public Scan<Cell1> {
00070       uint idx_;
00071       Sequence<Edge2d*>* cell_;
00072     public:
00073       inline S(Sequence<Edge2d*>* cell) : idx_(0), cell_(cell) {}
00074       inline S(const S &scan) : idx_(scan.idx_), cell_(scan.cell_) {}
00075 
00076       inline bool eos() const { return idx_ == cell_->size(); }
00077       inline Cell1& operator++(int) { return *(*cell_)[idx_++]; }
00078 
00079       inline Scan1* clone() const { return new S(*this); }
00080     };
00081 
00082   };
00083 
00084   // ********************************************************* CircleBoundary **
00085 
00086   class CircleBoundary : public Mesh1, public InnerOuterBoundary2d {
00087   public:
00088     CircleBoundary(const Real2d center, const uint n, const Real r, 
00089                    const uint attrib = 0, const Real phi0 = 0);
00090     virtual ~CircleBoundary();
00091 
00092     inline uint ncell() const { return ncell_; }
00093     inline Scan1* scan() { return new S(&this->outerBoundary_); }
00094 
00095     const Sequence<Edge2d*>& cells() const { return this->outerBoundary_; }
00096 
00097     virtual std::ostream& info(std::ostream& os) const;
00098   private:
00100     class S : public Scan<Cell1> {
00101       uint idx_;
00102       Sequence<Edge2d*>* cell_;
00103     public:
00104       inline S(Sequence<Edge2d*>* cell) : idx_(0), 
00105                                           cell_(cell) {}
00106       inline S(const S &scan) : idx_(scan.idx_),
00107                                 cell_(scan.cell_) {}
00108       
00109       inline bool eos() const { return idx_ == cell_->size(); }
00110       inline Cell1& operator++(int) { return *(*cell_)[idx_++]; }
00111 
00112       inline Scan1* clone() const { return new S(*this); }
00113     };
00114 
00115     uint ncell_;
00116 
00117     Array<Vertex*> vtx_;
00118     Array<Edge*> edg_;
00119   };
00120 
00121 } // namespace concepts
00122 
00123 #endif // edgeMeshes_hh
00124 

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