[Cython] Added access to the "id" property of ThermoPhase objects

This commit is contained in:
Ray Speth 2013-05-29 00:10:58 +00:00
parent 9631f44d29
commit 62dfdcfb01
3 changed files with 19 additions and 0 deletions

View file

@ -47,6 +47,8 @@ cdef extern from "cantera/thermo/ThermoPhase.h" namespace "Cantera":
string report(cbool) except +
string name()
void setName(string)
string id()
void setID(string)
double minTemp() except +
double maxTemp() except +
double refPressure() except +

View file

@ -64,6 +64,13 @@ class TestThermoPhase(utilities.CanteraTest):
self.assertEqual(self.phase.name, 'something')
self.assertTrue('something' in self.phase.report())
def test_ID(self):
self.assertEqual(self.phase.ID, 'ohmech')
self.phase.ID = 'something'
self.assertEqual(self.phase.ID, 'something')
self.assertEqual(self.phase.name, 'ohmech')
def test_badLength(self):
X = np.zeros(5)
def set_X():

View file

@ -43,6 +43,16 @@ cdef class ThermoPhase(_SolutionBase):
def __set__(self, name):
self.thermo.setName(stringify(name))
property ID:
"""
The ID of the phase. The default is taken from the CTI/XML input file.
"""
def __get__(self):
return pystr(self.thermo.id())
def __set__(self, id_):
self.thermo.setID(stringify(id_))
property basis:
"""
Determines whether intensive thermodynamic properties are treated on a