libRoadRunner C++ API  1.0.0
 All Classes Functions Variables Enumerations Enumerator Pages
Public Member Functions | List of all members
rr::ExecutableModel Class Referenceabstract

#include <rrExecutableModel.h>

Public Member Functions

virtual std::string getModelName ()=0
 
virtual void evalInitialConditions ()=0
 
virtual void reset ()=0
 
virtual int getNumDepFloatingSpecies ()=0
 
virtual int getNumFloatingSpecies ()=0
 
virtual int getNumIndFloatingSpecies ()=0
 
virtual int getFloatingSpeciesAmounts (int len, int const *indx, double *values)=0
 
virtual int getFloatingSpeciesConcentrations (int len, int const *indx, double *values)=0
 
virtual int setFloatingSpeciesConcentrations (int len, int const *indx, double const *values)=0
 
virtual int setFloatingSpeciesInitConcentrations (int len, int const *indx, double const *values)=0
 
virtual int getFloatingSpeciesInitConcentrations (int len, int const *indx, double *values)=0
 
virtual int setFloatingSpeciesInitAmounts (int len, int const *indx, double const *values)=0
 
virtual int getFloatingSpeciesInitAmounts (int len, int const *indx, double *values)=0
 
virtual int getNumBoundarySpecies ()=0
 
virtual int getBoundarySpeciesAmounts (int len, int const *indx, double *values)=0
 
virtual int getBoundarySpeciesConcentrations (int len, int const *indx, double *values)=0
 
virtual int setBoundarySpeciesConcentrations (int len, int const *indx, double const *values)=0
 
virtual int getNumGlobalParameters ()=0
 
virtual int getGlobalParameterIndex (const std::string &eid)=0
 
virtual std::string getGlobalParameterId (int index)=0
 
virtual int getGlobalParameterValues (int len, int const *indx, double *values)=0
 
virtual int getCompartmentVolumes (int len, int const *indx, double *values)=0
 
virtual int setCompartmentInitVolumes (int len, int const *indx, double const *values)=0
 
virtual int getCompartmentInitVolumes (int len, int const *indx, double *values)=0
 
virtual void getIds (int types, std::list< std::string > &ids)=0
 
virtual int getSupportedIdTypes ()=0
 
virtual double getValue (const std::string &id)=0
 
virtual void setValue (const std::string &id, double value)=0
 
virtual int getStoichiometryMatrix (int *rows, int *cols, double **data)=0
 
virtual double getStoichiometry (int speciesIndex, int reactionIndex)=0
 
virtual int getNumReactions ()=0
 
virtual int getReactionIndex (const std::string &eid)=0
 
virtual std::string getReactionId (int index)=0
 
virtual void evalReactionRates ()=0
 
virtual void setRateRuleValues (const double *rateRuleValues)=0
 
virtual void getRateRuleValues (double *rateRuleValues)=0
 
virtual int getStateVector (double *stateVector)=0
 
virtual int setStateVector (const double *stateVector)=0
 
virtual void evalModel (double time, const double *y, double *dydt=0)=0
 
virtual int getEventTriggers (int len, const int *indx, unsigned char *values)=0
 
virtual void evalEventRoots (double time, const double *y, double *gdot)=0
 
virtual ~ExecutableModel ()
 
virtual bool getConservedSumChanged ()=0
 
virtual void computeConservedTotals ()=0
 
virtual void setConservedSumChanged (bool)=0
 
virtual void convertToAmounts ()=0
 

Detailed Description

The ExecutableModel interface provides a way to access an sbml model that was compiled, JIT'd or interpreted as executable (runnable) module.

An ExecutableModel holds a ModelData structure, all the simulation values are stored in the ModelData struct, i.e. the dynamic state of the model is fully contained in the ModelData structure.

An ExecutableModel shoud also contain all of the initial condisions, rules, functions and whatever other semantic information that was specified in the sbml model.

Constructor & Destructor Documentation

virtual rr::ExecutableModel::~ExecutableModel ( )
inlinevirtual

need a virtual destructor as object implementing this interface can be deleted directly, i.e. ExecutableModel *p = createModel(...); delete p;

