|
SpECTRE
v2026.04.01
|
Base class for serial linear solvers that supports factory-creation. More...
#include <LinearSolver.hpp>
Public Types | |
| using | registrars = LinearSolverRegistrars |
| using | creatable_classes = Registration::registrants<LinearSolverRegistrars> |
Public Member Functions | |
| virtual std::unique_ptr< LinearSolver< LinearSolverRegistrars > > | get_clone () const =0 |
| template<typename LinearOperator, typename VarsType, typename SourceType, typename... OperatorArgs, typename... Args> | |
| Convergence::HasConverged | solve (gsl::not_null< VarsType * > initial_guess_in_solution_out, const LinearOperator &linear_operator, const SourceType &source, const std::tuple< OperatorArgs... > &operator_args, Args &&... args) const |
| Solve the linear equation \(Ax=b\) where \(A\) is the linear_operator and \(b\) is the source. | |
| virtual void | reset ()=0 |
| Discard caches from previous solves. Use before solving a different linear operator. | |
| template<typename LinearOperator, typename VarsType, typename SourceType, typename... OperatorArgs, typename... Args> | |
| Convergence::HasConverged | solve (const gsl::not_null< VarsType * > initial_guess_in_solution_out, const LinearOperator &linear_operator, const SourceType &source, const std::tuple< OperatorArgs... > &operator_args, Args &&... args) const |
Base class for serial linear solvers that supports factory-creation.
Derive linear solvers from this class so they can be factory-created. If your linear solver supports preconditioning, derive from PreconditionedLinearSolver instead to inherit utility that allows using any other factor-creatable linear solver as preconditioner.
|
pure virtual |
Discard caches from previous solves. Use before solving a different linear operator.
Implemented in LinearSolver::Serial::ExplicitInverse< ValueType, LinearSolverRegistrars >, and LinearSolver::Serial::PreconditionedLinearSolver< Preconditioner, LinearSolverRegistrars >.
| Convergence::HasConverged LinearSolver::Serial::LinearSolver< LinearSolverRegistrars >::solve | ( | gsl::not_null< VarsType * > | initial_guess_in_solution_out, |
| const LinearOperator & | linear_operator, | ||
| const SourceType & | source, | ||
| const std::tuple< OperatorArgs... > & | operator_args, | ||
| Args &&... | args ) const |
Solve the linear equation \(Ax=b\) where \(A\) is the linear_operator and \(b\) is the source.
Each solve may mutate the private state of the solver, for example to cache quantities to accelerate successive solves for the same operator. Invoke reset to discard these caches.