1#ifndef DUNE_FEM_GRIDPART_COMMON_COMPOSITEGEOMETRY_HH
2#define DUNE_FEM_GRIDPART_COMMON_COMPOSITEGEOMETRY_HH
9#include <dune/common/transpose.hh>
17#include <dune/fem/common/fmatrixcol.hh>
25 template<
class Geometry,
class Embedding >
26 struct CompositeGeometry
28 static const int mydimension = Embedding::mydimension;
32 typedef FieldVector< ctype, mydimension > LocalCoordinate;
38 typedef JacobianInverseTransposed Jacobian;
39 typedef JacobianTransposed JacobianInverse;
42 typedef Impl::FieldMatrixHelper< ctype > MatrixHelper;
44 CompositeGeometry ( Geometry geometry, Embedding embedding,
int order )
45 : geometry_(
std::move( geometry ) ), embedding_(
std::move( embedding ) ), order_( order )
50 int corners ()
const {
return embedding_.corners(); }
51 GlobalCoordinate corner(
int i )
const {
return geometry_.global( embedding_.corner( i ) ); }
53 bool affine ()
const {
return geometry_.affine() && embedding_.affine(); }
55 GlobalCoordinate global (
const LocalCoordinate &local )
const {
return geometry_.global( embedding_.global( local ) ); }
56 LocalCoordinate local (
const GlobalCoordinate &global )
const {
return embedding_.local( geometry_.local( global ) ); }
58 JacobianTransposed jacobianTransposed (
const LocalCoordinate &local )
const
60 const FieldMatrix< ctype, mydimension, Embedding::coorddimension > jacEmbedding( embedding_.jacobianTransposed( local ) );
61 const auto jacGeometry = geometry_.jacobianTransposed( embedding_.global( local ) );
63 JacobianTransposed jacTransposed( 0 );
64 for(
int i = 0; i < mydimension; ++i )
65 jacGeometry.mtv( jacEmbedding[ i ], jacTransposed[ i ] );
69 JacobianInverseTransposed jacobianInverseTransposed (
const LocalCoordinate &local )
const
71 JacobianInverseTransposed jacInverseTransposed( 0 );
72 MatrixHelper::template rightInvA< mydimension, coorddimension >( jacobianTransposed( local ), jacInverseTransposed );
73 return jacInverseTransposed;
76 Jacobian jacobian (
const LocalCoordinate &local )
const
78 return transpose( jacobianTransposed( local ) );
81 JacobianInverse jacobianInverse (
const LocalCoordinate &local )
const
83 return transpose( jacobianInverseTransposed( local ) );
86 ctype integrationElement (
const LocalCoordinate &local )
const
88 return MatrixHelper::template sqrtDetAAT< mydimension, coorddimension >( jacobianTransposed( local ) );
91 GlobalCoordinate center ()
const
93 GlobalCoordinate center( 0 );
96 for(
const auto &qp : quadrule )
98 const ctype weight = qp.weight() * integrationElement( qp.position() );
99 center.axpy( weight, global( qp.position() ) );
102 return center /= volume;
105 ctype volume ()
const
109 volume += qp.weight() * integrationElement( qp.position() );
115 Embedding embedding_;
An implementation of the Geometry interface for affine geometries.
static constexpr int coorddimension
dimension of embedding coordinate system
Definition: geometry.hh:97
GridImp::ctype ctype
define type used for coordinates in grid module
Definition: geometry.hh:100
static const QuadratureRule & rule(const GeometryType &t, int p, QuadratureType::Enum qt=QuadratureType::GaussLegendre)
select the appropriate QuadratureRule for GeometryType t and order p
Definition: quadraturerules.hh:326
Wrapper and interface classes for element geometries.
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:132
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.
Dune namespace.
Definition: alignedallocator.hh:13
auto transpose(const Matrix &matrix)
Return the transposed of the given matrix.
Definition: transpose.hh:183
A unique label for each type of element that can occur in a grid.