BioDynaMo  v1.05.120-25dc9790
Static Public Member Functions | List of all members
bdm::ModelInitializer Struct Reference

#include <model_initializer.h>

Static Public Member Functions

template<typename Function >
static void Grid3D (size_t agents_per_dim, real_t space, Function agent_builder)
 
template<typename Function >
static void Grid3D (const std::array< size_t, 3 > &agents_per_dim, real_t space, Function agent_builder)
 
template<typename Function >
static void CreateAgents (const std::vector< Real3 > &positions, Function agent_builder)
 
template<typename Function >
static void CreateAgentsRandom (real_t min, real_t max, uint64_t num_agents, Function agent_builder, DistributionRng< real_t > *rng=nullptr)
 
template<typename Function >
static void CreateAgentsOnSurface (real_t(*f)(const real_t *, const real_t *), const FixedSizeVector< real_t, 10 > &fn_params, real_t xmin, real_t xmax, real_t deltax, real_t ymin, real_t ymax, real_t deltay, Function agent_builder)
 
template<typename Function >
static void CreateAgentsOnSurfaceRndm (real_t(*f)(const real_t *, const real_t *), const FixedSizeVector< real_t, 10 > &fn_params, real_t xmin, real_t xmax, real_t ymin, real_t ymax, uint64_t num_agents, Function agent_builder)
 
template<typename Function >
static void CreateAgentsOnSphereRndm (const Real3 &center, real_t radius, uint64_t num_agents, Function agent_builder)
 
template<typename Function >
static void CreateAgentsInSphereRndm (const Real3 &center, real_t radius, uint64_t num_agents, Function agent_builder)
 
static void DefineSubstance (int substance_id, const std::string &substance_name, real_t diffusion_coeff, real_t decay_constant, int resolution=10, const std::vector< real_t > &binding_coefficients={}, const std::vector< int > &binding_substances={})
 
template<typename F >
static void InitializeSubstance (int substance_id, F function)
 
static void AddBoundaryConditions (int substance_id, BoundaryConditionType bc_type, std::unique_ptr< BoundaryCondition > bc)
 

Detailed Description

Definition at line 35 of file model_initializer.h.

Member Function Documentation

◆ AddBoundaryConditions()

static void bdm::ModelInitializer::AddBoundaryConditions ( int  substance_id,
BoundaryConditionType  bc_type,
std::unique_ptr< BoundaryCondition bc 
)
inlinestatic

Sets the boundary condition for the specified substance. Transfers the ownership of the boundary condition to the diffusion grid.

Parameters
[in]substance_idThe substance identifier
[in]bc_typeThe boundary condition type
[in]bcThe boundary condition

Definition at line 411 of file model_initializer.h.

◆ CreateAgents()

template<typename Function >
static void bdm::ModelInitializer::CreateAgents ( const std::vector< Real3 > &  positions,
Function  agent_builder 
)
inlinestatic

Creates agents on the given positions and adds them to the ExecutionContext.

Parameters
positionspositions of the agents to be
agent_builderfunction containing the logic to instantiate a new agent. Takes const Real3& as input parameter

Definition at line 122 of file model_initializer.h.

◆ CreateAgentsInSphereRndm()

template<typename Function >
static void bdm::ModelInitializer::CreateAgentsInSphereRndm ( const Real3 center,
real_t  radius,
uint64_t  num_agents,
Function  agent_builder 
)
inlinestatic

Creates agents with random positions in a sphere and adds them to the ExecutionContext. Agents are distributed uniformly inside the sphere. Agent creation is parallelized. Algorithm: Knop, 1970, 10.1145/362349.362377 (doi).

Parameters
[in]centerCenter of the sphere
[in]radiusRadius of the sphere
[in]num_agentsThe number of agents
[in]agent_builderfunction containing the logic to instantiate a new agent. Takes const Real3& as input parameter

Definition at line 335 of file model_initializer.h.

