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
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
00080
00086 template<>
00087 class ALUSimplexGrid< 2, 2 >
00088 : public Dune::ALU2dGrid< 2, 2 >
00089 {
00090 typedef ALUSimplexGrid< 2, 2 > This;
00091
00092 typedef Dune::ALU2dGrid< 2, 2 > BaseType;
00093 enum { dim = 2 };
00094 enum { dimworld = 2 };
00095
00096 public:
00099 ALUSimplexGrid(const std::string macroName )
00100 : BaseType(macroName,1)
00101 {
00102 std::cout << "\nCreated serial ALUSimplexGrid<"<<dim<<","<<dimworld;
00103 std::cout <<"> from macro grid file '" << macroName << "'. \n\n";
00104 }
00106 ALUSimplexGrid( ) : BaseType(1)
00107 {
00108 std::cout << "\nCreated empty ALUSimplexGrid<"<<dim<<","<<dimworld <<">. \n\n";
00109 }
00110 enum {dimension=BaseType::dimension,dimensionworld=BaseType::dimensionworld};
00111 enum { refineStepsForHalf = 1 };
00112 typedef BaseType::ctype ctype;
00113 typedef BaseType::GridFamily GridFamily;
00114 typedef GridFamily::Traits Traits;
00115 typedef BaseType::LocalIdSetImp LocalIdSetImp;
00116 typedef Traits :: GlobalIdSet GlobalIdSet;
00117 typedef Traits :: LocalIdSet LocalIdSet;
00118 typedef GridFamily :: LevelIndexSetImp LevelIndexSetImp;
00119 typedef GridFamily :: LeafIndexSetImp LeafIndexSetImp;
00120 typedef BaseType::LeafIteratorImp LeafIteratorImp;
00121 typedef Traits::Codim<0>::LeafIterator LeafIteratorType;
00122 typedef Traits::Codim<0>::LeafIterator LeafIterator;
00123 typedef BaseType::HierarchicIteratorImp HierarchicIteratorImp;
00124
00125 template< PartitionIteratorType pitype >
00126 struct Partition
00127 {
00128 typedef Dune::GridView< DefaultLevelGridViewTraits< const This, pitype > >
00129 LevelGridView;
00130 typedef Dune::GridView< DefaultLeafGridViewTraits< const This, pitype > >
00131 LeafGridView;
00132 };
00133
00134 typedef Partition< All_Partition > :: LevelGridView LevelGridView;
00135 typedef Partition< All_Partition > :: LeafGridView LeafGridView;
00136
00137 template< PartitionIteratorType pitype >
00138 typename Partition< pitype >::LevelGridView levelView ( int level ) const
00139 {
00140 typedef typename Partition< pitype >::LevelGridView LevelGridView;
00141 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
00142 return LevelGridView( LevelGridViewImp( *this, level ) );
00143 }
00144
00145 template< PartitionIteratorType pitype >
00146 typename Partition< pitype >::LeafGridView leafView () const
00147 {
00148 typedef typename Partition< pitype >::LeafGridView LeafGridView;
00149 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
00150 return LeafGridView( LeafGridViewImp( *this ) );
00151 }
00152
00153 LevelGridView levelView ( int level ) const
00154 {
00155 typedef LevelGridView::GridViewImp LevelGridViewImp;
00156 return LevelGridView( LevelGridViewImp( *this, level ) );
00157 }
00158
00159 LeafGridView leafView () const
00160 {
00161 typedef LeafGridView::GridViewImp LeafGridViewImp;
00162 return LeafGridView( LeafGridViewImp( *this ) );
00163 }
00164
00165 private:
00166 friend class Conversion< ALUSimplexGrid<dimension,dimensionworld> , HasObjectStream > ;
00167 friend class Conversion< const ALUSimplexGrid<dimension,dimensionworld> , HasObjectStream > ;
00168
00169 friend class Conversion< ALUSimplexGrid<dimension,dimensionworld> , HasHierarchicIndexSet > ;
00170 friend class Conversion< const ALUSimplexGrid<dimension,dimensionworld> , HasHierarchicIndexSet > ;
00171
00173 ALUSimplexGrid( const ALUSimplexGrid & g ) ;
00174
00176 ALUSimplexGrid<dim,dimworld>&
00177 operator = (const ALUSimplexGrid& g);
00178 };
00179
00180 namespace Capabilities {
00192 template<int dim,int dimw, int cdim >
00193 struct hasEntity<Dune::ALUSimplexGrid<dim, dimw>, cdim >
00194 {
00195 static const bool v = true;
00196 };
00197
00201 template<int dim,int dimw>
00202 struct isParallel<const ALUSimplexGrid<dim, dimw> > {
00203 static const bool v = false;
00204 };
00205
00209 template<int dim,int dimw>
00210 struct isLevelwiseConforming< ALUSimplexGrid<dim,dimw> >
00211 {
00212 static const bool v = true;
00213 };
00214
00218 template<int dim,int dimw>
00219 struct hasHangingNodes< ALUSimplexGrid<dim,dimw> >
00220 {
00221 static const bool v = true;
00222 };
00223
00227 template<int dim,int dimw>
00228 struct hasBackupRestoreFacilities< ALUSimplexGrid<dim,dimw> >
00229 {
00230 static const bool v = true;
00231 };
00232
00233 }
00234
00258 template <int dim, int dimworld>
00259 class ALUConformGrid {};
00260
00266 template<>
00267 class ALUConformGrid< 2, 2 >
00268 : public Dune::ALU2dGrid< 2, 2 >
00269 {
00270 typedef ALUConformGrid< 2, 2 > This;
00271
00272 typedef Dune::ALU2dGrid<2,2> BaseType;
00273 enum { dim = 2 };
00274 enum { dimworld = 2 };
00275 public:
00278 ALUConformGrid(const std::string macroName )
00279 : BaseType(macroName)
00280 {
00281 std::cout << "\nCreated serial ALUConformGrid<"<<dim<<","<<dimworld;
00282 std::cout <<"> from macro grid file '" << macroName << "'. \n\n";
00283 }
00285 ALUConformGrid( ) : BaseType(0)
00286 {
00287 std::cout << "\nCreated empty ALUConformGrid<"<<dim<<","<<dimworld <<">. \n\n";
00288 }
00289 enum {dimension=BaseType::dimension,dimensionworld=BaseType::dimensionworld};
00290 enum { refineStepsForHalf = 2 };
00291 typedef BaseType::ctype ctype;
00292 typedef BaseType::GridFamily GridFamily;
00293 typedef GridFamily::Traits Traits;
00294 typedef BaseType::LocalIdSetImp LocalIdSetImp;
00295 typedef Traits :: GlobalIdSet GlobalIdSet;
00296 typedef Traits :: LocalIdSet LocalIdSet;
00297 typedef GridFamily :: LevelIndexSetImp LevelIndexSetImp;
00298 typedef GridFamily :: LeafIndexSetImp LeafIndexSetImp;
00299 typedef BaseType::LeafIteratorImp LeafIteratorImp;
00300 typedef Traits::Codim<0>::LeafIterator LeafIteratorType;
00301 typedef Traits::Codim<0>::LeafIterator LeafIterator;
00302 typedef BaseType::HierarchicIteratorImp HierarchicIteratorImp;
00303
00304 template< PartitionIteratorType pitype >
00305 struct Partition
00306 {
00307 typedef Dune::GridView< DefaultLevelGridViewTraits< const This, pitype > >
00308 LevelGridView;
00309 typedef Dune::GridView< DefaultLeafGridViewTraits< const This, pitype > >
00310 LeafGridView;
00311 };
00312
00313 typedef Partition< All_Partition > :: LevelGridView LevelGridView;
00314 typedef Partition< All_Partition > :: LeafGridView LeafGridView;
00315
00316 template< PartitionIteratorType pitype >
00317 typename Partition< pitype >::LevelGridView levelView ( int level ) const
00318 {
00319 typedef typename Partition< pitype >::LevelGridView LevelGridView;
00320 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
00321 return LevelGridView( LevelGridViewImp( *this, level ) );
00322 }
00323
00324 template< PartitionIteratorType pitype >
00325 typename Partition< pitype >::LeafGridView leafView () const
00326 {
00327 typedef typename Partition< pitype >::LeafGridView LeafGridView;
00328 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
00329 return LeafGridView( LeafGridViewImp( *this ) );
00330 }
00331
00332 LevelGridView levelView ( int level ) const
00333 {
00334 typedef LevelGridView::GridViewImp LevelGridViewImp;
00335 return LevelGridView( LevelGridViewImp( *this, level ) );
00336 }
00337
00338 LeafGridView leafView () const
00339 {
00340 typedef LeafGridView::GridViewImp LeafGridViewImp;
00341 return LeafGridView( LeafGridViewImp( *this ) );
00342 }
00343
00344 private:
00345 friend class Conversion< ALUConformGrid<dimension,dimensionworld> , HasObjectStream > ;
00346 friend class Conversion< const ALUConformGrid<dimension,dimensionworld> , HasObjectStream > ;
00347
00348 friend class Conversion< ALUConformGrid<dimension,dimensionworld> , HasHierarchicIndexSet > ;
00349 friend class Conversion< const ALUConformGrid<dimension,dimensionworld> , HasHierarchicIndexSet > ;
00350
00352 ALUConformGrid( const ALUConformGrid & g ) ;
00353
00355 ALUConformGrid<dim,dimworld>&
00356 operator = (const ALUConformGrid& g);
00357 };
00358
00359 namespace Capabilities {
00371 template<int dim,int dimw, int cdim >
00372 struct hasEntity<Dune::ALUConformGrid<dim, dimw>, cdim >
00373 {
00374 static const bool v = true;
00375 };
00376
00380 template<int dim,int dimw>
00381 struct isParallel<const ALUConformGrid<dim, dimw> > {
00382 static const bool v = false;
00383 };
00384
00388 template<int dim,int dimw>
00389 struct isLevelwiseConforming< ALUConformGrid<dim,dimw> >
00390 {
00391 static const bool v = false;
00392 };
00393
00397 template<int dim,int dimw>
00398 struct hasHangingNodes< ALUConformGrid<dim,dimw> >
00399 {
00400 static const bool v = false;
00401 };
00402
00406 template<int dim,int dimw>
00407 struct hasBackupRestoreFacilities< ALUConformGrid<dim,dimw> >
00408 {
00409 static const bool v = true;
00410 };
00411
00412 }
00413
00414 }
00415 #endif