dune-grid  2.1.1
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends
Dune::Geometry< mydim, cdim, GridImp, GeometryImp > Class Template Reference

Wrapper class for geometries. More...

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

Inheritance diagram for Dune::Geometry< mydim, cdim, GridImp, GeometryImp >:
Inheritance graph

List of all members.

Public Types

enum  { dimension = GridImp::dimension }
 export grid dimension More...
enum  { mydimension = mydim }
 export geometry dimension More...
enum  { coorddimension = cdim }
 export coordinate dimension More...
enum  { dimensionworld = GridImp::dimensionworld }
 export dimension of world More...
typedef GridImp::ctype ctype
 define type used for coordinates in grid module
typedef FieldVector< ctype, mydim > LocalCoordinate
 type of local coordinates
typedef FieldVector< ctype, cdim > GlobalCoordinate
 type of the global coordinates
typedef FieldMatrix< ctype,
cdim, mydim > 
Jacobian
 type of jacobian (also of jacobian inverse transposed)
typedef FieldMatrix< ctype,
mydim, cdim > 
JacobianTransposed
 type of jacobian transposed

Public Member Functions

GeometryType type () const
 Return the name of the reference element. The type can be used to access the Dune::GenericReferenceElement.
bool affine () const
 Return true if the geometry mapping is affine and false otherwise.
int corners () const
 Return the number of corners of the reference element.
GlobalCoordinate corner (int i) const
 Obtain a corner of the geometry.
GlobalCoordinate global (const LocalCoordinate &local) const
 Evaluate the map $ g$.
LocalCoordinate local (const GlobalCoordinate &global) const
 Evaluate the inverse map $ g^{-1}$.
ctype integrationElement (const LocalCoordinate &local) const
 Return the factor appearing in the integral transformation formula.
ctype volume () const
 return volume of geometry
GlobalCoordinate center () const
 return center of geometry
const JacobianTransposedjacobianTransposed (const LocalCoordinate &local) const
 Return the transposed of the Jacobian.
const JacobianjacobianInverseTransposed (const LocalCoordinate &local) const
 Return inverse of transposed of Jacobian.
 Geometry (const GeometryImp< mydim, cdim, GridImp > &e)
 copy constructor from GeometryImp

Protected Types

typedef GeometryImp< mydim,
cdim, GridImp > 
ImplementationType

Protected Member Functions

GeometryImp< mydim, cdim,
GridImp > & 
getRealImp ()
 return reference to the real implementation
const GeometryImp< mydim, cdim,
GridImp > & 
getRealImp () const
 return reference to the real implementation
 Geometry (const Geometry &rhs)
Geometryoperator= (const Geometry &rhs)

Protected Attributes

GeometryImp< mydim, cdim, GridImp > realGeometry

Friends

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

Detailed Description

template<int mydim, int cdim, class GridImp, template< int, int, class > class GeometryImp>
class Dune::Geometry< mydim, cdim, GridImp, GeometryImp >

Wrapper class for geometries.

Template Parameters:
mydimDimension of the domain
cdimDimension of the range
GridImpType that is a model of Dune::Grid
GeometryImpClass template that is a model of Dune::Geometry

Maps

A Geometry defines a map

\[ g : D \to W\]

where $D\subseteq\mathbf{R}^\textrm{mydim}$ and $W\subseteq\mathbf{R}^\textrm{cdim}$. The domain $D$ is one of a set of predefined convex polytopes, the so-called reference elements (

See also:
Dune::GenericReferenceElement). The dimensionality of $D$ is mydim. In general $\textrm{mydim}\leq\textrm{cdim}$, i.e. the convex polytope may be mapped to a manifold. Moreover, we require that $ g\in \left( C^1(D) \right)^\textrm{cdim}$ and one-to-one.

Engine Concept

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


Member Typedef Documentation

template<int mydim, int cdim, class GridImp, template< int, int, class > class GeometryImp>
typedef GridImp::ctype Dune::Geometry< mydim, cdim, GridImp, GeometryImp >::ctype

define type used for coordinates in grid module

template<int mydim, int cdim, class GridImp, template< int, int, class > class GeometryImp>
typedef FieldVector< ctype, cdim > Dune::Geometry< mydim, cdim, GridImp, GeometryImp >::GlobalCoordinate

type of the global coordinates

template<int mydim, int cdim, class GridImp, template< int, int, class > class GeometryImp>
typedef GeometryImp<mydim,cdim,GridImp> Dune::Geometry< mydim, cdim, GridImp, GeometryImp >::ImplementationType [protected]
template<int mydim, int cdim, class GridImp, template< int, int, class > class GeometryImp>
typedef FieldMatrix<ctype,cdim,mydim> Dune::Geometry< mydim, cdim, GridImp, GeometryImp >::Jacobian

