alugrid.hh

Go to the documentation of this file.
00001 #ifndef DUNE_ALUGRID_HH
00002 #define DUNE_ALUGRID_HH
00003 
00004 // 3d version 
00005 #include "alugrid/3d/indexsets.hh"
00006 #include "alugrid/3d/iterator.hh"
00007 #include "alugrid/3d/entity.hh"
00008 #include "alugrid/3d/geometry.hh"
00009 #include "alugrid/3d/grid.hh"
00010 
00011 // 2d version 
00012 #include <dune/grid/alugrid/2d/grid.hh>
00018 namespace Dune { 
00019 
00020 
00044 template <int dim,int dimworld> class ALUCubeGrid {};
00045   
00051 template <>
00052 class ALUCubeGrid<3,3> : 
00053   public Dune::ALU3dGrid<3,3,Dune::hexa> {
00054   typedef Dune::ALU3dGrid<3,3,Dune::hexa> BaseType;
00055   enum { dim      = 3 }; 
00056   enum { dimworld = 3 }; 
00057  public:
00058 #if ALU3DGRID_PARALLEL
00063   ALUCubeGrid(const std::string macroName , MPI_Comm mpiComm = MPI_COMM_WORLD) :
00064     BaseType(macroName,mpiComm) 
00065   {
00066     if(this->comm().rank() == 0)
00067     {
00068       std::cout << "\nCreated parallel ALUCubeGrid<"<<dim<<","<<dimworld;
00069       std::cout <<"> from macro grid file '" << macroName << "'. \n\n";     
00070     }
00071   }
00073   ALUCubeGrid(MPI_Comm mpiComm = MPI_COMM_WORLD) :
00074     BaseType("",mpiComm) 
00075   {
00076     if(this->comm().rank() == 0)
00077     {
00078       std::cout << "\nCreated empty ALUCubeGrid<"<<dim<<","<<dimworld <<">. \n\n";
00079     }
00080   }
00081 #else
00086   ALUCubeGrid(const std::string macroName , int mpiComm = 0 ) :
00087     BaseType(macroName) 
00088   {
00089     std::cout << "\nCreated serial ALUCubeGrid<"<<dim<<","<<dimworld;
00090     std::cout <<"> from macro grid file '" << macroName << "'. \n\n";     
00091   }
00093   ALUCubeGrid(int myrank = -1) :
00094     BaseType("",myrank) 
00095   {
00096     std::cout << "\nCreated empty ALUCubeGrid<"<<dim<<","<<dimworld <<">. \n\n";
00097   }
00098 #endif
00099   enum {dimension=BaseType::dimension,dimensionworld=BaseType::dimensionworld};
00100   typedef BaseType::ctype ctype;
00101   typedef BaseType::GridFamily GridFamily;
00102   typedef GridFamily::Traits Traits;
00103   typedef BaseType::LocalIdSetImp LocalIdSetImp;
00104   typedef Traits :: GlobalIdSet GlobalIdSet;
00105   typedef Traits :: LocalIdSet LocalIdSet;
00106   typedef GridFamily :: LevelIndexSetImp  LevelIndexSetImp;
00107   typedef GridFamily :: LeafIndexSetImp  LeafIndexSetImp;
00108   typedef BaseType::LeafIteratorImp LeafIteratorImp;
00109   typedef Traits::Codim<0>::LeafIterator LeafIteratorType;
00110   typedef Traits::Codim<0>::LeafIterator LeafIterator;
00111 
00112   // ALUGrid only typedefs 
00113   typedef BaseType::HierarchicIteratorImp HierarchicIteratorImp;
00114   typedef BaseType::ObjectStreamType      ObjectStreamType;
00115 
00116   friend class Conversion< ALUCubeGrid<dimension,dimensionworld> , HasObjectStream > ;
00117   friend class Conversion< const ALUCubeGrid<dimension,dimensionworld> , HasObjectStream > ;
00118   
00119   friend class Conversion< ALUCubeGrid<dimension,dimensionworld> , HasHierarchicIndexSet > ;
00120   friend class Conversion< const ALUCubeGrid<dimension,dimensionworld> , HasHierarchicIndexSet > ;
00121   
00122  private: 
00124     ALUCubeGrid( const ALUCubeGrid & g ) ; // : BaseType(g) {}
00125   
00127     ALUCubeGrid<dim,dimworld>& 
00128     operator = (const ALUCubeGrid& g); 
00129 };
00130 
00131   namespace Capabilities {
00143     template<int dim,int dimw, int cdim >
00144     struct hasEntity<Dune::ALUCubeGrid<dim, dimw>, cdim >
00145     {
00146       static const bool v = true;
00147     };
00148 
00152     template<int dim,int dimw>
00153     struct isParallel<const ALUCubeGrid<dim, dimw> > {
00154       static const bool v = true;
00155     };
00156 
00160     template<int dim,int dimw>
00161     struct isLevelwiseConforming< ALUCubeGrid<dim,dimw> >
00162     {
00163       static const bool v = true;
00164     };
00165 
00169     template<int dim,int dimw>
00170     struct hasHangingNodes< ALUCubeGrid<dim,dimw> >
00171     {
00172       static const bool v = true;
00173     };
00174 
00178     template<int dim,int dimw>
00179     struct hasBackupRestoreFacilities< ALUCubeGrid<dim,dimw> >
00180     {
00181       static const bool v = true;
00182     };
00183 
00184   } // end namespace Capabilities
00185 
00186 
00214 template <int dim,int dimworld> class ALUSimplexGrid {};
00215 
00221 template <>
00222 class ALUSimplexGrid<3,3> : 
00223   public Dune::ALU3dGrid<3,3,Dune::tetra> {
00224   typedef Dune::ALU3dGrid<3,3,Dune::tetra> BaseType;
00225   enum { dim      = 3 };
00226   enum { dimworld = 3 }; 
00227  public:
00228 #if ALU3DGRID_PARALLEL
00233   ALUSimplexGrid(const std::string macroName, MPI_Comm mpiComm = MPI_COMM_WORLD) :
00234     BaseType(macroName,mpiComm) 
00235   {
00236     if(this->comm().rank() == 0)
00237     {
00238       std::cout << "\nCreated parallel ALUSimplexGrid<"<<dim<<","<<dimworld;
00239       std::cout <<"> from macro grid file '" << macroName << "'. \n\n";     
00240     }
00241   }
00243   ALUSimplexGrid(MPI_Comm mpiComm = MPI_COMM_WORLD) :
00244     BaseType("",mpiComm) 
00245   {
00246     if(this->comm().rank() == 0)
00247     {
00248       std::cout << "\nCreated empty ALUSimplexGrid<"<<dim<<","<<dimworld <<">. \n\n";
00249     }
00250   }
00251 #else
00256   ALUSimplexGrid(const std::string macroName , int mpicomm = 0) :
00257     BaseType(macroName) 
00258   {
00259     std::cout << "\nCreated serial ALUSimplexGrid<"<<dim<<","<<dimworld;
00260     std::cout <<"> from macro grid file '" << macroName << "'. \n\n";     
00261   }
00263   ALUSimplexGrid(int myrank = -1) :
00264     BaseType("",myrank) 
00265   {
00266     std::cout << "\nCreated empty ALUSimplexGrid<"<<dim<<","<<dimworld <<">. \n\n";
00267   }
00268 #endif 
00269   enum {dimension=BaseType::dimension,dimensionworld=BaseType::dimensionworld};
00270   typedef BaseType::ctype ctype;
00271   typedef BaseType::GridFamily GridFamily;
00272   typedef GridFamily::Traits Traits;
00273   typedef BaseType::LocalIdSetImp LocalIdSetImp;
00274   typedef Traits :: GlobalIdSet GlobalIdSet;
00275   typedef Traits :: LocalIdSet LocalIdSet;
00276   typedef GridFamily :: LevelIndexSetImp  LevelIndexSetImp;
00277   typedef GridFamily :: LeafIndexSetImp  LeafIndexSetImp;
00278   typedef BaseType::LeafIteratorImp LeafIteratorImp;
00279   typedef Traits::Codim<0>::LeafIterator LeafIteratorType;
00280   typedef Traits::Codim<0>::LeafIterator LeafIterator;
00281 
00282   // ALUGrid only typedefs 
00283   typedef BaseType::HierarchicIteratorImp HierarchicIteratorImp;
00284   typedef BaseType::ObjectStreamType      ObjectStreamType;
00285 
00286   friend class Conversion< ALUSimplexGrid<dimension,dimensionworld> , HasObjectStream > ;
00287   friend class Conversion< const ALUSimplexGrid<dimension,dimensionworld> , HasObjectStream > ;
00288 
00289   friend class Conversion< ALUSimplexGrid<dimension,dimensionworld> , HasHierarchicIndexSet > ;
00290   friend class Conversion< const ALUSimplexGrid<dimension,dimensionworld> , HasHierarchicIndexSet > ;
00291 
00292  private: 
00294     ALUSimplexGrid( const ALUSimplexGrid & g ); //  : BaseType(g) {}
00295   
00297     ALUSimplexGrid<dim,dimworld>& 
00298     operator = (const ALUSimplexGrid& g); 
00299   
00300 };
00301 
00307 template <>
00308 class ALUSimplexGrid<2,2> : 
00309   public Dune::ALU2dGrid<2,2> {
00310   typedef Dune::ALU2dGrid<2,2> BaseType;
00311   enum { dim      = 2 };
00312   enum { dimworld = 2 };
00313  public:
00316   ALUSimplexGrid(const std::string macroName ) 
00317     : BaseType(macroName, 1) 
00318   {
00319     std::cout << "\nCreated serial ALUSimplexGrid<"<<dim<<","<<dimworld;
00320     std::cout <<"> from macro grid file '" << macroName << "'. \n\n";     
00321   }
00323   ALUSimplexGrid( ) : BaseType(1) 
00324   {
00325     std::cout << "\nCreated empty ALUSimplexGrid<"<<dim<<","<<dimworld <<">. \n\n";
00326   }
00327   enum {dimension=BaseType::dimension,dimensionworld=BaseType::dimensionworld};
00328   enum { refineStepsForHalf = 1 };
00329   typedef BaseType::ctype ctype;
00330   typedef BaseType::GridFamily GridFamily;
00331   typedef GridFamily::Traits Traits;
00332   typedef BaseType::LocalIdSetImp LocalIdSetImp;
00333   typedef Traits :: GlobalIdSet GlobalIdSet;
00334   typedef Traits :: LocalIdSet LocalIdSet;
00335   typedef GridFamily :: LevelIndexSetImp  LevelIndexSetImp;
00336   typedef GridFamily :: LeafIndexSetImp  LeafIndexSetImp;
00337   typedef BaseType::LeafIteratorImp LeafIteratorImp;
00338   typedef Traits::Codim<0>::LeafIterator LeafIteratorType;
00339   typedef Traits::Codim<0>::LeafIterator LeafIterator;
00340   typedef BaseType::HierarchicIteratorImp HierarchicIteratorImp;
00341   
00342   friend class Conversion< ALUSimplexGrid<dimension,dimensionworld> , HasObjectStream > ;
00343   friend class Conversion< const ALUSimplexGrid<dimension,dimensionworld> , HasObjectStream > ;
00344 
00345   friend class Conversion< ALUSimplexGrid<dimension,dimensionworld> , HasHierarchicIndexSet > ;
00346   friend class Conversion< const ALUSimplexGrid<dimension,dimensionworld> , HasHierarchicIndexSet > ;
00347   
00348  private:
00349   
00351     ALUSimplexGrid( const ALUSimplexGrid & g ) ; // : BaseType(g) {}
00352   
00354     ALUSimplexGrid<dim,dimworld>& 
00355     operator = (const ALUSimplexGrid& g); 
00356  };
00357 
00358   namespace Capabilities {
00370     template<int dim,int dimw, int cdim >
00371     struct hasEntity<Dune::ALUSimplexGrid<dim, dimw>, cdim >
00372     {
00373       static const bool v = true;
00374     };
00375 
00379     template<int dim,int dimw>
00380     struct isParallel<const ALUSimplexGrid<dim, dimw> > {
00381       static const bool v = false;
00382     };
00383 
00387     template<int dim,int dimw>
00388     struct isLevelwiseConforming< ALUSimplexGrid<dim,dimw> >
00389     {
00390       static const bool v = true;
00391     };
00392 
00396     template<int dim,int dimw>
00397     struct hasHangingNodes< ALUSimplexGrid<dim,dimw> >
00398     {
00399       static const bool v = true;
00400     };
00401 
00405     template<int dim,int dimw>
00406     struct hasBackupRestoreFacilities< ALUSimplexGrid<dim,dimw> >
00407     {
00408       static const bool v = true;
00409     };
00410 
00411   } // end namespace Capabilities
00412 
00435 template <int dim, int dimworld>
00436 class ALUConformGrid {};
00437 
00443 template <>
00444 class ALUConformGrid<2,2> : 
00445   public Dune::ALU2dGrid<2,2> {
00446   typedef Dune::ALU2dGrid<2,2> BaseType;
00447   enum { dim      = 2 };
00448   enum { dimworld = 2 };
00449  public:
00452   ALUConformGrid(const std::string macroName ) 
00453     : BaseType(macroName) 
00454   {
00455     std::cout << "\nCreated serial ALUConformGrid<"<<dim<<","<<dimworld;
00456     std::cout <<"> from macro grid file '" << macroName << "'. \n\n";     
00457   }
00459   ALUConformGrid( ) : BaseType(0) 
00460   {
00461     std::cout << "\nCreated empty ALUConformGrid<"<<dim<<","<<dimworld <<">. \n\n";
00462   }
00463   enum {dimension=BaseType::dimension,dimensionworld=BaseType::dimensionworld};
00464   enum { refineStepsForHalf = 2 };
00465   typedef BaseType::ctype ctype;
00466   typedef BaseType::GridFamily GridFamily;
00467   typedef GridFamily::Traits Traits;
00468   typedef BaseType::LocalIdSetImp LocalIdSetImp;
00469   typedef Traits :: GlobalIdSet GlobalIdSet;
00470   typedef Traits :: LocalIdSet LocalIdSet;
00471   typedef GridFamily :: LevelIndexSetImp  LevelIndexSetImp;
00472   typedef GridFamily :: LeafIndexSetImp  LeafIndexSetImp;
00473   typedef BaseType::LeafIteratorImp LeafIteratorImp;
00474   typedef Traits::Codim<0>::LeafIterator LeafIteratorType;
00475   typedef Traits::Codim<0>::LeafIterator LeafIterator;
00476   typedef BaseType::HierarchicIteratorImp HierarchicIteratorImp;
00477   
00478   friend class Conversion< ALUConformGrid<dimension,dimensionworld> , HasObjectStream > ;
00479   friend class Conversion< const ALUConformGrid<dimension,dimensionworld> , HasObjectStream > ;
00480 
00481   friend class Conversion< ALUConformGrid<dimension,dimensionworld> , HasHierarchicIndexSet > ;
00482   friend class Conversion< const ALUConformGrid<dimension,dimensionworld> , HasHierarchicIndexSet > ;
00483   
00484  private:
00486     ALUConformGrid( const ALUConformGrid & g ) ; // : BaseType(g) {}
00487   
00489     ALUConformGrid<dim,dimworld>& 
00490     operator = (const ALUConformGrid& g); 
00491  };
00492 
00493   namespace Capabilities {
00505     template<int dim,int dimw, int cdim >
00506     struct hasEntity<Dune::ALUConformGrid<dim, dimw>, cdim >
00507     {
00508       static const bool v = true;
00509     };
00510 
00514     template<int dim,int dimw>
00515     struct isParallel<const ALUConformGrid<dim, dimw> > {
00516       static const bool v = false;
00517     };
00518 
00522     template<int dim,int dimw>
00523     struct isLevelwiseConforming< ALUConformGrid<dim,dimw> >
00524     {
00525       static const bool v = false;
00526     };
00527 
00531     template<int dim,int dimw>
00532     struct hasHangingNodes< ALUConformGrid<dim,dimw> >
00533     {
00534       static const bool v = false;
00535     };
00536 
00540     template<int dim,int dimw>
00541     struct hasBackupRestoreFacilities< ALUConformGrid<dim,dimw> >
00542     {
00543       static const bool v = true;
00544     };
00545 
00546   } // end namespace Capabilities
00547 
00548 
00549 } //end  namespace Dune 
00550 #endif

Generated on 12 Dec 2007 with Doxygen (ver 1.5.1)