mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add longer method names for accessing Matrix num rows/cols (#1391)
- in addition to m() and n(), provide Matrix mRows()/nRows(), nCols() methods. These provide unambiguous access names. 'mRows()' == for internal consistency with MatrixSpace. 'nRows()' == a commonly used naming.
This commit is contained in:
committed by
Andrew Heather
parent
9a3daeca23
commit
3870b1d43c
@ -152,40 +152,38 @@ Foam::LUscalarMatrix::LUscalarMatrix
|
||||
|
||||
if (Pstream::master(comm_))
|
||||
{
|
||||
label mRows = m();
|
||||
label nColumns = n();
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "LUscalarMatrix : size:" << mRows << endl;
|
||||
for (label rowI = 0; rowI < mRows; rowI++)
|
||||
{
|
||||
const scalar* row = operator[](rowI);
|
||||
const label numRows = m();
|
||||
const label numCols = n();
|
||||
|
||||
Pout<< "cell:" << rowI << " diagCoeff:" << row[rowI] << endl;
|
||||
Pout<< "LUscalarMatrix : size:" << numRows << endl;
|
||||
for (label rowi = 0; rowi < numRows; ++rowi)
|
||||
{
|
||||
const scalar* row = operator[](rowi);
|
||||
|
||||
Pout<< "cell:" << rowi << " diagCoeff:" << row[rowi] << endl;
|
||||
|
||||
Pout<< " connects to upper cells :";
|
||||
for (label columnI = rowI+1; columnI < nColumns; columnI++)
|
||||
for (label coli = rowi+1; coli < numCols; ++coli)
|
||||
{
|
||||
if (mag(row[columnI]) > SMALL)
|
||||
if (mag(row[coli]) > SMALL)
|
||||
{
|
||||
Pout<< ' ' << columnI << " (coeff:" << row[columnI]
|
||||
<< ")";
|
||||
Pout<< ' ' << coli << " (coeff:" << row[coli] << ')';
|
||||
}
|
||||
}
|
||||
Pout<< endl;
|
||||
Pout<< " connects to lower cells :";
|
||||
for (label columnI = 0; columnI < rowI; columnI++)
|
||||
for (label coli = 0; coli < rowi; ++coli)
|
||||
{
|
||||
if (mag(row[columnI]) > SMALL)
|
||||
if (mag(row[coli]) > SMALL)
|
||||
{
|
||||
Pout<< ' ' << columnI << " (coeff:" << row[columnI]
|
||||
<< ")";
|
||||
Pout<< ' ' << coli << " (coeff:" << row[coli] << ')';
|
||||
}
|
||||
}
|
||||
Pout<< endl;
|
||||
Pout<< nl;
|
||||
}
|
||||
Pout<< endl;
|
||||
Pout<< nl;
|
||||
}
|
||||
|
||||
pivotIndices_.setSize(m());
|
||||
|
||||
@ -180,13 +180,13 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the number of rows
|
||||
//- The number of rows
|
||||
inline label m() const noexcept;
|
||||
|
||||
//- Return the number of columns
|
||||
//- The number of columns
|
||||
inline label n() const noexcept;
|
||||
|
||||
//- Return the number of elements in Matrix (m*n)
|
||||
//- The number of elements in Matrix (m*n)
|
||||
inline label size() const;
|
||||
|
||||
//- Return row/column sizes
|
||||
@ -483,6 +483,25 @@ public:
|
||||
|
||||
// Housekeeping
|
||||
|
||||
//- The number of rows - same as m()
|
||||
inline label mRows() const noexcept
|
||||
{
|
||||
return mRows_;
|
||||
}
|
||||
|
||||
//- The number of rows - same as m()
|
||||
inline label nRows() const noexcept
|
||||
{
|
||||
return mRows_;
|
||||
}
|
||||
|
||||
//- The number of columns - same as n()
|
||||
inline label nCols() const noexcept
|
||||
{
|
||||
return nCols_;
|
||||
}
|
||||
|
||||
|
||||
//- Deprecated(2019-04) raw data pointer, const access
|
||||
// \deprecated(2019-04) - use cdata() method
|
||||
const Type* FOAM_DEPRECATED_FOR(2019-04, "cdata() method") v() const
|
||||
|
||||
Reference in New Issue
Block a user