dune-grid 2.9.0
identitygridintersections.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_IDENTITYGRID_INTERSECTIONS_HH
6#define DUNE_IDENTITYGRID_INTERSECTIONS_HH
7
10
15namespace Dune {
16
17
18 // External forward declarations
19 template< class Grid >
20 struct HostGridAccess;
21
22
31 template<class GridImp>
33 {
34
35 friend class IdentityGridLeafIntersectionIterator<GridImp>;
36
37 friend struct HostGridAccess< typename std::remove_const< GridImp >::type >;
38
39 constexpr static int dim = GridImp::dimension;
40
41 constexpr static int dimworld = GridImp::dimensionworld;
42
43 // The type used to store coordinates
44 typedef typename GridImp::ctype ctype;
45
46 typedef typename GridImp::HostGridType::LeafGridView::Intersection HostLeafIntersection;
47
48 public:
49
50 typedef typename GridImp::template Codim<1>::Geometry Geometry;
51 typedef typename GridImp::template Codim<1>::LocalGeometry LocalGeometry;
52 typedef typename GridImp::template Codim<0>::Entity Entity;
53 typedef FieldVector<ctype, dimworld> NormalVector;
54
56 {}
57
58 IdentityGridLeafIntersection(const GridImp* identityGrid,
59 const HostLeafIntersection& hostIntersection)
60 : identityGrid_(identityGrid)
61 , hostIntersection_(hostIntersection)
62 {}
63
64 IdentityGridLeafIntersection(const GridImp* identityGrid,
65 HostLeafIntersection&& hostIntersection)
66 : identityGrid_(identityGrid)
67 , hostIntersection_(std::move(hostIntersection))
68 {}
69
70 bool equals(const IdentityGridLeafIntersection& other) const
71 {
72 return hostIntersection_ == other.hostIntersection_;
73 }
74
77 Entity inside() const {
78 return IdentityGridEntity<0,dim,GridImp>(identityGrid_,hostIntersection_.inside());
79 }
80
81
84 Entity outside() const {
85 return IdentityGridEntity<0,dim,GridImp>(identityGrid_,hostIntersection_.outside());
86 }
87
88
90 bool boundary () const {
91 return hostIntersection_.boundary();
92 }
93
100 return hostIntersection_.centerUnitOuterNormal();
101 }
102
104 bool neighbor () const {
105 return hostIntersection_.neighbor();
106 }
107
109 size_t boundarySegmentIndex() const {
110 return hostIntersection_.boundarySegmentIndex();
111 }
112
114 bool conforming () const {
115 return hostIntersection_.conforming();
116 }
117
120 return hostIntersection_.type();
121 }
122
123
129 {
130 return LocalGeometry( hostIntersection_.geometryInInside() );
131 }
132
136 {
137 return LocalGeometry( hostIntersection_.geometryInOutside() );
138 }
139
143 {
144 return Geometry( hostIntersection_.geometry() );
145 }
146
147
149 int indexInInside () const {
150 return hostIntersection_.indexInInside();
151 }
152
153
155 int indexInOutside () const {
156 return hostIntersection_.indexInOutside();
157 }
158
159
161 FieldVector<ctype, GridImp::dimensionworld> outerNormal (const FieldVector<ctype, GridImp::dimension-1>& local) const {
162 return hostIntersection_.outerNormal(local);
163 }
164
166 FieldVector<ctype, GridImp::dimensionworld> integrationOuterNormal (const FieldVector<ctype, GridImp::dimension-1>& local) const {
167 return hostIntersection_.integrationOuterNormal(local);
168 }
169
171 FieldVector<ctype, GridImp::dimensionworld> unitOuterNormal (const FieldVector<ctype, GridImp::dimension-1>& local) const {
172 return hostIntersection_.unitOuterNormal(local);
173 }
174
175
176 private:
177 //**********************************************************
178 // private methods
179 //**********************************************************
180
181 const GridImp* identityGrid_;
182
183 HostLeafIntersection hostIntersection_;
184 };
185
186
187
188
190 template<class GridImp>
192 {
193
194 friend class IdentityGridLevelIntersectionIterator<GridImp>;
195
196 friend struct HostGridAccess< typename std::remove_const< GridImp >::type >;
197
198 constexpr static int dim = GridImp::dimension;
199
200 constexpr static int dimworld = GridImp::dimensionworld;
201
202 // The type used to store coordinates
203 typedef typename GridImp::ctype ctype;
204
205 typedef typename GridImp::HostGridType::LevelGridView::Intersection HostLevelIntersection;
206
207 public:
208
209 typedef typename GridImp::template Codim<1>::Geometry Geometry;
210 typedef typename GridImp::template Codim<1>::LocalGeometry LocalGeometry;
211 typedef typename GridImp::template Codim<0>::Entity Entity;
212 typedef FieldVector<ctype, dimworld> NormalVector;
213
215 {}
216
217 IdentityGridLevelIntersection(const GridImp* identityGrid,
218 const HostLevelIntersection& hostIntersection)
219 : identityGrid_(identityGrid)
220 , hostIntersection_(hostIntersection)
221 {}
222
223 IdentityGridLevelIntersection(const GridImp* identityGrid,
224 HostLevelIntersection&& hostIntersection)
225 : identityGrid_(identityGrid)
226 , hostIntersection_(std::move(hostIntersection))
227 {}
228
229 bool equals(const IdentityGridLevelIntersection& other) const
230 {
231 return hostIntersection_ == other.hostIntersection_;
232 }
233
236 Entity inside() const {
237 return IdentityGridEntity<0,dim,GridImp>(identityGrid_,hostIntersection_.inside());
238 }
239
240
243 Entity outside() const {
244 return IdentityGridEntity<0,dim,GridImp>(identityGrid_,hostIntersection_.outside());
245 }
246
247
250 bool boundary () const {
251 return hostIntersection_.boundary();
252 }
253
260 return hostIntersection_.centerUnitOuterNormal();
261 }
262
264 bool neighbor () const {
265 return hostIntersection_.neighbor();
266 }
267
269 size_t boundarySegmentIndex() const {
270 return hostIntersection_.boundarySegmentIndex();
271 }
272
274 bool conforming () const {
275 return hostIntersection_.conforming();
276 }
277
280 return hostIntersection_.type();
281 }
282
283
289 {
290 return LocalGeometry( hostIntersection_.geometryInInside() );
291 }
292
296 {
297 return LocalGeometry( hostIntersection_.geometryInOutside() );
298 }
299
303 {
304 return Geometry( hostIntersection_.geometry() );
305 }
306
307
309 int indexInInside () const {
310 return hostIntersection_.indexInInside();
311 }
312
313
315 int indexInOutside () const {
316 return hostIntersection_.indexInOutside();
317 }
318
319
321 FieldVector<ctype, dimworld> outerNormal (const FieldVector<ctype, dim-1>& local) const {
322 return hostIntersection_.outerNormal(local);
323 }
324
326 FieldVector<ctype, dimworld> integrationOuterNormal (const FieldVector<ctype, dim-1>& local) const {
327 return hostIntersection_.integrationOuterNormal(local);
328 }
329
331 FieldVector<ctype, dimworld> unitOuterNormal (const FieldVector<ctype, dim-1>& local) const {
332 return hostIntersection_.unitOuterNormal(local);
333 }
334
335 private:
336
337 const GridImp* identityGrid_;
338
339 HostLevelIntersection hostIntersection_;
340
341 };
342
343
344} // namespace Dune
345
346#endif
The IdentityGridLeafIterator class.
The IdentityGridEntity class.
STL namespace.
Include standard header files.
Definition: agrid.hh:60
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:132
provides access to host grid objects from GeometryGrid
Definition: identitygrid.hh:37
Definition: identitygridintersectioniterator.hh:84
Iterator over all element neighborsMesh entities of codimension 0 ("elements") allow to visit all nei...
Definition: identitygridintersectioniterator.hh:29
Specialization for codim-0-entities.
Definition: identitygridentity.hh:205
An intersection with a leaf neighbor elementMesh entities of codimension 0 ("elements") allow to visi...
Definition: identitygridintersections.hh:33
Entity inside() const
Definition: identitygridintersections.hh:77
IdentityGridLeafIntersection(const GridImp *identityGrid, HostLeafIntersection &&hostIntersection)
Definition: identitygridintersections.hh:64
NormalVector centerUnitOuterNormal() const
Return unit outer normal (length == 1)
Definition: identitygridintersections.hh:99
GridImp::template Codim< 1 >::LocalGeometry LocalGeometry
Definition: identitygridintersections.hh:51
Geometry geometry() const
Definition: identitygridintersections.hh:142
Entity outside() const
Definition: identitygridintersections.hh:84
LocalGeometry geometryInOutside() const
Definition: identitygridintersections.hh:135
bool boundary() const
return true if intersection is with boundary.
Definition: identitygridintersections.hh:90
GeometryType type() const
Geometry type of an intersection.
Definition: identitygridintersections.hh:119
FieldVector< ctype, dimworld > NormalVector
Definition: identitygridintersections.hh:53
LocalGeometry geometryInInside() const
Definition: identitygridintersections.hh:128
bool conforming() const
Return true if this is a conforming intersection.
Definition: identitygridintersections.hh:114
IdentityGridLeafIntersection(const GridImp *identityGrid, const HostLeafIntersection &hostIntersection)
Definition: identitygridintersections.hh:58
size_t boundarySegmentIndex() const
return the boundary segment index
Definition: identitygridintersections.hh:109
bool equals(const IdentityGridLeafIntersection &other) const
Definition: identitygridintersections.hh:70
FieldVector< ctype, GridImp::dimensionworld > outerNormal(const FieldVector< ctype, GridImp::dimension-1 > &local) const
return outer normal
Definition: identitygridintersections.hh:161
int indexInOutside() const
local number of codim 1 entity in neighbor where intersection is contained
Definition: identitygridintersections.hh:155
FieldVector< ctype, GridImp::dimensionworld > integrationOuterNormal(const FieldVector< ctype, GridImp::dimension-1 > &local) const
return outer normal multiplied by the integration element
Definition: identitygridintersections.hh:166
bool neighbor() const
return true if across the edge an neighbor on this level exists
Definition: identitygridintersections.hh:104
FieldVector< ctype, GridImp::dimensionworld > unitOuterNormal(const FieldVector< ctype, GridImp::dimension-1 > &local) const
return unit outer normal
Definition: identitygridintersections.hh:171
int indexInInside() const
local number of codim 1 entity in self where intersection is contained in
Definition: identitygridintersections.hh:149
GridImp::template Codim< 1 >::Geometry Geometry
Definition: identitygridintersections.hh:50
GridImp::template Codim< 0 >::Entity Entity
Definition: identitygridintersections.hh:52
Definition: identitygridintersections.hh:192
Geometry geometry() const
Definition: identitygridintersections.hh:302
GridImp::template Codim< 0 >::Entity Entity
Definition: identitygridintersections.hh:211
IdentityGridLevelIntersection(const GridImp *identityGrid, const HostLevelIntersection &hostIntersection)
Definition: identitygridintersections.hh:217
GridImp::template Codim< 1 >::Geometry Geometry
Definition: identitygridintersections.hh:209
bool equals(const IdentityGridLevelIntersection &other) const
Definition: identitygridintersections.hh:229
bool neighbor() const
return true if across the edge an neighbor on this level exists
Definition: identitygridintersections.hh:264
NormalVector centerUnitOuterNormal() const
Return unit outer normal (length == 1)
Definition: identitygridintersections.hh:259
bool conforming() const
Return true if this is a conforming intersection.
Definition: identitygridintersections.hh:274
int indexInInside() const
local number of codim 1 entity in self where intersection is contained in
Definition: identitygridintersections.hh:309
FieldVector< ctype, dimworld > outerNormal(const FieldVector< ctype, dim-1 > &local) const
return outer normal
Definition: identitygridintersections.hh:321
GridImp::template Codim< 1 >::LocalGeometry LocalGeometry
Definition: identitygridintersections.hh:210
FieldVector< ctype, dimworld > NormalVector
Definition: identitygridintersections.hh:212
bool boundary() const
return true if intersection is with boundary.
Definition: identitygridintersections.hh:250
FieldVector< ctype, dimworld > integrationOuterNormal(const FieldVector< ctype, dim-1 > &local) const
return outer normal multiplied by the integration element
Definition: identitygridintersections.hh:326
LocalGeometry geometryInOutside() const
Definition: identitygridintersections.hh:295
LocalGeometry geometryInInside() const
Definition: identitygridintersections.hh:288
int indexInOutside() const
local number of codim 1 entity in neighbor where intersection is contained
Definition: identitygridintersections.hh:315
FieldVector< ctype, dimworld > unitOuterNormal(const FieldVector< ctype, dim-1 > &local) const
return unit outer normal
Definition: identitygridintersections.hh:331
size_t boundarySegmentIndex() const
return the boundary segment index
Definition: identitygridintersections.hh:269
Entity outside() const
Definition: identitygridintersections.hh:243
Entity inside() const
Definition: identitygridintersections.hh:236
GeometryType type() const
Geometry type of an intersection.
Definition: identitygridintersections.hh:279
IdentityGridLevelIntersection(const GridImp *identityGrid, HostLevelIntersection &&hostIntersection)
Definition: identitygridintersections.hh:223