dune-pdelab  2.4.1
geometrywrapper.hh
Go to the documentation of this file.
1 // -*- tab-width: 4; indent-tabs-mode: nil -*-
2 #ifndef DUNE_PDELAB_GEOMETRYWRAPPER_HH
3 #define DUNE_PDELAB_GEOMETRYWRAPPER_HH
4 
5 #include <dune/common/fvector.hh>
6 
7 namespace Dune {
8  namespace PDELab {
9 
11 
14  template<typename E>
16  {
17  public:
19  typedef typename E::Geometry Geometry;
21  typedef E Entity;
22 
24  ElementGeometry (const E& e_)
25  : e(e_)
26  {}
27 
29  Geometry geometry () const
30  {
31  return e.geometry();
32  }
33 
35  const Entity& entity () const
36  {
37  return e;
38  }
39 
41  const Entity& hostEntity () const
42  {
43  return e;
44  }
45 
46  private:
47  const E& e;
48  };
49 
50 
52 
55  template<typename I>
57  {
58  private:
59  const I& i;
60  const unsigned int index;
61  public:
63  typedef typename I::Geometry Geometry;
65  typedef typename I::LocalGeometry LocalGeometry;
67  typedef typename I::Entity Entity;
69  typedef typename I::EntityPointer EntityPointer;
71  typedef typename Geometry::ctype ctype;
73  enum { dimension=Entity::dimension };
75  static const int DUNE_DEPRECATED_MSG("Geometry::dimensionworld is deprecated in dune-grid 2.4") dimensionworld=Geometry::coorddimension;
77  enum { coorddimension=Geometry::coorddimension };
78 
80  IntersectionGeometry (const I& i_, unsigned int index_)
81  : i(i_), index(index_)
82  {}
83 
85  int insideDomainIndex() const
86  {
87  return 0;
88  }
89 
91  int outsideDomainIndex() const
92  {
93  const bool is_boundary = i.boundary();
94  return 0 - int(is_boundary);
95  }
96 
98  bool boundary () const
99  {
100  return i.boundary();
101  }
102 
118  int boundaryId () const
119  {
120  return i.boundaryId();
121  }
122 
124  bool neighbor () const
125  {
126  return i.neighbor();
127  }
128 
136  LocalGeometry geometryInInside () const
137  {
138  return i.geometryInInside();
139  }
140 
148  LocalGeometry geometryInOutside () const
149  {
150  return i.geometryInOutside();
151  }
152 
158  Geometry geometry () const
159  {
160  return i.geometry();
161  }
162 
164  int indexInInside () const
165  {
166  return i.indexInInside ();
167  }
168 
170  int indexInOutside () const
171  {
172  return i.indexInOutside ();
173  }
174 
179  Dune::FieldVector<ctype, coorddimension> outerNormal (const Dune::FieldVector<ctype, dimension-1>& local) const
180  {
181  return i.outerNormal(local);
182  }
183 
190  Dune::FieldVector<ctype, coorddimension> integrationOuterNormal (const Dune::FieldVector<ctype, dimension-1>& local) const
191  {
192  return i.integrationOuterNormal(local);
193  }
194 
200  Dune::FieldVector<ctype, coorddimension> unitOuterNormal (const Dune::FieldVector<ctype, dimension-1>& local) const
201  {
202  return i.unitOuterNormal(local);
203  }
204 
210  Dune::FieldVector<ctype, coorddimension> centerUnitOuterNormal () const
211  {
212  return i.centerUnitOuterNormal();
213  }
214 
218 #ifdef DOXYGEN
219  Entity
220 #else
221  typename std::conditional<
222  std::is_same<
223  decltype(i.inside()),
224  Entity
225  >::value,
226  Entity,
227  EntityPointer
228  >::type
229 #endif
230  inside() const
231  {
232  return i.inside();
233  }
234 
238  EntityPointer insideHostEntity() const
239  {
240  DUNE_THROW(Dune::Exception,"This should never be called.");
241  return i.inside();
242  }
243 
250 #ifdef DOXYGEN
251  Entity
252 #else
253  typename std::conditional<
254  std::is_same<
255  decltype(i.inside()),
256  Entity
257  >::value,
258  Entity,
259  EntityPointer
260  >::type
261 #endif
262  outside() const
263  {
264  return i.outside();
265  }
266 
268  const I& intersection () const
269  {
270  return i;
271  }
272 
273  unsigned int intersectionIndex() const
274  {
275  return index;
276  }
277  };
278 
279  }
280 }
281 
282 #endif
IntersectionGeometry(const I &i_, unsigned int index_)
Definition: geometrywrapper.hh:80
LocalGeometry geometryInInside() const
geometrical information about this intersection in local coordinates of the inside() entity...
Definition: geometrywrapper.hh:136
const Entity & hostEntity() const
Definition: geometrywrapper.hh:41
Dune::FieldVector< ctype, coorddimension > unitOuterNormal(const Dune::FieldVector< ctype, dimension-1 > &local) const
Return unit outer normal (length == 1)
Definition: geometrywrapper.hh:200
bool neighbor() const
return true if intersection is shared with another element.
Definition: geometrywrapper.hh:124
const I & intersection() const
Definition: geometrywrapper.hh:268
static const unsigned int value
Definition: gridfunctionspace/tags.hh:177
int insideDomainIndex() const
Definition: geometrywrapper.hh:85
E Entity
Definition: geometrywrapper.hh:21
Entity inside() const
return EntityPointer to the Entity on the inside of this intersection. That is the Entity where we st...
Definition: geometrywrapper.hh:230
Dune::FieldVector< ctype, coorddimension > integrationOuterNormal(const Dune::FieldVector< ctype, dimension-1 > &local) const
return outer normal scaled with the integration element
Definition: geometrywrapper.hh:190
EntityPointer insideHostEntity() const
return EntityPointer to the Entity on the inside of this intersection. That is the Entity where we st...
Definition: geometrywrapper.hh:238
Geometry::ctype ctype
Definition: geometrywrapper.hh:71
int boundaryId() const
Identifier for boundary segment from macro grid.
Definition: geometrywrapper.hh:118
Definition: adaptivity.hh:27
E::Geometry Geometry
Definition: geometrywrapper.hh:19
Entity outside() const
return EntityPointer to the Entity on the outside of this intersection. That is the neighboring Entit...
Definition: geometrywrapper.hh:262
Dune::FieldVector< ctype, coorddimension > centerUnitOuterNormal() const
Return unit outer normal (length == 1)
Definition: geometrywrapper.hh:210
const Entity & entity() const
Definition: geometrywrapper.hh:35
LocalGeometry geometryInOutside() const
geometrical information about this intersection in local coordinates of the outside() entity...
Definition: geometrywrapper.hh:148
unsigned int intersectionIndex() const
Definition: geometrywrapper.hh:273
I::Geometry Geometry
Definition: geometrywrapper.hh:63
Geometry geometry() const
geometrical information about this intersection in global coordinates.
Definition: geometrywrapper.hh:158
int outsideDomainIndex() const
Definition: geometrywrapper.hh:91
I::Entity Entity
Definition: geometrywrapper.hh:67
int indexInOutside() const
Local number of codim 1 entity in outside() Entity where intersection is contained in...
Definition: geometrywrapper.hh:170
Dune::FieldVector< ctype, coorddimension > outerNormal(const Dune::FieldVector< ctype, dimension-1 > &local) const
Return an outer normal (length not necessarily 1)
Definition: geometrywrapper.hh:179
I::LocalGeometry LocalGeometry
Definition: geometrywrapper.hh:65
Wrap element.
Definition: geometrywrapper.hh:15
Wrap intersection.
Definition: geometrywrapper.hh:56
int indexInInside() const
Local number of codim 1 entity in the inside() Entity where intersection is contained in...
Definition: geometrywrapper.hh:164
Geometry geometry() const
Definition: geometrywrapper.hh:29
ElementGeometry(const E &e_)
Definition: geometrywrapper.hh:24
I::EntityPointer EntityPointer
Definition: geometrywrapper.hh:69
bool boundary() const
return true if intersection is with interior or exterior boundary (see the cases above) ...
Definition: geometrywrapper.hh:98