◆ CreateAgentsOnSphereRndm()

template<typename Function >
static void bdm::ModelInitializer::CreateAgentsOnSphereRndm ( const Real3 center,
real_t  radius,
uint64_t  num_agents,
Function  agent_builder 
)
inlinestatic

Creates agents with random positions on a sphere and adds them to the ExecutionContext. The agents' positions are uniformly distributed across the surface. Agent creation is parallelized. Algorithm: Knop, 1970, 10.1145/362349.362377 (doi).

Parameters
[in]centerCenter of the sphere
[in]radiusRadius of the sphere
[in]num_agentsThe number of agents
[in]agent_builderfunction containing the logic to instantiate a new agent. Takes const Real3& as input parameter

Definition at line 305 of file model_initializer.h.

◆ CreateAgentsOnSurface()

template<typename Function >
static void bdm::ModelInitializer::CreateAgentsOnSurface ( real_t(*)(const real_t *, const real_t *)  f,
const FixedSizeVector< real_t, 10 > &  fn_params,
real_t  xmin,
real_t  xmax,
real_t  deltax,
real_t  ymin,
real_t  ymax,
real_t  deltay,
Function  agent_builder 
)
inlinestatic

Creates agents on surface and adds them to the ExecutionContext. The x and y positions are defined by xmin, xmax, deltax and ymin, ymax, deltay. The z position is calculated using f. Agent creation is parallelized.

auto construct = [](const Real3& position) {
  Cell* cell = new Cell(position);
  cell->SetDiameter(10);
  return cell;
};
auto f = [](const real_t* x, const real_t* params) {
    // 10 * sin(x/20) + 10 * sin(y/20)
    return 10 * std::sin(x[0] / 20.) + 10 * std::sin(x[1] / 20.0);
};
ModelInitializer::CreateAgentsOnSurface(f, {}, -100, 100, 10, -100,
100, 10, construct);
Parameters
[in]ffunction that defines the surface
[in]fn_paramsParameters that will be passed to f as second argument.
[in]xminMinimum x coordinate on which a agent will be created.
[in]xmaxMaximum x coordinate on which a agent will be created.
[in]deltaxSpace between two agents on the x-axis.
[in]yminMinimum y coordinate on which a agent will be created.
[in]ymaxMaximum y coordinate on which a agent will be created.
[in]deltaySpace between two agents on the y-axis.
[in]agent_builderfunction containing the logic to instantiate a new agent. Takes const Real3& as input parameter

Definition at line 214 of file model_initializer.h.

◆ CreateAgentsOnSurfaceRndm()

template<typename Function >
static void bdm::ModelInitializer::CreateAgentsOnSurfaceRndm ( real_t(*)(const real_t *, const real_t *)  f,
const FixedSizeVector< real_t, 10 > &  fn_params,
real_t  xmin,
real_t  xmax,
real_t  ymin,
real_t  ymax,
uint64_t  num_agents,
Function  agent_builder 
)
inlinestatic

