DUNE-FEM (unstable)

localfunctiongeometry.hh
1#ifndef DUNE_FEM_GRIDPART_COMMON_LOCALFUNCTIONGEOMETRY_HH
2#define DUNE_FEM_GRIDPART_COMMON_LOCALFUNCTIONGEOMETRY_HH
3
4#include <type_traits>
5#include <utility>
6
9
11#include <dune/geometry/referenceelements.hh>
12
14
15#include <dune/fem/common/fmatrixcol.hh>
16
17#include <dune/fem/gridpart/common/simplegeometry.hh>
18
19namespace Dune
20{
21
22 namespace Fem
23 {
24
25 // LocalFunctionBasicGeometry
26 // --------------------------
27
28 template< class LocalFunction >
29 struct LocalFunctionBasicGeometry
30 {
31 typedef typename LocalFunction::EntityType Entity;
33
34 static const int mydimension = Entity::mydimension;
35 static const int coorddimension = LocalFunction::FunctionSpaceType::dimRange;
36
37 typedef FieldVector< ctype, mydimension > LocalCoordinate;
38 typedef FieldVector< ctype, coorddimension > GlobalCoordinate;
39
41
42 template< class... Args, std::enable_if_t< std::is_constructible< LocalFunction, Args &&... >::value, int > = 0 >
43 LocalFunctionBasicGeometry ( Args &&... args )
44 : localFunction_( std::forward< Args >( args )... )
45 {}
46
47 GlobalCoordinate global ( const LocalCoordinate &local ) const
48 {
49 GlobalCoordinate ret;
50 localFunction().evaluate( local, ret );
51 return ret;
52 }
53
54 JacobianTransposed jacobianTransposed ( const LocalCoordinate &local ) const
55 {
56 const auto gradFT = localFunction().entity().geometry().jacobianTransposed( local );
57
59
60 localFunction().jacobian( local, gradPhi );
61
62 JacobianTransposed jacTransposed( 0 );
63 for( int i = 0; i < coorddimension; ++i )
64 {
65 FieldMatrixColumn< JacobianTransposed > col( jacTransposed, i );
66 gradFT.mv( gradPhi[ i ], col );
67 }
68 return jacTransposed;
69 }
70
71 const QuadratureRule< ctype, mydimension > &quadrature ( int order ) const
72 {
73 return QuadratureRules< ctype, mydimension >::rule( type(), order + (2*localFunction().order() + 1) );
74 }
75
76 GeometryType type () const { return localFunction().entity().type(); }
77
78 void bind ( const Entity &entity ) { localFunction_.bind( entity ); }
79 void init ( const Entity &entity ) { bind( entity ); }
80
81 const LocalFunction &localFunction () const { return localFunction_; }
82
83 private:
84 LocalFunction localFunction_;
85 };
86
87
88
89 // LocalFunctionGeometry
90 // ---------------------
91
92 template< class LocalFunction >
93 using LocalFunctionGeometry = SimpleGeometry< LocalFunctionBasicGeometry< LocalFunction > >;
94
95 } // namespace Fem
96
97} // namespace Dune
98
99#endif // #ifndef DUNE_FEM_GRIDPART_COMMON_LOCALFUNCTIONGEOMETRY_HH
static constexpr int mydimension
Dimensionality of the reference element of the entity.
Definition: entity.hh:112
@ dimRange
dimension of range vector space
Definition: functionspaceinterface.hh:48
FunctionSpaceTraits::LinearMappingType JacobianRangeType
Intrinsic type used for the jacobian values has a Dune::FieldMatrix type interface.
Definition: functionspaceinterface.hh:75
FunctionSpaceTraits::RangeFieldType RangeFieldType
Intrinsic type used for values in the range field (usually a double)
Definition: functionspaceinterface.hh:63
BasisFunctionSetType::EntityType EntityType
type of the entity, the local function lives on is given by the space
Definition: localfunction.hh:95
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
STL namespace.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 27, 22:29, 2024)