[Dune] Question regarding the size() function of functionspacebases in dune-functions
Carsten Gräser
graeser at mi.fu-berlin.de
Thu Oct 18 11:40:11 CEST 2018
Hello,
Am 17.10.18 um 16:34 schrieb Felix Mueller:
> /basis.size()/ returns 8 as is expected (since each basis includes one
> Q1 element with 4 DoFs).
>
> Intuitively I would assume /basis.size({0})/ would return 4, yet it
> returns 0.
there's a misconception on what basis.size(prefix) is doing.
In principle dune-functions supports multi-indices that
need not to be consistent with the product space structure.
The basis.size(prefix) method exists for exploring the
set of not necessarily flat multi-indices.
For M=basis.size(prefix) the number M is the maximal one,
such that there's a multi-index (prefix,M-1,...). If you
consider the multi-indices as leaves in a tree, then any
prefix addresses a node in this tree and M is the number
of direct children of this node. For more details have a
look at the manual: https://arxiv.org/abs/1806.09545
Since you selected plain indices {(0),(1), ..., (7)}
the prefix (0) addresses a leave and the number of children
is 0. Currently there's no method returning the number of basis
functions in a subspace basis, since there's hardly any practical
use for this. Notice that the indices of a subspacebasis
are still the same as for the whole basis such that you
can use them to access a full vector. By using flat interleaved
indices, the indices of the subspaceBasis(basis,0) would be
{0, 2, 4, 6} while the ones for subspaceBasis(basis,1) would
be {1, 3, 5, 7}.
Best,
Carsten
>
> The problem also occurs when using a composite basis.
>
> I am using *dune-functions*, *dune-common* and *dune-grid v2.6.0*. My
> test is included below and was compiled with *g++7.2.0* using a new
> module generated with *duneproject*.
>
> _Is this the proper behaviour or did I encounter a bug?
>
> If this is indeed correct _behaviour_, what function yields the result I
> am looking for?_
>
>
> Thanks for your help and have a good day,
>
> Felix Müller
>
>
> /#include <dune/common/filledarray.hh>
> #include <dune/grid/yaspgrid.hh>
> #include <dune/functions/functionspacebases/compositebasis.hh>
> #include <dune/functions/functionspacebases/powerbasis.hh>
> #include <dune/functions/functionspacebases/lagrangebasis.hh>
>
> using namespace Dune::Functions::BasisFactory;
>
> int main()
> {
> // create grid
> Dune::FieldVector<double, 2> L;
> L = 1.0;
> auto s = Dune::filledArray<2>(1);
> Dune::YaspGrid<2> grid(L, s);
>
> // create taylorHood
> auto taylorHood = makeBasis(grid.leafGridView(),
> composite(power<2>(lagrange<2>(),
> flatInterleaved()), lagrange<1>(), flatLexicographic()));
> auto L1xL1 = makeBasis(grid.leafGridView(), power<2>(lagrange<1>(),
> flatInterleaved()));
>
> std::cout << "taylorHood.size(): " << taylorHood.size({}) // = 22
> << "\ntaylorHood.size({0}):" << taylorHood.size({0}) //
> = 0 (expected 18)
> // << "\ntaylorHood.size({0,0}):" << taylorHood.size({0,0}) //
> assertion failed (expected 9)
> << "\ntaylorHood.size({1}):" << taylorHood.size({1}) //
> = 0 (expected 4)
> << "\n";
> std::cout << "L1xL1.size(): " << L1xL1.size({}) // = 8
> << "\nL1xL1.size({0}):" << L1xL1.size({0}) // = 0 (expected 4)
> << "\nL1xL1.size({1}):" << L1xL1.size({1}) // = 0 (expected 4)
> << "\n";
> }/
>
>
> _______________________________________________
> Dune mailing list
> Dune at lists.dune-project.org
> https://lists.dune-project.org/mailman/listinfo/dune
>
--
Prof. Dr. Carsten Gräser
Freie Universität Berlin
Institut für Mathematik
Arnimallee 6
14195 Berlin, Germany
phone: +49 30 838 72637
fax : +49 30 838 472637
email: graeser at mi.fu-berlin.de
URL : http://page.mi.fu-berlin.de/graeser
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20181018/69fe5f89/attachment.sig>
More information about the Dune
mailing list