dune-geometry  2.4
Public Types | Public Member Functions | List of all members
Dune::AxisAlignedCubeGeometry< CoordType, dim, coorddim > Class Template Reference

A geometry implementation for axis-aligned hypercubes. More...

#include <dune/geometry/axisalignedcubegeometry.hh>

Public Types

enum  { mydimension = dim }
 Dimension of the cube element. More...
 
enum  { coorddimension = coorddim }
 Dimension of the world space that the cube element is embedded in. More...
 
typedef CoordType ctype
 Type used for single coordinate coefficients. More...
 
typedef FieldVector< ctype, dim > LocalCoordinate
 Type used for a vector of element coordinates. More...
 
typedef FieldVector< ctype, coorddim > GlobalCoordinate
 Type used for a vector of world coordinates. More...
 
typedef conditional< dim==coorddim, DiagonalMatrix< ctype, dim >, FieldMatrix< ctype, dim, coorddim > >::type JacobianTransposed
 Return type of jacobianTransposed. More...
 
typedef conditional< dim==coorddim, DiagonalMatrix< ctype, dim >, FieldMatrix< ctype, coorddim, dim > >::type JacobianInverseTransposed
 Return type of jacobianInverseTransposed. More...
 

Public Member Functions

 AxisAlignedCubeGeometry (const Dune::FieldVector< ctype, coorddim > lower, const Dune::FieldVector< ctype, coorddim > upper)
 Constructor from a lower left and an upper right corner. More...
 
 AxisAlignedCubeGeometry (const Dune::FieldVector< ctype, coorddim > lower, const Dune::FieldVector< ctype, coorddim > upper, const std::bitset< coorddim > &axes)
 Constructor from a lower left and an upper right corner. More...
 
 AxisAlignedCubeGeometry (const Dune::FieldVector< ctype, coorddim > lower)
 Constructor from a single point only. More...
 
AxisAlignedCubeGeometryoperator= (const AxisAlignedCubeGeometry &other)
 Assignment operator. More...
 
GeometryType type () const
 Type of the cube. Here: a hypercube of the correct dimension. More...
 
GlobalCoordinate global (const LocalCoordinate &local) const
 Map a point in local (element) coordinates to world coordinates. More...
 
LocalCoordinate local (const GlobalCoordinate &global) const
 Map a point in global (world) coordinates to element coordinates. More...
 
const JacobianTransposedjacobianTransposed (DUNE_UNUSED const LocalCoordinate &local) const
 Jacobian transposed of the transformation from local to global coordinates. More...
 
const JacobianInverseTransposedjacobianInverseTransposed (DUNE_UNUSED const LocalCoordinate &local) const
 Jacobian transposed of the transformation from local to global coordinates. More...
 
ctype integrationElement (DUNE_UNUSED const LocalCoordinate &local) const
 Return the integration element, i.e., the determinant term in the integral transformation formula. More...
 
GlobalCoordinate center () const
 Return center of mass of the element. More...
 
int corners () const
 Return the number of corners of the element. More...
 
GlobalCoordinate corner (int k) const
 Return world coordinates of the k-th corner of the element. More...
 
ctype volume () const
 Return the element volume. More...
 
bool affine () const
 Return if the element is affine. Here: yes. More...
 

Detailed Description

template<class CoordType, unsigned int dim, unsigned int coorddim>
class Dune::AxisAlignedCubeGeometry< CoordType, dim, coorddim >

A geometry implementation for axis-aligned hypercubes.

This code is much faster than a generic implementation for hexahedral elements. All methods use the fact that a geometry for axis-aligned cubes is basically just a(n affine) scaling in the coordinate directions.

If dim < coorddim then local coordinates need to be suitably mapped to global ones. AxisAlignedCubeGeometry uses a special std::bitset 'axes' for this. 'axes' has coorddim entries, of which precisely 'dim' need to be set. Each set entry marks a local coordinate, i.e., a coordinate in which the cube has extension. The cube is flat in all other directions. Its coordinates in these directions is taking from the array called 'lower', which specifies the lower left corner of the hypercube.

In the case of dim==coorddim, the code goes into overdrive. Then special code path's are taken (statically) which omit the conditionals needed to sort out the embedding of local into global coordinates. Aggressive compiler/scheduler optimization becomes possible. Additionally, the types returned by the methods jacobianTransposed and jacobianInverseTransposed are dedicated types for diagonal matrices (DiagonalMatrix).

Template Parameters
CoordTypeType used for single coordinate coefficients
dimDimension of the cube
coorddimDimension of the space that the cube lives in

Member Typedef Documentation

template<class CoordType , unsigned int dim, unsigned int coorddim>
typedef CoordType Dune::AxisAlignedCubeGeometry< CoordType, dim, coorddim >::ctype

Type used for single coordinate coefficients.

template<class CoordType , unsigned int dim, unsigned int coorddim>
typedef FieldVector<ctype,coorddim> Dune::AxisAlignedCubeGeometry< CoordType, dim, coorddim >::GlobalCoordinate

Type used for a vector of world coordinates.

template<class CoordType , unsigned int dim, unsigned int coorddim>
typedef conditional<dim==coorddim, DiagonalMatrix<ctype,dim>, FieldMatrix<ctype,coorddim,dim> >::type Dune::AxisAlignedCubeGeometry< CoordType, dim, coorddim >::JacobianInverseTransposed

Return type of jacobianInverseTransposed.

This is a fast DiagonalMatrix if dim==coorddim, and a FieldMatrix otherwise. The FieldMatrix will never contain more than one entry per column, hence it could be replaced by something more efficient.

