[Python] Add 'kinetics_species_name' and 'kinetics_species_names'

This commit is contained in:
Ray Speth 2019-02-26 14:33:32 -05:00
parent 5ad656e342
commit 5601ee9067
2 changed files with 17 additions and 0 deletions

View file

@ -353,6 +353,7 @@ cdef extern from "cantera/kinetics/Kinetics.h" namespace "Cantera":
int phaseIndex(string)
int kineticsSpeciesIndex(int, int)
int kineticsSpeciesIndex(string)
string kineticsSpeciesName(int)
CxxThermoPhase& thermo(int)

View file

@ -76,6 +76,22 @@ cdef class Kinetics(_SolutionBase):
self._check_phase_index(k)
return self.kinetics.kineticsSpeciesIndex(k, phase)
def kinetics_species_name(self, k):
"""
Name of the species with index *k* in the arrays returned by methods
of class `Kinetics`.
"""
return pystr(self.kinetics.kineticsSpeciesName(k))
property kinetics_species_names:
"""
A list of all species names, corresponding to the arrays returned by
methods of class `Kinetics`.
"""
def __get__(self):
return [self.kinetics_species_name(k)
for k in range(self.n_total_species)]
def reaction(self, int i_reaction):
"""
Return a `Reaction` object representing the reaction with index