From 09ce99dc837e44a4ecca7b08946e71525b1f8b75 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Fri, 20 Feb 2015 23:43:12 +0000 Subject: [PATCH] [Thermo] Eliminate redundant assignment of m_kk m_kk is automatically set as species are added to a phase. --- include/cantera/thermo/VPStandardStateTP.h | 9 --------- src/thermo/DebyeHuckel.cpp | 2 -- src/thermo/GibbsExcessVPSSTP.cpp | 1 - src/thermo/HMWSoln.cpp | 2 -- src/thermo/IdealMolalSoln.cpp | 1 - src/thermo/IdealSolnGasVPSS.cpp | 1 - src/thermo/IonsFromNeutralVPSSTP.cpp | 1 - src/thermo/MargulesVPSSTP.cpp | 1 - src/thermo/MixedSolventElectrolyte.cpp | 1 - src/thermo/MixtureFugacityTP.cpp | 1 - src/thermo/MolalityVPSSTP.cpp | 1 - src/thermo/MolarityIonicVPSSTP.cpp | 1 - src/thermo/PhaseCombo_Interaction.cpp | 1 - src/thermo/PseudoBinaryVPSSTP.cpp | 1 - src/thermo/RedlichKisterVPSSTP.cpp | 1 - src/thermo/StoichSubstanceSSTP.cpp | 1 - src/thermo/VPStandardStateTP.cpp | 16 ---------------- 17 files changed, 42 deletions(-) diff --git a/include/cantera/thermo/VPStandardStateTP.h b/include/cantera/thermo/VPStandardStateTP.h index a329dc832..2538cceaf 100644 --- a/include/cantera/thermo/VPStandardStateTP.h +++ b/include/cantera/thermo/VPStandardStateTP.h @@ -509,15 +509,6 @@ public: PDSS* providePDSS(size_t k); const PDSS* providePDSS(size_t k) const; -private: - //! @internal Initialize the internal lengths in this object. - /*! - * Note this is not a virtual function. - */ - void initLengths(); - - //@} - protected: //! Current value of the pressure - state variable diff --git a/src/thermo/DebyeHuckel.cpp b/src/thermo/DebyeHuckel.cpp index ac2184bdd..29fcab267 100644 --- a/src/thermo/DebyeHuckel.cpp +++ b/src/thermo/DebyeHuckel.cpp @@ -1190,8 +1190,6 @@ double DebyeHuckel::AionicRadius(int k) const void DebyeHuckel::initLengths() { - m_kk = nSpecies(); - /* * Obtain the limits of the temperature from the species * thermo handler's limits. diff --git a/src/thermo/GibbsExcessVPSSTP.cpp b/src/thermo/GibbsExcessVPSSTP.cpp index ee9a49a66..6c5f99c31 100644 --- a/src/thermo/GibbsExcessVPSSTP.cpp +++ b/src/thermo/GibbsExcessVPSSTP.cpp @@ -271,7 +271,6 @@ void GibbsExcessVPSSTP::initThermo() void GibbsExcessVPSSTP::initLengths() { - m_kk = nSpecies(); moleFractions_.resize(m_kk); lnActCoeff_Scaled_.resize(m_kk); dlnActCoeffdT_Scaled_.resize(m_kk); diff --git a/src/thermo/HMWSoln.cpp b/src/thermo/HMWSoln.cpp index 7c8311b88..a6e5cf752 100644 --- a/src/thermo/HMWSoln.cpp +++ b/src/thermo/HMWSoln.cpp @@ -1003,8 +1003,6 @@ double HMWSoln::AionicRadius(int k) const void HMWSoln::initLengths() { - m_kk = nSpecies(); - /* * Resize lengths equal to the number of species in * the phase. diff --git a/src/thermo/IdealMolalSoln.cpp b/src/thermo/IdealMolalSoln.cpp index a03910c16..d6d6680ec 100644 --- a/src/thermo/IdealMolalSoln.cpp +++ b/src/thermo/IdealMolalSoln.cpp @@ -769,7 +769,6 @@ void IdealMolalSoln::s_updateIMS_lnMolalityActCoeff() const void IdealMolalSoln::initLengths() { - m_kk = nSpecies(); /* * Obtain the limits of the temperature from the species * thermo handler's limits. diff --git a/src/thermo/IdealSolnGasVPSS.cpp b/src/thermo/IdealSolnGasVPSS.cpp index e64e4c5e5..e8b2784ed 100644 --- a/src/thermo/IdealSolnGasVPSS.cpp +++ b/src/thermo/IdealSolnGasVPSS.cpp @@ -332,7 +332,6 @@ void IdealSolnGasVPSS::setToEquilState(const doublereal* mu_RT) void IdealSolnGasVPSS::initLengths() { - m_kk = nSpecies(); m_pp.resize(m_kk, 0.0); } diff --git a/src/thermo/IonsFromNeutralVPSSTP.cpp b/src/thermo/IonsFromNeutralVPSSTP.cpp index e7f631afa..c55ac8518 100644 --- a/src/thermo/IonsFromNeutralVPSSTP.cpp +++ b/src/thermo/IonsFromNeutralVPSSTP.cpp @@ -778,7 +778,6 @@ void IonsFromNeutralVPSSTP::initThermo() void IonsFromNeutralVPSSTP::initLengths() { - m_kk = nSpecies(); numNeutralMoleculeSpecies_ = neutralMoleculePhase_->nSpecies(); moleFractions_.resize(m_kk); fm_neutralMolec_ions_.resize(numNeutralMoleculeSpecies_ * m_kk); diff --git a/src/thermo/MargulesVPSSTP.cpp b/src/thermo/MargulesVPSSTP.cpp index 3cf0cbad9..f1377c694 100644 --- a/src/thermo/MargulesVPSSTP.cpp +++ b/src/thermo/MargulesVPSSTP.cpp @@ -345,7 +345,6 @@ void MargulesVPSSTP::initThermo() void MargulesVPSSTP::initLengths() { - m_kk = nSpecies(); dlnActCoeffdlnN_.resize(m_kk, m_kk); } diff --git a/src/thermo/MixedSolventElectrolyte.cpp b/src/thermo/MixedSolventElectrolyte.cpp index 5bcdb8630..b7bd189b5 100644 --- a/src/thermo/MixedSolventElectrolyte.cpp +++ b/src/thermo/MixedSolventElectrolyte.cpp @@ -351,7 +351,6 @@ void MixedSolventElectrolyte::initThermo() void MixedSolventElectrolyte::initLengths() { - m_kk = nSpecies(); dlnActCoeffdlnN_.resize(m_kk, m_kk); } diff --git a/src/thermo/MixtureFugacityTP.cpp b/src/thermo/MixtureFugacityTP.cpp index a26660add..1667d93ba 100644 --- a/src/thermo/MixtureFugacityTP.cpp +++ b/src/thermo/MixtureFugacityTP.cpp @@ -274,7 +274,6 @@ void MixtureFugacityTP::initThermo() void MixtureFugacityTP::initLengths() { - m_kk = nSpecies(); moleFractions_.resize(m_kk, 0.0); moleFractions_[0] = 1.0; m_h0_RT.resize(m_kk, 0.0); diff --git a/src/thermo/MolalityVPSSTP.cpp b/src/thermo/MolalityVPSSTP.cpp index 152b5a9ce..1183bc45a 100644 --- a/src/thermo/MolalityVPSSTP.cpp +++ b/src/thermo/MolalityVPSSTP.cpp @@ -477,7 +477,6 @@ size_t MolalityVPSSTP::findCLMIndex() const // been identified. void MolalityVPSSTP::initLengths() { - m_kk = nSpecies(); m_molalities.resize(m_kk); } diff --git a/src/thermo/MolarityIonicVPSSTP.cpp b/src/thermo/MolarityIonicVPSSTP.cpp index 95fbc5831..e69a7d3bb 100644 --- a/src/thermo/MolarityIonicVPSSTP.cpp +++ b/src/thermo/MolarityIonicVPSSTP.cpp @@ -347,7 +347,6 @@ void MolarityIonicVPSSTP::initThermo() void MolarityIonicVPSSTP::initLengths() { - m_kk = nSpecies(); moleFractionsTmp_.resize(m_kk); } diff --git a/src/thermo/PhaseCombo_Interaction.cpp b/src/thermo/PhaseCombo_Interaction.cpp index 6deb7979e..0b3237f3b 100644 --- a/src/thermo/PhaseCombo_Interaction.cpp +++ b/src/thermo/PhaseCombo_Interaction.cpp @@ -358,7 +358,6 @@ void PhaseCombo_Interaction::initThermo() void PhaseCombo_Interaction::initLengths() { - m_kk = nSpecies(); dlnActCoeffdlnN_.resize(m_kk, m_kk); } diff --git a/src/thermo/PseudoBinaryVPSSTP.cpp b/src/thermo/PseudoBinaryVPSSTP.cpp index e2570a8e9..48c1cae62 100644 --- a/src/thermo/PseudoBinaryVPSSTP.cpp +++ b/src/thermo/PseudoBinaryVPSSTP.cpp @@ -161,7 +161,6 @@ void PseudoBinaryVPSSTP::initThermo() void PseudoBinaryVPSSTP::initLengths() { - m_kk = nSpecies(); moleFractions_.resize(m_kk); } diff --git a/src/thermo/RedlichKisterVPSSTP.cpp b/src/thermo/RedlichKisterVPSSTP.cpp index 1b667ac47..175307dd5 100644 --- a/src/thermo/RedlichKisterVPSSTP.cpp +++ b/src/thermo/RedlichKisterVPSSTP.cpp @@ -306,7 +306,6 @@ void RedlichKisterVPSSTP::initThermo() void RedlichKisterVPSSTP::initLengths() { - m_kk = nSpecies(); dlnActCoeffdlnN_.resize(m_kk, m_kk); } diff --git a/src/thermo/StoichSubstanceSSTP.cpp b/src/thermo/StoichSubstanceSSTP.cpp index cd92f5c15..2080cb29b 100644 --- a/src/thermo/StoichSubstanceSSTP.cpp +++ b/src/thermo/StoichSubstanceSSTP.cpp @@ -199,7 +199,6 @@ void StoichSubstanceSSTP::initThermo() /* * Make sure there is one and only one species in this phase. */ - m_kk = nSpecies(); if (m_kk != 1) { throw CanteraError("initThermo", "stoichiometric substances may only contain one species."); diff --git a/src/thermo/VPStandardStateTP.cpp b/src/thermo/VPStandardStateTP.cpp index 83edd7a9d..40b816eb3 100644 --- a/src/thermo/VPStandardStateTP.cpp +++ b/src/thermo/VPStandardStateTP.cpp @@ -245,7 +245,6 @@ void VPStandardStateTP::getStandardVolumes_ref(doublereal* vol) const void VPStandardStateTP::initThermo() { - initLengths(); ThermoPhase::initThermo(); m_VPSS_ptr->initThermo(); for (size_t k = 0; k < m_kk; k++) { @@ -261,17 +260,6 @@ void VPStandardStateTP::setVPSSMgr(VPSSMgr* vp_ptr) m_VPSS_ptr = vp_ptr; } -/* - * Initialize the internal lengths. - * (this is not a virtual function) - */ -void VPStandardStateTP::initLengths() -{ - m_kk = nSpecies(); - -} - - void VPStandardStateTP::setTemperature(const doublereal temp) { setState_TP(temp, m_Pcurrent); @@ -345,10 +333,6 @@ VPStandardStateTP::providePDSS(size_t k) const void VPStandardStateTP::initThermoXML(XML_Node& phaseNode, const std::string& id) { - // initialize the lengths in the current object and then call the parent - // routine. - VPStandardStateTP::initLengths(); - for (size_t k = 0; k < m_kk; k++) { PDSS* kPDSS = m_PDSS_storage[k]; AssertTrace(kPDSS != 0);