Go to the documentation of this file.
39 template<
class Form,
class Type>
50 template<
class Form,
class Type>
60 is.
fatalCheck(
"readMatrix : reading first token");
69 const label len = size();
79 if (listDelimiter == token::BEGIN_LIST)
84 for (label i = 0; i < mRows_; ++i)
88 for (label j = 0; j < nCols_; ++j)
92 is.
fatalCheck(
"readMatrix : reading reading entry");
103 is.
fatalCheck(
"readMatrix : reading the single entry");
116 Detail::readContiguous<Type>
119 reinterpret_cast<char*
>(v_),
123 is.
fatalCheck(
"readMatrix : reading the binary block");
132 <<
"incorrect first token, expected <int>, found "
140 template<
class Form,
class Type>
150 const label len = mat.
size();
153 os << mat.
m() << token::SPACE << mat.
n();
160 const Type* v = mat.
cdata();
166 os << token::BEGIN_BLOCK << v[0] << token::END_BLOCK;
171 os << token::BEGIN_LIST;
176 for (label i = 0; i < mat.
m(); ++i)
178 os << token::BEGIN_LIST;
181 for (label j = 0; j < mat.
n(); ++j)
183 if (j) os << token::SPACE;
187 os << token::END_LIST;
191 os << token::END_LIST;
196 os <<
nl << token::BEGIN_LIST;
201 for (label i=0; i < mat.
m(); ++i)
203 os <<
nl << token::BEGIN_LIST;
206 for (label j=0; j < mat.
n(); ++j)
208 os <<
nl << v[idx++];
211 os <<
nl << token::END_LIST;
215 os <<
nl << token::END_LIST <<
nl;
220 os << token::BEGIN_LIST << token::END_LIST <<
nl;
232 reinterpret_cast<const char*
>(mat.
cdata()),
243 template<
class Form,
class Type>
251 template<
class Form,
class Type>
254 return mat.writeMatrix(os, Detail::ListPolicy::short_length<Type>::value);
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.
label n() const noexcept
The number of columns.
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 '}'.
Istream & operator>>(Istream &, directionInfo &)
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:
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
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)....
bool readMatrix(Istream &is)
Read Matrix from Istream, discarding existing contents.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
label size() const
The number of elements in Matrix (m*n)
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
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 m() const noexcept
The number of rows.
label readLabel(const char *buf)
Parse entire buffer as a label, skipping leading/trailing whitespace.
const Type * cdata() const noexcept
#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.