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,
155 virtual ios_base::fmtflags
flags()
const override 157 return ios_base::fmtflags(0);
161 virtual ios_base::fmtflags
flags(
const ios_base::fmtflags)
override 163 return ios_base::fmtflags(0);
204 virtual bool endRawRead()
override {
return true; }
210 virtual void rewind()
override;
233 void bufferIPCrecv();
246 const int fromProcNo,
247 DynamicList<char>& receiveBuf,
248 label& receiveBufPosition,
251 const bool clearAtEnd =
false,
256 UIPstream(
const int fromProcNo, PstreamBuffers& buffers);
286 const int fromProcNo,
288 const std::streamsize bufSize,
297 inline static label
read 301 const int fromProcNo,
303 const std::streamsize bufSize,
324 inline static label
read 327 const int fromProcNo,
351 inline static label
read 354 const int fromProcNo,
355 SubList<Type> buffer,
359 UPstream::Request* req =
nullptr 382 const int fromProcNo,
404 inline static label
read 408 const int fromProcNo,
441 void bufferIPCrecv();
454 const int rootProcNo,
456 label& receiveBufPosition,
459 const bool clearAtEnd =
false,
480 const int rootProcNo,
482 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.
virtual ios_base::fmtflags flags() const override
Return stream flags.
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.
static label 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.
virtual ~UIPstreamBase()
Destructor. Optionally clears external receive buffer.
commsTypes
Communications types.
static label read(const int rootProcNo, char *buf, const std::streamsize bufSize, const label comm=UPstream::worldComm)
Wrapped version of UPstream::broadcast.
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.
int messageSize_
The message size, read on bufferIPCrecv or set directly.
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 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 independent of 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...
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)
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" : (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.
Istream(const Istream &)=default
Copy construct.