hierarchicalmesh.h

Go to the documentation of this file.
00001 #ifndef __hierarchicalmesh_h
00002 #define __hierarchicalmesh_h
00003 
00004 #include  <utility>
00005 
00006 #include  "triple.h"
00007 #include  <string>
00008 #include  "edge.h" 
00009 #include  "hanglist.h" 
00010 #include  "curvedshapes.h"
00011 #include  "meshinterface.h"
00012 #include  "vertex.h"
00013 #include  "compvector.h"
00014 #include  "gascoigne.h"
00015 #include  "paramfile.h"
00016 
00017 /*---------------------------------------------------*/
00018 
00019 namespace Gascoigne
00020 {
00021 class HierarchicalMesh : public MeshInterface
00022 {
00023  protected :
00024 
00025   /*  typedef  */
00026 
00027   typedef  std::pair<int,int>      pint;
00028   typedef  triple<int,int,int>     tint;
00029   typedef  fixarray<2,int>         EdgeVector;
00030   typedef  fixarray<4,int>         FaceVector;
00031   typedef  std::vector<Edge>       EdgeVec;
00032   typedef  IntSet::iterator        IntSetIt;   
00033   typedef  IntSet::const_iterator  IntSetCIt;
00034  
00035   /*  Data  */
00036 
00037   int       mnlevels, pdepth, etapatcher;
00038   IntVector    vo2n, eo2n, co2n;
00039   EdgeVec   edges;
00040 
00041   mutable int _i_showoutput;
00042   
00043   void  update_edges(IntVector&);
00044   virtual int   FindPatchDepth() const=0;
00045   virtual void  FillVertexLevels(IntVector& dst) const=0;
00046   virtual void  RefineCoarseNodes(IntSet& dst, const IntVector& refnodes,
00047                                   const IntVector& vertexlevel) const=0;
00048   virtual void  VertexToCells(IntVector& dst, const IntSet& src, 
00049                               const IntVector& vertexlevel) const=0;
00050   virtual void VertexToCellsCoarsening(IntVector& dst, const IntSet& src, 
00051                                const IntVector& vertexlevel) const=0;
00052 
00053   public:
00054 
00055   virtual ~HierarchicalMesh();
00056   
00057   int  withfaces;
00058 
00059   HierarchicalMesh();
00060   HierarchicalMesh(const HierarchicalMesh&);
00061   HierarchicalMesh& operator=(const HierarchicalMesh&);
00062 
00063   /*  Zugriff  */
00064 
00065   virtual int  nnodes ()        const =0;
00066   int  nlevels()                const { return 1+mnlevels;}
00067   int  nedges ()                const { return edges.size();}
00068 
00069   const IntVector*  Vertexo2n()    const { return &vo2n;}
00070   const IntVector*  Edgeo2n  ()    const { return &eo2n;}
00071   const IntVector*  Cello2n  ()    const { return &co2n;}
00072 
00073   int Vertexo2n(int i)          const { assert(i<vo2n.size());return vo2n[i];}
00074   int Edgeo2n  (int i)          const { assert(i<eo2n.size());return eo2n[i];}
00075   int Cello2n  (int i)          const { assert(i<co2n.size());return co2n[i];}
00076 
00077   const Edge&    edge(int i)    const {assert(i<edges.size());return edges[i];}
00078   const EdgeVec& edge()         const { return edges;}
00079 
00080   virtual int child(int i, int ii) const =0;
00081   virtual int nchilds(int i)       const =0;
00082 
00083   virtual int  level(int i)   const =0;
00084   virtual bool sleep(int i)   const =0;
00085 
00086   virtual int    Vater(const int i) const
00087     {assert(0); return 0;}
00088   virtual IntVector Nachkommen(const int i) const
00089     {assert(0); return IntVector();}
00090   virtual IntVector Geschwister(const int i) const
00091     {assert (0); return IntVector();}
00092   virtual IntVector Kinder(const int i) const
00093     {assert(0); return IntVector();}
00094     
00095   void SetParameters(std::string gridname, int patchdepth, int epatcher);
00096   void ReadFile(const std::string& gridname);
00097   void BasicInit(const ParamFile* pf);
00098   void global_refine  (int k);
00099   void global_patch_coarsen (int k);
00100   void random_refine  (double, int k=1);
00101   void random_patch_refine  (double, int k=1);
00102   void random_patch_coarsen (double, int k=0);
00103   void random_double_patch_refine  (double, int k=1);
00104   void clear_transfer_lists();
00105   virtual void   write_gip(const std::string&) const =0;
00106   virtual void   write_gup(const std::string&) const =0;
00107   virtual void   write_inp(const std::string&) const =0;
00108 
00109   virtual int dimension()       const { return 0;}
00110   virtual int ncells ()         const =0;
00111   int patchdepth()              const {return pdepth;}
00112   virtual int nactivedescendants(int i)      const=0;
00113   virtual IntVector GetVertices(int c) const=0;
00114   
00115   bool CellIsCurved(int iq) const  { return GetBoundaryCellOfCurved(iq)!=-1;}
00116 
00117   virtual std::set<int> GetColors() const=0;
00118 
00119   virtual void read_inp (const std::string&)=0;
00120   virtual void read_gup (const std::string&)=0;
00121   virtual void read_gip (const std::string&)=0;
00122   virtual void refine(const IntVector&, const IntVector&)=0;
00123   virtual void patch_refine(IntVector&, IntVector&)=0;
00124   virtual void vertex_patch_refine(IntVector& ref, IntVector& coarse);
00125   virtual void vertex_patch_refine(IntVector&);
00126   virtual void GetAwakePatchs(std::set<int>&) const =0;
00127   virtual void GetAwakeCells(std::set<int>&) const =0;
00128   virtual void ConstructQ2PatchMesh(IntVector& pm) const=0;
00129   virtual IntVector ConstructQ4Patch(int c) const =0;
00130   virtual std::set<int> CellNeighbours(int i) const 
00131     { std::cerr << "no CellNeighbours"; abort(); return std::set<int>();}
00132 
00133   virtual int  GetBoundaryCellOfCurved(int iq) const { return -1;}
00134 
00135   virtual void AddShape(int col, BoundaryFunction<2>* f) {assert(0);}
00136   virtual void AddShape(int col, BoundaryFunction<3>* f) {assert(0);}
00137 
00138   void ShowOutput(int i) const { _i_showoutput=i; } 
00139 
00140 };
00141 }
00142 
00143 /*---------------------------------------------------*/
00144 
00145 #endif

Generated on Thu Sep 14 10:34:37 2006 for Gascoigne by  doxygen 1.4.7