/usr/include/dune/geometry/genericgeometry/referenceelements.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 | // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_GEOMETRY_GENERICGEOMETRY_REFERENCEELEMENTS_HH
#define DUNE_GEOMETRY_GENERICGEOMETRY_REFERENCEELEMENTS_HH
/** \file
* \brief Implements some reference element functionality needed by the generic geometries
* \warning This is an internal header. Do not include it from outside of dune-geometry.
*/
#include <dune/common/array.hh>
#include <dune/common/fvector.hh>
#include <dune/common/typetraits.hh>
#include <dune/common/visibility.hh>
#include <dune/geometry/genericgeometry/referencedomain.hh>
namespace Dune
{
namespace GenericGeometry
{
// ReferenceElement
// ----------------
template< class Topology, class ctype >
struct ReferenceElement
{
static const unsigned int topologyId = Topology :: id;
static const unsigned int dimension = Topology :: dimension;
static const unsigned int numCorners = Topology :: numCorners;
static const unsigned int numNormals = ReferenceDomain< Topology > :: numNormals;
typedef FieldVector< ctype, dimension > CoordinateType;
template< unsigned int codim >
struct Codim
{
enum { size = Size< Topology, codim > :: value };
};
template< unsigned int codim, unsigned int subcodim >
static unsigned int subNumbering ( unsigned int i, unsigned int j )
{
return SubTopologyNumbering< Topology, codim, subcodim > :: number( i, j );
}
template< unsigned int codim, unsigned int subcodim >
static unsigned int size ( unsigned int i )
{
return SubTopologySize< Topology, codim, subcodim > :: size( i );
}
/** \brief Return the element barycenter
*/
static const FieldVector< ctype, dimension > &
baryCenter ()
{
return instance().baryCenter_;
}
static const CoordinateType &corner ( unsigned int i )
{
assert( i < numCorners );
return instance().corners_[ i ];
}
static bool checkInside ( const CoordinateType &x )
{
return ReferenceDomain< Topology >::checkInside( x );
}
static const CoordinateType &
integrationOuterNormal ( unsigned int i )
{
assert( i < numNormals );
return instance().normals_[ i ];
}
static ctype volume ()
{
return ReferenceDomain< Topology > :: template volume< ctype >();
}
DUNE_EXPORT static const ReferenceElement &instance ()
{
static ReferenceElement inst;
return inst;
}
private:
class BaryCenterArray;
ReferenceElement ()
{
for( unsigned int i = 0; i < numCorners; ++i )
ReferenceDomain< Topology > :: corner( i, corners_[ i ] );
for( unsigned int i = 0; i < numNormals; ++i )
ReferenceDomain< Topology > :: integrationOuterNormal( i, normals_[ i ] );
// Compute the element barycenter
typedef SubTopologyNumbering< Topology, 0, dimension > Numbering;
typedef SubTopologySize< Topology, 0, dimension > Size;
baryCenter_ = 0;
const unsigned int numCorners = Size :: size( 0 );
for( unsigned int k = 0; k < numCorners; ++k )
{
unsigned int j = Numbering :: number( 0, k );
CoordinateType y;
ReferenceDomain< Topology > :: corner( j, y );
baryCenter_ += y;
}
baryCenter_ *= ctype( 1 ) / ctype( numCorners );
}
Dune::array< CoordinateType, numCorners > corners_;
CoordinateType baryCenter_;
Dune::array< CoordinateType, numNormals > normals_;
};
}
}
#endif // DUNE_GEOMETRY_GENERICGEOMETRY_REFERENCEELEMENTS_HH
|