ESyS-Particle
4.0.1
|
Constant size MPI send/recv buffer. More...
#include <mpibuf.h>
Public Member Functions | |
CMPIBuffer (MPI_Comm, int) | |
virtual void | clear () |
virtual void | sendTo (int, int) |
virtual void | receiveFrom (int src=MPI_ANY_SOURCE, int tag=MPI_ANY_TAG) |
virtual void | append (int) |
virtual void | append (double) |
virtual void | append (const char *) |
bool | append_checked (int) |
bool | append_checked (double) |
virtual int | pop_int () |
virtual double | pop_double () |
virtual void | pop_doubles (double *, int) |
virtual std::string | pop_string () |
Constant size MPI send/recv buffer.
CMPIBuffer implements a send/receive buffer. MPI_pack/MPI_unpack is used the transfer arbitrary data. Type information is not transported. i.e. the user has to know the type of the content of a received message.
CMPIBuffer::CMPIBuffer | ( | MPI_Comm | comm, |
int | s | ||
) |
Constructor. Allocates the buffer and sets the MPI communicator to be used for send/receive operations.
comm | the MPI communicator |
s | the size of the buffer |
References AMPIBuffer::m_comm.
void CMPIBuffer::append | ( | int | i | ) | [virtual] |
Append an integer to the buffer.
Implements AMPIBuffer.
References AMPIBuffer::m_comm.
void CMPIBuffer::append | ( | double | d | ) | [virtual] |
Append a double to the buffer.
Implements AMPIBuffer.
References AMPIBuffer::m_comm.
void CMPIBuffer::append | ( | const char * | str | ) | [virtual] |
Append a string to the buffer. The string appended is a normal (zero-terminated) C-string, but is internally handeled by packing the length frist and then the string.
Implements AMPIBuffer.
References AMPIBuffer::m_comm.
bool CMPIBuffer::append_checked | ( | int | i | ) |
Append an integer to the buffer with overflow check. If the buffer is big enough the integer is appended, if not nothing is done.
References AMPIBuffer::m_comm.
bool CMPIBuffer::append_checked | ( | double | d | ) |
Append a double to the buffer with overflow check.
References AMPIBuffer::m_comm.
double CMPIBuffer::pop_double | ( | ) | [virtual] |
Pops a double from the buffer.
Implements AMPIBuffer.
References AMPIBuffer::m_comm.
void CMPIBuffer::pop_doubles | ( | double * | dbl, |
int | ndb | ||
) | [virtual] |
int CMPIBuffer::pop_int | ( | ) | [virtual] |
Pops an integer from the buffer, i.e. it pops the last sizeof(MPI_INT) bytes of the buffer, interpreting them as an int.
Implements AMPIBuffer.
References AMPIBuffer::m_comm.
std::string CMPIBuffer::pop_string | ( | ) | [virtual] |
Pops a string from the buffer. The first for bytes are interpreted as int, giving the length of the string (without terminating '\0'), the rest as the characters.
Implements AMPIBuffer.
References AMPIBuffer::m_comm.
void CMPIBuffer::receiveFrom | ( | int | src = MPI_ANY_SOURCE , |
int | tag = MPI_ANY_TAG |
||
) | [virtual] |
Recieves a message from a given source and stores it in the buffer. It is assumed that the buffer is large enough the take the message. If no source and no tag are given, any message from any source is accepted.
src | rank of the sender in the current communicator, defaults to MPI_ANY_SOURCE |
tag | the message tag, defaults to MPI_ANY_TAG |
Implements AMPIBufferPP.
References AMPIBuffer::m_comm.
void CMPIBuffer::sendTo | ( | int | dest, |
int | tag | ||
) | [virtual] |
Sends the contents of the buffer to a given destination.
dest | the rank of the destination process in the current communicator |
tag | the message tag |
Implements AMPIBufferPP.
References AMPIBuffer::m_comm.