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, 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 |
Private Attributes | |
const UPstream::commsTypes | commsType_ |
Communications type of this stream. More... | |
const int | tag_ |
const label | comm_ |
const IOstream::streamFormat | format_ |
const IOstream::versionNumber | version_ |
List< DynamicList< char > > | sendBuf_ |
Send buffer. More... | |
List< DynamicList< char > > | recvBuf_ |
Receive buffer. More... | |
labelList | recvBufPos_ |
Read position in recvBuf_. More... | |
bool | finishedSendsCalled_ |
Friends | |
class | UOPstream |
class | UIPstream |
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); } }
Definition at line 85 of file PstreamBuffers.H.
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,.
write format and IO version
Definition at line 40 of file PstreamBuffers.C.
~PstreamBuffers | ( | ) |
Destructor.
Definition at line 62 of file PstreamBuffers.C.
References Foam::abort(), Foam::FatalError, FatalErrorInFunction, forAll, PstreamBuffers::recvBuf_, and PstreamBuffers::recvBufPos_.
|
inline |
Definition at line 140 of file PstreamBuffers.H.
References PstreamBuffers::tag_.
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 82 of file PstreamBuffers.C.
References UPstream::nonBlocking.
Referenced by pointBoundaryMesh::calcGeometry(), polyBoundaryMesh::calcGeometry(), globalPoints::calculateSharedPoints(), fvMeshDistribute::distribute(), mapDistributeBase::distribute(), distributedTriSurfaceMesh::distribute(), meshToMesh::distributeCells(), AMIInterpolation< SourcePatch, TargetPatch >::distributePatches(), fvMeshSubset::doCoupledPatches(), PointEdgeWave< Type, TrackingData >::handleProcPatches(), FaceCellWave< Type, int >::handleProcPatches(), globalMeshData::initProcAddr(), main(), Cloud< streamLineParticle >::move(), pointBoundaryMesh::movePoints(), polyBoundaryMesh::movePoints(), externalCoupledFunctionObject::readColumns(), externalCoupledFunctionObject::readLines(), parLagrangianRedistributor::redistributeLagrangianPositions(), polyTopoChange::reorderCoupledFaces(), mapDistributeBase::send(), syncTools::syncBoundaryFaceList(), syncTools::syncEdgeMap(), syncTools::syncFaceList(), syncTools::syncPointMap(), pointBoundaryMesh::updateMesh(), and polyBoundaryMesh::updateMesh().
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, FatalErrorInFunction, and UPstream::nonBlocking.
void clear | ( | ) |
Clear storage and reset.
Definition at line 146 of file PstreamBuffers.C.
References forAll.
Referenced by Cloud< streamLineParticle >::move().
|
friend |
Definition at line 87 of file PstreamBuffers.H.
|
friend |
Definition at line 88 of file PstreamBuffers.H.
|
private |
Communications type of this stream.
Definition at line 93 of file PstreamBuffers.H.
|
private |
Definition at line 95 of file PstreamBuffers.H.
Referenced by PstreamBuffers::tag().
|
private |
Definition at line 97 of file PstreamBuffers.H.
|
private |
Definition at line 99 of file PstreamBuffers.H.
|
private |
Definition at line 101 of file PstreamBuffers.H.
|
private |
Send buffer.
Definition at line 104 of file PstreamBuffers.H.
|
private |
Receive buffer.
Definition at line 107 of file PstreamBuffers.H.
Referenced by PstreamBuffers::~PstreamBuffers().
|
private |
Read position in recvBuf_.
Definition at line 110 of file PstreamBuffers.H.
Referenced by PstreamBuffers::~PstreamBuffers().
|
private |
Definition at line 112 of file PstreamBuffers.H.
|
static |
Definition at line 118 of file PstreamBuffers.H.
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.