5#ifndef DUNE_ALBERTA_GEOMETRYCACHE_HH
6#define DUNE_ALBERTA_GEOMETRYCACHE_HH
8#include <dune/grid/albertagrid/misc.hh>
9#include <dune/grid/albertagrid/algebra.hh>
25 static const unsigned int flagIntegrationElement = (1 << 0);
26 static const unsigned int flagJacobianTransposed = (1 << 1);
27 static const unsigned int flagJacobianInverseTransposed = (1 << 2);
37 const Real &integrationElement (
const ALBERTA EL_INFO &elInfo )
39 if( (flags_ & flagIntegrationElement) == 0 )
41 integrationElement_ = std::abs( determinant( jacobianTransposed( elInfo ) ) );
42 assert( integrationElement_ > 1e-14 );
43 flags_ |= flagIntegrationElement;
45 return integrationElement_;
48 const JacobianTransposed &jacobianTransposed (
const ALBERTA EL_INFO &elInfo )
50 if( (flags_ & flagJacobianTransposed) == 0 )
52 assert( (elInfo.fill_flag & FillFlags< dim >::coords) != 0 );
53 const GlobalVector &x = elInfo.coord[ 0 ];
54 for(
int i = 0; i < dim; ++i )
56 const GlobalVector &y = elInfo.coord[ i+1 ];
57 for(
int j = 0; j < dimWorld; ++j )
58 jacobianTransposed_[ i ][ j ] = y[ j ] - x[ j ];
60 flags_ |= flagJacobianTransposed;
62 return jacobianTransposed_;
65 const JacobianInverseTransposed &
66 jacobianInverseTransposed (
const ALBERTA EL_INFO &elInfo )
68 if( (flags_ & flagJacobianInverseTransposed) == 0 )
70 integrationElement_ = std::abs( invert( jacobianTransposed( elInfo ), jacobianInverseTransposed_ ) );
71 assert( integrationElement_ > 1e-14 );
72 flags_ |= flagIntegrationElement | flagJacobianInverseTransposed;
74 return jacobianInverseTransposed_;
79 Real integrationElement_;
90 struct GeometryCacheProxy
95 GeometryCacheProxy ( GeometryCache< dim > &geometryCache,
const ALBERTA EL_INFO &elInfo )
96 : geometryCache_( geometryCache ),
100 const Real &integrationElement ()
102 return geometryCache_.integrationElement( elInfo_ );
105 const JacobianTransposed &jacobianTransposed ()
107 return geometryCache_.jacobianTransposed( elInfo_ );
110 const JacobianInverseTransposed &jacobianInverseTransposed ()
112 return geometryCache_.jacobianInverseTransposed( elInfo_ );
116 GeometryCache< dim > &geometryCache_;
117 const ALBERTA EL_INFO &elInfo_;
Dune namespace.
Definition: alignedallocator.hh:13