4#ifndef DUNE_GEOMETRY_GENERICGEOMETRY_REFERENCEELEMENTS_HH
5#define DUNE_GEOMETRY_GENERICGEOMETRY_REFERENCEELEMENTS_HH
16#include <dune/geometry/genericgeometry/referencedomain.hh>
21 namespace GenericGeometry
27 template<
class Topology,
class ctype >
28 struct ReferenceElement
30 static const unsigned int topologyId = Topology :: id;
31 static const unsigned int dimension = Topology :: dimension;
33 static const unsigned int numCorners = Topology :: numCorners;
34 static const unsigned int numNormals = ReferenceDomain< Topology > :: numNormals;
38 template<
unsigned int codim >
41 enum { size = Size< Topology, codim > :: value };
44 template<
unsigned int codim,
unsigned int subcodim >
45 static unsigned int subNumbering (
unsigned int i,
unsigned int j )
47 return SubTopologyNumbering< Topology, codim, subcodim > :: number( i, j );
50 template<
unsigned int codim,
unsigned int subcodim >
51 static unsigned int size (
unsigned int i )
53 return SubTopologySize< Topology, codim, subcodim > :: size( i );
61 return instance().baryCenter_;
64 static const CoordinateType &corner (
unsigned int i )
66 assert( i < numCorners );
67 return instance().corners_[ i ];
70 static bool checkInside (
const CoordinateType &x )
72 return ReferenceDomain< Topology >::checkInside( x );
75 static const CoordinateType &
76 integrationOuterNormal (
unsigned int i )
78 assert( i < numNormals );
79 return instance().normals_[ i ];
82 static ctype volume ()
84 return ReferenceDomain< Topology > :: template volume< ctype >();
87 DUNE_EXPORT static const ReferenceElement &instance ()
89 static ReferenceElement inst;
94 class BaryCenterArray;
98 for(
unsigned int i = 0; i < numCorners; ++i )
99 ReferenceDomain< Topology > :: corner( i, corners_[ i ] );
100 for(
unsigned int i = 0; i < numNormals; ++i )
101 ReferenceDomain< Topology > :: integrationOuterNormal( i, normals_[ i ] );
104 typedef SubTopologyNumbering< Topology, 0, dimension > Numbering;
105 typedef SubTopologySize< Topology, 0, dimension > Size;
108 const unsigned int numCorners = Size :: size( 0 );
109 for(
unsigned int k = 0; k < numCorners; ++k )
111 unsigned int j = Numbering :: number( 0, k );
114 ReferenceDomain< Topology > :: corner( j, y );
117 baryCenter_ *= ctype( 1 ) / ctype( numCorners );
120 Dune::array< CoordinateType, numCorners > corners_;
121 CoordinateType baryCenter_;
122 Dune::array< CoordinateType, numNormals > normals_;
Fallback implementation of the std::array class (a static array)
Implements a vector constructed from a given type representing a field and a compile-time given size.
Dune namespace.
Definition: alignment.hh:10
Traits for type conversions and type information.
Definition of macros controlling symbol visibility at the ABI level.
#define DUNE_EXPORT
Export a symbol as part of the public ABI.
Definition: visibility.hh:18