hierarchicalmesh3d.h

Go to the documentation of this file.
00001 #ifndef __hierarchicalmesh3d_h
00002 #define __hierarchicalmesh3d_h
00003 
00004 #include  "vertex.h" 
00005 #include  "boundaryquad.h" 
00006 #include  "hex.h" 
00007 #include  "hexlawandorder.h" 
00008 #include  "boundaryfunction.h"
00009 #include  "hangcontainer3d.h" 
00010 #include  "hierarchicalmesh.h"
00011 
00012 /*---------------------------------------------------*/
00013 
00014 namespace Gascoigne
00015 {
00016 class HierarchicalMesh3d : public HierarchicalMesh
00017 {
00018   protected :
00019   
00020   /*  typedef  */
00021 
00022   typedef  std::vector<Vertex3d>       VertexVec3d;
00023   typedef  BoundaryCell<4>          BoundaryQuad;
00024   typedef  std::vector<Hex>            HexVec;
00025   typedef  std::vector<BoundaryQuad>   BQuadVec;
00026   typedef  HangList<2>              LineHangList;
00027   typedef  HangList<4>              QuadHangList;
00028   typedef  BoundaryFunction<3>      BoundaryFunction3d;
00029   typedef  std::map<int,fixarray<8,int> >  HexChilds;
00030 
00031   /*  Data  */
00032 
00033   CurvedShapes<3>    _curvedshapes;
00034 
00035   VertexVec3d        vertexs3d; 
00036 
00037   /* info fuer interpolation auf neues gitter */
00038   HexChilds          hexchildsofdeleted;
00039   HexVec             hexs;
00040   BQuadVec           Bquads;
00041   LineHangList       LineHang;
00042   QuadHangList       QuadHang;
00043   HexLawAndOrder     HexLaO;
00044   std::map<int,int>       hexofcurved;
00045 
00046   /*  Functionen  */
00047   int    Vater(const int i) const;
00048   IntVector Nachkommen(const int i) const;
00049   IntVector Geschwister(const int i) const;
00050   IntVector Kinder     (const int i) const;
00051   
00052   void post_refine3d();
00053 
00054   void delete_vertexs3d(const IntVector&);
00055 
00056   void new_edge_vertex3d(int, const EdgeVector&);
00057   void new_face_vertex3d(int, const FaceVector&);
00058   void new_vertex3d     (int, const fixarray<6,int>&);
00059 
00060   void check_mesh3d() const;
00061 
00062   std::pair<bool,tint>  check_inp(const std::string&);
00063   std::pair<int,int>  GetBoundaryInformation(int i) const;
00064 
00065   void init_quad           (BoundaryQuad&);
00066 
00067   void  build_neighbours() const;
00068 
00069   void prepare3d  (const IntVector&, const IntVector&, IntSet&, IntSet&);
00070   void new_hexs   (const HangContainer3d&, const IntVector&, 
00071                    const IntVector&, int, const IntSet&);
00072   void ghost_fill_neighbours2d();
00073   void ghost_fill_neighbours3d();
00074   void UpdateHangs(HangContainer3d& hangset,
00075                    const IntSet& cellref, 
00076                    const IntSet& cellcoarse);
00077   void FaceCoarse(HangContainer3d&, const IntSet&) const;
00078   void FaceRefine(HangContainer3d&, const IntSet&) const;
00079   void UpdateHangingEdges(HangContainer3d& hangset,
00080                           const IntSet& cellref, 
00081                           const IntSet& cellcoarse) const;
00082   void boundary_prepare3d(IntSet&, IntSet&, IntSet&, const HangContainer3d&);
00083   void new_boundary3d    (IntSet&, IntSet&,IntSet&);
00084   void new_vertexs3d     (HangContainer3d&, const IntVector&, const IntSet&);
00085   void basic_refine3d    (HangContainer3d&, const IntSet&, const IntSet&);
00086   void basic_fill_neighbours3d();
00087   void boundary_newton3d      (IntSet&);
00088   void inner_vertex_newton3d (const IntVector&, const IntSet&, const IntSet&);
00089   void update_boundary_data3d(const IntSet&);
00090   void new_bquads            (const IntVector&, const IntVector&, const IntSet&);
00091   void new_middle_vertex3d   (int,int);
00092 
00093   int  regular_grid3d_one  (IntSet&, IntVector&, const IntSet&, const IntSet&);
00094   int  regular_grid3d_one  (IntVector&, IntVector&, const IntSet&, const IntSet&);
00095   int  regular_grid3d_two  (IntVector&, const IntSet&);
00096   int  regular_grid3d_three_refine(IntSet&) const;
00097   int  regular_grid3d_three_coarse(IntSet&, IntSet&) const;
00098 
00099   void GetMinMaxLevels(IntVector& maxi, IntVector& mini,
00100                        const IntSet& CellRef) const;
00101 
00102   void init_edges3d();
00103   void LoadFathers3d(IntVector& v) const;
00104 
00105   void    _refine3d (IntSet&, IntSet&, const IntVector&, const IntVector&);
00106   void FillNeighbourFaces(const Hex& father, const FaceVector& Face,
00107                           int rneigh);
00108   void FillNeighbourFaces(int M, int S, const FaceVector& Face);
00109   void   InitHexOfCurved();
00110   int   FindPatchDepth() const;
00111   void  FillVertexLevels(IntVector& dst) const;
00112   void  RefineCoarseNodes(IntSet& dst, const IntVector& refnodes,
00113                           const IntVector& vertexlevel) const;
00114   void  VertexToCells(IntVector& dst, const IntSet& src, 
00115                       const IntVector& vertexlevel) const;
00116   void VertexToCellsCoarsening(IntVector& dst, const IntSet& src, 
00117                                const IntVector& vertexlevel) const;
00118   void recursive_childs(int q, IntVector& ref, int d) const;
00119 
00120   const CurvedShapes<3>& GetCurvedShapes() const { return _curvedshapes;}
00121   CurvedShapes<3>& GetCurvedShapes() { return _curvedshapes;}
00122 
00123   public:
00124 
00125   HierarchicalMesh3d();
00126   HierarchicalMesh3d(const HierarchicalMesh3d& H);
00127   HierarchicalMesh3d& operator=(const HierarchicalMesh3d& H);
00128   HierarchicalMesh3d(const ParamFile* paramfile);
00129   ~HierarchicalMesh3d() {  GetCurvedShapes().clear();}
00130 
00131   std::string GetName() const {return "HierarchicalMesh3d";}
00132 
00133   /*  Zugriff  */
00134 
00135   int  dimension()            const { return 3;}
00136 
00137   int  nnodes   ()            const { return vertexs3d.size();}
00138   int  ncells   ()            const { return hexs.size();}
00139   int  nbquads  ()            const { return Bquads.size();}
00140 
00141   int  nodes_per_cell(int i)  const { return 8;}
00142   int  VtkType(int i) const { return 12;}
00143 
00144   const Vertex3d& vertex3d(int i)         const { return vertexs3d[i];}
00145 
00146   const Hex&   hex (int i)                const { return hexs[i];}
00147   const BoundaryQuad&  bquad(int i)       const { return Bquads[i];}
00148 
00149   int  vertex_of_cell (int i, int ii)      const { return hexs[i].vertex(ii);}
00150   int  vertex_of_bquad(int i, int ii)      const { return Bquads[i].vertex(ii);}
00151   int  face_of_hex    (int i, int ii)      const { return hexs[i].edge(ii); }
00152   int  level(int i)                        const { return hexs[i].level();}
00153   bool sleep(int i)                        const { return hexs[i].sleep();}
00154 
00155   int child(int i, int ii) const { return hexs[i].child(ii); }
00156   int nchilds(int i)       const { return hexs[i].nchilds(); }
00157 
00158   const HexLawAndOrder&     HexLawOrder()     const { return HexLaO; }
00159   const LineHangList&       linehang()        const { return LineHang;}
00160   const QuadHangList&       quadhanglist()    const { return QuadHang; }
00161   const BoundaryFunction3d* quad_shape(int i) const;
00162 
00163   const std::vector<BoundaryQuad>& quad_list() const { return Bquads; }
00164 
00165   const VertexVec3d&        vertex3d() const {return vertexs3d;}
00166   const HexVec&             hex     () const {return hexs;}
00167   const BQuadVec&           bquad   () const {return Bquads;}
00168   const QuadHangList&       quadhang() const {return QuadHang;}
00169   const std::map<int,int>&       GetHexOfCurved() const {return hexofcurved;}
00170 
00171   /*  Functionen  */
00172 
00173   void   write    (const std::string&) const;
00174   void   write_gup(const std::string&) const;
00175   void   write_gip(const std::string&) const;
00176 
00177   void   WriteAll(const std::string&) const;
00178 
00179   void   write_inp(const std::string&) const;
00180   void   read_inp (const std::string&);
00181   void   read_gup (const std::string&);
00182   void   read_gip (const std::string&);
00183 
00184   void   global_coarse3d();
00185 
00186   void   refine      (const IntVector&, const IntVector&);
00187   void   patch_refine(IntVector&, IntVector&);
00188   //  int    smooth_edges();
00189   void   FillAllBoundaryLines();
00190 
00191   pint  EdgeNeighbour(int i, int e) const;
00192 
00193   int  NodeOnFace(int e) const;
00194   fixarray<4,int> ChildrenOfFace(int e) const;
00195 
00196   void  GetVertexesOfFace(fixarray<4,int>&, int) const;
00197   void  GetVertexesOfFace(fixarray<5,int>&, int) const;
00198   void GetAwakePatchs(std::set<int>&) const;
00199   void GetAwakeCells(std::set<int>&) const;
00200   void ConstructQ2PatchMesh(IntVector& pm) const;
00201   IntVector ConstructQ4Patch(int c) const;
00202   std::set<int> GetColors() const;
00203 
00204   
00205   int nactivedescendants(int i)      const;
00206   IntVector GetVertices(int c) const;
00207 
00208   int GetBoundaryCellOfCurved(int iq) const
00209     {
00210       std::map<int,int>::const_iterator p = hexofcurved.find(iq);
00211       if( p!=hexofcurved.end() ) return p->second;
00212       return -1;
00213     }
00214   void Testing();
00215   int neighbour(int c, int le) const;
00216   int neighbour_neighbour(int c, int le) const;
00217 
00218   void AddShape(int col, BoundaryFunction<3>* f) {
00219     GetCurvedShapes().AddShape(col,f);
00220   }
00221 };
00222 }
00223 
00224 /*---------------------------------------------------*/
00225 
00226 #endif

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