roadrunner  2.6.0
Fast simulator for SBML models
RK4Integrator.h
1 /*
2  * RK4Integrator.h
3  *
4  * Created on: Jul 22, 2014
5  * Author: andy
6  */
7 
8 #ifndef RK4Integrator_H_
9 #define RK4Integrator_H_
10 
11 #include <Integrator.h>
12 #include <rrRoadRunnerOptions.h>
13 
14 namespace rr
15 {
16 
17 
28  class RK4Integrator: public Integrator
29  {
30  public:
31 
32  using Integrator::Integrator;
45 
49  ~RK4Integrator() override;
50 
56  void syncWithModel(ExecutableModel* m) override;
57 
58 
62  public:
63 
67  double integrate(double t0, double tf) override;
68 
73  void restart(double t0) override;
74 
75  // ** Meta Info ********************************************************
76 
82  std::string getName() const override;
83 
89  std::string getDescription() const override;
90 
96  std::string getHint() const override;
97 
103  Solver *construct(ExecutableModel *model) const override;
104 
105  // ** Getters / Setters ************************************************
106 
107  virtual Setting getValue(std::string key);
108 
113  IntegrationMethod getIntegrationMethod() const override;
114 
119  void resetSettings() override;
120 
121  // ** Listeners ********************************************************
122 
127  void setListener(IntegratorListenerPtr) override;
128 
132  IntegratorListenerPtr getListener() override;
133 
134  public:
135 
139 // virtual void setItem(const std::string& key, const rr::Setting& value);
140 
144 // virtual Setting getItem(const std::string& key) const;
145 
149 // virtual bool hasKey(const std::string& key) const;
150 
154 // virtual int deleteItem(const std::string& key);
155 
159 // virtual std::vector<std::string> getKeys() const;
160 
161 
162  private:
163 
164  unsigned stateVectorSize;
165 
169  double *k1, *k2, *k3, *k4, *y, *ytmp;
170 
171  void testRootsAtInitialTime();
172  void applyEvents(double timeEnd, std::vector<unsigned char> &previousEventStatus);
173 
174  };
175 
176 
177  // ** Registration *********************************************************
178 
179 
180 // class RK4IntegratorRegistrar : public Registrar {
181 // public:
182 // /**
183 // * @author JKM
184 // * @brief Gets the name associated with this integrator type
185 // */
186 // virtual std::string getName() const {
187 // return RK4Integrator::getRK4Name();
188 // }
189 //
190 // /**
191 // * @author JKM
192 // * @brief Gets the description associated with this integrator type
193 // */
194 // virtual std::string getDescription() const {
195 // return RK4Integrator::getRK4Description();
196 // }
197 //
198 // /**
199 // * @author JKM
200 // * @brief Gets the hint associated with this integrator type
201 // */
202 // virtual std::string getHint() const {
203 // return RK4Integrator::getRK4Hint();
204 // }
205 //
206 // /**
207 // * @author JKM
208 // * @brief Constructs a new integrator of a given type
209 // */
210 // virtual Integrator* construct(ExecutableModel *model) const {
211 // return new RK4Integrator(model);
212 // }
213 // };
214 
215 } /* namespace rr */
216 
217 #endif /* RK4Integrator_H_ */
RoadRunner's Gillespie SSA integrator.
Base class for all code generation systems; allows compiling and evaluating the model.
Definition: rrExecutableModel.h:118
Integrator is an abstract base class that provides an interface to specific integrator class implemen...
Definition: Integrator.h:60
A super basic 4'th order fixed step integrator.
Definition: RK4Integrator.h:29
void syncWithModel(ExecutableModel *m) override
Called whenever a new model is loaded to allow integrator to reset internal state.
Definition: RK4Integrator.cpp:30
void resetSettings() override
Reset all integrator settings to their respective default values.
Definition: RK4Integrator.cpp:217
void setListener(IntegratorListenerPtr) override
the integrator can hold a single listener.
Definition: RK4Integrator.cpp:176
double integrate(double t0, double tf) override
implement Integrator interface
Definition: RK4Integrator.cpp:70
Solver * construct(ExecutableModel *model) const override
construct an instance of type RK4Integrator.
Definition: RK4Integrator.cpp:200
IntegratorListenerPtr getListener() override
get the integrator listener
Definition: RK4Integrator.cpp:180
std::string getHint() const override
Get the hint for this integrator.
Definition: RK4Integrator.cpp:196
IntegrationMethod getIntegrationMethod() const override
Always deterministic for RK4.
Definition: RK4Integrator.cpp:212
~RK4Integrator() override
clean up any mess.
Definition: RK4Integrator.cpp:58
void restart(double t0) override
copies the state std::vector out of the model and into cvode std::vector, re-initializes cvode.
Definition: RK4Integrator.cpp:152
RK4Integrator(ExecutableModel *m)
Creates a new RK4Integrator.
Definition: RK4Integrator.cpp:21
std::string getDescription() const override
Get the description for this integrator.
Definition: RK4Integrator.cpp:189
std::string getName() const override
Get the name for this integrator.
Definition: RK4Integrator.cpp:185
Store a roadrunner option (or setting) as a Variant type.
Definition: Setting.h:78
Base class for all integrators and steady state solvers.
Definition: Solver.h:39