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)
43 if (!sendBuf_.capacity())
45 sendBuf_.setCapacity(1000);
51 inline void Foam::UOPstream::writeToBuffer
58 if (!sendBuf_.capacity())
60 sendBuf_.setCapacity(1000);
63 label alignedPos = sendBuf_.size();
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);
303 <<
"stream format not binary"
307 writeToBuffer(data,
count, 8);
315 os <<
"Writing from processor " << toProcNo_
316 <<
" to processor " << myProcNo() <<
" in communicator " << comm_
void setGood()
Set stream to be good.
streamFormat
Enumeration for the format of data in the stream.
void setOpened()
Set stream opened.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Buffers for inter-processor communications streams (UOPstream, UIPstream).
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.
Ostream & writeQuoted(const std::string &, const bool quoted=true)
Write std::string surrounded by quotes.
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,.
void print(Ostream &) const
Print description of IOstream to Ostream.
Inter-processor communications stream.
commsTypes
Types of communications.
A class for handling verbatimStrings, derived from string.
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const dimensionedScalar c
Speed of light in a vacuum.
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
double doubleScalar
Double precision floating point scalar type.
errorManip< error > abort(error &err)
float floatScalar
Float precision floating point scalar type.
label count(const ListType &l, typename ListType::const_reference x)
Count the number of occurrences of a value in a list.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
long double longDoubleScalar
Lang double precision floating point scalar type.
word format(conversionProperties.lookup("format"))