Chaste
Release::3.4
|
#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 | ( | ) |
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 | ( | ) |
Obtain a proper object once a call to IRecv has completed
Definition at line 244 of file ObjectCommunicator.hpp.
References EXCEPTION.
void ObjectCommunicator< CLASS >::IRecvObject | ( | unsigned | sourceProcess, |
unsigned | tag | ||
) |
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().
void ObjectCommunicator< CLASS >::ISendObject | ( | boost::shared_ptr< CLASS > const | pObject, |
unsigned | destinationProcess, | ||
unsigned | tag | ||
) |
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().
boost::shared_ptr< CLASS > ObjectCommunicator< CLASS >::RecvObject | ( | unsigned | sourceProcess, |
unsigned | tag, | ||
MPI_Status & | status | ||
) |
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 | ||
) |
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 | ||
) |
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().
|
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.
|
private |
An MPI_Request used in MPI_Irecv
Definition at line 81 of file ObjectCommunicator.hpp.
|
private |
A buffer for use in asynchronous communication
Definition at line 62 of file ObjectCommunicator.hpp.
|
private |
The size of a string we are waiting for in an asynchronous receive
Definition at line 75 of file ObjectCommunicator.hpp.
|
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 >::ObjectCommunicator().
|
private |
The size of a string we are sending
Definition at line 78 of file ObjectCommunicator.hpp.
|
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 >::ObjectCommunicator().