BioDynaMo  v1.03.58-27764645
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
bdm::Environment Class Referenceabstract

#include <environment.h>

Inheritance diagram for bdm::Environment:
[legend]

Classes

class  NeighborMutexBuilder
 
struct  SimDimensionAndLargestAgentFunctor
 

Public Member Functions

virtual ~Environment ()=default
 
void MarkAsOutOfSync ()
 
void Update ()
 
void ForcedUpdate ()
 Updates the environment. Prefer Update() for implementations. More...
 
virtual void ForEachNeighbor (Functor< void, Agent *, real_t > &lambda, const Agent &query, real_t squared_radius)=0
 
virtual void ForEachNeighbor (Functor< void, Agent * > &lambda, const Agent &query, void *criteria)=0
 
virtual void ForEachNeighbor (Functor< void, Agent *, real_t > &lambda, const Real3 &query_position, real_t squared_radius, const Agent *query_agent=nullptr)=0
 
virtual void Clear ()=0
 
virtual std::array< int32_t, 6 > GetDimensions () const =0
 
virtual std::array< int32_t, 2 > GetDimensionThresholds () const =0
 
real_t GetLargestAgentSize () const
 Return the size of the largest agent. More...
 
real_t GetLargestAgentSizeSquared () const
 
virtual LoadBalanceInfoGetLoadBalanceInfo ()=0
 
virtual NeighborMutexBuilderGetNeighborMutexBuilder ()=0
 
bool HasGrown () const
 

Protected Member Functions

virtual void UpdateImplementation ()=0
 
void CalcSimDimensionsAndLargestAgent (std::array< real_t, 6 > *ret_grid_dimensions)
 

Protected Attributes

bool has_grown_ = false
 
real_t largest_object_size_ = 0.0
 The size of the largest object in the simulation. More...
 
real_t largest_object_size_squared_ = 0.0
 

Private Attributes

bool out_of_sync_ = true
 

Detailed Description

Definition at line 30 of file environment.h.

Constructor & Destructor Documentation

◆ ~Environment()

virtual bdm::Environment::~Environment ( )
virtualdefault

Member Function Documentation

◆ CalcSimDimensionsAndLargestAgent()

void bdm::Environment::CalcSimDimensionsAndLargestAgent ( std::array< real_t, 6 > *  ret_grid_dimensions)
inlineprotected

Calculates what the grid dimensions need to be in order to contain all the agents

Definition at line 193 of file environment.h.

◆ Clear()

virtual void bdm::Environment::Clear ( )
pure virtual

◆ ForcedUpdate()

void bdm::Environment::ForcedUpdate ( )
inline

Updates the environment. Prefer Update() for implementations.

Definition at line 57 of file environment.h.

◆ ForEachNeighbor() [1/3]

virtual void bdm::Environment::ForEachNeighbor ( Functor< void, Agent * > &  lambda,
const Agent query,
void *  criteria 
)
pure virtual

Iterates over all neighbors in an environment that suffices the given criteria. The criteria is type-erased to facilitate for different criteria for different environments. Check the documentation of an environment to know the criteria data type

Implemented in bdm::KDTreeEnvironment, bdm::OctreeEnvironment, and bdm::UniformGridEnvironment.

◆ ForEachNeighbor() [2/3]

virtual void bdm::Environment::ForEachNeighbor ( Functor< void, Agent *, real_t > &  lambda,
const Agent query,
real_t  squared_radius 
)
pure virtual

Iterates over all neighbors of a query agent that appear in a distance of less than sqrt(squared_radius). Typically, the distance is computed as the Euclidean distance in 3D environments.

Implemented in bdm::UniformGridEnvironment, bdm::KDTreeEnvironment, and bdm::OctreeEnvironment.

◆ ForEachNeighbor() [3/3]

virtual void bdm::Environment::ForEachNeighbor ( Functor< void, Agent *, real_t > &  lambda,
const Real3 query_position,
real_t  squared_radius,
const Agent query_agent = nullptr 
)
pure virtual

Iterates over all neighbors of a query position that appear in a distance of less than sqrt(squared_radius). Typically, the distance is computed as the Euclidean distance in 3D environments. Typically iterating over the neighbors of a certain agent or a certain position are fairly similar tasks. If you implement an environment, the optional argument agent_query can be used to to treat both cases in the same function, keep the implementation lean, and avoid redundant code.

Implemented in bdm::UniformGridEnvironment, bdm::KDTreeEnvironment, and bdm::OctreeEnvironment.

◆ GetDimensions()

virtual std::array<int32_t, 6> bdm::Environment::GetDimensions ( ) const
pure virtual

◆ GetDimensionThresholds()

virtual std::array<int32_t, 2> bdm::Environment::GetDimensionThresholds ( ) const
pure virtual

◆ GetLargestAgentSize()

real_t bdm::Environment::GetLargestAgentSize ( ) const
inline

Return the size of the largest agent.

Definition at line 94 of file environment.h.

◆ GetLargestAgentSizeSquared()

real_t bdm::Environment::GetLargestAgentSizeSquared ( ) const
inline

Definition at line 95 of file environment.h.

◆ GetLoadBalanceInfo()

virtual LoadBalanceInfo* bdm::Environment::GetLoadBalanceInfo ( )
pure virtual

◆ GetNeighborMutexBuilder()

virtual NeighborMutexBuilder* bdm::Environment::GetNeighborMutexBuilder ( )
pure virtual

Returns the NeighborMutexBuilder. The client uses it to create a NeighborMutex.

Implemented in bdm::UniformGridEnvironment, bdm::KDTreeEnvironment, and bdm::OctreeEnvironment.

◆ HasGrown()

bool bdm::Environment::HasGrown ( ) const
inline

Definition at line 123 of file environment.h.

◆ MarkAsOutOfSync()

void bdm::Environment::MarkAsOutOfSync ( )
inline

This function informs the environment that it is no longer up to date and that the state of the simulation might not be reflected correctly in the current environment. For instance, the load balancing operation causes such a synchronization issue and therefore calls this member function.

Definition at line 44 of file environment.h.

◆ Update()

void bdm::Environment::Update ( )
inline

Updates the environment if it is marked as out_of_sync_. This function should not be called in parallel regions for performance reasons.

Definition at line 48 of file environment.h.

◆ UpdateImplementation()

virtual void bdm::Environment::UpdateImplementation ( )
protectedpure virtual

Member function that is called by Update() and ForcedUpdate(). Pure virtual.

Implemented in bdm::UniformGridEnvironment, bdm::KDTreeEnvironment, and bdm::OctreeEnvironment.

Member Data Documentation

◆ has_grown_

bool bdm::Environment::has_grown_ = false
protected

Definition at line 126 of file environment.h.

◆ largest_object_size_

real_t bdm::Environment::largest_object_size_ = 0.0
protected

The size of the largest object in the simulation.

Definition at line 128 of file environment.h.

◆ largest_object_size_squared_

real_t bdm::Environment::largest_object_size_squared_ = 0.0
protected

Definition at line 129 of file environment.h.

◆ out_of_sync_

bool bdm::Environment::out_of_sync_ = true
private

Definition at line 35 of file environment.h.


The documentation for this class was generated from the following file: