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);
219 size_t len = vs.size();
221 writeToBuffer(vs.c_str(), len + 1, 1);
229 const std::string& str,
242 size_t len = str.size();
244 writeToBuffer(str.c_str(), len + 1, 1);
311 <<
"stream format not binary"
315 writeToBuffer(data,
count, 8);
323 os <<
"Writing from processor " << toProcNo_
324 <<
" 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).
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,.
virtual Ostream & write(const token &)
Write token.
void print(Ostream &) const
Print description of IOstream to Ostream.
Inter-processor communications stream.
commsTypes
Types of communications.
A class for handling keywords in dictionaries.
bool isPattern() const
Should be treated as a match rather than a literal string.
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(GeometricField< Type, GeoMesh, PrimitiveField1 > &gf, const GeometricField< Type, GeoMesh, PrimitiveField2 > &gf1)
long double longDoubleScalar
Lang double precision floating point scalar type.
word format(conversionProperties.lookup("format"))