From 80f2b8804462b895732135c9852595c5d6e8f79b Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Wed, 23 Jan 2008 01:18:35 +0000 Subject: [PATCH] Incremental update - cleaning up the interface --- Cantera/src/equil/vcs_MultiPhaseEquil.cpp | 22 ++++++++++++++------ Cantera/src/equil/vcs_MultiPhaseEquil.h | 25 +++++++++++++++-------- 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/Cantera/src/equil/vcs_MultiPhaseEquil.cpp b/Cantera/src/equil/vcs_MultiPhaseEquil.cpp index 33e39dce7..4d4635505 100644 --- a/Cantera/src/equil/vcs_MultiPhaseEquil.cpp +++ b/Cantera/src/equil/vcs_MultiPhaseEquil.cpp @@ -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 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; + } - } diff --git a/Cantera/src/equil/vcs_MultiPhaseEquil.h b/Cantera/src/equil/vcs_MultiPhaseEquil.h index 2634c1830..eb41cb803 100644 --- a/Cantera/src/equil/vcs_MultiPhaseEquil.h +++ b/Cantera/src/equil/vcs_MultiPhaseEquil.h @@ -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 /*!