roadrunner  2.6.0
Fast simulator for SBML models
Solver.h
Go to the documentation of this file.
1 // == PREAMBLE ================================================
2 
3 // * Licensed under the Apache License, Version 2.0; see README
4 
5 // == FILEDOC =================================================
6 
14 # ifndef RR_SOLVER_H_
15 # define RR_SOLVER_H_
16 
17 
18 #include "rrLogger.h"
19 #include "rrOSSpecifics.h"
20 #include "Dictionary.h"
21 #include "rrException.h"
22 #include "Registrable.h"
23 
24 #include "tr1proxy/rr_memory.h"
25 #include "tr1proxy/rr_unordered_map.h"
26 #include <stdexcept>
27 
28 
29 namespace rr
30 {
31  // fwd decl
32  class ExecutableModel;
33 
38  class RR_DECLSPEC Solver : public Registrable
39  {
40  public:
41 
45 
46  Solver() = default;
47 
48  explicit Solver(ExecutableModel* model);
49 
50  ~Solver() override = default;
51 
57  void updateSettings(Dictionary * inputSettings);
58 
63  std::vector<std::string> getSettings() const;
64 
71  std::unordered_map<std::string, Setting>& getSettingsMap();
72 
76  virtual void resetSettings();
77 
84  virtual Setting getValue(const std::string& key) const;
85 
90  virtual Setting hasValue(const std::string& key) const;
91 
96  virtual size_t getNumParams() const;
97 
102  virtual std::string getParamName(size_t n) const;
103 
108  virtual std::string getParamDisplayName(int n) const;
109 
114  virtual std::string getParamHint(int n) const;
115 
120  virtual std::string getParamDesc(int n) const;
121 
126  virtual std::string getValueAsString(const std::string& key);
127 
128  virtual void setValue(const std::string& key, Setting value);
129 
134  virtual std::string getSettingsRepr() const;
135 
140  virtual std::string settingsPyDictRepr() const;
141 
146  virtual std::string toString() const;
147 
152  virtual std::string toRepr() const;
153 
158  const std::string& getDisplayName(const std::string& key) const;
159 
164  const std::string& getHint(const std::string& key) const;
165 
170  const std::string& getDescription(const std::string& key) const;
171 
176  Setting::TypeId getType(const std::string& key) const;
177 
183  virtual void syncWithModel(ExecutableModel* m) = 0;
184 
185 
189  virtual ExecutableModel *getModel() const;
190 
191 
192  using SettingsList = std::vector<std::string> ;
193  using SettingsMap = std::unordered_map<std::string, Setting> ;
194  using DisplayNameMap = std::unordered_map<std::string, std::string> ;
195  using HintMap = std::unordered_map<std::string, std::string> ;
196  using DescriptionMap = std::unordered_map<std::string, std::string> ;
197 
198  SettingsList sorted_settings;
199  SettingsMap settings;
200  DisplayNameMap display_names_;
201  HintMap hints;
202  DescriptionMap descriptions;
203 
204  protected:
208  ExecutableModel* mModel = nullptr;
209 
210  void addSetting(const std::string& name, const Setting& val, const std::string& display_name, const std::string& hint, const std::string& description);
211 
212  };
213 
214 }
215 
216 # endif /* RR_INTEGRATOR_H_ */
This class is frozen, no new features A dictionary interface that objects can implement.
Definition: Dictionary.h:30
Base class for all code generation systems; allows compiling and evaluating the model.
Definition: rrExecutableModel.h:118
Handles constructing a solver and contains meta information about it.
Definition: Registrable.h:23
virtual std::string getHint() const =0
Gets the hint associated with this Solver type.
virtual std::string getName() const =0
Gets the name associated with this Solver type.
virtual std::string getDescription() const =0
Gets the description associated with this Solver type.
Store a roadrunner option (or setting) as a Variant type.
Definition: Setting.h:78
TypeId
types that correspond to the index of the position of the type in the variant template.
Definition: Setting.h:132
Base class for all integrators and steady state solvers.
Definition: Solver.h:39
virtual void syncWithModel(ExecutableModel *m)=0
Called whenever a new model is loaded to allow integrator to reset internal state.
C_DECL_SPEC bool rrcCallConv getValue(RRHandle handle, const char *symbolId, double *value)
Get the value for a given symbol, use getAvailableTimeCourseSymbols(void) for a list of symbols.
C_DECL_SPEC bool rrcCallConv setValue(RRHandle handle, const char *symbolId, const double value)
Set the value for a given symbol, use getAvailableTimeCourseSymbols(void) for a list of symbols.