dune-grid
2.2.0
|
00001 #ifndef DUNE_ALUGRID_TRANSFORMATION_HH 00002 #define DUNE_ALUGRID_TRANSFORMATION_HH 00003 00004 #include <dune/common/fvector.hh> 00005 #include <dune/common/fmatrix.hh> 00006 00007 #if ENABLE_ALUGRID 00008 00009 namespace Dune 00010 { 00011 00012 template< class ctype, int dimw > 00013 struct ALUGridTransformation 00014 { 00015 static const int dimension = dimw; 00016 00017 typedef FieldVector< ctype, dimension > WorldVector; 00018 typedef FieldMatrix< ctype, dimension, dimension > WorldMatrix; 00019 00020 ALUGridTransformation ( const WorldMatrix &matrix, const WorldVector &shift ) 00021 : matrix_( matrix ), 00022 shift_( shift ) 00023 {} 00024 00025 WorldVector evaluate ( const WorldVector &x ) const 00026 { 00027 WorldVector y = shift_; 00028 matrix_.umv( x, y ); 00029 return y; 00030 } 00031 00032 WorldVector evaluateInverse ( const WorldVector &y ) const 00033 { 00034 // Note: We assume the matrix to be orthogonal, here 00035 WorldVector ys = y - shift_; 00036 WorldVector x; 00037 matrix_.mtv( ys, x ); 00038 return x; 00039 } 00040 00041 private: 00042 WorldMatrix matrix_; 00043 WorldVector shift_; 00044 }; 00045 00046 } 00047 00048 #endif // #if ENABLE_ALUGRID 00049 00050 #endif // #ifndef DUNE_ALUGRID_TRANSFORMATION_HH