ESyS-Particle  2.3.4
TML_PackedMultiMessage Class Reference

Message buffer for sending and receiving packed data to mutltiple receivers. Data types are not checked. The implementation has been derived from the old CMPIVarSGBufferRoot class. More...

#include <packed_multi_message.h>

Public Member Functions

 TML_PackedMultiMessage (MPI_Comm, int isize=64)
 
virtual ~TML_PackedMultiMessage ()
 
TML_PackedMultiMessageSlab operator[] (int)
 
char * buffer ()
 
int * offsets ()
 
int * sizes ()
 
void clear ()
 
void begin_pack (int)
 
void begin_unpack (int)
 
void append (int, int)
 
void append (double, int)
 
void append (const string &, int)
 
void append (bool, int)
 
int pop_int (int)
 
double pop_double (int)
 
string pop_string ()
 
bool pop_bool (int)
 

Protected Member Functions

void grow ()
 
void growTo (int)
 

Private Attributes

MPI_Comm m_comm
 
char * m_vbuffer
 
int m_vbuffersize
 the size of the buffer per slice More...
 
int * m_position
 the current end of the content in each slice More...
 
int * m_rpos
 the number of bytes in the slice (i.e. m_position-m_displ) More...
 
int * m_recvcount
 the buffer for the transfer of the size of the vbuffer More...
 
int * m_displ
 
int m_size
 
int m_int_increment
 
int m_dbl_increment
 the "packing size" of int/double More...
 

Detailed Description

Message buffer for sending and receiving packed data to mutltiple receivers. Data types are not checked. The implementation has been derived from the old CMPIVarSGBufferRoot class.

Constructor & Destructor Documentation

◆ TML_PackedMultiMessage()

TML_PackedMultiMessage::TML_PackedMultiMessage ( MPI_Comm  comm,
int  isize = 64 
)

Constructor for TML_PackedMultiMessage

Parameters
commthe MPI communicator
isizeinitial buffer size per slice, default 64 byte

References m_comm, m_dbl_increment, m_displ, m_int_increment, m_position, m_recvcount, m_rpos, m_size, m_vbuffer, and m_vbuffersize.

◆ ~TML_PackedMultiMessage()

TML_PackedMultiMessage::~TML_PackedMultiMessage ( )
virtual

Member Function Documentation

◆ append() [1/4]

void TML_PackedMultiMessage::append ( bool  b,
int  nslice 
)

Append boolean value to a given slice of the buffer.

Parameters
bthe boolean
nslicethe nr. of the slice

References append().

Here is the call graph for this function:

◆ append() [2/4]

void TML_PackedMultiMessage::append ( const string &  str,
int  nslice 
)

Append a STL-string to a given slice of the buffer.

Parameters
strthe string
nslicethe nr. of the slice
Warning
No check for overflow

References grow(), esys::lsm::bpu::len(), m_comm, m_displ, m_int_increment, m_position, m_rpos, m_size, m_vbuffer, and m_vbuffersize.

Here is the call graph for this function:

◆ append() [3/4]

void TML_PackedMultiMessage::append ( double  d,
int  nslice 
)

Append a double to a given slice of the buffer.

Parameters
dthe double
nslicethe nr. of the slice
Warning
No check for overflow

References grow(), m_comm, m_dbl_increment, m_displ, m_position, m_rpos, m_size, m_vbuffer, and m_vbuffersize.

Here is the call graph for this function:

◆ append() [4/4]

void TML_PackedMultiMessage::append ( int  i,
int  nslice 
)

Append an integer to a given slice of the buffer.

Parameters
ithe integer
nslicethe nr. of the slice
Warning
No check for overflow

References grow(), m_comm, m_displ, m_int_increment, m_position, m_rpos, m_size, m_vbuffer, and m_vbuffersize.

Referenced by append(), and TML_PackedMultiMessageSlab::append().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ begin_pack()

void TML_PackedMultiMessage::begin_pack ( int  i)

reset single packing posn to 0

References m_displ, and m_position.

Referenced by TML_PackedMultiMessageSlab::begin_pack().

Here is the caller graph for this function:

◆ begin_unpack()

void TML_PackedMultiMessage::begin_unpack ( int  i)

reset single unpacking posn to 0

References m_displ, and m_position.

Referenced by TML_PackedMultiMessageSlab::begin_unpack(), and test_pack_multi().

Here is the caller graph for this function:

◆ buffer()

char* TML_PackedMultiMessage::buffer ( )
inline

References m_vbuffer.

Referenced by TML_Comm::scatter_packed().

Here is the caller graph for this function:

◆ clear()

void TML_PackedMultiMessage::clear ( )

