diff -r 7ec1cfe19a24 -r a4137aedcb3a src/dolfinx_access/nanobind_helpers.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/dolfinx_access/nanobind_helpers.cc Thu Feb 26 09:32:12 2026 -0500 @@ -0,0 +1,29 @@ +/// Helpers to transmit nanobind C++ → Python bindings Python → Rust → C++. +#include +#include + +#include "pointsource_pde/include/dolfinx_access/nanobind_helpers.h" + +using namespace nanobind; + +namespace dolfinx_access { + bool check_Function_f64(const PyObject* obj) { + auto handle = nanobind::handle(obj); + return nanobind::isinstance(handle); + } + + const Function_f64* cast_Function_f64(const PyObject* obj) { + auto handle = nanobind::handle(obj); + return nanobind::cast(handle); + } + + Function_f64* cast_mut_Function_f64(PyObject* obj) { + auto handle = nanobind::handle(obj); + return nanobind::cast(handle); + } + + PyObject* wrap_Function_f64(Function_f64* f) { + return nanobind::cast(f).release().ptr(); + } + +} // namespace dolfinx_access