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 >
11   struct ALUGridTransformation
12   {
13     static const int dimension = dimw;
14 
15     typedef FieldVector< ctype, dimension > WorldVector;
16     typedef FieldMatrix< ctype, dimension, dimension > WorldMatrix;
17 
ALUGridTransformationDune::ALUGridTransformation18     ALUGridTransformation ( const WorldMatrix &matrix, const WorldVector &shift )
19     : matrix_( matrix ),
20       shift_( shift )
21     {}
22 
evaluateDune::ALUGridTransformation23     WorldVector evaluate ( const WorldVector &x ) const
24     {
25       WorldVector y = shift_;
26       matrix_.umv( x, y );
27       return y;
28     }
29 
evaluateInverseDune::ALUGridTransformation30     WorldVector evaluateInverse ( const WorldVector &y ) const
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
47