Go to the documentation of this file. 1 #pragma once // Ensure that file is included only once in a single compilation.
11 template <
unsigned int dimT>
17 static constexpr
unsigned int n_faces() {
return 2 * dimT; }
21 static constexpr
unsigned int n_vertices() {
return 1 << dimT; }
25 static constexpr
unsigned int pow(
unsigned int base)
27 unsigned int result = 1;
28 if constexpr (dimT > 0)
29 for (
unsigned int i = 0; i < dimT; ++i)
42 const unsigned int range)
44 std::array<
unsigned int, std::max(dimT, 1U)> decomposition;
45 for (
unsigned int dim = 0; dim < decomposition.size(); ++dim)
47 decomposition[dim] =
index % range;
50 hy_assert(
index == 0,
"Index initially exceeded given maximum value range^dimT.");
60 template <
typename po
int_t,
typename array_t>
62 const array_t& points)
64 static_assert(point_t::size() == dimT,
"Point must have appropriate dimension!");
66 if constexpr (dimT > 0)
69 for (
unsigned int dim = 0; dim < dimT; ++dim)
70 point[dim] = points[decomp[dim]];
index
Definition: check_push_test.py:10
static std::array< unsigned int, std::max(dimT, 1U)> index_decompose(unsigned int index, const unsigned int range)
Decompose global index of tensorial structure with respect to its dimensions.
Definition: hypercube.hxx:40
static constexpr unsigned int n_vertices()
Number of vertices of the hypercube.
Definition: hypercube.hxx:21
static constexpr point_t tensorial_pt(__attribute__((unused)) const unsigned int index, const array_t &points)
Generate tensorial point whose entries are elements of an array.
Definition: hypercube.hxx:61
static constexpr unsigned int pow(unsigned int base)
Return n to the power dim.
Definition: hypercube.hxx:25
#define hy_assert(Expr, Msg)
The assertion to be used within HyperHDG — deactivate using -DNDEBUG compile flag.
Definition: hy_assert.hxx:38
static constexpr unsigned int n_faces()
Number of faces of the hypercube.
Definition: hypercube.hxx:17
Helper class containing numbers and functions related to hypercubes.
Definition: hypercube.hxx:12