dune-alugrid  2.6-git
transformation.hh
Go to the documentation of this file.
1 #ifndef DUNE_ALUGRID_TRANSFORMATION_HH
2 #define DUNE_ALUGRID_TRANSFORMATION_HH
3 
4 #include <dune/common/fvector.hh>
5 #include <dune/common/fmatrix.hh>
6 
7 namespace Dune
8 {
9 
10  template< class ctype, int dimw >
12  {
13  static const int dimension = dimw;
14 
15  typedef FieldVector< ctype, dimension > WorldVector;
16  typedef FieldMatrix< ctype, dimension, dimension > WorldMatrix;
17 
18  ALUGridTransformation ( const WorldMatrix &matrix, const WorldVector &shift )
19  : matrix_( matrix ),
20  shift_( shift )
21  {}
22 
23  WorldVector evaluate ( const WorldVector &x ) const
24  {
25  WorldVector y = shift_;
26  matrix_.umv( x, y );
27  return y;
28  }
29 
31  {
32  // Note: We assume the matrix to be orthogonal, here
33  WorldVector ys = y - shift_;
34  WorldVector x;
35  matrix_.mtv( ys, x );
36  return x;
37  }
38 
39  private:
40  WorldMatrix matrix_;
41  WorldVector shift_;
42  };
43 
44 }
45 
46 #endif // #ifndef DUNE_ALUGRID_TRANSFORMATION_HH
Definition: alu3dinclude.hh:80
Definition: transformation.hh:12
FieldMatrix< ctype, dimension, dimension > WorldMatrix
Definition: transformation.hh:16
ALUGridTransformation(const WorldMatrix &matrix, const WorldVector &shift)
Definition: transformation.hh:18
FieldVector< ctype, dimension > WorldVector
Definition: transformation.hh:15
WorldVector evaluateInverse(const WorldVector &y) const
Definition: transformation.hh:30
WorldVector evaluate(const WorldVector &x) const
Definition: transformation.hh:23
static const int dimension
Definition: transformation.hh:13