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);
87 inline void putString(
const char* str,
const size_t len);
90 inline void putString(
const std::string& str);
125 const bool sendAtDestruct =
true,
151 virtual std::ios_base::fmtflags
flags()
const override 153 return std::ios_base::fmtflags(0);
158 virtual std::ios_base::fmtflags
flags(std::ios_base::fmtflags)
override 160 return std::ios_base::fmtflags(0);
171 virtual bool write(
const token& tok)
override;
181 const bool quoted=
true 192 virtual Ostream&
write(
const std::string& str)
override;
210 std::streamsize
count 217 std::streamsize
count 232 virtual void indent()
override 239 virtual void flush()
override 243 virtual void endl()
override 248 virtual char fill()
const override 254 virtual char fill(
const char)
override 260 virtual int width()
const override 267 virtual int width(
const int)
override 280 virtual int precision(
const int)
override 312 bool bufferIPCsend();
329 const bool sendAtDestruct =
true,
368 const std::streamsize bufSize,
378 inline static bool write 384 const std::streamsize bufSize,
407 inline static bool write 436 inline static bool write 439 UPstream::Request& req,
441 const UList<Type>& buffer,
451 buffer.cdata_bytes(),
477 bool bufferIPCsend();
494 const bool sendAtDestruct =
true,
515 const int rootProcNo,
517 const std::streamsize bufSize,
virtual void endl() override
Add newline and flush stream.
sendModes
Different MPI-send modes (ignored for commsTypes::buffered)
commsTypes
Communications types.
const int comm_
The communicator index.
virtual Ostream & writeRaw(const char *data, std::streamsize count) override
Low-level raw binary output.
virtual char fill() const override
Get the current padding character.
virtual bool endRawWrite() override
End marker for low-level raw binary output.
static int & msgType() noexcept
Message tag of standard messages.
virtual bool beginRawWrite(std::streamsize count) override
Begin marker for low-level raw binary output.
static label worldComm
Communicator for all ranks. May differ from commGlobal() if local worlds are in use.
virtual Ostream & writeQuoted(const char *str, std::streamsize len, const bool quoted=true)=0
Write character/string content, with/without surrounding quotes.
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.
virtual int precision() const override
Get precision of output field.
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.
An opaque wrapper for MPI_Request with a vendor-independent representation without 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...
virtual void flush() override
Flush stream.
const int toProcNo_
Destination rank for the data.
virtual ~UOPBstream()
Destructor, usually sends buffer on destruct.
DynamicList< char > & sendBuf_
Reference to the send buffer data.
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...
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)
Buffers for inter-processor communications streams (UOPstream, UIPstream).
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
virtual Ostream & writeQuoted(const char *str, std::streamsize len, const bool quoted=true) override
Write character/string content, with/without surrounding quotes.
virtual ~UOPstreamBase()
Destructor.
bool sendAtDestruct_
Call bufferIPCsend on termination (in the destructor)
virtual void indent() override
Add indentation characters.
void print(Ostream &os) const override
Print stream description to Ostream.
virtual int width() const override
Get width of output field.
virtual std::ios_base::fmtflags flags() const override
Return current stream flags. Dummy for parallel stream, returns 0.
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" (immediate) : (MPI_Isend, MPI_Irecv)
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.
bool send()
Send buffer contents now and not in destructor [advanced usage]. Returns true on success.
Ostream(const Ostream &)=default
Copy construct.
virtual bool write(const token &tok) override
Write token to stream or otherwise handle it.
Inter-processor communications stream.
std::streamsize size_bytes() const noexcept
Number of contiguous bytes for the List data.