35 inline void Foam::UOPstream::writeToBuffer(
const T& t)
37 writeToBuffer(&t,
sizeof(
T),
sizeof(
T));
41 inline void Foam::UOPstream::writeToBuffer(
const char& c)
51 inline void Foam::UOPstream::writeToBuffer
68 alignedPos = align + ((sendBuf_.
size() - 1) & ~(align - 1));
72 sendBuf_.
setSize(alignedPos + count);
74 const char* dataPtr =
reinterpret_cast<const char*
>(data);
76 while (i--) sendBuf_[alignedPos++] = *dataPtr++;
90 const bool sendAtDestruct,
101 sendAtDestruct_(sendAtDestruct)
111 Ostream(buffers.format_, buffers.version_),
113 sendBuf_(buffers.sendBuf_[toProcNo]),
115 comm_(buffers.comm_),
143 <<
"Failed sending outgoing message of size " << sendBuf_.
size()
144 <<
" to processor " << toProcNo_
166 word nonWhiteChars(string::validate<word>(str));
168 if (nonWhiteChars.size() == 1)
170 return write(nonWhiteChars[0]);
172 else if (nonWhiteChars.size())
174 return write(nonWhiteChars);
187 size_t len = str.size();
189 writeToBuffer(str.c_str(), len + 1, 1);
199 size_t len = str.size();
201 writeToBuffer(str.c_str(), len + 1, 1);
211 size_t len = vs.size();
213 writeToBuffer(vs.c_str(), len + 1, 1);
221 const std::string& str,
234 size_t len = str.size();
236 writeToBuffer(str.c_str(), len + 1, 1);
287 <<
"stream format not binary" 291 writeToBuffer(data, count, 8);
299 os <<
"Writing from processor " << toProcNo_
300 <<
" to processor " <<
myProcNo() <<
" in communicator " << comm_
A class for handling verbatimStrings, derived from string.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
commsTypes
Types of communications.
Ostream(streamFormat format=ASCII, versionNumber version=currentVersion, compressionType compression=UNCOMPRESSED)
Set stream status.
void setGood()
Set stream to be good.
commsTypes commsType_
Communications type of this stream.
void size(const label)
Override size to be inconsistent with allocated storage.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Ostream & writeQuoted(const std::string &, const bool quoted=true)
Write std::string surrounded by quotes.
void setSize(const label)
Alter the addressed list size.
A class for handling words, derived from string.
float floatScalar
Float precision floating point scalar type.
void setCapacity(const label)
Alter the size of the underlying storage.
iterator begin()
Return an iterator to begin traversing the UList.
streamFormat
Enumeration for the format of data in the stream.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
double doubleScalar
Double precision floating point scalar type.
streamFormat format() const
Return current stream format.
errorManip< error > abort(error &err)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
static bool write(const commsTypes commsType, const int toProcNo, const char *buf, const std::streamsize bufSize, const int tag=UPstream::msgType(), const label communicator=0)
Write given buffer to given processor.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
long double longDoubleScalar
Lang double precision floating point scalar type.
void setOpened()
Set stream opened.
UPstream(const commsTypes commsType)
Construct given optional buffer size.
UOPstream(const commsTypes commsType, const int toProcNo, DynamicList< char > &sendBuf, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm, const bool sendAtDestruct=true, streamFormat format=BINARY, versionNumber version=currentVersion)
Construct given process index to send to and optional buffer size,.
label capacity() const
Size of the underlying storage.
void print(Ostream &) const
Print description of IOstream to Ostream.
Inter-processor communications stream.