roadrunner  2.6.0
Fast simulator for SBML models
ModelGeneratorContext.h
1 /*
2  * ModelGeneratorContext.h
3  *
4  * Created on: Jun 18, 2013
5  *
6  * Author: Andy Somogyi,
7  * email decode: V1 = "."; V2 = "@"; V3 = V1;
8  * andy V1 somogyi V2 gmail V3 com
9  */
10 
11 #ifndef ModelGeneratorContext_H_
12 #define ModelGeneratorContext_H_
13 
14 #include "LLVMIncludes.h"
15 #include "LLVMModelDataSymbols.h"
16 #include "LLVMModelSymbols.h"
17 #include "Random.h"
18 #include <sbml/Model.h>
19 #include <sbml/SBMLDocument.h>
20 #include <string>
21 #include <memory>
22 
23 
24 #ifdef _MSC_VER
25 #pragma warning(disable: 4146)
26 #pragma warning(disable: 4141)
27 #pragma warning(disable: 4267)
28 #pragma warning(disable: 4624)
29 #pragma warning(disable: 4244)
30 #endif
31 
32 #include "llvm/IR/LegacyPassManager.h"
33 #include "Jit.h"
34 
35 #ifdef _MSC_VER
36 #pragma warning(default: 4146)
37 #pragma warning(default: 4141)
38 #pragma warning(default: 4267)
39 #pragma warning(default: 4624)
40 #pragma warning(default: 4244)
41 #endif
42 
43 namespace libsbml {
44  class SBMLDocument;
45 
46  class Model;
47 }
48 
49 namespace rr {
50  namespace conservation {
51  class ConservedMoietyConverter;
52  }
53 }
54 
55 namespace rrllvm {
56 
57  class ModelResources;
58 
59  class Jit;
60 
61 
96  public:
102  const libsbml::SBMLDocument *_doc,
103  unsigned options,
104  std::unique_ptr<Jit> jitEngine);
105 
112 
114 
115  const LLVMModelDataSymbols &getModelDataSymbols() const;
116 
117  const LLVMModelSymbols &getModelSymbols() const;
118 
119  const libsbml::SBMLDocument *getDocument() const;
120 
121  const libsbml::Model *getModel() const;
122 
123  const std::vector<libsbml::ASTNode*>* getPiecewiseTriggers() const;
124 
125  size_t getNumPiecewiseTriggers() const;
126 
127  Jit *getJitNonOwning() const;
128 
142  void transferObjectsToResources(std::shared_ptr<rrllvm::ModelResources> modelResources);
143 
144  bool getConservedMoietyAnalysis() const;
145 
146  bool useSymbolCache() const;
147 
148  unsigned getOptions() const {
149  return options;
150  }
151 
158  Random *getRandom() const;
159 
160  private:
161 
166  libsbml::SBMLDocument *ownedDoc;
167 
171  const libsbml::SBMLDocument *doc;
172 
173  std::vector<libsbml::ASTNode*> mPiecewiseTriggers;
174 
175  const LLVMModelDataSymbols *symbols;
176 
181  std::unique_ptr<LLVMModelSymbols> modelSymbols;
182 
183  const libsbml::Model *model;
184 
208  Random *random;
209 
210  unsigned options;
211 
215  std::unique_ptr<Jit> jit;
216 
221  std::unique_ptr<rr::conservation::ConservedMoietyConverter> moietyConverter;
222 
226  void addAllPiecewiseTriggers(const libsbml::Model* model);
227 
231  void addPiecewiseTriggersFrom(const libsbml::ASTNode* node);
232 
236  bool containsPiecewise(const libsbml::ASTNode* node);
237 
241  void clearPiecewiseTriggers();
242 
246  void cleanup();
247  };
248 
249 
250  LLVMModelData *createModelData(const rrllvm::LLVMModelDataSymbols &symbols, const Random *random, uint numPiecewiseTriggers);
251 
252 
253 } /* namespace rr */
254 #endif /* ModelGeneratorContext_H_ */
Definition: rrRandom.h:14
superclass of all Jit types.
Definition: Jit.h:150
stores the names of all the symbols in the sbml model and thier indexes in the ModelData arrays.
Definition: LLVMModelDataSymbols.h:128
Hold all the un-evaluated symbolic inforamtion in the model.
Definition: LLVMModelSymbols.h:26
All LLVM code generating objects basically need at a minimum three things to operate:
Definition: ModelGeneratorContext.h:95
ModelGeneratorContext()
does not attach to any sbml doc,
Definition: ModelGeneratorContext.cpp:212
Random * getRandom() const
get a pointer to the random object.
Definition: ModelGeneratorContext.cpp:227
void transferObjectsToResources(std::shared_ptr< rrllvm::ModelResources > modelResources)
A lot can go wrong in the process of generating a model from an sbml doc.
Definition: ModelGeneratorContext.cpp:390
A data structure that is that allows data to be exchanged with running SBML models.
Definition: LLVMModelData.h:47