dune-pdelab 2.10-git
Loading...
Searching...
No Matches
topologyutility.hh
Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3#ifndef DUNE_PDELAB_COMMON_TOPOLOGYUTILITY_HH
4#define DUNE_PDELAB_COMMON_TOPOLOGYUTILITY_HH
5
7
8namespace Dune {
9
10 namespace PDELab {
11
12
14
24 template<int dimension, unsigned int topologyId>
26 {
27 static const bool isCube =
28 ((topologyId ^ ((1 << dimension)-1)) >> 1 == 0);
29
30 static const bool isSimplex =
31 (topologyId | 1) == 1;
32
36 : (
39 );
40 };
41
42
49
50 unsigned int topologyId(0);
51
52 if (dim > 1){
53 switch( basicType )
54 {
56 topologyId = 0;
57 break;
59 topologyId = ((1 << dim) - 1);
60 break;
62 if (dim == 3)
63 topologyId = 0b0011;
64 else
66 "Invalid basic geometry type: no pyramids for dimension " << dim << "." );
67 break;
69 if (dim == 3)
70 topologyId = 0b0101;
71 else
73 "Invalid basic geometry type: no prisms for dimension " << dim << "." );
74 break;
76 break;
77 default :
79 "Invalid basic geometry type: " << basicType << " for dimension " << dim << "." );
80 }
81 }
82
83 return Dune::GeometryType(topologyId, dim);
84 }
85
86 } // namespace PDELab
87} // namespace Dune
88
89
90#endif // DUNE_PDELAB_COMMON_TOPOLOGYUTILITY_HH
static const int dim
Definition adaptivity.hh:84
#define DUNE_THROW(E,...)
Dune::GeometryType geometryTypeFromBasicType(Dune::GeometryType::BasicType basicType, int dim)
Definition topologyutility.hh:48
For backward compatibility – Do not use this!
Utility TMP for determining the BasicType of a geometry from its dimension and topology id.
Definition topologyutility.hh:26
static const bool isSimplex
Definition topologyutility.hh:30
static const GeometryType::BasicType value
The BasicType of Topology.
Definition topologyutility.hh:34
static const bool isCube
Definition topologyutility.hh:27