DUNE PDELab (git)

intersection.hh
1// SPDX-FileCopyrightText: Copyright © 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
8#include <dune/grid/common/intersection.hh>
9
10#include <dune/grid/albertagrid/transformation.hh>
12#include <dune/grid/albertagrid/geometry.hh>
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 >
31 class AlbertaGridIntersectionBase
32 {
33 typedef AlbertaGridIntersectionBase< Grid > This;
34
35 public:
36 typedef typename Grid::ctype ctype;
37
38 static const int dimension = Grid::dimension;
39 static const int dimensionworld = Grid::dimensionworld;
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
49 typedef Alberta::ElementInfo< dimension > ElementInfo;
50
51 protected:
52 typedef AlbertaGridEntity< 0, dimension, Grid > EntityImp;
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
62 AlbertaGridIntersectionBase ();
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
76 NormalVector centerIntegrationOuterNormal () const;
77 NormalVector centerOuterNormal () const;
78 NormalVector centerUnitOuterNormal () const;
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
85 AlbertaTransformation transformation () const;
86
87
88 const Grid &grid () const;
89 const ElementInfo &elementInfo () const;
90
91 protected:
92 const Grid *grid_;
93 ElementInfo elementInfo_;
94 int oppVertex_;
95 };
96
97
98
99 // AlbertaGridLeafIntersection
100 // ---------------------------
101
102 template< class GridImp >
103 class AlbertaGridLeafIntersection
104 : public AlbertaGridIntersectionBase< GridImp >
105 {
106 typedef AlbertaGridLeafIntersection< GridImp > This;
107 typedef AlbertaGridIntersectionBase< GridImp > Base;
108
109 friend class AlbertaGridEntity< 0, GridImp::dimension, GridImp >;
110
111 public:
112 typedef This ImplementationType;
113
114 static const int dimension = Base::dimension;
115 static const int dimensionworld = Base::dimensionworld;
116
117 typedef typename Base::NormalVector NormalVector;
118 typedef typename Base::LocalCoordType LocalCoordType;
119
120 typedef typename Base::Entity Entity;
121
122 typedef typename Base::Geometry Geometry;
123 typedef typename Base::LocalGeometry LocalGeometry;
124
125 typedef typename Base::ElementInfo ElementInfo;
126
127 protected:
128 typedef typename Base::EntityImp EntityImp;
129
130 typedef typename Base::GeometryImpl GeometryImpl;
131 typedef typename Base::LocalGeometryImpl LocalGeometryImpl;
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
142 AlbertaGridLeafIntersection () = default;
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
168 LocalGeometry geometryInInside () const;
169 LocalGeometry geometryInOutside () const;
170
171 Geometry geometry () const;
172
173 int indexInOutside () const;
174
175 int twistInInside () const { return elementInfo().template twist< 1 >( oppVertex_ ); }
176 int twistInOutside () const { return elementInfo().twistInNeighbor( 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
static constexpr int dimension
The dimension of the grid.
Definition: grid.hh:387
static constexpr int dimensionworld
The dimension of the world the grid lives in.
Definition: grid.hh:390
ct ctype
Define type used for coordinates in grid module.
Definition: grid.hh:518
@ conforming
Output conforming data.
Definition: common.hh:73
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:132
provides a wrapper for ALBERTA's el_info structure
constexpr auto equals
Function object for performing equality comparison.
Definition: hybridutilities.hh:572
EnableIfInterOperable< T1, T2, bool >::type operator==(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
Checks for equality.
Definition: iteratorfacades.hh:238
EnableIfInterOperable< T1, T2, bool >::type operator!=(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
Checks for inequality.
Definition: iteratorfacades.hh:260
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)