From f623e44d323f0fba2e37aff95c7921ec12485564 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Mon, 20 Jul 2015 12:56:56 -0400 Subject: [PATCH] [Kinetics] Eliminate unnecessary m_rrxn and m_prxn variables This information can be extracted from the Reaction objects as-needed. --- include/cantera/kinetics/Kinetics.h | 20 -------------------- include/cantera/thermo/ShomatePoly.h | 8 ++++---- src/kinetics/BulkKinetics.cpp | 2 -- src/kinetics/InterfaceKinetics.cpp | 2 -- src/kinetics/Kinetics.cpp | 10 ++++------ 5 files changed, 8 insertions(+), 34 deletions(-) diff --git a/include/cantera/kinetics/Kinetics.h b/include/cantera/kinetics/Kinetics.h index 015c1fbf2b..e47d70e634 100644 --- a/include/cantera/kinetics/Kinetics.h +++ b/include/cantera/kinetics/Kinetics.h @@ -938,26 +938,6 @@ class Kinetics //! Vector of Reaction objects represented by this Kinetics manager std::vector > m_reactions; - //! m_rrxn is a vector of maps, containing the reactant - //! stoichiometric coefficient information - /*! - * m_rrxn has a length equal to the total number of species in the - * kinetics object. For each species, there exists a map, with the - * reaction number being the key, and the reactant stoichiometric - * coefficient for the species being the value. - */ - std::vector > m_rrxn; - - //! m_prxn is a vector of maps, containing the reactant - //! stoichiometric coefficient information - /** - * m_prxn is a vector of maps. m_prxn has a length equal to the total - * number of species in the kinetics object. For each species, there - * exists a map, with the reaction number being the key, and the product - * stoichiometric coefficient for the species being the value. - */ - std::vector > m_prxn; - std::vector m_rxntype; //! m_thermo is a vector of pointers to ThermoPhase objects that are diff --git a/include/cantera/thermo/ShomatePoly.h b/include/cantera/thermo/ShomatePoly.h index d2e3dcd01c..6caa83e28b 100644 --- a/include/cantera/thermo/ShomatePoly.h +++ b/include/cantera/thermo/ShomatePoly.h @@ -115,10 +115,10 @@ class ShomatePoly : public SpeciesThermoInterpType * - `t[4] = log(t)` * - `t[5] = 1.0/t; * - * @param tt Vector of temperature polynomials - * @param cp_R Vector of Dimensionless heat capacities. (length m_kk). - * @param h_RT Vector of Dimensionless enthalpies. (length m_kk). - * @param s_R Vector of Dimensionless entropies. (length m_kk). + * @param[in] tt Array of evaluated temperature functions + * @param[out] cp_R Dimensionless heat capacity + * @param[out] h_RT Dimensionless enthalpy + * @param[out] s_R Dimensionless entropy */ virtual void updateProperties(const doublereal* tt, doublereal* cp_R, doublereal* h_RT, diff --git a/src/kinetics/BulkKinetics.cpp b/src/kinetics/BulkKinetics.cpp index f7c6dd52f5..a6bb5fdc47 100644 --- a/src/kinetics/BulkKinetics.cpp +++ b/src/kinetics/BulkKinetics.cpp @@ -156,8 +156,6 @@ void BulkKinetics::modifyElementaryReaction(size_t i, ElementaryReaction& rNew) void BulkKinetics::init() { m_kk = thermo().nSpecies(); - m_rrxn.resize(m_kk); - m_prxn.resize(m_kk); m_conc.resize(m_kk); m_grt.resize(m_kk); } diff --git a/src/kinetics/InterfaceKinetics.cpp b/src/kinetics/InterfaceKinetics.cpp index 48ed3ce724..35fb339bb4 100644 --- a/src/kinetics/InterfaceKinetics.cpp +++ b/src/kinetics/InterfaceKinetics.cpp @@ -952,8 +952,6 @@ void InterfaceKinetics::init() for (size_t n = 0; n < nPhases(); n++) { m_kk += thermo(n).nSpecies(); } - m_rrxn.resize(m_kk); - m_prxn.resize(m_kk); m_actConc.resize(m_kk); m_conc.resize(m_kk); m_mu0.resize(m_kk); diff --git a/src/kinetics/Kinetics.cpp b/src/kinetics/Kinetics.cpp index 76c85bc308..e34f8e847d 100644 --- a/src/kinetics/Kinetics.cpp +++ b/src/kinetics/Kinetics.cpp @@ -51,8 +51,6 @@ Kinetics& Kinetics::operator=(const Kinetics& right) m_kk = right.m_kk; m_perturb = right.m_perturb; m_reactions = right.m_reactions; - m_rrxn = right.m_rrxn; - m_prxn = right.m_prxn; m_rxntype = right.m_rxntype; m_thermo = right.m_thermo; // DANGER -> shallow pointer copy @@ -422,12 +420,14 @@ size_t Kinetics::speciesPhaseIndex(size_t k) double Kinetics::reactantStoichCoeff(size_t kSpec, size_t irxn) const { - return getValue(m_rrxn[kSpec], irxn, 0.0); + return getValue(m_reactions[irxn]->reactants, kineticsSpeciesName(kSpec), + 0.0); } double Kinetics::productStoichCoeff(size_t kSpec, size_t irxn) const { - return getValue(m_prxn[kSpec], irxn, 0.0); + return getValue(m_reactions[irxn]->products, kineticsSpeciesName(kSpec), + 0.0); } void Kinetics::getFwdRatesOfProgress(doublereal* fwdROP) @@ -607,7 +607,6 @@ bool Kinetics::addReaction(shared_ptr r) size_t k = kineticsSpeciesIndex(iter->first); rk.push_back(k); rstoich.push_back(iter->second); - m_rrxn[k][irxn] = iter->second; } for (Composition::const_iterator iter = r->products.begin(); @@ -616,7 +615,6 @@ bool Kinetics::addReaction(shared_ptr r) size_t k = kineticsSpeciesIndex(iter->first); pk.push_back(k); pstoich.push_back(iter->second); - m_prxn[k][irxn] = iter->second; } // The default order for each reactant is its stoichiometric coefficient,