hierarchicalmesh2d.h

Go to the documentation of this file.
00001 #ifndef __hierarchicalmesh2d_h
00002 #define __hierarchicalmesh2d_h
00003 
00004 #include  "vertex.h" 
00005 #include  "boundaryline.h" 
00006 #include  "quad.h" 
00007 #include  "quadlawandorder.h" 
00008 #include  "boundaryfunction.h"
00009 #include  "hangcontainer2d.h"
00010 #include  "hierarchicalmesh.h"
00011 
00012 /*---------------------------------------------------*/
00013 
00014 namespace Gascoigne
00015 {
00016 class HierarchicalMesh2d : public HierarchicalMesh
00017 {
00018   protected :
00019   
00020   typedef  std::vector<Vertex2d>       VertexVec2d;
00021   typedef  std::vector<Quad>           QuadVec;
00022   typedef  BoundaryFunction<2>      BoundaryFunction2d;
00023   typedef  BoundaryCell<2>          BoundaryLine;
00024   typedef  std::vector<BoundaryLine>   BLineVec;
00025   typedef  HangList<2>              LineHangList;
00026 
00027   typedef triple<int,int,int>          tint;
00028   typedef std::map<fixarray<2,int>,HierarchicalMesh2d::BoundaryLine> HangBLList;
00029 
00030   /*  Data  */
00031 
00032   CurvedShapes<2>    _curvedshapes;
00033 
00034   VertexVec2d        vertexs2d; 
00035 
00036   QuadVec            quads;
00037   BLineVec           Blines;
00038   LineHangList       LineHang;
00039   QuadLawAndOrder    QuadLaO;
00040   std::map<int,int>       quadofcurved;
00041 
00042   /*  Functionen  */
00043 
00044   void post_refine2d();
00045 
00046   void delete_vertexs2d(const IntVector&);
00047 
00048   void new_edge_vertex2d(int, const EdgeVector&);
00049   void new_face_vertex2d(int, const FaceVector&);
00050 
00051   void  check_mesh2d() const;
00052   void  prepare2d  (const IntVector&, const IntVector&, IntSet&, IntSet&);
00053   std::pair<bool,tint>  check_inp(const std::string&);
00054   void  ghost2d    (HangContainer2d&, const IntSet&, const IntSet&);
00055   void  ghostglobalcoarse(HangContainer2d&, const IntSet&);
00056   void  ghost_fill_neighbours2d();
00057   void  basic_fill_neighbours2d();
00058   void  new_vertexs2d(HangContainer2d&, const IntVector&, const IntSet&);
00059   void  new_quads(const HangContainer2d&, const IntVector&, const IntVector&, 
00060                   int, const IntSet&);
00061 
00062   void  change_hangs2d  (const IntVector&, const IntVector&);
00063   void  change_vertexs2d(const IntVector&);
00064   void  change_quads2d  (const IntVector&, const IntVector&);
00065   void  boundary_prepare2d(IntSet&, IntSet&, IntSet&, const HangContainer2d&);
00066   void  new_boundary2d    (IntSet&, IntSet&, IntSet&);
00067 
00068   void  basic_refine2d(HangContainer2d&, const IntSet&, const IntSet&);
00069 
00070   void init_line           (BoundaryLine&);
00071   void new_lines           (const IntVector&, const IntVector&, const IntSet&);
00072   void boundary_newton2d     ();
00073   void inner_vertex_newton2d (const IntVector&, const IntSet&);
00074   void update_boundary_data2d(const IntSet&);
00075 
00076   int   regular_grid2d_one  (IntSet&, IntVector& , IntSet&, IntSet&) const;
00077   int   regular_grid2d_two  (IntSet&, IntSet&) const;
00078   int   regular_grid2d_three(IntSet&, IntSet&) const;
00079   int   regular_grid2d_three_refine(IntSet&) const;
00080   int   regular_grid2d_three_coarse(IntSet&, IntSet&) const;
00081 
00082   void GetMinMaxLevels(IntVector& maxi, IntVector& mini,
00083                        const IntSet& CellRef) const;
00084   void  init_edges2d();
00085 
00086   void LoadFathers  (IntVector& v) const;
00087 
00088   void    _refine2d (IntSet&, IntSet&, const IntVector&, const IntVector&);
00089   void   InitQuadOfCurved();
00090   int   FindPatchDepth() const;
00091   void  FillVertexLevels(IntVector& dst) const;
00092   void  RefineCoarseNodes(IntSet& dst, const IntVector& refnodes,
00093                           const IntVector& vertexlevel) const;
00094   void  VertexToCells(IntVector& dst, const IntSet& src, 
00095                       const IntVector& vertexlevel) const;
00096   void VertexToCellsCoarsening(IntVector& dst, const IntSet& src, 
00097                                const IntVector& vertexlevel) const;
00098   void recursive_childs(int q, IntVector& ref, int d) const;
00099 
00100   const CurvedShapes<2>& GetCurvedShapes() const { return _curvedshapes;}
00101   CurvedShapes<2>& GetCurvedShapes() { return _curvedshapes;}
00102 
00103   public:
00104 
00105   HierarchicalMesh2d();
00106   HierarchicalMesh2d(const HierarchicalMesh2d& H);
00107   HierarchicalMesh2d& operator=(const HierarchicalMesh2d& H);
00108   HierarchicalMesh2d(const ParamFile* paramfile);
00109   ~HierarchicalMesh2d()   {  GetCurvedShapes().clear();}
00110 
00111   std::string GetName() const {return "HierarchicalMesh2d";}
00112 
00113   /*  Zugriff  */
00114 
00115   int  dimension()           const { return 2;}
00116   int  nnodes   ()           const { return vertexs2d.size();}
00117   int  ncells   ()           const { return quads.size();}
00118   int  nblines  ()           const { return Blines.size(); }
00119   int  nodes_per_cell(int i)   const { return 4;}
00120   int VtkType(int i) const { return 9;}
00121 
00122   const Vertex2d& vertex2d(int i)         const { return vertexs2d[i];}
00123 
00124   const Quad&  quad(int i)                const { return quads[i];}
00125   const BoundaryLine&  bline(int i)       const { return Blines[i];}
00126   std::pair<int,int>  GetBoundaryInformation(int i) const;
00127 
00128   int  vertex_of_cell(int i, int ii)      const { return quads[i].vertex(ii);}
00129   int  vertex_of_bline(int i, int ii)     const { return Blines[i].vertex(ii);}
00130   int  edge_of_quad  (int i, int ii)      const { return quads[i].edge(ii); }
00131   int  level(int i)                       const { return quads[i].level();}
00132   bool sleep(int i)                       const { return quads[i].sleep();}
00133 
00134   int child(int i, int ii) const { return quads[i].child(ii); }
00135   int nchilds(int i)       const { return quads[i].nchilds(); }
00136 
00137   int   QuadNeighbour(const Quad&, int)    const;
00138 
00139   const QuadLawAndOrder&    QuadLawOrder()    const { return QuadLaO; }
00140   const LineHangList&       linehanglist()    const { return LineHang; }
00141   const BoundaryFunction2d* line_shape(int i) const;
00142 
00143   const std::vector<BoundaryLine>& line_list() const { return Blines; }
00144 
00145   const VertexVec2d&        vertex2d() const {return vertexs2d;}
00146   const QuadVec&            quad    () const {return quads;}
00147   const BLineVec&           bline   () const {return Blines;}
00148   const LineHangList&       linehang() const {return LineHang;}
00149   const std::map<int,int>&       GetQuadOfCurved() const {return quadofcurved;}
00150 
00151   /*  Functionen  */
00152 
00153   int    Vater(const int i) const;
00154   IntVector Nachkommen(const int i) const;
00155   IntVector Geschwister(const int i) const;
00156   IntVector Kinder     (const int i) const;
00157   int nactivedescendants(int i)      const;
00158   IntVector GetVertices(int c) const;
00159   
00160   void   write    (const std::string&) const;
00161   void   write_gup(const std::string&) const;
00162   void   write_gip(const std::string&) const;
00163 
00164   void   WriteAll(const std::string&) const;
00165 
00166   void   write_inp(const std::string&) const;
00167   void   read_inp (const std::string&);
00168   void   write_vtk(const std::string&) const;
00169 
00170   void   read_gup (const std::string&);
00171   void   read_gip (const std::string&);
00172 
00173   void   global_coarse();
00174 
00175   void   refine      (const IntVector&, const IntVector&);
00176   void   patch_refine  (IntVector&, IntVector&);
00177   int    smooth_edges();
00178   void   FillAllBoundaryLines();
00179 
00180   pint  EdgeNeighbour(int i, int e) const;
00181   void  VertexNeighbours2d(std::set<int>&, int i) const;
00182 
00183   int  NodeOnEdge(int e) const;
00184   fixarray<2,int> ChildrenOfEdge(int e) const;
00185 
00186   void  GetVertexesOfEdge(fixarray<3,int>&, int) const;
00187   void  GetVertexesOfEdge(fixarray<2,int>&, int) const;
00188   void GetAwakePatchs(std::set<int>&) const;
00189   void GetAwakeCells(std::set<int>&) const;
00190   void ConstructQ2PatchMesh(IntVector& pm) const;
00191   IntVector ConstructQ4Patch(int c) const;
00192   std::set<int> GetColors() const;
00193   int GetBoundaryCellOfCurved(int iq) const
00194     {
00195       std::map<int,int>::const_iterator p = quadofcurved.find(iq);
00196       if( p!=quadofcurved.end() ) return p->second;
00197       return -1;
00198     }
00199 
00200   std::set<int>   CellNeighbours(int i)    const;
00201 
00202   int neighbour(int c, int le) const;
00203   void FillVolumes(DoubleVector& vol) const;
00204   void writeq2(const IntVector &a,const std::vector<int> & b,int np) const;
00205 
00206   void AddShape(int col, BoundaryFunction<2>* f) {
00207     GetCurvedShapes().AddShape(col,f);
00208   }
00209 };
00210 }
00211 
00212 /*---------------------------------------------------*/
00213 
00214 #endif

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