feat(python): added robust python bindings covering the entire codebase
This commit is contained in:
20
src/python/utils/bindings.cpp
Normal file
20
src/python/utils/bindings.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#include <pybind11/pybind11.h>
|
||||
#include <pybind11/stl.h> // Needed for vectors, maps, sets, strings
|
||||
#include <pybind11/stl_bind.h> // Needed for binding std::vector, std::map etc. if needed directly
|
||||
|
||||
#include "bindings.h"
|
||||
|
||||
namespace py = pybind11;
|
||||
|
||||
#include "gridfire/utils/logging.h"
|
||||
|
||||
void register_utils_bindings(py::module &m) {
|
||||
m.def("formatNuclearTimescaleLogString",
|
||||
&gridfire::utils::formatNuclearTimescaleLogString,
|
||||
py::arg("engine"),
|
||||
py::arg("Y"),
|
||||
py::arg("T9"),
|
||||
py::arg("rho"),
|
||||
"Format a string for logging nuclear timescales based on temperature, density, and energy generation rate."
|
||||
);
|
||||
}
|
||||
5
src/python/utils/bindings.h
Normal file
5
src/python/utils/bindings.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <pybind11/pybind11.h>
|
||||
|
||||
void register_utils_bindings(pybind11::module &m);
|
||||
17
src/python/utils/meson.build
Normal file
17
src/python/utils/meson.build
Normal file
@@ -0,0 +1,17 @@
|
||||
# Define the library
|
||||
bindings_sources = files('bindings.cpp')
|
||||
bindings_headers = files('bindings.h')
|
||||
|
||||
dependencies = [
|
||||
gridfire_dep,
|
||||
python3_dep,
|
||||
pybind11_dep,
|
||||
]
|
||||
|
||||
shared_module('py_gf_utils',
|
||||
bindings_sources,
|
||||
cpp_args: ['-fvisibility=default'],
|
||||
install : true,
|
||||
dependencies: dependencies,
|
||||
include_directories: include_directories('.')
|
||||
)
|
||||
Reference in New Issue
Block a user