OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
oofem::ProcessCommunicatorBuff Class Reference

The ProcessCommunicator and corresponding buffers (represented by this class) are separated in order to allow share the same buffer by several communicators. More...

#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. More...
 
virtual ~ProcessCommunicatorBuff ()
 
virtual int givePackSizeOfInt (int count)
 
virtual int givePackSizeOfDouble (int count)
 
virtual int givePackSizeOfChar (int count)
 
virtual int givePackSizeOfBool (int count)
 
virtual int givePackSizeOfLong (int count)
 
virtual int write (const int *data, int count)
 Writes count integer values from array pointed by data. More...
 
virtual int write (const long *data, int count)
 Writes count long values from array pointed by data. More...
 
virtual int write (const unsigned long *data, int count)
 Writes count unsigned long values from array pointed by data. More...
 
virtual int write (const double *data, int count)
 Writes count double values from array pointed by data. More...
 
virtual int write (const char *data, int count)
 Writes count char values from array pointed by data. More...
 
virtual int write (bool data)
 Writes a bool value. More...
 
virtual int read (int *data, int count)
 Reads count integer values into array pointed by data. More...
 
virtual int read (long *data, int count)
 Reads count long values into array pointed by data. More...
 
virtual int read (unsigned long *data, int count)
 Reads count unsigned long values into array pointed by data. More...
 
virtual int read (double *data, int count)
 Reads count double values into array pointed by data. More...
 
virtual int read (char *data, int count)
 Reads count char values into array pointed by data. More...
 
virtual int read (bool &data)
 Reads a bool value from data. More...
 
void initSendBuff ()
 Initializes send buffer to empty state. All packed data are lost. More...
 
void initRecvBuff ()
 Initializes send buffer to empty state. All packed data are lost. More...
 
void init ()
 Initializes receiver buffers. More...
 
void initForPacking ()
 Initialize for packing. More...
 
void initForUnpacking ()
 Initialize for Unpacking (data already received). More...
 
int initExchange (int rank, int tag)
 Initializes data exchange with associated problem. More...
 
int initSend (int rank, int tag)
 Initialize the send data exchange with associate problem. More...
 
int initReceive (int rank, int tag)
 Initialize the receive data exchange with associate problem. More...
 
void clearBuffers ()
 Clears all buffer contents. More...
 
void resizeSendBuffer (int size)
 
void resizeReceiveBuffer (int size)
 
CommunicationBuffergiveSendBuff ()
 Returns send buffer of receiver. More...
 
CommunicationBuffergiveRecvBuff ()
 Returns receive buffer of receiver. More...
 
Methods for manipulating/testing receiver state
int sendCompleted ()
 
int receiveCompleted ()
 
int testCompletion ()
 
int waitCompletion ()
 
- Public Member Functions inherited from oofem::DataStream
virtual ~DataStream ()
 Destructor. More...
 
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*). More...
 
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*). More...
 
int write (const char *data)
 Writes a string (wrapper needed, otherwise write(bool) is called ) More...
 

Protected Attributes

CommunicationBuffersend_buff
 Send buffer. More...
 
CommunicationBufferrecv_buff
 Receive buffer. More...
 

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 64 of file processcomm.h.

Constructor & Destructor Documentation

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.

oofem::ProcessCommunicatorBuff::~ProcessCommunicatorBuff ( )
virtual

Definition at line 66 of file processcomm.C.

Member Function Documentation

void oofem::ProcessCommunicatorBuff::clearBuffers ( )
inline

Clears all buffer contents.

Definition at line 147 of file processcomm.h.

virtual int oofem::ProcessCommunicatorBuff::givePackSizeOfBool ( int  count)
inlinevirtual

Implements oofem::DataStream.

Definition at line 79 of file processcomm.h.

References oofem::CommunicationBuffer::givePackSizeOfBool().

virtual int oofem::ProcessCommunicatorBuff::givePackSizeOfChar ( int  count)
inlinevirtual

Implements oofem::DataStream.

Definition at line 78 of file processcomm.h.

References oofem::CommunicationBuffer::givePackSizeOfChar().

virtual int oofem::ProcessCommunicatorBuff::givePackSizeOfDouble ( int  count)
inlinevirtual

Implements oofem::DataStream.

Definition at line 77 of file processcomm.h.

References oofem::CommunicationBuffer::givePackSizeOfDouble().

virtual int oofem::ProcessCommunicatorBuff::givePackSizeOfInt ( int  count)
inlinevirtual

Implements oofem::DataStream.

Definition at line 76 of file processcomm.h.

References oofem::CommunicationBuffer::givePackSizeOfInt().

virtual int oofem::ProcessCommunicatorBuff::givePackSizeOfLong ( int  count)
inlinevirtual
void oofem::ProcessCommunicatorBuff::init ( )
inline

Initializes receiver buffers.

Definition at line 103 of file processcomm.h.

Referenced by oofem::ProcessCommunicator::clearBuffers().

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 120 of file processcomm.h.

void oofem::ProcessCommunicatorBuff::initForPacking ( )
inline

Initialize for packing.

Definition at line 109 of file processcomm.h.

References oofem::CommunicationBuffer::initForPacking().

void oofem::ProcessCommunicatorBuff::initForUnpacking ( )
inline

