1 #ifndef POPULATIONALGORITHMTESTING_H
3 #define POPULATIONALGORITHMTESTING_H
14 #include "personaleventlisttesting.h"
20 class PopulationStateTesting;
93 bool isParallel()
const {
return m_parallel; }
94 bool_t run(
double &tMax, int64_t &maxEvents,
double startTime = 0);
106 bool_t initEventTimes()
const;
108 void advanceEventTimes(
EventBase *pScheduledEvent,
double dt);
109 void onAboutToFire(
EventBase *pEvt) {
if (m_pOnAboutToFire) m_pOnAboutToFire->
onAboutToFire(static_cast<PopulationEvent *>(pEvt)); }
110 PopulationEvent *getEarliestEvent(
const std::vector<PersonBase *> &people);
111 PersonalEventListTesting *personalEventList(
PersonBase *pPerson);
113 PopulationStateTesting &m_popState;
116 #ifdef ALGORITHM_SHOW_EVENTS
118 #endif // ALGORITHM_SHOW_EVENTS
119 void onAlgorithmLoop(
bool finished);
121 int64_t getNextEventID();
123 std::vector<EventBase *> m_eventsToRemove;
128 int64_t m_nextEventID;
133 inline int64_t PopulationAlgorithmTesting::getNextEventID()
135 int64_t
id = m_nextEventID++;
139 inline PersonalEventListTesting *PopulationAlgorithmTesting::personalEventList(
PersonBase *pPerson)
142 PersonalEventListTesting *pEvtList =
static_cast<PersonalEventListTesting *
>(pPerson->
getAlgorithmInfo());
147 #endif // POPULATIONALGORITHMTESTING_H
Type to return true/false with error description.
Definition: booltype.h:25
bool_t init()
Abstract function to initialize the implementation used.
Definition: populationalgorithmtesting.cpp:38
virtual void onAboutToFire(PopulationEvent *pEvt)=0
If set using PopulationAlgorithmInterface::setAboutToFireAction, this function will be called right b...
GslRandomNumberGenerator * getRandomNumberGenerator() const
Must return the random number generator used by the algorithm.
Definition: populationalgorithmtesting.h:102
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: populationalgorithmtesting.cpp:63
double getTime() const
Must return the simulation tilme of the algorithm.
Definition: populationalgorithmtesting.h:101
PopulationAlgorithmTesting(PopulationStateTesting &state, GslRandomNumberGenerator &rng, bool parallel)
Constructor of the class, indicating if a parallel version should be used, which random number genera...
Definition: populationalgorithmtesting.cpp:25
This class allows you to generate random numbers, and uses the GNU Scientific Library for this...
Definition: gslrandomnumbergenerator.h:16
double getTime() const
This function returns the current time of the simulation.
Definition: algorithm.h:155
GslRandomNumberGenerator * getRandomNumberGenerator() const
Returns the random number generator that was specified in the constructor.
Definition: algorithm.h:158
This class contains the core algorithm (as shown on the main page of the documentation) to execute th...
Definition: algorithm.h:81
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
This is the base class for events in the mNRM algorithm.
Definition: eventbase.h:55
PersonAlgorithmInfo * getAlgorithmInfo() const
Returns what was stored using PersonBase::PersonAlgorithmInfo.
Definition: personbase.h:77
void setAboutToFireAction(PopulationAlgorithmAboutToFireInterface *pAction)
Allows you to set the action that needs to be performed before firing an event dynamically.
Definition: populationalgorithmtesting.h:104
An interface for a population based mNRM algorithm.
Definition: populationinterfaces.h:101
void onNewEvent(PopulationEvent *pEvt)
When a new event has been created, it must be injected into the simulation using this function...
Definition: populationalgorithmtesting.cpp:288
This class provides functions for a population-based simulation using the modified Next Reaction Meth...
Definition: populationalgorithmtesting.h:82