Public Member Functions | Static Public Attributes | Friends | List of all members
PstreamBuffers Class Reference

Buffers for inter-processor communications streams (UOPstream, UIPstream). More...

Collaboration diagram for PstreamBuffers:
Collaboration graph
[legend]

Public Member Functions

 PstreamBuffers (const UPstream::commsTypes commsType, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm, IOstream::streamFormat format=IOstream::BINARY, IOstream::versionNumber version=IOstream::currentVersion)
 Construct given comms type,. More...
 
 ~PstreamBuffers ()
 Destructor. More...
 
int tag () const
 
void finishedSends (const bool block=true)
 Mark all sends as having been done. This will start receives. More...
 
void finishedSends (labelListList &sizes, const bool block=true)
 Mark all sends as having been done. Same as above but also returns. More...
 
void clear ()
 Clear storage and reset. More...
 

Static Public Attributes

static DynamicList< char > nullBuf
 

Friends

class UOPstream
 
class UIPstream
 

Detailed Description

Buffers for inter-processor communications streams (UOPstream, UIPstream).

Use UOPstream to stream data into buffers, call finishedSends() to notify that data is in buffers and then use IUPstream to get data out of received buffers. Works with both blocking and nonBlocking. Does not make much sense with scheduled since there you would not need these explicit buffers.

Example usage:

PstreamBuffers pBuffers(Pstream::nonBlocking);

for (label procI = 0; procI < Pstream::nProcs(); procI++) { if (procI != Pstream::myProcNo()) { someObject vals;

UOPstream str(procI, pBuffers); str << vals; } }

pBuffers.finishedSends(); // no-op for blocking

for (label procI = 0; procI < Pstream::nProcs(); procI++) { if (procI != Pstream::myProcNo()) { UIPstream str(procI, pBuffers); someObject vals(str); } }

Source files

Definition at line 85 of file PstreamBuffers.H.

Constructor & Destructor Documentation

Construct given comms type,.

write format and IO version

Definition at line 40 of file PstreamBuffers.C.

Destructor.

Definition at line 62 of file PstreamBuffers.C.

References Foam::abort(), Foam::FatalError, FatalErrorIn, and forAll.

Here is the call graph for this function:

Member Function Documentation

int tag ( ) const
inline

Definition at line 140 of file PstreamBuffers.H.

References PstreamBuffers::clear(), and PstreamBuffers::finishedSends().

Here is the call graph for this function:

void finishedSends ( const bool  block = true)
void finishedSends ( labelListList sizes,
const bool  block = true 
)

Mark all sends as having been done. Same as above but also returns.

sizes (bytes) transferred. Note:currently only valid for non-blocking.

Definition at line 102 of file PstreamBuffers.C.

References UPstream::commsTypeNames, Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorIn, and UPstream::nonBlocking.

Here is the call graph for this function:

void clear ( )

Clear storage and reset.

Definition at line 148 of file PstreamBuffers.C.

References forAll.

Referenced by PstreamBuffers::tag().

Here is the caller graph for this function:

Friends And Related Function Documentation

friend class UOPstream
friend

Definition at line 87 of file PstreamBuffers.H.

friend class UIPstream
friend

Definition at line 88 of file PstreamBuffers.H.

Member Data Documentation

DynamicList< char > nullBuf
static

Definition at line 118 of file PstreamBuffers.H.


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