Add a vector factory based on the container descriptors
Summary
This MR adds a factory for istl containers capable of storing the coefficients of a basis with multi-indices. It is based on the recently introduced container-descriptor facilities, which define the shape of a possible nested container.
The MR provides the following function:
#include <dune/functions/backends/istlvectorfactory.hh>
template<class T = double, class ContainerDescriptor>
auto istlVectorFactory (const ContainerDescriptor& tree);
Example
The container descriptor is provided by a basis, e.g.,
using namespace Dune::Functions::BasisFactory;
auto basis = makeBasis(grid.leafGridView(),
composite(power<2>(lagrange<2>(), blockedLexicographic()), lagrange<1>()));
auto u_basis = subspaceBasis(basis, _0);
auto p_basis = subspaceBasis(basis, _1);
// create a vector capable of storing the coefficients for that basis
using Dune::Functions::istlVectorFactory;
auto coefficients = istlVectorFactory<double>(basis.preBasis().containerDescriptor());
using Dune::Functions::interpolate;
interpolate(u_basis, coefficients, [](auto const& x) { return Dune::FieldVector<double,2>{2.0,2.0}; });
interpolate(p_basis, coefficients, [](auto const& x) { return 1.0; });
ToDo
-
Requires core/dune-istl!563 (merged) to be merged before.
Edited by Simon Praetorius