Dune Core Modules (2.8.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_COMMON_INTERSECTION_HH
5#define DUNE_GRID_COMMON_INTERSECTION_HH
6
8
9namespace 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
205 enum { mydimension=GridImp::dimension-1 };
206
208 enum { dimensionworld=GridImp::dimensionworld };
209
211 typedef typename GridImp::ctype ctype;
212
214 bool boundary () const
215 {
216 return this->real.boundary();
217 }
218
234 size_t boundarySegmentIndex () const
235 {
236 return this->real.boundarySegmentIndex();
237 }
238
240 bool neighbor () const
241 {
242 return this->real.neighbor();
243 }
244
249 {
250 return this->real.inside();
251 }
252
260 {
261 return this->real.outside();
262 }
263
266 bool conforming () const
267 {
268 return this->real.conforming();
269 }
270
285 {
286 return this->real.geometryInInside();
287 }
288
303 {
304 return this->real.geometryInOutside();
305 }
306
322 {
323 return this->real.geometry();
324 }
325
328 {
329 return this->real.type();
330 }
331
344 int indexInInside () const
345 {
346 return this->real.indexInInside();
347 }
348
361 int indexInOutside () const
362 {
363 return this->real.indexInOutside();
364 }
365
371 {
372 return this->real.outerNormal(local);
373 }
374
384 {
385 return this->real.integrationOuterNormal(local);
386 }
387
394 {
395 return this->real.unitOuterNormal(local);
396 }
397
405 {
406 return this->real.centerUnitOuterNormal();
407 }
408
410 bool operator==(const Intersection& other) const
411 {
412 return real.equals(other.real);
413 }
414
416 bool operator!=(const Intersection& other) const
417 {
418 return !real.equals(other.real);
419 }
420
423 {}
424
427 : real(other.real)
428 {}
429
432 : real(std::move(other.real))
433 {}
434
437 {
438 real = other.real;
439 return *this;
440 }
441
444 {
445 real = std::move(other.real);
446 return *this;
447 }
448
449 //===========================================================
453 //===========================================================
454
457 : real( impl )
458 {}
459
462 : real( std::move(impl) )
463 {}
464
466
467 protected:
470 friend class IntersectionIterator<GridImp, IntersectionImp, IntersectionImp>;
471
472 };
473
474 //**********************************************************************
480 template< class GridImp, class IntersectionImp >
482 {
483 enum { dim=GridImp::dimension };
484 enum { dimworld=GridImp::dimensionworld };
485 typedef typename GridImp::ctype ct;
486 public:
487
492 {
493 FieldVector<ct, dimworld> n = asImp().unitOuterNormal(local);
494 n *= asImp().geometry().integrationElement(local);
495 return n;
496 }
497
500 {
501 FieldVector<ct, dimworld> n = asImp().outerNormal(local);
502 n /= n.two_norm();
503 return n;
504 }
505
508 {
509 // For now, we do this...
510 GeometryType type = asImp().geometry().type();
511 auto refElement = referenceElement<ct, dim-1>(type);
512 return asImp().unitOuterNormal(refElement.position(0,0));
513 // But later, if we change the meaning of center(),
514 // we may have to change to this...
515 // return asImp().unitOuterNormal(asImp().local(asImp().center()));
516 }
517
518 private:
519 // CRTP (curiously recurring template pattern)
520 IntersectionImp &asImp () { return static_cast< IntersectionImp & >( *this ); }
521 const IntersectionImp &asImp () const { return static_cast< const IntersectionImp & >( *this ); }
522 };
523
524} // namespace Dune
525
526#endif // DUNE_GRID_COMMON_INTERSECTION_HH
FieldTraits< value_type >::real_type two_norm() const
two norm sqrt(sum over squared values of entries)
Definition: densevector.hh:642
vector space out of a tensor product of fields.
Definition: fvector.hh:95
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:123
Default Implementations of integrationOuterNormal and unitOuterNormal for IntersectionImp.
Definition: intersection.hh:482
FieldVector< ct, dimworld > integrationOuterNormal(const FieldVector< ct, dim-1 > &local) const
Definition: intersection.hh:491
FieldVector< ct, dimworld > unitOuterNormal(const FieldVector< ct, dim-1 > &local) const
return unit outer normal
Definition: intersection.hh:499
FieldVector< ct, dimworld > centerUnitOuterNormal() const
return unit outer normal at center of intersection geometry
Definition: intersection.hh:507
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
Intersection & operator=(const Intersection &other)
Copy assignment operator from an existing intersection.
Definition: intersection.hh:436
Geometry geometry() const
geometrical information about the intersection in global coordinates.
Definition: intersection.hh:321
bool conforming() const
Return true if intersection is conforming.
Definition: intersection.hh:266
Entity outside() const
return Entity on the outside of this intersection. That is the neighboring Entity.
Definition: intersection.hh:259
int indexInOutside() const
Local index of codim 1 entity in outside() entity where intersection is contained in.
Definition: intersection.hh:361
bool neighbor() const
return true if intersection is shared with another element.
Definition: intersection.hh:240
bool boundary() const
Return true if intersection is with interior or exterior boundary (see the cases above)
Definition: intersection.hh:214
@ dimensionworld
Definition: intersection.hh:208
int indexInInside() const
Local index of codim 1 entity in the inside() entity where intersection is contained in.
Definition: intersection.hh:344
Intersection(Implementation &&impl)
Definition: intersection.hh:461
Intersection & operator=(Intersection &&other)
Move assignment operator from an existing intersection.
Definition: intersection.hh:443
Geometry::GlobalCoordinate GlobalCoordinate
Type for normal vectors.
Definition: intersection.hh:199
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:393
bool operator!=(const Intersection &other) const
Compares two intersections for inequality.
Definition: intersection.hh:416
GeometryType type() const
obtain the type of reference element for this intersection
Definition: intersection.hh:327
Intersection(Intersection &&other)
Move constructor from an existing intersection.
Definition: intersection.hh:431
@ mydimension
Definition: intersection.hh:205
LocalGeometry geometryInOutside() const
geometrical information about this intersection in local coordinates of the outside() entity.
Definition: intersection.hh:302
LocalGeometry geometryInInside() const
geometrical information about this intersection in local coordinates of the inside() entity.
Definition: intersection.hh:284
size_t boundarySegmentIndex() const
index of the boundary segment within the macro grid
Definition: intersection.hh:234
Entity inside() const
return Entity on the inside of this intersection. That is the Entity where we started this.
Definition: intersection.hh:248
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:404
GridImp::template Codim< 1 >::Geometry Geometry
Codim 1 geometry returned by geometry()
Definition: intersection.hh:193
Implementation & impl()
access to the underlying implementation
Definition: intersection.hh:176
GridImp::template Codim< 0 >::Entity Entity
Type of entity that this Intersection belongs to.
Definition: intersection.hh:190
const Implementation & impl() const
access to the underlying implementation
Definition: intersection.hh:183
GlobalCoordinate outerNormal(const LocalCoordinate &local) const
Return an outer normal (length not necessarily 1)
Definition: intersection.hh:370
Intersection()
Default constructor.
Definition: intersection.hh:422
GridImp::ctype ctype
Type of individual coefficients of coordinate vectors.
Definition: intersection.hh:211
Intersection(const Implementation &impl)
Definition: intersection.hh:456
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:383
bool operator==(const Intersection &other) const
Compares two intersections for equality.
Definition: intersection.hh:410
Intersection(const Intersection &other)
Copy constructor from an existing intersection.
Definition: intersection.hh:426
Different resources needed by all grid implementations.
unspecified value type referenceElement(T &&... t)
Returns a reference element for the objects t....
Dune namespace.
Definition: alignedallocator.hh:11
STL namespace.
Static tag representing a codimension.
Definition: dimension.hh:22
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 21, 23:30, 2024)