33 template<
class MatrixType>
39 <<
"Number of columns " << nCols_ <<
" != 1" 47 f[i] = operator()(i, 0);
54 template<
class MatrixType>
60 <<
"Number of columns " << nCols_ <<
" != 1" 64 Field<cmptType>
f(mRows_);
68 f[i] = operator()(i, 0);
75 template<
class MatrixType>
82 <<
"Block addresses " << what
83 <<
" outside matrix or invalid matrix components" 89 template<
class MatrixType>
96 <<
"Block addresses " << what
97 <<
" outside matrix or invalid matrix components" 109 if (i < 0 || i >= mRows_)
112 <<
"Index " << i <<
" is out of range 0 ... " << mRows_ - 1
115 else if (j < 0 || j >= nCols_)
118 <<
"Index " << j <<
" is out of range 0 ... " << nCols_ - 1
130 if (i < 0 || i >= mRows_)
133 <<
"Index " << i <<
" is out of range 0 ... " << mRows_ - 1
136 else if (j < 0 || j >= nCols_)
139 <<
"Index " << j <<
" is out of range 0 ... " << nCols_ - 1
147 template<
class MatrixType>
154 if (mRows_ != Mb.m() || nCols_ != Mb.n())
157 <<
"Attempt to assign blocks of different sizes: " 158 << mRows_ <<
"x" << nCols_ <<
" != " 159 << Mb.m() <<
"x" << Mb.n()
163 for (label i = 0; i < mRows_; ++i)
165 for (label j = 0; j < nCols_; ++j)
167 (*this)(i, j) = Mb(i, j);
173 template<
class MatrixType>
176 const ConstMatrixBlock<MatrixType>& Mb
179 if (
reinterpret_cast<const ConstMatrixBlock<MatrixType>*
>(
this) != &Mb)
181 if (mRows_ != Mb.m() || nCols_ != Mb.n())
184 <<
"Attempt to assign blocks of different sizes: " 185 << mRows_ <<
"x" << nCols_ <<
" != " 186 << Mb.m() <<
"x" << Mb.n()
190 for (label i = 0; i < mRows_; ++i)
192 for (label j = 0; j < nCols_; ++j)
194 (*this)(i, j) = Mb(i, j);
201 template<
class MatrixType>
204 const MatrixBlock<MatrixType>& Mb
209 if (mRows_ != Mb.m() || nCols_ != Mb.n())
212 <<
"Attempt to assign blocks of different sizes: " 213 << mRows_ <<
"x" << nCols_ <<
" != " 214 << Mb.m() <<
"x" << Mb.n()
218 for (label i = 0; i < mRows_; ++i)
220 for (label j = 0; j < nCols_; ++j)
222 (*this)(i, j) = Mb(i, j);
229 template<
class MatrixType>
230 template<
class MatrixType2>
233 const ConstMatrixBlock<MatrixType2>& Mb
236 if (
reinterpret_cast<const ConstMatrixBlock<MatrixType2>*
>(
this) != &Mb)
238 if (mRows_ != Mb.m() || nCols_ != Mb.n())
241 <<
"Attempt to assign blocks of different sizes: " 242 << mRows_ <<
"x" << nCols_ <<
" != " 243 << Mb.m() <<
"x" << Mb.n()
247 for (label i = 0; i < mRows_; ++i)
249 for (label j = 0; j < nCols_; ++j)
251 (*this)(i, j) = Mb(i, j);
258 template<
class MatrixType>
259 template<
class MatrixType2>
262 const MatrixBlock<MatrixType2>& Mb
267 if (mRows_ != Mb.m() || nCols_ != Mb.n())
270 <<
"Attempt to assign blocks of different sizes: " 271 << mRows_ <<
"x" << nCols_ <<
" != " 272 << Mb.m() <<
"x" << Mb.n()
276 for (label i = 0; i < mRows_; ++i)
278 for (label j = 0; j < nCols_; ++j)
280 (*this)(i, j) = Mb(i, j);
287 template<
class MatrixType>
290 template<
class, Foam::direction, Foam::direction>
class MSBlock,
297 const MSBlock<SubTensor, BRowStart, BColStart>& Mb
300 if (mRows_ != Mb.mRows || nCols_ != Mb.nCols)
303 <<
"Attempt to assign blocks of different sizes: " 304 << mRows_ <<
"x" << nCols_ <<
" != " 305 << Mb.mRows <<
"x" << Mb.nCols
313 operator()(i, j) = Mb(i, j);
319 template<
class MatrixType>
322 template<
class, Foam::direction>
class VSBlock,
328 const VSBlock<SubVector, BStart>& Mb
331 if (mRows_ != Mb.nComponents || nCols_ != 1)
334 <<
"Attempt to assign blocks of different sizes: " 335 << mRows_ <<
"x" << nCols_ <<
" != " 336 << Mb.nComponents <<
"x" << 1
342 operator()(i, 0) = Mb[i];
347 template<
class MatrixType>
348 template<
class MSForm, Foam::direction Nrows, Foam::direction Ncols>
351 const MatrixSpace<MSForm, cmptType, Nrows, Ncols>& ms
354 if (mRows_ != Nrows || nCols_ != Ncols)
357 <<
"Attempt to assign blocks of different sizes: " 358 << mRows_ <<
"x" << nCols_ <<
" != " 359 << Nrows <<
"x" << Ncols
363 for (label i = 0; i < mRows_; ++i)
365 for (label j = 0; j < nCols_; ++j)
367 (*this)(i, j) = ms(i, j);
373 template<
class MatrixType>
374 template<
class VSForm, Foam::direction Ncmpts>
377 const VectorSpace<VSForm, cmptType, Ncmpts>& ms
380 if (mRows_ != Ncmpts || nCols_ != 1)
383 <<
"Attempt to assign blocks of different sizes: " 384 << mRows_ <<
"x" << nCols_ <<
" != " 385 << Ncmpts <<
"x" << 1
391 operator()(i, 0) = ms[i];
396 template<
class MatrixType>
399 if (mRows_ !=
f.size() || nCols_ != 1)
402 <<
"Error: cannot assign blocks of different size (left is " 403 << mRows_ <<
"x" << nCols_ <<
" != " 404 <<
f.size() <<
"x" << 1
410 operator()(i, 0) =
f[i];
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void checkIndex(const label i, const label j) const
Check if (i, j) is within range of row-column limits.
void operator=(const Matrix< Form, cmptType > &)
Assignment to a compatible matrix.
A templated block of an (m x n) matrix of type <MatrixType>.
#define forAll(list, i)
Loop across all elements in list.
Generic templated field type.
errorManip< error > abort(error &err)
A templated (m x n) matrix of objects of <T>. The layout is (mRows x nCols) - row-major order: ...
void checkIndex(const label i, const label j) const
Check if (i, j) is within range of row-column limits.