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

#include <combuff.h>

+ Inheritance diagram for oofem::StaticCommunicationBuffer:
+ Collaboration diagram for oofem::StaticCommunicationBuffer:

Public Member Functions

 StaticCommunicationBuffer (MPI_Comm comm, int size, bool dynamic=0)
 
 StaticCommunicationBuffer (MPI_Comm comm, bool dynamic=0)
 Constructor. Creates empty buffer, using given communicator for packing. More...
 
virtual ~StaticCommunicationBuffer ()
 Destructor. More...
 
virtual int resize (int newSize)
 Resizes buffer to given size. More...
 
virtual void init ()
 Initializes buffer to empty state. More...
 
virtual void initForPacking ()
 Initialize for packing. More...
 
virtual void initForUnpacking ()
 Initialize for Unpacking (data already received) More...
 
virtual int write (const int *src, int n)
 Writes count integer values from array pointed by data. More...
 
virtual int write (const long *src, int n)
 Writes count long values from array pointed by data. More...
 
virtual int write (const unsigned long *src, int n)
 Writes count unsigned long values from array pointed by data. More...
 
virtual int write (const double *src, int n)
 Writes count double values from array pointed by data. More...
 
virtual int write (const char *src, int n)
 Writes count char values from array pointed by data. More...
 
virtual int read (int *dest, int n)
 Reads count integer values into array pointed by data. More...
 
virtual int read (long *dest, int n)
 Reads count long values into array pointed by data. More...
 
virtual int read (unsigned long *dest, int n)
 Reads count unsigned long values into array pointed by data. More...
 
virtual int read (double *dest, int n)
 Reads count double values into array pointed by data. More...
 
virtual int read (char *dest, int n)
 Reads count char values into array pointed by data. More...
 
virtual int iSend (int dest, int tag)
 Starts standard mode, nonblocking send. More...
 
virtual int iRecv (int source, int tag, int count=0)
 Starts standard mode, nonblocking receive. More...
 
virtual int testCompletion ()
 Tests if the operation identified by this->request is complete. More...
 
int testCompletion (int &source, int &tag)
 
virtual int waitCompletion ()
 Waits until a completion of a nonblocking communication. More...
 
virtual int bcast (int root)
 Initializes broadcast over collaborating processes. More...
 
- Public Member Functions inherited from oofem::CommunicationBuffer
 CommunicationBuffer (MPI_Comm comm, int size, bool dynamic=0)
 
 CommunicationBuffer (MPI_Comm comm, bool dynamic=0)
 Constructor. Creates empty buffer, using given communicator for packing. More...
 
virtual ~CommunicationBuffer ()
 Destructor. More...
 
virtual int read (bool &data)
 Reads a bool value from data. More...
 
virtual int write (bool data)
 Writes a bool value. More...
 
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)
 
- 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...
 
- Public Member Functions inherited from oofem::MPIBuffer
 MPIBuffer (int size, bool dynamic=0)
 Constructor. Creates buffer of given size, using given communicator for packing. More...
 
 MPIBuffer (bool dynamic=0)
 Constructor. Creates empty buffer, using given communicator for packing. More...
 
virtual ~MPIBuffer ()
 Destructor. More...
 
int resize (int newSize)
 Resizes buffer to given size. More...
 
int giveSize ()
 
int giveAvailableSpace ()
 
MPI_Request giveRequest ()
 Returns associated MPI request handle. More...
 
int packArray (MPI_Comm communicator, const void *src, int n, MPI_Datatype type)
 Packs array of a values of given type into buffer. More...
 
int unpackArray (MPI_Comm communicator, void *dest, int n, MPI_Datatype type)
 Unpacks array of values of given type from buffer. More...
 
int givePackSize (MPI_Comm communicator, MPI_Datatype type, int size)
 Returns pack size required to pack array of given type and size (c-style). More...
 
virtual int iSend (MPI_Comm communicator, int dest, int tag)
 Starts standard mode, nonblocking send. More...
 
virtual int iRecv (MPI_Comm communicator, int source, int tag, int count=0)
 Starts standard mode, nonblocking receive. More...
 
int testCompletion ()
 Tests if the operation identified by this->request is complete. More...
 
