Dune Core Modules (2.4.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 public:
185 typedef typename GridImp::template Codim<0>::Entity Entity;
186
188 typedef typename GridImp::template Codim<0>::EntityPointer EntityPointer;
189
191 typedef typename GridImp::template Codim<1>::Geometry Geometry;
192
195
198
200 typedef typename GridImp::template Codim<1>::LocalGeometry LocalGeometry;
201
203 enum { codimension=1 };
204
206 enum { dimension=GridImp::dimension };
207
209 enum { mydimension=GridImp::dimension-1 };
210
212 enum { dimensionworld=GridImp::dimensionworld };
213
215 typedef typename GridImp::ctype ctype;
216
218 bool boundary () const
219 {
220 return this->real.boundary();
221 }
222
223#if DUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS
239 int boundaryId () const
240 {
241 return this->real.boundaryId();
242 }
243#endif
244
260 size_t boundarySegmentIndex () const
261 {
262 return this->real.boundarySegmentIndex();
263 }
264
266 bool neighbor () const
267 {
268 return this->real.neighbor();
269 }
270
274#ifdef DOXYGEN
275 Entity
276#else
277 typename std::conditional<
278 std::is_same<
279 decltype(real.inside()),
280 Entity
281 >::value,
282 Entity,
284 >::type
285#endif
286 inside() const
287 {
288 Entity::template warnOnDeprecatedEntityPointer<decltype(real.inside())>();
289 return this->real.inside();
290 }
291
298#ifdef DOXYGEN
299 Entity
300#else
301 typename std::conditional<
302 std::is_same<
303 decltype(real.outside()),
304 Entity
305 >::value,
306 Entity,
308 >::type
309#endif
310 outside() const
311 {
312 Entity::template warnOnDeprecatedEntityPointer<decltype(real.outside())>();
313 return this->real.outside();
314 }
315
318 bool conforming () const
319 {
320 return this->real.conforming();
321 }
322
337 {
338 return this->real.geometryInInside();
339 }
340
355 {
356 return this->real.geometryInOutside();
357 }
358
374 {
375 return this->real.geometry();
376 }
377
380 {
381 return this->real.type();
382 }
383
393 int indexInInside () const
394 {
395 return this->real.indexInInside();
396 }
397
407 int indexInOutside () const
408 {
409 return this->real.indexInOutside();
410 }
411
417 {
418 return this->real.outerNormal(local);
419 }
420
430 {
431 return this->real.integrationOuterNormal(local);
432 }
433
440 {
441 return this->real.unitOuterNormal(local);
442 }
443
451 {
452 return this->real.centerUnitOuterNormal();
453 }
454
456 bool operator==(const Intersection& other) const
457 {
458 return real.equals(other.real);
459 }
460
462 bool operator!=(const Intersection& other) const
463 {
464 return !real.equals(other.real);
465 }
466
469 {}
470
473 : real(other.real)
474 {}
475
478 : real(std::move(other.real))
479 {}
480
483 {
484 real = other.real;
485 return *this;
486 }
487
490 {
491 real = std::move(other.real);
492 return *this;
493 }
494
495 //===========================================================
499 //===========================================================
500
502 Intersection ( const Implementation &impl )
503 : real( impl )
504 {}
505
507 Intersection ( Implementation&& impl )
508 : real( std::move(impl) )
509 {}
510
512
513 protected:
516 friend class IntersectionIterator<GridImp, IntersectionImp, IntersectionImp>;
517
518 };
519
520 //**********************************************************************
526 template< class GridImp, class IntersectionImp >
528 {
529 enum { dim=GridImp::dimension };
530 enum { dimworld=GridImp::dimensionworld };
531 typedef typename GridImp::ctype ct;
532 public:
533
538 {
539 FieldVector<ct, dimworld> n = asImp().unitOuterNormal(local);
540 n *= asImp().geometry().integrationElement(local);
541 return n;
542 }
543
546 {
547 FieldVector<ct, dimworld> n = asImp().outerNormal(local);
548 n /= n.two_norm();
549 return n;
550 }
551
554 {
555 // For now, we do this...
556 GeometryType type = asImp().geometry().type();
557 const ReferenceElement<ct, dim-1> & refElement =
559 return asImp().unitOuterNormal(refElement.position(0,0));
560 // But later, if we change the meaning of center(),
561 // we may have to change to this...
562 // return asImp().unitOuterNormal(asImp().local(asImp().center()));
563 }
564
565 private:
566 // CRTP (curiously recurring template pattern)
567 IntersectionImp &asImp () { return static_cast< IntersectionImp & >( *this ); }
568 const IntersectionImp &asImp () const { return static_cast< const IntersectionImp & >( *this ); }
569 };
570
571} // namespace Dune
572
573#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:589
Wrapper class for pointers to entities.
Definition: entitypointer.hh:113
Wrapper class for entities.
Definition: entity.hh:62
vector space out of a tensor product of fields.
Definition: fvector.hh:94
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:25
Definition: grid.hh:1030
Default Implementations of integrationOuterNormal and unitOuterNormal for IntersectionImp.
Definition: intersection.hh:528
FieldVector< ct, dimworld > integrationOuterNormal(const FieldVector< ct, dim-1 > &local) const
Definition: intersection.hh:537
FieldVector< ct, dimworld > unitOuterNormal(const FieldVector< ct, dim-1 > &local) const
return unit outer normal
Definition: intersection.hh:545
FieldVector< ct, dimworld > centerUnitOuterNormal() const
return unit outer normal at center of intersection geometry
Definition: intersection.hh:553
Mesh entities of codimension 0 ("elements") allow to visit all intersections with "neighboring" eleme...
Definition: intersectioniterator.hh:84
Intersection of a mesh entities of codimension 0 ("elements") with a "neighboring" element or with th...
Definition: intersection.hh:161
Intersection & operator=(const Intersection &other)
Copy assignment operator from an existing intersection.
Definition: intersection.hh:482
Geometry geometry() const
geometrical information about the intersection in global coordinates.
Definition: intersection.hh:373
bool conforming() const
Return true if intersection is conforming.
Definition: intersection.hh:318
Entity outside() const
return EntityPointer to the Entity on the outside of this intersection. That is the neighboring Entit...
Definition: intersection.hh:310
int indexInOutside() const
Local index of codim 1 entity in outside() entity where intersection is contained in.
Definition: intersection.hh:407
@ codimension
Definition: intersection.hh:203
bool neighbor() const
return true if intersection is shared with another element.
Definition: intersection.hh:266
bool boundary() const
Return true if intersection is with interior or exterior boundary (see the cases above)
Definition: intersection.hh:218
int indexInInside() const
Local index of codim 1 entity in the inside() entity where intersection is contained in.
Definition: intersection.hh:393
Intersection(Implementation &&impl)
Definition: intersection.hh:507
Intersection & operator=(Intersection &&other)
Move assignment operator from an existing intersection.
Definition: intersection.hh:489
Geometry::GlobalCoordinate GlobalCoordinate
Type for normal vectors.
Definition: intersection.hh:197
@ mydimension
Definition: intersection.hh:209
GridImp::template Codim< 0 >::EntityPointer EntityPointer
Pointer to the type of entities that this Intersection belongs to.
Definition: intersection.hh:188
GridImp::template Codim< 1 >::LocalGeometry LocalGeometry
Codim 1 geometry returned by geometryInInside() and geometryInOutside()
Definition: intersection.hh:200
GlobalCoordinate unitOuterNormal(const LocalCoordinate &local) const
Return unit outer normal (length == 1)
Definition: intersection.hh:439
bool operator!=(const Intersection &other) const
Compares two intersections for inequality.
Definition: intersection.hh:462
GeometryType type() const
obtain the type of reference element for this intersection
Definition: intersection.hh:379
Intersection(Intersection &&other)
Move constructor from an existing intersection.
Definition: intersection.hh:477
LocalGeometry geometryInOutside() const
geometrical information about this intersection in local coordinates of the outside() entity.
Definition: intersection.hh:354
LocalGeometry geometryInInside() const
geometrical information about this intersection in local coordinates of the inside() entity.
Definition: intersection.hh:336
size_t boundarySegmentIndex() const
index of the boundary segment within the macro grid
Definition: intersection.hh:260
Entity inside() const
return EntityPointer to the Entity on the inside of this intersection. That is the Entity where we st...
Definition: intersection.hh:286
Geometry::LocalCoordinate LocalCoordinate
Type for vectors of coordinates on the intersection.
Definition: intersection.hh:194
GlobalCoordinate centerUnitOuterNormal() const
Return unit outer normal (length == 1)
Definition: intersection.hh:450
GridImp::template Codim< 1 >::Geometry Geometry
Codim 1 geometry returned by geometry()
Definition: intersection.hh:191
Implementation & impl()
return reference to the real implementation
Definition: intersection.hh:176
@ dimensionworld
Definition: intersection.hh:212
GridImp::template Codim< 0 >::Entity Entity
Type of entity that this Intersection belongs to.
Definition: intersection.hh:185
const Implementation & impl() const
return reference to the real implementation
Definition: intersection.hh:178
GlobalCoordinate outerNormal(const LocalCoordinate &local) const
Return an outer normal (length not necessarily 1)
Definition: intersection.hh:416
@ dimension
Definition: intersection.hh:206
Intersection()
Default constructor.
Definition: intersection.hh:468
GridImp::ctype ctype
Type of individual coefficients of coordinate vectors.
Definition: intersection.hh:215
Intersection(const Implementation &impl)
Definition: intersection.hh:502
GlobalCoordinate integrationOuterNormal(const LocalCoordinate &local) const
return unit outer normal scaled with the integration element
Definition: intersection.hh:429
bool operator==(const Intersection &other) const
Compares two intersections for equality.
Definition: intersection.hh:456
Intersection(const Intersection &other)
Copy constructor from an existing intersection.
Definition: intersection.hh:472
This class provides access to geometric and topological properties of a reference element.
Definition: referenceelements.hh:55
Different resources needed by all grid implementations.
Dune namespace.
Definition: alignment.hh:10
STL namespace.
Static tag representing a codimension.
Definition: dimension.hh:22
static const ReferenceElement< ctype, dim > & general(const GeometryType &type)
get general reference elements
Definition: referenceelements.hh:484
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 24, 22:29, 2024)