From 2a50dc50f714a2a49b4b19b9c1d2103d38d2c40b Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Thu, 8 Jan 2015 23:36:24 +0000 Subject: [PATCH] [Thermo] Add accessor for Species objects --- include/cantera/thermo/Phase.h | 3 +++ src/thermo/Phase.cpp | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/include/cantera/thermo/Phase.h b/include/cantera/thermo/Phase.h index ece75da69..5a9fe873e 100644 --- a/include/cantera/thermo/Phase.h +++ b/include/cantera/thermo/Phase.h @@ -738,6 +738,9 @@ public: doublereal charge = 0.0, doublereal size = 1.0); + //! Return the Species object for the named species. + const Species& species(const std::string& name) const; + //! Set behavior when adding a species containing undefined elements to just //! skip the species. void ignoreUndefinedElements(); diff --git a/src/thermo/Phase.cpp b/src/thermo/Phase.cpp index 69f4d260c..56b03e9ac 100644 --- a/src/thermo/Phase.cpp +++ b/src/thermo/Phase.cpp @@ -946,6 +946,11 @@ void Phase::addUniqueSpecies(const std::string& name_, const doublereal* comp, addSpecies(name_, comp, charge_, size_); } +const Species& Phase::species(const std::string& name) const +{ + return getValue(m_species, name); +} + void Phase::ignoreUndefinedElements() { m_undefinedElementBehavior = UndefElement::ignore; }