34 template<
class Form,
class Type>
45 template<
class Form,
class Type>
51 is.fatalCheck(
"operator>>(Istream&, Matrix<Form, Type>&)");
57 "operator>>(Istream&, Matrix<Form, Type>&) : reading first token"
60 if (firstToken.isLabel())
62 M.n_ = firstToken.labelToken();
68 if (is.format() == IOstream::ASCII || !contiguous<Type>())
71 char listDelimiter = is.readBeginList(
"Matrix");
78 if (listDelimiter == token::BEGIN_LIST)
83 for (
label i=0; i<
M.n(); i++)
85 listDelimiter = is.readBeginList(
"MatrixRow");
87 for (
label j=0; j<
M.m(); j++)
93 "operator>>(Istream&, Matrix<Form, Type>&) : "
98 is.readEndList(
"MatrixRow");
108 "operator>>(Istream&, Matrix<Form, Type>&) : "
109 "reading the single entry"
112 for (
label i=0; i<nm; i++)
120 is.readEndList(
"Matrix");
129 is.read(
reinterpret_cast<char*
>(v), nm*
sizeof(Type));
133 "operator>>(Istream&, Matrix<Form, Type>&) : "
134 "reading the binary block"
142 <<
"incorrect first token, expected <int>, found "
151 template<
class Form,
class Type>
156 os <<
M.n() << token::SPACE <<
M.m();
159 if (os.format() == IOstream::ASCII || !contiguous<Type>())
163 bool uniform =
false;
165 const Type* v =
M.v_[0];
167 if (nm > 1 && contiguous<Type>())
171 for (
label i=0; i< nm; i++)
184 os << token::BEGIN_BLOCK;
190 os << token::END_BLOCK;
192 else if (nm < 10 && contiguous<Type>())
195 os << token::BEGIN_LIST;
200 for (
label i=0; i<
M.n(); i++)
202 os << token::BEGIN_LIST;
205 for (
label j=0; j<
M.m(); j++)
207 if (j > 0) os << token::SPACE;
211 os << token::END_LIST;
215 os << token::END_LIST;
220 os <<
nl << token::BEGIN_LIST;
225 for (
label i=0; i<
M.n(); i++)
227 os <<
nl << token::BEGIN_LIST;
230 for (
label j=0; j<
M.m(); j++)
235 os <<
nl << token::END_LIST;
239 os <<
nl << token::END_LIST <<
nl;
244 os << token::BEGIN_LIST << token::END_LIST <<
nl;
251 os.write(
reinterpret_cast<const char*
>(
M.v_[0]), nm*
sizeof(Type));
256 os.check(
"Ostream& operator<<(Ostream&, const Matrix&)");