1#ifndef DUNE_FEM_GRIDPART_COMMON_COMPOSITEGEOMETRY_HH
2#define DUNE_FEM_GRIDPART_COMMON_COMPOSITEGEOMETRY_HH
5#pragma GCC diagnostic push
6#pragma GCC diagnostic ignored "-Wdangling-reference"
15#include <dune/common/transpose.hh>
23#include <dune/fem/common/fmatrixcol.hh>
31 template<
class Geometry,
class Embedding >
32 struct CompositeGeometry
34 static const int mydimension = Embedding::mydimension;
38 typedef FieldVector< ctype, mydimension > LocalCoordinate;
44 typedef JacobianInverseTransposed Jacobian;
45 typedef JacobianTransposed JacobianInverse;
48 typedef Impl::FieldMatrixHelper< ctype > MatrixHelper;
50 CompositeGeometry ( Geometry geometry, Embedding embedding,
int order )
51 : geometry_(
std::move( geometry ) ), embedding_(
std::move( embedding ) ), order_( order )
56 int corners ()
const {
return embedding_.corners(); }
57 GlobalCoordinate corner(
int i )
const {
return geometry_.global( embedding_.corner( i ) ); }
59 bool affine ()
const {
return geometry_.affine() && embedding_.affine(); }
61 GlobalCoordinate global (
const LocalCoordinate &local )
const {
return geometry_.global( embedding_.global( local ) ); }
62 LocalCoordinate local (
const GlobalCoordinate &global )
const {
return embedding_.local( geometry_.local( global ) ); }
64 JacobianTransposed jacobianTransposed (
const LocalCoordinate &local )
const
66 const FieldMatrix< ctype, mydimension, Embedding::coorddimension > jacEmbedding( embedding_.jacobianTransposed( local ) );
67 const auto jacGeometry = geometry_.jacobianTransposed( embedding_.global( local ) );
69 JacobianTransposed jacTransposed( 0 );
70 for(
int i = 0; i < mydimension; ++i )
71 jacGeometry.mtv( jacEmbedding[ i ], jacTransposed[ i ] );
75 JacobianInverseTransposed jacobianInverseTransposed (
const LocalCoordinate &local )
const
77 JacobianInverseTransposed jacInverseTransposed( 0 );
78 MatrixHelper::template rightInvA< mydimension, coorddimension >( jacobianTransposed( local ), jacInverseTransposed );
79 return jacInverseTransposed;
82 Jacobian jacobian (
const LocalCoordinate &local )
const
84 return transpose( jacobianTransposed( local ) );
87 JacobianInverse jacobianInverse (
const LocalCoordinate &local )
const
89 return transpose( jacobianInverseTransposed( local ) );
92 ctype integrationElement (
const LocalCoordinate &local )
const
94 return MatrixHelper::template sqrtDetAAT< mydimension, coorddimension >( jacobianTransposed( local ) );
97 GlobalCoordinate center ()
const
99 GlobalCoordinate center( 0 );
102 for(
const auto &qp : quadrule )
104 const ctype weight = qp.weight() * integrationElement( qp.position() );
105 center.axpy( weight, global( qp.position() ) );
108 return center /= volume;
111 ctype volume ()
const
115 volume += qp.weight() * integrationElement( qp.position() );
121 Embedding embedding_;
129#pragma GCC diagnostic pop
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:234
A unique label for each type of element that can occur in a grid.