Skip to content

Commit

Permalink
[Kinetics] Deprecate obsolete methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
ischoegl authored and speth committed May 30, 2022
1 parent aef1843 commit c9d7371
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 17 deletions.
8 changes: 6 additions & 2 deletions include/cantera/kinetics/ChebyshevRate.h
Expand Up @@ -124,11 +124,15 @@ class ChebyshevRate final : public ReactionRate
* @param units Unit definitions specific to rate information
*/
void setParameters(const AnyMap& node, const UnitStack& units);

void getParameters(AnyMap& rateNode) const;

//! @deprecated To be removed after Cantera 3.0.
void getParameters(AnyMap& rateNode, const Units& rate_units) const {
// @todo: deprecate, as second argument is no longer needed
warn_deprecated("ChebyshevRate:getParameters",
"To be removed after Cantera 3.0. Second argument is no longer needed.");
return getParameters(rateNode);
}
void getParameters(AnyMap& rateNode) const;

virtual void validate(const std::string& equation, const Kinetics& kin);

Expand Down
19 changes: 12 additions & 7 deletions include/cantera/kinetics/Falloff.h
Expand Up @@ -98,7 +98,7 @@ class FalloffRate : public ReactionRate
* @param c Vector of coefficients of the parameterization. The number and
* meaning of these coefficients is subclass-dependent.
*
* @todo deprecate; superseded by setFalloffCoeffs
* @deprecated To be removed after Cantera 3.0; superseded by setFalloffCoeffs()
*/
void init(const vector_fp& c);

Expand Down Expand Up @@ -161,9 +161,11 @@ class FalloffRate : public ReactionRate

//! The size of the work array required.
/**
* @todo deprecate; only used by legacy framework
* @deprecated To be removed after Cantera 3.0; unused.
*/
virtual size_t workSize() const {
warn_deprecated("FalloffRate::workSize",
"To be removed after Cantera 3.0; unused.");
return 0;
}

Expand All @@ -182,9 +184,12 @@ class FalloffRate : public ReactionRate
//! Get the values of the parameters for this object. *params* must be an
//! array of at least nParameters() elements.
/**
* @todo deprecate; superseded by getFalloffCoeffs
* @deprecated To be removed after Cantera 3.0; superseded by getFalloffCoeffs()
*/
virtual void getParameters(double* params) const {}
virtual void getParameters(double* params) const {
warn_deprecated("FalloffRate::getParameters",
"To be removed after Cantera 3.0; superseded by getFalloffCoeffs.");
}

virtual void getParameters(AnyMap& node) const;

Expand Down Expand Up @@ -392,7 +397,7 @@ class TroeRate final : public FalloffRate

//! Sets params to contain, in order, \f[ (A, T_3, T_1, T_2) \f]
/**
* @todo deprecate; superseded by getFalloffCoeffs
* @deprecated To be removed after Cantera 3.0; superseded by getFalloffCoeffs()
*/
virtual void getParameters(double* params) const;

Expand Down Expand Up @@ -495,7 +500,7 @@ class SriRate final : public FalloffRate

//! Sets params to contain, in order, \f[ (a, b, c, d, e) \f]
/**
* @todo deprecate; superseded by getFalloffCoeffs
* @deprecated To be removed after Cantera 3.0; superseded by getFalloffCoeffs()
*/
virtual void getParameters(double* params) const;

Expand Down Expand Up @@ -604,7 +609,7 @@ class TsangRate final : public FalloffRate

//! Sets params to contain, in order, \f[ (A, B) \f]
/**
* @todo deprecate; superseded by getFalloffCoeffs
* @deprecated To be removed after Cantera 3.0; superseded by getFalloffCoeffs()
*/
virtual void getParameters(double* params) const;

Expand Down
35 changes: 27 additions & 8 deletions src/kinetics/Falloff.cpp
Expand Up @@ -84,6 +84,8 @@ void FalloffData::restore()

void FalloffRate::init(const vector_fp& c)
{
warn_deprecated("FalloffRate::init",
"To be removed after Cantera 3.0; superseded by setFalloffCoeffs.");
setFalloffCoeffs(c);
}

Expand Down Expand Up @@ -244,11 +246,15 @@ void TroeRate::setFalloffCoeffs(const vector_fp& c)

void TroeRate::getFalloffCoeffs(vector_fp& c) const
{
c.resize(4, 0.);
getParameters(c.data());
if (std::abs(c[3]) < SmallNumber) {
if (std::abs(m_t2) < SmallNumber) {
c.resize(3);
} else {
c.resize(4, 0.);
c[3] = m_t2;
}
c[0] = m_a;
c[1] = 1.0 / m_rt3;
c[2] = 1.0 / m_rt1;
}

void TroeRate::updateTemp(double T, double* work) const
Expand Down Expand Up @@ -293,6 +299,8 @@ void TroeRate::setParameters(const AnyMap& node, const UnitStack& rate_units)
}

void TroeRate::getParameters(double* params) const {
warn_deprecated("TroeRate::getParameters",
"To be removed after Cantera 3.0; superseded by getFalloffCoeffs.");
params[0] = m_a;
params[1] = 1.0/m_rt3;
params[2] = 1.0/m_rt1;
Expand Down Expand Up @@ -356,11 +364,16 @@ void SriRate::setFalloffCoeffs(const vector_fp& c)

void SriRate::getFalloffCoeffs(vector_fp& c) const
{
c.resize(5, 0.);
getParameters(c.data());
if (m_e < SmallNumber && std::abs(m_e - 1.) < SmallNumber) {
c.resize(3);
} else {
c.resize(5, 0.);
c[3] = m_d;
c[4] = m_e;
}
c[0] = m_a;
c[1] = m_b;
c[2] = m_c;
}

void SriRate::updateTemp(double T, double* work) const
Expand Down Expand Up @@ -406,6 +419,8 @@ void SriRate::setParameters(const AnyMap& node, const UnitStack& rate_units)

void SriRate::getParameters(double* params) const
{
warn_deprecated("SriRate::getParameters",
"To be removed after Cantera 3.0; superseded by getFalloffCoeffs.");
params[0] = m_a;
params[1] = m_b;
params[2] = m_c;
Expand Down Expand Up @@ -460,11 +475,13 @@ void TsangRate::setFalloffCoeffs(const vector_fp& c)

void TsangRate::getFalloffCoeffs(vector_fp& c) const
{
c.resize(2, 0.);
getParameters(c.data());
if (m_b < SmallNumber) {
if (std::abs(m_b) < SmallNumber) {
c.resize(1);
} else {
c.resize(2, 0.);
c[1] = m_b;
}
c[0] = m_a;
}

void TsangRate::updateTemp(double T, double* work) const
Expand Down Expand Up @@ -502,6 +519,8 @@ void TsangRate::setParameters(const AnyMap& node, const UnitStack& rate_units)
}

void TsangRate::getParameters(double* params) const {
warn_deprecated("TsangRate::getParameters",
"To be removed after Cantera 3.0; superseded by getFalloffCoeffs.");
params[0] = m_a;
params[1] = m_b;
}
Expand Down

0 comments on commit c9d7371

Please sign in to comment.