chrono::synchrono::SynChronoManager Class Reference

Description

Base class responsible for handling agents and synchronizing states between nodes.

#include <SynChronoManager.h>

Public Member Functions

 SynChronoManager (int node_id, int num_nodes, std::shared_ptr< SynCommunicator > communicator=nullptr)
 Class constructor.
 
 ~SynChronoManager ()
 Class destructor.
 
bool AddAgent (std::shared_ptr< SynAgent > agent)
 Add an agent to the SynChrono manager Cannot be called after Initialize is called. More...
 
bool AddZombie (std::shared_ptr< SynAgent > zombie, AgentKey agent_key)
 Add a zombie to the SynChrono manager with the passed id Cannot be called after Initialize is called. More...
 
bool SetCommunicator (std::shared_ptr< SynCommunicator > communicator)
 Sets the underlying communicator. More...
 
bool Initialize (ChSystem *system)
 Initialize all the added agents. More...
 
void Synchronize (double time)
 Synchronize data across nodes. More...
 
void UpdateAgents ()
 Update the underlying agents Agents typically will update their state messages.
 
void QuitSimulation ()
 If our simulation is still running, sends a quit message to everyone else to exit as well Needed specifically for MPI where we don't wait for timeouts.
 
std::map< AgentKey, std::shared_ptr< SynAgent > > & GetAgents ()
 Get the agents list. More...
 
std::map< AgentKey, std::shared_ptr< SynAgent > > & GetZombies ()
 Get the zombies list. More...
 
void SetHeartbeat (double heartbeat)
 Set the heartbeat for the rate at which SynChrono synchronization occurs. More...
 
bool IsOk ()
 Should the simulation still be running?
 
void PrintStepStatistics (std::ostream &os) const
 Print timing information (over last step and cumulative)
 

Member Function Documentation

◆ AddAgent()

bool chrono::synchrono::SynChronoManager::AddAgent ( std::shared_ptr< SynAgent agent)

Add an agent to the SynChrono manager Cannot be called after Initialize is called.

Parameters
agentThe agent that should be added to the SynChrono world

◆ AddZombie()

bool chrono::synchrono::SynChronoManager::AddZombie ( std::shared_ptr< SynAgent zombie,
AgentKey  agent_key 
)

Add a zombie to the SynChrono manager with the passed id Cannot be called after Initialize is called.

Parameters
zombieThe zombie that should be added to the SynChrono world
agent_keyThe id of the added zombie

◆ GetAgents()

std::map<AgentKey, std::shared_ptr<SynAgent> >& chrono::synchrono::SynChronoManager::GetAgents ( )
inline

Get the agents list.

◆ GetZombies()

std::map<AgentKey, std::shared_ptr<SynAgent> >& chrono::synchrono::SynChronoManager::GetZombies ( )
inline

Get the zombies list.

◆ Initialize()

bool chrono::synchrono::SynChronoManager::Initialize ( ChSystem system)

Initialize all the added agents.

Communicator must be added before calling this function. Locks the agent list so new agents cannot be added.

Parameters
systemThe chrono system with which the sensor manager is associated. Used for zombie initialization.

◆ SetCommunicator()

bool chrono::synchrono::SynChronoManager::SetCommunicator ( std::shared_ptr< SynCommunicator communicator)

Sets the underlying communicator.

Parameters
communicatorthe communicator to use for internode communication

◆ SetHeartbeat()

void chrono::synchrono::SynChronoManager::SetHeartbeat ( double  heartbeat)
inline

Set the heartbeat for the rate at which SynChrono synchronization occurs.

◆ Synchronize()

void chrono::synchrono::SynChronoManager::Synchronize ( double  time)

Synchronize data across nodes.

This method essentially calls the underlying communicator to perform the work. The communicator will send and block until all messages are received. The manager is then responsible for distributing messages to each agent.

A manager is responsible for maintaining time and space coherence, so each node and it's agent should be at the same time within the simulation

Parameters
timetimestamp to synchronize each node at

The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono_synchrono/SynChronoManager.h
  • /builds/uwsbel/chrono/src/chrono_synchrono/SynChronoManager.cpp