RepastHPC  2.3.1
Public Member Functions | List of all members
SRManager Class Reference

Coordinates send and receive between processes by notifying processes to expect a send from X other processes. More...

#include <SRManager.h>

Public Member Functions

 SRManager (boost::mpi::communicator *comm)
 Creates an SRManager that uses the specified communicator. More...
 
 SRManager (boost::mpi::communicator *comm, int *toSend, int *toRecv)
 Creates an SRManager that uses the specified communicator, using the user-specified arrays instead of its internal arrays. More...
 
void mark (int pos)
 Marks the position in the array as 'true' (sets to one). More...
 
void setVal (int pos, int val)
 Sets the value at the given index in the array. More...
 
void clear ()
 Clears the send and receive arrays (sets all values to 0).
 
void retrieveSources ()
 Performs the actual send operation, populating the receive array with values from the other processes' send arrays.
 
void retrieveSources (std::vector< int > &sources)
 Performs the send operation and populates the vector passed with values representing all elements in the array that have non-zero values after the receive. More...
 
void retrieveSources (const std::vector< int > &targets, std::vector< int > &sources, int tag=0)
 Populates the send array based on the values listed in the 'targets' vector (which should be a list of process IDs to which this processer will send information) then performs the send operation, then populates the vector passed with values representing all elements in the receive array that have non-zero values after the receive. More...
 

Detailed Description

Coordinates send and receive between processes by notifying processes to expect a send from X other processes.

Constructor & Destructor Documentation

◆ SRManager() [1/2]

SRManager::SRManager ( boost::mpi::communicator *  comm)

Creates an SRManager that uses the specified communicator.

Parameters
commthe communicator to use

◆ SRManager() [2/2]

SRManager::SRManager ( boost::mpi::communicator *  comm,
int *  toSend,
int *  toRecv 
)

Creates an SRManager that uses the specified communicator, using the user-specified arrays instead of its internal arrays.

The ability to use external arrays is a convenience for conditions in which it is useful to maintain the array of values for other purposes but exchange them using the SRManager.

Parameters
commthe communicator to use
toSendthe array to be used as the send array
toRecvthe array to be used as the receive array If the pointer passed for the receive array is null, an internal array will be used. This is to provide for situations in which the user wishes to maintain the send array but not the receive array.

Member Function Documentation

◆ mark()

void SRManager::mark ( int  pos)

Marks the position in the array as 'true' (sets to one).

Parameters
posthe position in the array to be set, AKA the processor to which information will be sent.

◆ retrieveSources() [1/2]

void SRManager::retrieveSources ( const std::vector< int > &  targets,
std::vector< int > &  sources,
int  tag = 0 
)

Populates the send array based on the values listed in the 'targets' vector (which should be a list of process IDs to which this processer will send information) then performs the send operation, then populates the vector passed with values representing all elements in the receive array that have non-zero values after the receive.

Parameters
targetsvector of integers representing process to which this one intends to send information
sourcesvector that will be populated with list of integers representing processes that will send this process information @tag optional parameter, now obsolete (included for backward compatibility with boost-based SRManager prior to 2.0 release.

◆ retrieveSources() [2/2]

void SRManager::retrieveSources ( std::vector< int > &  sources)

Performs the send operation and populates the vector passed with values representing all elements in the array that have non-zero values after the receive.

Parameters
sourcesvector that will have a list of all processes that sent non-zero values to this one

◆ setVal()

void SRManager::setVal ( int  pos,
int  val 
)

Sets the value at the given index in the array.

Note: Does not perform error checking; user should ensure that index value is valid.

Parameters
posindex value for position in array to be set
valvalue to which the array element should be set

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