3 #ifndef DUNE_GEOMETRY_GENERICGEOMETRY_TOPOLOGYTYPES_HH
4 #define DUNE_GEOMETRY_GENERICGEOMETRY_TOPOLOGYTYPES_HH
9 #include <dune/common/static_assert.hh>
10 #include <dune/common/typetraits.hh>
11 #include <dune/common/unused.hh>
16 namespace GenericGeometry
31 static const unsigned int id = 0;
33 static std :: string
name ()
40 template<
class BaseTopology >
43 static const unsigned int dimension = BaseTopology :: dimension + 1;
44 static const unsigned int numCorners = 2 * BaseTopology :: numCorners;
48 static std :: string
name ()
50 return BaseTopology :: name() +
"l";
56 template<
class BaseTopology >
59 static const unsigned int dimension = BaseTopology :: dimension + 1;
60 static const unsigned int numCorners = BaseTopology :: numCorners + 1;
64 static std :: string
name ()
66 return BaseTopology :: name() +
"o";
73 template<
class Topology >
76 template<
class Base >
82 template<
class Base >
90 template<
class Topology >
93 static const bool value = ((Topology::id >> 1) == 0);
96 template<
class Topology >
99 static const bool value = ((Topology::id | 1) == (1 << Topology::dimension) - 1);
102 template<
class Topology >
105 static const bool value
109 template<
class Topology >
115 template<
class BaseTopology >
118 static const bool value
151 inline bool isPyramid (
unsigned int topologyId,
int dim,
int codim = 0 )
154 assert( (0 <= codim) && (codim < dim) );
155 return (((topologyId & ~1) & (1u << (dim-codim-1))) == 0);
169 inline bool isPrism (
unsigned int topologyId,
int dim,
int codim = 0 )
172 assert( (0 <= codim) && (codim < dim) );
173 return (( (topologyId | 1) & (1u << (dim-codim-1))) != 0);
191 assert( (0 <= codim) && (codim <= dim) );
192 return (codim >= (dim-1)) || (((topologyId >> (dim-codim-1)) & 1) == (
unsigned int)construction);
202 inline unsigned int baseTopologyId (
unsigned int topologyId,
int dim,
int codim = 1 )
205 assert( (0 <= codim) && (codim <= dim) );
206 return topologyId & ((1u << (dim-codim)) - 1);
214 template<
unsigned int dim >
231 template<
unsigned int dim >
248 template<
unsigned int dim >
259 template<
unsigned int dim >
270 template<
unsigned int id,
unsigned int dim >
273 static const unsigned int dimension = dim;
275 dune_static_assert( (
id < (1 << dimension)),
"id too large." );
277 static const bool isPrism = ((
id >> (dimension-1)) != 0);
279 typedef typename Topology< (
id & ~(1 << (dimension-1))), dimension-1 >::
type
295 typedef typename conditional< isPrism, Prism<true>, Pyramid<false> >::type::type
type;
298 template<
unsigned int id >
301 static const unsigned int dimension = 0;
303 dune_static_assert( (
id < (1 << dimension)),
"id too large." );
314 template<
template<
class >
class Operation,
int dim,
class Topology =
Point >
321 static void apply (
const unsigned int topologyId )
330 static void apply (
const unsigned int topologyId, T1 &p1 )
338 template<
class T1,
class T2 >
339 static void apply (
const unsigned int topologyId, T1 &p1, T2 &p2 )
347 template<
class T1,
class T2,
class T3 >
348 static void apply (
const unsigned int topologyId, T1 &p1, T2 &p2, T3 &p3 )
356 template<
class T1,
class T2,
class T3,
class T4 >
357 static void apply (
const unsigned int topologyId, T1 &p1, T2 &p2, T3 &p3, T4 &p4 )
366 template<
template<
class >
class Operation,
class Topology >
370 static void apply (
const unsigned int topologyId )
372 DUNE_UNUSED_PARAMETER(topologyId);
373 Operation< Topology >::apply();
377 static void apply (
const unsigned int topologyId, T1 &p1 )
379 DUNE_UNUSED_PARAMETER(topologyId);
380 Operation< Topology >::apply( p1 );
383 template<
class T1,
class T2 >
384 static void apply (
const unsigned int topologyId, T1 &p1, T2 &p2 )
386 DUNE_UNUSED_PARAMETER(topologyId);
387 Operation< Topology >::apply( p1, p2 );
390 template<
class T1,
class T2,
class T3 >
391 static void apply (
const unsigned int topologyId, T1 &p1, T2 &p2, T3 &p3 )
393 DUNE_UNUSED_PARAMETER(topologyId);
394 Operation< Topology >::apply( p1, p2, p3 );
397 template<
class T1,
class T2,
class T3,
class T4 >
398 static void apply (
const unsigned int topologyId, T1 &p1, T2 &p2, T3 &p3, T4 &p4 )
400 DUNE_UNUSED_PARAMETER(topologyId);
401 Operation< Topology >::apply( p1, p2, p3, p4 );
409 #endif // DUNE_GEOMETRY_GENERICGEOMETRY_TOPOLOGYTYPES_HH
static std::string name()
Definition: topologytypes.hh:48
static void apply(const unsigned int topologyId, T1 &p1)
Definition: topologytypes.hh:330
Definition: topologytypes.hh:57
Definition: topologytypes.hh:91
bool isPrism(unsigned int topologyId, int dim, int codim=0)
check whether a prism construction was used to create a given codimension
Definition: topologytypes.hh:169
Pyramid< typename SimplexTopology< dim-1 >::type > type
Definition: topologytypes.hh:217
Point type
Definition: topologytypes.hh:240
static const bool value
Definition: topologytypes.hh:106
static const bool value
Definition: topologytypes.hh:112
conditional< isPrism, Prism< true >, Pyramid< false > >::type::type type
Definition: topologytypes.hh:295
Definition: topologytypes.hh:315
unsigned int numTopologies(int dim)
obtain the number of topologies of a given dimension
Definition: topologytypes.hh:135
Definition: topologytypes.hh:215
Definition: topologytypes.hh:249
Definition: topologytypes.hh:260
Definition: topologytypes.hh:97
static const bool value
Definition: topologytypes.hh:93
Base type
Definition: topologytypes.hh:79
static void apply(const unsigned int topologyId)
Definition: topologytypes.hh:321
static void apply(const unsigned int topologyId, T1 &p1, T2 &p2, T3 &p3, T4 &p4)
Definition: topologytypes.hh:398
bool isPyramid(unsigned int topologyId, int dim, int codim=0)
check whether a pyramid construction was used to create a given codimension
Definition: topologytypes.hh:151
static const unsigned int numCorners
Definition: topologytypes.hh:44
static void apply(const unsigned int topologyId, T1 &p1, T2 &p2, T3 &p3)
Definition: topologytypes.hh:391
static void apply(const unsigned int topologyId)
Definition: topologytypes.hh:370
static void apply(const unsigned int topologyId, T1 &p1, T2 &p2, T3 &p3)
Definition: topologytypes.hh:348
unsigned int baseTopologyId(unsigned int topologyId, int dim, int codim=1)
obtain the base topology of a given codimension
Definition: topologytypes.hh:202
Prism< typename SimplexTopology< dim-1 >::type > type
Definition: topologytypes.hh:262
Definition: topologytypes.hh:110
Definition: topologytypes.hh:41
Base type
Definition: topologytypes.hh:85
static const bool value
Definition: topologytypes.hh:99
static void apply(const unsigned int topologyId, T1 &p1, T2 &p2)
Definition: topologytypes.hh:339
static void apply(const unsigned int topologyId, T1 &p1, T2 &p2)
Definition: topologytypes.hh:384
Definition: topologytypes.hh:232
static const unsigned int numCorners
Definition: topologytypes.hh:29
static const unsigned int numCorners
Definition: topologytypes.hh:60
TopologyConstruction
Definition: topologytypes.hh:19
Definition: topologytypes.hh:19
static void apply(const unsigned int topologyId, T1 &p1, T2 &p2, T3 &p3, T4 &p4)
Definition: topologytypes.hh:357
static std::string name()
Definition: topologytypes.hh:33
static std::string name()
Definition: topologytypes.hh:64
Definition: topologytypes.hh:74
Definition: topologytypes.hh:26
Point type
Definition: topologytypes.hh:223
static void apply(const unsigned int topologyId, T1 &p1)
Definition: topologytypes.hh:377
static const unsigned int dimension
Definition: topologytypes.hh:28
static const unsigned int dimension
Definition: topologytypes.hh:43
bool isTopology(TopologyConstruction construction, unsigned int topologyId, int dim, int codim=0)
check whether a specific topology construction was used to create a given codimension ...
Definition: topologytypes.hh:188
Definition: topologytypes.hh:103
Point type
Definition: topologytypes.hh:306
Prism< typename CubeTopology< dim-1 >::type > type
Definition: topologytypes.hh:234
Definition: topologytypes.hh:271
Pyramid< typename CubeTopology< dim-1 >::type > type
Definition: topologytypes.hh:251
Definition: topologytypes.hh:19
static const unsigned int dimension
Definition: topologytypes.hh:59