[Dune] Question regarding the size() function of functionspacebases in dune-functions

Felix Mueller Felix.Mueller2 at mailbox.tu-dresden.de
Wed Oct 17 16:34:18 CEST 2018


Hello,

Recently I was working with DUNE-FUNCTIONS for implementing interpolation
of data during grid adaptation. For this purpose I was looking for a
function to return the number of degrees of freedom for subspacebases of a
dune-functions basis of the following form:

Suppose we have two order 1 lagrange bases and a YASPGrid containing only
one element. I create a power basis by using
/auto basis = makeBasis(grid.leafGridView(), power<2>(lagrange<1>(),
flatInterleaved()));/

I now want to know how many degrees of freedom the first component of the
basis has.

/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.

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";
}/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20181017/6b2d75f9/attachment.htm>


More information about the Dune mailing list