Dune Core Modules (2.9.0)

hostgridaccess.hh
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
10#include <dune/grid/geometrygrid/intersection.hh>
11
12namespace 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 {
46 typedef GeometryGrid< HG, CoordFunction, Allocator > Grid;
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 &
102 hostIntersection ( const Intersection< const Grid, GeoGrid::Intersection< const Grid, HostIntersection > > &intersection )
103 {
104 return intersection.impl().hostIntersection();
105 }
106 };
107
108
116 template< class HG >
117 struct HostGridAccess< IdentityGrid< HG > >
118 {
122 typedef IdentityGrid< HG > Grid;
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
144 typedef typename Grid::Traits::LeafIntersection LeafIntersection;
146 typedef typename Grid::Traits::LevelIntersection LevelIntersection;
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
Wrapper class for entities.
Definition: entity.hh:66
grid wrapper replacing the geometries
Definition: grid.hh:86
const HostGrid & hostGrid() const
obtain constant reference to the host grid
Definition: grid.hh:538
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:456
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:461
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
Dune namespace.
Definition: alignedallocator.hh:13
Static tag representing a codimension.
Definition: dimension.hh:24
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::template Codim< codim >::Entity Entity
type of the IdGrid entity
Definition: hostgridaccess.hh:137
HostGrid::template Codim< codim >::Entity HostEntity
type of the host entity
Definition: hostgridaccess.hh:140
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 21, 23:30, 2024)