Class SUNNonLinSolWrapper¶
Defined in File sundials_linsol_wrapper.h
Inheritance Relationships¶
Derived Types¶
public amici::SUNNonLinSolFixedPoint
(Class SUNNonLinSolFixedPoint)public amici::SUNNonLinSolNewton
(Class SUNNonLinSolNewton)
Class Documentation¶
-
class
amici
::
SUNNonLinSolWrapper
¶ A RAII wrapper for SUNNonLinearSolver structs which solve the nonlinear system F (y) = 0 or G(y) = y.
Subclassed by amici::SUNNonLinSolFixedPoint, amici::SUNNonLinSolNewton
Public Functions
-
SUNNonLinSolWrapper
(SUNNonlinearSolver sol)¶ SUNNonLinSolWrapper from existing SUNNonlinearSolver.
- Parameters
sol
:
-
~SUNNonLinSolWrapper
()¶
-
SUNNonLinSolWrapper
(const SUNNonLinSolWrapper &other) = delete¶ Copy constructor.
- Parameters
other
:
-
SUNNonLinSolWrapper
(SUNNonLinSolWrapper &&other) noexcept¶ Move constructor.
- Parameters
other
:
-
SUNNonLinSolWrapper &
operator=
(const SUNNonLinSolWrapper &other) = delete¶ Copy assignment.
- Return
- Parameters
other
:
-
SUNNonLinSolWrapper &
operator=
(SUNNonLinSolWrapper &&other) noexcept¶ Move assignment.
- Return
- Parameters
other
:
-
SUNNonlinearSolver
get
() const¶ Get the wrapped SUNNonlinearSolver.
- Return
SUNNonlinearSolver
-
SUNNonlinearSolver_Type
getType
() const¶ Get type ID of the solver.
- Return
-
int
setup
(N_Vector y, void *mem)¶ Setup solver.
- Return
- Parameters
y
: the initial iteration passed to the nonlinear solver.mem
: the sundials integrator memory structure.
-
int
Solve
(N_Vector y0, N_Vector y, N_Vector w, realtype tol, bool callLSetup, void *mem)¶ Solve the nonlinear system F (y) = 0 or G(y) = y.
- Return
- Parameters
y0
: the initial iterate for the nonlinear solve. This must remain unchanged throughout the solution process.y
: the solution to the nonlinear systemw
: the solution error weight vector used for computing weighted error norms.tol
: the requested solution tolerance in the weighted root-mean- squared norm.callLSetup
: a flag indicating that the integrator recommends for the linear solver setup function to be called.mem
: the sundials integrator memory structure.
-
int
setSysFn
(SUNNonlinSolSysFn SysFn)¶ Set function to evaluate the nonlinear residual function F(y) = 0 or the fixed point function G(y) = y.
- Return
- Parameters
SysFn
:
-
int
setLSetupFn
(SUNNonlinSolLSetupFn SetupFn)¶ Set linear solver setup function.
- Return
- Parameters
SetupFn
:
-
int
setLSolveFn
(SUNNonlinSolLSolveFn SolveFn)¶ Set linear solver solve function.
- Return
- Parameters
SolveFn
:
-
int
setConvTestFn
(SUNNonlinSolConvTestFn CTestFn, void *ctest_data)¶ Set function to test for convergence.
- Return
- Parameters
CTestFn
:ctest_data
:
-
int
setMaxIters
(int maxiters)¶ Set maximum number of non-linear iterations.
- Return
- Parameters
maxiters
:
-
long int
getNumIters
() const¶ getNumIters
- Return
-
int
getCurIter
() const¶ getCurIter
- Return
-
long int
getNumConvFails
() const¶ getNumConvFails
- Return
Protected Functions
-
void
initialize
()¶ initialize
Protected Attributes
-
SUNNonlinearSolver
solver
= nullptr¶ the wrapper solver
-