From 812290dc37ac763cc728e25005b080a239082714 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Tue, 10 May 2016 20:20:35 -0400 Subject: [PATCH] [Thermo] Deprecate ThermoPhase::installSlavePhases For the only class in which this is used (LatticeSolidPhase), all initialization can be performed in the initThermo method. --- include/cantera/thermo/LatticeSolidPhase.h | 8 -------- include/cantera/thermo/ThermoPhase.h | 1 + src/thermo/LatticeSolidPhase.cpp | 16 ++++------------ src/thermo/ThermoFactory.cpp | 4 ---- src/thermo/ThermoPhase.cpp | 2 ++ 5 files changed, 7 insertions(+), 24 deletions(-) diff --git a/include/cantera/thermo/LatticeSolidPhase.h b/include/cantera/thermo/LatticeSolidPhase.h index 0b19503d1..55c56de86 100644 --- a/include/cantera/thermo/LatticeSolidPhase.h +++ b/include/cantera/thermo/LatticeSolidPhase.h @@ -417,14 +417,6 @@ public: virtual bool addSpecies(shared_ptr spec); virtual void initThermo(); - //! Add in species from Slave phases - /*! - * This hook is used for cSS_CONVENTION_SLAVE phases - * - * @param phaseNode XML_Node for the current phase - */ - virtual void installSlavePhases(XML_Node* phaseNode); - virtual void setParametersFromXML(const XML_Node& eosdata); //! Set the Lattice mole fractions using a string diff --git a/include/cantera/thermo/ThermoPhase.h b/include/cantera/thermo/ThermoPhase.h index ebea8052b..928002db9 100644 --- a/include/cantera/thermo/ThermoPhase.h +++ b/include/cantera/thermo/ThermoPhase.h @@ -1504,6 +1504,7 @@ public: * This hook is used for cSS_CONVENTION_SLAVE phases * * @param phaseNode XML Element for the phase + * @deprecated Unused. To be removed after Cantera 2.3. */ virtual void installSlavePhases(XML_Node* phaseNode); diff --git a/src/thermo/LatticeSolidPhase.cpp b/src/thermo/LatticeSolidPhase.cpp index 358595a39..8aec25c33 100644 --- a/src/thermo/LatticeSolidPhase.cpp +++ b/src/thermo/LatticeSolidPhase.cpp @@ -319,14 +319,13 @@ void LatticeSolidPhase::getGibbs_ref(doublereal* g) const } } -void LatticeSolidPhase::installSlavePhases(XML_Node* phaseNode) +void LatticeSolidPhase::initThermo() { size_t kk = 0; size_t kstart = 0; - m_speciesData.clear(); + lkstart_.resize(m_lattice.size() + 1); + size_t loc = 0; - XML_Node& la = phaseNode->child("thermo").child("LatticeArray"); - std::vector lattices = la.getChildren("phase"); for (size_t n = 0; n < m_lattice.size(); n++) { LatticePhase* lp = m_lattice[n]; vector_fp constArr(lp->nElements()); @@ -355,14 +354,6 @@ void LatticeSolidPhase::installSlavePhases(XML_Node* phaseNode) m_speciesComp[ks * mm + m] = theta_[n]; } } - } -} - -void LatticeSolidPhase::initThermo() -{ - lkstart_.resize(m_lattice.size() + 1); - size_t loc = 0; - for (size_t n = 0; n < m_lattice.size(); n++) { size_t nsp = m_lattice[n]->nSpecies(); lkstart_[n] = loc; for (size_t k = 0; k < nsp; k++) { @@ -371,6 +362,7 @@ void LatticeSolidPhase::initThermo() } lkstart_[n+1] = loc; } + setMoleFractions(m_x.data()); ThermoPhase::initThermo(); } diff --git a/src/thermo/ThermoFactory.cpp b/src/thermo/ThermoFactory.cpp index 2831ff7df..3eade5f3e 100644 --- a/src/thermo/ThermoFactory.cpp +++ b/src/thermo/ThermoFactory.cpp @@ -438,10 +438,6 @@ void importPhase(XML_Node& phase, ThermoPhase* th) th->saveSpeciesData(k, s); } - if (ssConvention == cSS_CONVENTION_SLAVE) { - th->installSlavePhases(&phase); - } - // Done adding species. Perform any required subclass-specific // initialization. th->initThermo(); diff --git a/src/thermo/ThermoPhase.cpp b/src/thermo/ThermoPhase.cpp index 1ba55879b..5e60a84c0 100644 --- a/src/thermo/ThermoPhase.cpp +++ b/src/thermo/ThermoPhase.cpp @@ -708,6 +708,8 @@ void ThermoPhase::initThermo() } void ThermoPhase::installSlavePhases(XML_Node* phaseNode) { + warn_deprecated("ThermoPhase::installSlavePhases", + "Unused. To be removed after Cantera 2.3."); } bool ThermoPhase::addSpecies(shared_ptr spec)