Skip to content
Snippets Groups Projects

Add support for (dune-functions) prefix resizing

Summary

When using ISTL blocked vectors for entity blocking, I came across the issue that the ordering was not able to provide individual sizes for each entity.

  • Tag dispatched resize methods using the virtual interface of the ordering. This was not suitable for local ordering resizing.
  • The ordering tree structure does not map directly to the container blocking, which makes it difficult to make resize based on its tree structure.
  • dune-functions method of resizing is much more flexible and more intuitive than tag dispatched resizing.

Proposal

Use the dune-functions approach. That is, provide the ordering with a function size(MultiIndex) to which we pass a partial path (i.e. prefix) to the container and it should return the size for such path. In the dune-functions jargon, the ordering would be the size provider. Once this is possible, we are able to reuse dune-functions algorithms for ISTL backends...

// assume the following blocking
auto b = BlockVector<BlockVector<FieldVector<double,1>>>{};
auto prefix = MultiIndex<std::size_t,1>{}; // -> {}
auto base_size = gfs.ordering().size(predix); // get size of first level blocking
b.resize(base_size);

prefix.push_back(0); // -> {0}
for (std::size_t i = 0; i < base_size; ++i) {
  prefix.back() = i; // -> {i}
  auto block_size_i = gfs.ordering().size(prefix); // get size for block i
  b[i].resize(block_size_i);
}

...or, this could be done recursively with the dune-functions implementation:

auto b = BlockVector<BlockVector<FieldVector<double,1>>>{};
auto backend = Functions::istlVectorBackend(b);
backend.resize(gfs.ordering()); // calls size on ordering recursively

Disclaimer

  • I only tested dynamic entity booking for a two nested block vector BlockVector<BlockVector<FieldVector<double,1>>> so far.
  • The dune-functions grid function spaces are yet not adapted, but I assume that this is trivially feasibly since no complex trees used yet. DONE
Edited by Santiago Ospina De Los Ríos

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Apart from what I mentioned above, this is feature complete and is documented. @christi would you mind taking a look into this?

  • mentioned in merge request !557 (merged)

  • added 1 commit

    • 72d5d777 - Move prefixed size from base class to nodes

    Compare with previous version

  • added 1 commit

    • 6d58c643 - Reverse size prefix when mixing dune-functions and pdelab code

    Compare with previous version

  • added 1 commit

    • 81ee58c6 - Fix size provider for non blocked local orderings

    Compare with previous version

  • added 2 commits

    • ada36a37 - Document size methods in ordering
    • edff4b40 - Fix and simplify reversing of prefix

    Compare with previous version

  • added 1 commit

    • 4aab70eb - Fix size for permuted orderings

    Compare with previous version

  • added 1 commit

    • 68136b47 - Fix size for permuted orderings

    Compare with previous version

  • added 1 commit

    • b3e008c2 - Fix size for permuted orderings

    Compare with previous version

  • Santiago Ospina De Los Ríos marked this merge request as ready

    marked this merge request as ready

  • requested review from @christi

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading