Skip to content

Add support for assembling on subspace basis only

When using a subspace basis, the DuneFunctions*-assemblers still partly assembled pattern and entries for the full basis. To be precise:

  1. The local matrix/vector was set to localView.size() which is the size of the full space. Hence this still works for a subspace basis, if the local assembler always uses localIndex() when accessing the local matrix/vector. However, it would only change local entries associated to the subspace.
  2. All entries of the local matrix where added to the matrix patter and the entries. This also included the non-touched local entries associated to DOFs which are not in the subspace.

This MR leaves 1) as it is but changes 2). 1) is kept, because otherwise it's hard to get proper local indices. 2) is changed such that only local entries from the subspace are added to the matrix pattern/entries.

This allows to only assemble those parts of the matrix associated to the subtree and thus avoids adding many zeros for the other entries. If the pattern is also assembled for the subspace, it will not contain entries for other DOFs.

There's one corner case where this may break existing code: If you have used these assemblers on a subspace basis and rely on the fact that it always builds the pattern for the full matrix.

This also adds zero-initialization for the used local matrix entries. Hence local assemblers no longer need to do this which allows chaneing them to compute the sum of two operators.

Edited by Carsten Gräser

Merge request reports