[dune-functions] Function space of constant functions

Simon Praetorius simon.praetorius at tu-dresden.de
Thu Nov 15 01:47:40 CET 2018


Hi Carsten

Am 14.11.18 um 16:35 schrieb Carsten Gräser:
> without looking at the code: That's just the P0 basis with
> all basis functions mapped to the index 0, isn't it? Maybe
> this can also be obtained using (abusing)
>
>    https://gitlab.dune-project.org/staging/dune-functions/merge_requests/125
>
> Something like the following should (almost) do the trick:
>
>    auto scalarPrebasis = []() {
>        return Experimental::transformIndices(lagrange<0>(),
>          Experimental::indexTransformation(
>            [](auto& multiIndex, const auto& basis) { multiIndex = {0}; },
>            [](const auto& prefix, const auto& basis) { return std::size_t(prefix.size()==0); },
>            Dune::Indices::_1, Dune::Indices::_1));
>      };
>
> It's "abusing" and "almost", because the fact that this is
> not just a transformation leads to a minor problem: The
> resulting basis will not return the proper value on dimension().
> This could be fixed by widening the scope and allowing to
> hijack dimension() with a lambda, too.

Yes, you are right. It is a super simple implementation of a P0 local 
basis with just 1 global index. Nothing else. Nothing fancy.

Although, it is nice to achieve something similar with your index 
transform, this looks too complicated to me. All the dimensions and 
sizes should be set correctly. Otherwise I will get hard to find errors 
somewhere deep in the implementation.

Best,
Simon





More information about the dune-functions mailing list