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

#include <operation.h>

Collaboration diagram for bdm::Operation:
[legend]

Public Member Functions

 Operation (const std::string &name)
 
 Operation (const std::string &name, uint32_t frequency)
 
 ~Operation ()
 
OperationClone ()
 
void operator() (Agent *agent)
 
void operator() ()
 
void AddOperationImpl (OpComputeTarget target, OperationImpl *impl)
 
template<typename T >
T * GetImplementation ()
 Returns the implementation corresponding to the template argument. More...
 
bool IsComputeTargetSupported (OpComputeTarget target)
 
void SelectComputeTarget (OpComputeTarget target)
 
bool IsStandalone ()
 
void SetUp ()
 Forwards call to implementation's Setup function. More...
 
void TearDown ()
 Forwards call to implementation's TearDown function. More...
 
bool IsExcluded (Functor< bool, Agent * > *filter)
 
void SetExcludeFilters (const std::set< Functor< bool, Agent * > * > &exclude_filters)
 

Public Attributes

size_t frequency_ = 1
 
std::string name_
 Operation name / unique identifier. More...
 
OpComputeTarget active_target_ = kCpu
 The compute target that this operation will be executed on. More...
 
std::vector< OperationImpl * > implementations_
 The different operation implementations for each supported compute target. More...
 
std::set< Functor< bool, Agent * > * > exclude_filters_
 If this is an agent operation don't run it for this list of filters. More...
 

Detailed Description

A BioDynaMo operation that is executed every frequency_ timesteps. An operation can have multiple implementations for various execution platform, or "compute targets", such as CUDA or OpenCL, to target GPU hardware for instance.

Definition at line 99 of file operation.h.

Constructor & Destructor Documentation

◆ Operation() [1/2]

bdm::Operation::Operation ( const std::string &  name)
explicit

Construct an operation

Parameters
[in]nameThe name of the operation

Definition at line 19 of file operation.cc.

◆ Operation() [2/2]

bdm::Operation::Operation ( const std::string &  name,
uint32_t  frequency 
)

Construct an operation

Parameters
[in]nameThe name of the operation
[in]frequencyThe frequency at which the operation is executed

Definition at line 21 of file operation.cc.

◆ ~Operation()

bdm::Operation::~Operation ( )

Definition at line 24 of file operation.cc.

Member Function Documentation

◆ AddOperationImpl()

void bdm::Operation::AddOperationImpl ( OpComputeTarget  target,
OperationImpl impl 
)

Add an operation implementation for the specified compute target

Parameters
[in]targetThe compute target
implThe implementation

Definition at line 53 of file operation.cc.

◆ Clone()

Operation * bdm::Operation::Clone ( )

Definition at line 32 of file operation.cc.

◆ GetImplementation()

template<typename T >
T* bdm::Operation::GetImplementation ( )
inline

Returns the implementation corresponding to the template argument.

Definition at line 138 of file operation.h.

◆ IsComputeTargetSupported()

bool bdm::Operation::IsComputeTargetSupported ( OpComputeTarget  target)

Check whether an implementation is available for the requested compute target

Parameters
[in]targetThe compute target
Returns
True if the specified compute target is supported, False otherwise.

Definition at line 61 of file operation.cc.

◆ IsExcluded()

bool bdm::Operation::IsExcluded ( Functor< bool, Agent * > *  filter)
inline

Returns if this operation should be excluded for this filters Only used for agent operations.

Definition at line 178 of file operation.h.

◆ IsStandalone()

bool bdm::Operation::IsStandalone ( )
inline

Definition at line 166 of file operation.h.

◆ operator()() [1/2]

void bdm::Operation::operator() ( )

Operate in a stand-alone fashion. Typically this operator is called for GPU operations, or operations that do not need to loop over simulation objects (such as updating diffusion grids)

Definition at line 51 of file operation.cc.

◆ operator()() [2/2]

void bdm::Operation::operator() ( Agent agent)

Operate on an individual agent. Typically this operator is called in a loop over all agents

Parameters
agentHandle to the agent

Definition at line 47 of file operation.cc.

◆ SelectComputeTarget()

void bdm::Operation::SelectComputeTarget ( OpComputeTarget  target)

Select which of the operation implementation should be used for this operation, by specifying the compute target

Parameters
[in]targetThe compute target

Definition at line 68 of file operation.cc.

◆ SetExcludeFilters()

void bdm::Operation::SetExcludeFilters ( const std::set< Functor< bool, Agent * > * > &  exclude_filters)
inline

Agent operations will not be executed for filters that are contained in exclude_filters.

Definition at line 187 of file operation.h.

◆ SetUp()

void bdm::Operation::SetUp ( )

Forwards call to implementation's Setup function.

Definition at line 76 of file operation.cc.

◆ TearDown()

void bdm::Operation::TearDown ( )

Forwards call to implementation's TearDown function.

Definition at line 78 of file operation.cc.

Member Data Documentation

◆ active_target_

OpComputeTarget bdm::Operation::active_target_ = kCpu

The compute target that this operation will be executed on.

Definition at line 200 of file operation.h.

◆ exclude_filters_

std::set<Functor<bool, Agent *> *> bdm::Operation::exclude_filters_

If this is an agent operation don't run it for this list of filters.

Definition at line 205 of file operation.h.

◆ frequency_

size_t bdm::Operation::frequency_ = 1

Specifies how often this operation will be executed.
1: every timestep
2: every second timestep
...

Definition at line 196 of file operation.h.

◆ implementations_

std::vector<OperationImpl *> bdm::Operation::implementations_

The different operation implementations for each supported compute target.

Definition at line 202 of file operation.h.

◆ name_

std::string bdm::Operation::name_

Operation name / unique identifier.

Definition at line 198 of file operation.h.


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