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,
150 virtual ios_base::fmtflags
flags()
const override 152 return ios_base::fmtflags(0);
163 virtual bool write(
const token& tok)
override;
173 const bool quoted=
true 184 virtual Ostream&
write(
const std::string& str)
override;
202 std::streamsize
count 209 std::streamsize
count 224 virtual void indent()
override 231 virtual void flush()
override 235 virtual void endl()
override 240 virtual char fill()
const override 246 virtual char fill(
const char)
override 252 virtual int width()
const override 259 virtual int width(
const int)
override 272 virtual int precision(
const int)
override 287 virtual ios_base::fmtflags
flags(
const ios_base::fmtflags)
override 289 return ios_base::fmtflags(0);
313 bool bufferIPCsend();
330 const bool sendAtDestruct =
true,
365 const std::streamsize bufSize,
375 inline static bool write 381 const std::streamsize bufSize,
404 inline static bool write 433 inline static bool write 436 UPstream::Request& req,
438 const UList<Type>& buffer,
448 buffer.cdata_bytes(),
474 bool bufferIPCsend();
491 const bool sendAtDestruct =
true,
512 const int rootProcNo,
514 const std::streamsize bufSize,
virtual void endl() override
Add newline and flush stream.
sendModes
Different MPI-send modes (ignored for commsTypes::blocking)
const bool sendAtDestruct_
Call bufferIPCsend on termination (in the destructor)
commsTypes
Communications types.
const int comm_
The communicator index.
virtual Ostream & writeRaw(const char *data, std::streamsize count) override
Low-level raw binary output.
A token holds an item read from Istream.
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 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...
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 ios_base::fmtflags flags() const override
Return flags of output 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...
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.
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.
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)
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 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.