template<class CoordType , unsigned int dim, unsigned int coorddim>
typedef conditional<dim==coorddim, DiagonalMatrix<ctype,dim>, FieldMatrix<ctype,dim,coorddim> >::type Dune::AxisAlignedCubeGeometry< CoordType, dim, coorddim >::JacobianTransposed

Return type of jacobianTransposed.

This is a fast DiagonalMatrix if dim==coorddim, and a FieldMatrix otherwise. The FieldMatrix will never contain more than one entry per row, hence it could be replaced by something more efficient.

template<class CoordType , unsigned int dim, unsigned int coorddim>
typedef FieldVector<ctype,dim> Dune::AxisAlignedCubeGeometry< CoordType, dim, coorddim >::LocalCoordinate

Type used for a vector of element coordinates.

Member Enumeration Documentation

template<class CoordType , unsigned int dim, unsigned int coorddim>
anonymous enum

Dimension of the cube element.

Enumerator
mydimension 
template<class CoordType , unsigned int dim, unsigned int coorddim>
anonymous enum

Dimension of the world space that the cube element is embedded in.

Enumerator
coorddimension 

Constructor & Destructor Documentation

template<class CoordType , unsigned int dim, unsigned int coorddim>
Dune::AxisAlignedCubeGeometry< CoordType, dim, coorddim >::AxisAlignedCubeGeometry ( const Dune::FieldVector< ctype, coorddim >  lower,
const Dune::FieldVector< ctype, coorddim >  upper 
)
inline

Constructor from a lower left and an upper right corner.

Note
Only for dim==coorddim
template<class CoordType , unsigned int dim, unsigned int coorddim>
Dune::AxisAlignedCubeGeometry< CoordType, dim, coorddim >::AxisAlignedCubeGeometry ( const Dune::FieldVector< ctype, coorddim >  lower,
const Dune::FieldVector< ctype, coorddim >  upper,
const std::bitset< coorddim > &  axes 
)
inline

Constructor from a lower left and an upper right corner.

Parameters
lowerCoordinates for the lower left corner.
upperCoordinates for the upper right corner.
axesEach bit set to 'true' here corresponds to a local coordinate axis. In other words, precisely 'dim' bits must be set here.
template<class CoordType , unsigned int dim, unsigned int coorddim>
Dune::AxisAlignedCubeGeometry< CoordType, dim, coorddim >::AxisAlignedCubeGeometry ( const Dune::FieldVector< ctype, coorddim >  lower)
inline

Constructor from a single point only.

Note
Only for dim==0

Member Function Documentation

template<class CoordType , unsigned int dim, unsigned int coorddim>
bool Dune::AxisAlignedCubeGeometry< CoordType, dim, coorddim >::affine ( ) const
inline

Return if the element is affine. Here: yes.

template<class CoordType , unsigned int dim, unsigned int coorddim>
GlobalCoordinate Dune::AxisAlignedCubeGeometry< CoordType, dim, coorddim >::center ( ) const
inline

Return center of mass of the element.

template<class CoordType , unsigned int dim, unsigned int coorddim>
GlobalCoordinate Dune::AxisAlignedCubeGeometry< CoordType, dim, coorddim >::corner ( int  k) const
inline

Return world coordinates of the k-th corner of the element.

template<class CoordType , unsigned int dim, unsigned int coorddim>
int Dune::AxisAlignedCubeGeometry< CoordType, dim, coorddim >::corners ( ) const
inline

Return the number of corners of the element.

template<class CoordType , unsigned int dim, unsigned int coorddim>
GlobalCoordinate Dune::AxisAlignedCubeGeometry< CoordType, dim, coorddim >::global ( const LocalCoordinate local) const
inline

Map a point in local (element) coordinates to world coordinates.

template<class CoordType , unsigned int dim, unsigned int coorddim>
ctype Dune::AxisAlignedCubeGeometry< CoordType, dim, coorddim >::integrationElement ( DUNE_UNUSED const LocalCoordinate local) const
inline

Return the integration element, i.e., the determinant term in the integral transformation formula.

References Dune::AxisAlignedCubeGeometry< CoordType, dim, coorddim >::volume().

template<class CoordType , unsigned int dim, unsigned int coorddim>
const JacobianInverseTransposed& Dune::AxisAlignedCubeGeometry< CoordType, dim, coorddim >::jacobianInverseTransposed ( DUNE_UNUSED const LocalCoordinate local) const
inline

Jacobian transposed of the transformation from local to global coordinates.

template<class CoordType , unsigned int dim, unsigned int coorddim>
const JacobianTransposed& Dune::AxisAlignedCubeGeometry< CoordType, dim, coorddim >::jacobianTransposed ( DUNE_UNUSED const LocalCoordinate local) const
inline

Jacobian transposed of the transformation from local to global coordinates.

template<class CoordType , unsigned int dim, unsigned int coorddim>
LocalCoordinate Dune::AxisAlignedCubeGeometry< CoordType, dim, coorddim >::local ( const GlobalCoordinate global) const
inline

Map a point in global (world) coordinates to element coordinates.

template<class CoordType , unsigned int dim, unsigned int coorddim>
AxisAlignedCubeGeometry& Dune::AxisAlignedCubeGeometry< CoordType, dim, coorddim >::operator= ( const AxisAlignedCubeGeometry< CoordType, dim, coorddim > &  other)
inline

Assignment operator.

template<class CoordType , unsigned int dim, unsigned int coorddim>
GeometryType Dune::AxisAlignedCubeGeometry< CoordType, dim, coorddim >::type ( ) const
inline

Type of the cube. Here: a hypercube of the correct dimension.

References Dune::GeometryType::cube.

template<class CoordType , unsigned int dim, unsigned int coorddim>
ctype Dune::AxisAlignedCubeGeometry< CoordType, dim, coorddim >::volume ( ) const
inline

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