dune-pdelab  2.5-dev
geometrywrapper.hh
Go to the documentation of this file.
1 // -*- tab-width: 4; indent-tabs-mode: nil -*-
2 #ifndef DUNE_PDELAB_COMMON_GEOMETRYWRAPPER_HH
3 #define DUNE_PDELAB_COMMON_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 Geometry::ctype ctype;
71  enum { dimension=Entity::dimension };
73  enum { coorddimension=Geometry::coorddimension };
74 
76  IntersectionGeometry (const I& i_, unsigned int index_)
77  : i(i_), index(index_)
78  {}
79 
81  int insideDomainIndex() const
82  {
83  return 0;
84  }
85 
87  int outsideDomainIndex() const
88  {
89  const bool is_boundary = i.boundary();
90  return 0 - int(is_boundary);
91  }
92 
94  bool boundary () const
95  {
96  return i.boundary();
97  }
98 
114  int boundaryId () const
115  {
116  return i.boundaryId();
117  }
118 
120  bool neighbor () const
121  {
122  return i.neighbor();
123  }
124 
132  LocalGeometry geometryInInside () const
133  {
134  return i.geometryInInside();
135  }
136 
144  LocalGeometry geometryInOutside () const
145  {
146  return i.geometryInOutside();
147  }
148 
154  Geometry geometry () const
155  {
156  return i.geometry();
157  }
158 
160  int indexInInside () const
161  {
162  return i.indexInInside ();
163  }
164 
166  int indexInOutside () const
167  {
168  return i.indexInOutside ();
169  }
170 
175  Dune::FieldVector<ctype, coorddimension> outerNormal (const Dune::FieldVector<ctype, dimension-1>& local) const
176  {
177  return i.outerNormal(local);
178  }
179 
186  Dune::FieldVector<ctype, coorddimension> integrationOuterNormal (const Dune::FieldVector<ctype, dimension-1>& local) const
187  {
188  return i.integrationOuterNormal(local);
189  }
190 
196  Dune::FieldVector<ctype, coorddimension> unitOuterNormal (const Dune::FieldVector<ctype, dimension-1>& local) const
197  {
198  return i.unitOuterNormal(local);
199  }
200 
206  Dune::FieldVector<ctype, coorddimension> centerUnitOuterNormal () const
207  {
208  return i.centerUnitOuterNormal();
209  }
210 
214  Entity inside() const
215  {
216  return i.inside();
217  }
218 
222  Entity insideHostEntity() const
223  {
224  DUNE_THROW(Dune::Exception,"This should never be called.");
225  return i.inside();
226  }
227 
234  Entity outside() const
235  {
236  return i.outside();
237  }
238 
240  const I& intersection () const
241  {
242  return i;
243  }
244 
245  unsigned int intersectionIndex() const
246  {
247  return index;
248  }
249  };
250 
251  }
252 }
253 
254 #endif // DUNE_PDELAB_COMMON_GEOMETRYWRAPPER_HH
LocalGeometry geometryInInside() const
geometrical information about this intersection in local coordinates of the inside() entity...
Definition: geometrywrapper.hh:132
I::LocalGeometry LocalGeometry
Definition: geometrywrapper.hh:65
Dune::FieldVector< ctype, coorddimension > outerNormal(const Dune::FieldVector< ctype, dimension-1 > &local) const
Return an outer normal (length not necessarily 1)
Definition: geometrywrapper.hh:175
IntersectionGeometry(const I &i_, unsigned int index_)
Definition: geometrywrapper.hh:76
Wrap intersection.
Definition: geometrywrapper.hh:56
Entity insideHostEntity() const
return Entity on the inside of this intersection. That is the Entity where we started this...
Definition: geometrywrapper.hh:222
Wrap element.
Definition: geometrywrapper.hh:15
const Entity & entity() const
Definition: geometrywrapper.hh:35
Entity outside() const
return Entity on the outside of this intersection. That is the neighboring Entity.
Definition: geometrywrapper.hh:234
E Entity
Definition: geometrywrapper.hh:21
Geometry::ctype ctype
Definition: geometrywrapper.hh:69
int indexInInside() const
Local number of codim 1 entity in the inside() Entity where intersection is contained in...
Definition: geometrywrapper.hh:160
const Entity & hostEntity() const
Definition: geometrywrapper.hh:41
For backward compatibility – Do not use this!
Definition: adaptivity.hh:27
unsigned int intersectionIndex() const
Definition: geometrywrapper.hh:245
int insideDomainIndex() const
Definition: geometrywrapper.hh:81
LocalGeometry geometryInOutside() const
geometrical information about this intersection in local coordinates of the outside() entity...
Definition: geometrywrapper.hh:144
Dune::FieldVector< ctype, coorddimension > centerUnitOuterNormal() const
Return unit outer normal (length == 1)
Definition: geometrywrapper.hh:206
Geometry geometry() const
geometrical information about this intersection in global coordinates.
Definition: geometrywrapper.hh:154
int outsideDomainIndex() const
Definition: geometrywrapper.hh:87
I::Entity Entity
Definition: geometrywrapper.hh:67
bool neighbor() const
return true if intersection is shared with another element.
Definition: geometrywrapper.hh:120
ElementGeometry(const E &e_)
Definition: geometrywrapper.hh:24
E::Geometry Geometry
Definition: geometrywrapper.hh:19
I::Geometry Geometry
Definition: geometrywrapper.hh:63
int indexInOutside() const
Local number of codim 1 entity in outside() Entity where intersection is contained in...
Definition: geometrywrapper.hh:166
int boundaryId() const
Identifier for boundary segment from macro grid.
Definition: geometrywrapper.hh:114
const I & intersection() const
Definition: geometrywrapper.hh:240
Geometry geometry() const
Definition: geometrywrapper.hh:29
Dune::FieldVector< ctype, coorddimension > unitOuterNormal(const Dune::FieldVector< ctype, dimension-1 > &local) const
Return unit outer normal (length == 1)
Definition: geometrywrapper.hh:196
Entity inside() const
return Entity on the inside of this intersection. That is the Entity where we started this...
Definition: geometrywrapper.hh:214
bool boundary() const
return true if intersection is with interior or exterior boundary (see the cases above) ...
Definition: geometrywrapper.hh:94
std::size_t index
Definition: interpolate.hh:118
Dune::FieldVector< ctype, coorddimension > integrationOuterNormal(const Dune::FieldVector< ctype, dimension-1 > &local) const
return outer normal scaled with the integration element
Definition: geometrywrapper.hh:186