[Thermo] Always add species using Species objects
Deprecate the non-Species-based addSpecies and addUniqueSpecies functions.
This commit is contained in:
parent
2ca603838d
commit
96cf312ec6
4 changed files with 15 additions and 32 deletions
|
|
@ -763,6 +763,8 @@ public:
|
|||
//! @see ignoreUndefinedElements addUndefinedElements throwUndefinedElements
|
||||
virtual bool addSpecies(shared_ptr<Species> spec);
|
||||
|
||||
//! @deprecated Use AddSpecies(shared_ptr<Species> spec) instead. To be
|
||||
//! removed after Cantera 2.2.
|
||||
void addSpecies(const std::string& name, const doublereal* comp,
|
||||
doublereal charge = 0.0, doublereal size = 1.0);
|
||||
|
||||
|
|
@ -774,6 +776,8 @@ public:
|
|||
//! species.
|
||||
//! @param charge Charge of the species. Defaults to zero.
|
||||
//! @param size Size of the species (meters). Defaults to 1 meter.
|
||||
//! @deprecated Use addSpecies(shared_ptr<Species> spec) instead. To be
|
||||
//! removed after Cantera 2.2.
|
||||
void addUniqueSpecies(const std::string& name, const doublereal* comp,
|
||||
doublereal charge = 0.0,
|
||||
doublereal size = 1.0);
|
||||
|
|
|
|||
|
|
@ -84,18 +84,12 @@ FixedChemPotSSTP::FixedChemPotSSTP(const std::string& Ename, doublereal val) :
|
|||
setName(pname);
|
||||
setNDim(3);
|
||||
addElement(Ename);
|
||||
vector_fp ecomp(nElements(), 0.0);
|
||||
ecomp[0] = 1.0;
|
||||
double chrg = 0.0;
|
||||
addUniqueSpecies(pname, &ecomp[0], chrg, 0.0);
|
||||
double c[4];
|
||||
c[0] = 298.15;
|
||||
c[1] = val;
|
||||
c[2] = 0.0;
|
||||
c[3] = 0.0;
|
||||
shared_ptr<Species> sp(new Species(pname, parseCompString(Ename + ":1.0")));
|
||||
double c[4] = {298.15, val, 0.0, 0.0};
|
||||
shared_ptr<SpeciesThermoInterpType> stit(
|
||||
newSpeciesThermoInterpType("const_cp", 0.1, 1e30, OneAtm, c));
|
||||
m_spthermo->install_STIT(0, stit);
|
||||
sp->thermo = stit;
|
||||
addSpecies(sp);
|
||||
initThermo();
|
||||
m_p0 = OneAtm;
|
||||
m_tlast = 298.15;
|
||||
|
|
|
|||
|
|
@ -341,31 +341,10 @@ void LatticeSolidPhase::installSlavePhases(Cantera::XML_Node* phaseNode)
|
|||
addElement(lp->elementName(es), aws[es], lp->atomicNumber(es),
|
||||
lp->entropyElement298(es), lp->elementType(es));
|
||||
}
|
||||
const std::vector<const XML_Node*> & spNode = lp->speciesData();
|
||||
kstart = kk;
|
||||
|
||||
|
||||
for (size_t k = 0; k < lp->nSpecies(); k++) {
|
||||
std::map<std::string, double> comp;
|
||||
lp->getAtoms(k, DATA_PTR(constArr));
|
||||
vector_fp ecomp(nElements(), 0.0);
|
||||
for (size_t m = 0; m < lp->nElements(); m++) {
|
||||
if (constArr[m] != 0.0) {
|
||||
size_t newIndex = elementIndex(lp->elementName(m));
|
||||
if (newIndex == npos) {
|
||||
throw CanteraError("LatticeSolidPhase::installSlavePhases",
|
||||
"element not found");
|
||||
}
|
||||
ecomp[newIndex] = constArr[m];
|
||||
}
|
||||
}
|
||||
addUniqueSpecies(lp->speciesName(k), &ecomp[0], lp->charge(k),
|
||||
lp->size(k));
|
||||
shared_ptr<SpeciesThermoInterpType> stit(
|
||||
newSpeciesThermoInterpType(spNode[k]->child("thermo")));
|
||||
stit->validate(spNode[k]->attrib("name"));
|
||||
m_spthermo->install_STIT(kk, stit);
|
||||
m_speciesData.push_back(new XML_Node(*(spNode[k])));
|
||||
addSpecies(lp->species(k));
|
||||
kk++;
|
||||
}
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -926,6 +926,9 @@ bool Phase::addSpecies(shared_ptr<Species> spec) {
|
|||
void Phase::addSpecies(const std::string& name_, const doublereal* comp,
|
||||
doublereal charge_, doublereal size_)
|
||||
{
|
||||
warn_deprecated("Phase::addSpecies(string, double*, double, double)",
|
||||
"Use AddSpecies(shared_ptr<Species> spec) instead. To be removed "
|
||||
"after Cantera 2.2.");
|
||||
compositionMap cmap;
|
||||
for (size_t i = 0; i < nElements(); i++) {
|
||||
if (comp[i]) {
|
||||
|
|
@ -939,6 +942,9 @@ void Phase::addSpecies(const std::string& name_, const doublereal* comp,
|
|||
void Phase::addUniqueSpecies(const std::string& name_, const doublereal* comp,
|
||||
doublereal charge_, doublereal size_)
|
||||
{
|
||||
warn_deprecated("Phase::addUniqueSpecies",
|
||||
"Use AddSpecies(shared_ptr<Species> spec) instead. To be removed "
|
||||
"after Cantera 2.2.");
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
if (m_speciesNames[k] == name_) {
|
||||
// We have found a match. Do some compatibility checks.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue