/usr/include/dune/grid/albertagrid/geometrycache.hh is in libdune-grid-dev 2.3.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_ALBERTA_GEOMETRYCACHE_HH
#define DUNE_ALBERTA_GEOMETRYCACHE_HH
#include <dune/grid/albertagrid/misc.hh>
#include <dune/grid/albertagrid/algebra.hh>
#if HAVE_ALBERTA
namespace Dune
{
namespace Alberta
{
// GeometryCache
// -------------
template< int dim >
class GeometryCache
{
static const unsigned int flagIntegrationElement = (1 << 0);
static const unsigned int flagJacobianTransposed = (1 << 1);
static const unsigned int flagJacobianInverseTransposed = (1 << 2);
public:
typedef FieldMatrix< Real, dimWorld, dim > JacobianInverseTransposed;
typedef FieldMatrix< Real, dim, dimWorld > JacobianTransposed;
GeometryCache ()
: flags_( 0 )
{}
const Real &integrationElement ( const ALBERTA EL_INFO &elInfo )
{
if( (flags_ & flagIntegrationElement) == 0 )
{
integrationElement_ = std::abs( determinant( jacobianTransposed( elInfo ) ) );
assert( integrationElement_ > 1e-14 );
flags_ |= flagIntegrationElement;
}
return integrationElement_;
}
const JacobianTransposed &jacobianTransposed ( const ALBERTA EL_INFO &elInfo )
{
if( (flags_ & flagJacobianTransposed) == 0 )
{
assert( (elInfo.fill_flag & FillFlags< dim >::coords) != 0 );
const GlobalVector &x = elInfo.coord[ 0 ];
for( int i = 0; i < dim; ++i )
{
const GlobalVector &y = elInfo.coord[ i+1 ];
for( int j = 0; j < dimWorld; ++j )
jacobianTransposed_[ i ][ j ] = y[ j ] - x[ j ];
}
flags_ |= flagJacobianTransposed;
}
return jacobianTransposed_;
}
const JacobianInverseTransposed &
jacobianInverseTransposed ( const ALBERTA EL_INFO &elInfo )
{
if( (flags_ & flagJacobianInverseTransposed) == 0 )
{
integrationElement_ = std::abs( invert( jacobianTransposed( elInfo ), jacobianInverseTransposed_ ) );
assert( integrationElement_ > 1e-14 );
flags_ |= flagIntegrationElement | flagJacobianInverseTransposed;
}
return jacobianInverseTransposed_;
}
private:
unsigned int flags_;
Real integrationElement_;
FieldMatrix< Real, dim, dimWorld > jacobianTransposed_;
FieldMatrix< Real, dimWorld, dim > jacobianInverseTransposed_;
};
// GeometryCacheProxy
// ------------------
template< int dim >
struct GeometryCacheProxy
{
typedef FieldMatrix< Real, dimWorld, dim > JacobianInverseTransposed;
typedef FieldMatrix< Real, dim, dimWorld > JacobianTransposed;
GeometryCacheProxy ( GeometryCache< dim > &geometryCache, const ALBERTA EL_INFO &elInfo )
: geometryCache_( geometryCache ),
elInfo_( elInfo )
{}
const Real &integrationElement ()
{
return geometryCache_.integrationElement( elInfo_ );
}
const JacobianTransposed &jacobianTransposed ()
{
return geometryCache_.jacobianTransposed( elInfo_ );
}
const JacobianInverseTransposed &jacobianInverseTransposed ()
{
return geometryCache_.jacobianInverseTransposed( elInfo_ );
}
private:
GeometryCache< dim > &geometryCache_;
const ALBERTA EL_INFO &elInfo_;
};
} // namespace Alberta
} // namespace Dune
#endif // #if HAVE_ALBERTA
#endif // #ifndef DUNE_ALBERTA_GEOMETRYCACHE_HH
|