clear message buffer, i.e. reset all positions to 0

References m_displ, m_position, m_rpos, and m_size.

◆ grow()

void TML_PackedMultiMessage::grow ( )
protected

Grows the buffer to twice its current size, thus guaranteeing that append works in amortized constant time. Currently grows the buffer homogeneously, i.e. all slices have the same size.

Warning
no check if there is enough space for the new buffer

References m_displ, m_position, m_rpos, m_size, m_vbuffer, and m_vbuffersize.

Referenced by append().

Here is the caller graph for this function:

◆ growTo()

void TML_PackedMultiMessage::growTo ( int  size)
protected

Grow buffer to a specified size

Parameters
sizethe size to grow to

References m_displ, m_position, m_rpos, m_size, m_vbuffer, and m_vbuffersize.

◆ offsets()

int* TML_PackedMultiMessage::offsets ( )
inline

References m_displ.

Referenced by TML_Comm::scatter_packed().

Here is the caller graph for this function:

◆ operator[]()

TML_PackedMultiMessageSlab TML_PackedMultiMessage::operator[] ( int  i)

return a slab

◆ pop_bool()

bool TML_PackedMultiMessage::pop_bool ( int  nslice)

Pops a boolean from a given slice of the the buffer, i.e. it pops the last sizeof(MPI_INT) bytes of the buffer, interpreting them as a boolean (via pop_int()).

Parameters
nslicethe nr. of the slice
Returns
the boolean value
Warning
No check for underflow

References pop_int().

Referenced by TML_PackedMultiMessageSlab::pop_bool().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pop_double()

double TML_PackedMultiMessage::pop_double ( int  nslice)

Pops a double from a given slice of the the buffer.

Parameters
nslicethe nr. of the slice
Returns
the double.
Warning
No check for underflow

References m_comm, m_position, m_size, m_vbuffer, and m_vbuffersize.

Referenced by TML_PackedMultiMessageSlab::pop_double(), and TML_PackedMultiMessageSlab::pop_vec3().

Here is the caller graph for this function:

◆ pop_int()

int TML_PackedMultiMessage::pop_int ( int  nslice)

Pops an integer from a given slice of the the buffer, i.e. it pops the last sizeof(MPI_INT) bytes of the buffer, interpreting them as an int.

Parameters
nslicethe nr. of the slice
Returns
the int.
Warning
No check for underflow

References m_comm, m_position, m_size, m_vbuffer, and m_vbuffersize.

Referenced by pop_bool(), and TML_PackedMultiMessageSlab::pop_int().

Here is the caller graph for this function:

◆ pop_string()

string TML_PackedMultiMessage::pop_string ( )

Pops a string from a given slice of the the buffer.

Parameters
nslicethe nr. of the slice
Returns
the string.
Warning
Not implemented
Todo:
implement

◆ sizes()

int* TML_PackedMultiMessage::sizes ( )
inline

References m_rpos.

Referenced by TML_Comm::scatter_packed().

Here is the caller graph for this function:

Member Data Documentation

◆ m_comm

MPI_Comm TML_PackedMultiMessage::m_comm
private

◆ m_dbl_increment

int TML_PackedMultiMessage::m_dbl_increment
private

the "packing size" of int/double

Referenced by append(), and TML_PackedMultiMessage().

◆ m_displ

int* TML_PackedMultiMessage::m_displ
private

◆ m_int_increment

int TML_PackedMultiMessage::m_int_increment
private

Referenced by append(), and TML_PackedMultiMessage().

◆ m_position

int* TML_PackedMultiMessage::m_position
private

the current end of the content in each slice

Referenced by append(), begin_pack(), begin_unpack(), clear(), grow(), growTo(), pop_double(), pop_int(), TML_PackedMultiMessage(), and ~TML_PackedMultiMessage().

◆ m_recvcount

int* TML_PackedMultiMessage::m_recvcount
private

the buffer for the transfer of the size of the vbuffer

Referenced by TML_PackedMultiMessage(), and ~TML_PackedMultiMessage().

◆ m_rpos

int* TML_PackedMultiMessage::m_rpos
private

the number of bytes in the slice (i.e. m_position-m_displ)

Referenced by append(), clear(), grow(), growTo(), sizes(), TML_PackedMultiMessage(), and ~TML_PackedMultiMessage().

◆ m_size

int TML_PackedMultiMessage::m_size
private

◆ m_vbuffer

char* TML_PackedMultiMessage::m_vbuffer
private

◆ m_vbuffersize

int TML_PackedMultiMessage::m_vbuffersize
private

the size of the buffer per slice

Referenced by append(), grow(), growTo(), pop_double(), pop_int(), and TML_PackedMultiMessage().


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