Dune Core Modules (2.3.1)

intersectioniteratorwrapper.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_INTERSECTIONITERATORWRAPPER_HH
4#define DUNE_INTERSECTIONITERATORWRAPPER_HH
5
6#include <dune/grid/common/intersectioniterator.hh>
7
13namespace Dune {
14
17 template <class GridImp, class IntersectionIteratorImpl>
19 {
20 enum { dim = GridImp :: dimension };
21 enum { dimworld = GridImp :: dimensionworld };
22
24
25 typedef IntersectionIteratorImpl IntersectionIteratorImp;
26
27 typedef typename IntersectionIteratorImp :: StorageType IntersectionIteratorProviderType;
28
29 public:
30 typedef typename GridImp :: GridObjectFactoryType FactoryType;
31
33 enum { dimension = dim };
35 enum { dimensionworld = dimworld };
36
38 typedef typename GridImp :: ctype ctype;
39
41 typedef typename GridImp::template Codim<0>::Entity Entity;
43 typedef typename GridImp::template Codim<0>::EntityPointer EntityPointer;
44
46 typedef typename GridImp::template Codim<1>::Geometry Geometry;
48 typedef typename GridImp::template Codim<1>::LocalGeometry LocalGeometry;
49
52
54 template <class EntityImp>
55 IntersectionIteratorWrapper(const EntityImp & en, int wLevel , bool end)
56 : factory_( en.factory() )
57 , it_( factory_.getIntersection(wLevel, (IntersectionIteratorImpl *) 0) )
58 {
59 if(end)
60 it().done( en );
61 else
62 it().first(en,wLevel);
63 }
64
67 : factory_( org.factory_ )
68 , it_( factory_.getIntersection(-1, (IntersectionIteratorImpl *) 0) )
69 {
70 it().assign( org.it() );
71 }
72
75 {
76 it().assign( org.it() );
77 return *this;
78 }
79
82 {
83 factory_.freeIntersection( it() );
84 }
85
87 bool equals (const ThisType & i) const { return it().equals(i.it()); }
88
90 void increment () { it().increment(); }
91
93 EntityPointer outside() const { return it().outside(); }
94
96 EntityPointer inside() const { return it().inside(); }
97
100 bool boundary () const { return it().boundary(); }
101
103 bool neighbor () const { return it().neighbor(); }
104
106 int boundaryId () const { return it().boundaryId(); }
107
109 size_t boundarySegmentIndex() const { return it().boundarySegmentIndex(); }
110
116 {
117 return it().geometryInInside();
118 }
119
125 {
126 return it().geometry();
127 }
128
131 {
132 return it().type();
133 }
134
137 int indexInInside () const
138 {
139 return it().indexInInside();
140 }
141
146 {
147 return it().geometryInOutside();
148 }
149
152 int indexInOutside () const
153 {
154 return it().indexInOutside();
155 }
156
158 int twistInSelf() const { return it().twistInSelf(); }
159
161 int twistInInside() const { return it().twistInInside(); }
162
164 int twistInNeighbor() const { return it().twistInNeighbor(); }
165
167 int twistInOutside() const { return it().twistInOutside(); }
168
172 {
173 return it().unitOuterNormal( local );
174 }
175
179 {
180 GeometryType type = geometry().type();
181 const ReferenceElement<ctype, dim-1> & refElement =
183 return unitOuterNormal(refElement.position(0,0));
184 }
185
189 {
190 return it().outerNormal( local );
191 }
192
196 {
197 return it().integrationOuterNormal( local );
198 }
199
201 int level () const { return it().level(); }
202
204 bool conforming () const { return it().conforming(); }
205
207 IntersectionIteratorImp & it() { return it_; }
208 const IntersectionIteratorImp & it() const { return it_; }
209
210 private:
211 const FactoryType& factory_ ;
212 IntersectionIteratorImp & it_;
213 }; // end class IntersectionIteratorWrapper
214
215 template <class GridImp>
216 class LeafIntersectionWrapper
217 : public IntersectionIteratorWrapper<GridImp,typename GridImp::LeafIntersectionIteratorImp>
218 {
219 typedef LeafIntersectionWrapper<GridImp> ThisType;
220 typedef IntersectionIteratorWrapper<GridImp,typename GridImp::LeafIntersectionIteratorImp> BaseType;
221 public:
223 template <class EntityImp>
224 LeafIntersectionWrapper(const EntityImp & en, int wLevel , bool end )
225 : BaseType(en,wLevel,end)
226 {}
227
229 LeafIntersectionWrapper(const ThisType & org)
230 : BaseType(org)
231 {}
232
233 };
234
237 template <class GridImp>
239 {
241 typedef LeafIntersectionWrapper<GridImp> IntersectionImp;
242
243 public:
245
247 enum { dimension = GridImp :: dimension };
249 enum { dimensionworld = GridImp :: dimensionworld };
250
252 typedef typename GridImp :: ctype ctype;
253
255 typedef typename GridImp::template Codim<0>::Entity Entity;
257 typedef typename GridImp::template Codim<0>::EntityPointer EntityPointer;
258
260 typedef typename GridImp::template Codim<1>::Geometry Geometry;
262 typedef typename GridImp::template Codim<1>::LocalGeometry LocalGeometry;
263
266
268 template <class EntityImp>
269 LeafIntersectionIteratorWrapper(const EntityImp & en, int wLevel , bool end )
270 : intersection_( IntersectionImp(en,wLevel,end) )
271 {}
272
275 : intersection_( IntersectionImp( org.impl() ) )
276 {}
277
280 {
281 impl() = org.impl();
282 return *this;
283 }
284
286 const Intersection &dereference () const
287 {
288 return intersection_;
289 }
290
292 bool equals (const ThisType & i) const { return impl().equals( i.impl() ); }
293
296 {
297 impl().increment();
298 }
299 protected:
300 // intersection object
301 Intersection intersection_;
302
303 // return reference to real implementation
304 IntersectionImp& impl() { return GridImp :: getRealImplementation( intersection_ ); }
305 // return reference to real implementation
306 const IntersectionImp& impl() const { return GridImp :: getRealImplementation( intersection_ ); }
307 }; // end class IntersectionIteratorWrapper
308
311 template <class GridImp>
313 : public IntersectionIteratorWrapper<GridImp,typename GridImp::LevelIntersectionIteratorImp>
314 {
317 public:
319 template <class EntityImp>
320 LevelIntersectionWrapper(const EntityImp & en, int wLevel , bool end )
321 : BaseType(en,wLevel,end)
322 {}
323
326 : BaseType(org)
327 {}
328 };
329
332 template <class GridImp>
334 {
337 public:
339
341 enum { dimension = GridImp :: dimension };
343 enum { dimensionworld = GridImp :: dimensionworld };
344
346 typedef typename GridImp :: ctype ctype;
347
349 typedef typename GridImp::template Codim<0>::Entity Entity;
351 typedef typename GridImp::template Codim<0>::EntityPointer EntityPointer;
352
354 typedef typename GridImp::template Codim<1>::Geometry Geometry;
356 typedef typename GridImp::template Codim<1>::LocalGeometry LocalGeometry;
357
360
362 template <class EntityImp>
363 LevelIntersectionIteratorWrapper(const EntityImp & en, int wLevel , bool end )
364 : intersection_( IntersectionImp(en,wLevel,end) )
365 {}
366
369 : intersection_( IntersectionImp( org.impl() ) )
370 {}
371
374 {
375 impl() = org.impl();
376 return *this;
377 }
378
380 const Intersection &dereference () const
381 {
382 return intersection_;
383 }
384
386 bool equals (const ThisType & i) const { return impl().equals( i.impl() ); }
387
390 {
391 impl().increment();
392 }
393 protected:
394 // intersection object
395 Intersection intersection_;
396
397 // return reference to real implementation
398 IntersectionImp& impl() { return GridImp :: getRealImplementation( intersection_ ); }
399 // return reference to real implementation
400 const IntersectionImp& impl() const { return GridImp :: getRealImplementation( intersection_ ); }
401 }; // end class IntersectionIteratorWrapper
402
403} // end namespace Dune
404#endif
vector space out of a tensor product of fields.
Definition: fvector.hh:92
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:25
Class that wraps IntersectionIteratorImp of a grid and gets it's internal object from a object stack ...
Definition: intersectioniteratorwrapper.hh:19
const NormalType centerUnitOuterNormal() const
Definition: intersectioniteratorwrapper.hh:178
IntersectionIteratorWrapper(const EntityImp &en, int wLevel, bool end)
constructor called from the ibegin and iend method
Definition: intersectioniteratorwrapper.hh:55
Geometry geometry() const
Definition: intersectioniteratorwrapper.hh:124
int twistInNeighbor() const
twist of the face seen from the outer element
Definition: intersectioniteratorwrapper.hh:164
const NormalType outerNormal(const FieldVector< ctype, dim-1 > &local) const
Definition: intersectioniteratorwrapper.hh:188
size_t boundarySegmentIndex() const
return the boundary segment index
Definition: intersectioniteratorwrapper.hh:109
bool boundary() const
Definition: intersectioniteratorwrapper.hh:100
EntityPointer outside() const
access neighbor
Definition: intersectioniteratorwrapper.hh:93
void increment()
increment iterator
Definition: intersectioniteratorwrapper.hh:90
IntersectionIteratorImp & it()
returns reference to underlying intersection iterator implementation
Definition: intersectioniteratorwrapper.hh:207
bool conforming() const
return true if intersection is conform (i.e. only one neighbor)
Definition: intersectioniteratorwrapper.hh:204
int boundaryId() const
return information about the Boundary
Definition: intersectioniteratorwrapper.hh:106
bool equals(const ThisType &i) const
the equality method
Definition: intersectioniteratorwrapper.hh:87
GridImp::template Codim< 0 >::Entity Entity
Entity type.
Definition: intersectioniteratorwrapper.hh:41
GridImp::ctype ctype
define type used for coordinates in grid module
Definition: intersectioniteratorwrapper.hh:38
ThisType & operator=(const ThisType &org)
the f*cking assignment operator
Definition: intersectioniteratorwrapper.hh:74
GeometryType type() const
obtain the type of reference element for this intersection
Definition: intersectioniteratorwrapper.hh:130
GridImp::template Codim< 1 >::LocalGeometry LocalGeometry
type of intersection*Local
Definition: intersectioniteratorwrapper.hh:48
EntityPointer inside() const
access entity where iteration started
Definition: intersectioniteratorwrapper.hh:96
int twistInOutside() const
twist of the face seen from the outer element
Definition: intersectioniteratorwrapper.hh:167
IntersectionIteratorWrapper(const ThisType &org)
The copy constructor.
Definition: intersectioniteratorwrapper.hh:66
const NormalType integrationOuterNormal(const FieldVector< ctype, dim-1 > &local) const
Definition: intersectioniteratorwrapper.hh:195
int twistInInside() const
twist of the face seen from the inner element
Definition: intersectioniteratorwrapper.hh:161
int twistInSelf() const
twist of the face seen from the inner element
Definition: intersectioniteratorwrapper.hh:158
LocalGeometry geometryInInside() const
Definition: intersectioniteratorwrapper.hh:115
int level() const
return level of iterator
Definition: intersectioniteratorwrapper.hh:201
FieldVector< ctype, dimworld > NormalType
type of normal vector
Definition: intersectioniteratorwrapper.hh:51
LocalGeometry geometryInOutside() const
Definition: intersectioniteratorwrapper.hh:145
GridImp::template Codim< 1 >::Geometry Geometry
type of intersectionGlobal
Definition: intersectioniteratorwrapper.hh:46
int indexInInside() const
Definition: intersectioniteratorwrapper.hh:137
int indexInOutside() const
Definition: intersectioniteratorwrapper.hh:152
~IntersectionIteratorWrapper()
The Destructor puts internal object back to stack.
Definition: intersectioniteratorwrapper.hh:81
bool neighbor() const
return true if across the intersection a neighbor on this level exists
Definition: intersectioniteratorwrapper.hh:103
const NormalType unitOuterNormal(const FieldVector< ctype, dim-1 > &local) const
Definition: intersectioniteratorwrapper.hh:171
GridImp::template Codim< 0 >::EntityPointer EntityPointer
type of EntityPointer
Definition: intersectioniteratorwrapper.hh:43
Intersection of a mesh entities of codimension 0 ("elements") with a "neighboring" element or with th...
Definition: intersection.hh:161
Class that wraps IntersectionIteratorImp of a grid and gets it's internal object from a object stack ...
Definition: intersectioniteratorwrapper.hh:239
bool equals(const ThisType &i) const
the equality method
Definition: intersectioniteratorwrapper.hh:292
GridImp::template Codim< 1 >::LocalGeometry LocalGeometry
type of intersection*Local
Definition: intersectioniteratorwrapper.hh:262
GridImp::template Codim< 0 >::Entity Entity
Entity type.
Definition: intersectioniteratorwrapper.hh:255
const Intersection & dereference() const
return reference to intersection
Definition: intersectioniteratorwrapper.hh:286
LeafIntersectionIteratorWrapper(const EntityImp &en, int wLevel, bool end)
constructor called from the ibegin and iend method
Definition: intersectioniteratorwrapper.hh:269
LeafIntersectionIteratorWrapper(const ThisType &org)
The copy constructor.
Definition: intersectioniteratorwrapper.hh:274
GridImp::template Codim< 0 >::EntityPointer EntityPointer
type of EntityPointer
Definition: intersectioniteratorwrapper.hh:257
GridImp::ctype ctype
define type used for coordinates in grid module
Definition: intersectioniteratorwrapper.hh:252
ThisType & operator=(const ThisType &org)
the f*cking assignment operator
Definition: intersectioniteratorwrapper.hh:279
void increment()
increment iterator
Definition: intersectioniteratorwrapper.hh:295
GridImp::template Codim< 1 >::Geometry Geometry
type of intersectionGlobal
Definition: intersectioniteratorwrapper.hh:260
FieldVector< ctype, dimensionworld > NormalType
type of normal vector
Definition: intersectioniteratorwrapper.hh:265
Class that wraps IntersectionIteratorImp of a grid and gets it's internal object from a object stack ...
Definition: intersectioniteratorwrapper.hh:334
GridImp::ctype ctype
define type used for coordinates in grid module
Definition: intersectioniteratorwrapper.hh:346
LevelIntersectionIteratorWrapper(const EntityImp &en, int wLevel, bool end)
constructor called from the ibegin and iend method
Definition: intersectioniteratorwrapper.hh:363
GridImp::template Codim< 0 >::Entity Entity
Entity type.
Definition: intersectioniteratorwrapper.hh:349
bool equals(const ThisType &i) const
the equality method
Definition: intersectioniteratorwrapper.hh:386
GridImp::template Codim< 1 >::Geometry Geometry
type of intersectionGlobal
Definition: intersectioniteratorwrapper.hh:354
FieldVector< ctype, dimensionworld > NormalType
type of normal vector
Definition: intersectioniteratorwrapper.hh:359
GridImp::template Codim< 1 >::LocalGeometry LocalGeometry
type of intersection*Local
Definition: intersectioniteratorwrapper.hh:356
void increment()
increment iterator
Definition: intersectioniteratorwrapper.hh:389
ThisType & operator=(const ThisType &org)
the f*cking assignment operator
Definition: intersectioniteratorwrapper.hh:373
LevelIntersectionIteratorWrapper(const ThisType &org)
The copy constructor.
Definition: intersectioniteratorwrapper.hh:368
GridImp::template Codim< 0 >::EntityPointer EntityPointer
type of EntityPointer
Definition: intersectioniteratorwrapper.hh:351
const Intersection & dereference() const
return reference to intersection
Definition: intersectioniteratorwrapper.hh:380
Class that wraps IntersectionIteratorImp of a grid and gets it's internal object from a object stack ...
Definition: intersectioniteratorwrapper.hh:314
LevelIntersectionWrapper(const EntityImp &en, int wLevel, bool end)
constructor called from the ibegin and iend method
Definition: intersectioniteratorwrapper.hh:320
LevelIntersectionWrapper(const ThisType &org)
The copy constructor.
Definition: intersectioniteratorwrapper.hh:325
This class provides access to geometric and topological properties of a reference element....
Definition: referenceelements.hh:58
Dune namespace.
Definition: alignment.hh:14
static const ReferenceElement< ctype, dim > & general(const GeometryType &type)
get general reference elements
Definition: referenceelements.hh:568
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 12, 23:30, 2024)