From 11d97dfbbf54574b3e46aec1dd090200bb859c60 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Wed, 7 Mar 2012 00:51:51 +0000 Subject: [PATCH] Simplified definitions in class SpeciesThermoDuo --- include/cantera/thermo/SpeciesThermoMgr.h | 81 +++++++---------------- 1 file changed, 23 insertions(+), 58 deletions(-) diff --git a/include/cantera/thermo/SpeciesThermoMgr.h b/include/cantera/thermo/SpeciesThermoMgr.h index 60b7cc0b1..a98dd0ab2 100644 --- a/include/cantera/thermo/SpeciesThermoMgr.h +++ b/include/cantera/thermo/SpeciesThermoMgr.h @@ -164,16 +164,19 @@ class SpeciesThermoDuo : public SpeciesThermo public: //! Constructor - SpeciesThermoDuo(); + SpeciesThermoDuo() {}; //! Destructor - virtual ~SpeciesThermoDuo(); + virtual ~SpeciesThermoDuo() {}; //! copy constructor /*! * @param right Object to be copied */ - SpeciesThermoDuo(const SpeciesThermoDuo& right); + SpeciesThermoDuo(const SpeciesThermoDuo& right) + { + *this = operator=(right); + } //! Assignment operator /*! @@ -224,7 +227,10 @@ public: * @param stit_ptr Pointer to the SpeciesThermoInterpType object * This will set up the thermo for one species */ - virtual void install_STIT(SpeciesThermoInterpType* stit_ptr); + virtual void install_STIT(SpeciesThermoInterpType* stit_ptr) + { + throw CanteraError("install_STIT", "not implemented"); + } //! Compute the reference-state properties for all species. /*! @@ -254,7 +260,10 @@ public: * * @param k Species index */ - virtual doublereal minTemp(size_t k = npos) const; + virtual doublereal minTemp(size_t k = npos) const + { + return std::max(m_thermo1.minTemp(),m_thermo2.minTemp()); + } //! Maximum temperature. /*! @@ -266,7 +275,10 @@ public: * * @param k index for parameterization k */ - virtual doublereal maxTemp(size_t k = npos) const; + virtual doublereal maxTemp(size_t k = npos) const + { + return std::min(m_thermo1.maxTemp(), m_thermo2.maxTemp()); + } /** * The reference-state pressure for species k. @@ -281,7 +293,10 @@ public: * * @param k index for parameterization k */ - virtual doublereal refPressure(size_t k = npos) const; + virtual doublereal refPressure(size_t k = npos) const + { + return m_p0; + } //! This utility function reports the type of parameterization //! used for the species with index number index. @@ -320,7 +335,6 @@ public: */ DEPRECATED(virtual void modifyParams(size_t index, doublereal* c)); - #ifdef H298MODIFY_CAPABILITY virtual doublereal reportOneHf298(int k) const { @@ -350,22 +364,6 @@ private: // Definitions for the SpeciesThermoDuo templated class -template -SpeciesThermoDuo::SpeciesThermoDuo() -{ -} - -template -SpeciesThermoDuo::~SpeciesThermoDuo() -{ -} - -template -SpeciesThermoDuo::SpeciesThermoDuo(const SpeciesThermoDuo& right) -{ - *this = operator=(right); -} - template SpeciesThermoDuo & SpeciesThermoDuo::operator=(const SpeciesThermoDuo& right) @@ -412,13 +410,6 @@ SpeciesThermoDuo::install(std::string name, size_t sp, int type, } } -template -void -SpeciesThermoDuo::install_STIT(SpeciesThermoInterpType* stit_ptr) -{ - throw CanteraError("install_STIT", "not implemented"); -} - template void SpeciesThermoDuo::update(doublereal t, doublereal* cp_R, @@ -428,39 +419,13 @@ SpeciesThermoDuo::update(doublereal t, doublereal* cp_R, m_thermo2.update(t, cp_R, h_RT, s_R); } -template -doublereal -SpeciesThermoDuo::minTemp(size_t k) const -{ - doublereal tm1 = m_thermo1.minTemp(); - doublereal tm2 = m_thermo2.minTemp(); - return (tm1 < tm2 ? tm2 : tm1); -} - -template -doublereal -SpeciesThermoDuo::maxTemp(size_t k) const -{ - doublereal tm1 = m_thermo1.maxTemp(); - doublereal tm2 = m_thermo2.maxTemp(); - return (tm1 < tm2 ? tm1 : tm2); -} - -template -doublereal -SpeciesThermoDuo::refPressure(size_t k) const -{ - return m_p0; -} - template int SpeciesThermoDuo::reportType(size_t k) const { std::map::const_iterator p = speciesToType.find(k); if (p != speciesToType.end()) { - const int type = p->second; - return type; + return p->second; } return -1; }