35#if WM_LABEL_SIZE == 32
38#elif WM_LABEL_SIZE == 64
50template<
class readType,
class dataType>
53 if constexpr (
sizeof(dataType) ==
sizeof(readType))
56 is.
readRaw(
reinterpret_cast<char*
>(data), nElem*
sizeof(dataType));
60 for (
const dataType* last = data + nElem; data != last; ++data)
63 is.
readRaw(
reinterpret_cast<char*
>(&val),
sizeof(readType));
65 if constexpr (
sizeof(dataType) <
sizeof(readType))
73 *data = dataType(val);
88 switch (is.labelByteSize())
92 reading<int32_t, label>(is, data, nElem);
97 reading<int64_t, label>(is, data, nElem);
104 <<
"Currently no code to read int" << (8*is.labelByteSize())
105 <<
" as int" << (8*
sizeof(label)) << nl
106 <<
abort(FatalIOError);
117 for (label i=0; i<
b; i++)
126 <<
"negative value for b is not supported"
127 <<
abort(FatalError);
137 static label factTable[13] =
139 1, 1, 2, 6, 24, 120, 720, 5040, 40320,
140 362880, 3628800, 39916800, 479001600
147 <<
"n value out of range"
148 <<
abort(FatalError);
unsigned labelByteSize() const noexcept
The sizeof (label) in bytes associated with the stream.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
virtual Istream & readRaw(char *data, std::streamsize count)=0
Low-level raw binary read (without possible block delimiters). Reading into a null pointer shall idea...
A traits class, which is primarily used for primitives and vector-space.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void readRawLabel(Istream &is, label *data, size_t nElem=1)
Read raw label(s) from binary stream.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
errorManip< error > abort(error &err)
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
constexpr int32_t narrowInt32(const int64_t val) noexcept
Type narrowing from int64_t to int32_t.
label factorial(label n)
Evaluate n! : 0 < n <= 12.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
constexpr char nl
The newline '\n' character (0x0a).