OOFEM 3.0
Loading...
Searching...
No Matches
oofem::ProcessCommunicatorBuff Class Reference

#include <processcomm.h>

Inheritance diagram for oofem::ProcessCommunicatorBuff:
Collaboration diagram for oofem::ProcessCommunicatorBuff:

Public Member Functions

 ProcessCommunicatorBuff (CommBuffType t)
 Constructor, creates empty send and receive com buffs in MPI_COMM_WORLD.
int givePackSizeOfInt (std::size_t count) override
int givePackSizeOfDouble (std::size_t count) override
int givePackSizeOfChar (std::size_t count) override
int givePackSizeOfBool (std::size_t count) override
int givePackSizeOfLong (std::size_t count) override
int givePackSizeOfSizet (std::size_t count) override
int write (const int *data, std::size_t count) override
 Writes count integer values from array pointed by data.
int write (const long *data, std::size_t count) override
 Writes count long values from array pointed by data.
int write (const unsigned long *data, std::size_t count) override
 Writes count unsigned long values from array pointed by data.
int write (const double *data, std::size_t count) override
 Writes count double values from array pointed by data.
int write (const char *data, std::size_t count) override
 Writes count char values from array pointed by data.
int write (bool data) override
 Writes a bool value.
int read (int *data, std::size_t count) override
 Reads count integer values into array pointed by data.
int read (long *data, std::size_t count) override
 Reads count long values into array pointed by data.
int read (unsigned long *data, std::size_t count) override
 Reads count unsigned long values into array pointed by data.
int read (double *data, std::size_t count) override
 Reads count double values into array pointed by data.
int read (char *data, std::size_t count) override
 Reads count char values into array pointed by data.
int read (bool &data) override
 Reads a bool value from data.
void initSendBuff ()
 Initializes send buffer to empty state. All packed data are lost.
void initRecvBuff ()
 Initializes send buffer to empty state. All packed data are lost.
void init ()
 Initializes receiver buffers.
void initForPacking ()
 Initialize for packing.
void initForUnpacking ()
 Initialize for Unpacking (data already received).
int initExchange (int rank, int tag)
int initSend (int rank, int tag)
int initReceive (int rank, int tag)
void clearBuffers ()
void resizeSendBuffer (std::size_t size)
void resizeReceiveBuffer (std::size_t size)
int write (int data)
int write (unsigned long data)
int write (long data)
int write (double data)
int write (char data)
int write (const std ::string &data)
 Reads a string (stored as an int for the length followed by char*).
int write (const char *data)
 Writes a string (wrapper needed, otherwise write(bool) is called ).
int read (int &data)
int read (unsigned long &data)
int read (long &data)
int read (double &data)
int read (char &data)
int read (std ::string &data)
 Reads a string (stored as an int for the length followed by char*).
Methods for manipulating/testing receiver state
int sendCompleted ()
int receiveCompleted ()
int testCompletion ()
int waitCompletion ()
CommunicationBuffergiveSendBuff ()
CommunicationBuffergiveRecvBuff ()
Public Member Functions inherited from oofem::DataStream
virtual ~DataStream ()
 Destructor.
int read (int &data)
int read (unsigned long &data)
int read (long &data)
int read (double &data)
int read (char &data)
int read (std ::string &data)
 Reads a string (stored as an int for the length followed by char*).
int write (int data)
int write (unsigned long data)
int write (long data)
int write (double data)
int write (char data)
int write (const std ::string &data)
 Reads a string (stored as an int for the length followed by char*).
int write (const char *data)
 Writes a string (wrapper needed, otherwise write(bool) is called ).

Protected Attributes

std::unique_ptr< CommunicationBuffersend_buff
 Send buffer.
std::unique_ptr< CommunicationBufferrecv_buff
 Receive buffer.

Detailed Description

The ProcessCommunicator and corresponding buffers (represented by this class) are separated in order to allow share the same buffer by several communicators. Here sharing means reusing for different but NON-OVERLAPPING communications. if communications overlap, the different instances of ProcessCommunicatorBuff should be used! The ProcessCommunicatorBuff objects are registered in corresponding communicator, then if maps are available, comBuff should be resized and used in subsequent operations.

The registration is necessary, otherwise before each send operation the buffers (given probably as parameter) will be resized again (size have to be computed again) and this is probably quite cost operation. When comBuff will be registered, resize is needed only when maps change, and this will not occur frequently (its even quite rare).

Definition at line 66 of file processcomm.h.

Constructor & Destructor Documentation

◆ ProcessCommunicatorBuff()

oofem::ProcessCommunicatorBuff::ProcessCommunicatorBuff ( CommBuffType t)

Constructor, creates empty send and receive com buffs in MPI_COMM_WORLD.

Definition at line 45 of file processcomm.C.

References oofem::CBT_static, recv_buff, and send_buff.

Member Function Documentation

◆ clearBuffers()

void oofem::ProcessCommunicatorBuff::clearBuffers ( )
inline

