5#ifndef DUNE_ALBERTA_TRANSFORMATION_HH
6#define DUNE_ALBERTA_TRANSFORMATION_HH
10#include <dune/grid/albertagrid/misc.hh>
17 class AlbertaTransformation
19 typedef Alberta::GlobalSpace GlobalSpace;
22 typedef Alberta::Real ctype;
24 static const int dimension = Alberta::dimWorld;
26 typedef FieldVector< ctype, dimension > WorldVector;
29 AlbertaTransformation (
const Alberta::AffineTransformation *trafo = NULL )
30 : matrix_( (trafo != NULL ? trafo->M : GlobalSpace::identityMatrix()) ),
31 shift_( (trafo != NULL ? trafo->t : GlobalSpace::nullVector()) )
34 AlbertaTransformation (
const GlobalSpace::Matrix &matrix,
35 const GlobalSpace::Vector &shift )
40 WorldVector evaluate (
const WorldVector &x )
const
43 for(
int i = 0; i < dimension; ++i )
45 const GlobalSpace::Vector &row = matrix_[ i ];
47 for(
int j = 0; j < dimension; ++j )
48 y[ i ] += row[ j ] * x[ j ];
53 WorldVector evaluateInverse (
const WorldVector &y )
const
56 WorldVector x( ctype( 0 ) );
57 for(
int i = 0; i < dimension; ++i )
59 const GlobalSpace::Vector &row = matrix_[ i ];
60 const ctype v = y[ i ] - shift_[ i ];
61 for(
int j = 0; j < dimension; ++j )
62 x[ j ] += row[ j ] * v;
68 const GlobalSpace::Matrix &matrix_;
69 const GlobalSpace::Vector &shift_;
Implements a vector constructed from a given type representing a field and a compile-time given size.
Dune namespace.
Definition: alignedallocator.hh:13