dune-grid  2.2.1
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends | List of all members
Dune::Intersection< GridImp, IntersectionImp > Class Template Reference

Intersection of a mesh entities of codimension 0 ("elements") with a "neighboring" element or with the domain boundary. More...

#include <dune/grid/common/intersection.hh>

Public Types

enum  { codimension = 1 }
 Export codim of intersection (always 1) More...
enum  { dimension = dim }
 Export grid dimension. More...
enum  { mydimension = dim-1 }
 Export dimension of the intersection. More...
enum  { dimensionworld = dimworld }
 Export dimension of world. More...
typedef GridImp::template
Codim< 0 >::Entity 
Entity
 Type of entity that this Intersection belongs to.
typedef GridImp::template
Codim< 0 >::EntityPointer 
EntityPointer
 Pointer to the type of entities that this Intersection belongs to.
typedef GridImp::template
Codim< 1 >::Geometry 
Geometry
 Codim 1 geometry returned by geometry()
typedef Geometry::LocalCoordinate LocalCoordinate
 local coordinate type used as parameter for the normals
typedef Geometry::GlobalCoordinate GlobalCoordinate
 global coordinate type used as parameter for the normals
typedef GridImp::template
Codim< 1 >::LocalGeometry 
LocalGeometry
 Codim 1 geometry returned by geometryInInside and geometryInOutside()
typedef GridImp::ctype ctype
 define type used for coordinates in grid module
typedef remove_const< GridImp >
::type 
mutableGridImp

Public Member Functions

bool boundary () const
 return true if intersection is with interior or exterior boundary (see the cases above)
int boundaryId () const
 Identifier for boundary segment from macro grid.
size_t boundarySegmentIndex () const
 index of the boundary segment within the macro grid
bool neighbor () const
 return true if intersection is shared with another element.
EntityPointer inside () const
 return EntityPointer to the Entity on the inside of this intersection. That is the Entity where we started this .
EntityPointer outside () const
 return EntityPointer to the Entity on the outside of this intersection. That is the neighboring Entity.
bool conforming () const
 return true if intersection is conform.
LocalGeometry geometryInInside () const
 geometrical information about this intersection in local coordinates of the inside() entity.
LocalGeometry geometryInOutside () const
 geometrical information about this intersection in local coordinates of the outside() entity.
Geometry geometry () const
 geometrical information about the intersection in global coordinates.
GeometryType type () const
 obtain the type of reference element for this intersection
int indexInInside () const
 Local index of codim 1 entity in the inside() entity where intersection is contained in.
int indexInOutside () const
 Local index of codim 1 entity in outside() entity where intersection is contained in.
GlobalCoordinate outerNormal (const LocalCoordinate &local) const
 Return an outer normal (length not necessarily 1)
GlobalCoordinate integrationOuterNormal (const LocalCoordinate &local) const
 return outer normal scaled with the integration element
GlobalCoordinate unitOuterNormal (const LocalCoordinate &local) const
 Return unit outer normal (length == 1)
GlobalCoordinate centerUnitOuterNormal () const
 Return unit outer normal (length == 1)
Implementor interface
 Intersection (const IntersectionImp< const GridImp > &i)

Protected Types

enum  { dim = GridImp::dimension }
enum  { dimworld = GridImp::dimensionworld }
typedef IntersectionImp< const
GridImp > 
Implementation

Protected Member Functions

Implementationimpl ()
 return reference to the real implementation
const Implementationimpl () const
 return reference to the real implementation
 Intersection (const Intersection &i)
const Intersectionoperator= (const Intersection &i)

Protected Attributes

Implementation real

Friends

class GridDefaultImplementation< GridImp::dimension, GridImp::dimensionworld, typename GridImp::ctype, typename GridImp::GridFamily >
class IntersectionIterator< GridImp, IntersectionImp, IntersectionImp >

Detailed Description

template<class GridImp, template< class > class IntersectionImp>
class Dune::Intersection< GridImp, IntersectionImp >

Intersection of a mesh entities of codimension 0 ("elements") with a "neighboring" element or with the domain boundary.

Template parameters are:

Overview

Intersections are codimension 1 objects. These intersections are accessed via an Intersection. This allows the implementation of non-matching grids, as one face can now consist of several intersections. In a conforming mesh such an intersection corresponds to an entity of codimension 1 but in the general non-conforming case there will be no entity in the mesh that directly corresponds to the intersection. Thus, the Intersection describes these intersections implicitly.

Engine Concept

The Intersection class template wraps an object of type IntersectionImp and forwards all member function calls to corresponding members of this class. In that sense Intersection defines the interface and IntersectionImp supplies the implementation.

Methods neighbor and boundary

