Simpact Cyan
Population based event driven simulation using mNRM
simplestate.h
Go to the documentation of this file.
1 #ifndef SIMPLESTATE_H
2 
3 #define SIMPLESTATE_H
4 
9 #include "state.h"
10 #include <vector>
11 
13 class EventBase;
14 
86 class SimpleState : public State
87 {
88 public:
92  SimpleState(bool parallel, GslRandomNumberGenerator *pRng);
93  ~SimpleState();
94 protected:
96  virtual const std::vector<EventBase *> &getCurrentEvents() const { return m_dummyEventList; }
97 
101  virtual void onFiredEvent(EventBase *pEvt, int position) { }
102 private:
103  bool initEventTimes() const;
104  EventBase *getNextScheduledEvent(double &dt);
105  void advanceEventTimes(EventBase *pScheduledEvent, double dt);
106  void onFiredEvent(EventBase *pEvt);
107 
108 #ifdef STATE_SHOW_EVENTS
109  virtual void showEvents() { } // For debugging
110 #endif // STATE_SHOW_EVENTS
111 
112  std::vector<EventBase *> m_dummyEventList;
113  const std::vector<EventBase *> *m_pTmpEventList;
114 
115  int m_eventPos;
116 
117  // for parallel version
118  std::vector<double> m_dtMinValues;
119  std::vector<int> m_minPosValues;
120  bool m_parallel;
121 };
122 
123 #endif // SIMPLESTATE_H
124 
SimpleState(bool parallel, GslRandomNumberGenerator *pRng)
Constructor of this class, specifying whether a parallel version should be used to speed things up a ...
Definition: simplestate.cpp:13
This class both describes the simulation state and contains the core algorithm (as shown on the main ...
Definition: state.h:40
virtual const std::vector< EventBase * > & getCurrentEvents() const
This function should return the list of events that are currently scheduled.
Definition: simplestate.h:96
This class allows you to generate random numbers, and uses the GNU Scientific Library for this...
Definition: gslrandomnumbergenerator.h:16
This is the base class for events in the mNRM algorithm.
Definition: eventbase.h:62
virtual void onFiredEvent(EventBase *pEvt, int position)
This function is called after firing the event pEvt, stored at position position in the list that was...
Definition: simplestate.h:101
A very naive implementation of the necessary functions from the State class.
Definition: simplestate.h:86