Class SUNLinSolWrapper
Defined in File sundials_linsol_wrapper.h
Inheritance Relationships
Derived Types
public amici::SUNLinSolBand
(Class SUNLinSolBand)public amici::SUNLinSolDense
(Class SUNLinSolDense)public amici::SUNLinSolKLU
(Class SUNLinSolKLU)public amici::SUNLinSolPCG
(Class SUNLinSolPCG)public amici::SUNLinSolSPBCGS
(Class SUNLinSolSPBCGS)public amici::SUNLinSolSPFGMR
(Class SUNLinSolSPFGMR)public amici::SUNLinSolSPGMR
(Class SUNLinSolSPGMR)public amici::SUNLinSolSPTFQMR
(Class SUNLinSolSPTFQMR)
Class Documentation
-
class SUNLinSolWrapper
A RAII wrapper for SUNLinearSolver structs.
For details on member functions see documentation in sunlinsol/sundials_linearsolver.h.
Subclassed by amici::SUNLinSolBand, amici::SUNLinSolDense, amici::SUNLinSolKLU, amici::SUNLinSolPCG, amici::SUNLinSolSPBCGS, amici::SUNLinSolSPFGMR, amici::SUNLinSolSPGMR, amici::SUNLinSolSPTFQMR
Public Functions
-
SUNLinSolWrapper() = default
-
explicit SUNLinSolWrapper(SUNLinearSolver linsol)
Wrap existing SUNLinearSolver.
- Parameters:
linsol – SUNLinSolWrapper takes ownership of
linsol
.
-
explicit SUNLinSolWrapper(SUNLinearSolver linsol, SUNMatrixWrapper const &A)
Wrap existing SUNLinearSolver.
- Parameters:
linsol – SUNLinSolWrapper takes ownership of
linsol
.A – Matrix
-
virtual ~SUNLinSolWrapper()
-
SUNLinSolWrapper(SUNLinSolWrapper const &other) = delete
Copy constructor.
- Parameters:
other –
-
SUNLinSolWrapper(SUNLinSolWrapper &&other) noexcept
Move constructor.
- Parameters:
other –
-
SUNLinSolWrapper &operator=(SUNLinSolWrapper const &other) = delete
Copy assignment.
- Parameters:
other –
- Returns:
-
SUNLinSolWrapper &operator=(SUNLinSolWrapper &&other) noexcept
Move assignment.
- Parameters:
other –
- Returns:
-
SUNLinearSolver get() const
Returns the wrapped SUNLinSol.
- Returns:
SUNLinearSolver
-
SUNLinearSolver_Type getType() const
Returns an identifier for the linear solver type.
- Returns:
-
void setup() const
Performs any linear solver setup needed, based on an updated system matrix A.
-
int solve(N_Vector x, N_Vector b, realtype tol) const
Solves a linear system A*x = b.
- Parameters:
x – A template for cloning vectors needed within the solver.
b –
tol – Tolerance (weighted 2-norm), iterative solvers only
- Returns:
error flag
-
long int getLastFlag() const
Returns the last error flag encountered within the linear solver.
- Returns:
error flag
-
int space(long int *lenrwLS, long int *leniwLS) const
Returns the integer and real workspace sizes for the linear solver.
- Parameters:
lenrwLS – output argument for size of real workspace
leniwLS – output argument for size of integer workspace
- Returns:
workspace size
-
virtual SUNMatrixWrapper &getMatrix()
Get the matrix A (matrix solvers only).
- Returns:
A
Protected Functions
-
int initialize()
Performs linear solver initialization (assumes that all solver-specific options have been set).
- Returns:
error code
Protected Attributes
-
SUNLinearSolver solver_ = {nullptr}
Wrapped solver
-
SUNMatrixWrapper A_
Matrix A for solver.
-
SUNLinSolWrapper() = default