BioDynaMo  v1.05.159-3be850bb
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 
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_
Contains code required by all agents.
Definition: agent.h:79
void TearDownAgentOpsAll(const std::vector< ExecutionContext * > &all_exec_ctxts) 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
std::shared_ptr< std::vector< std::vector< Agent * > > > agents_
void SetupIterationAll(const std::vector< ExecutionContext * > &all_exec_ctxts) override
static void Use(Simulation *sim)
Use the CopyExecutionContext for simulation sim.
Definition: agent.cc:39