int testCompletion (int &source, int &tag)
 Tests if the operation identified by this->request is complete. More...
 
int bcast (MPI_Comm communicator, int root)
 Initializes broadcast over collaborating processes. More...
 
void dump ()
 

Additional Inherited Members

- Protected Attributes inherited from oofem::CommunicationBuffer
MPI_Comm communicator
 
- Protected Attributes inherited from oofem::MPIBuffer
int size
 Size and current position in buffer in bytes (sizeof(char)). More...
 
int curr_pos
 
bool isDynamic
 Dynamic flag (if true, buffer can grow, but reallocation is needed). More...
 
ComBuff_BYTE_TYPEbuff
 Buffer. Dynamically allocated. More...
 
MPI_Request request
 MPI request handle. More...
 

Detailed Description

Definition at line 304 of file combuff.h.

Constructor & Destructor Documentation

oofem::StaticCommunicationBuffer::StaticCommunicationBuffer ( MPI_Comm  comm,
int  size,
bool  dynamic = 0 
)
inline

Definition at line 307 of file combuff.h.

oofem::StaticCommunicationBuffer::StaticCommunicationBuffer ( MPI_Comm  comm,
bool  dynamic = 0 
)
inline

Constructor. Creates empty buffer, using given communicator for packing.

Definition at line 310 of file combuff.h.

virtual oofem::StaticCommunicationBuffer::~StaticCommunicationBuffer ( )
inlinevirtual

Destructor.

Definition at line 312 of file combuff.h.

Member Function Documentation

virtual int oofem::StaticCommunicationBuffer::bcast ( int  root)
inlinevirtual

Initializes broadcast over collaborating processes.

The whole buffer size is broadcasted. All buffers participating in broadcast should have the same size.

Parameters
rootRank of broadcast root.
Returns
MPI_SUCCESS if ok.

Implements oofem::CommunicationBuffer.

Definition at line 354 of file combuff.h.

References oofem::MPIBuffer::bcast().

Referenced by oofem::NonlocalMaterialWTP::migrate(), oofem::ElementCommunicator::setUpCommunicationMaps(), and oofem::FETISolver::solve().

virtual void oofem::StaticCommunicationBuffer::init ( )
inlinevirtual
virtual void oofem::StaticCommunicationBuffer::initForPacking ( )
inlinevirtual

Initialize for packing.

Implements oofem::CommunicationBuffer.

Definition at line 317 of file combuff.h.

virtual void oofem::StaticCommunicationBuffer::initForUnpacking ( )
inlinevirtual

Initialize for Unpacking (data already received)

Implements oofem::CommunicationBuffer.

Definition at line 318 of file combuff.h.

References oofem::CommunicationBuffer::write().

virtual int oofem::StaticCommunicationBuffer::iRecv ( int  source,
int  tag,
int  count = 0 
)
inlinevirtual

Starts standard mode, nonblocking receive.

The buffer must be large enough to receive all data.

Parameters
sourceRank of source.
tagMessage tag.
countNumber of elements to receive (bytes). Causes receive buffer to resize to count elements. If zero (default value) buffer is not resized.
Returns
MPI_SUCCESS if ok.

Implements oofem::CommunicationBuffer.

Definition at line 346 of file combuff.h.

References oofem::MPIBuffer::iRecv().

Referenced by oofem::FETICommunicator::setUpCommunicationMaps(), and oofem::FETISolver::solve().

virtual int oofem::StaticCommunicationBuffer::iSend ( int  dest,
int  tag 
)
inlinevirtual

Starts standard mode, nonblocking send.

Parameters
destRank of destination.
tagMessage tag.
Returns
MPI_SUCCESS if ok.

Implements oofem::CommunicationBuffer.

Definition at line 344 of file combuff.h.

References oofem::MPIBuffer::iSend().

Referenced by oofem::FETISolver::setUpCommunicationMaps(), and oofem::FETISolver::solve().

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

Reads count integer values into array pointed by data.

Implements oofem::DataStream.

Definition at line 333 of file combuff.h.

References oofem::MPIBuffer::unpackArray().

