Skip to content

[forms] Change the bindToLocalView() mechanism and rename to registerLocalViews()

Carsten Gräser requested to merge feature/forms-register-localviews into master

So far op.bindToLocalView(localViews...) was called on each local operator with exactly those local views associated to the local operator op. I.e. it's called with two LocalViews for binary operators, with one LocalView for unary operators, and it is not called at all, for nullary operators representing (cofficient) functions.

This has the drawback, that any nullary (coefficicient) operator resulting from binding an unary operator, has to maintain its own local view. Even worse, if the same coefficient shows up twice, each one needs its own LocalView.

This patch changes the mechanism such that op.bindToLocalView(localViews...) is always called with all available LocalViews, for any arity. Now each operator can pick up those LocalViews matching to its basis. For unary and binary this has the consequence that they now need to check which of the passed LocalViews fits. However, this happens exactly once (per thread) such that this is not critical.

The main benefit is that nullary coefficient functions can now use the LocalViews maintained by the global assembler which can improves performance measurable (tested with coupled Navier-Stokes-transport problem).

The new approach can potentially also be used for the shape function cache such that coefficient function can reuse the evaluations made for ansatz and test functions. The latter may have a much stronger impact.

Merge request reports

Loading