43 #ifndef Foam_UIPstream_H 44 #define Foam_UIPstream_H 68 inline void checkEof();
71 inline void prepareBuffer(
const size_t align);
75 inline void readFromBuffer(
T& val);
80 inline void readFromBuffer(
void* data,
const size_t count);
83 inline Istream& readString(std::string& str);
124 const int fromProcNo,
126 label& receiveBufPosition,
129 const bool clearAtEnd =
false,
157 virtual std::ios_base::fmtflags
flags()
const override 159 return std::ios_base::fmtflags(0);
164 virtual std::ios_base::fmtflags
flags(std::ios_base::fmtflags)
override 166 return std::ios_base::fmtflags(0);
210 virtual
bool endRawRead()
override {
return true; }
216 virtual void rewind()
override;
239 void bufferIPCrecv();
252 const int fromProcNo,
253 DynamicList<char>& receiveBuf,
254 label& receiveBufPosition,
257 const bool clearAtEnd =
false,
262 UIPstream(
const int fromProcNo, PstreamBuffers& buffers);
290 static std::streamsize
read 293 const int fromProcNo,
305 inline static std::streamsize
read 309 const int fromProcNo,
311 std::streamsize
count,
318 inline static std::streamsize
read 321 const int fromProcNo,
331 inline static std::streamsize
read 334 const int fromProcNo,
344 inline static std::streamsize
read 348 const int fromProcNo,
356 inline static std::streamsize
read 360 const int fromProcNo,
381 void bufferIPCrecv();
393 label& receiveBufPosition,
395 const bool clearAtEnd =
false,
412 #include "UIPstream.txx" virtual bool endRawRead() override
End of low-level raw binary read.
virtual ~UIPstreamBase()
Destructor. Optionally clears external receive buffer.
commsTypes
Communications types.
Base class for input inter-processor communications stream (ie, parallel streams). Not to be used directly, thus contructors are protected.
virtual bool beginRawRead() override
Start of low-level raw binary read.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
UIPstreamBase(const UPstream::commsTypes commsType, const int fromProcNo, DynamicList< char > &receiveBuf, label &receiveBufPosition, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm, const bool clearAtEnd=false, IOstreamOption::streamFormat fmt=IOstreamOption::BINARY)
Construct given process index to read from using the given attached receive buffer, optional communication characteristics and IO format.
const int fromProcNo_
Source rank for the data.
label & recvBufPos_
Reference to the receive position in buffer data.
static int & msgType() noexcept
Message tag of standard messages.
static std::streamsize read(const UPstream::commsTypes commsType, const int fromProcNo, Type *buffer, std::streamsize count, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm, UPstream::Request *req=nullptr)
Receive buffer contents (contiguous types) from given processor.
virtual ~UIPBstream()=default
Destructor.
virtual ~UIPstream()=default
Destructor.
static label worldComm
Communicator for all ranks. May differ from commGlobal() if local worlds are in use.
void print(Ostream &os) const override
Print stream description to Ostream.
label messageSize_
The message size, read on bufferIPCrecv or set directly.
label storedRecvBufPos_
Receive position in buffer data, if ony If there is no external location for recvBufPos_.
Input inter-processor communications stream using MPI broadcast - operating on external buffer...
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
An opaque wrapper for MPI_Request with a vendor-independent representation without any <mpi...
virtual Istream & readRaw(char *data, std::streamsize count) override
Low-level raw binary read. Reading into a null pointer behaves like a forward seek of count character...
UIPstream(const UPstream::commsTypes commsType, const int fromProcNo, DynamicList< char > &receiveBuf, label &receiveBufPosition, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm, const bool clearAtEnd=false, IOstreamOption::streamFormat fmt=IOstreamOption::BINARY)
Construct given process index to read from using the given attached receive buffer, optional communication characteristics and IO format.
commsTypes commsType() const noexcept
Get the communications type of the stream.
label remaining() const noexcept
The number of characters remaining in the get buffer.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
OBJstream os(runTime.globalPath()/outputName)
Buffers for inter-processor communications streams (UOPstream, UIPstream).
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
virtual std::ios_base::fmtflags flags() const override
Return current stream flags. Dummy for parallel stream, returns 0.
Wrapper for internally indexed communicator label. Always invokes UPstream::allocateCommunicatorCompo...
const bool clearAtEnd_
Clear the receive buffer on termination (in the destructor)
DynamicList< char > & recvBuf_
Reference to the receive buffer data.
virtual void rewind() override
Rewind the receive stream position so that it may be read again.
const int tag_
Message tag for communication.
const dimensionedScalar c
Speed of light in a vacuum.
streamFormat
Data format (ascii | binary)
UIPBstream(DynamicList< char > &receiveBuf, label &receiveBufPosition, const int communicator=UPstream::worldComm, const bool clearAtEnd=false, IOstreamOption::streamFormat fmt=IOstreamOption::BINARY)
Construct using the given attached receive buffer,.
const int comm_
The communicator index.
Inter-processor communications stream.
virtual Istream & read(token &) override
Return next token from stream.
Istream(const Istream &)=default
Copy construct.