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

geometry/mutableMesh.hh
Go to the documentation of this file.
00001 
00007 #ifndef mutableMesh_hh
00008 #define mutableMesh_hh
00009 
00010 #include "toolbox/multiArray.hh"
00011 #include "toolbox/sequence.hh"
00012 #include "toolbox/set.hh"
00013 #include "mesh.hh"
00014 
00015 namespace concepts {
00016 
00017   // ******************************************************* MutableMeshBase **
00018 
00022   class MutableMeshBase {
00023   public:
00024     MutableMeshBase();
00025     virtual ~MutableMeshBase();
00026 
00027     virtual void addCell(Cell* cell, bool holding = true) = 0;
00028 
00034     Edge* ownEdge(Vertex* vtx1, Vertex* vtx2);
00035 
00036     const Sequence<Connector0*>& ownConnectors0() const {
00037       return ownConnectors0_; }
00038     const Sequence<Connector1*>& ownConnectors1() const {
00039       return ownConnectors1_; }
00040     const Sequence<Connector2*>& ownConnectors2() const {
00041       return ownConnectors2_; }
00042     const Sequence<Connector3*>& ownConnectors3() const {
00043       return ownConnectors3_; }
00044   protected:
00046     Sequence<Cell*>       ownCells_;
00048     Sequence<Connector0*> ownConnectors0_;
00049     Sequence<Connector1*> ownConnectors1_;
00050     Sequence<Connector2*> ownConnectors2_;
00051     Sequence<Connector3*> ownConnectors3_;
00053     MultiArray<2, Edge*> mapEdges_;
00054 
00055     void addCell_(Cell* cell, bool holding = true);
00056 
00061     void replaceCell_(Cell* cell, bool holding = true);
00062   };
00063 
00064   // ********************************************************** MutableMesh1 **
00065 
00074   class MutableMesh1 : public Mesh1, public MutableMeshBase {
00075   public:
00076     MutableMesh1() : ncell_(0) {}
00077     virtual ~MutableMesh1();
00078     inline uint ncell() const { return ncell_; }
00079     inline Scan1* scan() { return new PStlVectorScan<Cell1>(cells_); }
00080 
00084     virtual void addCell(Cell* cell, bool holding = true);
00085     
00090     void replaceCell(Cell1* cell, bool holding = true);
00091     
00092     inline const Sequence<Cell1*>& cells() const { return cells_; }
00093     
00094   protected:
00095     virtual std::ostream& info(std::ostream& os) const;
00096     
00097   private:
00099     uint ncell_;
00101     Sequence<Cell1*> cells_;
00102   };
00103 
00104   // ********************************************************* buildEdgeMesh **
00105   
00132   void buildEdgeMesh(Scan2* sc, const concepts::Set<uint> attrib,
00133                      MutableMeshBase& emsh);
00134 
00135   // ********************************************************** MutableMesh2 **
00136 
00142   class MutableMesh2 : public Mesh2, public MutableMeshBase {
00143   public:
00144     MutableMesh2() : ncell_(0) {}
00145     virtual ~MutableMesh2();
00146     inline uint ncell() const { return ncell_; }
00147     inline Scan2* scan() { return new PStlVectorScan<Cell2>(cells_); }
00148 
00152     virtual void addCell(Cell* cell, bool holding = true);
00153 
00158     void replaceCell(Cell2* cell, bool holding = true);
00159 
00161     Cell2* lastCell() const { 
00162       if (ncell_)
00163         return cells_[ncell_-1];
00164       return 0;
00165     }
00166 
00170     void addMesh(Mesh2& msh);
00171 
00177     void connectOppositeEdges(const Edge2d* edge1, const Edge2d* edge2,
00178                               const Attribute attrib = Attribute(),
00179                               const Quad2dSubdivision* strategy = 0);
00180 
00192     void connectOppositeEdges(const Sequence<Edge2d*> edges1, 
00193                               const Sequence<Edge2d*> edges2,
00194                               const Attribute attrib = Attribute(),
00195                               const Quad2dSubdivision* strategy = 0);
00196 
00197   protected:
00198     virtual std::ostream& info(std::ostream& os) const;
00199   private:
00201     uint ncell_;
00203     Sequence<Cell2*> cells_;
00204   };
00205 
00206   // ******************************************************* ConnectTwoMeshes2 **
00207 
00211   class ConnectTwoMeshes : public MutableMesh2, public InnerOuterBoundary2d {
00212   public:
00225     ConnectTwoMeshes(Mesh2withBoundary& mesh1, const Sequence<uint> edges1,
00226                      Mesh2withBoundary& mesh2, const Sequence<uint> edges2,
00227                      const Attribute attrib = Attribute());
00228     virtual ~ConnectTwoMeshes() {}
00229   };
00230 
00231 } // namespace concepts
00232 
00233 #endif // mutableMesh_hh

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