4#ifndef DUNE_ISTL_SOLVERREGISTRY_HH
5#define DUNE_ISTL_SOLVERREGISTRY_HH
7#include <dune/istl/common/registry.hh>
8#include <dune/istl/preconditioner.hh>
11#define DUNE_REGISTER_DIRECT_SOLVER(name, ...) \
12 DUNE_REGISTRY_PUT(DirectSolverTag, name, __VA_ARGS__)
14#define DUNE_REGISTER_PRECONDITIONER(name, ...) \
15 DUNE_REGISTRY_PUT(PreconditionerTag, name, __VA_ARGS__)
17#define DUNE_REGISTER_ITERATIVE_SOLVER(name, ...) \
18 DUNE_REGISTRY_PUT(IterativeSolverTag, name, __VA_ARGS__)
26 struct DirectSolverTag {};
27 struct PreconditionerTag {};
28 struct IterativeSolverTag {};
30 template<
template<
class,
class,
class,
int>
class Preconditioner,
int blockLevel=1>
31 auto defaultPreconditionerBlockLevelCreator(){
34 using Matrix =
typename Dune::TypeListElement<0,
decltype(typeList)>::type;
35 using Domain =
typename Dune::TypeListElement<1,
decltype(typeList)>::type;
36 using Range =
typename Dune::TypeListElement<2,
decltype(typeList)>::type;
37 std::shared_ptr<Dune::Preconditioner<Domain, Range>> preconditioner
38 = std::make_shared<Preconditioner<Matrix, Domain, Range, blockLevel>>(matrix, config);
39 return preconditioner;
43 template<
template<
class,
class,
class>
class Preconditioner>
44 auto defaultPreconditionerCreator(){
47 using Matrix =
typename Dune::TypeListElement<0,
decltype(typeList)>::type;
48 using Domain =
typename Dune::TypeListElement<1,
decltype(typeList)>::type;
49 using Range =
typename Dune::TypeListElement<2,
decltype(typeList)>::type;
50 std::shared_ptr<Dune::Preconditioner<Domain, Range>> preconditioner
51 = std::make_shared<Preconditioner<Matrix, Domain, Range>>(matrix, config);
52 return preconditioner;
56 template<
template<
class...>
class Solver>
57 auto defaultIterativeSolverCreator(){
58 return [](
auto typeList,
59 const auto& linearOperator,
60 const auto& scalarProduct,
61 const auto& preconditioner,
64 using Domain =
typename Dune::TypeListElement<0,
decltype(typeList)>::type;
65 using Range =
typename Dune::TypeListElement<1,
decltype(typeList)>::type;
66 std::shared_ptr<Dune::InverseOperator<Domain, Range>> solver
67 = std::make_shared<Solver<Domain>>(linearOperator, scalarProduct, preconditioner, config);
75 class UnsupportedType :
public NotImplemented {};
77 class InvalidSolverFactoryConfiguration :
public InvalidStateException{};
Hierarchical structure of string parameters.
Definition: parametertree.hh:35
Dune namespace.
Definition: alignedallocator.hh:11
constexpr std::size_t blockLevel()
Determine the block level of a possibly nested vector/matrix type.
Definition: blocklevel.hh:174
Define general, extensible interface for inverse operators.