36template<
class Form,
class Type>
47template<
class Form,
class Type>
57 is.
fatalCheck(
"readMatrix : reading first token");
59 if (firstToken.isLabel())
61 mRows_ = firstToken.labelToken();
66 const label len = size();
81 is.
fatalCheck(
"readMatrix : reading the binary block");
93 auto iter = this->begin();
96 for (label i = 0; i < mRows_; ++i)
100 for (label j = 0; j < nCols_; ++j, (void)++iter)
114 is.
fatalCheck(
"readMatrix : reading the single entry");
116 std::fill_n(begin(), size(), elem);
128 <<
"incorrect first token, expected <int>, found "
129 << firstToken.info() <<
nl
136template<
class Form,
class Type>
144 const label len = mat.
size();
168 (len <= 1 || !shortLen)
178 for (label i = 0; i < mat.
nRows(); ++i)
184 for (label j = 0; j < mat.
nCols(); ++j, (void)++iter)
199 (mat.
nCols() <= 1 || !shortLen)
209 for (label i = 0; i < mat.
nRows(); ++i)
215 for (label j = 0; j < mat.
nCols(); ++j, (void)++iter)
236 for (label i=0; i < mat.
nRows(); ++i)
242 for (label j = 0; j < mat.
nCols(); ++j, (void)++iter)
streamFormat format() const noexcept
Get the current stream format.
bool fatalCheck(const char *operation) const
Check IOstream status for given operation.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
char readEndList(const char *funcName)
End read of list data, ends with ')' or '}'.
char readBeginList(const char *funcName)
Begin read of list data, starts with '(' or '{'.
A templated (m x n) matrix of objects of <T>. The layout is (mRows x nCols) - row-major order:
constexpr Matrix() noexcept
Default construct (empty matrix).
char * data_bytes() noexcept
Return pointer to the underlying array serving as data storage, reinterpreted as byte data.
const_iterator cbegin() const noexcept
Return const_iterator to begin traversing a constant Matrix.
bool readMatrix(Istream &is)
Read Matrix from Istream, discarding existing contents.
Ostream & writeMatrix(Ostream &os, const label shortLen=0) const
Write Matrix, with line-breaks in ASCII when length exceeds shortLen.
iterator begin() noexcept
Return an iterator to begin traversing a Matrix.
label size() const noexcept
The number of elements in Matrix (m*n).
label nCols() const noexcept
The number of columns.
label nRows() const noexcept
The number of rows.
bool uniform() const
True if all entries have identical values, and Matrix is non-empty.
const char * cdata_bytes() const noexcept
Return pointer to the underlying array serving as data storage, reinterpreted as byte data.
std::streamsize size_bytes() const noexcept
Number of contiguous bytes for the Matrix data, no runtime check that the type is actually contiguous...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A token holds an item read from Istream.
@ BEGIN_BLOCK
Begin block [isseparator].
@ END_BLOCK
End block [isseparator].
@ BEGIN_LIST
Begin list [isseparator].
@ END_LIST
End list [isseparator].
bool isLabel() const noexcept
Integral token is convertible to Foam::label.
label labelToken() const
Return integer type as label value or Error.
InfoProxy< token > info() const noexcept
Return info proxy, for printing token information to a stream.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
OBJstream os(runTime.globalPath()/outputName)
void readContiguous(Istream &is, char *data, std::streamsize byteCount)
Read binary block of contiguous data, possibly with conversion.
label readLabel(const char *buf)
Parse entire buffer as a label, skipping leading/trailing whitespace.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
constexpr bool is_contiguous_v
The is_contiguous value of Type (after stripping of qualifiers).
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).