diff --git a/src/eos/public/helm.h b/src/eos/public/helm.h index 2577ea4..41b2cf5 100644 --- a/src/eos/public/helm.h +++ b/src/eos/public/helm.h @@ -35,8 +35,8 @@ #include "debug.h" namespace serif::eos::helmholtz { - constexpr int IMAX = 541; - constexpr int JMAX = 201; + static constexpr int IMAX = 541; + static constexpr int JMAX = 201; /** * @brief 2D array template alias. * @tparam T Type of the array elements. diff --git a/src/python/eos/bindings.cpp b/src/python/eos/bindings.cpp index 1e30219..6410a2d 100644 --- a/src/python/eos/bindings.cpp +++ b/src/python/eos/bindings.cpp @@ -9,6 +9,8 @@ #include "bindings.h" #include "EOSio.h" #include "helm.h" +#include "../../eos/public/EOSio.h" +#include "../../eos/public/helm.h" namespace serif::eos { class EOSio; @@ -22,7 +24,18 @@ void register_eos_bindings(pybind11::module &eos_submodule) { .def(py::init(), py::arg("filename")) // .def("load", &EOSio::load) .def("getFormat", &serif::eos::EOSio::getFormat, "Get the format of the EOS table.") + .def("getTable", [](serif::eos::EOSio &self) -> serif::eos::helmholtz::HELMTable* { + auto& table_variant = self.getTable(); + // Use std::get_if to safely access the contents of the variant. + // This returns a pointer to the value if the variant holds that type, otherwise nullptr. + if (auto* ptr_to_unique_ptr = std::get_if>(&table_variant)) { + return (*ptr_to_unique_ptr).get(); + } + + return nullptr; + }, py::return_value_policy::reference_internal, // IMPORTANT: Keep this policy! + "Get the EOS table data.") .def("__repr__", [](const serif::eos::EOSio &eos) { return ""; }); @@ -77,4 +90,17 @@ void register_eos_bindings(pybind11::module &eos_submodule) { py::cast(table) // Owner object (keeps C++ object alive) ); }, py::return_value_policy::reference_internal); // Keep parent 'table' alive - } + + py::class_(eos_submodule, "EOSInput") + .def(py::init<>()) + .def_readwrite("T", &serif::eos::helmholtz::EOSInput::T) + .def_readwrite("rho", &serif::eos::helmholtz::EOSInput::rho) + .def_readwrite("abar", &serif::eos::helmholtz::EOSInput::abar) + .def_readwrite("zbar", &serif::eos::helmholtz::EOSInput::zbar) + .def("__repr__", [](const serif::eos::helmholtz::EOSInput &input) { + return ""; + }); +}