Member Function Documentation

virtual void rr::ExecutableModel::computeConservedTotals ( )
pure virtual
Deprecated:
compatability with C backend, does nothing anymore.
virtual void rr::ExecutableModel::convertToAmounts ( )
pure virtual
Deprecated:
The old C backend had state variables for everything, here only for compatability, does nothing in LLVM.

Only for floating species.

virtual void rr::ExecutableModel::evalEventRoots ( double  time,
const double *  y,
double *  gdot 
)
pure virtual

evaluate the event 'roots' – when events transition form triggered - non-triggered or triggered to non-triggered state.

Simplest method is to return 1 for triggered, -1 for not-triggered, so long as there is a zero crossing.

Parameters
time[in]current time
y[in]the state vector
gdot[out]result event roots, this is of length numEvents.
virtual void rr::ExecutableModel::evalInitialConditions ( )
pure virtual

evaluate the initial conditions specified in the sbml, this entails evaluating all InitialAssigments, AssigmentRules, initial values, etc...

Sets the the concentrations and ammounts to the values specified by the initial conditions, ModelData::floatingSpeciesInitConcentrations, i.e. the ModelData::floatingSpeciesAmounts[:] are set to ModelData::floatingSpeciesInitConcentrations[:] * compartment volume, and ModelData::y[:] is set to ModelData::floatingSpeciesInitConcentrations[:].

This sets the concentrations and ammounts to either initialAmount or initialConcentration (which ever exists) or 0 if they are missing. A later call to evalInitialAssignments will apply any initialAssigments to update the concentations and ammounts.

The the model state is fully set.

virtual void rr::ExecutableModel::evalModel ( double  time,
const double *  y,
double *  dydt = 0 
)
pure virtual

the state vector y is the rate rule values and floating species concentrations concatenated. y is of length numFloatingSpecies + numRateRules.

The state vector is packed such that the first n raterule elements are the values of the rate rules, and the last n floatingspecies are the floating species values.

Parameters
[in]timecurrent simulator time
[in]ystate vector, must be either null, or have a size of that speciefied by getStateVector. If y is null, then the model is evaluated using its current state. If y is not null, then the y is considered the state vector.
[out]dydtcalculated rate of change of the state vector, if null, it is ignored.
virtual void rr::ExecutableModel::evalReactionRates ( )
pure virtual

Evaluate the reaction rates using the current model state.

The reaction rates are stored in ModelData::reactionRates.

virtual int rr::ExecutableModel::getBoundarySpeciesAmounts ( int  len,
int const *  indx,
double *  values 
)
pure virtual

get the boundary species amounts

Parameters
[in]lenthe length of the indx and values arrays.
[in]indxan array of length len of boundary species to return.
[out]valuesan array of at least length len which will store the returned boundary species amounts.
virtual int rr::ExecutableModel::getBoundarySpeciesConcentrations ( int  len,
int const *  indx,
double *  values 
)
pure virtual

get the boundary species concentrations

Parameters
[in]lenthe length of the indx and values arrays.
[in]indxan array of length len of boundary species to return.
[out]valuesan array of at least length len which will store the returned boundary species amounts.
virtual int rr::ExecutableModel::getCompartmentInitVolumes ( int  len,
int const *  indx,
double *  values 
)
pure virtual

Get the initial volume of the compartments, uses the same indexing as the other compartment methods.

virtual int rr::ExecutableModel::getCompartmentVolumes ( int  len,
int const *  indx,
double *  values 
)
pure virtual

get the compartment volumes

Parameters
[in]lenthe length of the indx and values arrays.
[in]indxan array of length len of boundary species to return.
[out]valuesan array of at least length len which will store the returned boundary species amounts.
virtual bool rr::ExecutableModel::getConservedSumChanged ( )
pure virtual
Deprecated:
did something with the old C backend, obsolete now.
virtual int rr::ExecutableModel::getEventTriggers ( int  len,
const int *  indx,
unsigned char *  values 
)
pure virtual

get the event status, false if the even is not triggered, true if it is.

