/usr/include/dune/geometry/genericgeometry/referenceelements.hh is in libdune-geometry-dev 2.2.1-2ubuntu2.
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 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | // -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=8 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/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 );
}
template< unsigned int codim >
static const FieldVector< ctype, dimension > &
baryCenter ( unsigned int i )
{
integral_constant< int, codim > codimVariable;
return instance().baryCenters_[ codimVariable ][ i ];
}
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 >();
}
static const ReferenceElement &instance ()
{
static ReferenceElement inst;
return inst;
}
private:
template< int codim >
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 ] );
}
Dune::array< CoordinateType, numCorners > corners_;
CodimTable< BaryCenterArray, dimension > baryCenters_;
Dune::array< CoordinateType, numNormals > normals_;
};
template< class Topology, class ctype >
template< int codim >
class ReferenceElement< Topology, ctype > :: BaryCenterArray
{
enum { Size = GenericGeometry :: Size< Topology, codim > :: value };
typedef FieldVector< ctype, dimension > CoordinateType;
template< int i >
struct Builder;
CoordinateType baryCenters_[ Size ];
public:
BaryCenterArray ()
{
ForLoop< Builder, 0, Size-1 > :: apply( baryCenters_ );
}
const CoordinateType &operator[] ( unsigned int i ) const
{
assert( i < Size );
return baryCenters_[ i ];
}
static unsigned int size ()
{
return Size;
}
};
template< class Topology, class ctype >
template< int codim >
template< int i >
struct ReferenceElement< Topology, ctype > :: BaryCenterArray< codim > :: Builder
{
static void apply ( CoordinateType (&baryCenters)[ Size ] )
{
typedef SubTopologyNumbering< Topology, codim, dimension - codim > Numbering;
typedef SubTopologySize< Topology, codim, dimension - codim > Size;
CoordinateType &x = baryCenters[ i ];
x = 0;
const unsigned int numCorners = Size :: size( i );
for( unsigned int k = 0; k < numCorners; ++k )
{
unsigned int j = Numbering :: number( i, k );
CoordinateType y;
ReferenceDomain< Topology > :: corner( j, y );
x += y;
}
x *= ctype( 1 ) / ctype( numCorners );
}
};
}
}
#endif // DUNE_GEOMETRY_GENERICGEOMETRY_REFERENCEELEMENTS_HH
|