Go to the documentation of this file.
65 inline void Foam::UIPstream::checkEof()
67 if (externalBufPosition_ == messageSize_)
74 inline void Foam::UIPstream::prepareBuffer(
const size_t align)
78 externalBufPosition_ =
79 align + ((externalBufPosition_ - 1) & ~(align - 1));
85 inline void Foam::UIPstream::readFromBuffer(
T& val)
87 prepareBuffer(
sizeof(
T));
89 val =
reinterpret_cast<T&
>(externalBuf_[externalBufPosition_]);
90 externalBufPosition_ +=
sizeof(
T);
95 inline void Foam::UIPstream::readFromBuffer
101 const char*
const __restrict__ buf = &externalBuf_[externalBufPosition_];
102 char*
const __restrict__
output =
reinterpret_cast<char*
>(data);
104 for (
size_t i = 0; i <
count; ++i)
109 externalBufPosition_ +=
count;
114 inline Foam::Istream& Foam::UIPstream::readStringFromBuffer(std::string& str)
124 str.assign(&externalBuf_[externalBufPosition_], len);
125 externalBufPosition_ += len;
141 if (clearAtEnd_ && eof())
145 Pout<<
"UIPstream::~UIPstream() : tag:" << tag_
146 <<
" fromProcNo:" << fromProcNo_
147 <<
" clearing externalBuf_ of size "
148 << externalBuf_.size()
149 <<
" messageSize_:" << messageSize_ <<
endl;
151 externalBuf_.clearStorage();
231 case token::tokenType::WORD :
232 case token::tokenType::DIRECTIVE :
255 case token::tokenType::STRING :
256 case token::tokenType::VARIABLE :
257 case token::tokenType::VERBATIM :
273 case token::tokenType::LABEL :
288 case token::tokenType::FLOAT :
303 case token::tokenType::DOUBLE :
337 c = externalBuf_[externalBufPosition_];
338 ++externalBufPosition_;
346 return readStringFromBuffer(str);
352 return readStringFromBuffer(str);
403 <<
"stream format not binary"
416 externalBufPosition_ = 0;
422 os <<
"Reading from processor " << fromProcNo_
423 <<
" using communicator " << comm_
424 <<
" and tag " << tag_
int debug
Static debugging option.
Subtract or start of negative number.
Assignment/equals [isseparator].
double doubleScalar
A typedef for double.
static Ostream & output(Ostream &os, const IntRange< T > &range)
A class for handling words, derived from Foam::string.
label lineNumber() const noexcept
The line number for the token.
float floatScalar
A typedef for float.
bool read(const char *buf, int32_t &val)
Same as readInt32.
void rewind()
Rewind the stream so that it may be read again.
void setEof()
Set stream to have reached eof.
streamFormat format() const noexcept
Get the current stream format.
static Foam::word charToWord(char c)
Ostream & endl(Ostream &os)
Add newline and flush stream.
A token holds an item read from Istream.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
static label read(const commsTypes commsType, const int fromProcNo, char *buf, const std::streamsize bufSize, const int tag=UPstream::msgType(), const label communicator=0)
Read into given buffer from given processor and return the.
word format(conversionProperties.get< word >("format"))
Begin dimensions [isseparator].
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
static void processFlags(Istream &is, int flagMask)
bool isFlag() const noexcept
Token is FLAG.
static bool isCompound(const word &name)
Test if name is a known (registered) compound type.
void print(Ostream &os) const
Print stream description to Ostream.
tokenType
Enumeration defining the types of token.
End dimensions [isseparator].
errorManip< error > abort(error &err)
Begin block [isseparator].
Istream & readRaw(char *data, std::streamsize count)
Low-level raw binary read.
stream flag (1-byte bitmask)
bool getBack(token &tok)
Get the put back token if there is one and return true.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
const dimensionedScalar c
Speed of light in a vacuum.
int flagToken() const
Return flag bitmask value.
static autoPtr< compound > New(const word &type, Istream &is)
Construct compound from Istream.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Begin list [isseparator].
bool beginRawRead()
Start of low-level raw binary read.
bool setType(const tokenType tokType) noexcept
Change the token type, for similar types.
Database for solution data, solver performance and other reduced data.
punctuationToken
Standard punctuation tokens (a character)
void setBad()
Clear token and set to be ERROR.