6 #include "../../types.hpp" 13 namespace wavepackets {
24 template<dim_t D,
class MultiIndex>
34 std::vector< std::vector<MultiIndex> > mindices;
39 for (
dim_t d = 0; d < D; d++) {
40 test[d] = shape.bbox(d);
41 if (test[d] != shape.bbox(d)) {
42 throw std::runtime_error(
"multi-index type is not suitable. reason: overflow");
50 for (
dim_t d = 0; d < D; d++) {
51 sum += shape.bbox(d)+1;
60 std::size_t islice = 0;
64 for (
dim_t i = 0; i <= shape.limit(
static_cast<std::array<int,D>
>(index).data(),D-1); i++) {
70 mindices[islice+i].push_back(index);
77 while ((
int)index[j] == shape.limit(static_cast<std::array<int,D> >(index).data(),j)) {
81 goto enumeration_complete;
94 std::vector< ShapeSlice<D,MultiIndex> > slices(mindices.size());
96 std::size_t offset = 0;
97 std::size_t islice = 0;
98 for (; islice < mindices.size() && mindices[islice].size() != 0; islice++) {
100 offset += slice.
size();
102 slices[islice] = std::move(slice);
105 slices.resize(islice);
108 size_t size = offset;
111 for (
dim_t d = 0; d < D; d++)
112 limits[d] = shape.bbox(d);
114 return {std::move(slices), size, limits};
125 return std::make_shared<ShapeEnum<D,MultiIndex> >(generate<AbstractShape<D> >(shape));
136 return std::make_shared<ShapeEnum<D,MultiIndex> >(generate<AbstractShape<D> >(*shape));
Definition: coefficients_file_parser.cpp:10
std::size_t size() const
Definition: shape_enum.hpp:93
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::shared_ptr< ShapeEnum< D, MultiIndex > > enumerate(AbstractShape< D > const *shape) const
Enumerates all nodes of basis shape described by AbstractShape.
Definition: shape_enumerator.hpp:134
std::shared_ptr< ShapeEnum< D, MultiIndex > > enumerate(AbstractShape< D > const &shape) const
Enumerates all nodes of a basis shape described by AbstractShape.
Definition: shape_enumerator.hpp:123
The -th slice of a shape enumeration contains all multi-indices that satisfy .
Definition: shape_enum.hpp:18
Subclasses provide a description of a basis shape.
Definition: shape_base.hpp:34
Enumerates nodes of a basis shape.
Definition: shape_enumerator.hpp:25
int sum(const point_t< D > Z)
Sum of the components of the point Z.
Definition: combinatorics.hpp:20
int dim_t
Definition: types.hpp:16
ShapeEnum< D, MultiIndex > generate(const Shape &shape) const
Definition: shape_enumerator.hpp:32