ESyS-Particle  4.0.1
Public Member Functions
CMPIBuffer Class Reference

Constant size MPI send/recv buffer. More...

#include <mpibuf.h>

Inheritance diagram for CMPIBuffer:
Inheritance graph
[legend]
Collaboration diagram for CMPIBuffer:
Collaboration graph
[legend]

List of all members.

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 ()
- Public Member Functions inherited from AMPIBufferPP
 AMPIBufferPP (MPI_Comm comm)
- Public Member Functions inherited from AMPIBuffer
 AMPIBuffer (MPI_Comm comm)
virtual void append (const Vec3 &)
virtual Vec3 pop_vector ()
const MPI_Status & status ()

Detailed Description

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.

Author:
Steffen Abe $Revision$ $Date$

Constructor & Destructor Documentation

CMPIBuffer::CMPIBuffer ( MPI_Comm  comm,
int  s 
)

Constructor. Allocates the buffer and sets the MPI communicator to be used for send/receive operations.

Parameters:
commthe MPI communicator
sthe size of the buffer

References AMPIBuffer::m_comm.


Member Function Documentation

void CMPIBuffer::append ( int  i)
virtual

Append an integer to the buffer.

Warning:
No check for overflow

Implements AMPIBuffer.

References AMPIBuffer::m_comm.

void CMPIBuffer::append ( double  d)
virtual

Append a double to the buffer.

Warning:
No check for overflow

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.

Warning:
No check for overflow

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.

Returns:
true if the append succeded, false otherwise

References AMPIBuffer::m_comm.

bool CMPIBuffer::append_checked ( double  d)

Append a double to the buffer with overflow check.

See also:
CMPIBuffer::append_checked(int i)

References AMPIBuffer::m_comm.

double CMPIBuffer::pop_double ( )
virtual

Pops a double from the buffer.

Warning:
No check for underflow
Returns:
the double.
See also:
CMPIBuffer::pop_int()

Implements AMPIBuffer.

References AMPIBuffer::m_comm.

void CMPIBuffer::pop_doubles ( double *  dbl,
int  ndb 
)
virtual

pop an array of doubles from a buffer

Implements AMPIBuffer.

References AMPIBuffer::m_comm.

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.

Warning:
No check for underflow
Returns:
the 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.

Warning:
no consistency check, i.e. it is not checked if the length is smaller than the buffersize.
Returns:
the double.
See also:
CMPISingle::pop_int()

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.

Warning:
No check if the buffer is big enough
Parameters:
srcrank of the sender in the current communicator, defaults to MPI_ANY_SOURCE
tagthe 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.

Parameters:
destthe rank of the destination process in the current communicator
tagthe message tag
Warning:
It is not checked if the destination actually exists.

Implements AMPIBufferPP.

References AMPIBuffer::m_comm.


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