minor cleanup

This commit is contained in:
Dave Goodwin 2003-10-22 00:33:02 +00:00
parent d456c04a55
commit f8ebd79be9
2 changed files with 16 additions and 23 deletions

View file

@ -16,7 +16,6 @@
*/
#include "utilities.h"
//#include "updaters.h"
#include "ctexceptions.h"
#include "State.h"
@ -26,7 +25,6 @@ namespace Cantera {
State::~State() {}
/// The mole fraction of species k.
doublereal State::moleFraction(int k) const {
if (k >= 0 && k < m_kk) {
return m_ym[k] * m_mmw;
@ -59,7 +57,6 @@ namespace Cantera {
}
}
/// Mass fraction of species k.
doublereal State::massFraction(int k) const {
if (k >= 0 && k < m_kk) {
return m_y[k];
@ -82,7 +79,6 @@ namespace Cantera {
sum += m_ym[k];
}
m_mmw = 1.0/sum;
////m_C_updater.need_update();
}
void State::setMassFractions_NoNorm(const doublereal* y) {
@ -94,21 +90,16 @@ namespace Cantera {
sum += m_ym[k];
}
m_mmw = 1.0/sum;
//copy(y, y + m_kk, m_y.begin());
//m_C_updater.need_update();
}
/// Evaluate \f$ \sum_k X_k \log X_k \f$.
doublereal State::sum_xlogx() const {
return m_mmw*_sum_xlogx(m_ym.begin(), m_ym.end()) + log(m_mmw);
}
/// Evaluate \f$ \sum_k X_k \log Q_k \f$.
doublereal State::sum_xlogQ(doublereal* Q) const {
return m_mmw * _sum_xlogQ(m_ym.begin(), m_ym.end(), Q);
}
/// set the concentrations to the specified values
void State::setConcentrations(const doublereal* c) {
int k;
doublereal sum = 0.0, norm = 0.0;
@ -123,7 +114,6 @@ namespace Cantera {
m_ym[k] = c[k] * rsum;
m_y[k] = m_ym[k] * m_molwts[k];
}
//m_C_updater.need_update();
}
void State::init(const array_fp& mw) {
@ -139,9 +129,10 @@ namespace Cantera {
"negative molecular weight for species number "+int2str(k));
}
/*
* Some surface phases may define species representing empty sites that
* have zero molecular weight. Give them a very small molecular weight to
* avoid dividing by zero.
* Some surface phases may define species representing
* empty sites that have zero molecular weight. Give them
* a very small molecular weight to avoid dividing by
* zero.
*/
if (m_molwts[k] < Tiny) m_molwts[k] = Tiny;
m_rmolwts[k] = 1.0/m_molwts[k];

View file

@ -20,7 +20,6 @@
#define CT_STATE2_H
#include "utilities.h"
//#include "updaters.h"
#include "ctexceptions.h"
namespace Cantera {
@ -53,9 +52,8 @@ namespace Cantera {
*/
virtual ~State();
/**
* Return a read-only reference to the vector of molecular
* Return a read-only reference to the array of molecular
* weights.
*/
const array_fp& molecularWeights() const { return m_molwts; }
@ -87,6 +85,11 @@ namespace Cantera {
*/
void setMoleFractions_NoNorm(const doublereal* x);
/**
* Get the species mass fractions.
* @param y On return, y contains the mass fractions. Array y
* must have a length at least as large as the number of species.
*/
void getMassFractions(size_t leny, doublereal* y) const {
copy(m_y.begin(), m_y.end(), y);
}
@ -120,9 +123,10 @@ namespace Cantera {
void setMassFractions_NoNorm(const doublereal* y);
/**
* Get the species concentrations (kmol/m^3). @param c On return, c
* contains the concentrations. Array \i c must have a length
* greater than or equal to the number of species.
* Get the species concentrations (kmol/m^3).
* @param c On return, \i c contains the concentrations.
* Array \i c must have a length greater than or equal to
* the number of species.
*/
void getConcentrations(doublereal* c) const {
doublereal f = m_dens;
@ -200,7 +204,8 @@ namespace Cantera {
* Set the concentrations to the specified values within the
* phase. This is the MAIN function for internally setting
* the composition of a phase. It sets all of the internal
* parameters within the state object. These are:
* parameters within the state object except the temperature.
* These are:
* m_dens = density of state
* m_ym[k] = mole fraction of species k / MolecWeight species k
* m_y[k] = Mass fractions of species k
@ -232,9 +237,6 @@ namespace Cantera {
protected:
//PropertyUpdater& updater_T() { return m_T_updater; }
//PropertyUpdater& updater_C() { return m_C_updater; }
/**
* @internal
* Initialize. Make a local copy of the vector of