The following holds for both the level and the leaf intersection : The intersection is started on a codimension 0 entity of the grid. If this entity belongs to the interior or the overlap region (see. ???) then the union of all intersections is identical to the boundary of the entity. On ghost elements the only stops on the border of the domain, i.e., only on the intersections with entities in the interior region. Depending on the boolean values returned by the methods boundary() and neighbor() one can detect the position of an intersection relative to the boundary. In general the method boundary() returns true if and only if the intersection is part of the physical boundary of the domain. The method neighbor() returns true only if the method outside() has a well defined return value.

The following cases are possible if the intersection is started on an entity in the interior or overlap region. More details are given below:

intersectionneighbor()boundary()outside()
1with inner, overlap
or ghost entity
truefalse the neighbor entity
2on domain boundary falsetrueundefined
3on periodic boundary truetrueGhost-/Overlap cell<br>(with transformed geometry)
4on processor boundary false if grid has no ghosts
true otherwise
false ghost entity (if it exists)
Inner Intersections:
The type of the neighboring entity can be determined through methods defined on the outside entity.
Handling physical boundaries:
Data (like the type of boundary) can be attached to physical boundaries either using global coordinates or the intersection's boundary segment index.
The boundary segment indices form a local, zero-based, contiguous set of integer values. Each boundary segment on the macro level is assigned a unique index from this set, which is inherited by child boundary segments. The size of the boundary segment index set (i.e., the number of boundary indices on the macro level) can be determined through the method Grid::numBoundarySegments.
Note that the boundary segment index is not persistent over dynamic load balancing.
Handling periodic boundaries:
  • The Intersection stops at periodic boundaries
  • periodic grids are handled in correspondence to parallel grids
  • At the periodic boundary one can adjust an overlap- or ghost-layer.
  • outer() returns a ghost or overlap cell (for ghost and overlap look into the documentation of the parallel grid interface)
  • outer() cell has a periodically transformed geometry (so that one does not see a jump or something like that)
  • outer() cell has its own index
  • outer() cell has the same id as the corresponding "original" cell
Processor boundaries:
At processor boundaries, i.e. when an element has an intersection with another element in the sequential grid but this element is only stored in other processors the intersection stops but neither neighbor() nor boundary() are true.

Geometry of an intersection

The method intersectionGlobal returns a geometry mapping the intersection as a codim one structure to global coordinates. The methods intersectionSelfLocal and intersectionNeighborLocal return geometries mapping the intersection into the reference elements of the originating entity and the neighboring entity, respectively. The numberInSelf and numberInNeighbor methods return the codim one subentities which contain the intersection.

Member Typedef Documentation

template<class GridImp, template< class > class IntersectionImp>
typedef GridImp::ctype Dune::Intersection< GridImp, IntersectionImp >::ctype

define type used for coordinates in grid module

template<class GridImp, template< class > class IntersectionImp>
typedef GridImp::template Codim<0>::Entity Dune::Intersection< GridImp, IntersectionImp >::Entity

Type of entity that this Intersection belongs to.

template<class GridImp, template< class > class IntersectionImp>
typedef GridImp::template Codim<0>::EntityPointer Dune::Intersection< GridImp, IntersectionImp >::EntityPointer

Pointer to the type of entities that this Intersection belongs to.

template<class GridImp, template< class > class IntersectionImp>
typedef GridImp::template Codim<1>::Geometry Dune::Intersection< GridImp, IntersectionImp >::Geometry

Codim 1 geometry returned by geometry()

template<class GridImp, template< class > class IntersectionImp>
typedef Geometry::GlobalCoordinate Dune::Intersection< GridImp, IntersectionImp >::GlobalCoordinate

global coordinate type used as parameter for the normals

template<class GridImp, template< class > class IntersectionImp>
typedef IntersectionImp< const GridImp > Dune::Intersection< GridImp, IntersectionImp >::Implementation
protected
template<class GridImp, template< class > class IntersectionImp>
typedef Geometry::LocalCoordinate Dune::Intersection< GridImp, IntersectionImp >::LocalCoordinate

local coordinate type used as parameter for the normals

template<class GridImp, template< class > class IntersectionImp>
typedef GridImp::template Codim<1>::LocalGeometry Dune::Intersection< GridImp, IntersectionImp >::LocalGeometry

Codim 1 geometry returned by geometryInInside and geometryInOutside()

template<class GridImp, template< class > class IntersectionImp>
typedef remove_const<GridImp>::type Dune::Intersection< GridImp, IntersectionImp >::mutableGridImp

Member Enumeration Documentation

template<class GridImp, template< class > class IntersectionImp>
anonymous enum
protected
Enumerator:
dim 
template<class GridImp, template< class > class IntersectionImp>
anonymous enum
protected
Enumerator:
dimworld 
template<class GridImp, template< class > class IntersectionImp>
anonymous enum

Export codim of intersection (always 1)

Enumerator:
codimension 

codim of intersection in grid

