alugrid.hh

Go to the documentation of this file.
00001 #ifndef DUNE_ALUGRID_HH
00002 #define DUNE_ALUGRID_HH
00003 
00004 #include <dune/grid/alugrid/3d/alugrid.hh>
00005 #include <dune/grid/alugrid/3d/alu3dgridfactory.hh>
00006 
00007 // 2d version 
00008 #include <dune/grid/alugrid/2d/grid.hh>
00009 
00015 namespace Dune
00016 {
00017 
00043 template< int dim, int dimworld >
00044 class ALUCubeGrid;
00045   
00046 
00047 
00076 template< int dim, int dimworld >
00077 class ALUSimplexGrid;
00078 
00079 namespace Capabilities {
00091   template<int dim,int dimw, int cdim >
00092   struct hasEntity<Dune::ALUSimplexGrid<dim, dimw>, cdim >
00093   {
00094     static const bool v = true;
00095   };
00096 
00100   template<int dim,int dimw>
00101   struct isParallel<const ALUSimplexGrid<dim, dimw> > {
00102     static const bool v = false;
00103   };
00104 
00108   template<int dim,int dimw>
00109   struct isLevelwiseConforming< ALUSimplexGrid<dim,dimw> >
00110   {
00111     static const bool v = true;
00112   };
00113 
00117   template<int dim,int dimw>
00118   struct hasHangingNodes< ALUSimplexGrid<dim,dimw> >
00119   {
00120     static const bool v = true;
00121   };
00122 
00126   template<int dim,int dimw>
00127   struct hasBackupRestoreFacilities< ALUSimplexGrid<dim,dimw> >
00128   {
00129     static const bool v = true;
00130   };
00131 
00132 } // end namespace Capabilities
00133 
00134 
00140 template<>
00141 class ALUSimplexGrid< 2, 2 >
00142 : public Dune::ALU2dGrid< 2, 2 >
00143 {
00144   typedef ALUSimplexGrid< 2, 2 > This;
00145 
00146   typedef Dune::ALU2dGrid< 2, 2 > BaseType;
00147   enum { dim      = 2 };
00148   enum { dimworld = 2 };
00149 
00150 public:
00153   ALUSimplexGrid(const std::string macroName ) 
00154     : BaseType(macroName,1) 
00155   {
00156     std::cout << "\nCreated serial ALUSimplexGrid<"<<dim<<","<<dimworld;
00157     std::cout <<"> from macro grid file '" << macroName << "'. \n\n";     
00158   }
00160   ALUSimplexGrid( ) : BaseType(1) 
00161   {
00162     std::cout << "\nCreated empty ALUSimplexGrid<"<<dim<<","<<dimworld <<">. \n\n";
00163   }
00164   enum {dimension=BaseType::dimension,dimensionworld=BaseType::dimensionworld};
00165   enum { refineStepsForHalf = 1 };
00166   typedef BaseType::ctype ctype;
00167   typedef BaseType::GridFamily GridFamily;
00168   typedef GridFamily::Traits Traits;
00169   typedef BaseType::LocalIdSetImp LocalIdSetImp;
00170   typedef Traits :: GlobalIdSet GlobalIdSet;
00171   typedef Traits :: LocalIdSet LocalIdSet;
00172   typedef GridFamily :: LevelIndexSetImp  LevelIndexSetImp;
00173   typedef GridFamily :: LeafIndexSetImp  LeafIndexSetImp;
00174   typedef BaseType::LeafIteratorImp LeafIteratorImp;
00175   typedef Traits::Codim<0>::LeafIterator LeafIteratorType;
00176   typedef Traits::Codim<0>::LeafIterator LeafIterator;
00177   typedef BaseType::HierarchicIteratorImp HierarchicIteratorImp;
00178 
00179   template< PartitionIteratorType pitype >
00180   struct Partition
00181   {
00182     typedef Dune::GridView< DefaultLevelGridViewTraits< const This, pitype > >
00183       LevelGridView;
00184     typedef Dune::GridView< DefaultLeafGridViewTraits< const This, pitype > >
00185       LeafGridView;
00186   };
00187 
00188   typedef Partition< All_Partition > :: LevelGridView LevelGridView;
00189   typedef Partition< All_Partition > :: LeafGridView LeafGridView;
00190 
00191   template< PartitionIteratorType pitype >
00192   typename Partition< pitype >::LevelGridView levelView ( int level ) const
00193   {
00194     typedef typename Partition< pitype >::LevelGridView LevelGridView;
00195     typedef typename LevelGridView::GridViewImp LevelGridViewImp;
00196     return LevelGridView( LevelGridViewImp( *this, level ) );
00197   }
00198 
00199   template< PartitionIteratorType pitype >
00200   typename Partition< pitype >::LeafGridView leafView () const
00201   {
00202     typedef typename Partition< pitype >::LeafGridView LeafGridView;
00203     typedef typename LeafGridView::GridViewImp LeafGridViewImp;
00204     return LeafGridView( LeafGridViewImp( *this ) );
00205   }
00206 
00207   LevelGridView levelView ( int level ) const
00208   {
00209     typedef LevelGridView::GridViewImp LevelGridViewImp;
00210     return LevelGridView( LevelGridViewImp( *this, level ) );
00211   }
00212 
00213   LeafGridView leafView () const
00214   {
00215     typedef LeafGridView::GridViewImp LeafGridViewImp;
00216     return LeafGridView( LeafGridViewImp( *this ) );
00217   }
00218 
00219 private:
00220   friend class Conversion< ALUSimplexGrid<dimension,dimensionworld> , HasObjectStream > ;
00221   friend class Conversion< const ALUSimplexGrid<dimension,dimensionworld> , HasObjectStream > ;
00222 
00223   friend class Conversion< ALUSimplexGrid<dimension,dimensionworld> , HasHierarchicIndexSet > ;
00224   friend class Conversion< const ALUSimplexGrid<dimension,dimensionworld> , HasHierarchicIndexSet > ;
00225   
00227     ALUSimplexGrid( const ALUSimplexGrid & g ) ; // : BaseType(g) {}
00228   
00230     ALUSimplexGrid<dim,dimworld>& 
00231     operator = (const ALUSimplexGrid& g); 
00232  };
00233 
00257 template <int dim, int dimworld>
00258 class ALUConformGrid {};
00259 
00260 namespace Capabilities {
00272   template<int dim,int dimw, int cdim >
00273   struct hasEntity<Dune::ALUConformGrid<dim, dimw>, cdim >
00274   {
00275     static const bool v = true;
00276   };
00277 
00281   template<int dim,int dimw>
00282   struct isParallel<const ALUConformGrid<dim, dimw> > {
00283     static const bool v = false;
00284   };
00285 
00289   template<int dim,int dimw>
00290   struct isLevelwiseConforming< ALUConformGrid<dim,dimw> >
00291   {
00292     static const bool v = false;
00293   };
00294 
00298   template<int dim,int dimw>
00299   struct isLeafwiseConforming< ALUConformGrid<dim,dimw> >
00300   {
00301     static const bool v = true;
00302   };
00303 
00307   template<int dim,int dimw>
00308   struct hasHangingNodes< ALUConformGrid<dim,dimw> >
00309   {
00310     static const bool v = false;
00311   };
00312 
00316   template<int dim,int dimw>
00317   struct hasBackupRestoreFacilities< ALUConformGrid<dim,dimw> >
00318   {
00319     static const bool v = true;
00320   };
00321 
00322 } // end namespace Capabilities
00323 
00324 
00325 
00331 template<>
00332 class ALUConformGrid< 2, 2 >
00333 : public Dune::ALU2dGrid< 2, 2 >
00334 {
00335   typedef ALUConformGrid< 2, 2 > This;
00336 
00337   typedef Dune::ALU2dGrid<2,2> BaseType;
00338   enum { dim      = 2 };
00339   enum { dimworld = 2 };
00340  public:
00343   ALUConformGrid(const std::string macroName ) 
00344     : BaseType(macroName) 
00345   {
00346     std::cout << "\nCreated serial ALUConformGrid<"<<dim<<","<<dimworld;
00347     std::cout <<"> from macro grid file '" << macroName << "'. \n\n";     
00348   }
00350   ALUConformGrid( ) : BaseType(0) 
00351   {
00352     std::cout << "\nCreated empty ALUConformGrid<"<<dim<<","<<dimworld <<">. \n\n";
00353   }
00354   enum {dimension=BaseType::dimension,dimensionworld=BaseType::dimensionworld};
00355   enum { refineStepsForHalf = 2 };
00356   typedef BaseType::ctype ctype;
00357   typedef BaseType::GridFamily GridFamily;
00358   typedef GridFamily::Traits Traits;
00359   typedef BaseType::LocalIdSetImp LocalIdSetImp;
00360   typedef Traits :: GlobalIdSet GlobalIdSet;
00361   typedef Traits :: LocalIdSet LocalIdSet;
00362   typedef GridFamily :: LevelIndexSetImp  LevelIndexSetImp;
00363   typedef GridFamily :: LeafIndexSetImp  LeafIndexSetImp;
00364   typedef BaseType::LeafIteratorImp LeafIteratorImp;
00365   typedef Traits::Codim<0>::LeafIterator LeafIteratorType;
00366   typedef Traits::Codim<0>::LeafIterator LeafIterator;
00367   typedef BaseType::HierarchicIteratorImp HierarchicIteratorImp;
00368 
00369   template< PartitionIteratorType pitype >
00370   struct Partition
00371   {
00372     typedef Dune::GridView< DefaultLevelGridViewTraits< const This, pitype > >
00373       LevelGridView;
00374     typedef Dune::GridView< DefaultLeafGridViewTraits< const This, pitype > >
00375       LeafGridView;
00376   };
00377 
00378   typedef Partition< All_Partition > :: LevelGridView LevelGridView;
00379   typedef Partition< All_Partition > :: LeafGridView LeafGridView;
00380 
00381   template< PartitionIteratorType pitype >
00382   typename Partition< pitype >::LevelGridView levelView ( int level ) const
00383   {
00384     typedef typename Partition< pitype >::LevelGridView LevelGridView;
00385     typedef typename LevelGridView::GridViewImp LevelGridViewImp;
00386     return LevelGridView( LevelGridViewImp( *this, level ) );
00387   }
00388 
00389   template< PartitionIteratorType pitype >
00390   typename Partition< pitype >::LeafGridView leafView () const
00391   {
00392     typedef typename Partition< pitype >::LeafGridView LeafGridView;
00393     typedef typename LeafGridView::GridViewImp LeafGridViewImp;
00394     return LeafGridView( LeafGridViewImp( *this ) );
00395   }
00396 
00397   LevelGridView levelView ( int level ) const
00398   {
00399     typedef LevelGridView::GridViewImp LevelGridViewImp;
00400     return LevelGridView( LevelGridViewImp( *this, level ) );
00401   }
00402 
00403   LeafGridView leafView () const
00404   {
00405     typedef LeafGridView::GridViewImp LeafGridViewImp;
00406     return LeafGridView( LeafGridViewImp( *this ) );
00407   }
00408  
00409 private:
00410   friend class Conversion< ALUConformGrid<dimension,dimensionworld> , HasObjectStream > ;
00411   friend class Conversion< const ALUConformGrid<dimension,dimensionworld> , HasObjectStream > ;
00412 
00413   friend class Conversion< ALUConformGrid<dimension,dimensionworld> , HasHierarchicIndexSet > ;
00414   friend class Conversion< const ALUConformGrid<dimension,dimensionworld> , HasHierarchicIndexSet > ;
00415   
00417     ALUConformGrid( const ALUConformGrid & g ) ; // : BaseType(g) {}
00418   
00420     ALUConformGrid<dim,dimworld>& 
00421     operator = (const ALUConformGrid& g); 
00422  };
00423 
00424 } //end  namespace Dune 
00425 #endif

Generated on Sun Nov 15 22:28:39 2009 for dune-grid by  doxygen 1.5.6