From 8c95ee035ef344ba51ad8236b445641b1b569f91 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Mon, 24 Jun 2013 15:22:08 +0000 Subject: [PATCH] Deprecate the setParameters and getParameters methods of ThermoPhase --- include/cantera/thermo/ConstDensityThermo.h | 4 ++++ include/cantera/thermo/DebyeHuckel.h | 2 ++ include/cantera/thermo/FixedChemPotSSTP.h | 2 ++ include/cantera/thermo/HMWSoln.h | 2 ++ include/cantera/thermo/IdealMolalSoln.h | 3 ++- include/cantera/thermo/LatticePhase.h | 2 ++ include/cantera/thermo/MetalSHEelectrons.h | 2 ++ include/cantera/thermo/MineralEQ3.h | 2 ++ include/cantera/thermo/SingleSpeciesTP.h | 11 ++++++++--- include/cantera/thermo/StoichSubstance.h | 2 ++ include/cantera/thermo/StoichSubstanceSSTP.h | 3 +++ include/cantera/thermo/SurfPhase.h | 1 + include/cantera/thermo/ThermoPhase.h | 10 ++++++++-- src/thermo/DebyeHuckel.cpp | 2 ++ src/thermo/FixedChemPotSSTP.cpp | 2 ++ src/thermo/HMWSoln.cpp | 2 ++ src/thermo/IdealMolalSoln.cpp | 2 ++ src/thermo/LatticePhase.cpp | 2 ++ src/thermo/MetalSHEelectrons.cpp | 2 ++ src/thermo/MineralEQ3.cpp | 2 ++ src/thermo/StoichSubstance.cpp | 2 ++ src/thermo/StoichSubstanceSSTP.cpp | 3 +++ src/thermo/SurfPhase.cpp | 16 ++++++++-------- 23 files changed, 67 insertions(+), 14 deletions(-) diff --git a/include/cantera/thermo/ConstDensityThermo.h b/include/cantera/thermo/ConstDensityThermo.h index b6971c60d..52b5a8b6e 100644 --- a/include/cantera/thermo/ConstDensityThermo.h +++ b/include/cantera/thermo/ConstDensityThermo.h @@ -289,8 +289,10 @@ public: * * @param n number of parameters * @param c array of \a n coefficients + * @deprecated Use setDensity() */ virtual void setParameters(int n, doublereal* const c) { + warn_deprecated("ConstDensityThermo::setParamters"); setDensity(c[0]); } @@ -301,8 +303,10 @@ public: * * @param n number of parameters * @param c array of \a n coefficients + * @deprecated Use density() */ virtual void getParameters(int& n, doublereal* const c) const { + warn_deprecated("ConstDensityThermo::getParameters"); double d = density(); c[0] = d; n = 1; diff --git a/include/cantera/thermo/DebyeHuckel.h b/include/cantera/thermo/DebyeHuckel.h index f9f270b00..b4df8f7a4 100644 --- a/include/cantera/thermo/DebyeHuckel.h +++ b/include/cantera/thermo/DebyeHuckel.h @@ -1074,6 +1074,7 @@ public: * * @param n number of parameters * @param c array of \a n coefficients + * @deprecated Unimplemented */ virtual void setParameters(int n, doublereal* const c); @@ -1084,6 +1085,7 @@ public: * * @param n number of parameters * @param c array of \a n coefficients + * @deprecated Unimplemented */ virtual void getParameters(int& n, doublereal* const c) const; diff --git a/include/cantera/thermo/FixedChemPotSSTP.h b/include/cantera/thermo/FixedChemPotSSTP.h index 1dcca7ff2..1e87ce3c8 100644 --- a/include/cantera/thermo/FixedChemPotSSTP.h +++ b/include/cantera/thermo/FixedChemPotSSTP.h @@ -543,6 +543,7 @@ public: * @param n number of parameters = 1 * @param c array of \a n coefficients * c[0] = density of phase [ kg/m3 ] + * @deprecated Use setChemicalPotential() */ virtual void setParameters(int n, doublereal* const c); @@ -556,6 +557,7 @@ public: * For this phase: * - n = 1 * - c[0] = density of phase [ kg/m3 ] + * @deprecated Use getChemPotentials() */ virtual void getParameters(int& n, doublereal* const c) const; diff --git a/include/cantera/thermo/HMWSoln.h b/include/cantera/thermo/HMWSoln.h index 7cab3bf46..56acc7893 100644 --- a/include/cantera/thermo/HMWSoln.h +++ b/include/cantera/thermo/HMWSoln.h @@ -1904,6 +1904,7 @@ public: * * @param n number of parameters * @param c array of \a n coefficients + * @deprecated Unimplemented */ virtual void setParameters(int n, doublereal* const c); @@ -1914,6 +1915,7 @@ public: * * @param n number of parameters * @param c array of \a n coefficients + * @deprecated Unimplemented */ virtual void getParameters(int& n, doublereal* const c) const; diff --git a/include/cantera/thermo/IdealMolalSoln.h b/include/cantera/thermo/IdealMolalSoln.h index 977beedc0..f04ad7f1e 100644 --- a/include/cantera/thermo/IdealMolalSoln.h +++ b/include/cantera/thermo/IdealMolalSoln.h @@ -609,7 +609,7 @@ public: * these depends on the subclass. * @param n number of parameters * @param c array of n coefficients - * + * @deprecated Unimplemented */ virtual void setParameters(int n, doublereal* const c); @@ -619,6 +619,7 @@ public: * * @param n number of parameters (output) * @param c array of n coefficients + * * @deprecated Unimplemented */ virtual void getParameters(int& n, doublereal* const c) const; diff --git a/include/cantera/thermo/LatticePhase.h b/include/cantera/thermo/LatticePhase.h index 56e6744aa..706bb89a8 100644 --- a/include/cantera/thermo/LatticePhase.h +++ b/include/cantera/thermo/LatticePhase.h @@ -853,6 +853,7 @@ public: * @param n number of parameters. Must be one * @param c array of \a n coefficients * c[0] = The bulk lattice density (kmol m-3) + * @deprecated Use setMolarDensity() */ virtual void setParameters(int n, doublereal* const c); @@ -866,6 +867,7 @@ public: * For this phase: * - n = 1 * - c[0] = molar density of phase [ kmol/m^3 ] + * @deprecated Use molarDensity() */ virtual void getParameters(int& n, doublereal* const c) const; diff --git a/include/cantera/thermo/MetalSHEelectrons.h b/include/cantera/thermo/MetalSHEelectrons.h index 471deac21..f465c4b76 100644 --- a/include/cantera/thermo/MetalSHEelectrons.h +++ b/include/cantera/thermo/MetalSHEelectrons.h @@ -465,6 +465,7 @@ public: * @param n number of parameters * @param c array of \a n coefficients * c[0] = density of phase [ kg/m3 ] + * @deprecated Use setDensity() */ virtual void setParameters(int n, doublereal* const c); @@ -478,6 +479,7 @@ public: * For this phase: * - n = 1 * - c[0] = density of phase [ kg/m3 ] + * @deprecated Use density() */ virtual void getParameters(int& n, doublereal* const c) const; diff --git a/include/cantera/thermo/MineralEQ3.h b/include/cantera/thermo/MineralEQ3.h index bf0b82da4..34295a002 100644 --- a/include/cantera/thermo/MineralEQ3.h +++ b/include/cantera/thermo/MineralEQ3.h @@ -397,6 +397,7 @@ public: * @param n number of parameters * @param c array of \a n coefficients * c[0] = density of phase [ kg/m3 ] + * @deprecated Use setDensity() */ virtual void setParameters(int n, doublereal* const c); @@ -410,6 +411,7 @@ public: * For this phase: * - n = 1 * - c[0] = density of phase [ kg/m3 ] + * @deprecated use density() */ virtual void getParameters(int& n, doublereal* const c) const; diff --git a/include/cantera/thermo/SingleSpeciesTP.h b/include/cantera/thermo/SingleSpeciesTP.h index 71b21147d..7fd09994f 100644 --- a/include/cantera/thermo/SingleSpeciesTP.h +++ b/include/cantera/thermo/SingleSpeciesTP.h @@ -567,11 +567,16 @@ public: * these depends on the subclass. * @param n number of parameters * @param c array of n coefficients - * + * @deprecated Unimplemented */ - virtual void setParameters(int n, doublereal* const c) {} + virtual void setParameters(int n, doublereal* const c) { + warn_deprecated("SingleSpeciesTP::setParameters"); + } - virtual void getParameters(int& n, doublereal* const c) const {} + //! @deprecated Unimplemented + virtual void getParameters(int& n, doublereal* const c) const { + warn_deprecated("SingleSpeciesTP::getParameters"); + } /** * Set equation of state parameter values from XML diff --git a/include/cantera/thermo/StoichSubstance.h b/include/cantera/thermo/StoichSubstance.h index d26dc2a35..f4e6c97ce 100644 --- a/include/cantera/thermo/StoichSubstance.h +++ b/include/cantera/thermo/StoichSubstance.h @@ -355,8 +355,10 @@ public: virtual void initThermo(); + //! @deprecated Use setDensity() virtual void setParameters(int n, double* const c); + //! @deprecated Use density() virtual void getParameters(int& n, double* const c) const; virtual void setParametersFromXML(const XML_Node& eosdata); diff --git a/include/cantera/thermo/StoichSubstanceSSTP.h b/include/cantera/thermo/StoichSubstanceSSTP.h index 04fc3f875..48056b5ab 100644 --- a/include/cantera/thermo/StoichSubstanceSSTP.h +++ b/include/cantera/thermo/StoichSubstanceSSTP.h @@ -439,6 +439,7 @@ public: * @param n number of parameters * @param c array of \a n coefficients * c[0] = density of phase [ kg/m3 ] + * @deprecated Use setDensity() */ virtual void setParameters(int n, doublereal* const c); @@ -452,6 +453,7 @@ public: * For this phase: * - n = 1 * - c[0] = density of phase [ kg/m3 ] + * @deprecated Use density() */ virtual void getParameters(int& n, doublereal* const c) const; @@ -530,6 +532,7 @@ public: virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); + //! @deprecated Use setDensity() void setParameters(int n, doublereal* const c); }; diff --git a/include/cantera/thermo/SurfPhase.h b/include/cantera/thermo/SurfPhase.h index 04e26c267..d6eaca5bc 100644 --- a/include/cantera/thermo/SurfPhase.h +++ b/include/cantera/thermo/SurfPhase.h @@ -345,6 +345,7 @@ public: * @param n number of parameters. Must be one * @param c array of \a n coefficients * c[0] = The site density (kmol m-2) + * @deprecated use setSiteDensity() */ virtual void setParameters(int n, doublereal* const c); diff --git a/include/cantera/thermo/ThermoPhase.h b/include/cantera/thermo/ThermoPhase.h index 211287cc7..09814e76a 100644 --- a/include/cantera/thermo/ThermoPhase.h +++ b/include/cantera/thermo/ThermoPhase.h @@ -1452,8 +1452,11 @@ public: * * @param n number of parameters * @param c array of \a n coefficients + * @deprecated Use methods specific to the derived class */ - virtual void setParameters(int n, doublereal* const c) {} + virtual void setParameters(int n, doublereal* const c) { + warn_deprecated("ThermoPhase::setParameters"); + } //! Get the equation of state parameters in a vector @@ -1463,8 +1466,11 @@ public: * * @param n number of parameters * @param c array of \a n coefficients + * @deprecated Use methods specific to the derived class */ - virtual void getParameters(int& n, doublereal* const c) const {} + virtual void getParameters(int& n, doublereal* const c) const { + warn_deprecated("ThermoPhase::getParameters"); + } //! Set equation of state parameter values from XML entries. diff --git a/src/thermo/DebyeHuckel.cpp b/src/thermo/DebyeHuckel.cpp index 2e27bc339..e55db4d9f 100644 --- a/src/thermo/DebyeHuckel.cpp +++ b/src/thermo/DebyeHuckel.cpp @@ -1126,10 +1126,12 @@ initThermoXML(XML_Node& phaseNode, const std::string& id_) void DebyeHuckel::setParameters(int n, doublereal* const c) { + warn_deprecated("DebyeHuckel::setParameters"); } void DebyeHuckel::getParameters(int& n, doublereal* const c) const { + warn_deprecated("DebyeHuckel::getParameters"); } void DebyeHuckel::setParametersFromXML(const XML_Node& eosdata) diff --git a/src/thermo/FixedChemPotSSTP.cpp b/src/thermo/FixedChemPotSSTP.cpp index 9f6076f77..c10d58723 100644 --- a/src/thermo/FixedChemPotSSTP.cpp +++ b/src/thermo/FixedChemPotSSTP.cpp @@ -328,11 +328,13 @@ void FixedChemPotSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id_ void FixedChemPotSSTP::setParameters(int n, doublereal* const c) { + warn_deprecated("FixedChemPotSSTP::setParameters"); chemPot_ = c[0]; } void FixedChemPotSSTP::getParameters(int& n, doublereal* const c) const { + warn_deprecated("FixedChemPotSSTP::getParameters"); n = 1; c[0] = chemPot_; } diff --git a/src/thermo/HMWSoln.cpp b/src/thermo/HMWSoln.cpp index b4373c14d..d99f33c0b 100644 --- a/src/thermo/HMWSoln.cpp +++ b/src/thermo/HMWSoln.cpp @@ -1008,10 +1008,12 @@ void HMWSoln::getPartialMolarCp(doublereal* cpbar) const void HMWSoln::setParameters(int n, doublereal* const c) { + warn_deprecated("HMWSoln::setParameters"); } void HMWSoln::getParameters(int& n, doublereal* const c) const { + warn_deprecated("HMWSoln::getParameters"); } void HMWSoln::setParametersFromXML(const XML_Node& eosdata) diff --git a/src/thermo/IdealMolalSoln.cpp b/src/thermo/IdealMolalSoln.cpp index dfadb865d..831e576e7 100644 --- a/src/thermo/IdealMolalSoln.cpp +++ b/src/thermo/IdealMolalSoln.cpp @@ -673,10 +673,12 @@ void IdealMolalSoln::initThermoXML(XML_Node& phaseNode, const std::string& id_) void IdealMolalSoln::setParameters(int n, doublereal* const c) { + warn_deprecated("IdealMolalSoln::setParameters"); } void IdealMolalSoln::getParameters(int& n, doublereal* const c) const { + warn_deprecated("IdealMolalSoln::getParameters"); } void IdealMolalSoln::setParametersFromXML(const XML_Node& eosdata) diff --git a/src/thermo/LatticePhase.cpp b/src/thermo/LatticePhase.cpp index ed8c986e5..6f9c4315c 100644 --- a/src/thermo/LatticePhase.cpp +++ b/src/thermo/LatticePhase.cpp @@ -402,12 +402,14 @@ void LatticePhase::_updateThermo() const void LatticePhase::setParameters(int n, doublereal* const c) { + warn_deprecated("LatticePhase::setParameters"); m_site_density = c[0]; setMolarDensity(m_site_density); } void LatticePhase::getParameters(int& n, doublereal* const c) const { + warn_deprecated("LatticePhase::getParameters"); double d = molarDensity(); c[0] = d; n = 1; diff --git a/src/thermo/MetalSHEelectrons.cpp b/src/thermo/MetalSHEelectrons.cpp index 3380b4a19..23323d163 100644 --- a/src/thermo/MetalSHEelectrons.cpp +++ b/src/thermo/MetalSHEelectrons.cpp @@ -303,12 +303,14 @@ XML_Node* MetalSHEelectrons::makeDefaultXMLTree() void MetalSHEelectrons::setParameters(int n, doublereal* const c) { + warn_deprecated("MetalSHEelectrons::setParameters"); doublereal rho = c[0]; setDensity(rho); } void MetalSHEelectrons::getParameters(int& n, doublereal* const c) const { + warn_deprecated("MetalSHEelectrons::getParameters"); doublereal rho = density(); n = 1; c[0] = rho; diff --git a/src/thermo/MineralEQ3.cpp b/src/thermo/MineralEQ3.cpp index c134cdcb4..06ad20bd2 100644 --- a/src/thermo/MineralEQ3.cpp +++ b/src/thermo/MineralEQ3.cpp @@ -234,12 +234,14 @@ void MineralEQ3::initThermo() void MineralEQ3::setParameters(int n, doublereal* const c) { + warn_deprecated("MineralEQ3::setParameters"); doublereal rho = c[0]; setDensity(rho); } void MineralEQ3::getParameters(int& n, doublereal* const c) const { + warn_deprecated("MineralEQ3::getParameters"); doublereal rho = density(); n = 1; c[0] = rho; diff --git a/src/thermo/StoichSubstance.cpp b/src/thermo/StoichSubstance.cpp index e83f5b366..7a7b70469 100644 --- a/src/thermo/StoichSubstance.cpp +++ b/src/thermo/StoichSubstance.cpp @@ -246,12 +246,14 @@ void StoichSubstance::getCp_R_ref(doublereal* cprt) const void StoichSubstance::setParameters(int n, double* const c) { + warn_deprecated("StoichSubstance::setParameters"); double rho = c[0]; setDensity(rho); } void StoichSubstance::getParameters(int& n, double* const c) const { + warn_deprecated("StoichSubstance::getParameters"); double rho = density(); c[0] = rho; } diff --git a/src/thermo/StoichSubstanceSSTP.cpp b/src/thermo/StoichSubstanceSSTP.cpp index e0c43d6f4..d266e6871 100644 --- a/src/thermo/StoichSubstanceSSTP.cpp +++ b/src/thermo/StoichSubstanceSSTP.cpp @@ -255,12 +255,14 @@ void StoichSubstanceSSTP::initThermoXML(XML_Node& phaseNode, const std::string& void StoichSubstanceSSTP::setParameters(int n, doublereal* const c) { + warn_deprecated("StoichSubstanceSSTP::setParameters"); doublereal rho = c[0]; setDensity(rho); } void StoichSubstanceSSTP::getParameters(int& n, doublereal* const c) const { + warn_deprecated("StoichSubstanceSSTP::getParameters"); doublereal rho = density(); n = 1; c[0] = rho; @@ -362,6 +364,7 @@ void electrodeElectron::initThermoXML(XML_Node& phaseNode, const std::string& id void electrodeElectron::setParameters(int n, doublereal* const c) { + warn_deprecated("electrodeElectron::setParameters"); doublereal rho = 10.0; setDensity(rho); } diff --git a/src/thermo/SurfPhase.cpp b/src/thermo/SurfPhase.cpp index f6c450027..34714e724 100644 --- a/src/thermo/SurfPhase.cpp +++ b/src/thermo/SurfPhase.cpp @@ -185,16 +185,12 @@ doublereal SurfPhase::logStandardConc(size_t k) const void SurfPhase::setParameters(int n, doublereal* const c) { + warn_deprecated("SurfPhase::setParameters"); if (n != 1) { throw CanteraError("SurfPhase::setParameters", "Bad value for number of parameter"); } - m_n0 = c[0]; - if (m_n0 <= 0.0) { - throw CanteraError("SurfPhase::setParameters", - "Bad value for parameter"); - } - m_logn0 = log(m_n0); + setSiteDensity(c[0]); } void SurfPhase::getGibbs_RT(doublereal* grt) const @@ -276,8 +272,12 @@ void SurfPhase::initThermo() void SurfPhase::setSiteDensity(doublereal n0) { - doublereal x = n0; - setParameters(1, &x); + if (n0 <= 0.0) { + throw CanteraError("SurfPhase::setSiteDensity", + "Bad value for parameter"); + } + m_n0 = n0; + m_logn0 = log(m_n0); } void SurfPhase::setCoverages(const doublereal* theta)