diff --git a/src/OpenFOAM/matrices/Matrix/Matrix.C b/src/OpenFOAM/matrices/Matrix/Matrix.C index 3937f9cb1e..d06cef41e6 100644 --- a/src/OpenFOAM/matrices/Matrix/Matrix.C +++ b/src/OpenFOAM/matrices/Matrix/Matrix.C @@ -30,14 +30,14 @@ License template void Foam::Matrix::allocate() { - if (n_ && m_) + if (nRows_ && nCols_) { - v_ = new Type*[n_]; - v_[0] = new Type[n_*m_]; + v_ = new Type*[nRows_]; + v_[0] = new Type[nRows_*nCols_]; - for (label i=1; i::~Matrix() template Foam::Matrix::Matrix(const label n, const label m) : - n_(n), - m_(m), + nRows_(n), + nCols_(m), v_(NULL) { - if (n_ < 0 || m_ < 0) + if (nRows_ < 0 || nCols_ < 0) { FatalErrorInFunction - << "bad n, m " << n_ << ", " << m_ + << "bad n, m " << nRows_ << ", " << nCols_ << abort(FatalError); } @@ -79,14 +79,14 @@ Foam::Matrix::Matrix(const label n, const label m) template Foam::Matrix::Matrix(const label n, const label m, const Type& a) : - n_(n), - m_(m), + nRows_(n), + nCols_(m), v_(NULL) { - if (n_ < 0 || m_ < 0) + if (nRows_ < 0 || nCols_ < 0) { FatalErrorInFunction - << "bad n, m " << n_ << ", " << m_ + << "bad n, m " << nRows_ << ", " << nCols_ << abort(FatalError); } @@ -96,7 +96,7 @@ Foam::Matrix::Matrix(const label n, const label m, const Type& a) { Type* v = v_[0]; - label nm = n_*m_; + label nm = nRows_*nCols_; for (label i=0; i::Matrix(const label n, const label m, const Type& a) template Foam::Matrix::Matrix(const Matrix& a) : - n_(a.n_), - m_(a.m_), + nRows_(a.nRows_), + nCols_(a.nCols_), v_(NULL) { if (a.v_) @@ -119,7 +119,7 @@ Foam::Matrix::Matrix(const Matrix& a) Type* v = v_[0]; const Type* av = a.v_[0]; - label nm = n_*m_; + label nm = nRows_*nCols_; for (label i=0; i::clear() delete[] (v_[0]); delete[] v_; } - n_ = 0; - m_ = 0; + nRows_ = 0; + nCols_ = 0; v_ = NULL; } @@ -147,11 +147,11 @@ void Foam::Matrix::transfer(Matrix& a) { clear(); - n_ = a.n_; - a.n_ = 0; + nRows_ = a.nRows_; + a.nRows_ = 0; - m_ = a.m_; - a.m_ = 0; + nCols_ = a.nCols_; + a.nCols_ = 0; v_ = a.v_; a.v_ = NULL; @@ -185,7 +185,7 @@ void Foam::Matrix::operator=(const Type& t) { Type* v = v_[0]; - label nm = n_*m_; + label nm = nRows_*nCols_; for (label i=0; i::operator=(const Matrix& a) << abort(FatalError); } - if (n_ != a.n_ || m_ != a.m_) + if (nRows_ != a.nRows_ || nCols_ != a.nCols_) { clear(); - n_ = a.n_; - m_ = a.m_; + nRows_ = a.nRows_; + nCols_ = a.nCols_; allocate(); } @@ -217,7 +217,7 @@ void Foam::Matrix::operator=(const Matrix& a) Type* v = v_[0]; const Type* av = a.v_[0]; - label nm = n_*m_; + label nm = nRows_*nCols_; for (label i=0; i inline Foam::Matrix::Matrix() : - n_(0), - m_(0), + nRows_(0), + nCols_(0), v_(NULL) {} @@ -55,37 +55,37 @@ inline const Foam::Matrix& Foam::Matrix::null() template inline Foam::label Foam::Matrix::n() const { - return n_; + return nRows_; } template inline Foam::label Foam::Matrix::m() const { - return m_; + return nCols_; } template inline Foam::label Foam::Matrix::size() const { - return n_*m_; + return nRows_*nCols_; } template inline void Foam::Matrix::checki(const label i) const { - if (!n_) + if (!nRows_) { FatalErrorInFunction << "attempt to access element from zero sized row" << abort(FatalError); } - else if (i<0 || i>=n_) + else if (i<0 || i>=nRows_) { FatalErrorInFunction - << "index " << i << " out of range 0 ... " << n_-1 + << "index " << i << " out of range 0 ... " << nRows_-1 << abort(FatalError); } } @@ -94,16 +94,16 @@ inline void Foam::Matrix::checki(const label i) const template inline void Foam::Matrix::checkj(const label j) const { - if (!m_) + if (!nCols_) { FatalErrorInFunction << "attempt to access element from zero sized column" << abort(FatalError); } - else if (j<0 || j>=m_) + else if (j<0 || j>=nCols_) { FatalErrorInFunction - << "index " << j << " out of range 0 ... " << m_-1 + << "index " << j << " out of range 0 ... " << nCols_-1 << abort(FatalError); } } diff --git a/src/OpenFOAM/matrices/Matrix/MatrixIO.C b/src/OpenFOAM/matrices/Matrix/MatrixIO.C index 8c52bdebc5..60df684937 100644 --- a/src/OpenFOAM/matrices/Matrix/MatrixIO.C +++ b/src/OpenFOAM/matrices/Matrix/MatrixIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,8 +34,8 @@ License template Foam::Matrix::Matrix(Istream& is) : - n_(0), - m_(0), + nRows_(0), + nCols_(0), v_(NULL) { operator>>(is, *this); @@ -59,10 +59,10 @@ Foam::Istream& Foam::operator>>(Istream& is, Matrix& M) if (firstToken.isLabel()) { - M.n_ = firstToken.labelToken(); - M.m_ = readLabel(is); + M.nRows_ = firstToken.labelToken(); + M.nCols_ = readLabel(is); - label nm = M.n_*M.m_; + label nm = M.nRows_*M.nCols_; // Read list contents depending on data format if (is.format() == IOstream::ASCII || !contiguous()) @@ -151,7 +151,7 @@ Foam::Istream& Foam::operator>>(Istream& is, Matrix& M) template Foam::Ostream& Foam::operator<<(Ostream& os, const Matrix& M) { - label nm = M.n_*M.m_; + label nm = M.nRows_*M.nCols_; os << M.n() << token::SPACE << M.m();