1 #ifndef POPULATIONALGORITHMSIMPLE_H
3 #define POPULATIONALGORITHMSIMPLE_H
49 bool_t run(
double &tMax, int64_t &maxEvents,
double startTime = 0);
61 bool_t initEventTimes()
const;
62 const std::vector<EventBase *> &getCurrentEvents()
const {
return m_allEvents; }
63 void onFiredEvent(
EventBase *pEvt,
int position);
64 int64_t getNextEventID();
65 void onAboutToFire(
EventBase *pEvt) {
if (m_pOnAboutToFire) m_pOnAboutToFire->
onAboutToFire(static_cast<PopulationEvent *>(pEvt)); }
67 std::vector<EventBase *> m_allEvents;
71 #ifdef ALGORITHM_SHOW_EVENTS
73 #endif // ALGORITHM_SHOW_EVENTS
74 void onAlgorithmLoop(
bool finished);
76 std::vector<EventBase *> m_eventsToRemove;
79 bool m_parallelRequested;
80 int64_t m_nextEventID;
85 inline int64_t PopulationAlgorithmSimple::getNextEventID()
87 int64_t
id = m_nextEventID++;
91 #endif // POPULATIONALGORITHMSIMPLE_H
Type to return true/false with error description.
Definition: booltype.h:25
virtual void onAboutToFire(PopulationEvent *pEvt)=0
If set using PopulationAlgorithmInterface::setAboutToFireAction, this function will be called right b...
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
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
Population state to be used when simulating with the straightforward algorithm in PopulationAlgorithm...
Definition: populationstatesimple.h:28
double getTime() const
Must return the simulation tilme of the algorithm.
Definition: populationalgorithmsimple.h:56
This class allows you to generate random numbers, and uses the GNU Scientific Library for this...
Definition: gslrandomnumbergenerator.h:16
bool_t init()
Abstract function to initialize the implementation used.
Definition: populationalgorithmsimple.cpp:29
double getTime() const
This function returns the current time of the simulation.
Definition: algorithm.h:142
GslRandomNumberGenerator * getRandomNumberGenerator() const
Returns the random number generator that was specified in the constructor.
Definition: algorithm.h:145
This is the base class for events in population-based simulations.
Definition: populationevent.h:63
An interface to allow a member function PopulationAlgorithmAboutToFireInterface::onAboutToFire to be ...
Definition: populationinterfaces.h:89
This is the base class for a person in a population-based simulation.
Definition: personbase.h:23
void setAboutToFireAction(PopulationAlgorithmAboutToFireInterface *pAction)
Allows you to set the action that needs to be performed before firing an event dynamically.
Definition: populationalgorithmsimple.h:58
This is the base class for events in the mNRM algorithm.
Definition: eventbase.h:55
GslRandomNumberGenerator * getRandomNumberGenerator() const
Must return the random number generator used by the algorithm.
Definition: populationalgorithmsimple.h:59
An interface for a population based mNRM algorithm.
Definition: populationinterfaces.h:101
A very naive implementation of the necessary functions from the Algorithm class.
Definition: simplealgorithm.h:86
This class provides functions for a population-based simulation using the modified Next Reaction Meth...
Definition: populationalgorithmsimple.h:39
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