67 ? (align + ((
pos - 1) & ~(align - 1)))
77inline void Foam::UIPstreamBase::checkEof()
86inline void Foam::UIPstreamBase::prepareBuffer(
const size_t align)
88 recvBufPos_ =
byteAlign(recvBufPos_, align);
93inline void Foam::UIPstreamBase::readFromBuffer(
T& val)
95 prepareBuffer(
sizeof(
T));
97 val =
reinterpret_cast<T&
>(recvBuf_[recvBufPos_]);
98 recvBufPos_ +=
sizeof(
T);
103inline void Foam::UIPstreamBase::readFromBuffer
109 const char*
const __restrict__ buf = &recvBuf_[recvBufPos_];
110 char*
const __restrict__
output =
reinterpret_cast<char*
>(data);
112 for (
size_t i = 0; i <
count; ++i)
117 recvBufPos_ +=
count;
122inline Foam::Istream& Foam::UIPstreamBase::readString(std::string& str)
132 str.assign(&recvBuf_[recvBufPos_], len);
150 const int fromProcNo,
152 label& receiveBufPosition,
155 const bool clearAtEnd,
161 fromProcNo_(fromProcNo),
162 recvBuf_(receiveBuf),
163 recvBufPos_(receiveBufPosition),
166 clearAtEnd_(clearAtEnd),
176 const int fromProcNo,
182 fromProcNo_(fromProcNo),
183 recvBuf_(buffers.recvBuf_[fromProcNo]),
184 recvBufPos_(buffers.recvBufPos_[fromProcNo]),
186 comm_(buffers.comm()),
187 clearAtEnd_(buffers.allowClearRecv()),
197 <<
"PstreamBuffers::finishedSends() never called." <<
endl
198 <<
"Please call PstreamBuffers::finishedSends() after doing"
199 <<
" all your sends (using UOPstream) and before doing any"
212 if (clearAtEnd_ && eof())
216 Pout<<
"UIPstreamBase Destructor : tag:" << tag_
217 <<
" fromProcNo:" << fromProcNo_
218 <<
" clearing receive buffer of size "
220 <<
" messageSize_:" << messageSize_ <<
endl;
222 recvBuf_.clearStorage();
409 c = recvBuf_[recvBufPos_];
418 return readString(str);
424 return readString(str);
456 readRaw(
data, count);
470 readFromBuffer(
data, count);
480 <<
"stream format not binary"
509 if (recvBuf_.empty() || !messageSize_)
518 os <<
"Reading from processor " << fromProcNo_
519 <<
" using communicator " << comm_
520 <<
" and tag " << tag_
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
The IOstreamOption is a simple container for options an IOstream can normally have.
streamFormat format() const noexcept
Get the current stream format.
streamFormat
Data format (ascii | binary)
void setEof() noexcept
Set stream state as reached 'eof'.
void setGood() noexcept
Set stream state to be good.
void setOpened() noexcept
Set stream opened.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
bool getBack(token &tok)
Get the put-back token if there is one.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Buffers for inter-processor communications streams (UOPstream, UIPstream).
bool finished() const noexcept
True if finishedSends() or finishedNeighbourSends() has been called.
virtual bool read()
Re-read model coefficients if they have changed.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Base class for input inter-processor communications stream (ie, parallel streams)....
virtual void rewind()
Rewind the receive stream position so that it may be read again.
virtual ~UIPstreamBase()
Destructor. Optionally clears external receive buffer.
bool beginRawRead()
Start of low-level raw binary read.
Istream & readRaw(char *data, std::streamsize count)
Low-level raw binary read.
Inter-processor communications stream.
commsTypes
Types of communications.
commsTypes commsType() const noexcept
Get the communications type of the stream.
Database for solution data, solver performance and other reduced data.
scalar print()
Print to screen.
A token holds an item read from Istream.
tokenType
Enumeration defining the types of token.
@ LABEL
label (integer) type
@ DOUBLE
double (double-precision) type
@ FLAG
stream flag (1-byte bitmask)
@ FLOAT
float (single-precision) type
@ STRING
Foam::string (usually double-quoted)
label lineNumber() const noexcept
The line number for the token.
punctuationToken
Standard punctuation tokens (a character)
@ DIVIDE
Divide [isseparator].
@ BEGIN_BLOCK
Begin block [isseparator].
@ BEGIN_SQR
Begin dimensions [isseparator].
@ COLON
Colon [isseparator].
@ END_BLOCK
End block [isseparator].
@ ASSIGN
Assignment/equals [isseparator].
@ END_STATEMENT
End entry [isseparator].
@ BEGIN_LIST
Begin list [isseparator].
@ PLUS
Addition [isseparator].
@ END_LIST
End list [isseparator].
@ END_SQR
End dimensions [isseparator].
@ MULTIPLY
Multiply [isseparator].
@ MINUS
Subtract or start of negative number.
@ COMMA
Comma [isseparator].
void setBad()
Clear token and set to be ERROR.
@ BINARY
BINARY-mode stream.
@ ASCII
ASCII-mode stream.
bool isFlag() const noexcept
Token is FLAG.
bool setType(const tokenType tokType) noexcept
Change the token type, for similar types.
int flagToken() const
Return flag bitmask value.
bool isCompound() const noexcept
Token is COMPOUND.
A class for handling words, derived from Foam::string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
dimensionedScalar pos(const dimensionedScalar &ds)
static Foam::word charToWord(char c)
bool read(const char *buf, int32_t &val)
Same as readInt32.
static void processFlags(Istream &is, int flagMask)
double doubleScalar
A typedef for double.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static label byteAlign(const label pos, const size_t align)
float floatScalar
A typedef for float.
errorManip< error > abort(error &err)
static Ostream & output(Ostream &os, const IntRange< T > &range)
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
errorManipArg< error, int > exit(error &err, const int errNo=1)
word format(conversionProperties.get< word >("format"))