Class CVodeIntegrator#
Defined in File Integrator.h
Inheritance Relationships#
Base Type#
public Karana::Integrators::SundialsImplicitIntegrator(Class SundialsImplicitIntegrator)
Class Documentation#
-
class CVodeIntegrator : public Karana::Integrators::SundialsImplicitIntegrator#
The multistep CVode integrator from the SUNDIALS suite.
Public Functions
-
CVodeIntegrator(const IntegratorType &integrator_type, size_t nstates, DerivativeFunction f, const CVodeIntegrator::IntegratorOptions *options = nullptr)#
Constructor.
Struct with options for this integrator
- Parameters:
nstates – The number of states to integrate.
f – The derivative function to calculate the derivative of the states.
integrator_type – The type of cvode integrator to use.
options – The integrator options.
-
virtual ~CVodeIntegrator()#
-
virtual const kc::ks_ptr<Integrator::IntegratorOptions> getOptions() const override#
Get the options associated with the integrator.
- Returns:
The options associated with the integrator.
-
virtual km::Vec getErrorContributions() const override#
Get the error contribution for each state.
- Returns:
A vector with the error contribution for each state.
Public Static Functions
-
static kc::ks_ptr<CVodeIntegrator> create(const IntegratorType &integrator_type, size_t nstates, DerivativeFunction deriv_fn, const CVodeIntegrator::IntegratorOptions *options = nullptr)#
Factory method for creating CVodeIntegrator instances.
- Parameters:
integrator_type – the type of integrator to create
nstates – the length of the states vector
deriv_fn – the derivative function
options – options for the integrator
- Returns:
a new CVode Integrator instance
Protected Functions
-
virtual void _initialize() final#
Initialize the implementation-specific data structures.
-
virtual void _freeMemory() final#
Free all memory, both common and implementation-specific. Must call _freeCommonMemory() to clear shared data structures.
-
virtual void _applyTolerances() final#
Copy tolerances from internal options into implementation data structures.
-
virtual void _reInit() final#
Reinitialize internal implementation state for a soft reset.
-
virtual void _advanceTo(double t_end) final#
Advances implementation to a target time; called by parent class.
- Parameters:
t_end –
-
virtual void _bindSolvers() final#
Bind internal nonlinear (and possibly linear) solvers to the implementation solver.
Protected Attributes
-
void *_cvode_mem#
Memory used by the cvode integrator.
-
kc::ks_ptr<CVodeIntegrator::IntegratorOptions> _opts#
CVode-specific integrator options.
Protected Static Functions
-
static int _proj_fn(sunrealtype t, N_Vector ycur, N_Vector corr, sunrealtype eps_proj, N_Vector err, void *user_data)#
Function to projects the state back onto a constraint manifold.
- Parameters:
t – The time to use when calculating the derivative.
ycur – The current integrator state.
corr – A correction vector c that gets populated such that (ycur + c) lives on the constraint manifold.
eps_proj – Tolerance for projection routine to use internally.
err – Data used to by the derivative function.
user_data – Data used to by the derivative function.
- Returns:
An error code indicating if the call was successful or not.
-
CVodeIntegrator(const IntegratorType &integrator_type, size_t nstates, DerivativeFunction f, const CVodeIntegrator::IntegratorOptions *options = nullptr)#