template<class GridImp, template< class > class IntersectionImp>
anonymous enum

Export grid dimension.

Enumerator:
dimension 

grid dimension

template<class GridImp, template< class > class IntersectionImp>
anonymous enum

Export dimension of the intersection.

Enumerator:
mydimension 

intersection's dimension

template<class GridImp, template< class > class IntersectionImp>
anonymous enum

Export dimension of world.

Enumerator:
dimensionworld 

dimension of world

Constructor & Destructor Documentation

template<class GridImp, template< class > class IntersectionImp>
Dune::Intersection< GridImp, IntersectionImp >::Intersection ( const IntersectionImp< const GridImp > &  i)
inline

Copy Constructor from IntersectionImp

template<class GridImp, template< class > class IntersectionImp>
Dune::Intersection< GridImp, IntersectionImp >::Intersection ( const Intersection< GridImp, IntersectionImp > &  i)
inlineprotected

Member Function Documentation

template<class GridImp, template< class > class IntersectionImp>
bool Dune::Intersection< GridImp, IntersectionImp >::boundary ( ) const
inline

return true if intersection is with interior or exterior boundary (see the cases above)

Referenced by Dune::GridPtr< GridType >::initialize(), and Dune::DGFGridFactory< HostGrid >::wasInserted().

template<class GridImp, template< class > class IntersectionImp>
int Dune::Intersection< GridImp, IntersectionImp >::boundaryId ( ) const
inline

Identifier for boundary segment from macro grid.

One can attach a boundary Id to a boundary segment on the macro grid. This Id will also be used for all fragments of these boundary segments.

The numbering is defined as:

  • Id==0 for all intersections without boundary()==false
  • Id>=0 for all intersections without boundary()==true

The way the Identifiers are attached to the grid may differ between the different grid implementations.

Deprecated:

Referenced by Dune::DGFGridFactory< HostGrid >::boundaryId().

template<class GridImp, template< class > class IntersectionImp>
size_t Dune::Intersection< GridImp, IntersectionImp >::boundarySegmentIndex ( ) const
inline

index of the boundary segment within the macro grid

In many applications, special data needs to be attached to the boundary segments of the macro grid (e.g., a function selecting the boundary condition). Usually, this data is inherited by the children of the boundary segment.

In the DUNE framework, data is stored in arrays, addressed by an index, in this case the boundarySegmentIndex. The size of these arrays can be obtained by the Grid::numBoundarySegments.

Referenced by Dune::DGFGridFactory< OneDGrid >::boundaryId(), Dune::GridPtr< GridType >::initialize(), and Dune::GridPtr< GridType >::parameters().

template<class GridImp, template< class > class IntersectionImp>
GlobalCoordinate Dune::Intersection< GridImp, IntersectionImp >::centerUnitOuterNormal ( ) const
inline

Return unit outer normal (length == 1)

The returned vector is the normal at the center() of the intersection's geometry. It is scaled to have unit length.

template<class GridImp, template< class > class IntersectionImp>
bool Dune::Intersection< GridImp, IntersectionImp >::conforming ( ) const
inline

return true if intersection is conform.

This method returns true, if

inside()->entity<1>(numberInSelf()) ==
outside()->entity<1>(numberInNeighbor()) ||

holds.

template<class GridImp, template< class > class IntersectionImp>
Geometry Dune::Intersection< GridImp, IntersectionImp >::geometry ( ) const
inline

geometrical information about the intersection in global coordinates.

This method returns a Geometry object that provides a mapping from local coordinates of the intersection to global (world) coordinates.

Note
Previously, the geometry was encapsulated in the intersection object and a const reference was returned.
The returned geometry object is guaranteed to remain valid until the grid is modified (or deleted).

Referenced by Dune::DGFGridFactory< SGrid< dim, dimworld, ctype > >::boundaryId(), Dune::DGFGridFactory< YaspGrid< dim > >::boundaryId(), Dune::DGFGridFactory< SGrid< dim, dimworld, ctype > >::boundaryParameter(), and Dune::DGFGridFactory< YaspGrid< dim > >::boundaryParameter().

template<class GridImp, template< class > class IntersectionImp>
LocalGeometry Dune::Intersection< GridImp, IntersectionImp >::geometryInInside ( ) const
inline

geometrical information about this intersection in local coordinates of the inside() entity.

This method returns a Geometry object that provides a mapping from local coordinates of the intersection to local coordinates of the inside() entity.

Note
Previously, the geometry was encapsulated in the intersection object and a const reference was returned.
The returned geometry object is guaranteed to remain valid until the grid is modified (or deleted).
template<class GridImp, template< class > class IntersectionImp>
LocalGeometry Dune::Intersection< GridImp, IntersectionImp >::geometryInOutside ( ) const
inline

geometrical information about this intersection in local coordinates of the outside() entity.

