Skip to content

Feature/solverfactory

Nils-Arne Dreier requested to merge feature/solverrepository into master

This MR introduces a solver factory that can assemble solvers to a given LinearOperator, that are fully configurable via a ParameterTree. It is based on a compile-time registry that can register class templates at compile time. This compile time registry can then be added to a ParameterizedObjectFactory.

We've introduced tree types of these Factories:

  • DirectSolverFactory
  • PreconditionerFactory
  • IterativeSolverFactory

We provide Macros for registering class templates. For example a preconditioner can be registered like that:

DUNE_REGISTER_PRECONDITIONER("ssor", default_preconditoner_BL_creator<Dune::SeqSSOR>());

where default_preconditoner_BL_creator<Dune::SeqSSOR>() could also be replaced by a object that creates the preconditoner from a matrix and a ParameterTree.

The solver factory can then be used like this:

std::shared_ptr<MatrixAdapter<Vector,Vector>> op = std::make_shared<MatrixAdapter<Vector,Vector>>(A);
std::shared_ptr<Dune::InverseOperator<Vector, Vector>> solver = getSolverFromFactory(op, solverConfig);

where solverConfig is a ParameterTree containing a configuration tree:

[CGWithAMG]
type = cgsolver
verbose = 1
maxit = 1000
reduction = 1e-5

[CGWithAMG.preconditioner]
type = amg
iterations = 1
relaxation = 1
maxLevel = 10

It is planned to have a library "libduneistl" at some point that contains preconditioners and solvers for the most often used template parameters.

Edited by Nils-Arne Dreier

Merge request reports

Loading