42 #ifndef Foam_UOPstream_H 43 #define Foam_UOPstream_H 68 inline void prepareBuffer(
const size_t count,
const size_t align);
72 inline void writeToBuffer(
const T& val);
76 inline void writeToBuffer
84 inline void putChar(
const char c);
88 inline void putString(
const std::string& str);
123 const bool sendAtDestruct =
true,
148 virtual ios_base::fmtflags
flags()
const 150 return ios_base::fmtflags(0);
177 const std::string& str,
178 const bool quoted=
true 227 virtual char fill()
const 233 virtual char fill(
const char)
239 virtual int width()
const 246 virtual int width(
const int)
274 virtual ios_base::fmtflags
flags(
const ios_base::fmtflags)
276 return ios_base::fmtflags(0);
300 bool bufferIPCsend();
317 const bool sendAtDestruct =
true,
352 const std::streamsize bufSize,
362 inline static bool write 368 const std::streamsize bufSize,
391 inline static bool write 420 inline static bool write 423 UPstream::Request& req,
425 const UList<Type>& buffer,
435 buffer.cdata_bytes(),
461 bool bufferIPCsend();
478 const bool sendAtDestruct =
true,
499 const int rootProcNo,
501 const std::streamsize bufSize,
sendModes
Different MPI-send modes (ignored for commsTypes::blocking)
const bool sendAtDestruct_
Call bufferIPCsend on termination (in the destructor)
virtual bool write(const token &tok)
Write token to stream or otherwise handle it.
virtual void flush()
Flush stream.
commsTypes
Communications types.
virtual void indent()
Add indentation characters.
const int comm_
The communicator index.
A token holds an item read from Istream.
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.
static bool write(const int rootProcNo, const char *buf, const std::streamsize bufSize, const label comm=UPstream::worldComm)
Wrapped version of UPstream::broadcast with const-cast.
const char * cdata_bytes() const noexcept
Return pointer to the underlying array serving as data storage,.
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
virtual ios_base::fmtflags flags() const
Return flags of output stream.
virtual bool beginRawWrite(std::streamsize count)
Begin marker for low-level raw binary output.
virtual int width() const
Get width of output field.
An opaque wrapper for MPI_Request with a vendor-independent representation independent of any <mpi...
A class for handling words, derived from Foam::string.
UOPstreamBase(const UPstream::commsTypes commsType, const int toProcNo, DynamicList< char > &sendBuf, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm, const bool sendAtDestruct=true, IOstreamOption::streamFormat fmt=IOstreamOption::BINARY)
Construct given process index to write to using the given attached send buffer, optional communicatio...
UOPstream(const UPstream::commsTypes commsType, const int toProcNo, DynamicList< char > &sendBuf, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm, const bool sendAtDestruct=true, IOstreamOption::streamFormat fmt=IOstreamOption::BINARY)
Construct given process index to write to using the given attached send buffer, optional communicatio...
void print(Ostream &os) const
Print stream description to Ostream.
const int toProcNo_
Destination rank for the data.
virtual Ostream & writeQuoted(const std::string &str, const bool quoted=true)
Write std::string surrounded by quotes.
virtual ~UOPBstream()
Destructor, usually sends buffer on destruct.
DynamicList< char > & sendBuf_
Reference to the send buffer data.
virtual void endl()
Add newline and flush stream.
virtual void rewind()
Rewind the send buffer for overwriting.
UOPBstream(const UPstream::commsTypes, const int toProcNo, DynamicList< char > &sendBuf, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm, const bool sendAtDestruct=true, IOstreamOption::streamFormat fmt=IOstreamOption::BINARY)
Construct given process index to write to using the given attached send buffer, optional communicatio...
virtual int precision() const
Get precision of output field.
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...
Output inter-processor communications stream using MPI send/recv etc. - operating on external buffer...
virtual ~UOPstream()
Destructor, usually sends buffer on destruct.
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)
virtual ~UOPstreamBase()
Destructor.
virtual Ostream & writeRaw(const char *data, std::streamsize count)
Low-level raw binary output.
const dimensionedScalar c
Speed of light in a vacuum.
static bool write(const UPstream::commsTypes commsType, const int toProcNo, const char *buf, const std::streamsize bufSize, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm, UPstream::Request *req=nullptr, const UPstream::sendModes sendMode=UPstream::sendModes::normal)
Write buffer contents to given processor.
streamFormat
Data format (ascii | binary)
"nonBlocking" : (MPI_Isend, MPI_Irecv)
virtual bool endRawWrite()
End marker for low-level raw binary output.
const int tag_
Message tag for communication.
Base class for output inter-processor communications stream (ie, parallel streams). Not to be used directly, thus contructors are protected.
virtual char fill() const
Get the current padding character.
Inter-processor communications stream.
std::streamsize size_bytes() const noexcept
Number of contiguous bytes for the List data.