133#ifndef Foam_PstreamBuffers_H
134#define Foam_PstreamBuffers_H
157 enum class modeOption :
unsigned char
170 bool finishedSendsCalled_;
173 bool allowClearRecv_;
207 inline void setFinished(
bool on)
noexcept;
210 inline void initFinalExchange();
216 enum modeOption
mode,
243 label& accessRecvPosition(
const label proci);
423 void registerSend(const label proci, const
bool toggleOn = true);
455 const
bool wait = true
468 const
bool wait = true
486 const
bool wait = true
503 const
bool wait = true
521 const
bool wait = true
547 const
bool wait = true
570 const
bool wait = true
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
streamFormat
Data format (ascii | binary | coherent).
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
label sendDataCount(const label proci) const
Number of send bytes for the specified processor.
void clearUnregistered()
Clear any 'unregistered' send buffers.
int nProcs() const noexcept
Number of ranks associated with PstreamBuffers.
const UList< char > peekRecvData(const label proci) const
Number of unconsumed receive bytes for the specified processor. Must call finishedSends() or other fi...
ClassName("PstreamBuffers")
void clearSends()
Clear all send buffers (does not remove buffer storage).
PstreamBuffers(int communicator, int tag, UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, IOstreamOption::streamFormat fmt=IOstreamOption::BINARY)
Construct given communicator, message tag, communication type (default: nonBlocking),...
UPstream::rangeType allProcs() const noexcept
Range of ranks indices associated with PstreamBuffers.
UPstream::commsTypes commsType() const noexcept
The communications type of the stream.
bool finished() const noexcept
True if finishedSends() or finishedNeighbourSends() has been called.
friend class UIPstreamBase
bool allowClearRecv() const noexcept
Is clearStorage of individual receive buffer by external hooks allowed? (default: true).
label maxRecvCount() const
Maximum receive size from any rocessor rank. Must call finishedSends() or other finished....
int tag() const noexcept
The transfer message tag.
void registerSend(const label proci, const bool toggleOn=true)
Toggle an individual send buffer as 'registered'. The setting is sticky (does not turn off).
void initRegisterSend()
Initialise registerSend() bookkeeping by mark all send buffers as 'unregistered'.
void clearStorage()
Clear storage for all send/recv buffers and reset states.
void clearRecv(const label proci)
Clear an individual receive buffer (eg, data not required).
int comm() const noexcept
The communicator index.
bool hasSendData() const
True if any (local) send buffers have data.
static int algorithm
Preferred exchange algorithm (may change or be removed in future).
PstreamBuffers(UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, int tag=UPstream::msgType(), int communicator=UPstream::worldComm, IOstreamOption::streamFormat fmt=IOstreamOption::BINARY)
Construct given communication type (default: nonBlocking), message tag, communicator (default: worldC...
void clearRecvs()
Clear all recv buffer and positions (does not remove buffer storage).
void finishedScatters(const bool wait=true)
Mark all sends to sub-procs as done.
labelList recvDataCounts() const
Number of unconsumed receive bytes for all processors. Must call finishedSends() or other finished....
void finishedSendsNBX(const bool wait=true)
Mark the send phase as being finished.
bool hasRecvData() const
True if any (local) recv buffers have unconsumed data. Must call finishedSends() or other finished....
void clearSend(const label proci)
Clear an individual send buffer (eg, data not required).
label recvDataCount(const label proci) const
Number of unconsumed receive bytes for the specified processor. Must call finishedSends() or other fi...
void finishedSends(const bool wait=true)
Mark the send phase as being finished.
friend class UOPstreamBase
void clear()
Clear all send/recv buffers and reset states.
PstreamBuffers(int communicator, UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, int tag=UPstream::msgType(), IOstreamOption::streamFormat fmt=IOstreamOption::BINARY)
Construct given communicator, communication type (default: nonBlocking), message tag,...
void finishedNeighbourSends(const labelUList &neighProcs, const bool wait=true)
Mark the send phase as being finished, with communication being limited to a known subset of send/rec...
void finishedGathers(const bool wait=true)
Mark all sends to master as done.
~PstreamBuffers()
Destructor - checks that all data have been consumed.
label maxNonLocalRecvCount() const
Maximum receive size, excluding current processor rank Must call finishedSends() or other finished....
UPstream::rangeType subProcs() const noexcept
Range of sub-processes indices associated with PstreamBuffers.
IOstreamOption::streamFormat format() const noexcept
The associated buffer format (ascii | binary).
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
commsTypes
Communications types.
@ nonBlocking
"nonBlocking" (immediate) : (MPI_Isend, MPI_Irecv)
static int & msgType() noexcept
Message tag of standard messages.
static label worldComm
Communicator for all ranks. May differ from commGlobal() if local worlds are in use.
IntRange< int > rangeType
Int ranges are used for MPI ranks (processes).
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
#define ClassName(TypeNameString)
Add typeName information from argument TypeNameString to a class.
List< label > labelList
A List of labels.
mode_t mode(const fileName &name, const bool followLink=true)
Return the file mode, normally following symbolic links.
UList< label > labelUList
A UList of labels.