This method returns a Geometry object that provides a mapping from local coordinates of the intersection to local coordinates of the outside() entity.

Note
Previously, the geometry was encapsulated in the intersection object and a const reference was returned.
The returned geometry object is guaranteed to remain valid until the grid is modified (or deleted).
template<class GridImp, template< class > class IntersectionImp>
Implementation& Dune::Intersection< GridImp, IntersectionImp >::impl ( )
inlineprotected

return reference to the real implementation

template<class GridImp, template< class > class IntersectionImp>
const Implementation& Dune::Intersection< GridImp, IntersectionImp >::impl ( ) const
inlineprotected

return reference to the real implementation

template<class GridImp, template< class > class IntersectionImp>
int Dune::Intersection< GridImp, IntersectionImp >::indexInInside ( ) const
inline

Local index of codim 1 entity in the inside() entity where intersection is contained in.

Note
This method returns the face number with respect to the generic reference element.
Returns
the index of the inside entity's face containing this intersection (with respect to the generic reference element)

Referenced by Dune::DGFGridFactory< SGrid< dim, dimworld, ctype > >::boundaryId(), Dune::DGFGridFactory< YaspGrid< dim > >::boundaryId(), Dune::DGFGridFactory< AlbertaGrid< dim, dimworld > >::boundaryParameter(), and Dune::GridPtr< GridType >::initialize().

template<class GridImp, template< class > class IntersectionImp>
int Dune::Intersection< GridImp, IntersectionImp >::indexInOutside ( ) const
inline

Local index of codim 1 entity in outside() entity where intersection is contained in.

Note
This method returns the face number with respect to the generic reference element.
Returns
the index of the outside entity's face containing this intersection (with respect to the generic reference element)
template<class GridImp, template< class > class IntersectionImp>
EntityPointer Dune::Intersection< GridImp, IntersectionImp >::inside ( ) const
inline

return EntityPointer to the Entity on the inside of this intersection. That is the Entity where we started this .

Referenced by Dune::DGFGridFactory< AlbertaGrid< dim, dimworld > >::boundaryParameter().

template<class GridImp, template< class > class IntersectionImp>
GlobalCoordinate Dune::Intersection< GridImp, IntersectionImp >::integrationOuterNormal ( const LocalCoordinate local) const
inline

return outer normal scaled with the integration element

   \copybrief Dune::Intersection::outerNormal

The returned vector may depend on local position within the intersection. The normal is scaled with the integration element of the intersection. This method is redundant but it may be more efficent to use this function rather than computing the integration element via intersectionGlobal().

template<class GridImp, template< class > class IntersectionImp>
bool Dune::Intersection< GridImp, IntersectionImp >::neighbor ( ) const
inline

return true if intersection is shared with another element.

template<class GridImp, template< class > class IntersectionImp>
const Intersection& Dune::Intersection< GridImp, IntersectionImp >::operator= ( const Intersection< GridImp, IntersectionImp > &  i)
inlineprotected
template<class GridImp, template< class > class IntersectionImp>
GlobalCoordinate Dune::Intersection< GridImp, IntersectionImp >::outerNormal ( const LocalCoordinate local) const
inline

Return an outer normal (length not necessarily 1)

The returned vector may depend on local position within the intersection.

template<class GridImp, template< class > class IntersectionImp>
EntityPointer Dune::Intersection< GridImp, IntersectionImp >::outside ( ) const
inline

return EntityPointer to the Entity on the outside of this intersection. That is the neighboring Entity.

Warning
Don't call this method if there is no neighboring Entity (neighbor() returns false). In this case the result is undefined.
template<class GridImp, template< class > class IntersectionImp>
GeometryType Dune::Intersection< GridImp, IntersectionImp >::type ( ) const
inline

obtain the type of reference element for this intersection

Referenced by Dune::GridPtr< GridType >::initialize().

template<class GridImp, template< class > class IntersectionImp>
GlobalCoordinate Dune::Intersection< GridImp, IntersectionImp >::unitOuterNormal ( const LocalCoordinate local) const
inline

Return unit outer normal (length == 1)

The returned vector may depend on the local position within the intersection. It is scaled to have unit length.

Friends And Related Function Documentation

template<class GridImp, template< class > class IntersectionImp>
friend class GridDefaultImplementation< GridImp::dimension, GridImp::dimensionworld,typename GridImp::ctype,typename GridImp::GridFamily >
friend
template<class GridImp, template< class > class IntersectionImp>
friend class IntersectionIterator< GridImp, IntersectionImp, IntersectionImp >
friend

give the pseudo IntersectionIterator class access to the realImp

Todo:
cleanup this hack

Member Data Documentation

template<class GridImp, template< class > class IntersectionImp>
Implementation Dune::Intersection< GridImp, IntersectionImp >::real
protected

The documentation for this class was generated from the following file: