19 #ifndef __DOLFIN_BELOS_KRYLOV_SOLVER_H 20 #define __DOLFIN_BELOS_KRYLOV_SOLVER_H 27 #include <BelosTpetraAdapter.hpp> 28 #include <BelosSolverFactory.hpp> 29 #include <Ifpack2_Factory.hpp> 31 #include <dolfin/common/types.h> 32 #include "GenericLinearSolver.h" 33 #include "TpetraVector.h" 34 #include "TpetraMatrix.h" 35 #include "TrilinosPreconditioner.h" 45 class TrilinosPreconditioner;
65 std::string preconditioner =
"default");
69 std::shared_ptr<TrilinosPreconditioner> preconditioner);
75 void set_operator(std::shared_ptr<const GenericLinearOperator> A);
78 void set_operators(std::shared_ptr<const GenericLinearOperator> A,
79 std::shared_ptr<const GenericLinearOperator> P);
92 std::string
str(
bool verbose)
const;
95 static std::map<std::string, std::string>
methods();
106 return "krylov_solver";
115 void init(
const std::string& method);
118 void _set_operator(std::shared_ptr<const TpetraMatrix> A);
121 void _set_operators(std::shared_ptr<const TpetraMatrix> A,
122 std::shared_ptr<const TpetraMatrix> P);
142 std::shared_ptr<TrilinosPreconditioner> _prec;
146 Teuchos::RCP<problem_type> _problem;
149 std::shared_ptr<const TpetraMatrix> _matA;
void set_operator(std::shared_ptr< const GenericLinearOperator > A)
Set operator (matrix)
Definition: BelosKrylovSolver.cpp:129
static std::map< std::string, std::string > methods()
Return a list of available solver methods.
Definition: BelosKrylovSolver.cpp:50
static Parameters default_parameters()
Default parameter values.
Definition: BelosKrylovSolver.cpp:117
std::string parameter_type() const
Return parameter type: "krylov_solver" or "lu_solver".
Definition: BelosKrylovSolver.h:104
Belos::LinearProblem< double, TpetraVector::vector_type, op_type > problem_type
Belos problem type.
Definition: BelosKrylovSolver.h:60
Implements Muelu preconditioner from Trilinos.
Definition: MueluPreconditioner.h:40
std::string str(bool verbose) const
Return informal string representation (pretty-print)
Definition: BelosKrylovSolver.cpp:167
~BelosKrylovSolver()
Destructor.
Definition: BelosKrylovSolver.cpp:112
Definition: GenericLinearOperator.h:42
Tpetra::MultiVector ::node_type node_type
Node type.
Definition: TpetraVector.h:58
Definition: TpetraMatrix.h:58
Tpetra::MultiVector< double, int, dolfin::la_index, node_type > vector_type
TpetraVector vector type (scalar, local index, global index, node)
Definition: TpetraVector.h:63
Definition: BelosKrylovSolver.h:51
Definition: Parameters.h:94
Definition: TpetraVector.h:53
static std::map< std::string, std::string > preconditioners()
Return a list of available preconditioners.
Definition: BelosKrylovSolver.cpp:39
BelosKrylovSolver(std::string method="default", std::string preconditioner="default")
Definition: BelosKrylovSolver.cpp:67
PetscInt la_index
Index type for compatibility with linear algebra backend(s)
Definition: types.h:32
This class provides a general solver for linear systems Ax = b.
Definition: GenericLinearSolver.h:37
std::size_t solve(GenericVector &x, const GenericVector &b)
Solve linear system Ax = b and return number of iterations.
Definition: BelosKrylovSolver.cpp:153
Tpetra::Operator< double, int, dolfin::la_index, TpetraVector::node_type > op_type
Tpetra operator type.
Definition: BelosKrylovSolver.h:57
const TpetraMatrix & get_operator() const
Get operator (matrix)
Definition: BelosKrylovSolver.cpp:142
Implements preconditioners using Ifpack2 from Trilinos.
Definition: Ifpack2Preconditioner.h:40
This class defines a common interface for vectors.
Definition: GenericVector.h:47
void set_operators(std::shared_ptr< const GenericLinearOperator > A, std::shared_ptr< const GenericLinearOperator > P)
Set operator (matrix) and preconditioner matrix.
Definition: BelosKrylovSolver.cpp:135