24 #ifndef __LINEAR_SOLVER_H 25 #define __LINEAR_SOLVER_H 30 #include <dolfin/common/types.h> 31 #include "GenericLinearSolver.h" 32 #include <dolfin/common/MPI.h> 37 class GenericLinearOperator;
41 class LinearVariationalSolver;
51 std::string preconditioner=
"default")
52 :
LinearSolver(MPI_COMM_WORLD, method, preconditioner) {}
56 std::string method=
"default",
57 std::string preconditioner=
"default");
63 void set_operator(std::shared_ptr<const GenericLinearOperator> A);
66 void set_operators(std::shared_ptr<const GenericLinearOperator> A,
67 std::shared_ptr<const GenericLinearOperator> P);
87 this->parameters.
update(parameters);
88 solver->update_parameters(parameters);
95 {
return _parameter_type; }
106 static bool in_list(
const std::string& method,
107 const std::map<std::string, std::string>& methods);
110 std::unique_ptr<GenericLinearSolver> solver;
114 std::string _parameter_type;
std::size_t solve(const GenericLinearOperator &A, GenericVector &x, const GenericVector &b)
Solve linear system Ax = b.
Definition: LinearSolver.cpp:125
Definition: GenericLinearOperator.h:42
This class implements a solver for linear variational problems.
Definition: LinearVariationalSolver.h:38
LU solver for the built-in LA backends.
Definition: LUSolver.h:35
Definition: KrylovSolver.h:38
This class provides a general solver for linear systems Ax = b.
Definition: LinearSolver.h:45
~LinearSolver()
Destructor.
Definition: LinearSolver.cpp:103
std::string parameter_type() const
Return parameter type: "krylov_solver" or "lu_solver".
Definition: LinearSolver.h:94
Parameters parameters
Parameters.
Definition: Variable.h:74
Definition: Parameters.h:94
virtual void update_parameters(const Parameters ¶meters)
Definition: LinearSolver.h:85
This class provides a general solver for linear systems Ax = b.
Definition: GenericLinearSolver.h:37
Definition: NewtonSolver.h:45
void update(const Parameters ¶meters)
Update parameters with another set of parameters.
Definition: Parameters.cpp:245
static Parameters default_parameters()
Default parameter values.
Definition: LinearSolver.h:77
void set_operator(std::shared_ptr< const GenericLinearOperator > A)
Set the operator (matrix)
Definition: LinearSolver.cpp:109
This class defines a common interface for vectors.
Definition: GenericVector.h:47
LinearSolver(std::string method="default", std::string preconditioner="default")
Create linear solver.
Definition: LinearSolver.h:50
void set_operators(std::shared_ptr< const GenericLinearOperator > A, std::shared_ptr< const GenericLinearOperator > P)
Set the operator (matrix) and preconditioner matrix.
Definition: LinearSolver.cpp:117