Initialize for Unpacking (data already received).

Definition at line 111 of file processcomm.h.

References oofem::CommunicationBuffer::initForUnpacking().

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 142 of file processcomm.h.

References oofem::CommunicationBuffer::iRecv().

Referenced by oofem::ProcessCommunicator::initReceive().

void oofem::ProcessCommunicatorBuff::initRecvBuff ( )
inline

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

Definition at line 101 of file processcomm.h.

References oofem::CommunicationBuffer::init().

Referenced by oofem::ProcessCommunicator::initReceive().

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 134 of file processcomm.h.

References oofem::CommunicationBuffer::iSend().

Referenced by oofem::ProcessCommunicator::initSend().

void oofem::ProcessCommunicatorBuff::initSendBuff ( )
inline

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

Definition at line 99 of file processcomm.h.

References oofem::CommunicationBuffer::init().

Referenced by oofem::ProcessCommunicator::initSend().

virtual int oofem::ProcessCommunicatorBuff::read ( long *  data,
int  count 
)
inlinevirtual

Reads count long values into array pointed by data.

Implements oofem::DataStream.

Definition at line 92 of file processcomm.h.

References oofem::CommunicationBuffer::read().

virtual int oofem::ProcessCommunicatorBuff::read ( unsigned long *  data,
int  count 
)
inlinevirtual

Reads count unsigned long values into array pointed by data.

Implements oofem::DataStream.

Definition at line 93 of file processcomm.h.

References oofem::CommunicationBuffer::read().

virtual int oofem::ProcessCommunicatorBuff::read ( double *  data,
int  count 
)
inlinevirtual

Reads count double values into array pointed by data.

Implements oofem::DataStream.

Definition at line 94 of file processcomm.h.

References oofem::CommunicationBuffer::read().

virtual int oofem::ProcessCommunicatorBuff::read ( char *  data,
int  count 
)
inlinevirtual

Reads count char values into array pointed by data.

Implements oofem::DataStream.

Definition at line 95 of file processcomm.h.

References oofem::CommunicationBuffer::read().

virtual int oofem::ProcessCommunicatorBuff::read ( bool &  data)
inlinevirtual

Reads a bool value from data.

Implements oofem::DataStream.

Definition at line 96 of file processcomm.h.

References oofem::CommunicationBuffer::read().

int oofem::ProcessCommunicatorBuff::receiveCompleted ( )
inline
void oofem::ProcessCommunicatorBuff::resizeReceiveBuffer ( int  size)
inline

Definition at line 150 of file processcomm.h.

References oofem::CommunicationBuffer::resize().

void oofem::ProcessCommunicatorBuff::resizeSendBuffer ( int  size)
inline

Definition at line 149 of file processcomm.h.

References oofem::CommunicationBuffer::resize().

int oofem::ProcessCommunicatorBuff::sendCompleted ( )
inline
int oofem::ProcessCommunicatorBuff::testCompletion ( )
inline

Definition at line 156 of file processcomm.h.

References oofem::CommunicationBuffer::testCompletion().

int oofem::ProcessCommunicatorBuff::waitCompletion ( )
inline

Definition at line 157 of file processcomm.h.

References oofem::CommunicationBuffer::waitCompletion().

virtual int oofem::ProcessCommunicatorBuff::write ( const long *  data,
int  count 
)
inlinevirtual

Writes count long values from array pointed by data.

Implements oofem::DataStream.

Definition at line 84 of file processcomm.h.

References oofem::CommunicationBuffer::write().

virtual int oofem::ProcessCommunicatorBuff::write ( const unsigned long *  data,
int  count 
)
inlinevirtual

Writes count unsigned long values from array pointed by data.

Implements oofem::DataStream.

Definition at line 85 of file processcomm.h.

References oofem::CommunicationBuffer::write().

virtual int oofem::ProcessCommunicatorBuff::write ( const double *  data,
int  count 
)
inlinevirtual

Writes count double values from array pointed by data.

Implements oofem::DataStream.

Definition at line 86 of file processcomm.h.

References oofem::CommunicationBuffer::write().

virtual int oofem::ProcessCommunicatorBuff::write ( const char *  data,
int  count 
)
inlinevirtual

Writes count char values from array pointed by data.

Implements oofem::DataStream.

Definition at line 87 of file processcomm.h.

References oofem::CommunicationBuffer::write().

virtual int oofem::ProcessCommunicatorBuff::write ( bool  data)
inlinevirtual

Writes a bool value.

Implements oofem::DataStream.

Definition at line 88 of file processcomm.h.

References oofem::DataStream::read(), and oofem::CommunicationBuffer::write().

Member Data Documentation

CommunicationBuffer* oofem::ProcessCommunicatorBuff::recv_buff
protected

Receive buffer.

Definition at line 70 of file processcomm.h.

Referenced by ProcessCommunicatorBuff().

CommunicationBuffer* oofem::ProcessCommunicatorBuff::send_buff
protected

Send buffer.

Definition at line 68 of file processcomm.h.

Referenced by ProcessCommunicatorBuff().


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

This page is part of the OOFEM documentation. Copyright (c) 2011 Borek Patzak
Project e-mail: info@oofem.org
Generated at Tue Jan 2 2018 20:07:39 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011