type of jacobian (also of jacobian inverse transposed)

template<int mydim, int cdim, class GridImp, template< int, int, class > class GeometryImp>
typedef FieldMatrix< ctype, mydim, cdim > Dune::Geometry< mydim, cdim, GridImp, GeometryImp >::JacobianTransposed

type of jacobian transposed

template<int mydim, int cdim, class GridImp, template< int, int, class > class GeometryImp>
typedef FieldVector<ctype, mydim> Dune::Geometry< mydim, cdim, GridImp, GeometryImp >::LocalCoordinate

type of local coordinates


Member Enumeration Documentation

template<int mydim, int cdim, class GridImp, template< int, int, class > class GeometryImp>
anonymous enum

export grid dimension

Enumerator:
dimension 

grid dimension

template<int mydim, int cdim, class GridImp, template< int, int, class > class GeometryImp>
anonymous enum

export geometry dimension

Enumerator:
mydimension 

geometry dimension

template<int mydim, int cdim, class GridImp, template< int, int, class > class GeometryImp>
anonymous enum

export coordinate dimension

Enumerator:
coorddimension 

dimension of embedding coordsystem

template<int mydim, int cdim, class GridImp, template< int, int, class > class GeometryImp>
anonymous enum

export dimension of world

Enumerator:
dimensionworld 

dimension of world


Constructor & Destructor Documentation

template<int mydim, int cdim, class GridImp, template< int, int, class > class GeometryImp>
Dune::Geometry< mydim, cdim, GridImp, GeometryImp >::Geometry ( const GeometryImp< mydim, cdim, GridImp > &  e) [inline, explicit]

copy constructor from GeometryImp

template<int mydim, int cdim, class GridImp, template< int, int, class > class GeometryImp>
Dune::Geometry< mydim, cdim, GridImp, GeometryImp >::Geometry ( const Geometry< mydim, cdim, GridImp, GeometryImp > &  rhs) [inline, protected]

hide copy constructor


Member Function Documentation

template<int mydim, int cdim, class GridImp, template< int, int, class > class GeometryImp>
bool Dune::Geometry< mydim, cdim, GridImp, GeometryImp >::affine ( ) const [inline]

Return true if the geometry mapping is affine and false otherwise.

template<int mydim, int cdim, class GridImp, template< int, int, class > class GeometryImp>
GlobalCoordinate Dune::Geometry< mydim, cdim, GridImp, GeometryImp >::center ( ) const [inline]

return center of geometry

Note that this method is still subject to a change of name and semantics. At the moment, the center is not required to be the centroid of the geometry, or even the centroid of its corners. This makes the current default implementation acceptable, which maps the centroid of the reference element to the geometry. We may change the name (and semantic) of the method to centroid() if we find reasonably efficient ways to implement it properly.

template<int mydim, int cdim, class GridImp, template< int, int, class > class GeometryImp>
GlobalCoordinate Dune::Geometry< mydim, cdim, GridImp, GeometryImp >::corner ( int  i) const [inline]

Obtain a corner of the geometry.

