dune-grid  2.2.1
hostgridaccess.hh
Go to the documentation of this file.
1 #ifndef DUNE_GRID_HOSTGRIDACCESS_HH
2 #define DUNE_GRID_HOSTGRIDACCESS_HH
3 
4 #include <string>
5 
6 namespace Dune
7 {
8 
9  // External Forward Declarations
10  // -----------------------------
11 
12  template< class HostGrid, class CoordFunction, class Allocator >
13  class GeometryGrid;
14 
15 
16 
17  // HostGridAccess
18  // --------------
19 
20  template< class Grid >
22 
23 
24 
32  template< class HG, class CoordFunction, class Allocator >
33  struct HostGridAccess< GeometryGrid< HG, CoordFunction, Allocator > >
34  {
39 
41  typedef typename Grid::HostGrid HostGrid;
42 
49  template< int codim >
50  struct Codim
51  {
53  typedef typename Grid::template Codim< codim >::Entity Entity;
55  typedef typename Grid::template Codim< codim >::EntityPointer EntityPointer;
56 
58  typedef typename HostGrid::template Codim< codim >::Entity HostEntity;
60  typedef typename HostGrid::template Codim< codim >::EntityPointer HostEntityPointer;
61  };
62 
64  typedef typename Grid::Traits::LeafIntersection LeafIntersection;
66  typedef typename Grid::Traits::LevelIntersection LevelIntersection;
67 
69  typedef typename HostGrid::Traits::LeafIntersection HostLeafIntersection;
71  typedef typename HostGrid::Traits::LevelIntersection HostLevelIntersection;
72 
77  static const HostGrid &hostGrid ( const Grid &grid )
78  {
79  return grid.hostGrid();
80  }
81 
82  template< class Entity >
83  static const typename Codim< Entity::codimension >::HostEntity &
84  hostEntity ( const Entity &entity )
85  {
86  return hostEntity< Entity::codimension >( entity );
87  }
88 
89  template< int codim >
90  static const typename Codim< codim >::HostEntity &
91  hostEntity ( const typename Codim< codim >::Entity &entity )
92  {
93  return Grid::getRealImplementation( entity ).hostEntity();
94  }
95 
96  static const HostLeafIntersection &
97  hostIntersection ( const LeafIntersection &intersection )
98  {
99  return Grid::getRealImplementation( intersection ).hostIntersection();
100  }
101 
102  static const HostLevelIntersection &
103  hostIntersection ( const LevelIntersection &intersection )
104  {
105  return Grid::getRealImplementation( intersection ).hostIntersection();
106  }
107  };
108 
109 }
110 
111 #endif // #ifndef DUNE_GRID_HOSTGRIDACCESS_HH