dune-grid  2.4.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  template< class >
20  class IdentityGrid;
21 
22 
23  // HostGridAccess
24  // --------------
25 
26  template< class Grid >
27  struct HostGridAccess;
28 
29 
30 
38  template< class HG, class CoordFunction, class Allocator >
39  struct HostGridAccess< GeometryGrid< HG, CoordFunction, Allocator > >
40  {
45 
47  typedef typename Grid::HostGrid HostGrid;
48 
55  template< int codim >
56  struct Codim
57  {
59  typedef typename Grid::template Codim< codim >::Entity Entity;
61  typedef typename Grid::template Codim< codim >::EntityPointer EntityPointer;
62 
64  typedef typename HostGrid::template Codim< codim >::Entity HostEntity;
66  typedef typename HostGrid::template Codim< codim >::EntityPointer HostEntityPointer;
67  };
68 
70  typedef typename Grid::Traits::LeafIntersection LeafIntersection;
72  typedef typename Grid::Traits::LevelIntersection LevelIntersection;
73 
75  typedef typename HostGrid::Traits::LeafIntersection HostLeafIntersection;
77  typedef typename HostGrid::Traits::LevelIntersection HostLevelIntersection;
78 
83  static const HostGrid &hostGrid ( const Grid &grid )
84  {
85  return grid.hostGrid();
86  }
87 
88  template< class Entity >
89  static const typename Codim< Entity::codimension >::HostEntity &
90  hostEntity ( const Entity &entity )
91  {
92  return hostEntity< Entity::codimension >( entity );
93  }
94 
95  template< int codim >
96  static const typename Codim< codim >::HostEntity &
97  hostEntity ( const typename Codim< codim >::Entity &entity )
98  {
99  return Grid::getRealImplementation( entity ).hostEntity();
100  }
101 
102  template< class HostIntersection >
103  static const HostIntersection &
105  {
106  return Grid::getRealImplementation( intersection ).hostIntersection();
107  }
108  };
109 
110 
118  template< class HG >
119  struct HostGridAccess< IdentityGrid< HG > >
120  {
125 
127  typedef HG HostGrid;
128 
135  template< int codim >
136  struct Codim
137  {
139  typedef typename Grid::template Codim< codim >::Entity Entity;
141  typedef typename Grid::template Codim< codim >::EntityPointer EntityPointer;
142 
144  typedef typename HostGrid::template Codim< codim >::Entity HostEntity;
146  typedef typename HostGrid::template Codim< codim >::EntityPointer HostEntityPointer;
147  };
148 
153 
155  typedef typename HostGrid::Traits::LeafIntersection HostLeafIntersection;
157  typedef typename HostGrid::Traits::LevelIntersection HostLevelIntersection;
158 
163  static const HostGrid &hostGrid ( const Grid &grid )
164  {
165  return grid.getHostGrid();
166  }
167 
168  template< class Entity >
169  static const typename Codim< Entity::codimension >::HostEntity &
170  hostEntity ( const Entity &entity )
171  {
172  return hostEntity< Entity::codimension >( entity );
173  }
174 
175  template< int codim >
176  static const typename Codim< codim >::HostEntity &
177  hostEntity ( const typename Codim< codim >::Entity &entity )
178  {
179  return *Grid::getRealImplementation( entity ).hostEntity_;
180  }
181 
182  static const HostLeafIntersection &
183  hostIntersection ( const LeafIntersection &intersection )
184  {
185  return *Grid::getRealImplementation( intersection ).hostIterator_;
186  }
187 
188  static const HostLevelIntersection &
189  hostIntersection ( const LevelIntersection &intersection )
190  {
191  return *Grid::getRealImplementation( intersection ).hostIterator_;
192  }
193  };
194 
195 } // namespace Dune
196 
197 #endif // #ifndef DUNE_GRID_HOSTGRIDACCESS_HH
Intersection of a mesh entities of codimension 0 ("elements") with a "neighboring" element or with th...
Definition: albertagrid/dgfparser.hh:26
HostGrid::template Codim< codim >::Entity HostEntity
type of the host entity
Definition: hostgridaccess.hh:64
HostGrid::Traits::LeafIntersection HostLeafIntersection
type of the host leaf intersection
Definition: hostgridaccess.hh:155
HostGrid::template Codim< codim >::Entity HostEntity
type of the host entity
Definition: hostgridaccess.hh:144
HostGridType & getHostGrid() const
Returns the hostgrid this IdentityGrid lives in.
Definition: identitygrid.hh:491
static const HostIntersection & hostIntersection(const Intersection< const Grid, GeoGrid::Intersection< const Grid, HostIntersection > > &intersection)
Definition: hostgridaccess.hh:104
Grid::template Codim< codim >::Entity Entity
type of the IdGrid entity
Definition: hostgridaccess.hh:139
Provides a meta grid that is identical to its host.
Definition: identitygrid.hh:33
Wrapper class for entities.
Definition: common/entity.hh:61
Grid::Traits::LeafIntersection LeafIntersection
type of the IdGrid leaf intersection
Definition: hostgridaccess.hh:150
HostGrid::Traits::LevelIntersection HostLevelIntersection
type of the host level intersection
Definition: hostgridaccess.hh:157
Grid::Traits::LevelIntersection LevelIntersection
type of the IdGrid level intersection
Definition: hostgridaccess.hh:152
static const HostLevelIntersection & hostIntersection(const LevelIntersection &intersection)
Definition: hostgridaccess.hh:189
Grid::Traits::LevelIntersection LevelIntersection
type of the GeometryGrid level intersection
Definition: hostgridaccess.hh:72
grid wrapper replacing the geometriesGeometryGrid wraps another DUNE grid and replaces its geometry b...
Definition: geometrygrid/declaration.hh:10
Grid::template Codim< codim >::Entity Entity
type of the GeometryGrid entity
Definition: hostgridaccess.hh:59
static const Codim< codim >::HostEntity & hostEntity(const typename Codim< codim >::Entity &entity)
Definition: hostgridaccess.hh:97
HostGrid::Traits::LevelIntersection HostLevelIntersection
type of the host level intersection
Definition: hostgridaccess.hh:77
static const HostGrid & hostGrid(const Grid &grid)
Get underlying HostGrid.
Definition: hostgridaccess.hh:163
HostGrid::Traits::LeafIntersection HostLeafIntersection
type of the host leaf intersection
Definition: hostgridaccess.hh:75
HG HostGrid
type of HostGrid
Definition: hostgridaccess.hh:127
Grid::template Codim< codim >::EntityPointer EntityPointer
type of the IdGrid entity pointer
Definition: hostgridaccess.hh:141
static const Codim< Entity::codimension >::HostEntity & hostEntity(const Entity &entity)
Definition: hostgridaccess.hh:170
GridFamily::Traits::LevelIntersection LevelIntersection
A type that is a model of Dune::Intersection, an intersections of two codimension 1 of two codimensio...
Definition: common/grid.hh:491
static const HostLeafIntersection & hostIntersection(const LeafIntersection &intersection)
Definition: hostgridaccess.hh:183
GeometryGrid< HG, CoordFunction, Allocator > Grid
Definition: hostgridaccess.hh:44
Definition: geometrygrid/intersection.hh:19
static const Codim< codim >::HostEntity & hostEntity(const typename Codim< codim >::Entity &entity)
Definition: hostgridaccess.hh:177
Grid::Traits::LeafIntersection LeafIntersection
type of the GeometryGrid leaf intersection
Definition: hostgridaccess.hh:70
HostGrid::template Codim< codim >::EntityPointer HostEntityPointer
type of the host entity pointer
Definition: hostgridaccess.hh:146
static const HostGrid & hostGrid(const Grid &grid)
Get underlying HostGrid.
Definition: hostgridaccess.hh:83
IdentityGrid< HG > Grid
Definition: hostgridaccess.hh:124
static const Codim< Entity::codimension >::HostEntity & hostEntity(const Entity &entity)
Definition: hostgridaccess.hh:90
Grid::template Codim< codim >::EntityPointer EntityPointer
type of the GeometryGrid entity pointer
Definition: hostgridaccess.hh:61
provides access to host grid objects from GeometryGrid
Definition: identitygrid.hh:37
const HostGrid & hostGrid() const
Definition: geometrygrid/grid.hh:629
HostGrid::template Codim< codim >::EntityPointer HostEntityPointer
type of the host entity pointer
Definition: hostgridaccess.hh:66
Grid::HostGrid HostGrid
type of HostGrid
Definition: hostgridaccess.hh:47
GridFamily::Traits::LeafIntersection LeafIntersection
A type that is a model of Dune::Intersection, an intersections of two codimension 1 of two codimensio...
Definition: common/grid.hh:486