Skip to content

Run-time container for LocalFiniteElement objects using std::variant

Oliver Sander requested to merge introduce-lfe-variant into master

This patch introduces a container that can store a LocalFiniteElement object whose precise type is only known at run-time. Internally, it uses std::variant.

Pro: Much simpler code than full type erasure Pro: Possibly a bit faster, too, but there are no measurements (yet) Con: The set of possibly types has to be known beforehand

It is argued that the 'con' is not severe. The main intended use for LocalFiniteElementVariant is to switch between LocalFiniteElements for different grid element types at run-time. Sets of such LocalFiniteElements are typically small and known at compile time.

TODO:

  • Port this from std::variant to Dune::Std::variant
  • Write a unit test
  • Write a changelog entry
  • Better inline documentation
Edited by Carsten Gräser

Merge request reports

Loading