Clears all buffer contents.

Definition at line 150 of file processcomm.h.

◆ givePackSizeOfBool()

int oofem::ProcessCommunicatorBuff::givePackSizeOfBool ( std::size_t count)
inlineoverridevirtual

Implements oofem::DataStream.

Definition at line 80 of file processcomm.h.

References send_buff.

◆ givePackSizeOfChar()

int oofem::ProcessCommunicatorBuff::givePackSizeOfChar ( std::size_t count)
inlineoverridevirtual

Implements oofem::DataStream.

Definition at line 79 of file processcomm.h.

References send_buff.

◆ givePackSizeOfDouble()

int oofem::ProcessCommunicatorBuff::givePackSizeOfDouble ( std::size_t count)
inlineoverridevirtual

Implements oofem::DataStream.

Definition at line 78 of file processcomm.h.

References send_buff.

◆ givePackSizeOfInt()

int oofem::ProcessCommunicatorBuff::givePackSizeOfInt ( std::size_t count)
inlineoverridevirtual

Implements oofem::DataStream.

Definition at line 77 of file processcomm.h.

References send_buff.

◆ givePackSizeOfLong()

int oofem::ProcessCommunicatorBuff::givePackSizeOfLong ( std::size_t count)
inlineoverridevirtual

Implements oofem::DataStream.

Definition at line 81 of file processcomm.h.

References send_buff.

◆ givePackSizeOfSizet()

int oofem::ProcessCommunicatorBuff::givePackSizeOfSizet ( std::size_t count)
inlineoverridevirtual

Implements oofem::DataStream.

Definition at line 82 of file processcomm.h.

References send_buff.

◆ giveRecvBuff()

◆ giveSendBuff()

◆ init()

void oofem::ProcessCommunicatorBuff::init ( )
inline

Initializes receiver buffers.

Definition at line 106 of file processcomm.h.

References initRecvBuff(), and initSendBuff().

◆ initExchange()

int oofem::ProcessCommunicatorBuff::initExchange ( int rank,
int tag )
inline

Initializes data exchange with associated problem. if send or receive pool is empty, the send or receive communication is not performed.

Parameters
rankPartition number.
tagMessage tag.
Returns
Nonzero if success.

Definition at line 123 of file processcomm.h.

References initReceive(), and initSend().

◆ initForPacking()

void oofem::ProcessCommunicatorBuff::initForPacking ( )
inline

Initialize for packing.

Definition at line 112 of file processcomm.h.

References send_buff.

◆ initForUnpacking()

void oofem::ProcessCommunicatorBuff::initForUnpacking ( )
inline

Initialize for Unpacking (data already received).

Definition at line 114 of file processcomm.h.

References recv_buff.

◆ initReceive()

int oofem::ProcessCommunicatorBuff::initReceive ( int rank,
int tag )
inline

Initialize the receive data exchange with associate problem. if receive pool is empty, the receive communication is not performed.

Parameters
rankPartition number.
tagMessage tag.
Returns
Nonzero if success.

Definition at line 145 of file processcomm.h.

References recv_buff.

Referenced by initExchange().

◆ initRecvBuff()

void oofem::ProcessCommunicatorBuff::initRecvBuff ( )
inline

Initializes send buffer to empty state. All packed data are lost.

Definition at line 104 of file processcomm.h.

References recv_buff.

Referenced by init().

◆ initSend()

int oofem::ProcessCommunicatorBuff::initSend ( int rank,
int tag )
inline

Initialize the send data exchange with associate problem. if send pool is empty, the send communication is not performed.

Parameters
rankPartition number.
tagMessage tag.
Returns
Nonzero if success.

Definition at line 137 of file processcomm.h.

References send_buff.

Referenced by initExchange().

◆ initSendBuff()

void oofem::ProcessCommunicatorBuff::initSendBuff ( )
inline

Initializes send buffer to empty state. All packed data are lost.

Definition at line 102 of file processcomm.h.

References send_buff.

Referenced by init().

◆ read() [1/12]

int oofem::ProcessCommunicatorBuff::read ( bool & data)
inlineoverridevirtual

Reads a bool value from data.

Implements oofem::DataStream.

Definition at line 99 of file processcomm.h.

References recv_buff.

◆ read() [2/12]

int oofem::DataStream::read ( char & data)
inline

Definition at line 85 of file datastream.h.

◆ read() [3/12]

int oofem::ProcessCommunicatorBuff::read ( char * data,
std::size_t count )
inlineoverridevirtual

Reads count char values into array pointed by data.

Implements oofem::DataStream.

Definition at line 98 of file processcomm.h.

◆ read() [4/12]

int oofem::DataStream::read ( double & data)
inline

Definition at line 82 of file datastream.h.

◆ read() [5/12]

int oofem::ProcessCommunicatorBuff::read ( double * data,
std::size_t count )
inlineoverridevirtual

Reads count double values into array pointed by data.

