BioDynaMo
v1.05.120-25dc9790
|
Go to the documentation of this file.
21 namespace experimental {
26 auto map = std::make_shared<
28 std::vector<ExecutionContext*> exec_ctxts(size);
29 auto agents = std::make_shared<std::vector<std::vector<Agent*>>>();
30 #pragma omp parallel for schedule(static, 1)
31 for (uint64_t i = 0; i < size; i++) {
39 const std::shared_ptr<ThreadSafeAgentUidMap>& map,
40 std::shared_ptr<std::vector<std::vector<Agent*>>> agents)
44 agents_->resize(tinfo->GetNumaNodes());
47 if (param->execution_order == Param::ExecutionOrder::kForEachOpForEachAgent) {
49 "CopyExecutionContext does not support Param::execution_order = "
50 "Param::ExecutionOrder::kForEachOpForEachAgent");
59 const std::vector<ExecutionContext*>& all_exec_ctxts) {
63 for (uint64_t n = 0; n <
agents_->size(); ++n) {
64 agents_->at(n).reserve(rm->GetAgentVectorCapacity(n));
65 agents_->at(n).resize(rm->GetNumAgents(n));
69 if (scheduler->GetAgentFilters().size() != 0) {
71 "CopyExecutionContext does not support simulations with agent "
72 "filters yet (see Scheduler::SetAgentFilters)");
78 const std::vector<ExecutionContext*>& all_exec_ctxts) {
81 auto del =
L2F([](
Agent* a) {
delete a; });
82 rm->ForEachAgentParallel(del);
88 const std::vector<Operation*>& operations) {
void TearDownAgentOpsAll(const std::vector< ExecutionContext * > &all_exec_ctxts) override
static ThreadInfo * GetInstance()
void Execute(Agent *agent, AgentHandle ah, const std::vector< Operation * > &operations) override
CopyExecutionContext(const std::shared_ptr< ThreadSafeAgentUidMap > &map, std::shared_ptr< std::vector< std::vector< Agent * >>> agents)
void Execute(Agent *agent, AgentHandle ah, const std::vector< Operation * > &operations) override
LambdaFunctor< decltype(&TLambda::operator())> L2F(const TLambda &l)
Contains code required by all agents.
void SetupIterationAll(const std::vector< ExecutionContext * > &all_exec_ctxts) override
Scheduler * GetScheduler()
void SetupIterationAll(const std::vector< ExecutionContext * > &all_exec_ctxts) override
ResourceManager * GetResourceManager()
Returns the ResourceManager instance.
void SetAllExecCtxts(const std::vector< ExecutionContext * > &exec_ctxts)
virtual Agent * NewCopy() const =0
Create a copy of this object.
static void Fatal(const std::string &location, const Args &... parts)
Prints fatal error message.
std::shared_ptr< std::vector< std::vector< Agent * > > > agents_
const Param * GetParam() const
Returns the simulation parameters.
std::vector< ExecutionContext * > & GetAllExecCtxts()
Returns all thread local execution contexts.
NumaNode_t GetNumaNode() const
static void Use(Simulation *sim)
Use the CopyExecutionContext for simulation sim.
static Simulation * GetActive()
This function returns the currently active Simulation simulation.
ElementIdx_t GetElementIdx() const
~CopyExecutionContext() override