dune-grid  2.6-git
albertagrid/intersection.hh
Go to the documentation of this file.
1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=4 sw=2 sts=2:
3 #ifndef DUNE_ALBERTA_INTERSECTION_HH
4 #define DUNE_ALBERTA_INTERSECTION_HH
5 
7 
11 
12 #if HAVE_ALBERTA
13 
14 namespace Dune
15 {
16 
17  // External Forward Declarations
18  // -----------------------------
19 
20  template< int codim, int dim, class GridImp >
21  class AlbertaGridEntity;
22 
23 
24 
25  // AlbertaGridIntersectionBase
26  // ---------------------------
27 
28  template< class Grid >
30  {
32 
33  public:
34  typedef typename Grid::ctype ctype;
35 
36  static const int dimension = Grid::dimension;
38 
39  typedef FieldVector< ctype, dimensionworld > NormalVector;
40  typedef FieldVector< ctype, dimension-1 > LocalCoordType;
41 
42  typedef typename Grid::template Codim< 0 >::Entity Entity;
43 
44  typedef typename Grid::template Codim< 1 >::Geometry Geometry;
45  typedef typename Grid::template Codim< 1 >::LocalGeometry LocalGeometry;
46 
48 
49  protected:
51 
52  typedef typename Grid::Traits::template Codim< 1 >::GeometryImpl GeometryImpl;
53  typedef typename Grid::Traits::template Codim< 1 >::LocalGeometryImpl LocalGeometryImpl;
54 
55  struct GlobalCoordReader;
56  struct LocalCoordReader;
57 
58  public:
59 
61 
62  AlbertaGridIntersectionBase ( const EntityImp &entity, const int oppVertex );
63 
64  Entity inside () const;
65 
66  bool boundary () const;
67  int boundaryId () const;
68  size_t boundarySegmentIndex () const;
69 
70  int indexInInside () const;
71 
72  GeometryType type () const;
73 
74  NormalVector centerIntegrationOuterNormal () const;
75  NormalVector centerOuterNormal () const;
76  NormalVector centerUnitOuterNormal () const;
77 
78  NormalVector integrationOuterNormal ( const LocalCoordType &local ) const;
79  NormalVector outerNormal ( const LocalCoordType &local ) const;
80  NormalVector unitOuterNormal ( const LocalCoordType &local ) const;
81 
82 
84 
85 
86  const Grid &grid () const;
87  const ElementInfo &elementInfo () const;
88 
89  protected:
90  const Grid *grid_;
91  ElementInfo elementInfo_;
93  };
94 
95 
96 
97  // AlbertaGridLeafIntersection
98  // ---------------------------
99 
100  template< class GridImp >
102  : public AlbertaGridIntersectionBase< GridImp >
103  {
106 
107  friend class AlbertaGridEntity< 0, GridImp::dimension, GridImp >;
108 
109  public:
110  typedef This ImplementationType;
111 
112  static const int dimension = Base::dimension;
113  static const int dimensionworld = Base::dimensionworld;
114 
117 
118  typedef typename Base::Entity Entity;
119 
120  typedef typename Base::Geometry Geometry;
122 
123  typedef typename Base::ElementInfo ElementInfo;
124 
125  protected:
126  typedef typename Base::EntityImp EntityImp;
127 
130 
131  typedef typename Base::GlobalCoordReader GlobalCoordReader;
132  typedef typename Base::LocalCoordReader LocalCoordReader;
133 
134  public:
135  using Base::grid;
136  using Base::elementInfo;
137 
138  using Base::inside;
139 
140  AlbertaGridLeafIntersection () = default;
141 
142  AlbertaGridLeafIntersection ( const EntityImp &entity, int n ) : Base( entity, n ) {}
143 
144  AlbertaGridLeafIntersection ( const This &other ) : Base( other ) {}
145 
146  This &operator= ( const This &other )
147  {
148  *static_cast< Base * >( this ) = other;
149  neighborInfo_ = ElementInfo();
150  return *this;
151  }
152 
153  bool operator== ( const This &other ) const { return (oppVertex_ == other.oppVertex_) && (elementInfo_ == other.elementInfo_); }
154  bool operator!= ( const This &other ) const { return (oppVertex_ != other.oppVertex_) || (elementInfo_ != other.elementInfo_); }
155 
156  bool equals ( const AlbertaGridLeafIntersection& other ) const { return (*this) == other; }
157 
158  void next ();
159 
160  typename GridImp::template Codim< 0 >::Entity outside () const;
161 
162  bool neighbor () const;
163 
164  bool conforming () const { return true; }
165 
166  LocalGeometry geometryInInside () const;
167  LocalGeometry geometryInOutside () const;
168 
169  Geometry geometry () const;
170 
171  int indexInOutside () const;
172 
173  int twistInInside () const { return elementInfo().template twist< 1 >( oppVertex_ ); }
174  int twistInOutside () const { return elementInfo().twistInNeighbor( oppVertex_ ); }
175 
176  protected:
177  using Base::elementInfo_;
178  using Base::oppVertex_;
179 
180  private:
181  mutable ElementInfo neighborInfo_;
182  };
183 
184 } // namespace Dune
185 
186 #endif // #if HAVE_ALBERTA
187 
188 #endif // #ifndef DUNE_ALBERTA_INTERSECTION_HH
Include standard header files.
Definition: agrid.hh:58
Grid::Traits::template Codim< 1 >::GeometryImpl GeometryImpl
Definition: albertagrid/intersection.hh:52
NormalVector unitOuterNormal(const LocalCoordType &local) const
Definition: intersection.cc:203
bool boundary() const
Definition: intersection.cc:41
NormalVector centerOuterNormal() const
Definition: intersection.cc:169
static const int dimension
Definition: albertagrid/intersection.hh:36
ct ctype
Define type used for coordinates in grid module.
Definition: common/grid.hh:522
int oppVertex_
Definition: albertagrid/intersection.hh:92
static const int dimensionworld
Definition: albertagrid/intersection.hh:37
Definition: albertagrid/intersection.hh:29
Base::GeometryImpl GeometryImpl
Definition: albertagrid/intersection.hh:128
Grid::template Codim< 1 >::LocalGeometry LocalGeometry
Definition: albertagrid/intersection.hh:45
AlbertaGridEntity< 0, dimension, Grid > EntityImp
Definition: albertagrid/intersection.hh:50
NormalVector centerUnitOuterNormal() const
Definition: intersection.cc:177
AlbertaTransformation transformation() const
Definition: intersection.cc:211
Grid::template Codim< 0 >::Entity Entity
Definition: albertagrid/intersection.hh:42
Base::LocalCoordType LocalCoordType
Definition: albertagrid/intersection.hh:116
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:373
FieldVector< ctype, dimensionworld > NormalVector
Definition: albertagrid/intersection.hh:39
int twistInOutside() const
Definition: albertagrid/intersection.hh:174
Grid::Traits::template Codim< 1 >::LocalGeometryImpl LocalGeometryImpl
Definition: albertagrid/intersection.hh:53
Definition: albertagrid/entity.hh:27
AlbertaGridLeafIntersection(const This &other)
Definition: albertagrid/intersection.hh:144
Base::Entity Entity
Definition: albertagrid/intersection.hh:118
int boundaryId() const
Definition: intersection.cc:48
provides a wrapper for ALBERTA&#39;s el_info structure
const Grid * grid_
Definition: albertagrid/intersection.hh:90
int twistInNeighbor(int face) const
Definition: elementinfo.hh:610
Base::LocalGeometry LocalGeometry
Definition: albertagrid/intersection.hh:121
Definition: albertagrid/entity.hh:42
Definition: transformation.hh:15
GeometryType
Type representing VTK&#39;s entity geometry types.
Definition: common.hh:178
Base::LocalCoordReader LocalCoordReader
Definition: albertagrid/intersection.hh:132
NormalVector outerNormal(const LocalCoordType &local) const
Definition: intersection.cc:195
int indexInInside() const
Definition: intersection.cc:72
bool conforming() const
Definition: albertagrid/intersection.hh:164
Base::NormalVector NormalVector
Definition: albertagrid/intersection.hh:115
FieldVector< ctype, dimension-1 > LocalCoordType
Definition: albertagrid/intersection.hh:40
int twistInInside() const
Definition: albertagrid/intersection.hh:173
size_t boundarySegmentIndex() const
Definition: intersection.cc:62
The dimension of the world the grid lives in.
Definition: common/grid.hh:393
NormalVector centerIntegrationOuterNormal() const
Definition: intersection.cc:88
const ElementInfo & elementInfo() const
Definition: intersection.cc:226
Base::GlobalCoordReader GlobalCoordReader
Definition: albertagrid/intersection.hh:131
GeometryType type() const
Definition: intersection.cc:80
Base::Geometry Geometry
Definition: albertagrid/intersection.hh:120
Grid::ctype ctype
Definition: albertagrid/intersection.hh:34
Alberta::ElementInfo< dimension > ElementInfo
Definition: albertagrid/intersection.hh:47
const Grid & grid() const
Definition: intersection.cc:218
The dimension of the grid.
Definition: common/grid.hh:387
Entity inside() const
Definition: intersection.cc:33
Grid::template Codim< 1 >::Geometry Geometry
Definition: albertagrid/intersection.hh:44
bool equals(const AlbertaGridLeafIntersection &other) const
Definition: albertagrid/intersection.hh:156
Base::LocalGeometryImpl LocalGeometryImpl
Definition: albertagrid/intersection.hh:129
AlbertaGridIntersectionBase()
Definition: intersection.cc:16
NormalVector integrationOuterNormal(const LocalCoordType &local) const
Definition: intersection.cc:187
ElementInfo elementInfo_
Definition: albertagrid/intersection.hh:91