11 #ifndef LLVMModelDataSymbolsH
12 #define LLVMModelDataSymbolsH
14 #include "LLVMModelData.h"
17 #include "tr1proxy/rr_memory.h"
18 #include "tr1proxy/rr_unordered_map.h"
28 class SimpleSpeciesReference;
35 enum ModelDataFields {
40 NumIndFloatingSpecies,
41 NumIndBoundarySpecies,
42 NumIndGlobalParameters,
47 NumInitFloatingSpecies,
48 NumInitBoundarySpecies,
49 NumInitGlobalParameters,
59 FloatingSpeciesAmountRates,
61 CompartmentVolumesAlias,
62 InitCompartmentVolumesAlias,
63 InitFloatingSpeciesAmountsAlias,
64 BoundarySpeciesAmountsAlias,
65 InitBoundarySpeciesAmountsAlias,
66 GlobalParametersAlias,
67 InitGlobalParametersAlias,
71 FloatingSpeciesAmountsAlias,
74 InitCompartmentVolumes,
75 InitFloatingSpeciesAmounts,
76 BoundarySpeciesAmounts,
77 InitBoundarySpeciesAmounts,
81 NotSafe_RateRuleValues,
82 NotSafe_FloatingSpeciesAmounts,
87 EventUseValuesFromTriggerTime = (0x1 << 0),
88 EventInitialValue = (0x1 << 1),
89 EventPersistent = (0x1 << 2)
131 typedef std::map<std::string, uint> StringUIntMap;
132 typedef std::map<std::string, std::vector<uint> > StringUIntVectorMap;
133 typedef std::pair<std::string, uint> StringUIntPair;
134 typedef std::unordered_map<uint, uint> UIntUIntMap;
136 enum SpeciesReferenceType
138 Reactant, Product, Modifier, MultiReactantProduct
168 SpeciesReferenceType type;
180 const std::string& getModelName()
const;
182 int getCompartmentIndex(std::string
const&)
const;
231 int getRateRuleIndex(std::string
const&)
const;
233 size_t getRateRuleSize()
const;
245 int getReactionIndex(std::string
const&)
const;
246 std::vector<std::string> getReactionIds()
const;
247 size_t getReactionSize()
const;
249 int getStoichiometryIndex(std::string
const&)
const;
250 int getStoichiometryIndex(
const std::string&,
const std::string&)
const;
251 std::vector<std::string> getStoichiometryIds()
const;
252 size_t getStoichiometrySize()
const;
255 std::vector<std::string> getGlobalParameterIds()
const;
297 size_t getBoundarySpeciesSize()
const;
299 size_t getCompartmentsSize()
const;
301 size_t getGlobalParametersSize()
const;
303 std::vector<std::string> getCompartmentIds()
const;
311 std::vector<std::string> getBoundarySpeciesIds()
const;
341 bool hasRateRule(
const std::string&
id)
const;
343 bool hasAssignmentRule(
const std::string&
id)
const;
345 bool hasInitialAssignmentRule(
const std::string&
id)
const;
347 bool isIndependentFloatingSpecies(
const std::string&
id)
const;
349 bool isIndependentBoundarySpecies(
const std::string&
id)
const;
351 bool isBoundarySpecies(
const std::string&
id)
const;
353 bool isIndependentGlobalParameter(
const std::string&
id)
const;
355 bool isIndependentCompartment(
const std::string&
id)
const;
357 bool isNamedSpeciesReference(
const std::string&
id)
const;
360 const std::string&
id);
442 std::set<std::string> conservedMoietySpeciesSet;
447 std::vector<bool> conservedMoietyGlobalParameter;
456 std::vector<uint> conservedMoietyGlobalParameterIndex;
464 UIntUIntMap floatingSpeciesToConservedMoietyIdMap;
467 StringUIntMap conservedMoietyDepSpecies;
470 StringUIntVectorMap conservedMoietyIndSpecies;
476 const std::vector<unsigned char>& getEventAttributes()
const;
533 bool isIndependentInitCompartment(
const std::string& symbol)
const;
586 size_t getInitCompartmentSize()
const;
587 size_t getInitFloatingSpeciesSize()
const;
588 size_t getInitBoundarySpeciesSize()
const;
589 size_t getInitGlobalParameterSize()
const;
591 std::vector<std::string> getEventIds()
const;
593 std::vector<std::string> getAssignmentRuleIds()
const;
595 std::vector<std::string> getRateRuleIds()
const;
597 std::vector<std::string> getInitialAssignmentIds()
const;
599 std::string getEventId(
size_t indx)
const;
601 int getEventIndex(
const std::string&
id)
const;
603 void saveState(std::ostream&)
const;
605 void loadState(std::istream&);
609 std::set<std::string> initAssignmentRules;
619 StringUIntMap initFloatingSpeciesMap;
620 StringUIntMap initBoundarySpeciesMap;
621 StringUIntMap initCompartmentsMap;
622 StringUIntMap initGlobalParametersMap;
640 uint independentInitFloatingSpeciesSize;
646 uint independentInitBoundarySpeciesSize;
651 uint independentInitGlobalParameterSize;
656 uint independentInitCompartmentSize;
661 std::vector<uint> floatingSpeciesCompartmentIndices;
666 std::vector<uint> boundarySpeciesCompartmentIndices;
673 std::string modelName;
674 StringUIntMap floatingSpeciesMap;
675 StringUIntMap boundarySpeciesMap;
676 StringUIntMap compartmentsMap;
677 StringUIntMap globalParametersMap;
684 typedef std::map<std::string, SpeciesReferenceInfo> StringRefInfoMap;
685 StringRefInfoMap namedSpeciesReferenceInfo;
690 StringUIntMap reactionsMap;
697 std::vector<uint> stoichColIndx;
702 std::vector<uint> stoichRowIndx;
708 std::vector<std::string> stoichIds;
710 std::vector<SpeciesReferenceType> stoichTypes;
716 std::set<std::string> assignmentRules;
721 StringUIntMap rateRules;
727 std::vector<bool> globalParameterRateRules;
729 size_t independentFloatingSpeciesSize;
730 size_t independentBoundarySpeciesSize;
731 size_t independentGlobalParameterSize;
732 size_t independentCompartmentSize;
737 std::vector<size_t> eventAssignmentsSize;
739 std::vector<unsigned char> eventAttributes;
744 StringUIntMap eventIds;
746 void initBoundarySpecies(
const libsbml::Model *);
754 void initFloatingSpecies(
const libsbml::Model *model,
755 bool conservedMoieties);
760 void initCompartments(
const libsbml::Model *);
769 void initGlobalParameters(
const libsbml::Model *model,
770 bool conservedMoieties);
772 void initReactions(
const libsbml::Model *model);
774 void displayCompartmentInfo();
776 void initEvents(
const libsbml::Model *model);
787 bool isValidFloatingSpeciesReference(
const libsbml::SimpleSpeciesReference*,
788 const std::string& reacOrProd);
794 void setNamedSpeciesReferenceInfo(uint row, uint column,
795 SpeciesReferenceType type);
797 void saveStringRefInfoMap(std::ostream&,
const StringRefInfoMap&)
const;
799 void loadStringRefInfoMap(std::istream&, StringRefInfoMap&);
stores the names of all the symbols in the sbml model and thier indexes in the ModelData arrays.
Definition: LLVMModelDataSymbols.h:128
int getBoundarySpeciesIndex(std::string const &id) const
Get the index of a boundary species.
Definition: LLVMModelDataSymbols.cpp:310
void print() const
initialize and allocate the buffers (including the stoich matrix) for an existing ModelData struct.
Definition: LLVMModelDataSymbols.cpp:435
size_t getIndependentFloatingSpeciesSize() const
number of fully indenpendent species, these are species that have thier dynamics fully determined by ...
Definition: LLVMModelDataSymbols.cpp:564
const std::vector< uint > & getStoichColIndx() const
the column indices of non-zero stoichiometry values
Definition: LLVMModelDataSymbols.cpp:342
SymbolIndexType getSymbolIndex(const std::string &name, int &result) const
checks to see if we have the given symbol in the sbml.
Definition: LLVMModelDataSymbols.cpp:235
const std::vector< uint > & getStoichRowIndx() const
the row indices of non-zero stoichiometry values
Definition: LLVMModelDataSymbols.cpp:337
static const char * getFieldName(ModelDataFields field)
get the textual form of the field names.
Definition: LLVMModelDataSymbols.cpp:607
std::vector< std::string > getFloatingSpeciesIds() const
the list that is returned by ExecutableModel, so order must remain constant.
Definition: LLVMModelDataSymbols.cpp:478
int getConservedMoietyGlobalParameterIndex(uint cmIndex) const
get the index of a global parameter given a conserved moiety index.
Definition: LLVMModelDataSymbols.cpp:1886
bool isIndependentInitBoundarySpecies(const std::string &symbol) const
checks if the given symbol is an init value for an independent boundary species.
Definition: LLVMModelDataSymbols.cpp:1731
bool isConservedMoietySpecies(const std::string &symbol) const
checks if the given symbol is a init value for a conserved species.
Definition: LLVMModelDataSymbols.cpp:1718
bool isRateRuleGlobalParameter(uint gid) const
is the global parameter index defined by a rate rule.
Definition: LLVMModelDataSymbols.cpp:1243
std::string getBoundarySpeciesId(size_t indx) const
get the symbolic id of the i'th boundary species.
Definition: LLVMModelDataSymbols.cpp:510
std::string getCompartmentId(size_t indx) const
get the symbolic id of the i'th compartment.
Definition: LLVMModelDataSymbols.cpp:537
const std::vector< uint > & getIndSpeciesIndexForConservedMoietyId(std::string id) const
get all the independent species for a given conserved moiety id
Definition: LLVMModelDataSymbols.cpp:1873
bool isConservedMoietyAnalysis() const
check if the conserved moiety is turned on for this model
Definition: LLVMModelDataSymbols.cpp:1922
std::list< SpeciesReferenceInfo > getStoichiometryList() const
get a list of all the non-zero entries in the stoichiometry matrix.
Definition: LLVMModelDataSymbols.cpp:421
bool isIndependentElement(const std::string &id) const
if there are no rules for an element, then they are considered independent.
Definition: LLVMModelDataSymbols.cpp:675
int getConservedMoietyIndex(const std::string &name) const
get the id of a conserved moiety given its name.
Definition: LLVMModelDataSymbols.cpp:1902
int getGlobalParameterIndex(std::string const &) const
index of a global param given its name.
Definition: LLVMModelDataSymbols.cpp:326
bool isIndependentInitElement(const std::string &symbol) const
Is this sbml element an independent initial value.
Definition: LLVMModelDataSymbols.cpp:1760
std::string getFloatingSpeciesId(size_t indx) const
get the symbolic id of the i'th floating species.
Definition: LLVMModelDataSymbols.cpp:483
size_t getConservedMoietySize() const
get the number of conserved moieties.
Definition: LLVMModelDataSymbols.cpp:1858
bool isConservedMoietyParameter(uint id) const
check if the global parameter with the given id is a conserved moiety.
Definition: LLVMModelDataSymbols.cpp:1237
bool isIndependentInitGlobalParameter(const std::string &symbol) const
has this std::string been found to be an independent init global param– is a global param and not hav...
Definition: LLVMModelDataSymbols.cpp:1747
SymbolIndexType
The model frequently looks for indices to sbml symbols.
Definition: LLVMModelDataSymbols.h:148
int getFloatingSpeciesIndex(std::string const &id, bool requireIndependent=true) const
Get the index of a floating species.
Definition: LLVMModelDataSymbols.cpp:295
size_t getEventBufferSize(size_t eventId) const
get the size (in number of doubles) of the buffer that events need to save the event data to.
Definition: LLVMModelDataSymbols.cpp:1620
size_t getIndependentBoundarySpeciesSize() const
number of boundary species not defined by rules.
Definition: LLVMModelDataSymbols.cpp:629
int getFloatingSpeciesInitIndex(const std::string &symbol) const
get the index of a floating species initial value.
Definition: LLVMModelDataSymbols.cpp:1672
int getCompartmentIndexForFloatingSpecies(size_t floatIndex) const
get the index of a compartment for a float species.
Definition: LLVMModelDataSymbols.cpp:1275
int getDepSpeciesIndexForConservedMoietyId(std::string id) const
get the dependent species for a given conserved moiety id
Definition: LLVMModelDataSymbols.cpp:1863
int getGlobalParameterInitIndex(const std::string &symbol) const
get the index of a global parameter initial value
Definition: LLVMModelDataSymbols.cpp:1706
std::string getConservedMoietyId(size_t indx) const
find the id of the given conserved moiety index.
Definition: LLVMModelDataSymbols.cpp:1896
std::string getRateRuleId(size_t indx) const
get the symbolic id of the i'th rate rule
Definition: LLVMModelDataSymbols.cpp:649
int getCompartmentIndexForBoundarySpecies(size_t floatIndex) const
get the index of a compartment for a boundary species.
Definition: LLVMModelDataSymbols.cpp:1285
size_t getIndependentGlobalParameterSize() const
number of global parameters which are not determined by rules.
Definition: LLVMModelDataSymbols.cpp:619
size_t getFloatingSpeciesSize() const
total size of all floating species.
Definition: LLVMModelDataSymbols.cpp:415
int getCompartmentInitIndex(const std::string &symbol) const
get the index of a compartment initial value
Definition: LLVMModelDataSymbols.cpp:1694
size_t getIndependentCompartmentSize() const
number of compartments which are not determined by rules.
Definition: LLVMModelDataSymbols.cpp:624
bool isIndependentInitFloatingSpecies(const std::string &symbol) const
checks if the given symbol is an init value for an independent floating species.
Definition: LLVMModelDataSymbols.cpp:1723
std::string getGlobalParameterId(size_t indx) const
find the id of the given global parameter index.
Definition: LLVMModelDataSymbols.cpp:1249
int getBoundarySpeciesInitIndex(const std::string &symbol) const
get the index of a boundary species initial value.
Definition: LLVMModelDataSymbols.cpp:1683
Base class for all code generators in RoadRunner.
info about an entry in the stoich matrix.
Definition: LLVMModelDataSymbols.h:165