3#ifndef DUNE_ALBERTA_TRANSFORMATION_HH
4#define DUNE_ALBERTA_TRANSFORMATION_HH
8#include <dune/grid/albertagrid/misc.hh>
15 class AlbertaTransformation
17 typedef Alberta::GlobalSpace GlobalSpace;
20 typedef Alberta::Real ctype;
22 static const int dimension = Alberta::dimWorld;
24 typedef FieldVector< ctype, dimension > WorldVector;
27 AlbertaTransformation (
const Alberta::AffineTransformation *trafo = NULL )
28 : matrix_( (trafo != NULL ? trafo->M : GlobalSpace::identityMatrix()) ),
29 shift_( (trafo != NULL ? trafo->t : GlobalSpace::nullVector()) )
32 AlbertaTransformation (
const GlobalSpace::Matrix &matrix,
33 const GlobalSpace::Vector &shift )
38 WorldVector evaluate (
const WorldVector &x )
const
41 for(
int i = 0; i < dimension; ++i )
43 const GlobalSpace::Vector &row = matrix_[ i ];
45 for(
int j = 0; j < dimension; ++j )
46 y[ i ] += row[ j ] * x[ j ];
51 WorldVector evaluateInverse (
const WorldVector &y )
const
54 WorldVector x( ctype( 0 ) );
55 for(
int i = 0; i < dimension; ++i )
57 const GlobalSpace::Vector &row = matrix_[ i ];
58 const ctype v = y[ i ] - shift_[ i ];
59 for(
int j = 0; j < dimension; ++j )
60 x[ j ] += row[ j ] * v;
66 const GlobalSpace::Matrix &matrix_;
67 const GlobalSpace::Vector &shift_;
Implements a vector constructed from a given type representing a field and a compile-time given size.
Dune namespace.
Definition: alignment.hh:11