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;
48 static std :: string
name ()
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 ()
73 template<
class Topology >
76 template<
class Base >
77 struct BaseTopology<
Prism< 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);
377 static void apply (
const unsigned int topologyId, T1 &p1 )
379 DUNE_UNUSED_PARAMETER(topologyId);
383 template<
class T1,
class T2 >
384 static void apply (
const unsigned int topologyId, T1 &p1, T2 &p2 )
386 DUNE_UNUSED_PARAMETER(topologyId);
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);
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);
409 #endif // DUNE_GEOMETRY_GENERICGEOMETRY_TOPOLOGYTYPES_HH