/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . \*---------------------------------------------------------------------------*/ // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template inline Foam::RectangularMatrix::RectangularMatrix ( const label m, const label n ) : Matrix, Type>(m, n) {} template inline Foam::RectangularMatrix::RectangularMatrix ( const label n ) : Matrix, Type>(n, n) {} template inline Foam::RectangularMatrix::RectangularMatrix ( const label m, const label n, const zero ) : Matrix, Type>(m, n, Zero) {} template inline Foam::RectangularMatrix::RectangularMatrix ( const label m, const label n, const Type& val ) : Matrix, Type>(m, n, val) {} template template inline Foam::RectangularMatrix::RectangularMatrix ( const labelPair& dims, const Identity ) : Matrix, Type>(dims.first(), dims.second(), Zero) { for (label i = 0; i < min(dims.first(), dims.second()); ++i) { this->operator()(i, i) = pTraits::one; } } template inline Foam::RectangularMatrix::RectangularMatrix ( const labelPair& dims ) : RectangularMatrix(dims.first(), dims.second()) {} template inline Foam::RectangularMatrix::RectangularMatrix ( const labelPair& dims, const zero ) : RectangularMatrix(dims.first(), dims.second(), Zero) {} template inline Foam::RectangularMatrix::RectangularMatrix ( const labelPair& dims, const Type& val ) : RectangularMatrix(dims.first(), dims.second(), val) {} template template inline Foam::RectangularMatrix::RectangularMatrix ( const ConstMatrixBlock& mat ) : Matrix, Type>(mat) {} template template inline Foam::RectangularMatrix::RectangularMatrix ( const MatrixBlock& mat ) : Matrix, Type>(mat) {} template inline Foam::RectangularMatrix::RectangularMatrix ( const SquareMatrix& mat ) : Matrix, Type>(mat) {} template inline Foam::RectangularMatrix::RectangularMatrix(Istream& is) : Matrix, Type>(is) {} template inline Foam::autoPtr> Foam::RectangularMatrix::clone() const { return autoPtr>::New(*this); } // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // template inline void Foam::RectangularMatrix::operator=(const zero) { Matrix, Type>::operator=(Zero); } template inline void Foam::RectangularMatrix::operator=(const Type& val) { Matrix, Type>::operator=(val); } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // template class typeOfInnerProduct, RectangularMatrix> { public: typedef RectangularMatrix type; }; template class typeOfInnerProduct, SquareMatrix> { public: typedef RectangularMatrix type; }; template class typeOfInnerProduct, RectangularMatrix> { public: typedef RectangularMatrix type; }; // * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * // // Return the outer product of Field-Field as RectangularMatrix template inline Foam::RectangularMatrix outer ( const Field& f1, const Field& f2 ) { RectangularMatrix f1f2T(f1.size(), f2.size()); for (label i = 0; i < f1f2T.m(); ++i) { for (label j = 0; j < f1f2T.n(); ++j) { f1f2T(i, j) = f1[i]*f2[j]; } } return f1f2T; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam // ************************************************************************* //