dune-grid  2.11
albertagrid/intersection.hh
Go to the documentation of this file.
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 
9 
13 
14 #if HAVE_ALBERTA
15 
16 namespace 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 
125  typedef typename Base::ElementInfo ElementInfo;
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 
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 
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
FieldVector< ctype, dimensionworld > NormalVector
Definition: albertagrid/intersection.hh:41
Wrapper class for geometries.
Definition: common/geometry.hh:70
concept Entity
Model of a grid entity.
Definition: concepts/entity.hh:119
bool neighbor() const
Definition: intersection.cc:382
Base::ElementInfo ElementInfo
Definition: albertagrid/intersection.hh:125
static constexpr int dimensionworld
The dimension of the world the grid lives in.
Definition: common/grid.hh:390
int twistInOutside() const
Definition: albertagrid/intersection.hh:176
GridImp::template Codim< 0 >::Entity outside() const
Definition: intersection.cc:365
NormalVector centerOuterNormal() const
Definition: intersection.cc:171
static const int dimension
Definition: albertagrid/intersection.hh:38
void next()
Definition: intersection.cc:356
bool equals(const AlbertaGridLeafIntersection &other) const
Definition: albertagrid/intersection.hh:158
provides a wrapper for ALBERTA&#39;s el_info structure
AlbertaGridLeafIntersection(const This &other)
Definition: albertagrid/intersection.hh:146
size_t boundarySegmentIndex() const
Definition: intersection.cc:64
NormalVector centerIntegrationOuterNormal() const
Definition: intersection.cc:90
Grid abstract base classThis class is the base class for all grid implementations. Although no virtual functions are used we call it abstract since its methods do not contain an implementation but forward to the methods of the derived class via the Barton-Nackman trick.
Definition: common/grid.hh:375
Grid::Traits::template Codim< 1 >::LocalGeometryImpl LocalGeometryImpl
Definition: albertagrid/intersection.hh:55
NormalVector integrationOuterNormal([[maybe_unused]] const LocalCoordType &local) const
Definition: intersection.cc:189
bool boundary() const
Definition: intersection.cc:43
int indexInInside() const
Definition: intersection.cc:74
GeometryType type() const
Definition: intersection.cc:82
Grid::template Codim< 1 >::LocalGeometry LocalGeometry
Definition: albertagrid/intersection.hh:47
Base::Entity Entity
Definition: albertagrid/intersection.hh:120
AlbertaGridEntity< 0, dimension, Grid > EntityImp
Definition: albertagrid/intersection.hh:52
int oppVertex_
Definition: albertagrid/intersection.hh:94
concept Geometry
Model of a geometry object.
Definition: concepts/geometry.hh:29
bool operator!=(const This &other) const
Definition: albertagrid/intersection.hh:156
AlbertaGridIntersectionBase()
Definition: intersection.cc:18
Base::LocalGeometryImpl LocalGeometryImpl
Definition: albertagrid/intersection.hh:131
LocalGeometry geometryInInside() const
Definition: intersection.cc:391
Base::GeometryImpl GeometryImpl
Definition: albertagrid/intersection.hh:130
int twistInInside() const
Definition: albertagrid/intersection.hh:175
int boundaryId() const
Definition: intersection.cc:50
ElementInfo elementInfo_
Definition: albertagrid/intersection.hh:93
Grid::ctype ctype
Definition: albertagrid/intersection.hh:36
const ElementInfo & elementInfo() const
Definition: intersection.cc:228
Base::Geometry Geometry
Definition: albertagrid/intersection.hh:122
static const int dimensionworld
Definition: albertagrid/intersection.hh:39
bool operator==(const This &other) const
Definition: albertagrid/intersection.hh:155
Grid::template Codim< 1 >::Geometry Geometry
Definition: albertagrid/intersection.hh:46
This & operator=(const This &other)
Definition: albertagrid/intersection.hh:148
NormalVector centerUnitOuterNormal() const
Definition: intersection.cc:179
const Grid & grid() const
Definition: intersection.cc:220
Include standard header files.
Definition: agrid.hh:59
static const int dimensionworld
Definition: albertagrid/intersection.hh:115
AlbertaTransformation transformation() const
Definition: intersection.cc:213
Entity inside() const
Definition: intersection.cc:35
Definition: transformation.hh:17
FieldVector< ctype, dimension-1 > LocalCoordType
Definition: albertagrid/intersection.hh:42
LocalGeometry geometryInOutside() const
Definition: intersection.cc:402
Base::LocalCoordType LocalCoordType
Definition: albertagrid/intersection.hh:118
Base::LocalCoordReader LocalCoordReader
Definition: albertagrid/intersection.hh:134
static constexpr int dimension
The dimension of the grid.
Definition: common/grid.hh:387
Base::LocalGeometry LocalGeometry
Definition: albertagrid/intersection.hh:123
NormalVector outerNormal([[maybe_unused]] const LocalCoordType &local) const
Definition: intersection.cc:197
Geometry geometry() const
Definition: intersection.cc:417
NormalVector unitOuterNormal([[maybe_unused]] const LocalCoordType &local) const
Definition: intersection.cc:205
Definition: albertagrid/intersection.hh:31
bool conforming() const
Definition: albertagrid/intersection.hh:166
Definition: albertagrid/entity.hh:29
Base::NormalVector NormalVector
Definition: albertagrid/intersection.hh:117
Grid::template Codim< 0 >::Entity Entity
Definition: albertagrid/intersection.hh:44
int twistInNeighbor(int face) const
Definition: elementinfo.hh:612
ct ctype
Define type used for coordinates in grid module.
Definition: common/grid.hh:518
static const int dimension
Definition: albertagrid/intersection.hh:114
Grid::Traits::template Codim< 1 >::GeometryImpl GeometryImpl
Definition: albertagrid/intersection.hh:54
GeometryType
Type representing VTK&#39;s entity geometry types.
Definition: common.hh:132
Alberta::ElementInfo< dimension > ElementInfo
Definition: albertagrid/intersection.hh:49
Definition: albertagrid/entity.hh:44
Base::GlobalCoordReader GlobalCoordReader
Definition: albertagrid/intersection.hh:133
const Grid * grid_
Definition: albertagrid/intersection.hh:92
int indexInOutside() const
Definition: intersection.cc:426