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 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
-
explicit SUNNonLinSolWrapper(SUNNonlinearSolver sol)
SUNNonLinSolWrapper from existing SUNNonlinearSolver.
- Parameters:
sol –
-
virtual ~SUNNonLinSolWrapper()
-
SUNNonLinSolWrapper(SUNNonLinSolWrapper const &other) = delete
Copy constructor.
- Parameters:
other –
-
SUNNonLinSolWrapper(SUNNonLinSolWrapper &&other) noexcept
Move constructor.
- Parameters:
other –
-
SUNNonLinSolWrapper &operator=(SUNNonLinSolWrapper const &other) = delete
Copy assignment.
- Parameters:
other –
- Returns:
-
SUNNonLinSolWrapper &operator=(SUNNonLinSolWrapper &&other) noexcept
Move assignment.
- Parameters:
other –
- Returns:
-
SUNNonlinearSolver get() const
Get the wrapped SUNNonlinearSolver.
- Returns:
SUNNonlinearSolver
-
SUNNonlinearSolver_Type get_type() const
Get type ID of the solver.
- Returns:
-
int setup(N_Vector y, void *mem)
Setup solver.
- Parameters:
y – the initial iteration passed to the nonlinear solver.
mem – the sundials integrator memory structure.
- Returns:
-
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.
- Parameters:
y0 – the initial iterate for the nonlinear solve. This must remain unchanged throughout the solution process.
y – the solution to the nonlinear system
w – 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.
- Returns:
-
int set_sys_fn(SUNNonlinSolSysFn SysFn)
Set function to evaluate the nonlinear residual function F(y) = 0 or the fixed point function G(y) = y.
- Parameters:
SysFn –
- Returns:
-
int set_l_setup_fn(SUNNonlinSolLSetupFn SetupFn)
Set linear solver setup function.
- Parameters:
SetupFn –
- Returns:
-
int set_l_solve_fn(SUNNonlinSolLSolveFn SolveFn)
Set linear solver solve function.
- Parameters:
SolveFn –
- Returns:
-
int set_conv_test_fn(SUNNonlinSolConvTestFn CTestFn, void *ctest_data)
Set function to test for convergence.
- Parameters:
CTestFn –
ctest_data –
- Returns:
-
int set_max_iters(int maxiters)
Set maximum number of non-linear iterations.
- Parameters:
maxiters –
- Returns:
-
long int get_num_iters() const
get_num_iters
- Returns:
-
int get_cur_iter() const
get_cur_iter
- Returns:
-
long int get_num_conv_fails() const
get_num_conv_fails
- Returns:
Protected Functions
-
void initialize()
initialize
Protected Attributes
-
SUNNonlinearSolver solver = nullptr
the wrapper solver
-
explicit SUNNonLinSolWrapper(SUNNonlinearSolver sol)