dune-grid  2.3.1
hostgridaccess.hh
Go to the documentation of this file.
1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=4 sw=2 sts=2:
3 #ifndef DUNE_GRID_HOSTGRIDACCESS_HH
4 #define DUNE_GRID_HOSTGRIDACCESS_HH
5 
6 #include <string>
7 
9 
10 namespace Dune
11 {
12 
13  // External Forward Declarations
14  // -----------------------------
15 
16  template< class HostGrid, class CoordFunction, class Allocator >
17  class GeometryGrid;
18 
19 
20 
21  // HostGridAccess
22  // --------------
23 
24  template< class Grid >
26 
27 
28 
36  template< class HG, class CoordFunction, class Allocator >
37  struct HostGridAccess< GeometryGrid< HG, CoordFunction, Allocator > >
38  {
43 
45  typedef typename Grid::HostGrid HostGrid;
46 
53  template< int codim >
54  struct Codim
55  {
57  typedef typename Grid::template Codim< codim >::Entity Entity;
59  typedef typename Grid::template Codim< codim >::EntityPointer EntityPointer;
60 
62  typedef typename HostGrid::template Codim< codim >::Entity HostEntity;
64  typedef typename HostGrid::template Codim< codim >::EntityPointer HostEntityPointer;
65  };
66 
68  typedef typename Grid::Traits::LeafIntersection LeafIntersection;
70  typedef typename Grid::Traits::LevelIntersection LevelIntersection;
71 
73  typedef typename HostGrid::Traits::LeafIntersection HostLeafIntersection;
75  typedef typename HostGrid::Traits::LevelIntersection HostLevelIntersection;
76 
81  static const HostGrid &hostGrid ( const Grid &grid )
82  {
83  return grid.hostGrid();
84  }
85 
86  template< class Entity >
87  static const typename Codim< Entity::codimension >::HostEntity &
88  hostEntity ( const Entity &entity )
89  {
90  return hostEntity< Entity::codimension >( entity );
91  }
92 
93  template< int codim >
94  static const typename Codim< codim >::HostEntity &
95  hostEntity ( const typename Codim< codim >::Entity &entity )
96  {
97  return Grid::getRealImplementation( entity ).hostEntity();
98  }
99 
100  template< class HostIntersection >
101  static const HostIntersection &
102  hostIntersection ( const Intersection< const Grid, GeoGrid::Intersection< const Grid, HostIntersection > > &intersection )
103  {
104  return Grid::getRealImplementation( intersection ).hostIntersection();
105  }
106  };
107 
108 } // namespace Dune
109 
110 #endif // #ifndef DUNE_GRID_HOSTGRIDACCESS_HH