dune-fem  2.8-git
transformation.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_SPACE_BASISFUNCTIONSET_TRANSFORMATION_HH
2 #define DUNE_FEM_SPACE_BASISFUNCTIONSET_TRANSFORMATION_HH
3 
4 #include <dune/common/exceptions.hh>
5 #include <dune/common/fmatrix.hh>
6 #include <dune/common/fvector.hh>
7 
10 
11 namespace 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 >
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:
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  {
79  gjit.mv( ci, bi );
80  }
81 
82  }
83  }
84 
85 
86 
87  // HessianTransformation
88  // ---------------------
89 
90  template< class Geometry >
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:
111  };
112 
113  } // namespace Fem
114 
115 } // namespace Dune
116 
117 #endif // #ifndef DUNE_FEM_SPACE_BASISFUNCTIONSET_TRANSFORMATION_HH
Definition: bindguard.hh:11
void jacobianTransformation(const GeometryJacobianInverseTransposed &gjit, const FieldMatrix< K, ROWS, GeometryJacobianInverseTransposed::cols > &a, FieldMatrix< K, ROWS, GeometryJacobianInverseTransposed::rows > &b)
Definition: transformation.hh:21
void hessianTransformation(const GeometryJacobianInverseTransposed &gjit, const ExplicitFieldVector< FieldMatrix< K, GeometryJacobianInverseTransposed::cols, GeometryJacobianInverseTransposed::cols >, SIZE > &a, ExplicitFieldVector< FieldMatrix< K, GeometryJacobianInverseTransposed::rows, GeometryJacobianInverseTransposed::rows >, SIZE > &b)
Definition: transformation.hh:60
Definition: explicitfieldvector.hh:75
Definition: fmatrixcol.hh:16
Definition: transformation.hh:36
void operator()(const A &a, B &b) const
Definition: transformation.hh:45
Geometry::LocalCoordinate LocalCoordinate
Definition: transformation.hh:37
JacobianTransformation(const Geometry &geometry, const LocalCoordinate &x)
Definition: transformation.hh:40
Geometry::JacobianInverseTransposed GeometryJacobianInverseTransposed
Definition: transformation.hh:38
Definition: transformation.hh:92
Geometry::JacobianInverseTransposed GeometryJacobianInverseTransposed
Definition: transformation.hh:94
Geometry::LocalCoordinate LocalCoordinate
Definition: transformation.hh:93
HessianTransformation(const Geometry &geometry, const LocalCoordinate &x)
Definition: transformation.hh:96
void operator()(const A &a, B &b) const
Definition: transformation.hh:104