8 namespace wavepackets {
10 namespace shape_enum {
12 template<
class MultiIndex>
13 std::vector<MultiIndex>
_extend(
const std::vector<MultiIndex>& source,
dim_t start,
dim_t len)
18 std::vector<MultiIndex> next(source);
19 for (std::size_t i = 0; i < source.size(); i++) {
25 std::vector<MultiIndex> lhs =
_extend(source, start, len/2);
26 std::vector<MultiIndex> rhs =
_extend(source, start + len/2, len - len/2);
28 std::vector<MultiIndex> sink(lhs.size() + rhs.size());
30 auto seek =
strict_union(lhs.begin(), lhs.end(), rhs.begin(), rhs.end(), sink.begin(), std::less<MultiIndex>{});
32 sink.resize(seek - sink.begin());
38 template<dim_t D,
class MultiIndex>
41 std::vector<MultiIndex> result =
_extend(slice.
_table(), 0, D);
43 return {std::move(result), offset};
54 template<dim_t D,
class MultiIndex>
57 std::vector< ShapeSlice<D, MultiIndex> > slices(source->
n_slices()+1);
58 std::size_t offset = 1;
60 slices[0] = source->
slice(0);
61 for (
int islice = 0; islice < source->
n_slices(); islice++) {
62 slices[islice+1] =
_extend(source->
slice(islice), offset);
63 offset += slices[islice+1].size();
66 MultiIndex limits = source->
limits();
67 for (
dim_t d = 0; d < D; d++) {
71 return {std::move(slices), offset, limits};
const MultiIndex & limits() const
Retrieves the minimum bounding box which contains all nodes.
Definition: shape_enum.hpp:472
Definition: coefficients_file_parser.cpp:10
Output strict_union(Input1 begin1, Input1 end1, Input2 begin2, Input2 end2, Output sink, Compare less)
Creates union of two shape slices.
Definition: shape_enum_union.hpp:35
int n_slices() const
Retrieves the number of slices.
Definition: shape_enum.hpp:457
A shape enumeration is a complete, ordered list of all lattice nodes that are part of the basis shape...
Definition: shape_enum.hpp:353
std::vector< MultiIndex > _extend(const std::vector< MultiIndex > &source, dim_t start, dim_t len)
Definition: shape_enum_extended.hpp:13
ShapeEnum< D, MultiIndex > extend(const ShapeEnum< D, MultiIndex > *source)
For a given enumerated shape, enumerate its extension.
Definition: shape_enum_extended.hpp:55
std::vector< MultiIndex > & _table()
Definition: shape_enum.hpp:70
The -th slice of a shape enumeration contains all multi-indices that satisfy .
Definition: shape_enum.hpp:18
int dim_t
Definition: types.hpp:16
const ShapeSlice< D, MultiIndex > & slice(int islice) const
Returns a reference to a slice.
Definition: shape_enum.hpp:409