SpECTRE
v2024.06.18

Base class for serial linear solvers that supports factorycreation. 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 . 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 
Base class for serial linear solvers that supports factorycreation.
Derive linear solvers from this class so they can be factorycreated. If your linear solver supports preconditioning, derive from PreconditionedLinearSolver
instead to inherit utility that allows using any other factorcreatable linear solver as preconditioner.

pure virtual 
Discard caches from previous solves. Use before solving a different linear operator.
Implemented in 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
.
initial_guess_in_solution_out
buffer, which also serves to provide an initial guess for \(x\). Not all solvers take the initial guess into account, but all expect the buffer is sized correctly.linear_operator
must be an invocable that takes a VarsType
as constref argument and returns a SourceType
by reference. It also takes all OperatorArgs
as constref arguments.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.