From e62ce054cef175521c75b0e67b2e4e49bed6904b Mon Sep 17 00:00:00 2001 From: Victor Brunini Date: Thu, 13 Mar 2014 16:49:10 +0000 Subject: [PATCH] Style changes to be consistent with the rest of Cantera. Thanks for the code review. --- include/cantera/thermo/HMWSoln.h | 2 +- .../cantera/thermo/MaskellSolidSolnPhase.h | 4 ++-- src/thermo/HMWSoln.cpp | 16 +++++++++------- src/thermo/MaskellSolidSolnPhase.cpp | 19 +++++++++---------- 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/include/cantera/thermo/HMWSoln.h b/include/cantera/thermo/HMWSoln.h index 8ca3281b8..d9cd403f7 100644 --- a/include/cantera/thermo/HMWSoln.h +++ b/include/cantera/thermo/HMWSoln.h @@ -3273,7 +3273,7 @@ private: void calc_lambdas(double is) const; //! Track the last ionic strength lambdas were calculated at to avoid unnecessarily recalculating them - mutable double last_is; + mutable double m_last_is; /** * Calculate etheta and etheta_prime diff --git a/include/cantera/thermo/MaskellSolidSolnPhase.h b/include/cantera/thermo/MaskellSolidSolnPhase.h index f35219148..5c03ac4cb 100644 --- a/include/cantera/thermo/MaskellSolidSolnPhase.h +++ b/include/cantera/thermo/MaskellSolidSolnPhase.h @@ -297,9 +297,9 @@ protected: bool _updateThermo() const; //! Vector containing the last computed activity coefficients at T = m_tlast and r = last_r - mutable std::vector last_ac; + mutable std::vector m_last_ac; //! Last value of r used to update activity coeffs - mutable doublereal last_r; + mutable doublereal m_last_mole_frac_product; //! Vector containing the species reference enthalpies at T = m_tlast mutable vector_fp m_h0_RT; diff --git a/src/thermo/HMWSoln.cpp b/src/thermo/HMWSoln.cpp index c3dff31e8..195600b19 100644 --- a/src/thermo/HMWSoln.cpp +++ b/src/thermo/HMWSoln.cpp @@ -73,7 +73,7 @@ HMWSoln::HMWSoln() : CROP_ln_gamma_o_max(3.0), CROP_ln_gamma_k_min(-5.0), CROP_ln_gamma_k_max(15.0), - last_is(-1.0), + m_last_is(-1.0), m_debugCalc(0) { for (size_t i = 0; i < 17; i++) { @@ -127,7 +127,7 @@ HMWSoln::HMWSoln(const std::string& inputFile, const std::string& id_) : CROP_ln_gamma_o_max(3.0), CROP_ln_gamma_k_min(-5.0), CROP_ln_gamma_k_max(15.0), - last_is(-1.0), + m_last_is(-1.0), m_debugCalc(0) { for (int i = 0; i < 17; i++) { @@ -182,7 +182,7 @@ HMWSoln::HMWSoln(XML_Node& phaseRoot, const std::string& id_) : CROP_ln_gamma_o_max(3.0), CROP_ln_gamma_k_min(-5.0), CROP_ln_gamma_k_max(15.0), - last_is(-1.0), + m_last_is(-1.0), m_debugCalc(0) { for (int i = 0; i < 17; i++) { @@ -237,7 +237,7 @@ HMWSoln::HMWSoln(const HMWSoln& b) : CROP_ln_gamma_o_max(3.0), CROP_ln_gamma_k_min(-5.0), CROP_ln_gamma_k_max(15.0), - last_is(-1.0), + m_last_is(-1.0), m_debugCalc(0) { /* @@ -451,7 +451,7 @@ HMWSoln::HMWSoln(int testProb) : CROP_ln_gamma_o_max(3.0), CROP_ln_gamma_k_min(-5.0), CROP_ln_gamma_k_max(15.0), - last_is(-1.0), + m_last_is(-1.0), m_debugCalc(0) { if (testProb != 1) { @@ -5465,7 +5465,9 @@ void HMWSoln::s_updatePitzer_dlnMolalityActCoeff_dP() const void HMWSoln::calc_lambdas(double is) const { const double tol = 1.e-12; - if( std::abs(is - last_is) < tol ) return; + if( std::abs(is - m_last_is) < tol ) { + return; + } double aphi, dj, jfunc, jprime, t, x, zprod; int i, ij, j; @@ -5524,7 +5526,7 @@ void HMWSoln::calc_lambdas(double is) const #endif } } - last_is = is; + m_last_is = is; } void HMWSoln::calc_thetas(int z1, int z2, diff --git a/src/thermo/MaskellSolidSolnPhase.cpp b/src/thermo/MaskellSolidSolnPhase.cpp index 67b71db2c..96ef03ef5 100644 --- a/src/thermo/MaskellSolidSolnPhase.cpp +++ b/src/thermo/MaskellSolidSolnPhase.cpp @@ -23,8 +23,8 @@ namespace Cantera MaskellSolidSolnPhase::MaskellSolidSolnPhase() : m_Pref(OneAtm), m_Pcurrent(OneAtm), - last_ac(2), - last_r(-1.0), + m_last_ac(2), + m_last_mole_frac_product(-1.0), m_h0_RT(2), m_cp0_R(2), m_g0_RT(2), @@ -38,8 +38,8 @@ MaskellSolidSolnPhase::MaskellSolidSolnPhase() : MaskellSolidSolnPhase::MaskellSolidSolnPhase(const MaskellSolidSolnPhase& b) : m_Pref(OneAtm), m_Pcurrent(OneAtm), - last_ac(2), - last_r(-1.0), + m_last_ac(2), + m_last_mole_frac_product(-1.0), m_h0_RT(2), m_cp0_R(2), m_g0_RT(2), @@ -160,8 +160,7 @@ getActivityCoefficients(doublereal* ac) const bool temp_changed = _updateThermo(); const doublereal r = moleFraction(product_species_index); const doublereal tol = 1.e-12; - if( temp_changed || std::abs(r - last_r) > tol ) - { + if( temp_changed || std::abs(r - m_last_mole_frac_product) > tol ) { const doublereal pval = p(r); const doublereal fmval = fm(r); const doublereal rfm = r * fmval; @@ -169,11 +168,11 @@ getActivityCoefficients(doublereal* ac) const const doublereal A = (std::pow(1 - rfm, pval) * std::pow(rfm, pval) * std::pow(r - rfm, 1 - pval)) / (std::pow(1 - r - rfm, 1 + pval) * (1 - r)); const doublereal B = pval * h_mixing / RT; - last_ac[product_species_index] = A * std::exp(B); - last_ac[reactant_species_index] = 1 / (A * r * (1-r) ) * std::exp(-B); - last_r = r; + m_last_ac[product_species_index] = A * std::exp(B); + m_last_ac[reactant_species_index] = 1 / (A * r * (1-r) ) * std::exp(-B); + m_last_mole_frac_product = r; } - std::copy(last_ac.begin(), last_ac.end(), ac); + std::copy(m_last_ac.begin(), m_last_ac.end(), ac); } void MaskellSolidSolnPhase::