diff --git a/include/cantera/thermo/GeneralSpeciesThermo.h b/include/cantera/thermo/GeneralSpeciesThermo.h index 2fb330d77..c9d2079bf 100644 --- a/include/cantera/thermo/GeneralSpeciesThermo.h +++ b/include/cantera/thermo/GeneralSpeciesThermo.h @@ -81,7 +81,7 @@ public: doublereal minTemp, doublereal maxTemp, doublereal refPressure); - virtual void install_STIT(SpeciesThermoInterpType* stit_ptr); + virtual void install_STIT(size_t index, SpeciesThermoInterpType* stit_ptr); //! Install a PDSS object to handle the reference state thermodynamics //! calculation diff --git a/include/cantera/thermo/SimpleThermo.h b/include/cantera/thermo/SimpleThermo.h index 6e923df3f..df906abf8 100644 --- a/include/cantera/thermo/SimpleThermo.h +++ b/include/cantera/thermo/SimpleThermo.h @@ -181,7 +181,7 @@ public: markInstalled(index); } - virtual void install_STIT(SpeciesThermoInterpType* stit_ptr) { + virtual void install_STIT(size_t index, SpeciesThermoInterpType* stit_ptr) { throw CanteraError("install_STIT", "not implemented"); } diff --git a/include/cantera/thermo/SpeciesThermo.h b/include/cantera/thermo/SpeciesThermo.h index 84abbc668..4dbf93705 100644 --- a/include/cantera/thermo/SpeciesThermo.h +++ b/include/cantera/thermo/SpeciesThermo.h @@ -198,10 +198,12 @@ public: //! Install a new species thermodynamic property //! parameterization for one species. /*! + * @param index Index of the species being installed * @param stit_ptr Pointer to the SpeciesThermoInterpType object * This will set up the thermo for one species */ - virtual void install_STIT(SpeciesThermoInterpType* stit_ptr) = 0; + virtual void install_STIT(size_t index, + SpeciesThermoInterpType* stit_ptr) = 0; //! Compute the reference-state properties for all species. /*! diff --git a/include/cantera/thermo/SpeciesThermoMgr.h b/include/cantera/thermo/SpeciesThermoMgr.h index e71d86a6a..4365094d1 100644 --- a/include/cantera/thermo/SpeciesThermoMgr.h +++ b/include/cantera/thermo/SpeciesThermoMgr.h @@ -84,7 +84,7 @@ public: doublereal minTemp, doublereal maxTemp, doublereal refPressure); - virtual void install_STIT(SpeciesThermoInterpType* stit_ptr) { + virtual void install_STIT(size_t index, SpeciesThermoInterpType* stit_ptr) { throw CanteraError("install_STIT", "not implemented"); } diff --git a/src/thermo/GeneralSpeciesThermo.cpp b/src/thermo/GeneralSpeciesThermo.cpp index a694c7abd..7a8c3efda 100644 --- a/src/thermo/GeneralSpeciesThermo.cpp +++ b/src/thermo/GeneralSpeciesThermo.cpp @@ -107,21 +107,20 @@ void GeneralSpeciesThermo::install(const std::string& name, */ SpeciesThermoInterpType* sp = newSpeciesThermoInterpType(type, minTemp_, maxTemp_, refPressure_, c); - sp->setIndex(index); sp->validate(name); - install_STIT(sp); + install_STIT(index, sp); } -void GeneralSpeciesThermo::install_STIT(SpeciesThermoInterpType* stit_ptr) +void GeneralSpeciesThermo::install_STIT(size_t index, + SpeciesThermoInterpType* stit_ptr) { if (!stit_ptr) { throw CanteraError("GeneralSpeciesThermo::install_STIT", "zero pointer"); } - size_t index = stit_ptr->speciesIndex(); AssertThrow(m_speciesLoc.find(index) == m_speciesLoc.end(), "Index position isn't null, duplication of assignment: " + int2str(index)); - + stit_ptr->setIndex(index); int type = stit_ptr->reportType(); m_speciesLoc[index] = std::make_pair(type, m_sp[type].size()); m_sp[type].push_back(stit_ptr); @@ -139,7 +138,7 @@ void GeneralSpeciesThermo::installPDSShandler(size_t k, PDSS* PDSS_ptr, VPSSMgr* vpssmgr_ptr) { STITbyPDSS* stit_ptr = new STITbyPDSS(k, vpssmgr_ptr, PDSS_ptr); - install_STIT(stit_ptr); + install_STIT(k, stit_ptr); } void GeneralSpeciesThermo::update_one(size_t k, doublereal t, doublereal* cp_R, diff --git a/src/thermo/LatticeSolidPhase.cpp b/src/thermo/LatticeSolidPhase.cpp index 07867c636..187eb112b 100644 --- a/src/thermo/LatticeSolidPhase.cpp +++ b/src/thermo/LatticeSolidPhase.cpp @@ -362,9 +362,8 @@ void LatticeSolidPhase::installSlavePhases(Cantera::XML_Node* phaseNode) addUniqueSpecies(lp->speciesName(k), &ecomp[0], lp->charge(k), lp->size(k)); SpeciesThermoInterpType* stit = newSpeciesThermoInterpType(*spNode[k]); - stit->setIndex(kk); stit->validate(spNode[k]->attrib("name")); - m_spthermo->install_STIT(stit); + m_spthermo->install_STIT(kk, stit); m_speciesData.push_back(new XML_Node(*(spNode[k]))); kk++; } diff --git a/src/thermo/NasaThermo.h b/src/thermo/NasaThermo.h index 58eeca1ff..4ad79569e 100644 --- a/src/thermo/NasaThermo.h +++ b/src/thermo/NasaThermo.h @@ -82,7 +82,7 @@ public: doublereal min_temp, doublereal max_temp, doublereal ref_pressure); - virtual void install_STIT(SpeciesThermoInterpType* stit_ptr) { + virtual void install_STIT(size_t index, SpeciesThermoInterpType* stit_ptr) { throw CanteraError("install_STIT", "not implemented"); } diff --git a/src/thermo/ShomateThermo.h b/src/thermo/ShomateThermo.h index c70eea394..f7f911194 100644 --- a/src/thermo/ShomateThermo.h +++ b/src/thermo/ShomateThermo.h @@ -204,7 +204,7 @@ public: markInstalled(index); } - virtual void install_STIT(SpeciesThermoInterpType* stit_ptr) { + virtual void install_STIT(size_t index, SpeciesThermoInterpType* stit_ptr) { throw CanteraError("install_STIT", "not implemented"); } diff --git a/src/thermo/SpeciesThermoFactory.cpp b/src/thermo/SpeciesThermoFactory.cpp index bd29ec4ec..d66d7759e 100644 --- a/src/thermo/SpeciesThermoFactory.cpp +++ b/src/thermo/SpeciesThermoFactory.cpp @@ -584,8 +584,7 @@ void SpeciesThermoFactory::installThermoForSpecies { SpeciesThermoInterpType* stit = newSpeciesThermoInterpType(speciesNode); stit->validate(speciesNode["name"]); - stit->setIndex(k); - spthermo.install_STIT(stit); + spthermo.install_STIT(k, stit); } void SpeciesThermoFactory::installVPThermoForSpecies(size_t k, diff --git a/src/thermo/ThermoPhase.cpp b/src/thermo/ThermoPhase.cpp index 4b92aeac6..1ab8f8fa0 100644 --- a/src/thermo/ThermoPhase.cpp +++ b/src/thermo/ThermoPhase.cpp @@ -700,8 +700,8 @@ bool ThermoPhase::addSpecies(const Species& spec) if (added) { Species& s = m_species[spec.name]; s.thermo().validate(spec.name); - s.thermo().setIndex(m_kk-1); - m_spthermo->install_STIT(s.thermo().duplMyselfAsSpeciesThermoInterpType()); + m_spthermo->install_STIT(m_kk-1, + s.thermo().duplMyselfAsSpeciesThermoInterpType()); } return added; } diff --git a/src/thermo/VPSSMgr.cpp b/src/thermo/VPSSMgr.cpp index b219ba466..a774ef601 100644 --- a/src/thermo/VPSSMgr.cpp +++ b/src/thermo/VPSSMgr.cpp @@ -395,9 +395,8 @@ void VPSSMgr::installSTSpecies(size_t k, const XML_Node& s, const XML_Node* phaseNode_ptr) { SpeciesThermoInterpType* stit = newSpeciesThermoInterpType(s); - stit->setIndex(k); stit->validate(s["name"]); - m_spthermo->install_STIT(stit); + m_spthermo->install_STIT(k, stit); if (m_p0 < 0.0) { m_p0 = m_spthermo->refPressure(k); } diff --git a/src/thermo/VPSSMgr_IdealGas.cpp b/src/thermo/VPSSMgr_IdealGas.cpp index 29709307a..6425954a5 100644 --- a/src/thermo/VPSSMgr_IdealGas.cpp +++ b/src/thermo/VPSSMgr_IdealGas.cpp @@ -104,9 +104,8 @@ VPSSMgr_IdealGas::createInstallPDSS(size_t k, const XML_Node& speciesNode, } SpeciesThermoInterpType* stit = newSpeciesThermoInterpType(speciesNode); - stit->setIndex(k); stit->validate(speciesNode["name"]); - m_spthermo->install_STIT(stit); + m_spthermo->install_STIT(k, stit); PDSS* kPDSS = new PDSS_IdealGas(m_vptp_ptr, k, speciesNode, *phaseNode_ptr, true);