Draft: Add IndexTree datastructures to represent hierarchic structure of the basis
Summary
This MR implements an idea discussed in a dune-functions developer meeting: Represent the hierarchic structure accessible by multi-indices in a "container descriptor", i.e., a class that is similar to a hierarchic container, with placeholders for the actual data types. This descriptor can be used to construct an actual hierarchic container compatible with the multi-indices provided by the basis.
ContainerDestriptors
There are various destriptors implemented in the namespace Dune::Functions::ContainerDescriptors
, following standard containers: Array
, Tuple
, Vector
. Additionally, "uniform"-containers are provided, where all elements (childs) are identical and thus only one of the elements need to be stored. These container destriptors have the prefix Uniform
.
The structure of a container-descriptor is a reduced container interface:
struct ContainerDescriptor
{
template<class Index>
[SubContainerDescriptor] operator[](Index i) const; // return the i-th sub-container-descriptor
[static constexpr] std::size_t size() [const]; // return the number of children
};
With the operator[]
you can access the children. The Index
type is either an integral value or an integral_constant
for tuple nodes.
Size is either a static property, or a runtime value. It might be represented as a static member of integral_constant
type, since these have a call operator and even be converted into a std::size_t
.
TODO
-
Decide whether to name the structure orSizeTree
-->IndexTree
ContainerDescriptor
-
Add changelog entry -
Squash commits -
requires !389 (merged) to be merged and then a rebase to include these commits. -
Update concepts definition
Closes #54