DUNE-FEM (unstable)

transformation.hh
1#ifndef DUNE_FEM_SPACE_BASISFUNCTIONSET_TRANSFORMATION_HH
2#define DUNE_FEM_SPACE_BASISFUNCTIONSET_TRANSFORMATION_HH
3
7
8#include <dune/fem/common/explicitfieldvector.hh>
9#include <dune/fem/common/fmatrixcol.hh>
10
11namespace Dune
12{
13
14 namespace Fem
15 {
16
17 // jacobianTransformation
18 // ----------------------
19
20 template< class GeometryJacobianInverseTransposed, class K, int ROWS >
21 void jacobianTransformation ( const GeometryJacobianInverseTransposed &gjit,
22 const FieldMatrix< K, ROWS, GeometryJacobianInverseTransposed::cols > &a,
23 FieldMatrix< K, ROWS, GeometryJacobianInverseTransposed::rows > &b )
24 {
25 for( int r = 0; r < ROWS; ++r )
26 gjit.mv( a[ r ], b[ r ] );
27 }
28
29
30
31 // JacobianTransformation
32 // ----------------------
33
34 template< class Geometry >
35 struct JacobianTransformation
36 {
37 typedef typename Geometry::LocalCoordinate LocalCoordinate;
38 typedef typename Geometry::JacobianInverseTransposed GeometryJacobianInverseTransposed;
39
40 JacobianTransformation ( const Geometry &geometry, const LocalCoordinate &x )
41 : gjit_( geometry.jacobianInverseTransposed( x ) )
42 {}
43
44 template< class A, class B >
45 void operator() ( const A &a, B &b ) const
46 {
47 jacobianTransformation( gjit_, a, b );
48 }
49
50 private:
51 GeometryJacobianInverseTransposed gjit_;
52 };
53
54
55
56 // hessianTransformation
57 // ---------------------
58
59 template< class GeometryJacobianInverseTransposed, class K, int SIZE >
60 void hessianTransformation ( const GeometryJacobianInverseTransposed &gjit,
61 const ExplicitFieldVector< FieldMatrix< K, GeometryJacobianInverseTransposed::cols, GeometryJacobianInverseTransposed::cols >, SIZE > &a,
62 ExplicitFieldVector< FieldMatrix< K, GeometryJacobianInverseTransposed::rows, GeometryJacobianInverseTransposed::rows >, SIZE > &b )
63 {
64 const int dimLocal = GeometryJacobianInverseTransposed::cols;
65 const int dimGlobal = GeometryJacobianInverseTransposed::rows;
66
67 for( int r = 0; r < SIZE; ++r )
68 {
69 // c = J^{-T} a_r^T
70 FieldMatrix< K, dimLocal, dimGlobal > c;
71 for( int i = 0; i < dimLocal; ++i )
72 gjit.mv( a[ r ][ i ], c[ i ] );
73
74 // b_r = J^{-T} c
75 for( int i = 0; i < dimGlobal; ++i )
76 {
77 FieldMatrixColumn< const FieldMatrix< K, dimLocal, dimGlobal > > ci( c, i );
78 FieldMatrixColumn< FieldMatrix< K, dimGlobal, dimGlobal > > bi( b[ r ], i );
79 gjit.mv( ci, bi );
80 }
81
82 }
83 }
84
85
86
87 // HessianTransformation
88 // ---------------------
89
90 template< class Geometry >
91 struct HessianTransformation
92 {
93 typedef typename Geometry::LocalCoordinate LocalCoordinate;
94 typedef typename Geometry::JacobianInverseTransposed GeometryJacobianInverseTransposed;
95
96 HessianTransformation ( const Geometry &geometry, const LocalCoordinate &x )
97 : gjit_( geometry.jacobianInverseTransposed( x ) )
98 {
99 if( !geometry.affine() )
100 DUNE_THROW( NotImplemented, "HessianTransformation not implemented for non-affine geometries." );
101 }
102
103 template< class A, class B >
104 void operator() ( const A &a, B &b ) const
105 {
106 hessianTransformation( gjit_, a, b );
107 }
108
109 private:
110 GeometryJacobianInverseTransposed gjit_;
111 };
112
113 } // namespace Fem
114
115} // namespace Dune
116
117#endif // #ifndef DUNE_FEM_SPACE_BASISFUNCTIONSET_TRANSFORMATION_HH
Implementation::JacobianInverseTransposed JacobianInverseTransposed
type of jacobian inverse transposed
Definition: geometry.hh:120
FieldVector< ctype, mydim > LocalCoordinate
type of local coordinates
Definition: geometry.hh:103
A few common exception classes.
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.
#define DUNE_THROW(E, m)
Definition: exceptions.hh:218
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 21, 23:30, 2024)