Go to the documentation of this file.
36 inline void Foam::UOPstream::prepareBuffer
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);
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::VERBATIMSTRING :
207 writeToBuffer(
char(token::tokenType::VERBATIMSTRING));
213 case token::tokenType::VARIABLE :
215 writeToBuffer(
char(token::tokenType::VARIABLE));
242 const word nonWhiteChars(string::validate<word>(str));
244 if (nonWhiteChars.size() == 1)
246 return write(nonWhiteChars[0]);
248 else if (nonWhiteChars.size())
250 return write(nonWhiteChars);
259 writeToBuffer(
char(token::tokenType::WORD));
260 writeStringToBuffer(str);
268 writeToBuffer(
char(token::tokenType::STRING));
269 writeStringToBuffer(str);
277 const std::string& str,
283 writeToBuffer(
char(token::tokenType::STRING));
287 writeToBuffer(
char(token::tokenType::WORD));
289 writeStringToBuffer(str);
297 writeToBuffer(
char(token::tokenType::LABEL));
305 writeToBuffer(
char(token::tokenType::LABEL));
313 writeToBuffer(
char(token::tokenType::FLOAT_SCALAR));
321 writeToBuffer(
char(token::tokenType::DOUBLE_SCALAR));
332 <<
"stream format not binary"
345 std::streamsize
count
363 <<
"stream format not binary"
368 prepareBuffer(
count, 8);
376 os <<
"Writing from processor " << toProcNo_
377 <<
" 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,.
label ListType::const_reference val
double doubleScalar
Floating-point double precision scalar type.
A class for handling words, derived from Foam::string.
const string & stringToken() const
Return const reference to the string contents.
float floatScalar
Floating-point single precision scalar type.
void print(Ostream &os) const
Print description of IOstream 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.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
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 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
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.
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)