Dune Core Modules (2.5.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
9namespace Dune
10{
11
160 template< class GridImp, class IntersectionImp >
162 {
163#if DUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS
164 public:
165#else
166 protected:
167 // give the GridDefaultImplementation class access to the realImp
168 friend class GridDefaultImplementation<
169 GridImp::dimension, GridImp::dimensionworld,
170 typename GridImp::ctype,
171 typename GridImp::GridFamily> ;
172#endif
173 // type of underlying implementation, for internal use only
174 typedef IntersectionImp Implementation;
175
177 Implementation &impl () { return real; }
179 const Implementation &impl () const { return real; }
180
181 protected:
182 Implementation real;
183
184 public:
186 typedef typename GridImp::template Codim<0>::Entity Entity;
187
189 typedef typename GridImp::template Codim<1>::Geometry Geometry;
190
193
196
198 typedef typename GridImp::template Codim<1>::LocalGeometry LocalGeometry;
199
203 enum DUNE_DEPRECATED_MSG("Deprecated: codimensions of an intersection are always 1!") { codimension=1 };
204
210 enum DUNE_DEPRECATED_MSG("Deprecated: get this dimension from the grid itself, or from an element!") { dimension=GridImp::dimension };
211
213 enum { mydimension=GridImp::dimension-1 };
214
216 enum { dimensionworld=GridImp::dimensionworld };
217
219 typedef typename GridImp::ctype ctype;
220
222 bool boundary () const
223 {
224 return this->real.boundary();
225 }
226
227#if DUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS
243 int boundaryId () const
244 {
245 return this->real.boundaryId();
246 }
247#endif
248
264 size_t boundarySegmentIndex () const
265 {
266 return this->real.boundarySegmentIndex();
267 }
268
270 bool neighbor () const
271 {
272 return this->real.neighbor();
273 }
274
279 {
280 return this->real.inside();
281 }
282
290 {
291 return this->real.outside();
292 }
293
296 bool conforming () const
297 {
298 return this->real.conforming();
299 }
300
315 {
316 return this->real.geometryInInside();
317 }
318
333 {
334 return this->real.geometryInOutside();
335 }
336
352 {
353 return this->real.geometry();
354 }
355
358 {
359 return this->real.type();
360 }
361
374 int indexInInside () const
375 {
376 return this->real.indexInInside();
377 }
378
391 int indexInOutside () const
392 {
393 return this->real.indexInOutside();
394 }
395
401 {
402 return this->real.outerNormal(local);
403 }
404
414 {
415 return this->real.integrationOuterNormal(local);
416 }
417
424 {
425 return this->real.unitOuterNormal(local);
426 }
427
435 {
436 return this->real.centerUnitOuterNormal();
437 }
438
440 bool operator==(const Intersection& other) const
441 {
442 return real.equals(other.real);
443 }
444
446 bool operator!=(const Intersection& other) const
447 {
448 return !real.equals(other.real);
449 }
450
453 {}
454
457 : real(other.real)
458 {}
459
462 : real(std::move(other.real))
463 {}
464
467 {
468 real = other.real;
469 return *this;
470 }
471
474 {
475 real = std::move(other.real);
476 return *this;
477 }
478
479 //===========================================================
483 //===========================================================
484
486 Intersection ( const Implementation &impl )
487 : real( impl )
488 {}
489
491 Intersection ( Implementation&& impl )
492 : real( std::move(impl) )
493 {}
494
496
497 protected:
500 friend class IntersectionIterator<GridImp, IntersectionImp, IntersectionImp>;
501
502 };
503
504 //**********************************************************************
510 template< class GridImp, class IntersectionImp >
512 {
513 enum { dim=GridImp::dimension };
514 enum { dimworld=GridImp::dimensionworld };
515 typedef typename GridImp::ctype ct;
516 public:
517
522 {
523 FieldVector<ct, dimworld> n = asImp().unitOuterNormal(local);
524 n *= asImp().geometry().integrationElement(local);
525 return n;
526 }
527
530 {
531 FieldVector<ct, dimworld> n = asImp().outerNormal(local);
532 n /= n.two_norm();
533 return n;
534 }
535
538 {
539 // For now, we do this...
540 GeometryType type = asImp().geometry().type();
541 const ReferenceElement<ct, dim-1> & refElement =
543 return asImp().unitOuterNormal(refElement.position(0,0));
544 // But later, if we change the meaning of center(),
545 // we may have to change to this...
546 // return asImp().unitOuterNormal(asImp().local(asImp().center()));
547 }
548
549 private:
550 // CRTP (curiously recurring template pattern)
551 IntersectionImp &asImp () { return static_cast< IntersectionImp & >( *this ); }
552 const IntersectionImp &asImp () const { return static_cast< const IntersectionImp & >( *this ); }
553 };
554
555} // namespace Dune
556
557#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:268
Definition: grid.hh:920
Default Implementations of integrationOuterNormal and unitOuterNormal for IntersectionImp.
Definition: intersection.hh:512
FieldVector< ct, dimworld > integrationOuterNormal(const FieldVector< ct, dim-1 > &local) const
Definition: intersection.hh:521
FieldVector< ct, dimworld > unitOuterNormal(const FieldVector< ct, dim-1 > &local) const
return unit outer normal
Definition: intersection.hh:529
FieldVector< ct, dimworld > centerUnitOuterNormal() const
return unit outer normal at center of intersection geometry
Definition: intersection.hh:537
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:466
Geometry geometry() const
geometrical information about the intersection in global coordinates.
Definition: intersection.hh:351
bool conforming() const
Return true if intersection is conforming.
Definition: intersection.hh:296
Entity outside() const
return Entity on the outside of this intersection. That is the neighboring Entity.
Definition: intersection.hh:289
int indexInOutside() const
Local index of codim 1 entity in outside() entity where intersection is contained in.
Definition: intersection.hh:391
bool neighbor() const
return true if intersection is shared with another element.
Definition: intersection.hh:270
enum DUNE_DEPRECATED_MSG("Deprecated: codimensions of an intersection are always 1!")
Export codim of intersection (always 1)
Definition: intersection.hh:203
bool boundary() const
Return true if intersection is with interior or exterior boundary (see the cases above)
Definition: intersection.hh:222
int indexInInside() const
Local index of codim 1 entity in the inside() entity where intersection is contained in.
Definition: intersection.hh:374
Intersection(Implementation &&impl)
Definition: intersection.hh:491
Intersection & operator=(Intersection &&other)
Move assignment operator from an existing intersection.
Definition: intersection.hh:473
Geometry::GlobalCoordinate GlobalCoordinate
Type for normal vectors.
Definition: intersection.hh:195
GridImp::template Codim< 1 >::LocalGeometry LocalGeometry
Codim 1 geometry returned by geometryInInside() and geometryInOutside()
Definition: intersection.hh:198
GlobalCoordinate unitOuterNormal(const LocalCoordinate &local) const
Return unit outer normal (length == 1)
Definition: intersection.hh:423
bool operator!=(const Intersection &other) const
Compares two intersections for inequality.
Definition: intersection.hh:446
GeometryType type() const
obtain the type of reference element for this intersection
Definition: intersection.hh:357
@ dimensionworld
Definition: intersection.hh:216
Intersection(Intersection &&other)
Move constructor from an existing intersection.
Definition: intersection.hh:461
LocalGeometry geometryInOutside() const
geometrical information about this intersection in local coordinates of the outside() entity.
Definition: intersection.hh:332
LocalGeometry geometryInInside() const
geometrical information about this intersection in local coordinates of the inside() entity.
Definition: intersection.hh:314
size_t boundarySegmentIndex() const
index of the boundary segment within the macro grid
Definition: intersection.hh:264
Entity inside() const
return Entity on the inside of this intersection. That is the Entity where we started this.
Definition: intersection.hh:278
Geometry::LocalCoordinate LocalCoordinate
Type for vectors of coordinates on the intersection.
Definition: intersection.hh:192
GlobalCoordinate centerUnitOuterNormal() const
Return unit outer normal (length == 1)
Definition: intersection.hh:434
GridImp::template Codim< 1 >::Geometry Geometry
Codim 1 geometry returned by geometry()
Definition: intersection.hh:189
Implementation & impl()
return reference to the real implementation
Definition: intersection.hh:177
GridImp::template Codim< 0 >::Entity Entity
Type of entity that this Intersection belongs to.
Definition: intersection.hh:186
const Implementation & impl() const
return reference to the real implementation
Definition: intersection.hh:179
GlobalCoordinate outerNormal(const LocalCoordinate &local) const
Return an outer normal (length not necessarily 1)
Definition: intersection.hh:400
@ mydimension
Definition: intersection.hh:213
Intersection()
Default constructor.
Definition: intersection.hh:452
GridImp::ctype ctype
Type of individual coefficients of coordinate vectors.
Definition: intersection.hh:219
Intersection(const Implementation &impl)
Definition: intersection.hh:486
GlobalCoordinate integrationOuterNormal(const LocalCoordinate &local) const
return unit outer normal scaled with the integration element
Definition: intersection.hh:413
bool operator==(const Intersection &other) const
Compares two intersections for equality.
Definition: intersection.hh:440
Intersection(const Intersection &other)
Copy constructor from an existing intersection.
Definition: intersection.hh:456
This class provides access to geometric and topological properties of a reference element.
Definition: referenceelements.hh:354
Different resources needed by all grid implementations.
Dune namespace.
Definition: alignment.hh:11
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:757
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)