Go to the documentation of this file.
40 inline static label
byteAlign(
const label
pos,
const size_t align)
45 ? (align + ((
pos - 1) & ~(align - 1)))
55 inline void Foam::UOPstream::prepareBuffer
78 inline void Foam::UOPstream::writeToBuffer(
const T& val)
80 writeToBuffer(&val,
sizeof(
T),
sizeof(
T));
84 inline void Foam::UOPstream::writeToBuffer
96 prepareBuffer(
count, align);
99 const label
pos = sendBuf_.size();
104 char*
const __restrict__ buf = (sendBuf_.data() +
pos);
105 const char*
const __restrict__
input =
reinterpret_cast<const char*
>(data);
107 for (
size_t i = 0; i <
count; ++i)
114 inline void Foam::UOPstream::putChar(
const char c)
116 if (!sendBuf_.capacity())
118 sendBuf_.setCapacity(1000);
124 inline void Foam::UOPstream::putString(
const std::string& str)
126 const size_t len = str.size();
128 writeToBuffer(str.data(), len, 1);
136 const commsTypes commsType,
141 const bool sendAtDestruct,
151 sendAtDestruct_(sendAtDestruct)
163 sendBuf_(buffers.sendBuf_[toProcNo]),
165 comm_(buffers.comm_),
166 sendAtDestruct_(buffers.commsType_ !=
UPstream::commsTypes::nonBlocking)
193 <<
"Failed sending outgoing message of size " << sendBuf_.size()
194 <<
" to processor " << toProcNo_
209 case token::tokenType::FLAG :
211 putChar(token::tokenType::FLAG);
212 putChar(tok.flagToken());
218 case token::tokenType::WORD :
219 case token::tokenType::DIRECTIVE :
222 putString(tok.wordToken());
228 case token::tokenType::STRING :
229 case token::tokenType::EXPRESSION :
230 case token::tokenType::VARIABLE :
231 case token::tokenType::VERBATIM :
234 putString(tok.stringToken());
260 const word nonWhiteChars(string::validate<word>(str));
262 if (nonWhiteChars.size() == 1)
264 return write(nonWhiteChars[0]);
266 else if (nonWhiteChars.size())
277 putChar(token::tokenType::WORD);
286 putChar(token::tokenType::STRING);
295 const std::string& str,
301 putChar(token::tokenType::STRING);
305 putChar(token::tokenType::WORD);
315 putChar(token::tokenType::LABEL);
323 putChar(token::tokenType::LABEL);
331 putChar(token::tokenType::FLOAT);
339 putChar(token::tokenType::DOUBLE);
350 <<
"stream format not binary"
364 std::streamsize
count
382 <<
"stream format not binary"
388 prepareBuffer(
count, 8);
396 os <<
"Writing from processor " << toProcNo_
397 <<
" to processor " << myProcNo() <<
" in communicator " << comm_
void resize(const label len)
UOPstream(const 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)
double doubleScalar
Floating-point double precision scalar type.
A class for handling words, derived from Foam::string.
static bool write(const commsTypes commsType, const int toProcNo, const char *buf, const std::streamsize bufSize, const int tag=UPstream::msgType(), const label communicator=UPstream::worldComm)
bool isspace(char c) noexcept
const string & stringToken() const
float floatScalar
Floating-point single precision scalar type.
void print(Ostream &os) const
Buffers for inter-processor communications streams (UOPstream, UIPstream).
static const versionNumber currentVersion
Ostream & endl(Ostream &os)
A token holds an item read from Istream.
void reserve(const label len)
void setOpened() noexcept
word format(conversionProperties.get< word >("format"))
static label byteAlign(const label pos, const size_t align)
Inter-processor communications stream.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
The IOstreamOption is a simple container for options an IOstream can normally have.
virtual bool beginRawWrite(std::streamsize count)
label max(const labelHashSet &set, label maxValue=labelMin)
OBJstream os(runTime.globalPath()/outputName)
errorManip< error > abort(error &err)
const word & wordToken() const
tokenType type() const noexcept
#define FatalErrorInFunction
unsigned int count(const UList< bool > &bools, const bool val=true)
static Istream & input(Istream &is, IntRange< T > &range)
void write(vtk::formatter &fmt, const Type &val, const label n=1)
const dimensionedScalar c
virtual Ostream & writeQuoted(const std::string &str, const bool quoted=true)
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
virtual Ostream & writeRaw(const char *data, std::streamsize count)
Database for solution data, solver performance and other reduced data.
dimensionedScalar pos(const dimensionedScalar &ds)