3 #ifndef DUNE_GEOMETRY_GENERICGEOMETRY_TOPOLOGYTYPES_HH
4 #define DUNE_GEOMETRY_GENERICGEOMETRY_TOPOLOGYTYPES_HH
9 #include <dune/common/typetraits.hh>
10 #include <dune/common/unused.hh>
15 namespace GenericGeometry
30 static const unsigned int id = 0;
32 static std :: string
name ()
39 template<
class BaseTopology >
42 static const unsigned int dimension = BaseTopology :: dimension + 1;
43 static const unsigned int numCorners = 2 * BaseTopology :: numCorners;
45 static const unsigned int id = BaseTopology::id | ((
unsigned int)
prismConstruction << (dimension-1));
47 static std :: string
name ()
49 return BaseTopology :: name() +
"l";
55 template<
class BaseTopology >
58 static const unsigned int dimension = BaseTopology :: dimension + 1;
59 static const unsigned int numCorners = BaseTopology :: numCorners + 1;
61 static const unsigned int id = BaseTopology::id | ((
unsigned int)
pyramidConstruction << (dimension-1));
63 static std :: string
name ()
65 return BaseTopology :: name() +
"o";
72 template<
class Topology >
75 template<
class Base >
81 template<
class Base >
89 template<
class Topology >
92 static const bool value = ((Topology::id >> 1) == 0);
95 template<
class Topology >
98 static const bool value = ((Topology::id | 1) == (1 << Topology::dimension) - 1);
101 template<
class Topology >
104 static const bool value
108 template<
class Topology >
111 static const bool value =
false;
114 template<
class BaseTopology >
117 static const bool value
150 inline bool isPyramid (
unsigned int topologyId,
int dim,
int codim = 0 )
153 assert( (0 <= codim) && (codim < dim) );
154 return (((topologyId & ~1) & (1u << (dim-codim-1))) == 0);
168 inline bool isPrism (
unsigned int topologyId,
int dim,
int codim = 0 )
171 assert( (0 <= codim) && (codim < dim) );
172 return (( (topologyId | 1) & (1u << (dim-codim-1))) != 0);
190 assert( (0 <= codim) && (codim <= dim) );
191 return (codim >= (dim-1)) || (((topologyId >> (dim-codim-1)) & 1) == (
unsigned int)construction);
201 inline unsigned int baseTopologyId (
unsigned int topologyId,
int dim,
int codim = 1 )
204 assert( (0 <= codim) && (codim <= dim) );
205 return topologyId & ((1u << (dim-codim)) - 1);
213 template<
unsigned int dim >
230 template<
unsigned int dim >
247 template<
unsigned int dim >
258 template<
unsigned int dim >
269 template<
unsigned int id,
unsigned int dim >
272 static const unsigned int dimension = dim;
274 static_assert((
id < (1 << dimension)),
"id too large.");
276 static const bool isPrism = ((
id >> (dimension-1)) != 0);
278 typedef typename Topology< (
id & ~(1 << (dimension-1))), dimension-1 >::
type
294 typedef typename conditional< isPrism, Prism<true>, Pyramid<false> >::type::type
type;
297 template<
unsigned int id >
300 static const unsigned int dimension = 0;
302 static_assert((
id < (1 << dimension)),
"id too large.");
313 template<
template<
class >
class Operation,
int dim,
class Topology =
Point >
320 static void apply (
const unsigned int topologyId )
329 static void apply (
const unsigned int topologyId, T1 &p1 )
337 template<
class T1,
class T2 >
338 static void apply (
const unsigned int topologyId, T1 &p1, T2 &p2 )
346 template<
class T1,
class T2,
class T3 >
347 static void apply (
const unsigned int topologyId, T1 &p1, T2 &p2, T3 &p3 )
355 template<
class T1,
class T2,
class T3,
class T4 >
356 static void apply (
const unsigned int topologyId, T1 &p1, T2 &p2, T3 &p3, T4 &p4 )
365 template<
template<
class >
class Operation,
class Topology >
369 static void apply (
const unsigned int topologyId )
371 DUNE_UNUSED_PARAMETER(topologyId);
372 Operation< Topology >::apply();
376 static void apply (
const unsigned int topologyId, T1 &p1 )
378 DUNE_UNUSED_PARAMETER(topologyId);
379 Operation< Topology >::apply( p1 );
382 template<
class T1,
class T2 >
383 static void apply (
const unsigned int topologyId, T1 &p1, T2 &p2 )
385 DUNE_UNUSED_PARAMETER(topologyId);
386 Operation< Topology >::apply( p1, p2 );
389 template<
class T1,
class T2,
class T3 >
390 static void apply (
const unsigned int topologyId, T1 &p1, T2 &p2, T3 &p3 )
392 DUNE_UNUSED_PARAMETER(topologyId);
393 Operation< Topology >::apply( p1, p2, p3 );
396 template<
class T1,
class T2,
class T3,
class T4 >
397 static void apply (
const unsigned int topologyId, T1 &p1, T2 &p2, T3 &p3, T4 &p4 )
399 DUNE_UNUSED_PARAMETER(topologyId);
400 Operation< Topology >::apply( p1, p2, p3, p4 );
408 #endif // DUNE_GEOMETRY_GENERICGEOMETRY_TOPOLOGYTYPES_HH
Definition: topologytypes.hh:314
Definition: topologytypes.hh:214
Definition: topologytypes.hh:40
Definition: affinegeometry.hh:18
static const unsigned int numCorners
Definition: topologytypes.hh:28
TopologyConstruction
Definition: topologytypes.hh:18
static void apply(const unsigned int topologyId)
Definition: topologytypes.hh:320
static void apply(const unsigned int topologyId, T1 &p1, T2 &p2)
Definition: topologytypes.hh:338
static void apply(const unsigned int topologyId, T1 &p1)
Definition: topologytypes.hh:376
Definition: topologytypes.hh:18
static void apply(const unsigned int topologyId, T1 &p1, T2 &p2)
Definition: topologytypes.hh:383
unsigned int baseTopologyId(unsigned int topologyId, int dim, int codim=1)
obtain the base topology of a given codimension
Definition: topologytypes.hh:201
Pyramid< typename CubeTopology< dim-1 >::type > type
Definition: topologytypes.hh:250
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:150
static const unsigned int dimension
Definition: topologytypes.hh:42
Definition: topologytypes.hh:96
static void apply(const unsigned int topologyId, T1 &p1, T2 &p2, T3 &p3)
Definition: topologytypes.hh:390
Definition: topologytypes.hh:56
Base type
Definition: topologytypes.hh:78
Point type
Definition: topologytypes.hh:302
Definition: topologytypes.hh:231
Definition: topologytypes.hh:25
static const unsigned int numCorners
Definition: topologytypes.hh:43
conditional< isPrism, Prism< true >, Pyramid< false > >::type::type type
Definition: topologytypes.hh:294
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:187
Definition: topologytypes.hh:248
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:168
Base type
Definition: topologytypes.hh:84
static const unsigned int dimension
Definition: topologytypes.hh:27
Definition: topologytypes.hh:18
static std::string name()
Definition: topologytypes.hh:32
Definition: topologytypes.hh:270
Prism< typename SimplexTopology< dim-1 >::type > type
Definition: topologytypes.hh:261
Definition: topologytypes.hh:259
static void apply(const unsigned int topologyId, T1 &p1, T2 &p2, T3 &p3)
Definition: topologytypes.hh:347
unsigned int numTopologies(int dim)
obtain the number of topologies of a given dimension
Definition: topologytypes.hh:134
Definition: topologytypes.hh:90
Definition: topologytypes.hh:73
static const bool value
Definition: topologytypes.hh:98
static std::string name()
Definition: topologytypes.hh:47
static void apply(const unsigned int topologyId)
Definition: topologytypes.hh:369
static const bool value
Definition: topologytypes.hh:92
static void apply(const unsigned int topologyId, T1 &p1)
Definition: topologytypes.hh:329
Point type
Definition: topologytypes.hh:222
static void apply(const unsigned int topologyId, T1 &p1, T2 &p2, T3 &p3, T4 &p4)
Definition: topologytypes.hh:356
Prism< typename CubeTopology< dim-1 >::type > type
Definition: topologytypes.hh:233
Pyramid< typename SimplexTopology< dim-1 >::type > type
Definition: topologytypes.hh:216
Point type
Definition: topologytypes.hh:239
static std::string name()
Definition: topologytypes.hh:63
static void apply(const unsigned int topologyId, T1 &p1, T2 &p2, T3 &p3, T4 &p4)
Definition: topologytypes.hh:397
Definition: topologytypes.hh:102
Definition: topologytypes.hh:109