Author: Lukas Breitwieser
In this tutorial we want to demonstrate different functions to initialize agents in space.
Let's start by setting up BioDynaMo notebooks.
%jsroot on
gROOT->LoadMacro("${BDMSYS}/etc/rootlogon.C");
INFO: Created simulation object 'simulation' with UniqueName='simulation'.
We use SphericalAgent
s with $diameter = 10$ for all consecutive examples.
auto create_agent = [](const Real3& position) {
auto* agent = new SphericalAgent(position);
agent->SetDiameter(10);
return agent;
};
We define the number of agents that should be created for functions that require this parameter.
uint64_t num_agents = 300;
We define two helper functions that reset the simulation to the empty state and one to visualize the result.
void Clear() {
simulation.GetResourceManager()->ClearAgents();
}
void Vis() {
simulation.GetScheduler()->FinalizeInitialization();
VisualizeInNotebook();
}
Cube: $x_{min} = y_{min} = z_{min} = -200$ and $x_{max} = y_{max} = z_{max} = 200$
By default a uniform random number distribution is used.
Clear();
ModelInitializer::CreateAgentsRandom(-200, 200, num_agents, create_agent);
Vis();