PstreamBuffers Class Reference

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

Collaboration diagram for PstreamBuffers:
[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
 
label comm () const
 
void finishedSends (const bool block=true)
 Mark all sends as having been done. This will start receives. More...
 
void finishedSends (labelList &recvSizes, 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:

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 87 of file PstreamBuffers.H.

Constructor & Destructor Documentation

◆ PstreamBuffers()

Construct given comms type,.

write format and IO version

Definition at line 38 of file PstreamBuffers.C.

◆ ~PstreamBuffers()

Destructor.

Definition at line 60 of file PstreamBuffers.C.

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

Here is the call graph for this function:

Member Function Documentation

◆ tag()

int tag ( ) const
inline

Definition at line 142 of file PstreamBuffers.H.

◆ comm()

label comm ( ) const
inline

Definition at line 147 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)

Mark all sends as having been done. This will start receives.

in non-blocking mode. If block will wait for all transfers to finish (only relevant for nonBlocking mode)

Definition at line 80 of file PstreamBuffers.C.

References UPstream::nonBlocking.

Referenced by fvMeshDistribute::distribute(), mapDistributeBase::distribute(), distributedTriSurfaceMesh::distribute(), box::doRefineBoxes(), globalIndex::get(), zoneDistribute::getDatafromOtherProc(), FaceCellWave< Type, TrackingData >::handleProcPatches(), trackingInverseDistance::markDonors(), inverseDistance::markDonors(), trackingInverseDistance::markPatchesAsHoles(), inverseDistance::markPatchesAsHoles(), pointBoundaryMesh::movePoints(), polyBoundaryMesh::movePoints(), masterUncollatedFileOperation::NewIFstream(), RecycleInteraction< CloudType >::postEvolve(), masterUncollatedFileOperation::read(), decomposedBlockData::readBlocks(), surfaceNoise::readSurfaceData(), masterUncollatedFileOperation::scatterList(), mapDistributeBase::send(), box::setRefineFlags(), zoneDistribute::setUpCommforZone(), surfaceNoise::surfaceAverage(), syncObjects::sync(), syncTools::syncBoundaryFaceList(), syncTools::syncEdgeMap(), syncTools::syncFaceList(), syncTools::syncPointMap(), pointBoundaryMesh::updateMesh(), polyBoundaryMesh::updateMesh(), energySpectrum::write(), and surfaceNoise::writeSurfaceData().

Here is the caller graph for this function:

◆ finishedSends() [2/2]

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

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

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

Definition at line 98 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 ( )

Clear storage and reset.

Definition at line 130 of file PstreamBuffers.C.

Referenced by trackingInverseDistance::markDonors(), inverseDistance::markDonors(), trackingInverseDistance::markPatchesAsHoles(), inverseDistance::markPatchesAsHoles(), RecycleInteraction< CloudType >::postEvolve(), and surfaceNoise::readSurfaceData().

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ UOPstream

friend class UOPstream
friend

Definition at line 89 of file PstreamBuffers.H.

◆ UIPstream

friend class UIPstream
friend

Definition at line 90 of file PstreamBuffers.H.

Member Data Documentation

◆ nullBuf

Foam::DynamicList< char > nullBuf
static

Definition at line 120 of file PstreamBuffers.H.


The documentation for this class was generated from the following files:
Foam::UPstream::commsTypes::nonBlocking
Foam::PstreamBuffers::UOPstream
friend class UOPstream
Definition: PstreamBuffers.H:89
Foam::PstreamBuffers::UIPstream
friend class UIPstream
Definition: PstreamBuffers.H:90
Foam::PstreamBuffers::PstreamBuffers
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,.
Definition: PstreamBuffers.C:38
Foam::UPstream::allProcs
static rangeType allProcs(const label communicator=worldComm)
Range of process indices for all processes.
Definition: UPstream.H:509
Foam::UPstream::myProcNo
static int myProcNo(const label communicator=worldComm)
Number of this process (starting from masterNo() = 0)
Definition: UPstream.H:464