dune-grid  2.2.0
hostgridaccess.hh
Go to the documentation of this file.
00001 #ifndef DUNE_GRID_HOSTGRIDACCESS_HH
00002 #define DUNE_GRID_HOSTGRIDACCESS_HH
00003 
00004 #include <string>
00005 
00006 namespace Dune
00007 {
00008 
00009   // External Forward Declarations
00010   // -----------------------------
00011 
00012   template< class HostGrid, class CoordFunction, class Allocator >
00013   class GeometryGrid;
00014 
00015 
00016 
00017   // HostGridAccess
00018   // --------------
00019 
00020   template< class Grid >
00021   struct HostGridAccess;
00022 
00023 
00024 
00032   template< class HG, class CoordFunction, class Allocator >
00033   struct HostGridAccess< GeometryGrid< HG, CoordFunction, Allocator > >
00034   {
00038     typedef GeometryGrid< HG, CoordFunction, Allocator > Grid;
00039     
00041     typedef typename Grid::HostGrid HostGrid;
00042  
00049     template< int codim >
00050     struct Codim 
00051     {
00053       typedef typename Grid::template Codim< codim >::Entity Entity;
00055       typedef typename Grid::template Codim< codim >::EntityPointer EntityPointer;
00056 
00058       typedef typename HostGrid::template Codim< codim >::Entity HostEntity;
00060       typedef typename HostGrid::template Codim< codim >::EntityPointer HostEntityPointer;
00061     };
00062 
00064     typedef typename Grid::Traits::LeafIntersection LeafIntersection;
00066     typedef typename Grid::Traits::LevelIntersection LevelIntersection;
00067 
00069     typedef typename HostGrid::Traits::LeafIntersection HostLeafIntersection;
00071     typedef typename HostGrid::Traits::LevelIntersection HostLevelIntersection;
00072 
00077     static const HostGrid &hostGrid ( const Grid &grid )
00078     {      
00079       return grid.hostGrid();
00080     }
00081 
00082     template< class Entity >
00083     static const typename Codim< Entity::codimension >::HostEntity &
00084     hostEntity ( const Entity &entity )
00085     {
00086       return hostEntity< Entity::codimension >( entity );
00087     }
00088 
00089     template< int codim >
00090     static const typename Codim< codim >::HostEntity &
00091     hostEntity ( const typename Codim< codim >::Entity &entity )
00092     {
00093       return Grid::getRealImplementation( entity ).hostEntity();
00094     }
00095 
00096     static const HostLeafIntersection &
00097     hostIntersection ( const LeafIntersection &intersection )
00098     {
00099       return Grid::getRealImplementation( intersection ).hostIntersection();
00100     }
00101 
00102     static const HostLevelIntersection &
00103     hostIntersection ( const LevelIntersection &intersection )
00104     {
00105       return Grid::getRealImplementation( intersection ).hostIntersection();
00106     }
00107   };
00108 
00109 }
00110 
00111 #endif // #ifndef DUNE_GRID_HOSTGRIDACCESS_HH