|
ESyS-Particle
2.3.4
|
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... | |
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.
| TML_PackedMultiMessage::TML_PackedMultiMessage | ( | MPI_Comm | comm, |
| int | isize = 64 |
||
| ) |
Constructor for TML_PackedMultiMessage
| comm | the MPI communicator |
| isize | initial 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.
|
virtual |
References m_displ, m_position, m_recvcount, m_rpos, and m_vbuffer.
| void TML_PackedMultiMessage::append | ( | bool | b, |
| int | nslice | ||
| ) |
Append boolean value to a given slice of the buffer.
| b | the boolean |
| nslice | the nr. of the slice |
References append().

| void TML_PackedMultiMessage::append | ( | const string & | str, |
| int | nslice | ||
| ) |
Append a STL-string to a given slice of the buffer.
| str | the string |
| nslice | the nr. of the slice |
References grow(), esys::lsm::bpu::len(), m_comm, m_displ, m_int_increment, m_position, m_rpos, m_size, m_vbuffer, and m_vbuffersize.

| void TML_PackedMultiMessage::append | ( | double | d, |
| int | nslice | ||
| ) |
Append a double to a given slice of the buffer.
| d | the double |
| nslice | the nr. of the slice |
References grow(), m_comm, m_dbl_increment, m_displ, m_position, m_rpos, m_size, m_vbuffer, and m_vbuffersize.

| void TML_PackedMultiMessage::append | ( | int | i, |
| int | nslice | ||
| ) |
Append an integer to a given slice of the buffer.
| i | the integer |
| nslice | the nr. of the slice |
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().


| 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().

| 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().

|
inline |
References m_vbuffer.
Referenced by TML_Comm::scatter_packed().

| void TML_PackedMultiMessage::clear | ( | ) |
clear message buffer, i.e. reset all positions to 0
References m_displ, m_position, m_rpos, and m_size.
|
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.
References m_displ, m_position, m_rpos, m_size, m_vbuffer, and m_vbuffersize.
Referenced by append().

|
protected |
Grow buffer to a specified size
| size | the size to grow to |
References m_displ, m_position, m_rpos, m_size, m_vbuffer, and m_vbuffersize.
|
inline |
References m_displ.
Referenced by TML_Comm::scatter_packed().

| TML_PackedMultiMessageSlab TML_PackedMultiMessage::operator[] | ( | int | i | ) |
return a slab
| 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()).
| nslice | the nr. of the slice |
References pop_int().
Referenced by TML_PackedMultiMessageSlab::pop_bool().


| double TML_PackedMultiMessage::pop_double | ( | int | nslice | ) |
Pops a double from a given slice of the the buffer.
| nslice | the nr. of the slice |
References m_comm, m_position, m_size, m_vbuffer, and m_vbuffersize.
Referenced by TML_PackedMultiMessageSlab::pop_double(), and TML_PackedMultiMessageSlab::pop_vec3().

| 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.
| nslice | the nr. of the slice |
References m_comm, m_position, m_size, m_vbuffer, and m_vbuffersize.
Referenced by pop_bool(), and TML_PackedMultiMessageSlab::pop_int().

| string TML_PackedMultiMessage::pop_string | ( | ) |
Pops a string from a given slice of the the buffer.
| nslice | the nr. of the slice |
|
inline |
References m_rpos.
Referenced by TML_Comm::scatter_packed().

|
private |
Referenced by append(), pop_double(), pop_int(), and TML_PackedMultiMessage().
|
private |
the "packing size" of int/double
Referenced by append(), and TML_PackedMultiMessage().
|
private |
Referenced by append(), begin_pack(), begin_unpack(), clear(), grow(), growTo(), offsets(), TML_PackedMultiMessage(), and ~TML_PackedMultiMessage().
|
private |
Referenced by append(), and TML_PackedMultiMessage().
|
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().
|
private |
the buffer for the transfer of the size of the vbuffer
Referenced by TML_PackedMultiMessage(), and ~TML_PackedMultiMessage().
|
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().
|
private |
Referenced by append(), clear(), grow(), growTo(), pop_double(), pop_int(), and TML_PackedMultiMessage().
|
private |
Referenced by append(), buffer(), grow(), growTo(), pop_double(), pop_int(), TML_PackedMultiMessage(), and ~TML_PackedMultiMessage().
|
private |
the size of the buffer per slice
Referenced by append(), grow(), growTo(), pop_double(), pop_int(), and TML_PackedMultiMessage().