3#ifndef DUNE_ALBERTA_GEOMETRYCACHE_HH
4#define DUNE_ALBERTA_GEOMETRYCACHE_HH
6#include <dune/grid/albertagrid/misc.hh>
7#include <dune/grid/albertagrid/algebra.hh>
23 static const unsigned int flagIntegrationElement = (1 << 0);
24 static const unsigned int flagJacobianTransposed = (1 << 1);
25 static const unsigned int flagJacobianInverseTransposed = (1 << 2);
35 const Real &integrationElement (
const ALBERTA EL_INFO &elInfo )
37 if( (flags_ & flagIntegrationElement) == 0 )
39 integrationElement_ = std::abs( determinant( jacobianTransposed( elInfo ) ) );
40 assert( integrationElement_ > 1e-14 );
41 flags_ |= flagIntegrationElement;
43 return integrationElement_;
46 const JacobianTransposed &jacobianTransposed (
const ALBERTA EL_INFO &elInfo )
48 if( (flags_ & flagJacobianTransposed) == 0 )
50 assert( (elInfo.fill_flag & FillFlags< dim >::coords) != 0 );
51 const GlobalVector &x = elInfo.coord[ 0 ];
52 for(
int i = 0; i < dim; ++i )
54 const GlobalVector &y = elInfo.coord[ i+1 ];
55 for(
int j = 0; j < dimWorld; ++j )
56 jacobianTransposed_[ i ][ j ] = y[ j ] - x[ j ];
58 flags_ |= flagJacobianTransposed;
60 return jacobianTransposed_;
63 const JacobianInverseTransposed &
64 jacobianInverseTransposed (
const ALBERTA EL_INFO &elInfo )
66 if( (flags_ & flagJacobianInverseTransposed) == 0 )
68 integrationElement_ = std::abs( invert( jacobianTransposed( elInfo ), jacobianInverseTransposed_ ) );
69 assert( integrationElement_ > 1e-14 );
70 flags_ |= flagIntegrationElement | flagJacobianInverseTransposed;
72 return jacobianInverseTransposed_;
77 Real integrationElement_;
88 struct GeometryCacheProxy
93 GeometryCacheProxy ( GeometryCache< dim > &geometryCache,
const ALBERTA EL_INFO &elInfo )
94 : geometryCache_( geometryCache ),
98 const Real &integrationElement ()
100 return geometryCache_.integrationElement( elInfo_ );
103 const JacobianTransposed &jacobianTransposed ()
105 return geometryCache_.jacobianTransposed( elInfo_ );
108 const JacobianInverseTransposed &jacobianInverseTransposed ()
110 return geometryCache_.jacobianInverseTransposed( elInfo_ );
114 GeometryCache< dim > &geometryCache_;
115 const ALBERTA EL_INFO &elInfo_;
Dune namespace.
Definition: alignedallocator.hh:11