1#ifndef DUNE_FEM_GRIDPART_COMMON_SIMPLEGEOMETRY_HH
2#define DUNE_FEM_GRIDPART_COMMON_SIMPLEGEOMETRY_HH
11#include <dune/geometry/referenceelements.hh>
15#include <dune/fem/common/fmatrixcol.hh>
23 template<
class BasicGeometry >
25 :
public BasicGeometry
27 typedef typename BasicGeometry::ctype ctype;
29 using BasicGeometry::mydimension;
30 using BasicGeometry::coorddimension;
32 using BasicGeometry::global;
33 using BasicGeometry::jacobianTransposed;
34 using BasicGeometry::quadrature;
35 using BasicGeometry::type;
37 typedef FieldVector< ctype, mydimension > LocalCoordinate;
43 typedef JacobianInverseTransposed Jacobian;
44 typedef JacobianTransposed JacobianInverse;
47 typedef Impl::FieldMatrixHelper< ctype > MatrixHelper;
49 template<
class... Args, std::enable_if_t< std::is_constructible< BasicGeometry, Args &&... >::value,
int > = 0 >
50 SimpleGeometry ( Args &&...args )
51 : BasicGeometry(
std::forward< Args >( args )... )
55 GlobalCoordinate corner (
int i )
const {
return global(
referenceElement().position( i, mydimension ) ); }
57 bool affine ()
const {
return false; }
59 LocalCoordinate local (
const GlobalCoordinate &global )
const
61 const ctype tolerance = 1e-12;
63 LocalCoordinate dlocal;
67 const GlobalCoordinate dglobal = this->global( local ) - global;
68 MatrixHelper::template xTRightInvA< mydimension, coorddimension >( jacobianTransposed( local ), dglobal, dlocal );
72 while( dlocal.two_norm2() > tolerance );
76 ctype integrationElement (
const LocalCoordinate &local )
const
78 return MatrixHelper::template sqrtDetAAT< mydimension, coorddimension >( jacobianTransposed( local ) );
81 JacobianInverseTransposed jacobianInverseTransposed (
const LocalCoordinate &local )
const
83 JacobianInverseTransposed jacInverseTransposed( 0 );
84 MatrixHelper::template rightInvA< mydimension, coorddimension >( jacobianTransposed( local ), jacInverseTransposed );
85 return jacInverseTransposed;
88 Jacobian jacobian (
const LocalCoordinate &local )
const
90 return transpose( jacobianTransposed( local ) );
93 JacobianInverse jacobianInverse (
const LocalCoordinate &local )
const
95 return transpose( jacobianInverseTransposed( local ) );
98 GlobalCoordinate center ()
const
100 GlobalCoordinate center( 0 );
102 for(
const auto &qp : quadrature( 0 ) )
104 const ctype weight = qp.weight() * integrationElement( qp.position() );
105 center.axpy( weight, global( qp.position() ) );
108 return center /= volume;
111 ctype volume ()
const
114 for(
const auto &qp : quadrature( 0 ) )
115 volume += qp.weight() * integrationElement( qp.position() );
An implementation of the Geometry interface for affine geometries.
Wrapper and interface classes for element geometries.
Implements a matrix constructed from a given type representing a field and compile-time given number ...
Implements a vector constructed from a given type representing a field and a compile-time given size.
unspecified value type referenceElement(T &&... t)
Returns a reference element for the objects t....
Dune namespace.
Definition: alignedallocator.hh:13
auto transpose(const Matrix &matrix)
Return the transposed of the given matrix.
Definition: transpose.hh:234
Static tag representing a dimension.
Definition: dimension.hh:16