Simpact Cyan
Population based event driven simulation using mNRM
populationstateadvanced.h
Go to the documentation of this file.
1 #ifndef POPULATIONSTATEADVANCED_H
2 
3 #define POPULATIONSTATEADVANCED_H
4 
9 #include "algorithm.h"
10 #include "mutex.h"
11 #include "personbase.h"
12 #include "populationstatesimpleadvancedcommon.h"
13 #include "personaleventlist.h"
14 #include <assert.h>
15 #include <vector>
16 
18 
22 class PopulationStateAdvanced : public PopulationStateSimpleAdvancedCommon
23 {
24 public:
27 
28  bool_t init(bool parallel);
29 
30  // For internal use (by PersonalEventList)
31  void lockPerson(PersonBase *pPerson) const;
32  void unlockPerson(PersonBase *pPerson) const;
33 private:
34  int64_t getNextPersonID();
35  void setListIndex(PersonBase *pPerson, int idx);
36  int getListIndex(PersonBase *pPerson);
37  void addAlgorithmInfo(PersonBase *pPerson);
38 
39  bool m_init;
40  bool m_parallel;
41 
42  int64_t m_nextPersonID;
43 #ifndef DISABLEOPENMP
44  Mutex m_nextPersonIDMutex;
45  mutable std::vector<Mutex> m_personMutexes;
46 #endif // !DISABLEOPENMP
47 
48  friend class PopulationAlgorithmAdvanced;
49 };
50 
51 #endif // POPULATIONSTATEADVANCED_H
52 
This is the base class for a person in a population-based simulation.
Definition: personbase.h:24
This class provides functions for a population-based simulation using the modified Next Reaction Meth...
Definition: populationalgorithmadvanced.h:87
Population state to be used when simulating with the population based algorithm in PopulationAlgorith...
Definition: populationstateadvanced.h:23
Type to return true/false with error description.
Definition: booltype.h:26