26 #include <type_traits> 30 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
35 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
45 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
46 template<
class Form2,
class Cmpt2>
56 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
59 template<
class, Foam::direction, Foam::direction>
class Block2,
65 const Block2<Form, BRowStart, BColStart>&
block 72 operator()(i, j) = block(i, j);
78 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
85 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
86 template<
class SubTensor, Foam::direction BRowStart, Foam::direction BColStart>
96 "Rows in block > rows in matrix" 101 "Columns in block > columns in matrix" 106 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
107 template<
class SubTensor, Foam::direction BRowStart, Foam::direction BColStart>
117 "Rows in block > rows in matrix" 122 "Columns in block > columns in matrix" 129 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
130 template<Foam::direction Row, Foam::direction Col>
133 static_assert(Row < Mrows && Col < Ncols,
"Address outside matrix");
134 return this->
v_[Row*Ncols + Col];
138 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
139 template<Foam::direction Row, Foam::direction Col>
142 static_assert(Row < Mrows && Col < Ncols,
"Address outside matrix");
143 return this->
v_[Row*Ncols + Col];
147 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
154 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
161 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
168 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
175 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
182 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
189 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
196 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
203 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
210 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
217 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
224 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
231 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
238 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
245 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
252 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
259 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
265 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
271 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
275 static_assert(Mrows == Ncols,
"Matrix is not square");
287 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
305 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
313 ConstBlock<SubTensor, BRowStart, BColStart>
320 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
329 Block<SubTensor, BRowStart, BColStart>
338 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
346 if (i > Mrows-1 || j > Ncols-1)
349 <<
"indices out of range" 354 return this->
v_[i*Ncols + j];
358 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
366 if (i > Mrows-1 || j > Ncols-1)
369 <<
"indices out of range" 374 return this->
v_[i*Ncols + j];
378 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
379 template<
class SubTensor, Foam::direction BRowStart, Foam::direction BColStart>
389 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
390 template<
class SubTensor, Foam::direction BRowStart, Foam::direction BColStart>
396 return matrix_(BRowStart + i, BColStart + j);
400 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
401 template<
class SubTensor, Foam::direction BRowStart, Foam::direction BColStart>
409 for (
direction i=0; i<SubTensor::mRows; ++i)
411 for (
direction j=0; j<SubTensor::nCols; ++j)
413 st[i*SubTensor::nCols + j] =
operator()(i, j);
421 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
422 template<
class SubTensor, Foam::direction BRowStart, Foam::direction BColStart>
428 return matrix_(BRowStart + i, BColStart + j);
432 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
433 template<
class SubTensor, Foam::direction BRowStart, Foam::direction BColStart>
439 return matrix_(BRowStart + i, BColStart + j);
443 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
444 inline void Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::operator=
453 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
454 template<
class Form2>
455 inline void Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::operator&=
460 *
this = *
this & matrix;
464 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
467 template<
class, Foam::direction, Foam::direction>
class Block2,
471 inline void Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::operator=
473 const Block2<Form, BRowStart, BColStart>&
block 486 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
487 template<
class SubTensor, Foam::direction BRowStart, Foam::direction BColStart>
488 template<
class Form2>
491 Block<SubTensor, BRowStart, BColStart>
:: 507 template<
class Form,
class Cmpt, Foam::direction Mrows, Foam::direction Ncols>
508 template<
class SubTensor, Foam::direction BRowStart, Foam::direction BColStart>
509 template<
class VSForm>
518 static_assert(
nCols == 1,
"Matrix must have a single column");
520 for (
direction i=0; i<SubTensor::mRows; ++i)
534 template<
class Form,
class Cmpt, direction Mrows, direction Ncols>
544 template<
class Form,
class Cmpt, direction Ncmpts>
582 "Number of columns in matrix 1 != number of rows in matrix 2" 593 result(i, j) += matrix1(i,
k)*matrix2(
k, j);
602 template<
class Form,
class VSForm,
class Cmpt, direction Mrows, direction Ncols>
615 result[i] += matrix(i, j)*v[j];
643 result(i, j) = v1[i]*v2[j];
Abstract template class to provide the form resulting from.
static const direction nCols
Abstract template class to provide the form resulting from.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const Cmpt & operator()(const direction &i, const direction &j) const
(i, j) const element access operator
static const direction nCols
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
label k
Boltzmann constant.
typeOfTranspose< Cmpt, Form >::type T() const
Return the transpose of the matrix.
static const direction mRows
MatrixSpace()
Construct null.
static const direction mRows
const Cmpt & elmt() const
Fast const element access using compile-time addressing.
void operator=(const Foam::zero)
static const direction mRows
static const direction nCols
errorManip< error > abort(error &err)
Abstract template class to provide the transpose form of a form.
ConstBlock< SubTensor, BRowStart, BColStart > block() const
Return a const sub-block corresponding to the specified type.
Creates a single block of cells from point coordinates, numbers of cells in each direction and an exp...
friend Ostream & operator(Ostream &, const VectorSpace< Form, Cmpt, Ncmpts > &)
SubTensor operator()() const
Construct and return the sub-tensor corresponding to this block.
A class representing the concept of 0 used to avoid unnecessary manipulations for objects that are kn...
static msType identity()
Return the identity matrix for square matrix spaces.
Cmpt v_[Ncmpts]
The components of this vector space.