roadrunner
2.6.0
Fast simulator for SBML models
|
Hold all the un-evaluated symbolic inforamtion in the model. More...
#include <LLVMModelSymbols.h>
Classes | |
struct | ReactionSymbols |
hold the symbols that belong to a reactions. More... | |
Public Member Functions | |
LLVMModelSymbols (libsbml::Model const *m, LLVMModelDataSymbols const &sym) | |
libsbml::ASTNode * | createStoichiometryNode (int row, int col) const |
create an ASTNode for the species id / reaction id std::pair. More... | |
const SymbolForest & | getAssigmentRules () const |
assignment rules are always active | |
const SymbolForest & | getInitialAssignmentRules () const |
only valid before the model is started. More... | |
const SymbolForest & | getInitialValues () const |
contains the intial symbols along with the intial assignments which override the initial values. | |
const SymbolForest & | getRateRules () const |
Protected Types | |
enum | SpeciesReferenceType { Reactant , Product } |
typedef std::list< const libsbml::ASTNode * > | ASTNodeList |
a species can appear more than once in a reaction, there can be several stoichiometries for a species both as a product and as a reactant, for example, we could have More... | |
typedef std::map< int, ASTNodeList > | IntASTNodeListMap |
we reference the reactants and products by the species index | |
Protected Member Functions | |
virtual bool | visit (const libsbml::Compartment &x) |
virtual bool | visit (const libsbml::Species &x) |
virtual bool | visit (const libsbml::AssignmentRule &x) |
virtual bool | visit (const libsbml::InitialAssignment &x) |
InitialAssignments override the initial value specified in the element definition. More... | |
virtual bool | visit (const libsbml::RateRule &rule) |
virtual bool | visit (const libsbml::Reaction &x) |
visit the reactions so we can get all the SpeciesReferences and stuff them in the initialConditions std::map. | |
virtual bool | visit (const libsbml::Rule &x) |
tell the acceptor to process all rules, even the ones we don't handle so the iteration continues over all rules. More... | |
virtual bool | visit (const libsbml::Event &event) |
fatal error if we find these, event not supported yet | |
void | processElement (SymbolForest ¤tSymbols, const libsbml::SBase *element, const libsbml::ASTNode *math) |
The only differences in how initialAssigments and assignmentRules are handled is whether they are stuffed in the initialAssigment or assignmentRules maps. More... | |
void | processSpecies (SymbolForest ¤tSymbols, const libsbml::Species *element, const libsbml::ASTNode *math) |
specialized logic to write both amounts and concentrations here. | |
const libsbml::ASTNode * | getSpeciesReferenceStoichMath (const libsbml::SpeciesReference *reference) |
get the MathML element for a SpeciesReference if it is set, otherwise, create a ASTNode from its stoichiometry field. | |
Protected Attributes | |
SymbolForest | initialValues |
SymbolForest | assignmentRules |
SymbolForest | initialAssignmentRules |
SymbolForest | rateRules |
ASTNodeFactory | nodes |
all ASTNodes we create are stored here. | |
std::vector< ReactionSymbols > | reactions |
these are indexed by reaction index. More... | |
Hold all the un-evaluated symbolic inforamtion in the model.
TODO: some real docs...
|
protected |
a species can appear more than once in a reaction, there can be several stoichiometries for a species both as a product and as a reactant, for example, we could have
A + 2A + B -> A + C
In this case, we calculate the stochiometry for each species as S(A) = -1 -2 + 1 = -1 S(B) = -1 + 0 = -1 S(C) = 0 + 1 = 1
Stochiometries can however change, so we have to delay evaluation of them – if we have a named species reference, we add an ASTNode with a reference to it: this way, when it get evaluated, we can look up to see if we have any assigment rules or intitial assigments overriding the original value. each species has a list of stoichiometry nodes, this way it can appear more than once.
ASTNode * rrllvm::LLVMModelSymbols::createStoichiometryNode | ( | int | row, |
int | col | ||
) | const |
create an ASTNode for the species id / reaction id std::pair.
This assembles the mess of items stored in the reactions array.
const SymbolForest & rrllvm::LLVMModelSymbols::getInitialAssignmentRules | ( | ) | const |
only valid before the model is started.
There cannot be both an InitialAssignment and an AssignmentRule for the same symbol in a model, because both kinds of constructs apply prior to and at the start of simulated time allowing both to exist for a given symbol would result in indeterminism.
conservation: In the case of conserved moieties, these are species that are defined by assignment rules, they however can have initial values defined by initial value or assignment rules.
So, at run time, the assignment rule is active, however before run time, the initial value or initial assignment rule is active.
|
protected |
The only differences in how initialAssigments and assignmentRules are handled is whether they are stuffed in the initialAssigment or assignmentRules maps.
This figures out what they refer to, and stuffs the AST in the appropriate std::map.
|
protectedvirtual |
InitialAssignments override the initial value specified in the element definition.
The actions of all InitialAssignment objects are in general terms the same, but differ in the precise details depending on the type of variable being set:
|
protectedvirtual |
|
protectedvirtual |
tell the acceptor to process all rules, even the ones we don't handle so the iteration continues over all rules.
The left-hand side (the variable attribute) of an assignment rule can refer to the identifier of a Species, SpeciesReference, Compartment, or global Parameter object in the model (but not a reaction)
|
protected |
these are indexed by reaction index.
the stoichiometry matrix is a N species x N reaction matrix.