#include <ObjectCommunicator.hpp>
Public Member Functions | |
ObjectCommunicator () | |
void | SendObject (boost::shared_ptr< CLASS > const pObject, unsigned destinationProcess, unsigned tag) |
void | ISendObject (boost::shared_ptr< CLASS > const pObject, unsigned destinationProcess, unsigned tag) |
boost::shared_ptr< CLASS > | RecvObject (unsigned sourceProcess, unsigned tag, MPI_Status &status) |
void | IRecvObject (unsigned sourceProcess, unsigned tag) |
boost::shared_ptr< CLASS > | GetRecvObject () |
boost::shared_ptr< CLASS > | SendRecvObject (boost::shared_ptr< CLASS > const pSendObject, unsigned destinationProcess, unsigned sendTag, unsigned sourceProcess, unsigned sourceTag, MPI_Status &status) |
Private Attributes | |
char * | mRecvBuffer |
std::vector< char * > | mSendBuffer |
std::vector< std::string > | mSendString |
unsigned | mRecvBufferLength |
unsigned | mSendBufferLength |
MPI_Request | mMpiRequest |
bool | mIsWriting |
This is a helper class to enable classes that can be serialized to be sent using PetSc MPI communication. The object is serialized in to a string of characters, and then de-serialized on the receive process.
Definition at line 57 of file ObjectCommunicator.hpp.
ObjectCommunicator< CLASS >::ObjectCommunicator | ( | ) | [inline] |
Default constructor.
Definition at line 158 of file ObjectCommunicator.hpp.
References PetscTools::GetNumProcs(), ObjectCommunicator< CLASS >::mSendBuffer, and ObjectCommunicator< CLASS >::mSendString.
boost::shared_ptr< CLASS > ObjectCommunicator< CLASS >::GetRecvObject | ( | ) | [inline] |
Obtain a proper object once a call to IRecv has completed
Definition at line 244 of file ObjectCommunicator.hpp.
References EXCEPTION, ObjectCommunicator< CLASS >::mIsWriting, ObjectCommunicator< CLASS >::mMpiRequest, and ObjectCommunicator< CLASS >::mRecvBuffer.
Referenced by NodeBasedCellPopulation< DIM >::GetReceivedCells().
void ObjectCommunicator< CLASS >::IRecvObject | ( | unsigned | sourceProcess, | |
unsigned | tag | |||
) | [inline] |
Post an asynchronous receive for an object
sourceProcess | the process from which the data will be received | |
tag | the unique identifier code |
Definition at line 233 of file ObjectCommunicator.hpp.
References PetscTools::GetWorld(), ObjectCommunicator< CLASS >::mIsWriting, ObjectCommunicator< CLASS >::mMpiRequest, and ObjectCommunicator< CLASS >::mRecvBuffer.
Referenced by NodeBasedCellPopulation< DIM >::NonBlockingSendCellsToNeighbourProcesses().
void ObjectCommunicator< CLASS >::ISendObject | ( | boost::shared_ptr< CLASS > const | pObject, | |
unsigned | destinationProcess, | |||
unsigned | tag | |||
) | [inline] |
Send an object.
pObject | A pointer to the object to be sent | |
destinationProcess | the index of the process to send the data to | |
tag | a unique identifier tag for this communication |
Definition at line 187 of file ObjectCommunicator.hpp.
References PetscTools::GetWorld(), ObjectCommunicator< CLASS >::mSendBuffer, ObjectCommunicator< CLASS >::mSendBufferLength, and ObjectCommunicator< CLASS >::mSendString.
Referenced by NodeBasedCellPopulation< DIM >::NonBlockingSendCellsToNeighbourProcesses().
boost::shared_ptr< CLASS > ObjectCommunicator< CLASS >::RecvObject | ( | unsigned | sourceProcess, | |
unsigned | tag, | |||
MPI_Status & | status | |||
) | [inline] |
Receive an object
sourceProcess | the process from which the data will be received | |
tag | the unique identifier code | |
status | pointer to the MPI status |
Definition at line 211 of file ObjectCommunicator.hpp.
References PetscTools::GetWorld().
void ObjectCommunicator< CLASS >::SendObject | ( | boost::shared_ptr< CLASS > const | pObject, | |
unsigned | destinationProcess, | |||
unsigned | tag | |||
) | [inline] |
Send an object.
pObject | A pointer to the object to be sent | |
destinationProcess | the index of the process to send the data to | |
tag | a unique identifier tag for this communication |
Definition at line 166 of file ObjectCommunicator.hpp.
References PetscTools::GetWorld().
boost::shared_ptr< CLASS > ObjectCommunicator< CLASS >::SendRecvObject | ( | boost::shared_ptr< CLASS > const | pSendObject, | |
unsigned | destinationProcess, | |||
unsigned | sendTag, | |||
unsigned | sourceProcess, | |||
unsigned | sourceTag, | |||
MPI_Status & | status | |||
) | [inline] |
Send and receive an object
pSendObject | a pointer to the object to send | |
destinationProcess | the rank of the target process | |
sendTag | the tag to send with. | |
sourceProcess | the process from which the data will be received | |
sourceTag | the tag to receive with | |
status | a reference to an MPI_Status object. |
Definition at line 276 of file ObjectCommunicator.hpp.
References PetscTools::GetWorld().
Referenced by NodeBasedCellPopulation< DIM >::SendCellsToNeighbourProcesses().
bool ObjectCommunicator< CLASS >::mIsWriting [private] |
A flag, used as a lock to ensure that we don't accidentally start overwriting the above buffer, mRecvBuffer
Definition at line 84 of file ObjectCommunicator.hpp.
Referenced by ObjectCommunicator< CLASS >::GetRecvObject(), and ObjectCommunicator< CLASS >::IRecvObject().
MPI_Request ObjectCommunicator< CLASS >::mMpiRequest [private] |
An MPI_Request used in MPI_Irecv
Definition at line 81 of file ObjectCommunicator.hpp.
Referenced by ObjectCommunicator< CLASS >::GetRecvObject(), and ObjectCommunicator< CLASS >::IRecvObject().
char* ObjectCommunicator< CLASS >::mRecvBuffer [private] |
A buffer for use in asynchronous communication
Definition at line 62 of file ObjectCommunicator.hpp.
Referenced by ObjectCommunicator< CLASS >::GetRecvObject(), and ObjectCommunicator< CLASS >::IRecvObject().
unsigned ObjectCommunicator< CLASS >::mRecvBufferLength [private] |
The size of a string we are waiting for in an asynchronous receive
Definition at line 75 of file ObjectCommunicator.hpp.
std::vector<char* > ObjectCommunicator< CLASS >::mSendBuffer [private] |
A group of buffers for use in asynchronous communication. There's one for each process so that a non-blocking send request won't accidentally overwrite a message which is actively being communicated to another remote process
Definition at line 67 of file ObjectCommunicator.hpp.
Referenced by ObjectCommunicator< CLASS >::ISendObject(), and ObjectCommunicator< CLASS >::ObjectCommunicator().
unsigned ObjectCommunicator< CLASS >::mSendBufferLength [private] |
The size of a string we are sending
Definition at line 78 of file ObjectCommunicator.hpp.
Referenced by ObjectCommunicator< CLASS >::ISendObject().
std::vector<std::string> ObjectCommunicator< CLASS >::mSendString [private] |
A group of strings for use in asynchronous communication. There's one for each process so that a non-blocking send request won't accidentally overwrite a message which is actively being communicated to another remote process
Definition at line 72 of file ObjectCommunicator.hpp.
Referenced by ObjectCommunicator< CLASS >::ISendObject(), and ObjectCommunicator< CLASS >::ObjectCommunicator().