[Python] add ctypedef for Composition
This commit is contained in:
parent
dc3af8a58d
commit
af93dc774d
2 changed files with 11 additions and 9 deletions
|
|
@ -7,6 +7,8 @@ from cpython cimport bool as pybool
|
|||
import numpy as np
|
||||
cimport numpy as np
|
||||
|
||||
ctypedef stdmap[string,double] Composition
|
||||
|
||||
cdef extern from "cantera/base/xml.h" namespace "Cantera":
|
||||
cdef cppclass XML_Node:
|
||||
XML_Node* findByName(string)
|
||||
|
|
@ -56,11 +58,11 @@ cdef extern from "cantera/thermo/SpeciesThermoFactory.h":
|
|||
cdef extern from "cantera/thermo/Species.h" namespace "Cantera":
|
||||
cdef cppclass CxxSpecies "Cantera::Species":
|
||||
CxxSpecies()
|
||||
CxxSpecies(string, stdmap[string,double])
|
||||
CxxSpecies(string, Composition)
|
||||
shared_ptr[CxxSpeciesThermo] thermo
|
||||
|
||||
string name
|
||||
stdmap[string,double] composition
|
||||
Composition composition
|
||||
double charge
|
||||
double size
|
||||
|
||||
|
|
@ -120,17 +122,17 @@ cdef extern from "cantera/thermo/ThermoPhase.h" namespace "Cantera":
|
|||
|
||||
# composition
|
||||
void setMassFractionsByName(string) except +
|
||||
void setMassFractionsByName(stdmap[string,double]&) except +
|
||||
void setMassFractionsByName(Composition&) except +
|
||||
void setMassFractions_NoNorm(double*) except +
|
||||
stdmap[string,double] getMassFractionsByName(double)
|
||||
Composition getMassFractionsByName(double)
|
||||
double massFraction(size_t) except +
|
||||
double massFraction(string) except +
|
||||
|
||||
void setMoleFractionsByName(string) except +
|
||||
void setMoleFractionsByName(stdmap[string,double]&) except +
|
||||
void setMoleFractionsByName(Composition&) except +
|
||||
void setMoleFractions_NoNorm(double*) except +
|
||||
void getMoleFractions(double*) except +
|
||||
stdmap[string,double] getMoleFractionsByName(double)
|
||||
Composition getMoleFractionsByName(double)
|
||||
double moleFraction(size_t) except +
|
||||
double moleFraction(string) except +
|
||||
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@ cdef enum Thermasis:
|
|||
molar_basis = 1
|
||||
|
||||
|
||||
cdef stdmap[string,double] comp_map(dict X) except *:
|
||||
cdef stdmap[string,double] m
|
||||
cdef Composition comp_map(dict X) except *:
|
||||
cdef Composition m
|
||||
for species,value in X.items():
|
||||
m[stringify(species)] = value
|
||||
return m
|
||||
|
||||
cdef comp_map_to_dict(stdmap[string,double] m):
|
||||
cdef comp_map_to_dict(Composition m):
|
||||
return {pystr(species):value for species,value in m.items()}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue