BioDynaMo
v1.05.120-25dc9790
|
Go to the documentation of this file.
15 #ifndef CORE_EXECUTION_CONTEXT_IN_PLACE_EXEC_CTXT_H_
16 #define CORE_EXECUTION_CONTEXT_IN_PLACE_EXEC_CTXT_H_
37 namespace in_place_exec_ctxt_detail {
38 class InPlaceExecutionContext_NeighborCacheValidity_Test;
58 using Batch = std::vector<value_type>;
64 uint64_t
Size()
const;
65 void Resize(uint64_t new_size);
76 const std::shared_ptr<ThreadSafeAgentUidMap>& map);
85 const std::vector<ExecutionContext*>& all_exec_ctxts)
override;
92 const std::vector<ExecutionContext*>& all_exec_ctxts)
override;
98 const std::vector<ExecutionContext*>& all_exec_ctxts)
override;
104 const std::vector<ExecutionContext*>& all_exec_ctxts)
override;
109 const std::vector<Operation*>& operations)
override;
114 void* criteria)
override;
119 const Agent& query,
real_t squared_radius)
override;
124 const Real3& query_position,
125 real_t squared_radius)
override;
137 friend class in_place_exec_ctxt_detail::
138 InPlaceExecutionContext_NeighborCacheValidity_Test;
152 std::atomic_flag
mutex_ = ATOMIC_FLAG_INIT;
166 const std::vector<ExecutionContext*>& all_exec_ctxts);
169 const std::vector<ExecutionContext*>& all_exec_ctxts);
182 #endif // CORE_EXECUTION_CONTEXT_IN_PLACE_EXEC_CTXT_H_
std::vector< Agent * > new_agents_
Pointer to new agents.
std::vector< AgentUid > remove_
void AddAgent(Agent *new_agent) override
Adds the agent to the simulation (threadsafe, takes ownership). Note that we avoid the use of smart p...
virtual void AddAgentsToRm(const std::vector< ExecutionContext * > &all_exec_ctxts)
void Resize(uint64_t new_size)
bool cache_neighbors_
Cache the value of Param::cache_neighbors.
const value_type & operator[](const AgentUid &key) const
real_t cached_squared_search_radius_
The radius that was used to cache neighbors in neighbor_cache_
std::atomic_flag mutex_
prevent race conditions for cached Agents
void Execute(Agent *agent, AgentHandle ah, const std::vector< Operation * > &operations) override
std::vector< Batch ** > old_copies_
Contains code required by all agents.
void SetupIterationAll(const std::vector< ExecutionContext * > &all_exec_ctxts) override
std::vector< value_type > Batch
InPlaceExecutionContext(const std::shared_ptr< ThreadSafeAgentUidMap > &map)
void TearDownIterationAll(const std::vector< ExecutionContext * > &all_exec_ctxts) override
std::vector< std::pair< Agent *, real_t > > neighbor_cache_
void ForEachNeighbor(Functor< void, Agent * > &lambda, const Agent &query, void *criteria) override
void Insert(const AgentUid &uid, const value_type &value)
constexpr static uint64_t kBatchSize
bool IsNeighborCacheValid(real_t query_squared_radius) const
void TearDownAgentOpsAll(const std::vector< ExecutionContext * > &all_exec_ctxts) override
~InPlaceExecutionContext() override
void RemoveAgent(const AgentUid &uid) override
std::vector< AgentPointer<> > critical_region_
Used to determine which agents must not be updated from different threads.
std::vector< Spinlock * > locks_
std::atomic< Batch ** > batches_
std::vector< AgentPointer<> > critical_region_2_
Used to determine which agents must not be updated from different threads.
Agent * GetAgent(const AgentUid &uid) override
const Agent * GetConstAgent(const AgentUid &uid) override
virtual void RemoveAgentsFromRm(const std::vector< ExecutionContext * > &all_exec_ctxts)
std::shared_ptr< ThreadSafeAgentUidMap > new_agent_map_
Lookup table AgentUid -> AgentPointer for new created agents.
This class stores information about each thread. (e.g. to which NUMA node it belongs to....
void SetupAgentOpsAll(const std::vector< ExecutionContext * > &all_exec_ctxts) override