The reason this returns an unsigned char instead of a bool array is this array is typically stuffed into an std::vector, and std::vector<bool> is seriously broken and can not be used as a C array.

So, on every modern system I'm aware of, bool is an unsigned char, so use that data type here.

virtual int rr::ExecutableModel::getFloatingSpeciesAmounts ( int  len,
int const *  indx,
double *  values 
)
pure virtual

get the floating species amounts

Parameters
[in]lenthe length of the indx and values arrays.
[in]indxan array of length len of boundary species to return.
[out]valuesan array of at least length len which will store the returned boundary species amounts.
virtual int rr::ExecutableModel::getFloatingSpeciesConcentrations ( int  len,
int const *  indx,
double *  values 
)
pure virtual

get the floating species concentrations

Parameters
[in]lenthe length of the indx and values arrays.
[in]indxan array of length len of boundary species to return.
[out]valuesan array of at least length len which will store the returned boundary species amounts.
virtual int rr::ExecutableModel::getFloatingSpeciesInitAmounts ( int  len,
int const *  indx,
double *  values 
)
pure virtual

Get the initial amounts of the floating species, uses the same indexing as the other floating species methods.

virtual int rr::ExecutableModel::getFloatingSpeciesInitConcentrations ( int  len,
int const *  indx,
double *  values 
)
pure virtual

Get the initial concentrations of the floating species, uses the same indexing as the other floating species methods.

virtual std::string rr::ExecutableModel::getGlobalParameterId ( int  index)
pure virtual

id of the indexed global parameter.

virtual int rr::ExecutableModel::getGlobalParameterIndex ( const std::string &  eid)
pure virtual

index of the global parameter id, -1 if it does not exist.

virtual int rr::ExecutableModel::getGlobalParameterValues ( int  len,
int const *  indx,
double *  values 
)
pure virtual

get the global parameter values

Parameters
[in]lenthe length of the indx and values arrays.
[in]indxan array of length len of boundary species to return.
[out]valuesan array of at least length len which will store the returned boundary species amounts.
virtual void rr::ExecutableModel::getIds ( int  types,
std::list< std::string > &  ids 
)
pure virtual

populates a given list with all the ids that this class can accept.

Parameters
ids,:a list of strings that will be filled by this class.
types,:the types of ids that are requested. Can be set to 0xffffffff to request all the ids that this class supports. This should by a bitwise OR of the filelds in SelectionRecord::SelectionType
virtual std::string rr::ExecutableModel::getModelName ( )
pure virtual

get the name of the model

virtual int rr::ExecutableModel::getNumBoundarySpecies ( )
pure virtual

get the number of boundary species.

virtual int rr::ExecutableModel::getNumDepFloatingSpecies ( )
pure virtual

dependent species are defined by rules and the only way to change them is by changing the values on which they depend.

virtual int rr::ExecutableModel::getNumFloatingSpecies ( )
pure virtual

total number of floating species.

virtual int rr::ExecutableModel::getNumGlobalParameters ( )
pure virtual

get the number of global parameters

virtual int rr::ExecutableModel::getNumIndFloatingSpecies ( )
pure virtual

independent species do are not defined by rules, they typically participate in reactions and can have thier values set at any time.

virtual int rr::ExecutableModel::getNumReactions ( )
pure virtual

get the number of reactions the model has

virtual void rr::ExecutableModel::getRateRuleValues ( double *  rateRuleValues)
pure virtual

get the 'values' i.e. the what the rate rule integrates to, and store it in the given array.

The length of rateRuleValues obviously must be the number of rate rules we have.

virtual std::string rr::ExecutableModel::getReactionId ( int  index)
pure virtual

get the name of the specified reaction

virtual int rr::ExecutableModel::getReactionIndex ( const std::string &  eid)
pure virtual

get the index of a named reaction

Returns
>= 0 on success, < 0 on failure.
virtual int rr::ExecutableModel::getStateVector ( double *  stateVector)
pure virtual

copies the internal model state vector into the provided buffer.

