42 #ifndef Foam_UIPstream_H 43 #define Foam_UIPstream_H 67 inline void checkEof();
70 inline void prepareBuffer(
const size_t align);
74 inline void readFromBuffer(
T& val);
79 inline void readFromBuffer(
void* data,
const size_t count);
82 inline Istream& readString(std::string& str);
123 const int fromProcNo,
125 label& receiveBufPosition,
128 const bool clearAtEnd =
false,
156 virtual std::ios_base::fmtflags
flags()
const override 158 return std::ios_base::fmtflags(0);
163 virtual std::ios_base::fmtflags
flags(std::ios_base::fmtflags)
override 165 return std::ios_base::fmtflags(0);
206 virtual bool endRawRead()
override {
return true; }
212 virtual void rewind()
override;
235 void bufferIPCrecv();
248 const int fromProcNo,
249 DynamicList<char>& receiveBuf,
250 label& receiveBufPosition,
253 const bool clearAtEnd =
false,
258 UIPstream(
const int fromProcNo, PstreamBuffers& buffers);
285 static std::streamsize
read 288 const int fromProcNo,
290 const std::streamsize bufSize,
299 inline static std::streamsize
read 303 const int fromProcNo,
305 const std::streamsize bufSize,
326 inline static std::streamsize
read 329 const int fromProcNo,
353 inline static std::streamsize
read 356 const int fromProcNo,
357 SubList<Type> buffer,
361 UPstream::Request* req =
nullptr 380 inline static std::streamsize
read 384 const int fromProcNo,
406 inline static std::streamsize
read 410 const int fromProcNo,
443 void bufferIPCrecv();
456 const int rootProcNo,
458 label& receiveBufPosition,
461 const bool clearAtEnd =
false,
480 static std::streamsize
read 482 const int rootProcNo,
484 const std::streamsize bufSize,
virtual bool endRawRead() override
End of low-level raw binary read.
UIPstream(const UPstream::commsTypes commsType, const int fromProcNo, DynamicList< char > &receiveBuf, label &receiveBufPosition, const int tag=UPstream::msgType(), const label comm=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.
UIPstreamBase(const UPstream::commsTypes commsType, const int fromProcNo, DynamicList< char > &receiveBuf, label &receiveBufPosition, const int tag=UPstream::msgType(), const label comm=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.
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)...
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.
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.
char * data_bytes() noexcept
Return pointer to the underlying array serving as data storage,.
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_.
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...
static std::streamsize read(const int rootProcNo, char *buf, const std::streamsize bufSize, const label comm=UPstream::worldComm)
Wrapped version of UPstream::broadcast.
UIPBstream(const UPstream::commsTypes, const int rootProcNo, DynamicList< char > &receiveBuf, label &receiveBufPosition, const int tag=UPstream::msgType(), const label comm=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.
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.
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)
"nonBlocking" (immediate) : (MPI_Isend, MPI_Irecv)
const int comm_
The communicator index.
Inter-processor communications stream.
std::streamsize size_bytes() const noexcept
Number of contiguous bytes for the List data.
virtual Istream & read(token &) override
Return next token from stream.
static std::streamsize read(const UPstream::commsTypes commsType, const int fromProcNo, char *buf, const std::streamsize bufSize, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm, UPstream::Request *req=nullptr)
Read buffer contents from given processor.
Istream(const Istream &)=default
Copy construct.