BioDynaMo  v1.05.120-25dc9790
copy_execution_context.h
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------
2 //
3 // Copyright (C) 2021 CERN & University of Surrey for the benefit of the
4 // BioDynaMo collaboration. All Rights Reserved.
5 //
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 //
9 // See the LICENSE file distributed with this work for details.
10 // See the NOTICE file distributed with this work for additional information
11 // regarding copyright ownership.
12 //
13 // -----------------------------------------------------------------------------
14 
15 #ifndef CORE_EXECUTION_CONTEXT_COPY_EXECUTION_CONTEXT_H_
16 #define CORE_EXECUTION_CONTEXT_COPY_EXECUTION_CONTEXT_H_
17 
19 
20 namespace bdm {
21 
22 class Simulation;
23 
24 namespace experimental {
25 
38  public:
40  static void Use(Simulation* sim);
41 
42  explicit CopyExecutionContext(
43  const std::shared_ptr<ThreadSafeAgentUidMap>& map,
44  std::shared_ptr<std::vector<std::vector<Agent*>>> agents);
45 
46  ~CopyExecutionContext() override;
47 
48  void SetupIterationAll(
49  const std::vector<ExecutionContext*>& all_exec_ctxts) override;
50 
52  const std::vector<ExecutionContext*>& all_exec_ctxts) override;
53 
54  void Execute(Agent* agent, AgentHandle ah,
55  const std::vector<Operation*>& operations) override;
56 
57  protected:
60  std::shared_ptr<std::vector<std::vector<Agent*>>> agents_;
61 };
62 
63 } // namespace experimental
64 } // namespace bdm
65 
66 #endif // CORE_EXECUTION_CONTEXT_COPY_EXECUTION_CONTEXT_H_
in_place_exec_ctxt.h
bdm::experimental::CopyExecutionContext::TearDownAgentOpsAll
void TearDownAgentOpsAll(const std::vector< ExecutionContext * > &all_exec_ctxts) override
Definition: copy_execution_context.cc:77
bdm
Definition: agent.cc:39
bdm::experimental::CopyExecutionContext::Execute
void Execute(Agent *agent, AgentHandle ah, const std::vector< Operation * > &operations) override
Definition: copy_execution_context.cc:87
bdm::experimental::CopyExecutionContext::CopyExecutionContext
CopyExecutionContext(const std::shared_ptr< ThreadSafeAgentUidMap > &map, std::shared_ptr< std::vector< std::vector< Agent * >>> agents)
Definition: copy_execution_context.cc:38
bdm::InPlaceExecutionContext
Definition: in_place_exec_ctxt.h:54
bdm::Agent
Contains code required by all agents.
Definition: agent.h:79
bdm::experimental::CopyExecutionContext::SetupIterationAll
void SetupIterationAll(const std::vector< ExecutionContext * > &all_exec_ctxts) override
Definition: copy_execution_context.cc:58
bdm::experimental::CopyExecutionContext::agents_
std::shared_ptr< std::vector< std::vector< Agent * > > > agents_
Definition: copy_execution_context.h:60
bdm::experimental::CopyExecutionContext::Use
static void Use(Simulation *sim)
Use the CopyExecutionContext for simulation sim.
Definition: copy_execution_context.cc:24
bdm::experimental::CopyExecutionContext
Definition: copy_execution_context.h:37
bdm::Simulation
Definition: simulation.h:50
bdm::AgentHandle
Definition: agent_handle.h:29
bdm::experimental::CopyExecutionContext::~CopyExecutionContext
~CopyExecutionContext() override