dune-grid  2.9.0
hostgridaccess.hh
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
2 // SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
3 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
4 // vi: set et ts=4 sw=2 sts=2:
5 #ifndef DUNE_GRID_HOSTGRIDACCESS_HH
6 #define DUNE_GRID_HOSTGRIDACCESS_HH
7 
8 #include <string>
9 
11 
12 namespace Dune
13 {
14 
15  // External Forward Declarations
16  // -----------------------------
17 
18  template< class HostGrid, class CoordFunction, class Allocator >
19  class GeometryGrid;
20 
21  template< class >
22  class IdentityGrid;
23 
24 
25  // HostGridAccess
26  // --------------
27 
28  template< class Grid >
29  struct HostGridAccess;
30 
31 
32 
40  template< class HG, class CoordFunction, class Allocator >
41  struct HostGridAccess< GeometryGrid< HG, CoordFunction, Allocator > >
42  {
47 
49  typedef typename Grid::HostGrid HostGrid;
50 
57  template< int codim >
58  struct Codim
59  {
61  typedef typename Grid::template Codim< codim >::Entity Entity;
62 
64  typedef typename HostGrid::template Codim< codim >::Entity HostEntity;
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 entity.impl().hostEntity();
98  }
99 
100  template< class HostIntersection >
101  static const HostIntersection &
103  {
104  return intersection.impl().hostIntersection();
105  }
106  };
107 
108 
116  template< class HG >
117  struct HostGridAccess< IdentityGrid< HG > >
118  {
123 
125  typedef HG HostGrid;
126 
133  template< int codim >
134  struct Codim
135  {
137  typedef typename Grid::template Codim< codim >::Entity Entity;
138 
140  typedef typename HostGrid::template Codim< codim >::Entity HostEntity;
141  };
142 
147 
149  typedef typename HostGrid::Traits::LeafIntersection HostLeafIntersection;
151  typedef typename HostGrid::Traits::LevelIntersection HostLevelIntersection;
152 
157  static const HostGrid &hostGrid ( const Grid &grid )
158  {
159  return grid.getHostGrid();
160  }
161 
162  template< class Entity >
163  static const typename Codim< Entity::codimension >::HostEntity &
164  hostEntity ( const Entity &entity )
165  {
166  return hostEntity< Entity::codimension >( entity );
167  }
168 
169  template< int codim >
170  static const typename Codim< codim >::HostEntity &
171  hostEntity ( const typename Codim< codim >::Entity &entity )
172  {
173  return *entity.impl().hostEntity_;
174  }
175 
176  static const HostLeafIntersection &
177  hostIntersection ( const LeafIntersection &intersection )
178  {
179  return *intersection.impl().hostIterator_;
180  }
181 
182  static const HostLevelIntersection &
183  hostIntersection ( const LevelIntersection &intersection )
184  {
185  return *intersection.impl().hostIterator_;
186  }
187  };
188 
189 } // namespace Dune
190 
191 #endif // #ifndef DUNE_GRID_HOSTGRIDACCESS_HH
Include standard header files.
Definition: agrid.hh:60
Intersection of a mesh entity of codimension 0 ("element") with a "neighboring" element or with the d...
Definition: common/intersection.hh:164
Wrapper class for entities.
Definition: common/entity.hh:66
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:456
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:461
grid wrapper replacing the geometries
Definition: geometrygrid/grid.hh:86
const HostGrid & hostGrid() const
obtain constant reference to the host grid
Definition: geometrygrid/grid.hh:538
Definition: geometrygrid/intersection.hh:22
Provides a meta grid that is identical to its host.
Definition: identitygrid.hh:88
HostGridType & getHostGrid() const
Returns the hostgrid this IdentityGrid lives in.
Definition: identitygrid.hh:394
provides access to host grid objects from GeometryGrid
Definition: hostgridaccess.hh:29
static const Codim< Entity::codimension >::HostEntity & hostEntity(const Entity &entity)
Definition: hostgridaccess.hh:88
static const Codim< codim >::HostEntity & hostEntity(const typename Codim< codim >::Entity &entity)
Definition: hostgridaccess.hh:95
static const HostIntersection & hostIntersection(const Intersection< const Grid, GeoGrid::Intersection< const Grid, HostIntersection > > &intersection)
Definition: hostgridaccess.hh:102
Grid::HostGrid HostGrid
type of HostGrid
Definition: hostgridaccess.hh:49
HostGrid::Traits::LevelIntersection HostLevelIntersection
type of the host level intersection
Definition: hostgridaccess.hh:75
GeometryGrid< HG, CoordFunction, Allocator > Grid
Definition: hostgridaccess.hh:46
Grid::Traits::LeafIntersection LeafIntersection
type of the GeometryGrid leaf intersection
Definition: hostgridaccess.hh:68
static const HostGrid & hostGrid(const Grid &grid)
Get underlying HostGrid.
Definition: hostgridaccess.hh:81
HostGrid::Traits::LeafIntersection HostLeafIntersection
type of the host leaf intersection
Definition: hostgridaccess.hh:73
Grid::Traits::LevelIntersection LevelIntersection
type of the GeometryGrid level intersection
Definition: hostgridaccess.hh:70
HostGrid::template Codim< codim >::Entity HostEntity
type of the host entity
Definition: hostgridaccess.hh:64
Grid::template Codim< codim >::Entity Entity
type of the GeometryGrid entity
Definition: hostgridaccess.hh:61
Grid::Traits::LeafIntersection LeafIntersection
type of the IdGrid leaf intersection
Definition: hostgridaccess.hh:144
static const Codim< Entity::codimension >::HostEntity & hostEntity(const Entity &entity)
Definition: hostgridaccess.hh:164
static const HostLeafIntersection & hostIntersection(const LeafIntersection &intersection)
Definition: hostgridaccess.hh:177
HG HostGrid
type of HostGrid
Definition: hostgridaccess.hh:125
IdentityGrid< HG > Grid
Definition: hostgridaccess.hh:122
HostGrid::Traits::LevelIntersection HostLevelIntersection
type of the host level intersection
Definition: hostgridaccess.hh:151
Grid::Traits::LevelIntersection LevelIntersection
type of the IdGrid level intersection
Definition: hostgridaccess.hh:146
HostGrid::Traits::LeafIntersection HostLeafIntersection
type of the host leaf intersection
Definition: hostgridaccess.hh:149
static const Codim< codim >::HostEntity & hostEntity(const typename Codim< codim >::Entity &entity)
Definition: hostgridaccess.hh:171
static const HostLevelIntersection & hostIntersection(const LevelIntersection &intersection)
Definition: hostgridaccess.hh:183
static const HostGrid & hostGrid(const Grid &grid)
Get underlying HostGrid.
Definition: hostgridaccess.hh:157
HostGrid::template Codim< codim >::Entity HostEntity
type of the host entity
Definition: hostgridaccess.hh:140
Grid::template Codim< codim >::Entity Entity
type of the IdGrid entity
Definition: hostgridaccess.hh:137