libRoadRunner C++ API  1.3
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Static Public Member Functions | List of all members
rr::EulerIntegrator Class Reference

#include <EulerIntegrator.h>

Inherits rr::Integrator.

Public Member Functions

 EulerIntegrator (ExecutableModel *m)
 
virtual ~EulerIntegrator ()
 
virtual double integrate (double t0, double h)
 
virtual void restart (double t0)
 
virtual void setListener (IntegratorListenerPtr p)
 
virtual IntegratorListenerPtr getListener ()
 
virtual std::string toString () const
 
virtual std::string toRepr () const
 
virtual std::string getName () const
 
std::string getDescription () const
 Get the description for this integrator. More...
 
std::string getHint () const
 Get the hint for this integrator. More...
 
void resetSettings ()
 Reset all integrator settings to their respective default values. More...
 
IntegrationMethod getIntegrationMethod () const
 Always deterministic for Euler. More...
 
virtual void setItem (const std::string &key, const rr::Variant &value)
 
virtual Variant getItem (const std::string &key) const
 
virtual bool hasKey (const std::string &key) const
 
virtual int deleteItem (const std::string &key)
 
virtual std::vector< std::string > getKeys () const
 

Static Public Member Functions

static std::string getEulerName ()
 Get the name for this integrator. More...
 
static std::string getEulerDescription ()
 Get the description for this integrator. More...
 
static std::string getEulerHint ()
 Get the hint for this integrator. More...
 
static const DictionarygetIntegratorOptions ()
 

Detailed Description

An example class intended to show how to create an Integrator. This class implements the most basic possible integration algorithm: the forward Euler method.

This integrator should not really be used in practice as the forward Euler algorithm is highly unstable and will seldomly yield numerically correct values.

This class also has two dummy variables, exampleParameter1 and exampleParameter2. These serve as examples of how to use the Dictionary interface to get/set various tuning paramters that an Integrator might have. These values will be displayed when the toString method is called, typically by Python.

An example of calling simulate in Python, and the results of specifying the parameters as keyword arguments is

r.simulate(integrator='euler', exampleParameter1=123456, exampleParameter2='some value');
print(r.integrator)
< roadrunner.EulerIntegrator()
{ 'this' : 0x101f28350
'exampleParameter1' : 123456
'exampleParameter2' : some value
}>

Constructor & Destructor Documentation

rr::EulerIntegrator::EulerIntegrator ( ExecutableModel m)
inline

Creates a new EulerIntegrator.

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.

Parameters
ma borrowed reference to an existing ExecutableModel object.
oa reference to a SimulatOptions object where the configuration parameters will be read from.
virtual rr::EulerIntegrator::~EulerIntegrator ( )
inlinevirtual

delete any memory we allocated

Member Function Documentation

virtual int rr::EulerIntegrator::deleteItem ( const std::string &  key)
inlinevirtual

remove a value, this example class does not support deleting keys, so just raise an exception if someone tries to do so.

std::string rr::EulerIntegrator::getDescription ( ) const
inlinevirtual

Get the description for this integrator.

Author
JKM
Note
Delegates to getDescription

Implements rr::Solver.

static std::string rr::EulerIntegrator::getEulerDescription ( )
inlinestatic

Get the description for this integrator.

Author
JKM
static std::string rr::EulerIntegrator::getEulerHint ( )
inlinestatic

Get the hint for this integrator.

Author
JKM
static std::string rr::EulerIntegrator::getEulerName ( )
inlinestatic

Get the name for this integrator.

Author
JKM
std::string rr::EulerIntegrator::getHint ( ) const
inlinevirtual

Get the hint for this integrator.

Author
JKM
Note
Delegates to getHint

Implements rr::Solver.

IntegrationMethod rr::EulerIntegrator::getIntegrationMethod ( ) const
inline

Always deterministic for Euler.

Author
JKM
static const Dictionary* rr::EulerIntegrator::getIntegratorOptions ( )
inlinestatic

list of keys that this integrator supports.

This method is called by the IntegratorFactory to build a list of all the options that all the integrators support.

virtual Variant rr::EulerIntegrator::getItem ( const std::string &  key) const
inlinevirtual

Get a value.

This integrator only supports two parameters, those are the only valid ones to get.

virtual std::vector<std::string> rr::EulerIntegrator::getKeys ( ) const
inlinevirtual

list of keys in this object.

virtual IntegratorListenerPtr rr::EulerIntegrator::getListener ( )
inlinevirtual

get the integrator listener

virtual std::string rr::EulerIntegrator::getName ( ) const
inlinevirtual

get the name of this integrator

Implements rr::Solver.

virtual bool rr::EulerIntegrator::hasKey ( const std::string &  key) const
inlinevirtual

is there a key matching this name.

virtual double rr::EulerIntegrator::integrate ( double  t0,
double  h 
)
inlinevirtual

integrates the model from t0 to t0 + hstep

In this implementation, this performs a basic forward Euler step. This method also demonstrates how to notify the listener that a timestep has completed.

Returns
the end time.
void rr::EulerIntegrator::resetSettings ( )
inlinevirtual

Reset all integrator settings to their respective default values.

Author
JKM

Reimplemented from rr::Solver.

virtual void rr::EulerIntegrator::restart ( double  t0)
inlinevirtual

This simple integrator has nothing to reset, so do nothing here

virtual void rr::EulerIntegrator::setItem ( const std::string &  key,
const rr::Variant value 
)
inlinevirtual

sets the value for a key.

This integrator only supports 2 values, so those are the only two valid items to set.

virtual void rr::EulerIntegrator::setListener ( IntegratorListenerPtr  p)
inlinevirtual

Clients may register a listener to listen for sbml events and time step events.

virtual std::string rr::EulerIntegrator::toRepr ( ) const
inlinevirtual

get a short descriptions of this object, compatable with python repr.

Reimplemented from rr::Solver.

virtual std::string rr::EulerIntegrator::toString ( ) const
inlinevirtual

get a description of this object, compatable with python str

Reimplemented from rr::Solver.


The documentation for this class was generated from the following file: