Dune Core Modules (2.4.2)

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;
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 &
104 hostIntersection ( const Intersection< const Grid, GeoGrid::Intersection< const Grid, HostIntersection > > &intersection )
105 {
106 return Grid::getRealImplementation( intersection ).hostIntersection();
107 }
108 };
109
110
118 template< class HG >
119 struct HostGridAccess< IdentityGrid< HG > >
120 {
124 typedef IdentityGrid< HG > Grid;
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
150 typedef typename Grid::Traits::LeafIntersection LeafIntersection;
152 typedef typename Grid::Traits::LevelIntersection LevelIntersection;
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
Wrapper class for entities.
Definition: entity.hh:62
grid wrapper replacing the geometries
Definition: grid.hh:83
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:486
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:491
Provides a meta grid that is identical to its host.
Definition: identitygrid.hh:136
HostGridType & getHostGrid() const
Returns the hostgrid this IdentityGrid lives in.
Definition: identitygrid.hh:491
Dune namespace.
Definition: alignment.hh:10
Static tag representing a codimension.
Definition: dimension.hh:22
Grid::template Codim< codim >::EntityPointer EntityPointer
type of the GeometryGrid entity pointer
Definition: hostgridaccess.hh:61
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:59
HostGrid::template Codim< codim >::EntityPointer HostEntityPointer
type of the host entity pointer
Definition: hostgridaccess.hh:66
Grid::template Codim< codim >::Entity Entity
type of the IdGrid entity
Definition: hostgridaccess.hh:139
HostGrid::template Codim< codim >::EntityPointer HostEntityPointer
type of the host entity pointer
Definition: hostgridaccess.hh:146
Grid::template Codim< codim >::EntityPointer EntityPointer
type of the IdGrid entity pointer
Definition: hostgridaccess.hh:141
HostGrid::template Codim< codim >::Entity HostEntity
type of the host entity
Definition: hostgridaccess.hh:144
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 21, 23:30, 2024)