Dune Core Modules (2.3.1)

intersection.hh
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3
4#ifndef DUNE_GRID_INTERSECTION_HH
5#define DUNE_GRID_INTERSECTION_HH
6
8
9namespace Dune
10{
11
159 template< class GridImp, class IntersectionImp >
161 {
162#if DUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS
163 public:
164#else
165 protected:
166 // give the GridDefaultImplementation class access to the realImp
167 friend class GridDefaultImplementation<
168 GridImp::dimension, GridImp::dimensionworld,
169 typename GridImp::ctype,
170 typename GridImp::GridFamily> ;
171#endif
172 // type of underlying implementation, for internal use only
173 typedef IntersectionImp Implementation;
174
176 Implementation &impl () { return real; }
178 const Implementation &impl () const { return real; }
179
180 protected:
181 Implementation real;
182
183 enum { dim=GridImp::dimension };
184 enum { dimworld=GridImp::dimensionworld };
185
186 public:
188 typedef typename GridImp::template Codim<0>::Entity Entity;
189
191 typedef typename GridImp::template Codim<0>::EntityPointer EntityPointer;
192
194 typedef typename GridImp::template Codim<1>::Geometry Geometry;
195
198
201
203 typedef typename GridImp::template Codim<1>::LocalGeometry LocalGeometry;
204
206 enum { codimension=1 };
207
209 enum { dimension=dim };
210
212 enum { mydimension=dim-1 };
213
215 enum { dimensionworld=dimworld };
216
218 typedef typename GridImp::ctype ctype;
219
221 bool boundary () const
222 {
223 return this->real.boundary();
224 }
225
226#if DUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS
242 int boundaryId () const
243 {
244 return this->real.boundaryId();
245 }
246#endif
247
259 size_t boundarySegmentIndex () const
260 {
261 return this->real.boundarySegmentIndex();
262 }
263
265 bool neighbor () const
266 {
267 return this->real.neighbor();
268 }
269
274 {
275 return this->real.inside();
276 }
277
285 {
286 return this->real.outside();
287 }
288
291 bool conforming () const
292 {
293 return this->real.conforming();
294 }
295
310 {
311 return this->real.geometryInInside();
312 }
313
328 {
329 return this->real.geometryInOutside();
330 }
331
344 {
345 return this->real.geometry();
346 }
347
350 {
351 return this->real.type();
352 }
353
363 int indexInInside () const
364 {
365 return this->real.indexInInside();
366 }
367
377 int indexInOutside () const
378 {
379 return this->real.indexInOutside();
380 }
381
387 {
388 return this->real.outerNormal(local);
389 }
390
398 {
399 return this->real.integrationOuterNormal(local);
400 }
401
408 {
409 return this->real.unitOuterNormal(local);
410 }
411
419 {
420 return this->real.centerUnitOuterNormal();
421 }
422
423 //===========================================================
427 //===========================================================
428
430 Intersection ( const Implementation &impl )
431 : real( impl )
432 {}
434
435 protected:
438 friend class IntersectionIterator<GridImp, IntersectionImp, IntersectionImp>;
439
440 /* hide copy constructor */
441 Intersection ( const Intersection &i )
442 : real( i.real )
443 {}
444
445 /* hide assignment operator */
446 const Intersection &operator= ( const Intersection &i )
447 {
448 real = i.real;
449 return *this;
450 }
451 };
452
453 //**********************************************************************
459 template< class GridImp, class IntersectionImp >
461 {
462 enum { dim=GridImp::dimension };
463 enum { dimworld=GridImp::dimensionworld };
464 typedef typename GridImp::ctype ct;
465 public:
466
471 {
472 FieldVector<ct, dimworld> n = asImp().unitOuterNormal(local);
473 n *= asImp().intersectionGlobal().integrationElement(local);
474 return n;
475 }
476
479 {
480 FieldVector<ct, dimworld> n = asImp().outerNormal(local);
481 n /= n.two_norm();
482 return n;
483 }
484
487 {
488 // For now, we do this...
489 GeometryType type = asImp().geometry().type();
490 const ReferenceElement<ct, dim-1> & refElement =
492 return asImp().unitOuterNormal(refElement.position(0,0));
493 // But later, if we change the meaning of center(),
494 // we may have to change to this...
495 // return asImp().unitOuterNormal(asImp().local(asImp().center()));
496 }
497
498 private:
499 // CRTP (curiously recurring template pattern)
500 IntersectionImp &asImp () { return static_cast< IntersectionImp & >( *this ); }
501 const IntersectionImp &asImp () const { return static_cast< const IntersectionImp & >( *this ); }
502 };
503
504} // namespace Dune
505
506#endif // DUNE_GRID_INTERSECTION_HH
FieldTraits< value_type >::real_type two_norm() const
two norm sqrt(sum over squared values of entries)
Definition: densevector.hh:521
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
Definition: grid.hh:1017
Default Implementations of integrationOuterNormal and unitOuterNormal for IntersectionImp.
Definition: intersection.hh:461
FieldVector< ct, dimworld > integrationOuterNormal(const FieldVector< ct, dim-1 > &local) const
Definition: intersection.hh:470
FieldVector< ct, dimworld > unitOuterNormal(const FieldVector< ct, dim-1 > &local) const
return unit outer normal
Definition: intersection.hh:478
FieldVector< ct, dimworld > centerUnitOuterNormal() const
return unit outer normal at center of intersection geometry
Definition: intersection.hh:486
Mesh entities of codimension 0 ("elements") allow to visit all intersections with "neighboring" eleme...
Definition: intersectioniterator.hh:83
Intersection of a mesh entities of codimension 0 ("elements") with a "neighboring" element or with th...
Definition: intersection.hh:161
Geometry geometry() const
geometrical information about the intersection in global coordinates.
Definition: intersection.hh:343
bool conforming() const
Return true if intersection is conforming.
Definition: intersection.hh:291
@ codimension
Definition: intersection.hh:206
int indexInOutside() const
Local index of codim 1 entity in outside() entity where intersection is contained in.
Definition: intersection.hh:377
@ mydimension
Definition: intersection.hh:212
bool neighbor() const
return true if intersection is shared with another element.
Definition: intersection.hh:265
bool boundary() const
Return true if intersection is with interior or exterior boundary (see the cases above)
Definition: intersection.hh:221
int indexInInside() const
Local index of codim 1 entity in the inside() entity where intersection is contained in.
Definition: intersection.hh:363
Geometry::GlobalCoordinate GlobalCoordinate
Type for normal vectors.
Definition: intersection.hh:200
@ dimensionworld
Definition: intersection.hh:215
GridImp::template Codim< 0 >::EntityPointer EntityPointer
Pointer to the type of entities that this Intersection belongs to.
Definition: intersection.hh:191
GridImp::template Codim< 1 >::LocalGeometry LocalGeometry
Codim 1 geometry returned by geometryInInside and geometryInOutside()
Definition: intersection.hh:203
GlobalCoordinate unitOuterNormal(const LocalCoordinate &local) const
Return unit outer normal (length == 1)
Definition: intersection.hh:407
GeometryType type() const
obtain the type of reference element for this intersection
Definition: intersection.hh:349
LocalGeometry geometryInOutside() const
geometrical information about this intersection in local coordinates of the outside() entity.
Definition: intersection.hh:327
LocalGeometry geometryInInside() const
geometrical information about this intersection in local coordinates of the inside() entity.
Definition: intersection.hh:309
size_t boundarySegmentIndex() const
index of the boundary segment within the macro grid
Definition: intersection.hh:259
@ dimension
Definition: intersection.hh:209
Geometry::LocalCoordinate LocalCoordinate
Type for vectors of coordinates on the intersection.
Definition: intersection.hh:197
GlobalCoordinate centerUnitOuterNormal() const
Return unit outer normal (length == 1)
Definition: intersection.hh:418
GridImp::template Codim< 1 >::Geometry Geometry
Codim 1 geometry returned by geometry()
Definition: intersection.hh:194
Implementation & impl()
return reference to the real implementation
Definition: intersection.hh:176
GridImp::template Codim< 0 >::Entity Entity
Type of entity that this Intersection belongs to.
Definition: intersection.hh:188
const Implementation & impl() const
return reference to the real implementation
Definition: intersection.hh:178
EntityPointer inside() const
return EntityPointer to the Entity on the inside of this intersection. That is the Entity where we st...
Definition: intersection.hh:273
EntityPointer outside() const
return EntityPointer to the Entity on the outside of this intersection. That is the neighboring Entit...
Definition: intersection.hh:284
GlobalCoordinate outerNormal(const LocalCoordinate &local) const
Return an outer normal (length not necessarily 1)
Definition: intersection.hh:386
GridImp::ctype ctype
Type of individual coefficients of coordinate vectors.
Definition: intersection.hh:218
Intersection(const Implementation &impl)
Definition: intersection.hh:430
GlobalCoordinate integrationOuterNormal(const LocalCoordinate &local) const
return outer normal scaled with the integration element
Definition: intersection.hh:397
This class provides access to geometric and topological properties of a reference element....
Definition: referenceelements.hh:58
Different resources needed by all grid implementations.
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 (Jul 15, 22:36, 2024)