Go to the documentation of this file.
39 template<
class Form,
class Type>
52 template<
class Form,
class Type>
62 is.
fatalCheck(
"readMatrix : reading first token");
71 const label len = size();
79 Detail::readContiguous<Type>
86 is.
fatalCheck(
"readMatrix : reading the binary block");
97 if (listDelimiter == token::BEGIN_LIST)
102 for (label i = 0; i < mRows_; ++i)
106 for (label j = 0; j < nCols_; ++j)
120 is.
fatalCheck(
"readMatrix : reading the single entry");
134 <<
"incorrect first token, expected <int>, found "
135 << firstToken.
info() <<
nl
142 template<
class Form,
class Type>
152 const label len = mat.
size();
171 const Type* v = mat.
cdata();
177 os << token::BEGIN_BLOCK << v[0] << token::END_BLOCK;
182 os << token::BEGIN_LIST;
187 for (label i = 0; i < mat.
nRows(); ++i)
189 os << token::BEGIN_LIST;
192 for (label j = 0; j < mat.
nCols(); ++j)
194 if (j)
os << token::SPACE;
198 os << token::END_LIST;
202 os << token::END_LIST;
207 os <<
nl << token::BEGIN_LIST;
212 for (label i=0; i < mat.
nRows(); ++i)
214 os <<
nl << token::BEGIN_LIST;
217 for (label j = 0; j < mat.
nCols(); ++j)
219 os <<
nl << v[idx++];
222 os <<
nl << token::END_LIST;
226 os <<
nl << token::END_LIST <<
nl;
232 os << token::BEGIN_LIST << token::END_LIST <<
nl;
label labelToken() const
Return label value.
bool isLabel() const noexcept
Token is LABEL.
constexpr auto begin(C &c) -> decltype(c.begin())
Return iterator to the beginning of the container c.
char readBeginList(const char *funcName)
Begin read of list data, starts with '(' or '{'.
Ostream & writeMatrix(Ostream &os, const label shortLen=0) const
bool fatalCheck(const char *operation) const
Check IOstream status for given operation.
streamFormat format() const noexcept
Get the current stream format.
char readEndList(const char *funcName)
End read of list data, ends with ')' or '}'.
A token holds an item read from Istream.
A templated (m x n) matrix of objects of <T>. The layout is (mRows x nCols) - row-major order:
label nCols() const noexcept
The number of columns - same as n()
InfoProxy< token > info() const
Return info proxy for printing token information to a stream.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
std::streamsize size_bytes() const noexcept
bool readMatrix(Istream &is)
Read Matrix from Istream, discarding existing contents.
label nRows() const noexcept
The number of rows - same as m()
label size() const
The number of elements in Matrix (m*n)
OBJstream os(runTime.globalPath()/outputName)
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
errorManipArg< error, int > exit(error &err, const int errNo=1)
bool uniform() const
True if all entries have identical values, and Matrix is non-empty.
label readLabel(const char *buf)
Parse entire buffer as a label, skipping leading/trailing whitespace.
const Type * cdata() const noexcept
const char * cdata_bytes() const noexcept
Matrix() noexcept
Default construct (empty matrix)
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A template class to specify that a data type can be considered as being contiguous in memory.