diff --git a/src/OpenFOAM/matrices/LUscalarMatrix/LUscalarMatrix.C b/src/OpenFOAM/matrices/LUscalarMatrix/LUscalarMatrix.C index f425accf72..3e8fc3fe0f 100644 --- a/src/OpenFOAM/matrices/LUscalarMatrix/LUscalarMatrix.C +++ b/src/OpenFOAM/matrices/LUscalarMatrix/LUscalarMatrix.C @@ -101,7 +101,7 @@ Foam::LUscalarMatrix::LUscalarMatrix nCells += lduMatrices[i].size(); } - scalarSquareMatrix m(nCells, 0.0); + scalarSquareMatrix m(nCells, nCells, 0.0); transfer(m); convert(lduMatrices); } @@ -109,7 +109,7 @@ Foam::LUscalarMatrix::LUscalarMatrix else { label nCells = ldum.lduAddr().size(); - scalarSquareMatrix m(nCells, 0.0); + scalarSquareMatrix m(nCells, nCells, 0.0); transfer(m); convert(ldum, interfaceCoeffs, interfaces); } diff --git a/src/OpenFOAM/matrices/SquareMatrix/SquareMatrix.H b/src/OpenFOAM/matrices/SquareMatrix/SquareMatrix.H index 6239781d85..27160dc239 100644 --- a/src/OpenFOAM/matrices/SquareMatrix/SquareMatrix.H +++ b/src/OpenFOAM/matrices/SquareMatrix/SquareMatrix.H @@ -69,9 +69,10 @@ public: // It checks that m == n. inline SquareMatrix(const label m, const label n); - //- Construct with given number of rows/columns + //- Construct with given number of rows and rows // and value for all elements. - inline SquareMatrix(const label n, const Type&); + // It checks that m == n. + inline SquareMatrix(const label m, const label n, const Type&); //- Construct from Istream. inline SquareMatrix(Istream&); diff --git a/src/OpenFOAM/matrices/SquareMatrix/SquareMatrixI.H b/src/OpenFOAM/matrices/SquareMatrix/SquareMatrixI.H index a7371a6a2e..d3ee1cd6bf 100644 --- a/src/OpenFOAM/matrices/SquareMatrix/SquareMatrixI.H +++ b/src/OpenFOAM/matrices/SquareMatrix/SquareMatrixI.H @@ -53,10 +53,24 @@ inline Foam::SquareMatrix::SquareMatrix(const label m, const label n) } template -inline Foam::SquareMatrix::SquareMatrix(const label n, const Type& t) +inline Foam::SquareMatrix::SquareMatrix +( + const label m, + const label n, + const Type& t +) : - Matrix, Type>(n, t) -{} + Matrix, Type>(m, n, t) +{ + if (m != n) + { + FatalErrorIn + ( + "SquareMatrix::SquareMatrix" + "(const label m, const label n, const Type&)" + ) << "m != n for constructing a square matrix" << exit(FatalError); + } +} template inline Foam::SquareMatrix::SquareMatrix(Istream& is)