BioDynaMo
v1.05.120-25dc9790
|
Go to the documentation of this file.
15 #ifndef CORE_AGENT_AGENT_UID_GENERATOR_H_
16 #define CORE_AGENT_AGENT_UID_GENERATOR_H_
46 if (old_uids.size()) {
47 auto uid = old_uids.back();
49 return AgentUid(uid.GetIndex(), uid.GetReused() + 1);
70 std::atomic<typename AgentUid::Index_t>
counter_;
84 #if (!defined(__CLING__) || defined(__ROOTCLING__)) && defined(USE_DICT)
86 inline void AgentUidGenerator::Streamer(TBuffer& R__b) {
87 if (R__b.IsReading()) {
88 R__b.ReadClassBuffer(AgentUidGenerator::Class(),
this);
92 R__b.WriteClassBuffer(AgentUidGenerator::Class(),
this);
96 #endif // !defined(__CLING__) || defined(__ROOTCLING__)
100 #endif // CORE_AGENT_AGENT_UID_GENERATOR_H_
SharedData< std::vector< AgentUid > > tl_uids_
Thread local vector of AgentUids that can be reused.
The SharedData class avoids false sharing between threads.
void ReuseAgentUid(const AgentUid &uid)
AgentUid::Index_t GetHighestIndex() const
Thread-safe.
BDM_CLASS_DEF_NV(AgentUidGenerator, 1)
std::atomic< typename AgentUid::Index_t > counter_
AgentUid::Index_t root_counter_
This class generates unique ids for agents.
int GetMaxThreads() const
Return the maximum number of threads.
int GetMyThreadId() const
This class stores information about each thread. (e.g. to which NUMA node it belongs to....