Skip to content

Commit

Permalink
Generalize InterfacePhase type checking routine
Browse files Browse the repository at this point in the history
  • Loading branch information
jongyoonbae committed Feb 2, 2023
1 parent 1a7831d commit a231f32
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion interfaces/cython/cantera/thermo.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ cdef enum ThermoBasisType:
molar_basis = 1

ctypedef CxxPlasmaPhase* CxxPlasmaPhasePtr
ctypedef CxxSurfPhase* CxxSurfPhasePtr

class ThermoModelMethodError(Exception):
"""Exception raised for an invalid method used by a thermo model
Expand Down Expand Up @@ -1874,7 +1875,7 @@ cdef class InterfacePhase(ThermoPhase):
def __cinit__(self, *args, **kwargs):
if not kwargs.get("init", True):
return
if pystr(self.thermo.type()) not in ("Surf", "Edge"):
if not dynamic_cast[CxxSurfPhasePtr](self.thermo):
raise TypeError('Underlying ThermoPhase object is of the wrong type.')
self.surf = <CxxSurfPhase*>(self.thermo)

Expand Down

0 comments on commit a231f32

Please sign in to comment.