chrono::synchrono::SynCommunicationManager Class Referenceabstract

Description

Base class for anyone that could manage state synchronization in a chrono simulation.

#include <SynCommunicationManager.h>

Inheritance diagram for chrono::synchrono::SynCommunicationManager:
Collaboration diagram for chrono::synchrono::SynCommunicationManager:

Public Member Functions

 SynCommunicationManager ()
 Constructs a new SynCommunicationManager object.
 
 SynCommunicationManager (int msg_length)
 Constructs a new SynCommunicationManager object with a starting message length.
 
 ~SynCommunicationManager ()
 Destory the SynCommunicationManager object.
 
virtual bool AddAgent (std::shared_ptr< SynAgent > agent)
 Add the specified agent to this manager's list of agents. More...
 
virtual bool AddAgent (std::shared_ptr< SynAgent > agent, int rank)
 Add the specified agent to this manager's list of agents at the provided rank. More...
 
virtual bool Initialize ()
 Initialize all agents. More...
 
virtual void Advance (double time_to_next_sync)
 Advance the state of the agent simulated by this rank to the specified timestep. More...
 
virtual void Synchronize ()=0
 Synchronize all zombie agents within each ranks environment.
 
virtual void Barrier ()=0
 Blocks simulation from proceeding until all ranks have reached this method call.
 
virtual void GenerateMessages () final
 Adds all messages to the flatbuffer manager and finishes it size-prefixed (if desired) More...
 
virtual void GenerateAgentDescriptionMessage () final
 Adds all info messages to the flatbuffer manager and finishes it size-prefixed.
 
virtual void ProcessMessage (const uint8_t *data)
 Processes all of the messages received. More...
 
virtual void ProcessMessageBuffer (const SynFlatBuffers::Buffer *buffer) final
 Processes all messages inside a single buffer. More...
 
virtual std::shared_ptr< SynAgentAgentFromDescription (const SynFlatBuffers::Buffer *buffer) final
 Processes all messages inside a single buffer. More...
 
std::shared_ptr< SynAgentGetAgent (int rank)
 Get agent at specified rank.
 
virtual int GetRank () final
 Get rank of current manager.
 
virtual int GetNumRanks () final
 Get the number of ranks in the simulation.
 
virtual std::map< int, std::shared_ptr< SynAgent > > GetAgentList () final
 Get the agent list.
 
bool IsOk ()
 Is the simulation still running?
 
double GetHeartbeat ()
 Get/Set the heartbeat.
 
void SetHeartbeat (double heartbeat)
 
double GetEndTime ()
 Get/Set the end time.
 
void SetEndTime (double end_time)
 

Protected Attributes

bool m_ok
 Is everything ok?
 
double m_heartbeat
 
double m_end_time
 
int m_num_advances
 keeps track of the number of updates that have occured so far
 
bool m_is_synchronized
 keeps track of the whether ranks are time synchronized
 
int m_rank
 rank which this manager controls
 
int m_num_ranks
 total number of ranks in this simulation
 
bool m_initialized
 has the manager been initialized
 
std::shared_ptr< SynAgentm_agent
 handle to this rank's agent
 
std::map< int, std::shared_ptr< SynAgent > > m_agent_list
 id to agent map on this rank
 
std::map< int, std::vector< SynMessage * > > m_message_list
 received messages mapped to each rank
 
SynFlatBuffersManager m_flatbuffers_manager
 flatbuffer manager for this rank
 

Member Function Documentation

◆ AddAgent() [1/2]

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

Add the specified agent to this manager's list of agents.

Parameters
agentHandle to the agent that will be added

◆ AddAgent() [2/2]

bool chrono::synchrono::SynCommunicationManager::AddAgent ( std::shared_ptr< SynAgent agent,
int  rank 
)
virtual

Add the specified agent to this manager's list of agents at the provided rank.

Parameters
agentHandle to the agent that will be added
rankRank that manages this agent

◆ Advance()

void chrono::synchrono::SynCommunicationManager::Advance ( double  time_to_next_sync)
virtual

Advance the state of the agent simulated by this rank to the specified timestep.

Parameters
time_to_next_syncTimestep to advance the agent's ChSystem to

◆ AgentFromDescription()

std::shared_ptr< SynAgent > chrono::synchrono::SynCommunicationManager::AgentFromDescription ( const SynFlatBuffers::Buffer *  buffer)
finalvirtual

Processes all messages inside a single buffer.

Add agents from their description messages

Parameters
bufferA buffer that contains messages received from a particular rank. e.g. state data + other messages

◆ GenerateMessages()

void chrono::synchrono::SynCommunicationManager::GenerateMessages ( )
finalvirtual

Adds all messages to the flatbuffer manager and finishes it size-prefixed (if desired)

Parameters
size_prefixedfinish the buffer with the size infront of it

◆ Initialize()

bool chrono::synchrono::SynCommunicationManager::Initialize ( )
virtual

Initialize all agents.

Returns
boolean indicated whether initialization function was successful

Reimplemented in chrono::synchrono::SynMPIManager.

◆ ProcessMessage()

void chrono::synchrono::SynCommunicationManager::ProcessMessage ( const uint8_t *  data)
virtual

Processes all of the messages received.

Parameters
dataa pointer to the flatbuffer buffer

◆ ProcessMessageBuffer()

void chrono::synchrono::SynCommunicationManager::ProcessMessageBuffer ( const SynFlatBuffers::Buffer *  buffer)
finalvirtual

Processes all messages inside a single buffer.

Updates zombie agents and allows agents additional processing.

Parameters
bufferA buffer that contains messages received from a particular rank. e.g. state data + other messages

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