class RK4Integrator : public rr::Integrator

A super basic 4’th order fixed step integrator.

The RungeKuttaIntegrator will be the more sophisticated, general purpose Runge-Kutta integrator which will support different orders and adaptive time stepping.

This object is mainly here as an example of creating a new Integrator.

Public Functions

RK4Integrator(ExecutableModel *m)

Creates a new RK4Integrator.

The IntegratorFactory is the ONLY object that creates integrators.

Integrators are created when the IntegratorFactory::New method is called, typically by the top level RoadRunner object.

The integrator will hold onto the ExecutableModel pointer, m, and when the integrate method is called, will advance the model object forward in time.

  • m – a borrowed reference to an existing ExecutableModel object.

  • o – a reference to a SimulatOptions object where the configuration parameters will be read from.

~RK4Integrator() override

clean up any mess.

virtual void syncWithModel(ExecutableModel *m) override

Called whenever a new model is loaded to allow integrator to reset internal state.



virtual double integrate(double t0, double tf) override

implement Integrator interface

integrates the model from t0 to tf.

virtual void restart(double t0) override

copies the state std::vector out of the model and into cvode std::vector, re-initializes cvode.

virtual std::string getName() const override

Get the name for this integrator.




Delegates to getName

virtual std::string getDescription() const override

Get the description for this integrator.




Delegates to getDescription

virtual std::string getHint() const override

Get the hint for this integrator.




Delegates to getHint

virtual Solver *construct(ExecutableModel *model) const override

construct an instance of type RK4Integrator.

implements the Registrar interface. Used in factory creation of Integrators.

virtual Setting getValue(std::string key)
virtual IntegrationMethod getIntegrationMethod() const override

Always deterministic for RK4.



virtual void resetSettings() override

Reset all integrator settings to their respective default values.



virtual void setListener(IntegratorListenerPtr) override

the integrator can hold a single listener.

If clients require multicast, they can create a multi-cast listener.

virtual IntegratorListenerPtr getListener() override

get the integrator listener

explicit Integrator(ExecutableModel *model)

Private Functions

void testRootsAtInitialTime()
void applyEvents(double timeEnd, std::vector<unsigned char> &previousEventStatus)

Private Members

unsigned stateVectorSize

set an arbitrary key

get a value. Variants are POD. is there a key matching this name. remove a value list of keys in this object.

double *k1

arrays to store function eval values.

double *k2
double *k3
double *k4
double *y
double *ytmp