dune-grid  2.2.0
albertagrid/gridfamily.hh
Go to the documentation of this file.
00001 #ifndef DUNE_ALBERTAGRID_GRIDFAMILTY_HH
00002 #define DUNE_ALBERTAGRID_GRIDFAMILTY_HH
00003 
00009 #include <dune/common/collectivecommunication.hh>
00010 
00011 #include <dune/grid/common/geometry.hh>
00012 
00013 #include <dune/grid/common/entity.hh>
00014 #include <dune/grid/common/entitypointer.hh>
00015 #include <dune/grid/common/intersection.hh>
00016 #include <dune/grid/common/intersectioniterator.hh>
00017 #include <dune/grid/common/entityiterator.hh>
00018 
00019 #include <dune/grid/albertagrid/misc.hh>
00020 #include <dune/grid/albertagrid/gridview.hh>
00021 
00022 #if HAVE_ALBERTA
00023 
00024 namespace Dune 
00025 {
00026 
00027   // External Forward Declarations
00028   // -----------------------------
00029 
00030   template< int dim, int dimworld >
00031   class AlbertaGrid;
00032 
00033   template< int codim, int dim, class GridImp >
00034   class AlbertaGridEntity;
00035 
00036   template< int codim, class GridImp >
00037   class AlbertaGridEntityPointer;
00038 
00039   template< int codim, class Grid >
00040   class AlbertaGridEntitySeed;
00041 
00042   template< int mydim, int cdim, class GridImp >
00043   class AlbertaGridGeometry;
00044 
00045   template< int mydim, int cdim, class GridImp >
00046   class AlbertaGridGlobalGeometry;
00047   
00048   template< int dim, int dimworld >
00049   class AlbertaGridHierarchicIndexSet;
00050 
00051   template< class GridImp >
00052   class AlbertaGridHierarchicIterator;
00053 
00054   template< class GridImp >
00055   class AlbertaGridLeafIntersection;
00056 
00057   template< class GridImp >
00058   class AlbertaGridLeafIntersectionIterator;
00059 
00060   template< int dim, int dimworld >
00061   class AlbertaGridIdSet;
00062 
00063   template< int dim, int dimworld >
00064   class AlbertaGridIndexSet;
00065 
00066   template< int codim, PartitionIteratorType pitype, class GridImp >
00067   class AlbertaGridLeafIterator;
00068 
00069   template< int codim, PartitionIteratorType pitype, class GridImp >
00070   class AlbertaGridLevelIterator;
00071 
00072 
00073 
00074 
00075   // AlbertaGridFamily
00076   // -----------------
00077 
00078   template <int dim, int dimworld> 
00079   struct AlbertaGridFamily 
00080   {
00081     typedef AlbertaGrid< dim, dimworld > GridImp;
00082 
00083     typedef Alberta::Real ctype;
00084 
00085     static const int dimension = dim;
00086     static const int dimensionworld = dimworld;
00087 
00088     typedef AlbertaGridIndexSet< dim, dimworld > LevelIndexSetImp;
00089     typedef AlbertaGridIndexSet< dim, dimworld > LeafIndexSetImp;
00090 
00091     typedef AlbertaGridIdSet< dim, dimworld > IdSetImp;
00092     typedef unsigned int IdType;
00093 
00094     struct Traits
00095     {
00096       typedef GridImp Grid;
00097 
00098       typedef Dune::Intersection< const GridImp, AlbertaGridLeafIntersection > LeafIntersection;
00099       typedef Dune::Intersection< const GridImp, AlbertaGridLeafIntersection > LevelIntersection;
00100       typedef Dune::IntersectionIterator
00101         < const GridImp, AlbertaGridLeafIntersectionIterator, AlbertaGridLeafIntersection >
00102         LeafIntersectionIterator;
00103       typedef Dune::IntersectionIterator
00104         < const GridImp, AlbertaGridLeafIntersectionIterator, AlbertaGridLeafIntersection >
00105         LevelIntersectionIterator;
00106 
00107       typedef Dune::EntityIterator< 0, const GridImp, AlbertaGridHierarchicIterator< const GridImp > > HierarchicIterator;
00108 
00109       typedef IdType GlobalIdType;
00110       typedef IdType LocalIdType;
00111 
00112       template< int cd >
00113       struct Codim
00114       {
00115         // IMPORTANT: Codim<codim>::Geometry == Geometry<dim-codim,dimw>
00116         typedef AlbertaGridGlobalGeometry< dim-cd, dimworld, const GridImp > GeometryImpl;
00117         typedef AlbertaGridGeometry< dim-cd, dim, const GridImp > LocalGeometryImpl;
00118         typedef Dune::Geometry< dim-cd, dimworld, const GridImp, AlbertaGridGlobalGeometry > Geometry;
00119         typedef Dune::Geometry< dim-cd, dim, const GridImp, AlbertaGridGeometry > LocalGeometry;
00120 
00121         typedef Dune::Entity< cd, dim, const GridImp, AlbertaGridEntity > Entity;
00122 
00123         typedef AlbertaGridEntityPointer< cd, const GridImp > EntityPointerImpl;
00124         typedef Dune::EntityPointer< const GridImp, EntityPointerImpl > EntityPointer;
00125         typedef AlbertaGridEntitySeed< cd, const GridImp > EntitySeed;
00126 
00127         template <PartitionIteratorType pitype>
00128         struct Partition
00129         {
00130           typedef Dune::EntityIterator< cd, const GridImp, AlbertaGridLevelIterator< cd, pitype, const GridImp > > LevelIterator;
00131           typedef Dune::EntityIterator< cd, const GridImp, AlbertaGridLeafIterator< cd, pitype, const GridImp > > LeafIterator;
00132         };
00133 
00134         typedef typename Partition< All_Partition >::LevelIterator LevelIterator;
00135         typedef typename Partition< All_Partition >::LeafIterator LeafIterator;
00136       };
00137 
00138       template <PartitionIteratorType pitype>
00139       struct Partition
00140       {
00141         typedef Dune::GridView<AlbertaLevelGridViewTraits<const GridImp,pitype> > LevelGridView;
00142         typedef Dune::GridView<AlbertaLeafGridViewTraits<const GridImp,pitype> > LeafGridView;
00143       };
00144 
00145       typedef IndexSet< GridImp, LevelIndexSetImp, int > LevelIndexSet;
00146       typedef IndexSet< GridImp, LeafIndexSetImp, int > LeafIndexSet;
00147       typedef AlbertaGridHierarchicIndexSet< dim, dimworld > HierarchicIndexSet;
00148       typedef IdSet<GridImp,IdSetImp,IdType> GlobalIdSet;
00149       typedef IdSet<GridImp,IdSetImp,IdType> LocalIdSet;
00150 
00151       typedef Dune::CollectiveCommunication< No_Comm > CollectiveCommunication;
00152     };
00153   };
00154 
00155 }
00156 
00157 #endif // #if HAVE_ALBERTA
00158 
00159 #endif // #ifndef DUNE_ALBERTAGRID_GRIDFAMILTY_HH