1 #ifndef POPULATIONALGORITHMSIMPLE_H
3 #define POPULATIONALGORITHMSIMPLE_H
14 #ifdef STATE_SHOW_EVENTS
53 bool_t run(
double &tMax, int64_t &maxEvents,
double startTime = 0);
65 bool_t initEventTimes()
const;
66 const std::vector<EventBase *> &getCurrentEvents()
const {
return m_allEvents; }
67 void onFiredEvent(
EventBase *pEvt,
int position);
68 int64_t getNextEventID();
71 std::vector<EventBase *> m_allEvents;
75 #ifdef ALGORITHM_SHOW_EVENTS
78 void onAlgorithmLoop(
bool finished);
80 std::vector<EventBase *> m_eventsToRemove;
83 bool m_parallelRequested;
84 int64_t m_nextEventID;
89 inline int64_t PopulationAlgorithmSimple::getNextEventID()
91 int64_t
id = m_nextEventID++;
95 inline void PopulationAlgorithmSimple::onAboutToFire(
EventBase *pEvt)
97 #ifdef STATE_SHOW_EVENTS
101 if (m_pOnAboutToFire)
GslRandomNumberGenerator * getRandomNumberGenerator() const
Returns the random number generator that was specified in the constructor.
Definition: algorithm.h:158
double getTime() const
This function returns the current time of the simulation.
Definition: algorithm.h:155
This is the base class for events in the mNRM algorithm.
Definition: eventbase.h:56
This class allows you to generate random numbers, and uses the GNU Scientific Library for this.
Definition: gslrandomnumbergenerator.h:17
This is the base class for a person in a population-based simulation.
Definition: personbase.h:24
An interface to allow a member function PopulationAlgorithmAboutToFireInterface::onAboutToFire to be ...
Definition: populationinterfaces.h:90
virtual void onAboutToFire(PopulationEvent *pEvt)=0
If set using PopulationAlgorithmInterface::setAboutToFireAction, this function will be called right b...
An interface for a population based mNRM algorithm.
Definition: populationinterfaces.h:102
This class provides functions for a population-based simulation using the modified Next Reaction Meth...
Definition: populationalgorithmsimple.h:44
bool_t init()
Abstract function to initialize the implementation used.
Definition: populationalgorithmsimple.cpp:29
void setAboutToFireAction(PopulationAlgorithmAboutToFireInterface *pAction)
Allows you to set the action that needs to be performed before firing an event dynamically.
Definition: populationalgorithmsimple.h:62
bool_t run(double &tMax, int64_t &maxEvents, double startTime=0)
This should be called to actually start the simulation, do not call Algorithm::evolve for this.
Definition: populationalgorithmsimple.cpp:57
void onNewEvent(PopulationEvent *pEvt)
When a new event has been created, it must be injected into the simulation using this function.
Definition: populationalgorithmsimple.cpp:89
double getTime() const
Must return the simulation tilme of the algorithm.
Definition: populationalgorithmsimple.h:60
PopulationAlgorithmSimple(PopulationStateSimple &state, GslRandomNumberGenerator &rng, bool parallel)
Constructor of the class, indicating if a parallel version should be used, which random number genera...
Definition: populationalgorithmsimple.cpp:16
GslRandomNumberGenerator * getRandomNumberGenerator() const
Must return the random number generator used by the algorithm.
Definition: populationalgorithmsimple.h:63
This is the base class for events in population-based simulations.
Definition: populationevent.h:64
Population state to be used when simulating with the straightforward algorithm in PopulationAlgorithm...
Definition: populationstatesimple.h:29
A very naive implementation of the necessary functions from the Algorithm class.
Definition: simplealgorithm.h:87
Type to return true/false with error description.
Definition: booltype.h:26