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

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

Public Member Functions

 PstreamBuffers (const UPstream::commsTypes commsType, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm, IOstreamOption::streamFormat fmt=IOstreamOption::BINARY)
 
 ~PstreamBuffers ()
 
int tag () const noexcept
 
label comm () const noexcept
 
void finishedSends (const bool block=true)
 
void finishedSends (labelList &recvSizes, const bool block=true)
 
void clear ()
 

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:

for (const int proci : Pstream::allProcs())
{
if (proci != Pstream::myProcNo())
{
someObject vals;
UOPstream send(proci, pBufs);
send << vals;
}
}
pBufs.finishedSends(); // no-op for blocking
for (const int proci : Pstream::allProcs())
{
if (proci != Pstream::myProcNo())
{
UIPstream recv(proci, pBufs);
someObject vals(recv);
}
}
Source files

Definition at line 84 of file PstreamBuffers.H.

Constructor & Destructor Documentation

◆ PstreamBuffers()

PstreamBuffers ( const UPstream::commsTypes  commsType,
const int  tag = UPstream::msgType(),
const label  comm = UPstream::worldComm,
IOstreamOption::streamFormat  fmt = IOstreamOption::BINARY 
)
explicit

Definition at line 27 of file PstreamBuffers.C.

◆ ~PstreamBuffers()

Definition at line 47 of file PstreamBuffers.C.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, forAll, and Foam::nl.

Here is the call graph for this function:

Member Function Documentation

◆ tag()

int tag ( ) const
inlinenoexcept

Definition at line 137 of file PstreamBuffers.H.

◆ comm()

label comm ( ) const
inlinenoexcept

Definition at line 143 of file PstreamBuffers.H.

Referenced by processorPolyPatch::initGeometry(), processorPolyPatch::initUpdateMesh(), and syncObjects::sync().

Here is the caller graph for this function:

◆ finishedSends() [1/2]

void finishedSends ( const bool  block = true)

◆ finishedSends() [2/2]

void finishedSends ( labelList recvSizes,
const bool  block = true 
)

Definition at line 85 of file PstreamBuffers.C.

References UPstream::commsTypeNames, Foam::endl(), Pstream::exchangeSizes(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, and UPstream::nonBlocking.

Here is the call graph for this function:

◆ clear()

void clear ( )

Friends And Related Function Documentation

◆ UOPstream

friend class UOPstream
friend

Definition at line 86 of file PstreamBuffers.H.

◆ UIPstream

friend class UIPstream
friend

Definition at line 87 of file PstreamBuffers.H.


The documentation for this class was generated from the following files:
Foam::PstreamBuffers::UOPstream
friend class UOPstream
Definition: PstreamBuffers.H:86
Foam::PstreamBuffers::UIPstream
friend class UIPstream
Definition: PstreamBuffers.H:87
Foam::PstreamBuffers::PstreamBuffers
PstreamBuffers(const UPstream::commsTypes commsType, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm, IOstreamOption::streamFormat fmt=IOstreamOption::BINARY)
Definition: PstreamBuffers.C:27
Foam::UPstream::allProcs
static rangeType allProcs(const label communicator=worldComm)
Definition: UPstream.H:504
Foam::UPstream::commsTypes::nonBlocking
@ nonBlocking
Foam::UPstream::myProcNo
static int myProcNo(const label communicator=worldComm)
Definition: UPstream.H:459