3#ifndef DUNE_GEOMETRY_GENERICGEOMETRY_TRACEPROVIDER_HH
4#define DUNE_GEOMETRY_GENERICGEOMETRY_TRACEPROVIDER_HH
11#include "subtopologies.hh"
16 namespace GenericGeometry
22 template<
class Topology,
class GeometryTraits >
23 class NonHybridMapping;
25 template<
unsigned int dim,
class GeometryTraits >
28 template<
class Topology,
class GeometryTraits >
36 template<
class Topology,
class GeometryTraits,
unsigned int codim,
bool forceHybr
id >
39 typedef TraceProvider< Topology, GeometryTraits, codim, forceHybrid > This;
41 typedef typename GeometryTraits::template Mapping< Topology >::type MappingImpl;
44 static const unsigned int dimension = Topology::dimension;
45 static const unsigned int codimension = codim;
46 static const unsigned int mydimension = dimension - codimension;
48 static const bool hybrid = (forceHybrid || ((mydimension != dimension) && IsHybrid< Topology >::value));
50 typedef GenericGeometry::Mapping< typename GeometryTraits::CoordTraits, Topology, GeometryTraits::dimWorld, MappingImpl > Mapping;
53 static const unsigned int numSubTopologies = Mapping::ReferenceElement::template Codim< codimension >::size;
55 template<
bool >
class HybridFactory;
56 template<
bool >
class NonHybridFactory;
58 typedef typename conditional< hybrid, HybridFactory< true >, NonHybridFactory< false > >::type Factory;
60 template<
int i >
struct Builder;
63 typedef typename Factory::Trace Trace;
65 static Trace *construct (
const Mapping &mapping,
unsigned int i,
char *traceStorage )
67 return (*instance().construct_[ i ])( mapping, traceStorage );
71 typedef Trace *(*Construct)(
const Mapping &mapping,
char *traceStorage );
75 ForLoop< Builder, 0, numSubTopologies-1 >::apply( construct_ );
80 static This theInstance;
84 Construct construct_[ numSubTopologies ];
92 template<
class Topology,
class GeometryTraits,
unsigned int codim,
bool forceHybr
id >
94 class TraceProvider< Topology, GeometryTraits, codim, forceHybrid >::HybridFactory
96 template<
unsigned int i >
99 typedef typename GenericGeometry::SubTopology< Topology, codim, i >::type SubTopology;
100 typedef VirtualMapping< SubTopology, GeometryTraits > type;
104 typedef HybridMapping< mydimension, GeometryTraits > Trace;
107 static Trace *construct (
const Mapping &mapping,
char *traceStorage )
109 typedef typename VirtualTrace< i >::type TraceImpl;
110 return new( traceStorage ) TraceImpl( mapping.template trace< codim, i >() );
119 template<
class Topology,
class GeometryTraits,
unsigned int codim,
bool forceHybr
id >
121 class TraceProvider< Topology, GeometryTraits, codim, forceHybrid >::NonHybridFactory
123 typedef typename GenericGeometry::SubTopology< Topology, codim, 0 >::type SubTopology;
126 typedef NonHybridMapping< SubTopology, GeometryTraits > Trace;
129 static Trace *construct (
const Mapping &mapping,
char *traceStorage )
131 return new( traceStorage ) Trace( mapping.template trace< codim, i >() );
140 template<
class Topology,
class GeometryTraits,
unsigned int codim,
bool forceHybr
id >
142 struct TraceProvider< Topology, GeometryTraits, codim, forceHybrid >::Builder
144 static void apply ( Construct (&construct)[ numSubTopologies ] )
146 construct[ i ] = &(Factory::template construct< i >);
A static for loop for template meta-programming.
Dune namespace.
Definition: alignment.hh:14
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