6#ifndef DUNE_ISTL_SOLVERREGISTRY_HH
7#define DUNE_ISTL_SOLVERREGISTRY_HH
9#include <dune/istl/common/registry.hh>
10#include <dune/istl/preconditioner.hh>
13#define DUNE_REGISTER_DIRECT_SOLVER(name, ...) \
14 DUNE_REGISTRY_PUT(DirectSolverTag, name, __VA_ARGS__)
16#define DUNE_REGISTER_PRECONDITIONER(name, ...) \
17 DUNE_REGISTRY_PUT(PreconditionerTag, name, __VA_ARGS__)
19#define DUNE_REGISTER_ITERATIVE_SOLVER(name, ...) \
20 DUNE_REGISTRY_PUT(IterativeSolverTag, name, __VA_ARGS__)
28 struct DirectSolverTag {};
29 struct PreconditionerTag {};
30 struct IterativeSolverTag {};
32 template<
template<
class,
class,
class,
int>
class Preconditioner,
int blockLevel=1>
33 auto defaultPreconditionerBlockLevelCreator(){
36 using Matrix =
typename Dune::TypeListElement<0,
decltype(typeList)>::type;
37 using Domain =
typename Dune::TypeListElement<1,
decltype(typeList)>::type;
38 using Range =
typename Dune::TypeListElement<2,
decltype(typeList)>::type;
39 std::shared_ptr<Dune::Preconditioner<Domain, Range>> preconditioner
40 = std::make_shared<Preconditioner<Matrix, Domain, Range, blockLevel>>(matrix, config);
41 return preconditioner;
45 template<
template<
class,
class,
class>
class Preconditioner>
46 auto defaultPreconditionerCreator(){
49 using Matrix =
typename Dune::TypeListElement<0,
decltype(typeList)>::type;
50 using Domain =
typename Dune::TypeListElement<1,
decltype(typeList)>::type;
51 using Range =
typename Dune::TypeListElement<2,
decltype(typeList)>::type;
52 std::shared_ptr<Dune::Preconditioner<Domain, Range>> preconditioner
53 = std::make_shared<Preconditioner<Matrix, Domain, Range>>(matrix, config);
54 return preconditioner;
58 template<
template<
class...>
class Solver>
59 auto defaultIterativeSolverCreator(){
60 return [](
auto typeList,
61 const auto& linearOperator,
62 const auto& scalarProduct,
63 const auto& preconditioner,
66 using Domain =
typename Dune::TypeListElement<0,
decltype(typeList)>::type;
67 using Range =
typename Dune::TypeListElement<1,
decltype(typeList)>::type;
68 std::shared_ptr<Dune::InverseOperator<Domain, Range>> solver
69 = std::make_shared<Solver<Domain>>(linearOperator, scalarProduct, preconditioner, config);
77 class UnsupportedType :
public NotImplemented {};
79 class InvalidSolverFactoryConfiguration :
public InvalidStateException{};
Hierarchical structure of string parameters.
Definition: parametertree.hh:37
Dune namespace.
Definition: alignedallocator.hh:13
constexpr std::size_t blockLevel()
Determine the block level of a possibly nested vector/matrix type.
Definition: blocklevel.hh:176
Define general, extensible interface for inverse operators.