Referenced by oofem::NonlocalMaterialWTP::migrate(), oofem::FETICommunicator::setUpCommunicationMaps(), and oofem::FETISolver::solve().

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

Reads count long values into array pointed by data.

Implements oofem::DataStream.

Definition at line 335 of file combuff.h.

References oofem::MPIBuffer::unpackArray().

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

Reads count unsigned long values into array pointed by data.

Implements oofem::DataStream.

Definition at line 337 of file combuff.h.

References oofem::MPIBuffer::unpackArray().

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

Reads count double values into array pointed by data.

Implements oofem::DataStream.

Definition at line 339 of file combuff.h.

References oofem::MPIBuffer::unpackArray().

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

Reads count char values into array pointed by data.

Implements oofem::DataStream.

Definition at line 341 of file combuff.h.

References oofem::MPIBuffer::unpackArray().

virtual int oofem::StaticCommunicationBuffer::resize ( int  newSize)
inlinevirtual

Resizes buffer to given size.

If buffer size is to be enlarged, then previously packed data are kept in new buffer. Otherwise buffer is cleared using init service. Current implementation only performs buffer growing, request for size decrease is ignored to avoid reallocation if further request for growing is encountered.

Parameters
newSizeNew buffer size in bytes.
Returns
Nonzero if successful.

Implements oofem::CommunicationBuffer.

Definition at line 314 of file combuff.h.

References oofem::MPIBuffer::resize().

Referenced by oofem::NonlocalMaterialWTP::migrate(), oofem::FETICommunicator::setUpCommunicationMaps(), oofem::FETISolver::setUpCommunicationMaps(), oofem::ElementCommunicator::setUpCommunicationMaps(), and oofem::FETISolver::solve().

virtual int oofem::StaticCommunicationBuffer::testCompletion ( )
inlinevirtual

Tests if the operation identified by this->request is complete.

In such case, true is returned and if communication was initiated by nonblocking send/receive, then request handle is set to MPI_REQUEST_NULL. Otherwise call returns flag=false.

Returns
Nonzero if operation complete, zero otherwise.

Implements oofem::CommunicationBuffer.

Definition at line 348 of file combuff.h.

References oofem::MPIBuffer::testCompletion().

Referenced by oofem::FETICommunicator::setUpCommunicationMaps(), and oofem::FETISolver::solve().

int oofem::StaticCommunicationBuffer::testCompletion ( int &  source,
int &  tag 
)
inline

Definition at line 350 of file combuff.h.

References oofem::MPIBuffer::testCompletion().

virtual int oofem::StaticCommunicationBuffer::waitCompletion ( )
inlinevirtual

Waits until a completion of a nonblocking communication.

The completion of a send operation indicates that the sender is now free to update the locations in the send buffer, the completion of a receive operation indicates that the receive buffer contains the received message, the receiver is now free to access it, and that the status object is set. If the communication object associated with this request was created (nonblocking send or receive call), then the object is deallocated by the call to MPI_WAIT and the request handle is set to MPI_REQUEST_NULL.

Returns

Reimplemented from oofem::MPIBuffer.

Definition at line 352 of file combuff.h.

References oofem::MPIBuffer::waitCompletion().

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

Writes count integer values from array pointed by data.

Implements oofem::DataStream.

Definition at line 321 of file combuff.h.

References oofem::MPIBuffer::packArray().

Referenced by oofem::NonlocalMaterialWTP::migrate(), oofem::FETISolver::setUpCommunicationMaps(), and oofem::FETISolver::solve().

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

Writes count long values from array pointed by data.

Implements oofem::DataStream.

Definition at line 323 of file combuff.h.

References oofem::MPIBuffer::packArray().

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

Writes count unsigned long values from array pointed by data.

Implements oofem::DataStream.

Definition at line 325 of file combuff.h.

References oofem::MPIBuffer::packArray().

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

Writes count double values from array pointed by data.

Implements oofem::DataStream.

Definition at line 327 of file combuff.h.

References oofem::MPIBuffer::packArray().

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

Writes count char values from array pointed by data.

Implements oofem::DataStream.

Definition at line 329 of file combuff.h.

References oofem::MPIBuffer::packArray(), and oofem::CommunicationBuffer::read().


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

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:41 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011