diff --git a/build-config/meson.build b/build-config/meson.build index 4a1443a..0dab29f 100644 --- a/build-config/meson.build +++ b/build-config/meson.build @@ -8,8 +8,6 @@ subdir('opatIO') subdir('mpi') subdir('hypre') subdir('pybind') -subdir('mpi') -subdir('hypre') # Set the config file error handling options configErr = get_option('config_error_handling') diff --git a/src/eos/private/EOSio.cpp b/src/eos/private/EOSio.cpp index 65f9f99..03a6b43 100644 --- a/src/eos/private/EOSio.cpp +++ b/src/eos/private/EOSio.cpp @@ -28,7 +28,7 @@ #include namespace serif::eos { - EOSio::EOSio(const std::string filename) : m_filename(filename) { + EOSio::EOSio(const std::string &filename) : m_filename(filename) { load(); } diff --git a/src/eos/public/EOSio.h b/src/eos/public/EOSio.h index 5312b67..1882c07 100644 --- a/src/eos/public/EOSio.h +++ b/src/eos/public/EOSio.h @@ -33,7 +33,7 @@ namespace serif::eos { >; /** - * @class EosIO + * @class EOSio * @brief Handles the input/output operations for EOS tables. * * The EosIO class is responsible for loading and managing EOS tables from files. @@ -67,7 +67,7 @@ namespace serif::eos { * @brief Constructs an EosIO object with the given filename. * @param filename The filename of the EOS table. */ - explicit EOSio(const std::string filename); + explicit EOSio(const std::string &filename); /** * @brief Default destructor. @@ -78,15 +78,15 @@ namespace serif::eos { * @brief Gets the format of the EOS table. * @return The format of the EOS table as a string. */ - std::string getFormat() const; + [[nodiscard]] std::string getFormat() const; /** * @brief Gets the EOS table. * @return A reference to the EOS table. */ - EOSTable& getTable(); + [[nodiscard]] EOSTable& getTable(); - std::string getFilename() const { return m_filename; } + [[nodiscard]] std::string getFilename() const { return m_filename; } }; } diff --git a/src/eos/public/helm.h b/src/eos/public/helm.h index e3031e9..2577ea4 100644 --- a/src/eos/public/helm.h +++ b/src/eos/public/helm.h @@ -342,8 +342,8 @@ namespace serif::eos::helmholtz { * @param w1md Weight 1 for density (minus). * @return Result of the polynomial. */ - double h3(double fi[36], double w0t, double w1t, double w0mt, double w1mt, - double w0d, double w1d, double w0md, double w1md); + double h3(const std::array &fi, const double w0t, const double w1t, const double w0mt, const double w1mt, + const double w0d, const double w1d, const double w0md, const double w1md); /** * @brief Interpolating polynomial function h5. @@ -362,16 +362,16 @@ namespace serif::eos::helmholtz { * @param w2md Weight 2 for density (minus). * @return Result of the polynomial. */ - double h5(double fi[36], double w0t, double w1t, double w2t, double w0mt, - double w1mt, double w2mt, double w0d, double w1d, double w2d, - double w0md, double w1md, double w2md); + double h5(const std::array &fi, const double w0t, const double w1t, const double w2t, const double w0mt, + const double w1mt, const double w2mt, const double w0d, const double w1d, const double w2d, + const double w0md, const double w1md, const double w2md); /** * @brief Read the Helmholtz EOS table from a file. * @param filename Path to the file containing the table. * @return HELMTable structure containing the table data. */ - std::unique_ptr read_helm_table(const std::string filename); + std::unique_ptr read_helm_table(const std::string& filename); /** * @brief Calculate the Helmholtz EOS components. diff --git a/src/python/eos/bindings.cpp b/src/python/eos/bindings.cpp index 18218b3..1e30219 100644 --- a/src/python/eos/bindings.cpp +++ b/src/python/eos/bindings.cpp @@ -8,34 +8,38 @@ // #include "resourceManager.h" #include "bindings.h" #include "EOSio.h" -#include "../../eos/public/helm.h" +#include "helm.h" + +namespace serif::eos { + class EOSio; +} namespace py = pybind11; void register_eos_bindings(pybind11::module &eos_submodule) { - py::class_(eos_submodule, "EOSio") + py::class_(eos_submodule, "EOSio") .def(py::init(), py::arg("filename")) // .def("load", &EOSio::load) - .def("getFormat", &EOSio::getFormat, "Get the format of the EOS table.") + .def("getFormat", &serif::eos::EOSio::getFormat, "Get the format of the EOS table.") - .def("__repr__", [](const EOSio &eos) { + .def("__repr__", [](const serif::eos::EOSio &eos) { return ""; }); - py::class_(eos_submodule, "EOSTable"); + py::class_(eos_submodule, "EOSTable"); - py::class_(eos_submodule, "HELMTable") - .def_readonly("loaded", &helmholtz::HELMTable::loaded) - .def_readonly("imax", &helmholtz::HELMTable::imax) - .def_readonly("jmax", &helmholtz::HELMTable::jmax) - .def_readonly("t", &helmholtz::HELMTable::t) - .def_readonly("d", &helmholtz::HELMTable::d) - .def("__repr__", [](const helmholtz::HELMTable &table) { + py::class_(eos_submodule, "HELMTable") + .def_readonly("loaded", &serif::eos::helmholtz::HELMTable::loaded) + .def_readonly("imax", &serif::eos::helmholtz::HELMTable::imax) + .def_readonly("jmax", &serif::eos::helmholtz::HELMTable::jmax) + .def_readonly("t", &serif::eos::helmholtz::HELMTable::t) + .def_readonly("d", &serif::eos::helmholtz::HELMTable::d) + .def("__repr__", [](const serif::eos::helmholtz::HELMTable &table) { return ""; }) - .def_property_readonly("f", [](helmholtz::HELMTable &table) -> py::array_t { + .def_property_readonly("f", [](serif::eos::helmholtz::HELMTable &table) -> py::array_t { // --- Check Preconditions --- // 1. Check if dimensions are valid if (table.imax <= 0 || table.jmax <= 0) { @@ -57,8 +61,10 @@ void register_eos_bindings(pybind11::module &eos_submodule) { // --- Define NumPy array shape and strides --- std::vector shape = {rows, cols}; - std::vector strides = {cols * sizeof(double), // Stride to next row - sizeof(double)}; // Stride to next element in row + std::vector strides = { + static_cast(cols * sizeof(double)), // Stride to next row + static_cast( sizeof(double)) // Stride to next element in row + }; // --- Create and return the py::array_t --- // py::cast(table) creates a py::object that acts as the 'base'.