Implements oofem::DataStream.

Definition at line 97 of file processcomm.h.

◆ read() [6/12]

int oofem::DataStream::read ( int & data)
inline

Definition at line 68 of file datastream.h.

◆ read() [7/12]

◆ read() [8/12]

int oofem::DataStream::read ( long & data)
inline

Definition at line 79 of file datastream.h.

◆ read() [9/12]

int oofem::ProcessCommunicatorBuff::read ( long * data,
std::size_t count )
inlineoverridevirtual

Reads count long values into array pointed by data.

Implements oofem::DataStream.

Definition at line 95 of file processcomm.h.

◆ read() [10/12]

int oofem::DataStream::read ( std ::string & data)

Reads a string (stored as an int for the length followed by char*).

Definition at line 89 of file datastream.C.

◆ read() [11/12]

int oofem::DataStream::read ( unsigned long & data)
inline

Definition at line 71 of file datastream.h.

◆ read() [12/12]

int oofem::ProcessCommunicatorBuff::read ( unsigned long * data,
std::size_t count )
inlineoverridevirtual

Reads count unsigned long values into array pointed by data.

Implements oofem::DataStream.

Definition at line 96 of file processcomm.h.

◆ receiveCompleted()

int oofem::ProcessCommunicatorBuff::receiveCompleted ( )
inline

Definition at line 158 of file processcomm.h.

References recv_buff.

◆ resizeReceiveBuffer()

void oofem::ProcessCommunicatorBuff::resizeReceiveBuffer ( std::size_t size)
inline

Definition at line 153 of file processcomm.h.

References recv_buff.

◆ resizeSendBuffer()

void oofem::ProcessCommunicatorBuff::resizeSendBuffer ( std::size_t size)
inline

Definition at line 152 of file processcomm.h.

References send_buff.

◆ sendCompleted()

int oofem::ProcessCommunicatorBuff::sendCompleted ( )
inline

Definition at line 157 of file processcomm.h.

References send_buff.

◆ testCompletion()

int oofem::ProcessCommunicatorBuff::testCompletion ( )
inline

Definition at line 159 of file processcomm.h.

References recv_buff, and send_buff.

◆ waitCompletion()

int oofem::ProcessCommunicatorBuff::waitCompletion ( )
inline

Definition at line 160 of file processcomm.h.

References recv_buff, and send_buff.

◆ write() [1/13]

int oofem::ProcessCommunicatorBuff::write ( bool data)
inlineoverridevirtual

Writes a bool value.

Implements oofem::DataStream.

Definition at line 91 of file processcomm.h.

References send_buff.

◆ write() [2/13]

int oofem::DataStream::write ( char data)
inline

Definition at line 117 of file datastream.h.

◆ write() [3/13]

int oofem::DataStream::write ( const char * data)
inline

Writes a string (wrapper needed, otherwise write(bool) is called ).

Definition at line 123 of file datastream.h.

◆ write() [4/13]

int oofem::ProcessCommunicatorBuff::write ( const char * data,
std::size_t count )
inlineoverridevirtual

Writes count char values from array pointed by data.

Implements oofem::DataStream.

Definition at line 90 of file processcomm.h.

References send_buff.

◆ write() [5/13]

int oofem::ProcessCommunicatorBuff::write ( const double * data,
std::size_t count )
inlineoverridevirtual

Writes count double values from array pointed by data.

Implements oofem::DataStream.

Definition at line 89 of file processcomm.h.

References send_buff.

◆ write() [6/13]

◆ write() [7/13]

int oofem::ProcessCommunicatorBuff::write ( const long * data,
std::size_t count )
inlineoverridevirtual

Writes count long values from array pointed by data.

Implements oofem::DataStream.

Definition at line 87 of file processcomm.h.

References send_buff.

◆ write() [8/13]

int oofem::DataStream::write ( const std ::string & data)

Reads a string (stored as an int for the length followed by char*).

Definition at line 121 of file datastream.C.

◆ write() [9/13]

int oofem::ProcessCommunicatorBuff::write ( const unsigned long * data,
std::size_t count )
inlineoverridevirtual

Writes count unsigned long values from array pointed by data.

Implements oofem::DataStream.

Definition at line 88 of file processcomm.h.

References send_buff.

◆ write() [10/13]

int oofem::DataStream::write ( double data)
inline

Definition at line 114 of file datastream.h.

◆ write() [11/13]

int oofem::DataStream::write ( int data)
inline

Definition at line 100 of file datastream.h.

◆ write() [12/13]

int oofem::DataStream::write ( long data)
inline

Definition at line 111 of file datastream.h.

◆ write() [13/13]

int oofem::DataStream::write ( unsigned long data)
inline

Definition at line 103 of file datastream.h.

Member Data Documentation

◆ recv_buff

std::unique_ptr<CommunicationBuffer> oofem::ProcessCommunicatorBuff::recv_buff
protected

◆ send_buff


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

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011