18 #ifndef __KRYLOV_SOLVER_H 19 #define __KRYLOV_SOLVER_H 24 #include "GenericLinearSolver.h" 25 #include <dolfin/common/MPI.h> 30 class GenericLinearOperator;
32 class VectorSpaceBasis;
44 std::string method=
"default",
45 std::string preconditioner=
"default");
49 std::string preconditioner=
"default");
53 std::shared_ptr<const GenericLinearOperator> A,
54 std::string method=
"default",
55 std::string preconditioner=
"default");
58 KrylovSolver(std::shared_ptr<const GenericLinearOperator> A,
59 std::string method=
"default",
60 std::string preconditioner=
"default");
66 void set_operator(std::shared_ptr<const GenericLinearOperator> A);
69 void set_operators(std::shared_ptr<const GenericLinearOperator> A,
70 std::shared_ptr<const GenericLinearOperator> P);
86 this->parameters.
update(parameters);
87 solver->parameters.update(parameters);
95 return "krylov_solver";
101 void init(std::string method, std::string preconditioner, MPI_Comm comm);
104 std::shared_ptr<GenericLinearSolver> solver;
std::string parameter_type() const
Return parameter type: "krylov_solver" or "lu_solver".
Definition: KrylovSolver.h:93
virtual void update_parameters(const Parameters ¶meters)
Definition: KrylovSolver.h:84
void set_operators(std::shared_ptr< const GenericLinearOperator > A, std::shared_ptr< const GenericLinearOperator > P)
Set operator (matrix) and preconditioner matrix.
Definition: KrylovSolver.cpp:93
void set_operator(std::shared_ptr< const GenericLinearOperator > A)
Set operator (matrix)
Definition: KrylovSolver.cpp:85
Definition: GenericLinearOperator.h:42
Definition: KrylovSolver.h:38
Parameters parameters
Parameters.
Definition: Variable.h:74
Definition: Parameters.h:94
std::size_t solve(GenericVector &x, const GenericVector &b)
Solve linear system Ax = b.
Definition: KrylovSolver.cpp:101
This class provides a general solver for linear systems Ax = b.
Definition: GenericLinearSolver.h:37
~KrylovSolver()
Destructor.
Definition: KrylovSolver.cpp:79
void update(const Parameters ¶meters)
Update parameters with another set of parameters.
Definition: Parameters.cpp:245
static Parameters default_parameters()
Default parameter values.
Definition: KrylovSolver.cpp:32
This class defines a common interface for vectors.
Definition: GenericVector.h:47
KrylovSolver(MPI_Comm comm, std::string method="default", std::string preconditioner="default")
Constructor.
Definition: KrylovSolver.cpp:48