Dune Core Modules (2.6.0)

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 
9 namespace Dune
10 {
11 
160  template< class GridImp, class IntersectionImp >
162  {
163  public:
169  typedef IntersectionImp Implementation;
170 
176  Implementation &impl () { return real; }
177 
183  const Implementation &impl () const { return real; }
184 
185  protected:
186  Implementation real;
187 
188  public:
190  typedef typename GridImp::template Codim<0>::Entity Entity;
191 
193  typedef typename GridImp::template Codim<1>::Geometry Geometry;
194 
197 
200 
202  typedef typename GridImp::template Codim<1>::LocalGeometry LocalGeometry;
203 
207  enum DUNE_DEPRECATED_MSG("Deprecated: codimensions of an intersection are always 1!") { codimension=1 };
208 
214  enum DUNE_DEPRECATED_MSG("Deprecated: get this dimension from the grid itself, or from an element!") { dimension=GridImp::dimension };
215 
217  enum { mydimension=GridImp::dimension-1 };
218 
220  enum { dimensionworld=GridImp::dimensionworld };
221 
223  typedef typename GridImp::ctype ctype;
224 
226  bool boundary () const
227  {
228  return this->real.boundary();
229  }
230 
246  size_t boundarySegmentIndex () const
247  {
248  return this->real.boundarySegmentIndex();
249  }
250 
252  bool neighbor () const
253  {
254  return this->real.neighbor();
255  }
256 
260  Entity inside() const
261  {
262  return this->real.inside();
263  }
264 
271  Entity outside() const
272  {
273  return this->real.outside();
274  }
275 
278  bool conforming () const
279  {
280  return this->real.conforming();
281  }
282 
297  {
298  return this->real.geometryInInside();
299  }
300 
315  {
316  return this->real.geometryInOutside();
317  }
318 
334  {
335  return this->real.geometry();
336  }
337 
340  {
341  return this->real.type();
342  }
343 
356  int indexInInside () const
357  {
358  return this->real.indexInInside();
359  }
360 
373  int indexInOutside () const
374  {
375  return this->real.indexInOutside();
376  }
377 
383  {
384  return this->real.outerNormal(local);
385  }
386 
396  {
397  return this->real.integrationOuterNormal(local);
398  }
399 
406  {
407  return this->real.unitOuterNormal(local);
408  }
409 
417  {
418  return this->real.centerUnitOuterNormal();
419  }
420 
422  bool operator==(const Intersection& other) const
423  {
424  return real.equals(other.real);
425  }
426 
428  bool operator!=(const Intersection& other) const
429  {
430  return !real.equals(other.real);
431  }
432 
435  {}
436 
439  : real(other.real)
440  {}
441 
444  : real(std::move(other.real))
445  {}
446 
449  {
450  real = other.real;
451  return *this;
452  }
453 
456  {
457  real = std::move(other.real);
458  return *this;
459  }
460 
461  //===========================================================
465  //===========================================================
466 
469  : real( impl )
470  {}
471 
474  : real( std::move(impl) )
475  {}
476 
478 
479  protected:
482  friend class IntersectionIterator<GridImp, IntersectionImp, IntersectionImp>;
483 
484  };
485 
486  //**********************************************************************
492  template< class GridImp, class IntersectionImp >
494  {
495  enum { dim=GridImp::dimension };
496  enum { dimworld=GridImp::dimensionworld };
497  typedef typename GridImp::ctype ct;
498  public:
499 
504  {
505  FieldVector<ct, dimworld> n = asImp().unitOuterNormal(local);
506  n *= asImp().geometry().integrationElement(local);
507  return n;
508  }
509 
512  {
513  FieldVector<ct, dimworld> n = asImp().outerNormal(local);
514  n /= n.two_norm();
515  return n;
516  }
517 
520  {
521  // For now, we do this...
522  GeometryType type = asImp().geometry().type();
523  auto refElement = referenceElement<ct, dim-1>(type);
524  return asImp().unitOuterNormal(refElement.position(0,0));
525  // But later, if we change the meaning of center(),
526  // we may have to change to this...
527  // return asImp().unitOuterNormal(asImp().local(asImp().center()));
528  }
529 
530  private:
531  // CRTP (curiously recurring template pattern)
532  IntersectionImp &asImp () { return static_cast< IntersectionImp & >( *this ); }
533  const IntersectionImp &asImp () const { return static_cast< const IntersectionImp & >( *this ); }
534  };
535 
536 } // namespace Dune
537 
538 #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:590
vector space out of a tensor product of fields.
Definition: fvector.hh:93
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:277
Default Implementations of integrationOuterNormal and unitOuterNormal for IntersectionImp.
Definition: intersection.hh:494
FieldVector< ct, dimworld > integrationOuterNormal(const FieldVector< ct, dim-1 > &local) const
Definition: intersection.hh:503
FieldVector< ct, dimworld > centerUnitOuterNormal() const
return unit outer normal at center of intersection geometry
Definition: intersection.hh:519
FieldVector< ct, dimworld > unitOuterNormal(const FieldVector< ct, dim-1 > &local) const
return unit outer normal
Definition: intersection.hh:511
Mesh entities of codimension 0 ("elements") allow to visit all intersections with "neighboring" eleme...
Definition: intersectioniterator.hh:81
Intersection of a mesh entity of codimension 0 ("element") with a "neighboring" element or with the d...
Definition: intersection.hh:162
Geometry geometry() const
geometrical information about the intersection in global coordinates.
Definition: intersection.hh:333
bool conforming() const
Return true if intersection is conforming.
Definition: intersection.hh:278
Entity outside() const
return Entity on the outside of this intersection. That is the neighboring Entity.
Definition: intersection.hh:271
Intersection & operator=(const Intersection &other)
Copy assignment operator from an existing intersection.
Definition: intersection.hh:448
int indexInOutside() const
Local index of codim 1 entity in outside() entity where intersection is contained in.
Definition: intersection.hh:373
Intersection & operator=(Intersection &&other)
Move assignment operator from an existing intersection.
Definition: intersection.hh:455
bool neighbor() const
return true if intersection is shared with another element.
Definition: intersection.hh:252
const Implementation & impl() const
access to the underlying implementation
Definition: intersection.hh:183
bool boundary() const
Return true if intersection is with interior or exterior boundary (see the cases above)
Definition: intersection.hh:226
int indexInInside() const
Local index of codim 1 entity in the inside() entity where intersection is contained in.
Definition: intersection.hh:356
Intersection(Implementation &&impl)
Definition: intersection.hh:473
Geometry::GlobalCoordinate GlobalCoordinate
Type for normal vectors.
Definition: intersection.hh:199
@ dimension
Definition: intersection.hh:214
GridImp::template Codim< 1 >::LocalGeometry LocalGeometry
Codim 1 geometry returned by geometryInInside() and geometryInOutside()
Definition: intersection.hh:202
GlobalCoordinate unitOuterNormal(const LocalCoordinate &local) const
Return unit outer normal (length == 1)
Definition: intersection.hh:405
bool operator!=(const Intersection &other) const
Compares two intersections for inequality.
Definition: intersection.hh:428
GeometryType type() const
obtain the type of reference element for this intersection
Definition: intersection.hh:339
Intersection(Intersection &&other)
Move constructor from an existing intersection.
Definition: intersection.hh:443
LocalGeometry geometryInOutside() const
geometrical information about this intersection in local coordinates of the outside() entity.
Definition: intersection.hh:314
LocalGeometry geometryInInside() const
geometrical information about this intersection in local coordinates of the inside() entity.
Definition: intersection.hh:296
@ mydimension
Definition: intersection.hh:217
@ codimension
Definition: intersection.hh:207
size_t boundarySegmentIndex() const
index of the boundary segment within the macro grid
Definition: intersection.hh:246
Entity inside() const
return Entity on the inside of this intersection. That is the Entity where we started this.
Definition: intersection.hh:260
@ dimensionworld
Definition: intersection.hh:220
Geometry::LocalCoordinate LocalCoordinate
Type for vectors of coordinates on the intersection.
Definition: intersection.hh:196
GlobalCoordinate centerUnitOuterNormal() const
Return unit outer normal (length == 1)
Definition: intersection.hh:416
GridImp::template Codim< 1 >::Geometry Geometry
Codim 1 geometry returned by geometry()
Definition: intersection.hh:193
GridImp::template Codim< 0 >::Entity Entity
Type of entity that this Intersection belongs to.
Definition: intersection.hh:190
GlobalCoordinate outerNormal(const LocalCoordinate &local) const
Return an outer normal (length not necessarily 1)
Definition: intersection.hh:382
Implementation & impl()
access to the underlying implementation
Definition: intersection.hh:176
Intersection()
Default constructor.
Definition: intersection.hh:434
GridImp::ctype ctype
Type of individual coefficients of coordinate vectors.
Definition: intersection.hh:223
Intersection(const Implementation &impl)
Definition: intersection.hh:468
IntersectionImp Implementation
type of underlying implementation
Definition: intersection.hh:169
GlobalCoordinate integrationOuterNormal(const LocalCoordinate &local) const
return unit outer normal scaled with the integration element
Definition: intersection.hh:395
bool operator==(const Intersection &other) const
Compares two intersections for equality.
Definition: intersection.hh:422
Intersection(const Intersection &other)
Copy constructor from an existing intersection.
Definition: intersection.hh:438
Different resources needed by all grid implementations.
#define DUNE_DEPRECATED_MSG(text)
Mark some entity as deprecated.
Definition: deprecated.hh:169
unspecified value type referenceElement(T &&... t)
Returns a reference element for the objects t....
Dune namespace.
Definition: alignedallocator.hh:10
Static tag representing a codimension.
Definition: dimension.hh:22
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (Apr 24, 22:30, 2024)