[Thermo] Add 'index' argument to GeneralSpeciesThermo::install_STIT

This is a prerequisite to removing the species index as a property of the
SpeciesThermoInterpType object and making it independent of any specific
ThermoPhase object.
This commit is contained in:
Ray Speth 2015-02-27 17:09:31 -05:00
parent 1dd7b214b5
commit a1599ac921
12 changed files with 19 additions and 22 deletions

View file

@ -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

View file

@ -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");
}

View file

@ -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.
/*!

View file

@ -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");
}

View file

@ -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,

View file

@ -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++;
}

View file

@ -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");
}

View file

@ -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");
}

View file

@ -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,

View file

@ -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;
}

View file

@ -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);
}

View file

@ -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);