Go to the documentation of this file.
29 #define CHECK_MATRIX_IS_SQUARE(a, b) \
32 FatalErrorInFunction \
33 << "Attempt to create a non-square matrix (" \
34 << a << ", " << b << ')' << nl << abort(FatalError); \
77 template<
class AnyType>
86 for (
label i=0; i <
n; ++i)
94 template<
class AnyType>
105 for (
label i = 0; i < dims.first(); ++i)
165 template<
class MatrixType>
178 template<
class MatrixType>
258 for (
label n = 0;
n < this->
n() - 1; ++
n)
260 for (
label m = this->m() - 1;
n < m; --m)
262 if (SMALL <
mag((*
this)(
n, m) - (*
this)(m,
n)))
275 for (
label i = 0; i < this->m(); ++i)
277 for (
label j = 0; j < this->
n(); ++j)
279 const Type&
val = (*this)(i, j);
281 if ((i == j) || (i - 1 == j) || (i + 1 == j))
288 else if (SMALL <
mag(
val))
330 for (
label i = 0; i < f1f2T.m(); ++i)
332 for (
label j = 0; j < f1f2T.n(); ++j)
334 f1f2T(i, j) = f1[i]*f2[j];
349 #undef CHECK_MATRIX_IS_SQUARE
Foam::SquareMatrix< Type > symmOuter(const Field< Type > &f1, const Field< Type > &f2)
const T & second() const noexcept
Return second element, which is also the last element.
label ListType::const_reference val
SquareMatrix()
Construct null.
autoPtr< SquareMatrix< Type > > clone() const
Clone.
static constexpr const zero Zero
Global zero.
void operator=(const zero)
Assign all elements to zero.
ConstMatrixBlock< mType > const label n
void resize(const label m)
Resize the matrix preserving the elements.
A templated (m x n) matrix of objects of <T>. The layout is (mRows x nCols) - row-major order:
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
patchWriters resize(patchIds.size())
Generic templated field type.
Templated identity and dual space identity tensors derived from SphericalTensor.
A templated block of an (m x n) matrix of type <MatrixType>.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
bool symmetric() const
Return true if the square matrix is effectively symmetric/Hermitian.
A templated 2D rectangular m x n matrix of objects of <Type>.
bool tridiagonal() const
Return true if the square matrix is reduced tridiagonal.
errorManip< error > abort(error &err)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A templated 2D square matrix of objects of <T>, where the n x n matrix dimension is known and used fo...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label m() const noexcept
The number of rows.
An ordered pair of two objects of type <T> with first() and second() elements.
Traits class for primitives.
#define CHECK_MATRIX_IS_SQUARE(a, b)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void setSize(const label m)
Resize the matrix preserving the elements.
void shallowResize(const label m)
Resize the matrix without reallocating storage (unsafe)
A class representing the concept of 0 (zero), which can be used to avoid manipulating objects that ar...