dune-grid  2.2.0
geometrygrid/gridfamily.hh
Go to the documentation of this file.
00001 #ifndef DUNE_GEOGRID_GRIDFAMILY_HH
00002 #define DUNE_GEOGRID_GRIDFAMILY_HH
00003 
00004 #include <dune/common/static_assert.hh>
00005 
00006 #include <dune/grid/common/grid.hh>
00007 #include <dune/grid/geometrygrid/capabilities.hh>
00008 #include <dune/grid/geometrygrid/declaration.hh>
00009 #include <dune/grid/geometrygrid/entity.hh>
00010 #include <dune/grid/geometrygrid/entityseed.hh>
00011 #include <dune/grid/geometrygrid/entitypointer.hh>
00012 #include <dune/grid/geometrygrid/geometry.hh>
00013 #include <dune/grid/geometrygrid/intersection.hh>
00014 #include <dune/grid/geometrygrid/intersectioniterator.hh>
00015 #include <dune/grid/geometrygrid/iterator.hh>
00016 #include <dune/grid/geometrygrid/idset.hh>
00017 #include <dune/grid/geometrygrid/indexsets.hh>
00018 
00019 namespace Dune
00020 {
00021 
00025   namespace GeoGrid
00026   {
00027 
00028     // ExportParams
00029     // ------------
00030 
00031     template< class HG, class CF >
00032     class ExportParams
00033     {
00034       static const bool isCoordFunction = isCoordFunctionInterface< typename CF::Interface >::value;
00035       dune_static_assert( isCoordFunction, "Invalid CoordFunction." );
00036 
00037     public:
00038       typedef HG HostGrid;
00039       typedef CF CoordFunction;
00040     };
00041 
00042 
00043 
00044     // GridFamily
00045     // ----------
00046     
00047     template< class HG, class CF, class Allocator >
00048     struct GridFamily
00049     {
00050       struct Traits
00051       {
00052         typedef GeometryGrid< HG, CF, Allocator > Grid;
00053 
00054         typedef HG HostGrid;
00055         typedef CF CoordFunction;
00056 
00057         typedef typename HostGrid::ctype ctype;
00058 
00059         static const int dimension = HostGrid::dimension;
00060         static const int dimensionworld = CoordFunction::dimRange;
00061 
00062         typedef Dune::Intersection< const Grid, GeoGrid::LeafIntersection > LeafIntersection;
00063         typedef Dune::Intersection< const Grid, GeoGrid::LevelIntersection > LevelIntersection;
00064 
00065         typedef Dune::IntersectionIterator
00066           < const Grid, GeoGrid::LeafIntersectionIterator, GeoGrid::LeafIntersection >
00067           LeafIntersectionIterator;
00068         typedef Dune::IntersectionIterator
00069           < const Grid, GeoGrid::LevelIntersectionIterator, GeoGrid::LevelIntersection >
00070           LevelIntersectionIterator;
00071 
00072         typedef Dune::EntityIterator< 0, const Grid, GeoGrid::HierarchicIterator< const Grid > >
00073           HierarchicIterator;
00074 
00075         template< int codim >
00076         struct Codim
00077         {
00078           typedef Dune::GeoGrid::Geometry< dimension-codim, dimensionworld, const Grid > GeometryImpl;
00079           typedef Dune::Geometry< dimension-codim, dimensionworld, const Grid, Dune::GeoGrid::Geometry > Geometry;
00080           typedef typename HostGrid::template Codim< codim >::LocalGeometry LocalGeometry;
00081 
00082           typedef GeoGrid::EntityPointerTraits< codim, const Grid > EntityPointerTraits;
00083           typedef GeoGrid::EntityPointer< EntityPointerTraits > EntityPointerImpl;
00084           typedef Dune::EntityPointer< const Grid, EntityPointerImpl > EntityPointer;
00085           typedef typename EntityPointerTraits::Entity Entity;
00086 
00087           typedef GeoGrid::EntitySeed< codim, const Grid > EntitySeed;
00088 
00089           template< PartitionIteratorType pitype >
00090           struct Partition
00091           {
00092             typedef GeoGrid::LeafIteratorTraits< codim, pitype, const Grid > LeafIteratorTraits;
00093             typedef Dune::EntityIterator< codim, const Grid, GeoGrid::Iterator< LeafIteratorTraits > > LeafIterator;
00094 
00095             typedef GeoGrid::LevelIteratorTraits< codim, pitype, const Grid > LevelIteratorTraits;
00096             typedef Dune::EntityIterator< codim, const Grid, GeoGrid::Iterator< LevelIteratorTraits > > LevelIterator;
00097           };
00098 
00099           typedef typename Partition< All_Partition >::LeafIterator LeafIterator;
00100           typedef typename Partition< All_Partition >::LevelIterator LevelIterator;
00101         };
00102 
00103         typedef GeoGrid::IndexSet< const Grid, typename HostGrid::Traits::LeafIndexSet >
00104           LeafIndexSet;
00105         typedef GeoGrid::IndexSet< const Grid, typename HostGrid::Traits::LevelIndexSet >
00106           LevelIndexSet;
00107 
00108         typedef GeoGrid::IdSet< const Grid, typename HostGrid::Traits::GlobalIdSet >
00109           GlobalIdSet;
00110         typedef GeoGrid::IdSet< const Grid, typename HostGrid::Traits::LocalIdSet >
00111           LocalIdSet;
00112 
00113         typedef typename HostGrid::Traits::CollectiveCommunication CollectiveCommunication;
00114 
00115         template< PartitionIteratorType pitype >
00116         struct Partition
00117         {
00118           typedef Dune::GridView< DefaultLeafGridViewTraits< const Grid, pitype > >
00119             LeafGridView;
00120           typedef Dune::GridView< DefaultLevelGridViewTraits< const Grid, pitype > >
00121             LevelGridView;
00122         };
00123       };
00124     };
00125 
00126   } // namespace GeoGrid
00127 
00128 } // namespace Dune
00129 
00130 #endif // #ifndef DUNE_GEOGRID_GRIDFAMILY_HH