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 :
253 case token::tokenType::VERBATIMSTRING :
257 t.
setType(token::tokenType::VERBATIMSTRING);
260 case token::tokenType::VARIABLE :
264 t.
setType(token::tokenType::VARIABLE);
267 case token::tokenType::STRING :
282 case token::tokenType::LABEL :
297 case token::tokenType::FLOAT_SCALAR :
312 case token::tokenType::DOUBLE_SCALAR :
346 c = externalBuf_[externalBufPosition_];
347 ++externalBufPosition_;
355 return readStringFromBuffer(str);
361 return readStringFromBuffer(str);
412 <<
"stream format not binary"
425 externalBufPosition_ = 0;
431 os <<
"Reading from processor " << fromProcNo_
432 <<
" using communicator " << comm_
433 <<
" and tag " << tag_
int debug
Static debugging option.
Subtract or start of negative number.
Assignment/equals [isseparator].
bool isFlag() const
Token is FLAG.
label ListType::const_reference val
double doubleScalar
Floating-point double precision scalar type.
A class for handling words, derived from Foam::string.
float floatScalar
Floating-point single precision scalar type.
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
An Ostream wrapper for parallel output to std::cout.
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"))
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void print(Ostream &) const
Print description of IOstream to Ostream.
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)
static bool isCompound(const word &name)
Return true if name is a known (registered) compound type.
End dimensions [isseparator].
bool setType(const tokenType variant)
Change the token type, for similar types.
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)
Select null constructed.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
label lineNumber() const
The line number for the token.
Begin list [isseparator].
bool beginRawRead()
Start of low-level raw binary read.
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.