Go to the documentation of this file. 1 #ifndef TPCC_LEXICOGRAPHIC_H
2 #define TPCC_LEXICOGRAPHIC_H
42 template <
int n,
int k,
boundaries bnd =
both,
typename Bint =
unsigned int,
43 typename Sint =
unsigned short,
typename Tint =
unsigned char>
59 static constexpr Tint
order() {
return n; }
81 for (Tint i = 0; i <
binomial(n, k); ++i)
84 auto combination = combinations[i];
85 for (Tint j = 0; j < k; ++j)
87 for (Tint j = 0; j < n - k; ++j)
91 p *=
dimensions[n - 1 - combination.out(j)] + 1;
94 p *=
dimensions[n - 1 - combination.out(j)] - 1;
102 for (Tint i = 0; i <
binomial(n, k); ++i)
105 auto combination = combinations[i];
106 for (Tint j = 0; j < k; ++j)
108 for (Tint j = 0; j < n - k; ++j)
109 p *=
dimensions[n - 1 - combination.out(j)] + 1;
120 for (
unsigned int i = 0; i <
block_sizes.size(); ++i)
140 Bint result = 0, factor = 1;
141 for (Tint i = 0; i < k; ++i)
155 template <boundaries bndT = bnd>
162 template <
int n,
int k, boundaries bnd,
typename B
int,
typename S
int,
typename T
int>
166 while (b < block_sizes.size())
168 if (
index < block_sizes[b])
170 index -= block_sizes[b];
174 if (b == block_sizes.size())
178 auto combination = combinations[b];
180 std::array<Sint, n> coordinates;
181 for (
int i = 0; i < k; ++i)
183 Sint fdim = dimensions[n - 1 - combination.in(i)];
184 coordinates[n - 1 - combination.in(i)] =
index % fdim;
187 for (
int i = 0; i < n - k; ++i)
189 Sint fdim = 1 + dimensions[n - 1 - combination.out(i)];
190 coordinates[n - 1 - combination.out(i)] =
index % fdim;
196 template <
int n,
int k, boundaries bnd,
typename B
int,
typename S
int,
typename T
int>
201 for (
unsigned int i = 0; i < ci; ++i)
202 result += block_sizes_bnd[i];
205 for (Tint i = 0; i < k; ++i)
211 for (
unsigned int i = 0; i < n - k; ++i)
217 else if (bnd ==
none)
223 assert((cross_coord != 0 && cross_coord != fdim + 1) || bnd !=
none);
224 if (cross_coord == fdim && bnd ==
periodic)
226 else if (bnd ==
none)
229 result += cross_coord * factor;
Tensor coordinates for a facet of dimension k in the complex of dimension n.
Definition: element.h:38
constexpr Sint fiber_dimension(Tint i) const
Dimension of the fiber with given index in the tensor product.
Definition: lexicographic.h:131
constexpr Tint along_direction(Tint index) const
Mapping from local to global coordinate directions.
Definition: element.h:84
index
Definition: check_push_test.py:10
@ both
Definition: lexicographic.h:11
constexpr Lexicographic(const std::array< Sint, n > &d)
Constructor setting the dimensions of the complex.
Definition: lexicographic.h:77
boundaries
Definition: lexicographic.h:9
constexpr Sint across_coordinate(Tint index) const
The position of the element orthogonal to its extension.
Definition: element.h:95
constexpr Bint block_size(Tint block) const
The number of elements in one direction.
Definition: lexicographic.h:128
Sint fiber_index_t
Index type for addressing in the fibers.
Definition: lexicographic.h:67
@ none
Definition: lexicographic.h:12
value_type operator[](Bint index) const
Descriptor for the element at given index.
Definition: lexicographic.h:163
Bint index(const value_type &e) const
Find index of a given element.
Definition: lexicographic.h:197
constexpr Bint size() const
The number of elements in this set.
Definition: lexicographic.h:117
Tint dimension_index_t
Index type for addressing dimensions and elements of the chain complex.
Definition: lexicographic.h:69
constexpr Tint across_direction(Tint index) const
Mapping of orthogonal coordinate directions to global.
Definition: element.h:92
Definition: combinations.h:8
std::array< Bint, binomial(n, k)> block_sizes
The number of objects facing the same directions.
Definition: lexicographic.h:53
static constexpr Tint cell_dimension()
The dimension of the elements, index in the chain complex.
Definition: lexicographic.h:62
Lexicographic enumeration of the k-dimensional faces in a tensor product chain complex of dimension n...
Definition: lexicographic.h:44
static constexpr Tint order()
The tensor order of the chain complex.
Definition: lexicographic.h:59
constexpr Lexicographic< n, k - 1, bndT, Bint, Sint, Tint > boundary() const
Definition: lexicographic.h:156
Bint global_index_t
Index type for addressing in the tensor product.
Definition: lexicographic.h:65
std::array< Bint, binomial(n, k)> block_sizes_bnd
Definition: lexicographic.h:55
constexpr Sint along_coordinate(Tint index) const
The coordinates in the k-dimensional element.
Definition: element.h:87
Bint index_in_slice(const value_type &e) const
Definition: lexicographic.h:138
std::array< Sint, n > dimensions
The dimension of the fibers in each direction.
Definition: lexicographic.h:49
Element< n, k, Sint, Tint > value_type
The type of elements of this set in the complex.
Definition: lexicographic.h:72
@ periodic
Definition: lexicographic.h:13
Definition: combinations.h:195
constexpr Tint direction_index() const
The index of the combination enumerating directions.
Definition: element.h:67
constexpr T binomial(T n, T k)
Compute the binomial coefficient n over k.
Definition: combinations.h:17