Skip to content

Fix caching in DiscreteGlobalBasisFunction

Carsten Gräser requested to merge bugfix/subspace-dgbfunction-caching into master

This fixes an issue with caching in DiscreteGlobalBasisFunction when using a subspace basis. For a subspace basis the size-of-tree and index-within-tree do not coincide with size-of-localview and index-within-localview (aka localIndex), repectively. This was not handled carefully which led to memory corruption and thus non-deterministic values and valgrind errors whenever the subspace was not starting with localIndex 0. This was e.g. the case when writing the pressure components in the Taylor-Hood stokes example.

Now the cache has the size of the full local view but only entries associated to the tree (i.e. subspace) are actually written and read at the correct position.

This also extends the test of DiscreteGlobalBasisFunction to subspace bases which would have revealed the bug.

Merge request reports

Loading