/usr/include/dune/geometry/genericgeometry/mapping.hh is in libdune-geometry-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 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_GEOMETRY_GENERICGEOMETRY_MAPPING_HH
#define DUNE_GEOMETRY_GENERICGEOMETRY_MAPPING_HH
#include <dune/geometry/genericgeometry/topologytypes.hh>
#include <dune/geometry/genericgeometry/referenceelements.hh>
#include <dune/geometry/genericgeometry/matrixhelper.hh>
#include <dune/geometry/genericgeometry/geometrytraits.hh>
namespace Dune
{
namespace GenericGeometry
{
// Mapping
// -------
/** \class Mapping
* \ingroup GenericGeometry
* \brief interface for a mapping
*
* \tparam CoordTraits coordinate traits
* \tparam Topology topology of the reference domain
* \tparam dimW dimension of the world
* \tparam Impl implementation of the mapping
*/
template< class CoordTraits, class Topo, int dimW, class Impl >
class Mapping
{
typedef Mapping< CoordTraits, Topo, dimW, Impl > This;
typedef Impl Implementation;
public:
typedef Topo Topology;
typedef MappingTraits< CoordTraits, Topology :: dimension, dimW > Traits;
static const unsigned int dimension = Traits :: dimension;
static const unsigned int dimWorld = Traits :: dimWorld;
typedef typename Traits :: FieldType FieldType;
typedef typename Traits :: LocalCoordinate LocalCoordinate;
typedef typename Traits :: GlobalCoordinate GlobalCoordinate;
typedef typename Traits :: JacobianType JacobianType;
typedef typename Traits :: JacobianTransposedType JacobianTransposedType;
typedef typename Traits :: MatrixHelper MatrixHelper;
typedef GenericGeometry :: ReferenceElement< Topology, FieldType > ReferenceElement;
template< unsigned int codim, unsigned int i >
struct SubTopology
{
typedef typename GenericGeometry :: SubTopology< Topo, codim, i > :: type Topology;
typedef typename Implementation :: template SubTopology< codim, i > :: Trace TraceImpl;
typedef Mapping< CoordTraits, Topology, dimWorld, TraceImpl > Trace;
};
static const bool alwaysAffine = Implementation :: alwaysAffine;
protected:
Implementation impl_;
public:
template< class CoordVector >
explicit Mapping ( const CoordVector &coords )
: impl_( coords )
{}
Mapping ( const Implementation &implementation )
: impl_( implementation )
{}
const GlobalCoordinate &corner ( int i ) const
{
return implementation().corner( i );
}
void global ( const LocalCoordinate &x, GlobalCoordinate &y ) const
{
implementation().global( x, y );
}
void local ( const GlobalCoordinate &y, LocalCoordinate &x ) const
{
const FieldType epsilon = CoordTraits::epsilon();
x = ReferenceElement::baryCenter();
LocalCoordinate dx;
do
{
// DF^n dx^n = F^n, x^{n+1} -= dx^n
JacobianTransposedType JT;
jacobianTransposed( x, JT );
GlobalCoordinate z;
global( x, z );
z -= y;
MatrixHelper::template xTRightInvA< dimension, dimWorld >( JT, z, dx );
x -= dx;
} while( dx.two_norm2() > epsilon*epsilon );
}
bool jacobianTransposed ( const LocalCoordinate &x,
JacobianTransposedType &JT ) const
{
return implementation().jacobianTransposed( x, JT );
}
FieldType
jacobianInverseTransposed ( const LocalCoordinate &x, JacobianType &JTInv ) const
{
JacobianTransposedType JT;
jacobianTransposed( x, JT );
return MatrixHelper :: template rightInvA< dimension, dimWorld >( JT, JTInv );
}
FieldType integrationElement ( const LocalCoordinate &x ) const
{
JacobianTransposedType JT;
jacobianTransposed( x, JT );
return MatrixHelper :: template sqrtDetAAT< dimension, dimWorld >( JT );
}
const Implementation &implementation () const
{
return impl_;
}
template< unsigned int codim, unsigned int i >
typename SubTopology< codim, i > :: Trace trace () const
{
return impl_.template trace< codim, i >();
}
};
}
}
#endif // #ifndef DUNE_GEOMETRY_GENERICGEOMETRY_MAPPING_HH
|