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