dune-pdelab  2.7-git
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;
70 
72  enum { mydimension=I::mydimension };
73 
75  enum { coorddimension=Geometry::coorddimension };
76 
78  IntersectionGeometry (const I& i_, unsigned int index_)
79  : i(i_), index(index_)
80  {}
81 
83  int insideDomainIndex() const
84  {
85  return 0;
86  }
87 
89  int outsideDomainIndex() const
90  {
91  const bool is_boundary = i.boundary();
92  return 0 - int(is_boundary);
93  }
94 
96  bool boundary () const
97  {
98  return i.boundary();
99  }
100 
102  bool neighbor () const
103  {
104  return i.neighbor();
105  }
106 
115  {
116  return i.geometryInInside();
117  }
118 
127  {
128  return i.geometryInOutside();
129  }
130 
137  {
138  return i.geometry();
139  }
140 
142  int indexInInside () const
143  {
144  return i.indexInInside ();
145  }
146 
148  int indexInOutside () const
149  {
150  return i.indexInOutside ();
151  }
152 
157  Dune::FieldVector<ctype, coorddimension> outerNormal (const Dune::FieldVector<ctype, mydimension>& local) const
158  {
159  return i.outerNormal(local);
160  }
161 
168  Dune::FieldVector<ctype, coorddimension> integrationOuterNormal (const Dune::FieldVector<ctype, mydimension>& local) const
169  {
170  return i.integrationOuterNormal(local);
171  }
172 
178  Dune::FieldVector<ctype, coorddimension> unitOuterNormal (const Dune::FieldVector<ctype, mydimension>& local) const
179  {
180  return i.unitOuterNormal(local);
181  }
182 
188  Dune::FieldVector<ctype, coorddimension> centerUnitOuterNormal () const
189  {
190  return i.centerUnitOuterNormal();
191  }
192 
196  Entity inside() const
197  {
198  return i.inside();
199  }
200 
205  {
206  DUNE_THROW(Dune::Exception,"This should never be called.");
207  return i.inside();
208  }
209 
216  Entity outside() const
217  {
218  return i.outside();
219  }
220 
222  const I& intersection () const
223  {
224  return i;
225  }
226 
227  unsigned int intersectionIndex() const
228  {
229  return index;
230  }
231  };
232 
233  }
234 }
235 
236 #endif // DUNE_PDELAB_COMMON_GEOMETRYWRAPPER_HH
std::size_t index
Definition: interpolate.hh:97
For backward compatibility – Do not use this!
Definition: adaptivity.hh:28
Wrap element.
Definition: geometrywrapper.hh:16
Geometry geometry() const
Definition: geometrywrapper.hh:29
E Entity
Definition: geometrywrapper.hh:21
ElementGeometry(const E &e_)
Definition: geometrywrapper.hh:24
E::Geometry Geometry
Definition: geometrywrapper.hh:19
const Entity & hostEntity() const
Definition: geometrywrapper.hh:41
const Entity & entity() const
Definition: geometrywrapper.hh:35
Wrap intersection.
Definition: geometrywrapper.hh:57
bool neighbor() const
return true if intersection is shared with another element.
Definition: geometrywrapper.hh:102
Entity outside() const
return Entity on the outside of this intersection. That is the neighboring Entity.
Definition: geometrywrapper.hh:216
Dune::FieldVector< ctype, coorddimension > integrationOuterNormal(const Dune::FieldVector< ctype, mydimension > &local) const
return outer normal scaled with the integration element
Definition: geometrywrapper.hh:168
LocalGeometry geometryInInside() const
geometrical information about this intersection in local coordinates of the inside() entity.
Definition: geometrywrapper.hh:114
bool boundary() const
return true if intersection is with interior or exterior boundary (see the cases above)
Definition: geometrywrapper.hh:96
IntersectionGeometry(const I &i_, unsigned int index_)
Definition: geometrywrapper.hh:78
int outsideDomainIndex() const
Definition: geometrywrapper.hh:89
Entity inside() const
return Entity on the inside of this intersection. That is the Entity where we started this.
Definition: geometrywrapper.hh:196
int indexInOutside() const
Local number of codim 1 entity in outside() Entity where intersection is contained in.
Definition: geometrywrapper.hh:148
Geometry::ctype ctype
Definition: geometrywrapper.hh:69
I::Geometry Geometry
Definition: geometrywrapper.hh:63
@ mydimension
Definition: geometrywrapper.hh:72
Geometry geometry() const
geometrical information about this intersection in global coordinates.
Definition: geometrywrapper.hh:136
Dune::FieldVector< ctype, coorddimension > centerUnitOuterNormal() const
Return unit outer normal (length == 1)
Definition: geometrywrapper.hh:188
unsigned int intersectionIndex() const
Definition: geometrywrapper.hh:227
int insideDomainIndex() const
Definition: geometrywrapper.hh:83
Entity insideHostEntity() const
return Entity on the inside of this intersection. That is the Entity where we started this.
Definition: geometrywrapper.hh:204
int indexInInside() const
Local number of codim 1 entity in the inside() Entity where intersection is contained in.
Definition: geometrywrapper.hh:142
I::Entity Entity
Definition: geometrywrapper.hh:67
Dune::FieldVector< ctype, coorddimension > unitOuterNormal(const Dune::FieldVector< ctype, mydimension > &local) const
Return unit outer normal (length == 1)
Definition: geometrywrapper.hh:178
@ coorddimension
Definition: geometrywrapper.hh:75
const I & intersection() const
Definition: geometrywrapper.hh:222
I::LocalGeometry LocalGeometry
Definition: geometrywrapper.hh:65
Dune::FieldVector< ctype, coorddimension > outerNormal(const Dune::FieldVector< ctype, mydimension > &local) const
Return an outer normal (length not necessarily 1)
Definition: geometrywrapper.hh:157
LocalGeometry geometryInOutside() const
geometrical information about this intersection in local coordinates of the outside() entity.
Definition: geometrywrapper.hh:126