Parameters
[out]stateVectora buffer to copy the state vector into, if NULL, return the size required.
Returns
the number of items coppied into the provided buffer, if stateVector is NULL, returns the length of the state vector.
virtual double rr::ExecutableModel::getStoichiometry ( int  speciesIndex,
int  reactionIndex 
)
pure virtual

Get the current stiochiometry value for the given species / reaction.

If either are not valid, NaN is returned.

virtual int rr::ExecutableModel::getStoichiometryMatrix ( int *  rows,
int *  cols,
double **  data 
)
pure virtual

allocate a block of memory and copy the stochiometric values into it, and return it.

The caller is responsible for freeing the memory that is referenced by data.

Parameters
[out]rowswill hold the number of rows in the matrix.
[out]colswill hold the number of columns in the matrix.
[out]dataa pointer which will hold a newly allocated memory block.
virtual int rr::ExecutableModel::getSupportedIdTypes ( )
pure virtual

returns a bit field of the ids that this class supports.

virtual double rr::ExecutableModel::getValue ( const std::string &  id)
pure virtual

gets the value for the given id string. The string must be a SelectionRecord string that is accepted by this class.

virtual void rr::ExecutableModel::reset ( )
pure virtual

Loads the initial conditions into the current model state.

Initial conditions may have been updated at any time externally.

virtual int rr::ExecutableModel::setBoundarySpeciesConcentrations ( int  len,
int const *  indx,
double const *  values 
)
pure virtual

set the boundary species concentrations

Parameters
[in]lenthe length of the indx and values arrays.
[in]indxan array of length len of boundary species to return.
[in]valuesan array of at least length len which will store the returned boundary species amounts.
virtual int rr::ExecutableModel::setCompartmentInitVolumes ( int  len,
int const *  indx,
double const *  values 
)
pure virtual

Set the initial volumes of the compartments.

Takes the same indices as the other compartment methods.

Note, if a compartment has an initial assignment rule, than the initial conditions value can only be set by updating the values on which it depends, it can not be set directly.

virtual void rr::ExecutableModel::setConservedSumChanged ( bool  )
pure virtual
Deprecated:
did something with old C backend, here for compatility.
virtual int rr::ExecutableModel::setFloatingSpeciesConcentrations ( int  len,
int const *  indx,
double const *  values 
)
pure virtual

set the floating species concentrations

Parameters
[in]lenthe length of the indx and values arrays.
[in]indxan array of length len of boundary species to return.
[in]valuesan array of at least length len which will store the returned boundary species amounts.
virtual int rr::ExecutableModel::setFloatingSpeciesInitAmounts ( int  len,
int const *  indx,
double const *  values 
)
pure virtual

Set the initial amounts of the floating species.

Takes the same indices as the other floating species methods.

Note, if a floating species has an initial assignment rule, than the initial conditions value can only be set by updating the values on which it depends, it can not be set directly.

virtual int rr::ExecutableModel::setFloatingSpeciesInitConcentrations ( int  len,
int const *  indx,
double const *  values 
)
pure virtual

Set the initial concentrations of the floating species.

Takes the same indices as the other floating species methods.

Note, if a floating species has an initial assignment rule, than the initial conditions value can only be set by updating the values on which it depends, it can not be set directly.

virtual void rr::ExecutableModel::setRateRuleValues ( const double *  rateRuleValues)
pure virtual

set the 'values' of the rate rules.

Rate rules are a set of rate equations, i.e dy/dt, where y is some existing model variable, i.e. volume, parameter, etc...

This function sets all of the values that the derivatives integrated to, i.e. if dy/dt is the rate of change of say a compartment volume, than this function takes that compartment volume and stores it in the appropriate place.

The length of rateRuleValues obviously must be the number of rate rules we have.

virtual int rr::ExecutableModel::setStateVector ( const double *  stateVector)
pure virtual

sets the internal model state to the provided packed state vector.

Parameters
[in]anarray which holds the packed state vector, must be at least the size returned by getStateVector.
Returns
the number of items copied from the state vector, negative on failure.
virtual void rr::ExecutableModel::setValue ( const std::string &  id,
double  value 
)
pure virtual

sets the value coresponding to the given selection stringl


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