roadrunner
2.6.0
Fast simulator for SBML models
|
LLVM executable model. More...
#include <LLVMExecutableModel.h>
Public Member Functions | |
virtual std::string | getExecutableModelDesc () const |
Returns a human-readable description of the code generation backend, e.g. LLVM, legacy C, etc. More... | |
LLVMExecutableModel () | |
the default ctor just zeros out all our private bits, then the main construction is handled by the model generator. | |
LLVMExecutableModel (const std::shared_ptr< ModelResources > &resources, LLVMModelData *modelData) | |
takes ownership of the LLVMModelData pointer. | |
LLVMExecutableModel (std::istream &in, uint modelGeneratorOpt) | |
virtual std::string | getModelName () |
get the name of the model | |
virtual void | setTime (double _time) |
virtual double | getTime () |
void | evalInitialConditions (uint32_t flags=0) |
evaluate the initial conditions specified in the sbml, this entails evaluating all InitialAssigments, AssigmentRules, initial values, etc... More... | |
virtual void | reset () |
call reset(options) with defaut options. | |
virtual void | reset (int options) |
reset the model accordign to a bitfield specified by the SelectionRecord::SelectionType values. | |
virtual int | getNumIndFloatingSpecies () |
independent species do are not defined by rules, they typically participate in reactions and can have thier values set at any time. | |
virtual int | getNumDepFloatingSpecies () |
dependent species are defined by rules and the only way to change them is by changing the values on which they depend. | |
virtual int | getNumFloatingSpecies () |
total number of floating species. | |
virtual int | getNumBoundarySpecies () |
get the number of boundary species. | |
virtual int | getNumGlobalParameters () |
get the number of global parameters | |
virtual int | getNumCompartments () |
virtual int | getCompartmentIndexForFloatingSpecies (size_t index) |
virtual int | getCompartmentIndexForBoundarySpecies (size_t index) |
virtual int | getGlobalParameterValues (size_t len, int const *indx, double *values) |
get the global parameter values More... | |
virtual int | setGlobalParameterValues (size_t len, int const *indx, const double *values) |
virtual int | setGlobalParameterValues (size_t len, int const *indx, const double *values, bool strict) |
virtual int | getNumReactions () |
get the number of reactions the model has | |
virtual int | getReactionRates (size_t len, int const *indx, double *values) |
get the std::vector of reaction rates. More... | |
virtual int | getCompartmentVolumes (size_t len, int const *indx, double *values) |
get the compartment volumes More... | |
virtual int | getNumRateRules () |
virtual std::vector< std::string > | getRateRuleSymbols () const |
Gets the symbols defined by rate rules, i.e. returns all x such that x' = f(x) is a rule which defines parameter x. More... | |
virtual void | getRateRuleValues (double *rateRuleValues) |
copy (but do not evaluate) existing rate rules values into a buffer. | |
virtual std::string | getStateVectorId (size_t index) |
get the id of an element of the state std::vector. | |
virtual int | getStateVector (double *stateVector) |
copies the internal model state std::vector into the provided buffer. More... | |
virtual int | setStateVector (const double *stateVector) |
sets the internal model state to the provided packed state std::vector. More... | |
virtual void | getStateVectorRate (double time, const double *y, double *dydt=0) |
where most of the juicy bits occur. More... | |
virtual void | testConstraints () |
virtual std::string | getInfo () |
virtual int | getFloatingSpeciesIndex (const std::string &) |
virtual std::string | getFloatingSpeciesId (size_t index) |
virtual int | getBoundarySpeciesIndex (const std::string &) |
virtual std::string | getBoundarySpeciesId (size_t index) |
virtual int | getFloatingSpeciesAmounts (size_t len, int const *indx, double *values) |
get the floating species amounts More... | |
virtual int | getFloatingSpeciesAmountRates (size_t len, int const *indx, double *values) |
get the floating species amount rates More... | |
virtual int | getFloatingSpeciesConcentrationRates (size_t len, int const *indx, double *values) |
get the floating species concentration rates More... | |
virtual int | getFloatingSpeciesConcentrations (size_t len, int const *indx, double *values) |
get the floating species concentrations More... | |
virtual int | setFloatingSpeciesConcentrations (size_t len, int const *indx, double const *values) |
set the floating species concentrations More... | |
virtual int | setFloatingSpeciesAmounts (size_t len, int const *indx, const double *values) |
virtual int | setFloatingSpeciesAmounts (size_t len, int const *indx, const double *values, bool strict) |
virtual int | getBoundarySpeciesAmounts (size_t len, int const *indx, double *values) |
get the boundary species amounts More... | |
virtual int | getBoundarySpeciesConcentrations (size_t len, int const *indx, double *values) |
get the boundary species concentrations More... | |
virtual int | setBoundarySpeciesConcentrations (size_t len, int const *indx, double const *values) |
get the boundary species concentrations More... | |
virtual int | setBoundarySpeciesAmounts (size_t len, int const *indx, double const *values) |
get the boundary species amounts More... | |
virtual int | setBoundarySpeciesAmounts (size_t len, int const *indx, double const *values, bool strict) |
virtual int | getGlobalParameterIndex (const std::string &) |
index of the global parameter id, -1 if it does not exist. | |
virtual std::string | getGlobalParameterId (size_t) |
id of the indexed global parameter. | |
virtual int | getCompartmentIndex (const std::string &) |
virtual std::string | getCompartmentId (size_t) |
virtual int | getReactionIndex (const std::string &) |
get the index of a named reaction More... | |
virtual std::string | getReactionId (size_t) |
get the name of the specified reaction | |
virtual int | getStoichiometryIndex (const std::string &) |
get the index of a named stoichiometry More... | |
virtual int | getStoichiometryIndex (const std::string &speciesId, const std::string &reactionId) |
get the index of a named stoichiometry More... | |
virtual std::string | getStoichiometryId (size_t) |
get the name of the specified stoichiometry | |
virtual void | print (std::ostream &stream) |
virtual int | getNumConservedMoieties () |
virtual int | getConservedMoietyIndex (const std::string &name) |
virtual std::string | getConservedMoietyId (size_t index) |
virtual int | getConservedMoietyValues (size_t len, int const *indx, double *values) |
virtual int | setConservedMoietyValues (size_t len, int const *indx, const double *values) |
virtual int | setCompartmentVolumes (size_t len, int const *indx, const double *values) |
virtual int | setCompartmentVolumes (size_t len, int const *indx, const double *values, bool strict) |
virtual int | setStoichiometries (size_t len, int const *indx, const double *values) |
virtual int | setStoichiometries (size_t len, int const *indx, const double *values, bool strict) |
virtual int | setStoichiometry (int index, double value) |
virtual int | setStoichiometry (int speciesIndex, int reactionIndex, double value) |
virtual double | getStoichiometry (int index) |
Get the current stiochiometry value with the given index. More... | |
virtual double | getStoichiometry (int speciesIndex, int reactionIndex) |
Get the current stiochiometry value for the given species / reaction. More... | |
virtual int | setFloatingSpeciesInitConcentrations (size_t len, const int *indx, double const *values) |
Set the initial concentrations of the floating species. More... | |
virtual int | setBoundarySpeciesInitConcentrations (size_t len, const int *indx, double const *values) |
Set the initial concentrations of the boundary species. More... | |
virtual int | getFloatingSpeciesInitConcentrations (size_t len, const int *indx, double *values) |
Get the initial concentrations of the floating species, uses the same indexing as the other floating species methods. | |
virtual int | getBoundarySpeciesInitConcentrations (size_t len, const int *indx, double *values) |
Get the initial concentrations of the boundary species, uses the same indexing as the other boundary species methods. | |
virtual int | setFloatingSpeciesInitAmounts (size_t len, const int *indx, double const *values) |
Set the initial amounts of the floating species. More... | |
virtual int | setBoundarySpeciesInitAmounts (size_t len, const int *indx, double const *values) |
Set the initial amounts of the boundary species. More... | |
virtual int | getFloatingSpeciesInitAmounts (size_t size_t, const int *indx, double *values) |
Get the initial amounts of the floating species, uses the same indexing as the other floating species methods. | |
virtual int | getBoundarySpeciesInitAmounts (size_t size_t, const int *indx, double *values) |
Get the initial amounts of the boundary species, uses the same indexing as the other boundary species methods. | |
virtual int | setCompartmentInitVolumes (size_t len, const int *indx, double const *values) |
Set the initial volumes of the compartments. More... | |
virtual int | getCompartmentInitVolumes (size_t len, const int *indx, double *values) |
Get the initial volume of the compartments, uses the same indexing as the other compartment methods. | |
virtual int | setGlobalParameterInitValues (size_t len, const int *indx, double const *values) |
Set the initial value of the global parameter. More... | |
virtual int | getGlobalParameterInitValues (size_t len, const int *indx, double *values) |
Get the initial amounts of the global parameter, uses the same indexing as the other global parameter methods. | |
virtual void | getIds (int types, std::list< std::string > &ids) |
populates a given list with all the ids that this class can accept. | |
virtual int | getSupportedIdTypes () |
returns a bit field of the ids that this class supports. | |
virtual double | getValue (const std::string &id) |
gets the value for the given id std::string. More... | |
virtual void | setValue (const std::string &id, double value) |
sets the value coresponding to the given selection stringl | |
virtual void | setRandomSeed (int64_t) |
set the seed used by the random number generator. More... | |
virtual int64_t | getRandomSeed () |
get the seed used by the RNG. | |
virtual double | getRandom () |
Get a uniform random number between 0 and 1 created by the RNG. More... | |
virtual int | getNumEvents () |
virtual int | getEventTriggers (size_t len, const int *indx, unsigned char *eventState) |
Get status of event triggers. More... | |
virtual int | applyEvents (double timeEnd, const unsigned char *previousEventState, const double *initialState, double *finalState) |
erases expired events, and applies ripe events as long as we have ripe events. | |
virtual void | getEventRoots (double time, const double *y, double *gdot) |
evaluate the event 'roots' – when events transition form triggered - non-triggered or triggered to non-triggered state. More... | |
virtual void | getPiecewiseTriggerRoots (double time, const double *y, double *gdot) |
virtual double | getNextPendingEventTime (bool pop) |
virtual int | getPendingEventSize () |
virtual void | resetEvents () |
double | getEventDelay (size_t event) |
double | getEventPriority (size_t event) |
bool | getEventTrigger (size_t event) |
bool | getEventUseValuesFromTriggerTime (size_t event) |
bool | getEventInitialValue (size_t event) |
bool | getEventPersistent (size_t event) |
size_t | getEventBufferSize (size_t event) |
void | getEventData (size_t eventId, double *data) |
void | assignEvent (size_t eventId, double *data) |
assign or apply the event using the given data. | |
bool | getEventTieBreak (size_t eventA, size_t eventB) |
virtual int | getEventIndex (const std::string &eid) |
Gets the index for an event id. More... | |
virtual std::string | getEventId (size_t index) |
virtual void | getEventIds (std::list< std::string > &out) |
virtual int | getNumPiecewiseTriggers () |
We do root-finding for 'piecewise triggers': those times in a piecewise function that transition from one condition to the next. | |
virtual void | getAssignmentRuleIds (std::list< std::string > &out) |
virtual void | getRateRuleIds (std::list< std::string > &out) |
virtual void | getInitialAssignmentIds (std::list< std::string > &out) |
virtual void | setEventListener (size_t index, rr::EventListenerPtr eventHandler) |
virtual rr::EventListenerPtr | getEventListener (size_t index) |
virtual double | getFloatingSpeciesAmountRate (size_t index, const double *reactionRates) |
Get the amount rate of change for the i'th floating species given a reaction rates std::vector. More... | |
virtual int | getRateRuleRates (size_t len, int const *indx, double *values) |
calculate rate rule values. More... | |
virtual uint32_t | getFlags () const |
Get the current set of flags. | |
virtual void | setFlags (uint32_t val) |
Set certain options that determine the state of the ExecutableModel, these are listed in. | |
void | saveState (std::ostream &out) |
![]() | |
ExecutableModel () | |
Returns a human-readable description of the code generation backend, e.g. LLVM, legacy C, etc. More... | |
virtual | ~ExecutableModel () |
need a virtual destructor as object implementing this interface can be deleted directly, i.e. More... | |
void | computeAllRatesOfChange () |
for source compatability | |
virtual void | setIntegrationStartTime (double time) |
Friends | |
class | LLVMModelGenerator |
template<typename a_type , typename b_type > | |
void | copyCachedModel (a_type *src, b_type *dst) |
copy the cached model fields between a cached model, and a executable model. More... | |
Additional Inherited Members | |
![]() | |
enum | ExecutableModelFlags { INTEGRATION = (0x1 << 0) , OPTIMIZE_REACTION_RATE_SELECTION = (0x1 << 1) } |
![]() | |
void | setIntegration (bool value) |
is integration is currently proceeding. | |
![]() | |
double | mIntegrationStartTime |
LLVM executable model.
Interface to LLVM executable model.
void rrllvm::LLVMExecutableModel::evalInitialConditions | ( | uint32_t | flags = 0 | ) |
evaluate the initial conditions specified in the sbml, this entails evaluating all InitialAssigments, AssigmentRules, initial values, etc...
Then the model state is fully set.
|
virtual |
get the boundary species amounts
[in] | len | the length of the indx and values arrays. |
[in] | indx | an array of length len of boundary species to return. |
[out] | values | an array of at least length len which will store the returned boundary species amounts. |
Implements rr::ExecutableModel.
|
virtual |
get the boundary species concentrations
[in] | len | the length of the indx and values arrays. |
[in] | indx | an array of length len of boundary species to return. |
[out] | values | an array of at least length len which will store the returned boundary species amounts. |
Implements rr::ExecutableModel.
|
virtual |
get the compartment volumes
[in] | len | the length of the indx and values arrays. |
[in] | indx | an array of length len of boundary species to return. |
[out] | values | an array of at least length len which will store the returned boundary species amounts. |
Implements rr::ExecutableModel.
|
virtual |
Gets the index for an event id.
If there is no event with this id, returns -1.
Implements rr::ExecutableModel.
|
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.
[in] | time | current time |
[in] | y | the state std::vector |
[out] | gdot | result event roots, this is of length numEvents. |
Implements rr::ExecutableModel.
|
virtual |
Get status of event triggers.
When len <= 0, returns number of events. Otherwise, sets bits in eventState to the corresponding trigger.
[in] | len | The length of indx |
[in] | indx | An index into eventState |
[out] | eventState | The state of the event triggers |
Implements rr::ExecutableModel.
|
inlinevirtual |
Returns a human-readable description of the code generation backend, e.g. LLVM, legacy C, etc.
Implements rr::ExecutableModel.
|
virtual |
Get the amount rate of change for the i'th floating species given a reaction rates std::vector.
TODO: This should be merged with getFloatingSpeciesAmountRates, but that will break inteface, will do in next point release.
TODO: If the conversion factor changes in between getting the reaction rates std::vector via getReactionRates
index | index of the desired floating speceis rate. |
reactionRates | pointer to buffer of reaction rates. |
Implements rr::ExecutableModel.
|
virtual |
get the floating species amount rates
[in] | len | the length of the indx and values arrays. |
[in] | indx | an array of length len of floating species to return. |
[out] | values | an array of at least length len which will store the returned floating species amount rates. |
Implements rr::ExecutableModel.
|
virtual |
get the floating species amounts
[in] | len | the length of the indx and values arrays. |
[in] | indx | an array of length len of boundary species to return. |
[out] | values | an array of at least length len which will store the returned boundary species amounts. |
Implements rr::ExecutableModel.
|
virtual |
get the floating species concentration rates
[in] | len | the length of the indx and values arrays. |
[in] | indx | an array of length len of floating species to return. |
[out] | values | an array of at least length len which will store the returned floating species concentration rates. |
Implements rr::ExecutableModel.
|
virtual |
get the floating species concentrations
[in] | len | the length of the indx and values arrays. |
[in] | indx | an array of length len of boundary species to return. |
[out] | values | an array of at least length len which will store the returned boundary species amounts. |
Implements rr::ExecutableModel.
|
virtual |
get the global parameter values
[in] | len | the length of the indx and values arrays. |
[in] | indx | an array of length len of boundary species to return. |
[out] | values | an array of at least length len which will store the returned boundary species amounts. |
Implements rr::ExecutableModel.
|
virtual |
Get a uniform random number between 0 and 1 created by the RNG.
The type of RNG can be specified in the config file with the RANDOM_GENERATOR_TYPE key.
Implements rr::ExecutableModel.
|
virtual |
calculate rate rule values.
TODO redo this function, not very effecient.
Reimplemented from rr::ExecutableModel.
|
virtual |
Gets the symbols defined by rate rules, i.e. returns all x such that x' = f(x) is a rule which defines parameter x.
Implements rr::ExecutableModel.
|
virtual |
get the index of a named reaction
Implements rr::ExecutableModel.
|
virtual |
get the std::vector of reaction rates.
len | the length of the supplied buffer, must be >= reaction rates size. |
indx | pointer to index array. If NULL, then it is ignored and the reaction rates are copied directly into the supplied buffer. |
values | pointer to user supplied buffer where rates will be stored. |
Implements rr::ExecutableModel.
|
virtual |
copies the internal model state std::vector into the provided buffer.
[out] | stateVector | a buffer to copy the state std::vector into, if NULL, return the size required. |
Implements rr::ExecutableModel.
|
virtual |
where most of the juicy bits occur.
the state std::vector y is the rate rule values and floating species concentrations concatenated. y is of length numFloatingSpecies + numRateRules.
The state std::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.
[in] | time | current simulator time |
[in] | y | state std::vector, must be of size returned by getStateVector |
[out] | dydt | calculated rate of change of the state std::vector, if null, it is ignored. |
Implements rr::ExecutableModel.
|
virtual |
Get the current stiochiometry value with the given index.
If either are not valid, NaN is returned.
Implements rr::ExecutableModel.
|
virtual |
Get the current stiochiometry value for the given species / reaction.
If either are not valid, NaN is returned.
Implements rr::ExecutableModel.
|
virtual |
get the index of a named stoichiometry
Implements rr::ExecutableModel.
|
virtual |
get the index of a named stoichiometry
Implements rr::ExecutableModel.
|
virtual |
gets the value for the given id std::string.
The std::string must be a SelectionRecord std::string that is accepted by this class.
Implements rr::ExecutableModel.
|
virtual |
get the boundary species amounts
[in] | len | the length of the indx and values arrays. |
[in] | indx | an array of length len of boundary species to return. |
[in] | values | an array of at least length len which will store the returned boundary species amounts. |
Implements rr::ExecutableModel.
|
virtual |
get the boundary species concentrations
[in] | len | the length of the indx and values arrays. |
[in] | indx | an array of length len of boundary species to return. |
[in] | values | an array of at least length len which will store the returned boundary species amounts. |
Implements rr::ExecutableModel.
|
virtual |
Set the initial amounts of the boundary species.
Takes the same indices as the other boundary species methods.
Note, if a boundary 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.
Implements rr::ExecutableModel.
|
virtual |
Set the initial concentrations of the boundary species.
Takes the same indices as the other boundary species methods.
Note, if a boundary 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.
Implements rr::ExecutableModel.
|
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.
Implements rr::ExecutableModel.
|
virtual |
set the floating species concentrations
[in] | len | the length of the indx and values arrays. |
[in] | indx | an array of length len of boundary species to return. |
[in] | values | an array of at least length len which will store the returned boundary species amounts. |
Implements rr::ExecutableModel.
|
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.
Implements rr::ExecutableModel.
|
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.
Implements rr::ExecutableModel.
|
virtual |
Set the initial value of the global parameter.
Takes the same indices as the other global parameter methods.
Implements rr::ExecutableModel.
|
virtual |
set the seed used by the random number generator.
This will by definition reset the RNG.
Implements rr::ExecutableModel.
|
virtual |
sets the internal model state to the provided packed state std::vector.
[in] | stateVector | an array which holds the packed state std::vector, must be at least the size returned by getStateVector. |
Implements rr::ExecutableModel.
|
friend |
copy the cached model fields between a cached model, and a executable model.
We don't want to have ExecutableModel inherit from CahcedModel because they do compleltly different things, and have completly differnt deletion semantics