Go to the documentation of this file.
36 inline void Foam::UOPstream::prepareBuffer
48 label
pos = sendBuf_.size();
53 pos = align + ((
pos - 1) & ~(align - 1));
65 inline void Foam::UOPstream::writeToBuffer(
const T& val)
67 writeToBuffer(&val,
sizeof(
T),
sizeof(
T));
71 inline void Foam::UOPstream::writeToBuffer(
const char&
c)
73 if (!sendBuf_.capacity())
75 sendBuf_.setCapacity(1000);
81 inline void Foam::UOPstream::writeToBuffer
93 prepareBuffer(
count, align);
96 const label
pos = sendBuf_.size();
101 char*
const __restrict__ buf = (sendBuf_.begin() +
pos);
102 const char*
const __restrict__
input =
reinterpret_cast<const char*
>(data);
104 for (
size_t i = 0; i <
count; ++i)
111 inline void Foam::UOPstream::writeStringToBuffer(
const std::string& str)
113 const size_t len = str.size();
115 writeToBuffer(str.data(), len, 1);
128 const bool sendAtDestruct,
139 sendAtDestruct_(sendAtDestruct)
149 Ostream(buffers.format_, buffers.version_),
151 sendBuf_(buffers.sendBuf_[toProcNo]),
153 comm_(buffers.comm_),
181 <<
"Failed sending outgoing message of size " << sendBuf_.size()
182 <<
" to processor " << toProcNo_
197 case token::tokenType::FLAG :
199 writeToBuffer(
char(token::tokenType::FLAG));
205 case token::tokenType::DIRECTIVE :
207 writeToBuffer(
char(token::tokenType::DIRECTIVE));
213 case token::tokenType::VARIABLE :
214 case token::tokenType::VERBATIM :
216 writeToBuffer(
char(tok.
type()));
243 const word nonWhiteChars(string::validate<word>(str));
245 if (nonWhiteChars.size() == 1)
247 return write(nonWhiteChars[0]);
249 else if (nonWhiteChars.size())
251 return write(nonWhiteChars);
260 writeToBuffer(
char(token::tokenType::WORD));
261 writeStringToBuffer(str);
269 writeToBuffer(
char(token::tokenType::STRING));
270 writeStringToBuffer(str);
278 const std::string& str,
284 writeToBuffer(
char(token::tokenType::STRING));
288 writeToBuffer(
char(token::tokenType::WORD));
290 writeStringToBuffer(str);
298 writeToBuffer(
char(token::tokenType::LABEL));
306 writeToBuffer(
char(token::tokenType::LABEL));
314 writeToBuffer(
char(token::tokenType::FLOAT));
322 writeToBuffer(
char(token::tokenType::DOUBLE));
333 <<
"stream format not binary"
346 std::streamsize
count
364 <<
"stream format not binary"
369 prepareBuffer(
count, 8);
377 os <<
"Writing from processor " << toProcNo_
378 <<
" to processor " << myProcNo() <<
" in communicator " << comm_
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,.
double doubleScalar
A typedef for double.
A class for handling words, derived from Foam::string.
const string & stringToken() const
Return const reference to the string contents.
float floatScalar
A typedef for float.
void print(Ostream &os) const
Print stream description to Ostream.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
Ostream & endl(Ostream &os)
Add newline and flush stream.
A token holds an item read from Istream.
void setOpened()
Set stream opened.
void reserve(const label nElem)
Reserve allocation space for at least this size.
word format(conversionProperties.get< word >("format"))
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.
Inter-processor communications stream.
Representation of a major/minor version number.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
virtual bool beginRawWrite(std::streamsize count)
Begin marker for low-level raw binary output.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
streamFormat
Data format (ascii | binary)
errorManip< error > abort(error &err)
const word & wordToken() const
Return const reference to the word contents.
const std::string version
OpenFOAM version (name or stringified number) as a std::string.
void resize(const label nElem)
Alter addressable list size.
tokenType type() const noexcept
Return the token type.
commsTypes
Types of communications.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void setGood()
Set stream to be good.
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
static Istream & input(Istream &is, IntRange< T > &range)
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
const dimensionedScalar c
Speed of light in a vacuum.
virtual Ostream & writeQuoted(const std::string &str, const bool quoted=true)
Write std::string surrounded by quotes.
int flagToken() const
Return flag bitmask value.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
virtual Ostream & writeRaw(const char *data, std::streamsize count)
Low-level raw binary output.
bool isspace(char c)
Test for horizontal whitespace.
Database for solution data, solver performance and other reduced data.
dimensionedScalar pos(const dimensionedScalar &ds)