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 157 return ios_base::fmtflags(0);
213 virtual ios_base::fmtflags
flags(
const ios_base::fmtflags)
215 return ios_base::fmtflags(0);
239 void bufferIPCrecv();
252 const int fromProcNo,
254 label& receiveBufPosition,
257 const bool clearAtEnd =
false,
292 const int fromProcNo,
294 const std::streamsize bufSize,
303 inline static label
read 307 const int fromProcNo,
309 const std::streamsize bufSize,
330 inline static label
read 333 const int fromProcNo,
357 inline static label
read 360 const int fromProcNo,
361 SubList<Type> buffer,
365 UPstream::Request* req =
nullptr 388 const int fromProcNo,
410 inline static label
read 414 const int fromProcNo,
447 void bufferIPCrecv();
460 const int rootProcNo,
462 label& receiveBufPosition,
465 const bool clearAtEnd =
false,
486 const int rootProcNo,
488 const std::streamsize bufSize,
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.
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.
bool beginRawRead()
Start of low-level raw binary read.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
bool endRawRead()
End of low-level raw binary read.
A token holds an item read from Istream.
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,.
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.
Istream & read(token &t)
Return next token from stream.
virtual ios_base::fmtflags flags() const
Return flags of output stream.
An opaque wrapper for MPI_Request with a vendor-independent representation independent of any <mpi...
A class for handling words, derived from Foam::string.
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.
OBJstream os(runTime.globalPath()/outputName)
Database for solution data, solver performance and other reduced data.
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.
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)
Istream & readRaw(char *data, std::streamsize count)
Low-level raw binary read. Reading into a null pointer behaves like a forward seek of count character...
void print(Ostream &os) const
Print stream description to Ostream.
virtual void rewind()
Rewind the receive stream position so that it may be read again.
const int comm_
The communicator index.
Inter-processor communications stream.
std::streamsize size_bytes() const noexcept
Number of contiguous bytes for the List data.