Creates agents on surface and adds them to the ExecutionContext. The x and y positions are determined by a uniform distribution [xmin, xmax[ and [ymin, ymax[. The z position is calculated using f. Agent creation is parallelized.

auto construct = [](const Real3& position) {
  Cell* cell = new Cell(position);
  cell->SetDiameter(10);
  return cell;
};
auto f = [](const real_t* x, const real_t* params) {
    // 10 * sin(x/20) + 10 * sin(y/20)
    return 10 * std::sin(x[0] / 20.) + 10 * std::sin(x[1] / 20.0);
};
ModelInitializer::CreateAgentsOnSurfaceRndm(f, {}, -100, 100, -100,
100, construct);
Parameters
[in]ffunction that defines the surface
[in]fn_paramsParameters that will be passed to f as second argument.
[in]xminMinimum x coordinate on which a agent will be created.
[in]xmaxMaximum x coordinate on which a agent will be created.
[in]yminMinimum y coordinate on which a agent will be created.
[in]ymaxMaximum y coordinate on which a agent will be created.
[in]agent_builderfunction containing the logic to instantiate a new agent. Takes const Real3& as input parameter

Definition at line 274 of file model_initializer.h.

◆ CreateAgentsRandom()

template<typename Function >
static void bdm::ModelInitializer::CreateAgentsRandom ( real_t  min,
real_t  max,
uint64_t  num_agents,
Function  agent_builder,
DistributionRng< real_t > *  rng = nullptr 
)
inlinestatic

Creates agents with random positions and adds them to the ExecutionContext. Agent creation is parallelized.

Parameters
[in]minThe minimum position value
[in]maxThe maximum position value
[in]num_agentsThe number agents
[in]agent_builderfunction containing the logic to instantiate a new agent. Takes const Real3& as input parameter
[in]rngUses the given DistributionRng. if rng is a nullptr, this function uses a uniform distribution between [min, max[

Definition at line 151 of file model_initializer.h.

◆ DefineSubstance()

void bdm::ModelInitializer::DefineSubstance ( int  substance_id,
const std::string &  substance_name,
real_t  diffusion_coeff,
real_t  decay_constant,
int  resolution = 10,
const std::vector< real_t > &  binding_coefficients = {},
const std::vector< int > &  binding_substances = {} 
)
static

Allows agents to secrete the specified substance. Diffusion throughout the simulation space is automatically taken care of by the DiffusionGrid class

Parameters
[in]substance_idThe substance identifier
[in]substance_nameThe substance name
[in]diffusion_coeffThe diffusion coefficient
[in]decay_constantThe decay constant
[in]resolutionThe resolution of the diffusion grid
[in]binding_coefficientsThe binding coefficients of the depleting substances
[in]binding_substancesThe depleting substances

Definition at line 23 of file model_initializer.cc.

◆ Grid3D() [1/2]

template<typename Function >
static void bdm::ModelInitializer::Grid3D ( const std::array< size_t, 3 > &  agents_per_dim,
real_t  space,
Function  agent_builder 
)
inlinestatic

Creates a 3D grid of agents and adds them to the ExecutionContext. Type of the agent is determined by the return type of parameter agent_builder.

ModelInitializer::Grid3D({8,6,4}, 10, [](const Real3&
pos){ return Cell(pos); });
Parameters
agents_per_dimnumber of agents on each axis. Number of generated agents = agents_per_dim[0] * agents_per_dim[1] * agents_per_dim[2]
spacespace between the positions - e.g space = 10: positions = {(0, 0, 0), (0, 0, 10), (0, 0, 20), ... }
agent_builderfunction containing the logic to instantiate a new agent. Takes const Real3& as input parameter

Definition at line 92 of file model_initializer.h.

◆ Grid3D() [2/2]

template<typename Function >
static void bdm::ModelInitializer::Grid3D ( size_t  agents_per_dim,
real_t  space,
Function  agent_builder 
)
inlinestatic

Creates a 3D cubic grid of agents and adds them to the ExecutionContext. Type of the agent is determined by the return type of parameter agent_builder.

ModelInitializer::Grid3D(8, 10, [](const Real3& pos){
return Cell(pos); });
Parameters
agents_per_dimnumber of agents on each axis. Number of generated agents = agents_per_dim ^ 3
spacespace between the positions - e.g space = 10: positions = {(0, 0, 0), (0, 0, 10), (0, 0, 20), ... }
agent_builderfunction containing the logic to instantiate a new agent. Takes const Real3& as input parameter

Definition at line 53 of file model_initializer.h.

◆ InitializeSubstance()

template<typename F >
static void bdm::ModelInitializer::InitializeSubstance ( int  substance_id,
function 
)
inlinestatic

Definition at line 399 of file model_initializer.h.


The documentation for this struct was generated from the following files: