Add factory for container descriptors specialized for different pre-basis types
Summary
This MR implements the first step towards container descriptors for dune-functions bases. The descriptors for leaf bases and for power/composite bases with blocked-lexicographic IMS is provided. All other cases return a ContainerDescriptors::Unknown
tag, indicating: not implemented.
Design
The container descriptors of a pre-basis can be obtained by calling preBasis.containerDescriptor()
and by using the factory method
template <class PreBasis>
auto constainerDescriptor(const PreBasis& preBasis)
{
if constexpr (/* preBasis implements .containerDescriptor() */)
return preBasis.containerDescriptor();
else
return ContainerDescriptors::Unknown{};
}
with a fallback to ContainerDescriptors::Unknown
in case the pre-basis does not provide a definition.
Specializations for leaf pre-bases in dune-functions are provided. Additionally, in this MR the specialization for composie/power/dynamic-power pre-basis with blocked-lexicographic index-merging strategy is implemented. In follow-up MRs the other index-merging strategy specializations will be added.
Example
using namespace Dune::Functions;
using namespace Dune::Functions::BasisFactory;
namespace CD = Dune::Functions::ContainerDescriptors;
auto basis1 = makeBasis(gridView, power<2>(lagrange<1>(), blockedLexicographic()));
auto descriptor1 = containerDescriptor(basis1.preBasis());
// -> CD::UniformArray<CD::FlatVector,2>
auto basis2 = makeBasis(gridView,
composite(power<3>(lagrange<2>(),blockedLexicographic()), lagrange<1>(), blockedLexicographic()));
auto descriptor2 = containerDescriptor(basis2.preBasis());
// -> CD::Tuple<CD::UniformArray<CD::FlatVector,2>,CD::FlatVector>
auto basis3 = makeBasis(gridView, power<2>(lagrange<1>(), flatInterleaved()));
auto descriptor3 = containerDescriptor(basis3.preBasis());
// -> CD::Unknown
Changes
- Each pre-basis gets a new member-function
containerDescriptor() const
returning a type from the namespaceContainerDescriptors
. - The
GenericIndexingTransformation
is parametrized additionally with aContainerDescriptorImplementation
, i.e. a callable returning the container-descriptor associated to the pre-basis after index transformation. This callable is passed as additional last constructor argument. The factory functionindexTransformation
also gets an additional parameter, but for backwards-compatibility, there is an overload that just returnsContainerDescriptor::Unkown
if nothing is provided.
Merge request reports
Activity
added 1 commit
- 0c8df434 - Remove container descriptor merge utility for flat indexmerging
- Resolved by Simon Praetorius
@carsten.graeser, @oliver.sander, @christi, @santiago.ospina: This MR implements the second step of the container-descriptor design we have discussed at the last dune-functions meeting. Instead of having a member-function
preBasis.containerDescriptor()
I propose to introduce a factory class. Thus, the container-descriptor is not directly a part of the basis interface, but is still provided for all bases available in dune-functions.In this MR, the descriptors are implemented for the leaf-pre-bases, a few special bases (e.g. Taylor-Hood) and for composite/power bases with blocked-lexicographic index-merging. In these cases, the descriptor can be defined explicitly in terms of the container-descriptor tree, without any merging/appending algorithm. That will be added in a next MR after we have decided on a general pattern.
Can you please give a clear voting whether you accept my proposal of the factory class instead of the member-function?!
Edited by Simon Praetorius
- Resolved by Santiago Ospina De Los Ríos
- Resolved by Simon Praetorius
added 1 commit
- 712b02cf - Move containerDescriptor factory into member functions
added 30 commits
-
66dc4981...03dc66b6 - 28 commits from branch
master
- 0f15a4d3 - Add factory for container discretors specialized for different pre basis types
- 88820dba - Add a changelog entry
-
66dc4981...03dc66b6 - 28 commits from branch
The implementation for other merging strategies was left out on purpose in this MR to first concentrate on the general interface. All cases can be covered, see !350 (closed).
In doing the MRs step-by-step we can add for all steps test cases. This was partially missing in the big MR. Also, some of the merging-strategies require in the current implementation of the container-descriptors quiet complex algorithms. Maybe these can be cleaned up in the follow-up MRs.
mentioned in commit 664f68c6