Incremental update - cleaning up the interface

This commit is contained in:
Harry Moffat 2008-01-23 01:18:35 +00:00
parent 7f88caa782
commit 80f2b88044
2 changed files with 32 additions and 15 deletions

View file

@ -1621,14 +1621,18 @@ namespace VCSnonideal {
// This routine hasn't been checked yet
void vcs_MultiPhaseEquil::getStoichVector(index_t rxn, Cantera::vector_fp& nu) {
index_t k;
nu.resize(m_nsp, 0.0);
int k;
int nsp = m_vsolvePtr->m_numSpeciesTot;
nu.resize(nsp, 0.0);
for (int i = 0; i < nsp; i++) {
nu[i] = 0.0;
}
int nc = numComponents();
const DoubleStarStar &scMatrix = m_vsolvePtr->sc;
const std::vector<int> indSpecies = m_vsolvePtr->ind;
if (rxn > m_nsp - nc) return;
for (k = 0; k < m_nsp; k++) {
int j = indSpecies[j];
if ((int) rxn > nsp - nc) return;
for (k = 0; k < nsp; k++) {
int j = indSpecies[k];
nu[j] = scMatrix[rxn][k];
}
}
@ -1648,6 +1652,12 @@ namespace VCSnonideal {
}
return nec;
}
int vcs_MultiPhaseEquil::component(int m) const {
int nc = numComponents();
if (m < nc) return m_vsolvePtr->ind[m];
else return -1;
}
}

View file

@ -1,5 +1,5 @@
/**
* @file vcs_MultiPhase.h
* @file vcs_MultiPhaseEquil.h
* Interface class for the vcsnonlinear solver
*/
@ -237,15 +237,22 @@ namespace VCSnonideal {
//! Destructor for the class
virtual ~vcs_MultiPhaseEquil();
int constituent(index_t m) {
if (m < m_nel) return m_order[m];
else return -1;
}
//! Return the index of the ith component
/*!
* Returns the index of the ith component in the equilibrium
* calculation. The index refers to the ordering of the species
* in the MultiPhase object.
*/
int component(int m) const ;
//! Get the stoichiometric matrix for a single reaction index
//! Get the stoichiometric reaction matrix for a single reaction index
/*!
* This returns a stoichiometric reaction matrix for a single
* formation reaction.
* formation reaction for a noncomponent species.
*
*
* @param rxn Reaction number.
* @param nu Vector of coefficients for the formation reaction.
*/
void getStoichVector(index_t rxn, Cantera::vector_fp& nu);
@ -374,10 +381,10 @@ namespace VCSnonideal {
//! Number of elements in the combined element object describing all of the
//! phases.
index_t m_nel;
//index_t m_nel;
//! Number of species in the combined multiphase object
index_t m_nsp;
//index_t m_nsp;
//! Vector that takes into account of the current sorting of the species
/*!