[Python] Add repr functions to Species/Reaction classes

This commit is contained in:
Ray Speth 2015-05-24 19:45:26 -04:00
parent 2610af703f
commit af3e34ccb0
2 changed files with 14 additions and 0 deletions

View file

@ -224,6 +224,12 @@ cdef class Reaction:
def __set__(self, allow):
self.reaction.allow_negative_orders = allow
def __repr__(self):
return '<{}: {}>'.format(self.__class__.__name__, self.equation)
def __str__(self):
return self.equation
cdef class Arrhenius:
r"""
@ -268,6 +274,11 @@ cdef class Arrhenius:
def __get__(self):
return self.rate.activationEnergy_R() * gas_constant
def __repr__(self):
return 'Arrhenius(A={:g}, b={:g}, E={:g})'.format(
self.pre_exponential_factor, self.temperature_exponent,
self.activation_energy)
cdef wrapArrhenius(CxxArrhenius* rate, Reaction reaction):
r = Arrhenius(init=False)

View file

@ -198,6 +198,9 @@ cdef class Species:
def __set__(self, GasTransportData tran):
self.species.transport = tran._data
def __repr__(self):
return '<Species {}>'.format(self.name)
cdef class ThermoPhase(_SolutionBase):
"""