1- use crate :: { Contributions , EosError , Verbosity } ;
1+ use crate :: EosError ;
22use pyo3:: exceptions:: PyRuntimeError ;
33use pyo3:: prelude:: * ;
44use pyo3:: { wrap_pymodule, PyErr } ;
5- use quantity:: python:: PyInit_quantity ;
5+ use quantity:: python:: __PYO3_PYMODULE_DEF_QUANTITY ;
66
77mod cubic;
88mod equation_of_state;
@@ -14,83 +14,8 @@ mod statehd;
1414mod user_defined;
1515mod utils;
1616
17- pub use cubic:: PyInit_cubic ;
18- pub use user_defined:: PyInit_user_defined ;
19-
20- /// Helmholtz energy contributions to consider
21- /// when computing a property.
22- #[ pyclass( name = "Contributions" ) ]
23- #[ derive( Copy , Clone ) ]
24- pub struct PyContributions ( pub Contributions ) ;
25-
26- #[ pymethods]
27- impl PyContributions {
28- /// Only compute ideal gas contribution.
29- #[ classattr]
30- #[ allow( non_snake_case) ]
31- pub fn IdealGas ( ) -> Self {
32- Self ( Contributions :: IdealGas )
33- }
34-
35- /// Only compute residual contribution with respect
36- /// to an ideal gas contribution which is defined at
37- /// T, V, {n}.
38- ///
39- /// See also
40- /// --------
41- /// ResidualP: to use an ideal gas reference defined at T, p, {n}
42- #[ classattr]
43- #[ allow( non_snake_case) ]
44- pub fn Residual ( ) -> Self {
45- Self ( Contributions :: Residual )
46- }
47-
48- /// Only compute residual contribution with respect
49- /// to an ideal gas contribution which is defined at
50- /// T, p, {n}.
51- ///
52- /// See also
53- /// --------
54- /// Residual: to use an ideal gas reference defined at T, V, {n}
55- #[ classattr]
56- #[ allow( non_snake_case) ]
57- pub fn ResidualP ( ) -> Self {
58- Self ( Contributions :: ResidualP )
59- }
60-
61- /// Compute all contributions
62- ///
63- /// Note
64- /// ----
65- /// This is the default for most properties.
66- #[ classattr]
67- #[ allow( non_snake_case) ]
68- pub fn Total ( ) -> Self {
69- Self ( Contributions :: Total )
70- }
71- }
72-
73- /// Verbosity levels for iterative solvers.
74- #[ pyclass( name = "Verbosity" ) ]
75- #[ derive( Copy , Clone ) ]
76- pub struct PyVerbosity ( pub Verbosity ) ;
77-
78- #[ pymethods]
79- impl PyVerbosity {
80- /// Print a status message at the end of the iteration.
81- #[ classattr]
82- #[ allow( non_snake_case) ]
83- pub fn Result ( ) -> Self {
84- Self ( Verbosity :: Result )
85- }
86-
87- /// Print a detailed progress of the iteration.
88- #[ classattr]
89- #[ allow( non_snake_case) ]
90- pub fn Iter ( ) -> Self {
91- Self ( Verbosity :: Iter )
92- }
93- }
17+ pub use cubic:: __PYO3_PYMODULE_DEF_CUBIC;
18+ pub use user_defined:: __PYO3_PYMODULE_DEF_USER_DEFINED;
9419
9520impl From < EosError > for PyErr {
9621 fn from ( e : EosError ) -> PyErr {
0 commit comments