From 47005a500826c11dc60fdd68108ded9e26488659 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Tue, 5 Mar 2019 14:34:12 -0500 Subject: [PATCH] [Thermo] Fix overriding of IdealSolidSolnPhase::_updateThermo Since IdealSolidSolnPhase::_updateThermo wasn't a virtual method, and the signatures didn't match (const vs non-const), calls to this method from IdealSolidSolnPhase weren't being overridden by BinarySolutionTabulatedThermo::_updateThermo as expected. --- include/cantera/thermo/BinarySolutionTabulatedThermo.h | 4 ++-- include/cantera/thermo/IdealSolidSolnPhase.h | 2 +- src/thermo/BinarySolutionTabulatedThermo.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/cantera/thermo/BinarySolutionTabulatedThermo.h b/include/cantera/thermo/BinarySolutionTabulatedThermo.h index 671b22a9e..11c2e9d7f 100644 --- a/include/cantera/thermo/BinarySolutionTabulatedThermo.h +++ b/include/cantera/thermo/BinarySolutionTabulatedThermo.h @@ -156,7 +156,7 @@ protected: size_t m_kk_tab; //! Current tabulated species mole fraction - double m_xlast; + mutable double m_xlast; //! Vector for storing tabulated thermo vector_fp m_molefrac_tab; @@ -164,7 +164,7 @@ protected: vector_fp m_entropy_tab; private: - void _updateThermo(); + virtual void _updateThermo() const; }; } diff --git a/include/cantera/thermo/IdealSolidSolnPhase.h b/include/cantera/thermo/IdealSolidSolnPhase.h index 05316b5c0..adf632e69 100644 --- a/include/cantera/thermo/IdealSolidSolnPhase.h +++ b/include/cantera/thermo/IdealSolidSolnPhase.h @@ -681,7 +681,7 @@ private: * the temperature has changed, the species thermo manager is called to * recalculate G, Cp, H, and S at the current temperature. */ - void _updateThermo() const; + virtual void _updateThermo() const; //@} }; diff --git a/src/thermo/BinarySolutionTabulatedThermo.cpp b/src/thermo/BinarySolutionTabulatedThermo.cpp index e054ce1c0..a90285795 100644 --- a/src/thermo/BinarySolutionTabulatedThermo.cpp +++ b/src/thermo/BinarySolutionTabulatedThermo.cpp @@ -48,7 +48,7 @@ void BinarySolutionTabulatedThermo::compositionChanged() _updateThermo(); } -void BinarySolutionTabulatedThermo::_updateThermo() +void BinarySolutionTabulatedThermo::_updateThermo() const { double tnow = temperature(); double xnow = moleFraction(m_kk_tab);