BioDynaMo  v1.05.120-25dc9790
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_EXECUTION_CONTEXT_H_
16 #define CORE_EXECUTION_CONTEXT_EXECUTION_CONTEXT_H_
17 
18 #include <utility>
19 #include <vector>
20 
22 #include "core/agent/agent_uid.h"
24 #include "core/functor.h"
26 
27 namespace bdm {
28 
29 class Agent;
30 
32  public:
33  virtual ~ExecutionContext() = default;
34 
38  virtual void SetupAgentOpsAll(
39  const std::vector<ExecutionContext*>& all_exec_ctxts) = 0;
40 
44  virtual void TearDownAgentOpsAll(
45  const std::vector<ExecutionContext*>& all_exec_ctxts) = 0;
46 
51  virtual void SetupIterationAll(
52  const std::vector<ExecutionContext*>& all_exec_ctxts) = 0;
53 
58  virtual void TearDownIterationAll(
59  const std::vector<ExecutionContext*>& all_exec_ctxts) = 0;
60 
63  virtual void Execute(Agent* agent, AgentHandle ah,
64  const std::vector<Operation*>& operations) = 0;
65 
68  virtual void ForEachNeighbor(Functor<void, Agent*>& lambda,
69  const Agent& query, void* criteria) = 0;
70 
74  const Agent& query, real_t squared_radius) = 0;
75 
79  const Real3& query_position,
80  real_t squared_radius) = 0;
81 
99  virtual void AddAgent(Agent* new_agent) = 0;
100 
101  virtual void RemoveAgent(const AgentUid& uid) = 0;
102 
103  virtual Agent* GetAgent(const AgentUid& uid) = 0;
104 
105  virtual const Agent* GetConstAgent(const AgentUid& uid) = 0;
106 };
107 
108 } // namespace bdm
109 
110 #endif // CORE_EXECUTION_CONTEXT_EXECUTION_CONTEXT_H_
bdm::ExecutionContext::AddAgent
virtual void AddAgent(Agent *new_agent)=0
Adds the agent to the simulation (threadsafe, takes ownership). Note that we avoid the use of smart p...
bdm::ExecutionContext::GetAgent
virtual Agent * GetAgent(const AgentUid &uid)=0
agent_uid.h
agent_handle.h
bdm
Definition: agent.cc:39
bdm::ExecutionContext::~ExecutionContext
virtual ~ExecutionContext()=default
operation.h
bdm::ExecutionContext::ForEachNeighbor
virtual void ForEachNeighbor(Functor< void, Agent * > &lambda, const Agent &query, void *criteria)=0
bdm::real_t
double real_t
Definition: real_t.h:21
bdm::ExecutionContext
Definition: execution_context.h:31
bdm::ExecutionContext::TearDownIterationAll
virtual void TearDownIterationAll(const std::vector< ExecutionContext * > &all_exec_ctxts)=0
bdm::Agent
Contains code required by all agents.
Definition: agent.h:79
bdm::Functor< void, Agent * >
bdm::ExecutionContext::SetupIterationAll
virtual void SetupIterationAll(const std::vector< ExecutionContext * > &all_exec_ctxts)=0
bdm::ExecutionContext::SetupAgentOpsAll
virtual void SetupAgentOpsAll(const std::vector< ExecutionContext * > &all_exec_ctxts)=0
bdm::ExecutionContext::GetConstAgent
virtual const Agent * GetConstAgent(const AgentUid &uid)=0
bdm::ExecutionContext::TearDownAgentOpsAll
virtual void TearDownAgentOpsAll(const std::vector< ExecutionContext * > &all_exec_ctxts)=0
math_array.h
bdm::AgentUid
Definition: agent_uid.h:25
bdm::MathArray< real_t, 3 >
functor.h
bdm::ExecutionContext::Execute
virtual void Execute(Agent *agent, AgentHandle ah, const std::vector< Operation * > &operations)=0
bdm::AgentHandle
Definition: agent_handle.h:29
bdm::ExecutionContext::RemoveAgent
virtual void RemoveAgent(const AgentUid &uid)=0