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,
102 sendAtDestruct_(sendAtDestruct)
112 Ostream(buffers.format_, buffers.version_),
114 sendBuf_(buffers.sendBuf_[toProcNo]),
116 comm_(buffers.comm_),
144 <<
"Failed sending outgoing message of size " << sendBuf_.size()
145 <<
" to processor " << toProcNo_
167 word nonWhiteChars(string::validate<word>(str));
169 if (nonWhiteChars.size() == 1)
171 return write(nonWhiteChars[0]);
173 else if (nonWhiteChars.size())
175 return write(nonWhiteChars);
188 size_t len = str.size();
190 writeToBuffer(str.c_str(), len + 1, 1);
200 size_t len = str.size();
202 writeToBuffer(str.c_str(), len + 1, 1);
212 size_t len = vs.size();
214 writeToBuffer(vs.c_str(), len + 1, 1);
222 const std::string& str,
235 size_t len = str.size();
237 writeToBuffer(str.c_str(), len + 1, 1);
304 <<
"stream format not binary"
308 writeToBuffer(data,
count, 8);
316 os <<
"Writing from processor " << toProcNo_
317 <<
" 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, const streamFormat format=BINARY, const versionNumber version=currentVersion, const bool global=false)
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)
void T(LagrangianPatchField< Type > &f, const LagrangianPatchField< Type > &f1)
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.
long double longDoubleScalar
Lang double precision floating point scalar type.
word format(conversionProperties.lookup("format"))