Dune Core Modules (2.7.1)

hostgridaccess.hh
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
8#include <dune/grid/geometrygrid/intersection.hh>
9
10namespace 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 {
44 typedef GeometryGrid< HG, CoordFunction, Allocator > Grid;
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;
60
62 typedef typename HostGrid::template Codim< codim >::Entity HostEntity;
63 };
64
66 typedef typename Grid::Traits::LeafIntersection LeafIntersection;
68 typedef typename Grid::Traits::LevelIntersection LevelIntersection;
69
71 typedef typename HostGrid::Traits::LeafIntersection HostLeafIntersection;
73 typedef typename HostGrid::Traits::LevelIntersection HostLevelIntersection;
74
79 static const HostGrid &hostGrid ( const Grid &grid )
80 {
81 return grid.hostGrid();
82 }
83
84 template< class Entity >
85 static const typename Codim< Entity::codimension >::HostEntity &
86 hostEntity ( const Entity &entity )
87 {
88 return hostEntity< Entity::codimension >( entity );
89 }
90
91 template< int codim >
92 static const typename Codim< codim >::HostEntity &
93 hostEntity ( const typename Codim< codim >::Entity &entity )
94 {
95 return entity.impl().hostEntity();
96 }
97
98 template< class HostIntersection >
99 static const HostIntersection &
100 hostIntersection ( const Intersection< const Grid, GeoGrid::Intersection< const Grid, HostIntersection > > &intersection )
101 {
102 return intersection.impl().hostIntersection();
103 }
104 };
105
106
114 template< class HG >
115 struct HostGridAccess< IdentityGrid< HG > >
116 {
120 typedef IdentityGrid< HG > Grid;
121
123 typedef HG HostGrid;
124
131 template< int codim >
132 struct Codim
133 {
135 typedef typename Grid::template Codim< codim >::Entity Entity;
136
138 typedef typename HostGrid::template Codim< codim >::Entity HostEntity;
139 };
140
142 typedef typename Grid::Traits::LeafIntersection LeafIntersection;
144 typedef typename Grid::Traits::LevelIntersection LevelIntersection;
145
147 typedef typename HostGrid::Traits::LeafIntersection HostLeafIntersection;
149 typedef typename HostGrid::Traits::LevelIntersection HostLevelIntersection;
150
155 static const HostGrid &hostGrid ( const Grid &grid )
156 {
157 return grid.getHostGrid();
158 }
159
160 template< class Entity >
161 static const typename Codim< Entity::codimension >::HostEntity &
162 hostEntity ( const Entity &entity )
163 {
164 return hostEntity< Entity::codimension >( entity );
165 }
166
167 template< int codim >
168 static const typename Codim< codim >::HostEntity &
169 hostEntity ( const typename Codim< codim >::Entity &entity )
170 {
171 return *entity.impl().hostEntity_;
172 }
173
174 static const HostLeafIntersection &
175 hostIntersection ( const LeafIntersection &intersection )
176 {
177 return *intersection.impl().hostIterator_;
178 }
179
180 static const HostLevelIntersection &
181 hostIntersection ( const LevelIntersection &intersection )
182 {
183 return *intersection.impl().hostIterator_;
184 }
185 };
186
187} // namespace Dune
188
189#endif // #ifndef DUNE_GRID_HOSTGRIDACCESS_HH
Wrapper class for entities.
Definition: entity.hh:64
grid wrapper replacing the geometries
Definition: grid.hh:85
const HostGrid & hostGrid() const
obtain constant reference to the host grid
Definition: grid.hh:576
GridFamily::Traits::LeafIntersection LeafIntersection
A type that is a model of Dune::Intersection, an intersections of two codimension 1 of two codimensio...
Definition: grid.hh:460
GridFamily::Traits::LevelIntersection LevelIntersection
A type that is a model of Dune::Intersection, an intersections of two codimension 1 of two codimensio...
Definition: grid.hh:465
Provides a meta grid that is identical to its host.
Definition: identitygrid.hh:87
HostGridType & getHostGrid() const
Returns the hostgrid this IdentityGrid lives in.
Definition: identitygrid.hh:393
Dune namespace.
Definition: alignedallocator.hh:14
Static tag representing a codimension.
Definition: dimension.hh:22
HostGrid::template Codim< codim >::Entity HostEntity
type of the host entity
Definition: hostgridaccess.hh:62
Grid::template Codim< codim >::Entity Entity
type of the GeometryGrid entity
Definition: hostgridaccess.hh:59
Grid::template Codim< codim >::Entity Entity
type of the IdGrid entity
Definition: hostgridaccess.hh:135
HostGrid::template Codim< codim >::Entity HostEntity
type of the host entity
Definition: hostgridaccess.hh:138
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 12, 23:30, 2024)