[Numerics] move 'm_factored' up to GeneralMatrix
This commit is contained in:
parent
4467b898a5
commit
90c2d58973
7 changed files with 18 additions and 52 deletions
|
|
@ -237,9 +237,6 @@ public:
|
|||
|
||||
virtual GeneralMatrix* duplMyselfAsGeneralMatrix() const;
|
||||
|
||||
//! Report whether the current matrix has been factored.
|
||||
virtual bool factored() const;
|
||||
|
||||
//! Return a pointer to the top of column j, column values are assumed to be contiguous in memory
|
||||
/*!
|
||||
* The LAPACK bandstructure has column values which are contiguous in memory:
|
||||
|
|
@ -280,9 +277,6 @@ public:
|
|||
*/
|
||||
virtual void copyData(const GeneralMatrix& y);
|
||||
|
||||
//! Clear the factored flag
|
||||
virtual void clearFactorFlag();
|
||||
|
||||
//! Check to see if we have any zero rows in the jacobian
|
||||
/*!
|
||||
* This utility routine checks to see if any rows are zero.
|
||||
|
|
@ -313,9 +307,6 @@ protected:
|
|||
//! Factorized data
|
||||
vector_fp ludata;
|
||||
|
||||
//! Boolean indicating whether the matrix is factored
|
||||
bool m_factored;
|
||||
|
||||
//! Number of rows and columns of the matrix
|
||||
size_t m_n;
|
||||
|
||||
|
|
|
|||
|
|
@ -130,7 +130,9 @@ public:
|
|||
virtual size_t nRowsAndStruct(size_t* const iStruct = 0) const = 0;
|
||||
|
||||
//! clear the factored flag
|
||||
virtual void clearFactorFlag() = 0;
|
||||
virtual void clearFactorFlag() {
|
||||
m_factored = 0;
|
||||
};
|
||||
|
||||
//! Solves the Ax = b system returning x in the b spot.
|
||||
/*!
|
||||
|
|
@ -142,7 +144,9 @@ public:
|
|||
virtual int solve(doublereal* b, size_t nrhs=1, size_t ldb=0) = 0;
|
||||
|
||||
//! true if the current factorization is up to date with the matrix
|
||||
virtual bool factored() const = 0;
|
||||
virtual bool factored() const {
|
||||
return (m_factored != 0);
|
||||
}
|
||||
|
||||
//! Return a pointer to the top of column j, columns are assumed to be contiguous in memory
|
||||
/*!
|
||||
|
|
@ -228,6 +232,11 @@ public:
|
|||
*/
|
||||
int matrixType_;
|
||||
|
||||
protected:
|
||||
//! Indicates whether the matrix is factored. 0 for unfactored; Non-zero values
|
||||
//! indicate a particular factorization (LU=1, QR=2).
|
||||
int m_factored;
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -69,12 +69,9 @@ public:
|
|||
*/
|
||||
int solveQR(doublereal* b);
|
||||
|
||||
virtual void clearFactorFlag();
|
||||
|
||||
//! set the factored flag
|
||||
void setFactorFlag();
|
||||
|
||||
virtual bool factored() const;
|
||||
virtual void useFactorAlgorithm(int fAlgorithm);
|
||||
|
||||
//! Returns the factor algorithm used
|
||||
|
|
@ -121,11 +118,6 @@ public:
|
|||
virtual size_t checkRows(doublereal& valueSmall) const;
|
||||
virtual size_t checkColumns(doublereal& valueSmall) const;
|
||||
|
||||
protected:
|
||||
//! the factor flag
|
||||
int m_factored;
|
||||
|
||||
public:
|
||||
//! Work vector for QR algorithm
|
||||
vector_fp tau;
|
||||
|
||||
|
|
|
|||
|
|
@ -1481,7 +1481,7 @@ void BEulerInt::doNewtonSolve(double time_curr, double* y_curr,
|
|||
RRow[0] = delta_y[focusRow];
|
||||
RRow[1] = delta_y[focusRow+1];
|
||||
double Pcutoff = 1.0E-70;
|
||||
if (!jac.m_factored) {
|
||||
if (!jac.factored()) {
|
||||
jacBack = jac;
|
||||
} else {
|
||||
freshJac = false;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ namespace Cantera
|
|||
|
||||
BandMatrix::BandMatrix() :
|
||||
GeneralMatrix(1),
|
||||
m_factored(false),
|
||||
m_n(0),
|
||||
m_kl(0),
|
||||
m_ku(0),
|
||||
|
|
@ -35,7 +34,6 @@ BandMatrix::BandMatrix() :
|
|||
|
||||
BandMatrix::BandMatrix(size_t n, size_t kl, size_t ku, doublereal v) :
|
||||
GeneralMatrix(1),
|
||||
m_factored(false),
|
||||
m_n(n),
|
||||
m_kl(kl),
|
||||
m_ku(ku),
|
||||
|
|
@ -54,8 +52,7 @@ BandMatrix::BandMatrix(size_t n, size_t kl, size_t ku, doublereal v) :
|
|||
}
|
||||
|
||||
BandMatrix::BandMatrix(const BandMatrix& y) :
|
||||
GeneralMatrix(1),
|
||||
m_factored(false),
|
||||
GeneralMatrix(y),
|
||||
m_n(0),
|
||||
m_kl(0),
|
||||
m_ku(0),
|
||||
|
|
@ -66,7 +63,6 @@ BandMatrix::BandMatrix(const BandMatrix& y) :
|
|||
m_ku = y.m_ku;
|
||||
data = y.data;
|
||||
ludata = y.ludata;
|
||||
m_factored = y.m_factored;
|
||||
m_ipiv = y.m_ipiv;
|
||||
m_colPtrs.resize(m_n);
|
||||
size_t ldab = (2 *m_kl + m_ku + 1);
|
||||
|
|
@ -87,7 +83,6 @@ BandMatrix& BandMatrix::operator=(const BandMatrix& y)
|
|||
m_ipiv = y.m_ipiv;
|
||||
data = y.data;
|
||||
ludata = y.ludata;
|
||||
m_factored = y.m_factored;
|
||||
m_colPtrs.resize(m_n);
|
||||
size_t ldab = (2 * m_kl + m_ku + 1);
|
||||
for (size_t j = 0; j < m_n; j++) {
|
||||
|
|
@ -439,11 +434,6 @@ GeneralMatrix* BandMatrix::duplMyselfAsGeneralMatrix() const
|
|||
return new BandMatrix(*this);
|
||||
}
|
||||
|
||||
bool BandMatrix::factored() const
|
||||
{
|
||||
return m_factored;
|
||||
}
|
||||
|
||||
doublereal* BandMatrix::ptrColumn(size_t j)
|
||||
{
|
||||
return m_colPtrs[j];
|
||||
|
|
@ -462,9 +452,4 @@ void BandMatrix::copyData(const GeneralMatrix& y)
|
|||
(void) memcpy(DATA_PTR(data), yyPtr->ptrColumn(0), n);
|
||||
}
|
||||
|
||||
void BandMatrix::clearFactorFlag()
|
||||
{
|
||||
m_factored = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,12 +16,14 @@ namespace Cantera
|
|||
{
|
||||
|
||||
GeneralMatrix::GeneralMatrix(int matType) :
|
||||
matrixType_(matType)
|
||||
matrixType_(matType),
|
||||
m_factored(0)
|
||||
{
|
||||
}
|
||||
|
||||
GeneralMatrix::GeneralMatrix(const GeneralMatrix& y) :
|
||||
matrixType_(y.matrixType_)
|
||||
matrixType_(y.matrixType_),
|
||||
m_factored(y.m_factored)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -31,6 +33,7 @@ GeneralMatrix& GeneralMatrix::operator=(const GeneralMatrix& y)
|
|||
return *this;
|
||||
}
|
||||
matrixType_ = y.matrixType_;
|
||||
m_factored = y.m_factored;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ namespace Cantera
|
|||
SquareMatrix::SquareMatrix() :
|
||||
DenseMatrix(),
|
||||
GeneralMatrix(0),
|
||||
m_factored(0),
|
||||
a1norm_(0.0),
|
||||
useQR_(0)
|
||||
{
|
||||
|
|
@ -31,7 +30,6 @@ SquareMatrix::SquareMatrix() :
|
|||
SquareMatrix::SquareMatrix(size_t n, doublereal v) :
|
||||
DenseMatrix(n, n, v),
|
||||
GeneralMatrix(0),
|
||||
m_factored(0),
|
||||
a1norm_(0.0),
|
||||
useQR_(0)
|
||||
|
||||
|
|
@ -41,7 +39,6 @@ SquareMatrix::SquareMatrix(size_t n, doublereal v) :
|
|||
SquareMatrix::SquareMatrix(const SquareMatrix& y) :
|
||||
DenseMatrix(y),
|
||||
GeneralMatrix(0),
|
||||
m_factored(y.m_factored),
|
||||
a1norm_(y.a1norm_),
|
||||
useQR_(y.useQR_)
|
||||
{
|
||||
|
|
@ -54,7 +51,6 @@ SquareMatrix& SquareMatrix::operator=(const SquareMatrix& y)
|
|||
}
|
||||
DenseMatrix::operator=(y);
|
||||
GeneralMatrix::operator=(y);
|
||||
m_factored = y.m_factored;
|
||||
a1norm_ = y.a1norm_;
|
||||
useQR_ = y.useQR_;
|
||||
return *this;
|
||||
|
|
@ -150,11 +146,6 @@ int SquareMatrix::factor()
|
|||
return info;
|
||||
}
|
||||
|
||||
void SquareMatrix::clearFactorFlag()
|
||||
{
|
||||
m_factored = 0;
|
||||
}
|
||||
|
||||
void SquareMatrix::setFactorFlag()
|
||||
{
|
||||
m_factored = 1;
|
||||
|
|
@ -315,11 +306,6 @@ int SquareMatrix::factorAlgorithm() const
|
|||
return (int) useQR_;
|
||||
}
|
||||
|
||||
bool SquareMatrix::factored() const
|
||||
{
|
||||
return (m_factored != 0);
|
||||
}
|
||||
|
||||
doublereal* SquareMatrix::ptrColumn(size_t j)
|
||||
{
|
||||
return Array2D::ptrColumn(j);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue