diff --git a/include/cantera/thermo/Phase.h b/include/cantera/thermo/Phase.h index 8a8009e49..dddc81e11 100644 --- a/include/cantera/thermo/Phase.h +++ b/include/cantera/thermo/Phase.h @@ -781,6 +781,9 @@ public: //! Return the Species object for the named species. shared_ptr species(const std::string& name) const; + //! Return the Species object for species whose index is *k*. + shared_ptr species(size_t k) 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 7379d5974..4486f7bdc 100644 --- a/src/thermo/Phase.cpp +++ b/src/thermo/Phase.cpp @@ -971,6 +971,11 @@ shared_ptr Phase::species(const std::string& name) const return getValue(m_species, name); } +shared_ptr Phase::species(size_t k) const +{ + return species(m_speciesNames[k]); +} + void Phase::ignoreUndefinedElements() { m_undefinedElementBehavior = UndefElement::ignore; }