roadrunner
2.6.0
Fast simulator for SBML models
|
A RoadRunner integrator based on CVODE; serves as RoadRunner's main integrator for ODEs. More...
#include <CVODEIntegrator.h>
Public Member Functions | |
CVODEIntegrator (ExecutableModel *oModel) | |
Constructor: takes an executable model, does not own the pointer. More... | |
~CVODEIntegrator () override | |
Destructor. More... | |
void | syncWithModel (ExecutableModel *m) override |
Called whenever a new model is loaded to allow integrator to reset internal state. More... | |
void | loadConfigSettings () override |
It looks like this method only get used inside resetSettings. | |
void | loadSBMLSettings (const std::string &filename) override |
Load an SBML settings file and apply the configuration options. More... | |
std::string | getName () const override |
Get the name for this integrator. More... | |
std::string | getDescription () const override |
Get the description for this integrator. More... | |
std::string | getHint () const override |
Get the hint for this integrator. More... | |
Solver * | construct (ExecutableModel *executableModel) const override |
construct an instance of type CVODEIntegrator. More... | |
IntegrationMethod | getIntegrationMethod () const override |
Always deterministic for CVODE. More... | |
void | setValue (const std::string &setting, Setting value) override |
Sets the value of an integrator setting (e.g. absolute_tolerance) More... | |
void | setMaxOrder (int newValue) |
sets the value of maximum order, which defaults to 12 for Adams (non-stiff) and 5 for BDF (Stiff). More... | |
void | setIndividualTolerance (std::string sid, double value) override |
Sets tolerance for individual species. More... | |
void | resetSettings () override |
Reset all integrator settings to their respective default values. More... | |
void | tweakTolerances () override |
Fix tolerances for SBML tests. More... | |
double | integrate (double t0, double hstep) override |
Main integration routine. More... | |
void | restart (double timeStart) override |
Reset time to zero and reinitialize model. More... | |
IntegratorListenerPtr | getListener () override |
Gets the integrator listener. More... | |
void | setListener (IntegratorListenerPtr) override |
Sets the integrator listener. More... | |
void | checkType () const |
Does a RT type check which throws if it fails, EVEN IF RTTI IS DISABLED. More... | |
void | checkVectorSize (int expected, size_t real) const |
Does a size check which throws if it fails. More... | |
void | checkIndex (int index, int size) const |
Does a index check which throws if it is out of bound. More... | |
std::string | ToString (int val) const |
Converts integer to std::string for error print. More... | |
std::string | ToString (size_t val) const |
Converts size_t to std::string for error print. More... | |
N_Vector | getStateVector () const |
getter for the internal state std::vector | |
SUNNonlinearSolver | getSolver () const |
getter for the internal Sundials linear solver object | |
void * | getCvodeMemory () const |
getter for the internal CVode memory buffer | |
std::vector< double > | getAbsoluteToleranceVector () override |
Get the absolute tolerance vector for the solver. More... | |
Integrator (ExecutableModel *model) | |
Integrator () | |
![]() | |
Integrator (ExecutableModel *model) | |
std::string | toString () const |
Return a std::string representation of the solver. More... | |
virtual std::string | toRepr () const |
Return std::string representation a la Python repr method. More... | |
void | setIntegrationStartTime (double time) |
Solver ()=default | |
Solver (ExecutableModel *model) | |
virtual void | setValue (const std::string &key, Setting value) |
Pull down the setValue from superclass. More... | |
![]() | |
Solver (ExecutableModel *model) | |
void | updateSettings (Dictionary *inputSettings) |
Update settings values. More... | |
std::vector< std::string > | getSettings () const |
Get a list of all settings for this solver. More... | |
std::unordered_map< std::string, Setting > & | getSettingsMap () |
get settings for this solver More... | |
virtual Setting | getValue (const std::string &key) const |
Get the value of an integrator setting. More... | |
virtual Setting | hasValue (const std::string &key) const |
Return true if this setting is supported by the integrator. More... | |
virtual size_t | getNumParams () const |
Get the number of parameters. More... | |
virtual std::string | getParamName (size_t n) const |
Get the name of the parameter at index n. More... | |
virtual std::string | getParamDisplayName (int n) const |
Get the display name of the parameter at index n. More... | |
virtual std::string | getParamHint (int n) const |
Get the hint of the parameter at index n. More... | |
virtual std::string | getParamDesc (int n) const |
Get the description of the parameter at index n. More... | |
virtual std::string | getValueAsString (const std::string &key) |
Wrapper for getValue which converts output to a specific type. More... | |
virtual std::string | getSettingsRepr () const |
Get the solver settings as a std::string. More... | |
virtual std::string | settingsPyDictRepr () const |
Python dictionary-style std::string representation of settings. More... | |
const std::string & | getDisplayName (const std::string &key) const |
Gets the hint associated with a given key. More... | |
const std::string & | getHint (const std::string &key) const |
Gets the hint associated with a given key. More... | |
const std::string & | getDescription (const std::string &key) const |
Gets the description associated with a given key. More... | |
Setting::TypeId | getType (const std::string &key) const |
Gets the type associated with a given key. More... | |
virtual ExecutableModel * | getModel () const |
returns the pointer to the ExecutableModel | |
virtual std::string | getName () const=0 |
Gets the name associated with this Solver type. More... | |
virtual std::string | getHint () const=0 |
Gets the hint associated with this Solver type. More... | |
virtual std::string | getDescription () const=0 |
Gets the description associated with this Solver type. More... | |
Friends | |
class | ForwardSensitivitySolver |
int | cvodeDyDtFcn (double t, N_Vector cv_y, N_Vector cv_ydot, void *f_data) |
int | cvodeEventAndPiecewiseRootFcn (double t, N_Vector y, double *gout, void *g_data) |
Additional Inherited Members | |
![]() | |
enum | IntegrationMethod { Deterministic , Stochastic , Hybrid , Other } |
![]() | |
using | SettingsList = std::vector< std::string > |
using | SettingsMap = std::unordered_map< std::string, Setting > |
using | DisplayNameMap = std::unordered_map< std::string, std::string > |
using | HintMap = std::unordered_map< std::string, std::string > |
using | DescriptionMap = std::unordered_map< std::string, std::string > |
![]() | |
SettingsList | sorted_settings |
SettingsMap | settings |
DisplayNameMap | display_names_ |
HintMap | hints |
DescriptionMap | descriptions |
![]() | |
void | addSetting (const std::string &name, const Setting &val, const std::string &display_name, const std::string &hint, const std::string &description) |
![]() | |
double | mIntegrationStartTime |
![]() | |
ExecutableModel * | mModel = nullptr |
non-owning pointer to model | |
A RoadRunner integrator based on CVODE; serves as RoadRunner's main integrator for ODEs.
Provides a wrapper around CVODE from the SUNDIALS suite. CVODE has two main solvers: an Adams-Moulton solver for non-stiff problems, and a backward differentiation formula (BDF) solver for stiff problems. See: https://computation.llnl.gov/casc/sundials/documentation/toms_sundials.pdf
|
explicit |
Constructor: takes an executable model, does not own the pointer.
|
override |
Destructor.
void rr::CVODEIntegrator::checkIndex | ( | int | index, |
int | size | ||
) | const |
Does a index check which throws if it is out of bound.
void rr::CVODEIntegrator::checkType | ( | ) | const |
Does a RT type check which throws if it fails, EVEN IF RTTI IS DISABLED.
void rr::CVODEIntegrator::checkVectorSize | ( | int | expected, |
size_t | real | ||
) | const |
Does a size check which throws if it fails.
|
overridevirtual |
construct an instance of type CVODEIntegrator.
implements the Registrar interface. Used in factory creation of Integrators.
Implements rr::Registrable.
|
overridevirtual |
Get the absolute tolerance vector for the solver.
The absolute tolerance vector is either set directly by the user as a vector, or is generated from the single absolute tolerance value (either default or set by the user) multiplied by the initial value of every element in the state vector (independent floating species, and elements controlled by rate rules). If that initial value is zero, the corresponding element of the absolute tolerance vector is the single value multiplied by the compartment volume for species, or by one for all other values.
Reimplemented from rr::Integrator.
|
overridevirtual |
Get the description for this integrator.
Implements rr::Registrable.
|
overridevirtual |
|
overridevirtual |
Always deterministic for CVODE.
Implements rr::Integrator.
|
overridevirtual |
Gets the integrator listener.
Implements rr::Integrator.
|
overridevirtual |
|
overridevirtual |
Main integration routine.
Implements rr::Integrator.
|
overridevirtual |
Load an SBML settings file and apply the configuration options.
Reimplemented from rr::Integrator.
|
overridevirtual |
Reset all integrator settings to their respective default values.
Reimplemented from rr::Solver.
|
overridevirtual |
Reset time to zero and reinitialize model.
Applies events which occur before time zero. Reinitializes CVODE and the executable model.
Implements rr::Integrator.
|
overridevirtual |
Sets tolerance for individual species.
Reimplemented from rr::Integrator.
|
overridevirtual |
Sets the integrator listener.
Implements rr::Integrator.
void rr::CVODEIntegrator::setMaxOrder | ( | int | newValue | ) |
sets the value of maximum order, which defaults to 12 for Adams (non-stiff) and 5 for BDF (Stiff).
Once a CVODEIntegrator has been created, increasing the order value beyond the original value is not possible (because the underlying sundials objects require more memory). Attempts to do so will simply be ignored.
|
overridevirtual |
Sets the value of an integrator setting (e.g. absolute_tolerance)
Values and keys are stored in the settings std::map, which is updated in every call to setValue. In addition, changing CVODE-specific parameters requires a call into the CVODE library to synchronize CVODE's internal memory with the settings std::map.
The default value is ADAMS Q MAX = 12 for the Adams-Moulton method and BDF Q MAX = 5 for the BDF method. Since maxord affects the memory requirements for the internal cvodes memory block, its value cannot be increased past its previous value.
Reimplemented from rr::Solver.
|
overridevirtual |
Called whenever a new model is loaded to allow integrator to reset internal state.
Reimplemented from rr::Integrator.
std::string rr::CVODEIntegrator::ToString | ( | int | val | ) | const |
Converts integer to std::string for error print.
std::string rr::CVODEIntegrator::ToString | ( | size_t | val | ) | const |
Converts size_t to std::string for error print.
|
overridevirtual |
Fix tolerances for SBML tests.
In order to ensure that the results of the SBML test suite remain valid, this method enforces a lower bound on tolerance values. Sets minimum absolute and relative tolerances to Config::CVODE_MIN_ABSOLUTE and Config::CVODE_MIN_RELATIVE resp.
Reimplemented from rr::Integrator.