3 #ifndef DUNE_GEOMETRY_GENERICGEOMETRY_TRACEPROVIDER_HH
4 #define DUNE_GEOMETRY_GENERICGEOMETRY_TRACEPROVIDER_HH
6 #include <dune/common/forloop.hh>
7 #include <dune/common/typetraits.hh>
8 #include <dune/common/visibility.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 >
44 static const unsigned int dimension = Topology::dimension;
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;
67 return (*instance().construct_[ i ])( mapping, traceStorage );
71 typedef Trace *(*Construct)(
const Mapping &mapping,
char *traceStorage );
75 ForLoop< Builder, 0, numSubTopologies-1 >::apply( construct_ );
78 DUNE_EXPORT
static const This &instance ()
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;
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;
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 >);
154 #endif // #ifndef DUNE_GEOMETRY_GENERICGEOMETRY_TRACEPROVIDER_HH
GenericGeometry::Mapping< typename GeometryTraits::CoordTraits, Topology, GeometryTraits::dimWorld, MappingImpl > Mapping
Definition: traceprovider.hh:50
static const unsigned int dimension
Definition: traceprovider.hh:44
Definition: traceprovider.hh:37
Factory::Trace Trace
Definition: traceprovider.hh:60
static const unsigned int mydimension
Definition: traceprovider.hh:46
unsigned int size(unsigned int topologyId, int dim, int codim)
Compute the number of subentities of a given codimension.
Definition: subtopologies.cc:16
static Trace * construct(const Mapping &mapping, unsigned int i, char *traceStorage)
Definition: traceprovider.hh:65
static const bool hybrid
Definition: traceprovider.hh:48
static const unsigned int codimension
Definition: traceprovider.hh:45
Definition: topologytypes.hh:103