alu3dinclude.hh

00001 #ifndef DUNE_ALU3DINCLUDE_HH
00002 #define DUNE_ALU3DINCLUDE_HH
00003 
00004 // all methods and classes of the ALUGrid are defined in the namespace 
00005 #define ALU3DSPACE ALUGridSpace ::
00006 
00007 #include <alugrid_defineparallel.h>
00008 
00009 #if HAVE_MPI
00010   // if this variable is defined, 
00011   // // then parallel version of ALUGrid is compiled
00012   #if ALU3DGRID_BUILD_FOR_PARALLEL == 0
00013     #warning "The ALUGrid-library wasn't compiled for parallel usage. Reconfigure\
00014  using the MPI compiler script or compile Dune without the MPI support!\
00015  Defaulting to serial ALUGrid!"
00016     #define ALU3DGRID_PARALLEL 0 
00017   #else 
00018     #define ALU3DGRID_PARALLEL 1
00019   #endif
00020 #else 
00021   #define ALU3DGRID_PARALLEL 0 
00022 #endif
00023 
00024 // if MPI was found include all headers 
00025 #if ALU3DGRID_PARALLEL
00026 #include <alugrid_parallel.h>
00027 #else  
00028 // if not, include only headers for serial version 
00029 #include <alugrid_serial.h>
00030 #endif
00031 
00032 namespace ALUGridSpace {
00033   
00034 #if ALU3DGRID_PARALLEL
00035   typedef GatherScatter GatherScatterType;
00036   
00037   typedef GitterDunePll GitterType;
00038   typedef GitterDunePll GitterImplType; 
00039 
00040   typedef Hbnd3PllInternal<GitterType::Objects::Hbnd3Default,
00041                            BndsegPllBaseXClosure<GitterType::hbndseg3_GEO>, 
00042                            BndsegPllBaseXMacroClosure<GitterType::hbndseg3_GEO> > :: micro_t  MicroType;
00043 
00044   // value for boundary to other processes 
00045   static const int ProcessorBoundary_t = GitterImplType::hbndseg_STI::closure;
00046   
00047 #else 
00048   typedef GatherScatter GatherScatterType;
00049   
00050   // the header 
00051   typedef Gitter GitterType;
00052   typedef GitterDuneImpl GitterImplType; 
00053   typedef GitterType::hface_STI               PLLFaceType;       // Interface Face
00054   
00055 #endif
00056   
00057   
00058   // typedefs of Element types 
00059   typedef GitterType::helement_STI            HElementType;    // Interface Element
00060   typedef GitterType::hface_STI               HFaceType;       // Interface Face
00061   typedef GitterType::hedge_STI               HEdgeType;       // Interface Edge
00062   typedef GitterType::vertex_STI              VertexType;      // Interface Vertex
00063   typedef GitterType::hbndseg_STI HBndSegType;
00064   typedef GitterType::ghostpair_STI GhostPairType;
00065   typedef GitterType::Geometric::hface3_GEO GEOFace3Type;     // Tetra Face
00066   typedef GitterType::Geometric::hface4_GEO GEOFace4Type; // Hexa Face
00067   typedef GitterType::Geometric::hedge1_GEO GEOEdgeT;     // * stays real Face
00068   typedef GitterType::Geometric::VertexGeo GEOVertexT;     // * stays real Face
00069   typedef GitterImplType::Objects::tetra_IMPL IMPLTetraElementType; //impl Element
00070   typedef GitterImplType::Objects::hexa_IMPL IMPLHexaElementType;
00071   typedef GitterType::Geometric::tetra_GEO GEOTetraElementType;  // real Element
00072   typedef GitterType::Geometric::hexa_GEO GEOHexaElementType;
00073   typedef GitterType::Geometric::hasFace3 HasFace3Type;    // has Face with 3 polygons
00074   typedef GitterType::Geometric::hasFace4 HasFace4Type;
00075   typedef GitterType::Geometric::Hface3Rule Hface3RuleType;
00076   typedef GitterType::Geometric::Hface4Rule Hface4RuleType;
00077   
00078   typedef GitterImplType::Objects::Hbnd3Default BNDFace3Type;    // boundary segment 
00079   typedef GitterImplType::Objects::Hbnd4Default BNDFace4Type;
00080   typedef GitterImplType::Objects::hbndseg3_IMPL ImplBndFace3Type;    // boundary segment 
00081   typedef GitterImplType::Objects::hbndseg4_IMPL ImplBndFace4Type;
00082 } // end namespace ALUGridSpace 
00083 
00084 //- local includes 
00085 #include "topology.hh"
00086 
00087 namespace Dune {
00088 
00089   // typedef of ALU3dGridElementType see topology.hh 
00090     
00091   // i.e. double or float 
00092   typedef double alu3d_ctype;
00093 
00094   template <ALU3dGridElementType elType>
00095   struct ALU3dImplTraits {};
00096 
00097   template <>
00098   struct ALU3dImplTraits<tetra> {
00099     typedef ALU3DSPACE GEOFace3Type GEOFaceType;
00100     typedef ALU3DSPACE GEOEdgeT GEOEdgeType;
00101     typedef ALU3DSPACE GEOVertexT GEOVertexType;
00102     typedef ALU3DSPACE IMPLTetraElementType IMPLElementType;
00103     typedef ALU3DSPACE GEOTetraElementType GEOElementType;
00104     typedef ALU3DSPACE HasFace3Type HasFaceType;
00105     typedef ALU3DSPACE Hface3RuleType HfaceRuleType;
00106     typedef ALU3DSPACE BNDFace3Type BNDFaceType;
00107     typedef ALU3DSPACE ImplBndFace3Type ImplBndFaceType;
00108     typedef ALU3DSPACE BNDFace3Type PLLBndFaceType;
00109   
00110     // refinement and coarsening enum for tetrahedons 
00111     enum { refine_element_t = 
00112            ALU3DSPACE GitterType::Geometric::TetraRule::iso8 };
00113     enum { coarse_element_t = 
00114            ALU3DSPACE GitterType::Geometric::TetraRule::crs  };
00115     enum { nosplit_element_t = ALU3DSPACE GitterType::Geometric::TetraRule::nosplit };
00116 
00117     typedef ALU3DSPACE GitterType::Geometric::TetraRule MarkRuleType;
00118 
00119     typedef std::pair<GEOFaceType*, int> NeighbourFaceType;
00120     typedef std::pair<HasFaceType*, int> NeighbourPairType;
00121     typedef ALU3DSPACE GhostPairType GhostPairType;
00122 
00123     template <int cdim>
00124     struct Codim;
00125 
00126   };
00127 
00128   template <>
00129   struct ALU3dImplTraits<tetra>::Codim<0> {
00130     typedef ALU3DSPACE GitterType::helement_STI InterfaceType;
00131     typedef IMPLElementType ImplementationType;
00132     typedef ALU3DSPACE HBndSegType GhostInterfaceType; 
00133     typedef PLLBndFaceType  GhostImplementationType; 
00134   };
00135 
00136   template <>
00137   struct ALU3dImplTraits<tetra>::Codim<1> {
00138     typedef ALU3DSPACE GitterType::hface_STI InterfaceType;
00139     typedef GEOFaceType ImplementationType;
00140   };
00141 
00142   template <>
00143   struct ALU3dImplTraits<tetra>::Codim<2> {
00144     typedef ALU3DSPACE GitterType::hedge_STI InterfaceType;
00145     typedef GEOEdgeType ImplementationType;
00146   };
00147 
00148   template <>
00149   struct ALU3dImplTraits<tetra>::Codim<3> {
00150     typedef ALU3DSPACE GitterType::vertex_STI InterfaceType;
00151     typedef ALU3DSPACE GitterType::Geometric::VertexGeo ImplementationType;
00152   };
00153 
00154 
00155 
00156   template <>
00157   struct ALU3dImplTraits<hexa> {
00158     typedef ALU3DSPACE GEOFace4Type GEOFaceType;
00159     typedef ALU3DSPACE GEOEdgeT GEOEdgeType;
00160     typedef ALU3DSPACE GEOVertexT GEOVertexType;
00161     typedef ALU3DSPACE IMPLHexaElementType IMPLElementType;
00162     typedef ALU3DSPACE GEOHexaElementType GEOElementType;
00163     typedef ALU3DSPACE HasFace4Type HasFaceType;
00164     typedef ALU3DSPACE Hface4RuleType HfaceRuleType;
00165     typedef ALU3DSPACE BNDFace4Type BNDFaceType;
00166     typedef ALU3DSPACE ImplBndFace4Type ImplBndFaceType;
00167     typedef ALU3DSPACE BNDFace4Type PLLBndFaceType;
00168 
00169     // refinement and coarsening enum for hexahedrons 
00170     enum { refine_element_t  = ALU3DSPACE GitterType::Geometric::HexaRule::iso8 };
00171     enum { coarse_element_t  = ALU3DSPACE GitterType::Geometric::HexaRule::crs  };
00172     enum { nosplit_element_t = ALU3DSPACE GitterType::Geometric::HexaRule::nosplit };
00173 
00174     typedef ALU3DSPACE GitterType::Geometric::HexaRule MarkRuleType;
00175     typedef std::pair<GEOFaceType*, int> NeighbourFaceType;
00176     typedef std::pair<HasFaceType*, int> NeighbourPairType;
00177     typedef ALU3DSPACE GhostPairType GhostPairType;
00178   
00179     template <int cdim>
00180     struct Codim;
00181   };
00182 
00183   template <>
00184   struct ALU3dImplTraits<hexa>::Codim<0> {
00185     typedef ALU3DSPACE GitterType::helement_STI InterfaceType;
00186     typedef IMPLElementType ImplementationType;
00187     typedef ALU3DSPACE HBndSegType GhostInterfaceType; 
00188     typedef PLLBndFaceType  GhostImplementationType; 
00189   };
00190 
00191   template <>
00192   struct ALU3dImplTraits<hexa>::Codim<1> {
00193     typedef ALU3DSPACE GitterType::hface_STI InterfaceType;
00194     typedef GEOFaceType ImplementationType;
00195   };
00196   
00197   template <>
00198   struct ALU3dImplTraits<hexa>::Codim<2> {
00199     typedef ALU3DSPACE GitterType::hedge_STI InterfaceType;
00200     typedef GEOEdgeType ImplementationType;
00201   };
00202   
00203   template <>
00204   struct ALU3dImplTraits<hexa>::Codim<3> {
00205     typedef ALU3DSPACE GitterType::vertex_STI InterfaceType;
00206     typedef ALU3DSPACE GitterType::Geometric::VertexGeo ImplementationType;
00207   };
00208  
00211   class ALU3dGridVertexList 
00212   {
00213   public:
00214     // level vertex iterator list 
00215     typedef std::vector < ALU3DSPACE VertexType * > VertexListType;
00216     typedef VertexListType :: iterator IteratorType;
00217 
00218     ALU3dGridVertexList () : up2Date_(false) {}
00219 
00220     size_t size () const  { return vertexList_.size(); }
00221 
00222     bool up2Date () const { return up2Date_;  }
00223     void unsetUp2Date ()  { up2Date_ = false; }
00224 
00225     // make grid walkthrough and calc global size 
00226     template <class GridType>
00227     void setupVxList (const GridType & grid, int level);
00228 
00229     IteratorType begin () { return vertexList_.begin(); }
00230     IteratorType end   () { return vertexList_.end(); }
00231 
00232     VertexListType & getItemList() { return vertexList_; }
00233   private:
00234     bool up2Date_;
00235     VertexListType vertexList_;
00236   };
00237   
00240   class ALU3dGridLeafVertexList 
00241   {
00242   public:
00243     // level vertex iterator list 
00244     typedef std::pair < ALU3DSPACE VertexType * , int > ItemType;
00245     typedef std::vector < ItemType > VertexListType;
00246     typedef VertexListType :: iterator IteratorType;
00247 
00248     ALU3dGridLeafVertexList () : up2Date_(false) {}
00249 
00250     size_t size () const  { return vertexList_.size(); }
00251 
00252     bool up2Date () const { return up2Date_;  }
00253     void unsetUp2Date ()  { up2Date_ = false; }
00254 
00255     // make grid walkthrough and calc global size 
00256     template <class GridType>
00257     void setupVxList (const GridType & grid);
00258 
00259     IteratorType begin () { return vertexList_.begin(); }
00260     IteratorType end   () { return vertexList_.end(); }
00261 
00262     VertexListType & getItemList() { return vertexList_; }
00263     int getLevel(const ALU3DSPACE VertexType & vertex) const 
00264     {
00265       const int idx = vertex.getIndex();
00266       assert( idx >= 0 );
00267       assert( idx < (int)size());
00268       const ItemType & p = vertexList_[idx];
00269       if( p.first == 0 )
00270         return vertex.level();
00271       else 
00272         return p.second;
00273     }
00274   private:
00275     bool up2Date_;
00276     VertexListType vertexList_;
00277   };
00278   typedef ALU3dGridLeafVertexList LeafVertexListType;
00279 
00280   class ALU3dGridItemList 
00281   {
00282   public:
00283     // level vertex iterator list 
00284     typedef std::vector < void * > ItemListType;
00285     typedef ItemListType :: iterator IteratorType;
00286 
00287     ALU3dGridItemList () : up2Date_(false) {}
00288 
00289     size_t size () const  { return itemList_.size(); }
00290 
00291     bool up2Date () const { return up2Date_;  }
00292     void unsetUp2Date ()  { up2Date_ = false; }
00293 
00294     void markAsUp2Date() { up2Date_ = true; }
00295 
00296     IteratorType begin () { return itemList_.begin(); }
00297     IteratorType end   () { return itemList_.end(); }
00298 
00299     ItemListType & getItemList() { return itemList_; }
00300 
00301   private:
00302     bool up2Date_;
00303     ItemListType itemList_;
00304   };
00305 
00306   typedef ALU3dGridItemList ALU3dGridItemListType;
00307 
00308 } // end namespace Dune
00309 
00310 #endif

Generated on 6 Nov 2008 with Doxygen (ver 1.5.6) [logfile].