SpECTRE
v2025.03.17
|
Base class for serial linear solvers that supports factory-creation and nested preconditioning. More...
#include <LinearSolver.hpp>
Classes | |
struct | PreconditionerOption |
Public Types | |
using | PreconditionerType = implementation defined |
![]() | |
using | registrars = LinearSolverRegistrars |
using | creatable_classes = Registration::registrants< LinearSolverRegistrars > |
Public Member Functions | |
void | pup (PUP::er &p) override |
bool | has_preconditioner () const |
Whether or not a preconditioner is set. | |
![]() | |
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 linear_operator and source . More... | |
virtual void | reset ()=0 |
Discard caches from previous solves. Use before solving a different linear operator. More... | |
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 |
Protected Member Functions | |
PreconditionedLinearSolver (PreconditionedLinearSolver &&)=default | |
PreconditionedLinearSolver & | operator= (PreconditionedLinearSolver &&)=default |
PreconditionedLinearSolver (std::optional< PreconditionerType > local_preconditioner) | |
PreconditionedLinearSolver (const PreconditionedLinearSolver &rhs) | |
PreconditionedLinearSolver & | operator= (const PreconditionedLinearSolver &rhs) |
template<bool Enabled = not std::is_same_v<Preconditioner, NoPreconditioner>, Requires< Enabled and not std::is_same_v< Preconditioner, NoPreconditioner > > = nullptr> | |
std::optional< PreconditionerType > | clone_preconditioner () const |
Copy the preconditioner. Useful to implement get_clone when the preconditioner has an abstract type. | |
template<bool Enabled = not std::is_same_v<Preconditioner, NoPreconditioner>, Requires< Enabled and not std::is_same_v< Preconditioner, NoPreconditioner > > = nullptr> | |
const Preconditioner & | preconditioner () const |
Access to the preconditioner. Check has_preconditioner() before calling this function. Calling this function when has_preconditioner() returns false is an error. | |
template<bool Enabled = not std::is_same_v<Preconditioner, NoPreconditioner>, Requires< Enabled and not std::is_same_v< Preconditioner, NoPreconditioner > > = nullptr> | |
Preconditioner & | preconditioner () |
Copy the preconditioner. Useful to implement get_clone when the preconditioner has an abstract type. | |
void | reset () override=0 |
Copy the preconditioner. Useful to implement get_clone when the preconditioner has an abstract type. More... | |
Base class for serial linear solvers that supports factory-creation and nested preconditioning.
To enable support for preconditioning in your derived linear solver class, pass any type that has a solve
and a reset
function as the Preconditioner
template parameter. It can also be an abstract LinearSolver
type, which means that any other linear solver can be used as preconditioner. Pass NoPreconditioner
to disable support for preconditioning.
|
overridepure virtual |
Copy the preconditioner. Useful to implement get_clone
when the preconditioner has an abstract type.
Implements LinearSolver::Serial::LinearSolver< LinearSolverRegistrars >.