20 #ifndef LIBMESH_LASPACK_LINEAR_SOLVER_H 21 #define LIBMESH_LASPACK_LINEAR_SOLVER_H 23 #include "libmesh/libmesh_common.h" 25 #if defined(LIBMESH_HAVE_LASPACK) 34 #include "libmesh/linear_solver.h" 35 #include "libmesh/laspack_vector.h" 36 #include "libmesh/laspack_matrix.h" 50 class LaspackLinearSolver :
public LinearSolver<T>
66 virtual void clear ()
override;
71 virtual void init (
const char *
name =
nullptr)
override;
76 virtual std::pair<unsigned int, Real>
77 solve (SparseMatrix<T> & matrix,
78 NumericVector<T> & solution,
79 NumericVector<T> & rhs,
80 const std::optional<double> tol = std::nullopt,
81 const std::optional<unsigned int> m_its = std::nullopt)
override;
86 virtual std::pair<unsigned int, Real>
88 NumericVector<T> & solution,
89 NumericVector<T> & rhs,
90 const std::optional<double> tol = std::nullopt,
91 const std::optional<unsigned int> m_its = std::nullopt)
override;
96 virtual std::pair<unsigned int, Real>
97 solve (SparseMatrix<T> & matrix,
99 NumericVector<T> & solution,
100 NumericVector<T> & rhs,
101 const std::optional<double> tol = std::nullopt,
102 const std::optional<unsigned int> m_its = std::nullopt)
override;
107 virtual std::pair<unsigned int, Real>
108 solve (
const ShellMatrix<T> & shell_matrix,
109 NumericVector<T> & solution_in,
110 NumericVector<T> & rhs_in,
111 const std::optional<double> tol = std::nullopt,
112 const std::optional<unsigned int> m_its = std::nullopt)
override;
119 virtual std::pair<unsigned int, Real>
120 solve (
const ShellMatrix<T> & shell_matrix,
121 const SparseMatrix<T> & precond_matrix,
122 NumericVector<T> & solution_in,
123 NumericVector<T> & rhs_in,
124 const std::optional<double> tol = std::nullopt,
125 const std::optional<unsigned int> m_its = std::nullopt)
override;
154 template <
typename T>
158 _precond_type (ILUPrecond)
164 template <
typename T>
173 template <
typename T>
175 std::pair<unsigned int, Real>
180 const std::optional<double>,
181 const std::optional<unsigned int>)
183 libmesh_error_msg(
"ERROR: LASPACK does not support a user-supplied preconditioner!");
185 std::pair<unsigned int, Real> p;
191 #endif // #ifdef LIBMESH_HAVE_LASPACK 192 #endif // LIBMESH_LASPACK_LINEAR_SOLVER_H std::string name(const ElemQuality q)
This function returns a string containing some name for q.
virtual void print_converged_reason() const override
Prints a useful message about why the latest linear solve con(di)verged.
void set_laspack_preconditioner_type()
Tells LASPACK to use the user-specified preconditioner stored in _preconditioner_type.
LinearConvergenceReason
Linear solver convergence flags (taken from the PETSc flags).
virtual void init(const char *name=nullptr) override
Initialize data structures if not done so already.
Provides a uniform interface to vector storage schemes for different linear algebra libraries...
const Parallel::Communicator & comm() const
~LaspackLinearSolver()
Destructor.
The libMesh namespace provides an interface to certain functionality in the library.
This base class can be inherited from to provide interfaces to linear solvers from different packages...
LaspackLinearSolver(const libMesh::Parallel::Communicator &comm)
Constructor.
PrecondProcType _precond_type
Preconditioner type.
virtual void clear() override
Release all memory and clear data structures.
virtual LinearConvergenceReason get_converged_reason() const override
virtual std::pair< unsigned int, Real > adjoint_solve(SparseMatrix< T > &matrix, NumericVector< T > &solution, NumericVector< T > &rhs, const std::optional< double > tol=std::nullopt, const std::optional< unsigned int > m_its=std::nullopt) override
Call the Laspack solver to solve A^T x = b.
virtual std::pair< unsigned int, Real > solve(SparseMatrix< T > &matrix, NumericVector< T > &solution, NumericVector< T > &rhs, const std::optional< double > tol=std::nullopt, const std::optional< unsigned int > m_its=std::nullopt) override
Call the Laspack solver.