This method is for convenient access to the corners of the geometry. The same result could be achieved by by calling

  global( genericReferenceElement.position( i, mydimension )
Parameters:
[in]inumber of the corner (with respect to the generic reference element)
Returns:
position of the i-th corner
template<int mydim, int cdim, class GridImp, template< int, int, class > class GeometryImp>
int Dune::Geometry< mydim, cdim, GridImp, GeometryImp >::corners ( ) const [inline]

Return the number of corners of the reference element.

Since a geometry is a convex polytope the number of corners is a well-defined concept. The method is redundant because this information is also available via the reference element. It is here for efficiency and ease of use.

template<int mydim, int cdim, class GridImp, template< int, int, class > class GeometryImp>
GeometryImp<mydim,cdim,GridImp>& Dune::Geometry< mydim, cdim, GridImp, GeometryImp >::getRealImp ( ) [inline, protected]

return reference to the real implementation

template<int mydim, int cdim, class GridImp, template< int, int, class > class GeometryImp>
const GeometryImp<mydim,cdim,GridImp>& Dune::Geometry< mydim, cdim, GridImp, GeometryImp >::getRealImp ( ) const [inline, protected]

return reference to the real implementation

template<int mydim, int cdim, class GridImp, template< int, int, class > class GeometryImp>
GlobalCoordinate Dune::Geometry< mydim, cdim, GridImp, GeometryImp >::global ( const LocalCoordinate local) const [inline]

Evaluate the map $ g$.

Parameters:
[in]localPosition in the reference element $D$
Returns:
Position in $W$
template<int mydim, int cdim, class GridImp, template< int, int, class > class GeometryImp>
ctype Dune::Geometry< mydim, cdim, GridImp, GeometryImp >::integrationElement ( const LocalCoordinate local) const [inline]

Return the factor appearing in the integral transformation formula.

Let $ g : D \to W$ denote the transformation described by the Geometry. Then the jacobian of the transformation is defined as the $\textrm{cdim}\times\textrm{mydim}$ matrix

\[ J_g(x) = \left( \begin{array}{ccc} \frac{\partial g_0}{\partial x_0} & \cdots & \frac{\partial g_0}{\partial x_{n-1}} \\ \vdots & \ddots & \vdots \\ \frac{\partial g_{m-1}}{\partial x_0} & \cdots & \frac{\partial g_{m-1}}{\partial x_{n-1}} \end{array} \right).\]

Here we abbreviated $m=\textrm{cdim}$ and $n=\textrm{mydim}$ for ease of readability.

The integration element $\mu(x)$ for any $x\in D$ is then defined as

\[ \mu(x) = \sqrt{|\det J_g^T(x)J_g(x)|}.\]

Parameters:
[in]localPosition $x\in D$
Returns:
integration element $\mu(x)$
Note:
Each implementation computes the integration element with optimal efficieny. For example in an equidistant structured mesh it may be as simple as $h^\textrm{mydim}$.
template<int mydim, int cdim, class GridImp, template< int, int, class > class GeometryImp>
const Jacobian& Dune::Geometry< mydim, cdim, GridImp, GeometryImp >::jacobianInverseTransposed ( const LocalCoordinate local) const [inline]

Return inverse of transposed of Jacobian.

The Jacobian is defined in the documentation of integrationElement.

Parameters:
[in]localposition $x\in D$
Returns:
$J_g^{-T}(x)$

The use of this function is to compute the gradient of some function $f : W \to \textbf{R}$ at some position $y=g(x)$, where $x\in D$ and $g$ the transformation of the Geometry. When we set $\hat{f}(x) = f(g(x))$ and apply the chain rule we obtain

\[\nabla f(g(x)) = J_g^{-T}(x) \nabla \hat{f}(x).\]

Note:
In the non-symmetric case $\textrm{cdim} \neq \textrm{mydim}$, the pseudoinverse of $J_g^T(x)$ is returned. This means that it is inverse for all tangential vectors in $g(x)$ while mapping all normal vectors to zero.
template<int mydim, int cdim, class GridImp, template< int, int, class > class GeometryImp>
const JacobianTransposed& Dune::Geometry< mydim, cdim, GridImp, GeometryImp >::jacobianTransposed ( const LocalCoordinate local) const [inline]

Return the transposed of the Jacobian.

The Jacobian is defined in the documentation of integrationElement.

Parameters:
[in]localposition $x\in D$
Returns:
$J_g^T(x)$
template<int mydim, int cdim, class GridImp, template< int, int, class > class GeometryImp>
LocalCoordinate Dune::Geometry< mydim, cdim, GridImp, GeometryImp >::local ( const GlobalCoordinate global) const [inline]

Evaluate the inverse map $ g^{-1}$.

Parameters:
[in]globalPosition in $W$
Returns:
Position in $D$ that maps to global
template<int mydim, int cdim, class GridImp, template< int, int, class > class GeometryImp>
Geometry& Dune::Geometry< mydim, cdim, GridImp, GeometryImp >::operator= ( const Geometry< mydim, cdim, GridImp, GeometryImp > &  rhs) [inline, protected]

hide assignment operator

template<int mydim, int cdim, class GridImp, template< int, int, class > class GeometryImp>
GeometryType Dune::Geometry< mydim, cdim, GridImp, GeometryImp >::type ( ) const [inline]

Return the name of the reference element. The type can be used to access the Dune::GenericReferenceElement.

Referenced by Dune::ALU3dGridEntity< 0, dim, GridImp >::type().

template<int mydim, int cdim, class GridImp, template< int, int, class > class GeometryImp>
ctype Dune::Geometry< mydim, cdim, GridImp, GeometryImp >::volume ( ) const [inline]

return volume of geometry


Friends And Related Function Documentation

template<int mydim, int cdim, class GridImp, template< int, int, class > class GeometryImp>
friend class GridDefaultImplementation< GridImp::dimension, GridImp::dimensionworld,typename GridImp::ctype,typename GridImp::GridFamily > [friend]

Member Data Documentation

template<int mydim, int cdim, class GridImp, template< int, int, class > class GeometryImp>
GeometryImp<mydim,cdim,GridImp> Dune::Geometry< mydim, cdim, GridImp, GeometryImp >::realGeometry [protected]

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