From aac951c2bb97a227d7dfa9ebaa2bd9ff5181ffc4 Mon Sep 17 00:00:00 2001
From: Rahil Doshi <rahil.doshi@fau.de>
Date: Mon, 27 Jan 2025 16:22:37 +0100
Subject: [PATCH] Add module.cpp to expose C++ functions to Python

---
 src/pymatlib/core/cpp/module.cpp | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 src/pymatlib/core/cpp/module.cpp

diff --git a/src/pymatlib/core/cpp/module.cpp b/src/pymatlib/core/cpp/module.cpp
new file mode 100644
index 0000000..3c80f29
--- /dev/null
+++ b/src/pymatlib/core/cpp/module.cpp
@@ -0,0 +1,26 @@
+#include <pybind11/pybind11.h>
+#include <pybind11/numpy.h>
+#include "include/binary_search_interpolation.h"
+#include "include/double_lookup_interpolation.h"
+
+namespace py = pybind11;
+
+PYBIND11_MODULE(fast_interpolation, m) {
+    m.doc() = "Fast interpolation methods implementation";
+
+    m.def("interpolate_binary_search",
+          &interpolate_binary_search,
+          "Find temperature using binary search and linear interpolation",
+          py::arg("temperature_array"),
+          py::arg("h_in"),
+          py::arg("energy_density_array"));
+
+    m.def("interpolate_double_lookup",
+          &interpolate_double_lookup,
+          "Fast interpolation using double lookup method and linear interpolation",
+          py::arg("E_target"),
+          py::arg("T_eq"),
+          py::arg("E_neq"),
+          py::arg("E_eq"),
+          py::arg("idx_map"));
+}
-- 
GitLab