Skip to content

Feature/parameterizedobjectfactory

Christian Engwer requested to merge feature/parameterizedobjectfactory into master

the idea is to have a generic factory which can be extended by the user at run time and maps a key (usually an std::string) to a constructor-call (usually taking a Dune::ParameterTree).

We want something like a plugin-system, to instantiate implementations of an abstract interface. Usually a factory can only create a hard-coded list of objects. The proposed ParameterizedObjectFactory different modules (or the user) can register implementations of the interface, without modifying the factory code.

Example:

using V = Dune::BlockVector<Dune::FieldVector<double,2>>;
using M = Dune::BCRSMatrix<Dune::FieldMatrix<double,2,2>>;

using PreconditionerFactory = 
  Dune::ParameterizedObjectFactory<Dune::Preconditioner<V,V>(const M&, const Dune::ParameterTree&)>;

PreconditionerFactory::define<Dune::SeqGS<M,V,V>>("Gauss-Seidel");

Merge request reports

Loading