added method concentration(int k)

This commit is contained in:
Dave Goodwin 2006-11-07 13:47:39 +00:00
parent a1d59baa09
commit 36f3254010
2 changed files with 16 additions and 0 deletions

View file

@ -107,6 +107,16 @@ namespace Cantera {
}
}
doublereal State::concentration(int k) const {
if (k >= 0 && k < m_kk) {
return m_y[k] * m_dens * m_rmolwts[k] ;
}
else {
throw CanteraError("State:massFraction",
"illegal species index number");
}
}
void State::setMassFractions(const doublereal* y) {
doublereal norm = 0.0, sum = 0.0;
int k;

View file

@ -156,6 +156,12 @@ namespace Cantera {
*/
void getConcentrations(doublereal* c) const;
/**
* Concentration of species k. If k is outside the valid
* range, an exception will be thrown.
*/
doublereal concentration(int k) const;
/**
* Set the concentrations to the specified values within the
* phase.