dune-grid 2.9.0
albertagrid/intersection.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_ALBERTA_INTERSECTION_HH
6#define DUNE_ALBERTA_INTERSECTION_HH
7
9
13
14#if HAVE_ALBERTA
15
16namespace Dune
17{
18
19 // External Forward Declarations
20 // -----------------------------
21
22 template< int codim, int dim, class GridImp >
23 class AlbertaGridEntity;
24
25
26
27 // AlbertaGridIntersectionBase
28 // ---------------------------
29
30 template< class Grid >
32 {
34
35 public:
36 typedef typename Grid::ctype ctype;
37
38 static const int dimension = Grid::dimension;
40
41 typedef FieldVector< ctype, dimensionworld > NormalVector;
42 typedef FieldVector< ctype, dimension-1 > LocalCoordType;
43
44 typedef typename Grid::template Codim< 0 >::Entity Entity;
45
46 typedef typename Grid::template Codim< 1 >::Geometry Geometry;
47 typedef typename Grid::template Codim< 1 >::LocalGeometry LocalGeometry;
48
50
51 protected:
53
54 typedef typename Grid::Traits::template Codim< 1 >::GeometryImpl GeometryImpl;
55 typedef typename Grid::Traits::template Codim< 1 >::LocalGeometryImpl LocalGeometryImpl;
56
57 struct GlobalCoordReader;
58 struct LocalCoordReader;
59
60 public:
61
63
64 AlbertaGridIntersectionBase ( const EntityImp &entity, const int oppVertex );
65
66 Entity inside () const;
67
68 bool boundary () const;
69 int boundaryId () const;
70 size_t boundarySegmentIndex () const;
71
72 int indexInInside () const;
73
74 GeometryType type () const;
75
79
80 NormalVector integrationOuterNormal ( [[maybe_unused]] const LocalCoordType &local ) const;
81 NormalVector outerNormal ( [[maybe_unused]] const LocalCoordType &local ) const;
82 NormalVector unitOuterNormal ( [[maybe_unused]] const LocalCoordType &local ) const;
83
84
86
87
88 const Grid &grid () const;
89 const ElementInfo &elementInfo () const;
90
91 protected:
92 const Grid *grid_;
95 };
96
97
98
99 // AlbertaGridLeafIntersection
100 // ---------------------------
101
102 template< class GridImp >
104 : public AlbertaGridIntersectionBase< GridImp >
105 {
108
109 friend class AlbertaGridEntity< 0, GridImp::dimension, GridImp >;
110
111 public:
113
114 static const int dimension = Base::dimension;
116
119
120 typedef typename Base::Entity Entity;
121
122 typedef typename Base::Geometry Geometry;
124
126
127 protected:
128 typedef typename Base::EntityImp EntityImp;
129
132
133 typedef typename Base::GlobalCoordReader GlobalCoordReader;
134 typedef typename Base::LocalCoordReader LocalCoordReader;
135
136 public:
137 using Base::grid;
138 using Base::elementInfo;
139
140 using Base::inside;
141
143
144 AlbertaGridLeafIntersection ( const EntityImp &entity, int n ) : Base( entity, n ) {}
145
146 AlbertaGridLeafIntersection ( const This &other ) : Base( other ) {}
147
148 This &operator= ( const This &other )
149 {
150 *static_cast< Base * >( this ) = other;
151 neighborInfo_ = ElementInfo();
152 return *this;
153 }
154
155 bool operator== ( const This &other ) const { return (oppVertex_ == other.oppVertex_) && (elementInfo_ == other.elementInfo_); }
156 bool operator!= ( const This &other ) const { return (oppVertex_ != other.oppVertex_) || (elementInfo_ != other.elementInfo_); }
157
158 bool equals ( const AlbertaGridLeafIntersection& other ) const { return (*this) == other; }
159
160 void next ();
161
162 typename GridImp::template Codim< 0 >::Entity outside () const;
163
164 bool neighbor () const;
165
166 bool conforming () const { return true; }
167
170
171 Geometry geometry () const;
172
173 int indexInOutside () const;
174
175 int twistInInside () const { return elementInfo().template twist< 1 >( oppVertex_ ); }
177
178 protected:
179 using Base::elementInfo_;
180 using Base::oppVertex_;
181
182 private:
183 mutable ElementInfo neighborInfo_;
184 };
185
186} // namespace Dune
187
188#endif // #if HAVE_ALBERTA
189
190#endif // #ifndef DUNE_ALBERTA_INTERSECTION_HH
provides a wrapper for ALBERTA's el_info structure
Include standard header files.
Definition: agrid.hh:60
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:132
int twistInNeighbor(int face) const
Definition: elementinfo.hh:612
Definition: albertagrid/intersection.hh:105
LocalGeometry geometryInOutside() const
Definition: intersection.cc:402
GridImp::template Codim< 0 >::Entity outside() const
Definition: intersection.cc:365
AlbertaGridLeafIntersection(const This &other)
Definition: albertagrid/intersection.hh:146
int twistInInside() const
Definition: albertagrid/intersection.hh:175
Base::NormalVector NormalVector
Definition: albertagrid/intersection.hh:117
void next()
Definition: intersection.cc:356
bool operator==(const This &other) const
Definition: albertagrid/intersection.hh:155
Base::GeometryImpl GeometryImpl
Definition: albertagrid/intersection.hh:130
bool operator!=(const This &other) const
Definition: albertagrid/intersection.hh:156
int indexInOutside() const
Definition: intersection.cc:426
LocalGeometry geometryInInside() const
Definition: intersection.cc:391
Base::GlobalCoordReader GlobalCoordReader
Definition: albertagrid/intersection.hh:133
Base::Geometry Geometry
Definition: albertagrid/intersection.hh:122
This & operator=(const This &other)
Definition: albertagrid/intersection.hh:148
Base::LocalCoordReader LocalCoordReader
Definition: albertagrid/intersection.hh:134
Geometry geometry() const
Definition: intersection.cc:417
Base::ElementInfo ElementInfo
Definition: albertagrid/intersection.hh:125
static const int dimensionworld
Definition: albertagrid/intersection.hh:115
bool neighbor() const
Definition: intersection.cc:382
Base::LocalCoordType LocalCoordType
Definition: albertagrid/intersection.hh:118
bool equals(const AlbertaGridLeafIntersection &other) const
Definition: albertagrid/intersection.hh:158
Base::Entity Entity
Definition: albertagrid/intersection.hh:120
static const int dimension
Definition: albertagrid/intersection.hh:114
bool conforming() const
Definition: albertagrid/intersection.hh:166
Base::LocalGeometryImpl LocalGeometryImpl
Definition: albertagrid/intersection.hh:131
int twistInOutside() const
Definition: albertagrid/intersection.hh:176
Base::LocalGeometry LocalGeometry
Definition: albertagrid/intersection.hh:123
Definition: albertagrid/entity.hh:46
Definition: albertagrid/intersection.hh:32
NormalVector centerOuterNormal() const
Definition: intersection.cc:171
AlbertaGridEntity< 0, dimension, Grid > EntityImp
Definition: albertagrid/intersection.hh:52
const ElementInfo & elementInfo() const
Definition: intersection.cc:228
FieldVector< ctype, dimensionworld > NormalVector
Definition: albertagrid/intersection.hh:41
NormalVector centerIntegrationOuterNormal() const
Definition: intersection.cc:90
Grid::ctype ctype
Definition: albertagrid/intersection.hh:36
NormalVector integrationOuterNormal(const LocalCoordType &local) const
Definition: intersection.cc:189
ElementInfo elementInfo_
Definition: albertagrid/intersection.hh:93
FieldVector< ctype, dimension-1 > LocalCoordType
Definition: albertagrid/intersection.hh:42
NormalVector centerUnitOuterNormal() const
Definition: intersection.cc:179
static const int dimensionworld
Definition: albertagrid/intersection.hh:39
Grid::Traits::template Codim< 1 >::LocalGeometryImpl LocalGeometryImpl
Definition: albertagrid/intersection.hh:55
int indexInInside() const
Definition: intersection.cc:74
Grid::template Codim< 1 >::LocalGeometry LocalGeometry
Definition: albertagrid/intersection.hh:47
Entity inside() const
Definition: intersection.cc:35
NormalVector unitOuterNormal(const LocalCoordType &local) const
Definition: intersection.cc:205
const Grid & grid() const
Definition: intersection.cc:220
int oppVertex_
Definition: albertagrid/intersection.hh:94
static const int dimension
Definition: albertagrid/intersection.hh:38
bool boundary() const
Definition: intersection.cc:43
Grid::Traits::template Codim< 1 >::GeometryImpl GeometryImpl
Definition: albertagrid/intersection.hh:54
AlbertaGridIntersectionBase()
Definition: intersection.cc:18
size_t boundarySegmentIndex() const
Definition: intersection.cc:64
GeometryType type() const
Definition: intersection.cc:82
AlbertaTransformation transformation() const
Definition: intersection.cc:213
NormalVector outerNormal(const LocalCoordType &local) const
Definition: intersection.cc:197
int boundaryId() const
Definition: intersection.cc:50
Grid::template Codim< 1 >::Geometry Geometry
Definition: albertagrid/intersection.hh:46
Grid::template Codim< 0 >::Entity Entity
Definition: albertagrid/intersection.hh:44
const Grid * grid_
Definition: albertagrid/intersection.hh:92
Alberta::ElementInfo< dimension > ElementInfo
Definition: albertagrid/intersection.hh:49
Definition: transformation.hh:18
Wrapper class for geometries.
Definition: common/geometry.hh:71
Grid abstract base class.
Definition: common/grid.hh:375
static constexpr int dimension
The dimension of the grid.
Definition: common/grid.hh:387
static constexpr int dimensionworld
The dimension of the world the grid lives in.
Definition: common/grid.hh:390
ct ctype
Define type used for coordinates in grid module.
Definition: common/grid.hh:532