dune-grid  2.1.1
common/grid.hh
Go to the documentation of this file.
00001 #ifndef DUNE_GRID_HH
00002 #define DUNE_GRID_HH
00003 
00007 // system includes 
00008 #include <iostream>
00009 #include <string>
00010 
00011 // dune-common includes 
00012 #include <dune/common/fvector.hh>
00013 #include <dune/common/typetraits.hh>
00014 #include <dune/common/geometrytype.hh>
00015 
00016 // local includes 
00017 #include <dune/grid/common/gridenums.hh>
00018 #include <dune/grid/common/exceptions.hh>
00019 #include <dune/grid/common/capabilities.hh>
00020 #include <dune/grid/common/datahandleif.hh>
00021 #include <dune/grid/common/gridview.hh>
00022 #include <dune/grid/common/defaultgridview.hh>
00023 
00024 // inlcude this file after all other, because other files might undef the
00025 // macros that are defined in that file 
00026 #include <dune/common/bartonnackmanifcheck.hh>
00027 
00028 namespace Dune {
00029 
00340 // Forward Declarations
00341 // --------------------
00342 
00343 template<int mydim, int cdim, class GridImp,template<int,int,class> class GeometryImp> class Geometry;
00344 // dim is necessary because Entity will be specialized for codim==0 _and_ codim==dim
00345 // EntityImp gets GridImp as 3rd template parameter to distinguish between const and mutable grid
00346 template<int codim, int dim, class GridImp,template<int,int,class> class EntityImp> class Entity;
00347 template<class GridImp, class EntityPointerImp> class EntityPointer;
00348 template< int codim, class Grid, class IteratorImp > class EntityIterator;
00349 template<class GridImp, template<class> class IntersectionImp> class Intersection;
00350 template<class GridImp, template<class> class IntersectionIteratorImp, template<class> class IntersectionImp> class IntersectionIterator;
00351 template<class GridImp> class GenericLeafIterator;
00352 template<class GridImp, class IndexSetImp, class IndexTypeImp=unsigned int> class IndexSet;
00353 template<class GridImp, class IdSetImp, class IdTypeImp> class IdSet;
00354 
00355 
00356 //************************************************************************
00357 // G R I D
00358 //************************************************************************
00359 
00378 template< int dim, int dimworld, class ct, class GridFamily>  
00379 class Grid {
00380   typedef typename GridFamily::Traits::Grid GridImp;
00381   typedef Grid<dim,dimworld,ct,GridFamily> ThisType;
00382 public:
00383 
00384   //===========================================================
00388   //===========================================================
00389 
00391   enum { 
00393     dimension=dim 
00394   };
00395 
00397   enum { 
00399     dimensionworld=dimworld 
00400   };
00402 
00403   //===========================================================
00407   //===========================================================
00408 
00410   template <PartitionIteratorType pitype>
00411   struct Partition
00412   {
00413     typedef typename GridFamily::Traits::template Partition<pitype>::LevelGridView
00414        LevelGridView;
00415     typedef typename GridFamily::Traits::template Partition<pitype>::LeafGridView
00416        LeafGridView;
00417   };
00419   typedef typename Partition< All_Partition > :: LevelGridView LevelGridView;
00420   typedef typename Partition< All_Partition > :: LeafGridView LeafGridView;
00421   
00422 
00427   template <int cd>
00428   struct Codim
00429   {
00431     typedef typename GridFamily::Traits::template Codim<cd>::Geometry Geometry;
00432 
00434     typedef typename GridFamily::Traits::template Codim<cd>::LocalGeometry LocalGeometry;
00435 
00437     typedef typename GridFamily::Traits::template Codim<cd>::Entity Entity;
00438 
00440     typedef typename GridFamily::Traits::template Codim<cd>::EntityPointer EntityPointer;
00441 
00443     typedef typename GridFamily::Traits::template Codim<cd>::EntitySeed    EntitySeed;
00444 
00446     template <PartitionIteratorType pitype>
00447     struct Partition
00448     {
00455       typedef typename GridFamily::Traits::template Codim<cd>::template Partition<pitype>::LevelIterator LevelIterator;
00462       typedef typename GridFamily::Traits::template Codim<cd>::template Partition<pitype>::LeafIterator LeafIterator;
00463     };
00464   
00467     typedef typename GridFamily::Traits::template Codim<cd>::LevelIterator LevelIterator;
00468 
00471     typedef typename GridFamily::Traits::template Codim<cd>::LeafIterator LeafIterator;
00472   };
00473 
00477   typedef typename GridFamily::Traits::LeafIntersection LeafIntersection;
00478 
00482   typedef typename GridFamily::Traits::LevelIntersection LevelIntersection;
00483 
00489   typedef typename GridFamily::Traits::LeafIntersectionIterator LeafIntersectionIterator;
00490 
00496   typedef typename GridFamily::Traits::LevelIntersectionIterator LevelIntersectionIterator;
00497 
00503   typedef typename GridFamily::Traits::HierarchicIterator HierarchicIterator;
00504 
00509   typedef typename GridFamily::Traits::LevelIndexSet LevelIndexSet;
00510 
00515   typedef typename GridFamily::Traits::LeafIndexSet LeafIndexSet;
00516 
00523   typedef typename GridFamily::Traits::GlobalIdSet GlobalIdSet;
00524 
00530   typedef typename GridFamily::Traits::LocalIdSet LocalIdSet;
00531 
00536   typedef typename GridFamily::Traits::CollectiveCommunication CollectiveCommunication;
00537 
00539   typedef ct ctype;
00541 
00542 
00543   //===========================================================
00547   //===========================================================
00548 
00552   int maxLevel() const
00553   {
00554     CHECK_INTERFACE_IMPLEMENTATION(asImp().maxLevel());
00555     return asImp().maxLevel();
00556   }
00557 
00559   int size (int level, int codim) const
00560   {
00561     CHECK_INTERFACE_IMPLEMENTATION(asImp().size(level,codim));
00562     return asImp().size(level,codim);
00563   }
00564 
00566   int size (int codim) const
00567   {
00568     CHECK_INTERFACE_IMPLEMENTATION(asImp().size(codim));
00569     return asImp().size(codim);
00570   }
00571 
00573   int size (int level, GeometryType type) const
00574   {
00575     CHECK_INTERFACE_IMPLEMENTATION(asImp().size(level,type));
00576     return asImp().size(level,type);
00577   }
00578 
00580   int size (GeometryType type) const
00581   {
00582     CHECK_INTERFACE_IMPLEMENTATION(asImp().size(type));
00583     return asImp().size(type);
00584   }
00586 
00587 
00592   size_t numBoundarySegments () const
00593   {
00594     CHECK_INTERFACE_IMPLEMENTATION( asImp().numBoundarySegments());
00595     return asImp().numBoundarySegments();
00596   }
00597 
00598   //===========================================================
00602   //===========================================================
00603 
00605   template<PartitionIteratorType pitype>
00606   typename Partition<pitype>::LevelGridView levelView(int level) const {
00607     CHECK_INTERFACE_IMPLEMENTATION((asImp().template levelView<pitype>(level)));
00608     return asImp().template levelView<pitype>(level);
00609   }
00610 
00612   template<PartitionIteratorType pitype>
00613   typename Partition<pitype>::LeafGridView leafView() const {
00614     CHECK_INTERFACE_IMPLEMENTATION((asImp().template leafView<pitype>()));
00615     return asImp().template leafView<pitype>();
00616   }
00617 
00619   LevelGridView levelView(int level) const {
00620     CHECK_INTERFACE_IMPLEMENTATION((asImp().levelView(level)));
00621     return asImp().levelView(level);
00622   }
00623 
00625   LeafGridView leafView() const {
00626     CHECK_INTERFACE_IMPLEMENTATION((asImp().leafView()));
00627     return asImp().leafView();
00628   }
00629 
00631 
00632 
00633   //===========================================================
00637   //===========================================================
00638 
00640   template<int cd, PartitionIteratorType pitype>
00641   typename Codim<cd>::template Partition<pitype>::LevelIterator lbegin (int level) const
00642   {
00643     CHECK_INTERFACE_IMPLEMENTATION((asImp().template lbegin<cd,pitype>(level)));
00644     return asImp().template lbegin<cd,pitype>(level);
00645   }
00646 
00648   template<int cd, PartitionIteratorType pitype>
00649   typename Codim<cd>::template Partition<pitype>::LevelIterator lend (int level) const
00650   {
00651     CHECK_INTERFACE_IMPLEMENTATION((asImp().template lend<cd,pitype>(level)));
00652     return asImp().template lend<cd,pitype>(level);
00653   }
00654 
00656   template<int cd>
00657   typename Codim<cd>::template Partition<All_Partition>::LevelIterator lbegin (int level) const
00658   {
00659     CHECK_INTERFACE_IMPLEMENTATION((asImp().template lbegin<cd>(level)));
00660     return asImp().template lbegin<cd>(level);
00661   }
00662 
00664   template<int cd>
00665   typename Codim<cd>::template Partition<All_Partition>::LevelIterator lend (int level) const
00666   {
00667     CHECK_INTERFACE_IMPLEMENTATION((asImp().template lend<cd>(level)));
00668     return asImp().template lend<cd>(level);
00669   }
00670 
00672   template<int cd, PartitionIteratorType pitype>
00673   typename Codim<cd>::template Partition<pitype>::LeafIterator leafbegin () const
00674   {
00675     CHECK_INTERFACE_IMPLEMENTATION((asImp().template leafbegin<cd,pitype>()));
00676     return asImp().template leafbegin<cd,pitype>();
00677   }
00678 
00680   template<int cd, PartitionIteratorType pitype>
00681   typename Codim<cd>::template Partition<pitype>::LeafIterator leafend () const
00682   {
00683     CHECK_INTERFACE_IMPLEMENTATION((asImp().template leafend<cd,pitype>()));
00684     return asImp().template leafend<cd,pitype>();
00685   }
00686 
00688   template<int cd>
00689   typename Codim<cd>::template Partition<All_Partition>::LeafIterator leafbegin () const
00690   {
00691     CHECK_INTERFACE_IMPLEMENTATION((asImp().template leafbegin<cd,All_Partition>()));
00692     return asImp().template leafbegin<cd,All_Partition>();
00693   }
00694 
00696   template<int cd>
00697   typename Codim<cd>::template Partition<All_Partition>::LeafIterator leafend () const
00698   {
00699     CHECK_INTERFACE_IMPLEMENTATION((asImp().template leafend<cd,All_Partition>()));
00700     return asImp().template leafend<cd,All_Partition>();
00701   }
00703 
00704 
00705   //===========================================================
00709   //===========================================================
00710 
00712   const GlobalIdSet &globalIdSet () const
00713   {
00714     CHECK_INTERFACE_IMPLEMENTATION(asImp().globalIdSet());
00715         return asImp().globalIdSet();
00716   }
00717   
00719   const LocalIdSet &localIdSet () const
00720   {
00721     CHECK_INTERFACE_IMPLEMENTATION(asImp().localIdSet());
00722           return asImp().localIdSet();
00723   }
00724 
00726   const LevelIndexSet &levelIndexSet ( int level ) const
00727   {
00728     CHECK_INTERFACE_IMPLEMENTATION(asImp().levelIndexSet(level));
00729           return asImp().levelIndexSet(level);
00730   }
00731 
00733   const LeafIndexSet &leafIndexSet () const
00734   {
00735     CHECK_INTERFACE_IMPLEMENTATION(asImp().leafIndexSet());
00736         return asImp().leafIndexSet();
00737   }
00739 
00740 
00741   //===========================================================
00745   //===========================================================
00746 
00752   void globalRefine (int refCount)
00753   {
00754     CHECK_AND_CALL_INTERFACE_IMPLEMENTATION(asImp().globalRefine(refCount));
00755           return;
00756   }
00757 
00765   bool mark( int refCount, const typename Codim<0>::Entity & e )
00766   {
00767     return asImp().mark(refCount,e);
00768   }
00769 
00776   int getMark(const typename Codim<0>::Entity & e) const
00777   {
00778     return asImp().getMark(e);
00779   }
00780 
00787   bool preAdapt ()
00788   {
00789         return asImp().preAdapt();
00790   }
00791 
00806   bool adapt ()
00807   {
00808           return asImp().adapt();
00809   }
00810   
00815   void postAdapt()
00816   {
00817           return asImp().postAdapt();
00818   }
00820 
00821 
00822   //===========================================================
00826   //===========================================================
00827 
00829   int overlapSize (int level, int codim) const
00830   {
00831     CHECK_INTERFACE_IMPLEMENTATION(asImp().overlapSize(level,codim));
00832     return asImp().overlapSize(level,codim);
00833   }
00834   
00836   int overlapSize (int codim) const
00837   {
00838     CHECK_INTERFACE_IMPLEMENTATION(asImp().overlapSize(codim));
00839     return asImp().overlapSize(codim);
00840   }
00841   
00843   int ghostSize (int level, int codim) const
00844   {
00845     CHECK_INTERFACE_IMPLEMENTATION(asImp().ghostSize(level,codim));
00846     return asImp().ghostSize(level,codim);
00847   }
00848 
00850   int ghostSize (int codim) const
00851   {
00852     CHECK_INTERFACE_IMPLEMENTATION(asImp().ghostSize(codim));
00853     return asImp().ghostSize(codim);
00854   }
00855 
00859   template<class DataHandleImp, class DataTypeImp>
00860   void communicate (CommDataHandleIF<DataHandleImp,DataTypeImp> & data, InterfaceType iftype, CommunicationDirection dir, int level) const
00861   {
00862     CHECK_AND_CALL_INTERFACE_IMPLEMENTATION((asImp().template communicate<DataHandleImp,DataTypeImp>(data,iftype,dir,level)));
00863         return;
00864   }
00865 
00869   template<class DataHandleImp, class DataTypeImp>
00870   void communicate (CommDataHandleIF<DataHandleImp,DataTypeImp> & data, InterfaceType iftype, CommunicationDirection dir) const
00871   {
00872     CHECK_AND_CALL_INTERFACE_IMPLEMENTATION((asImp().template communicate<DataHandleImp,DataTypeImp>(data,iftype,dir)));
00873         return;
00874   }
00875 
00877   const CollectiveCommunication &comm () const
00878   {
00879     CHECK_INTERFACE_IMPLEMENTATION(asImp().comm());
00880         return asImp().comm();
00881   }
00883 
00887   bool loadBalance() 
00888   {
00889     CHECK_INTERFACE_IMPLEMENTATION(asImp().loadBalance());
00890     return asImp().loadBalance(); 
00891   }
00892 
00897   template<class DataHandle>
00898   bool loadBalance (DataHandle& data)
00899   {
00900     CHECK_INTERFACE_IMPLEMENTATION(asImp().loadBalance(data));
00901     return asImp().loadBalance(data); 
00902   }
00903 
00905   template < class EntitySeed >
00906   typename Codim< EntitySeed :: codimension > :: EntityPointer
00907   entityPointer( const EntitySeed& seed ) const 
00908   {
00909     CHECK_INTERFACE_IMPLEMENTATION( asImp().entityPointer( seed ) );
00910     return asImp().entityPointer( seed );
00911   }
00912 protected:
00914   GridImp& asImp () {return static_cast<GridImp &> (*this);}
00916   const GridImp& asImp () const {return static_cast<const GridImp &>(*this);}
00917 };
00918 
00919 #undef CHECK_INTERFACE_IMPLEMENTATION
00920 #undef CHECK_AND_CALL_INTERFACE_IMPLEMENTATION
00921 
00922 
00923 //************************************************************************
00924 //
00925 //  Default Methods of Grid 
00926 //
00927 //************************************************************************
00928 //
00929 
00930 //- helper class for entity seed implementation to provide a default 
00931 //  implementation based on entity pointer until entity is implemented 
00932 //  in every grid  
00933 struct EntitySeedHelper {
00934 
00935   template <class S, class EP>
00936   struct SeedReturner
00937   {
00938     typedef S EntitySeed ;
00939     template <class E>
00940     static const EntitySeed& generateSeed ( const E& entity )
00941     {
00942       DUNE_THROW(NotImplemented,"Method EntityImp::seed() not implemented");
00943       return *((EntitySeed *)0);
00944     }
00945   };
00946 
00947   template <class EP>
00948   struct SeedReturner< EP, EP >
00949   {
00950     template <class E>
00951     static EP generateSeed ( const E& entity )
00952     {
00953       return EP( entity );
00954     }
00955   };
00956 
00957   template <class Seed, class EP>
00958   struct EntityPointerReturner
00959   {
00960     static const EP& generatePointer ( const Seed& seed )
00961     {
00962       DUNE_THROW(NotImplemented,"Method Grid::entityPointer( seed ) not implemented");
00963       return *((EP *)0);
00964     }
00965   };
00966 
00967   template <class EP>
00968   struct EntityPointerReturner< EP, EP >
00969   {
00970     static const EP& generatePointer ( const EP& seed )
00971     {
00972       return seed ;
00973     }
00974   };
00975 };
00976 
00977 
00978 
01017 template<int dim, 
01018          int dimworld, 
01019          class ct, 
01020          class GridFamily>  
01021 class GridDefaultImplementation : public Grid <dim,dimworld,ct,GridFamily> 
01022 {
01023   typedef typename GridFamily::Traits::Grid GridImp;
01024 
01025 public:
01031   typedef typename GridFamily::Traits Traits;
01032 
01034   template<PartitionIteratorType pitype>
01035   typename Traits::template Partition<pitype>::LevelGridView 
01036   levelView(int level) const {
01037     typedef typename Traits::template Partition<pitype>::LevelGridView View;
01038     typedef typename View::GridViewImp ViewImp;
01039     return View(ViewImp(asImp(),level));
01040   }
01041 
01043   template<PartitionIteratorType pitype>
01044   typename Traits::template Partition<pitype>::LeafGridView leafView() const {
01045     typedef typename Traits::template Partition<pitype>::LeafGridView View;
01046     typedef typename View::GridViewImp ViewImp;
01047     return View(ViewImp(asImp()));
01048   }
01049 
01051   typename Traits::template Partition<All_Partition>::LevelGridView 
01052   levelView(int level) const {
01053     typedef typename Traits::template Partition<All_Partition>::LevelGridView View;
01054     typedef typename View::GridViewImp ViewImp;
01055     return View(ViewImp(asImp(),level));
01056   }
01057 
01059   typename Traits::template Partition<All_Partition>::LeafGridView 
01060   leafView() const {
01061     typedef typename Traits::template Partition<All_Partition>::LeafGridView View;
01062     typedef typename View::GridViewImp ViewImp;
01063     return View(ViewImp(asImp()));
01064   }
01065 
01066   //***************************************************************
01067   //  Interface for Adaptation
01068   //***************************************************************
01069 
01092   bool mark( int refCount, const typename Traits :: template Codim<0>::Entity & e )
01093   {
01094     return false;
01095   }
01096 
01104   int getMark ( const typename Traits::template Codim< 0 >::Entity &e ) const
01105   {
01106     return 0; 
01107   }
01108 
01116   bool adapt ()    { return false; }
01117   
01119   bool preAdapt () { return false; }
01120 
01122   void postAdapt() {}
01123 
01125   int ghostSize (int level, int codim) const { return 0; } 
01126   
01128   int overlapSize (int level, int codim) const { return 0; } 
01129 
01131   int ghostSize (int codim) const { return 0; } 
01132   
01134   int overlapSize (int codim) const { return 0; }
01135 
01137   template<class DataHandleImp, class DataTypeImp>
01138   void communicate (CommDataHandleIF<DataHandleImp,DataTypeImp> & data, 
01139                     InterfaceType iftype, CommunicationDirection dir, int level) const
01140   {
01141   }
01142 
01144   template<class DataHandleImp, class DataTypeImp>
01145   void communicate (CommDataHandleIF<DataHandleImp,DataTypeImp> & data, 
01146                     InterfaceType iftype, CommunicationDirection dir) const
01147   {
01148   }
01149 
01151   bool loadBalance() 
01152   {
01153     return false; 
01154   }
01155 
01157   template<class DataHandle>
01158   bool loadBalance (DataHandle& data)
01159   {
01160     return false; 
01161   }
01162 
01165   template < class EntitySeed >
01166   DUNE_DEPRECATED
01167   typename Traits :: template Codim< EntitySeed :: codimension > :: EntityPointer
01168   entityPointer( const EntitySeed& seed ) const 
01169   {
01170     typedef typename Traits :: template Codim< EntitySeed :: codimension > :: EntityPointer  EntityPointer ;
01171 
01172     // the default implementation is only available 
01173     // if the type of entity seed is EntityPointer
01174     return EntitySeedHelper :: 
01175       EntityPointerReturner< EntitySeed, EntityPointer > :: generatePointer( seed );
01176   }
01177 
01178 protected:
01185   template<class T>
01186   class ReturnImplementationType : public T // implement friendship via subclassing
01187   {
01188   public:
01190     typedef typename T::ImplementationType ImplementationType;
01191   private:
01192     // constructor in only need to compile 
01193     ReturnImplementationType(const T& t) : T(t) {}
01194   };
01195   
01196   template<class T> 
01197   class ReturnImplementationType<const T> : public T // implement friendship via subclassing
01198   {
01199   public:
01200     typedef const typename T::ImplementationType ImplementationType;
01201   private:  
01202     // constructor in only need to compile 
01203     ReturnImplementationType(const T& t) : T(t) {}
01204   };
01205 
01207   template <class InterfaceType>
01208   static typename ReturnImplementationType<InterfaceType>::ImplementationType & 
01209   getRealImplementation (InterfaceType &i) { return i.getRealImp(); }
01210 
01211 protected:
01212   using Grid< dim, dimworld, ct, GridFamily >::asImp;
01213 };
01214 
01228 template <int dim, int dimw, class GridImp,
01229           template<int,int,class> class GeometryImp,
01230           template<int,int,class> class EntityImp,
01231           template<int,class> class EntityPointerImp,
01232           template<int,PartitionIteratorType,class> class LevelIteratorImp,
01233           template<class> class LeafIntersectionImp,
01234           template<class> class LevelIntersectionImp,
01235           template<class> class LeafIntersectionIteratorImp,
01236           template<class> class LevelIntersectionIteratorImp,
01237           template<class> class HierarchicIteratorImp,
01238           template<int,PartitionIteratorType,class> class LeafIteratorImp,
01239                 class LevelIndexSetImp, class LeafIndexSetImp,
01240                 class GlobalIdSetImp, class GIDType, class LocalIdSetImp, class LIDType, class CCType,
01241                 template<class,PartitionIteratorType> class LevelGridViewTraits = DefaultLevelGridViewTraits,
01242           template<class,PartitionIteratorType> class LeafGridViewTraits = DefaultLeafGridViewTraits,
01243           template<int,class> class EntitySeedImp = EntityPointerImp,
01244           template<int,int,class> class LocalGeometryImp = GeometryImp
01245          >
01246 struct GridTraits
01247 {
01249   typedef GridImp Grid;
01250 
01252   typedef Dune::Intersection<const GridImp, LeafIntersectionImp>  LeafIntersection;
01254   typedef Dune::Intersection<const GridImp, LevelIntersectionImp> LevelIntersection;
01256   typedef Dune::IntersectionIterator<const GridImp, LeafIntersectionIteratorImp, LeafIntersectionImp>   LeafIntersectionIterator;
01258   typedef Dune::IntersectionIterator<const GridImp, LevelIntersectionIteratorImp, LevelIntersectionImp> LevelIntersectionIterator;
01259 
01261   typedef Dune::EntityIterator< 0, const GridImp, HierarchicIteratorImp< const GridImp > > HierarchicIterator;
01262 
01267   template <int cd>
01268   struct Codim
01269   {
01270   protected:  
01271     // class to extract whether we are using the default seed type or not 
01272     template <class Seed, class EPImpl >
01273     struct SeedDefault
01274     {
01275       typedef Seed EntitySeed ;     
01276     };
01277 
01278     // the default seed type is entity pointer until its implemented 
01279     template <class EPImpl>
01280     struct SeedDefault< EPImpl, EPImpl >
01281     {
01282       typedef Dune::EntityPointer<const GridImp,EntityPointerImp<cd,const GridImp> > EntitySeed ;
01283     };
01284 
01285   public:
01287 
01288     typedef Dune::Geometry<dim-cd, dimw, const GridImp, GeometryImp> Geometry;
01290     typedef Dune::Geometry<dim-cd, dim, const GridImp, LocalGeometryImp> LocalGeometry;
01292     // we could - if needed - introduce another struct for dimglobal of Geometry
01293     typedef Dune::Entity<cd, dim, const GridImp, EntityImp> Entity;
01294 
01296     typedef Dune::EntityPointer<const GridImp,EntityPointerImp<cd,const GridImp> > EntityPointer;
01297 
01299     typedef typename SeedDefault< EntitySeedImp<cd, const GridImp>, EntityPointerImp<cd,const GridImp> > :: EntitySeed  EntitySeed; 
01300     
01305     template <PartitionIteratorType pitype>
01306     struct Partition
01307     {
01309       typedef Dune::EntityIterator< cd, const GridImp, LevelIteratorImp< cd, pitype, const GridImp > > LevelIterator;
01311       typedef Dune::EntityIterator< cd, const GridImp, LeafIteratorImp< cd, pitype, const GridImp > > LeafIterator;
01312     };
01313 
01315     typedef typename Partition< All_Partition >::LeafIterator LeafIterator;
01316 
01318     typedef typename Partition< All_Partition >::LevelIterator LevelIterator;
01319     
01320   private:
01321     friend class Dune::Entity<cd, dim, const GridImp, EntityImp>;
01322     typedef EntityPointerImp<cd,const GridImp> EntityPointerImpl;
01323   };
01324 
01329   template <PartitionIteratorType pitype>
01330   struct Partition
01331   {
01333     typedef Dune::GridView<LevelGridViewTraits<const GridImp,pitype> > 
01334        LevelGridView;
01335     
01337     typedef Dune::GridView<LeafGridViewTraits<const GridImp,pitype> > 
01338        LeafGridView;
01339   };
01340 
01342   typedef IndexSet<const GridImp,LevelIndexSetImp> LevelIndexSet;
01344   typedef IndexSet<const GridImp,LeafIndexSetImp> LeafIndexSet;
01346   typedef IdSet<const GridImp,GlobalIdSetImp,GIDType> GlobalIdSet;
01348   typedef IdSet<const GridImp,LocalIdSetImp,LIDType> LocalIdSet;
01349 
01351   typedef CCType CollectiveCommunication;
01352 };
01353 
01354   // define of capabilties for the interface class 
01355   namespace Capabilities
01356   {
01357     // capabilities for the interface class depend on the implementation 
01358     template< int dim, int dimworld, typename ct, class GridFamily , int cdim >
01359     struct hasEntity< GridDefaultImplementation<dim,dimworld,ct,GridFamily>, cdim >
01360     {
01361       typedef GridDefaultImplementation<dim,dimworld,ct,GridFamily> GridType;
01362       typedef typename GridType::Traits::Grid GridImp;
01363       static const bool v = hasEntity<GridImp,cdim>::v;
01364     };
01365 
01366   } // end namespace Capabilities
01367 
01373   template <class InterfaceType>
01374   struct MakeableInterfaceObject : public InterfaceType
01375   {
01376     typedef typename InterfaceType::ImplementationType ImplementationType;
01378     explicit MakeableInterfaceObject ( const ImplementationType &realImp )
01379     : InterfaceType( realImp )
01380     {}
01381   };
01382 }
01383 
01384 #include "geometry.hh"
01385 #include "entity.hh"
01386 #include "entitypointer.hh"
01387 #include "intersection.hh"
01388 #include "intersectioniterator.hh"
01389 #include "entityiterator.hh"
01390 #include "indexidset.hh"
01391 
01392 #endif // #ifndef DUNE_GRID_HH