feat(pythonInterface/polytrope): added initial polytrope implimentation to the python interface
currently this can only interface with polySolver; however, it does work 100% to run a model. The biggest caveat is that at this time there is no way to get the actual results out of the model other than to visualize them in GLVis or use the limited output dumped in the output directory
This commit is contained in:
15
src/python/polytrope/bindings.cpp
Normal file
15
src/python/polytrope/bindings.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#include "bindings.h"
|
||||
#include "EOSio.h"
|
||||
#include "helm.h"
|
||||
#include "polySolver.h"
|
||||
#include "../../polytrope/solver/public/polySolver.h"
|
||||
#include "../../polytrope/utils/public/polytropeOperator.h"
|
||||
|
||||
namespace py = pybind11;
|
||||
|
||||
void register_polytrope_bindings(pybind11::module &polytrope_submodule) {
|
||||
py::class_<serif::polytrope::PolySolver>(polytrope_submodule, "PolySolver")
|
||||
.def(py::init<double, int>(), py::arg("polytropic_index"), py::arg("FEM_order"))
|
||||
.def("solve", &serif::polytrope::PolySolver::solve, "Solve the polytrope equation.");
|
||||
|
||||
}
|
||||
5
src/python/polytrope/bindings.h
Normal file
5
src/python/polytrope/bindings.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <pybind11/pybind11.h>
|
||||
|
||||
void register_polytrope_bindings(pybind11::module &polytrope_submodule);
|
||||
19
src/python/polytrope/meson.build
Normal file
19
src/python/polytrope/meson.build
Normal file
@@ -0,0 +1,19 @@
|
||||
# Define the library
|
||||
bindings_sources = files('bindings.cpp')
|
||||
bindings_headers = files('bindings.h')
|
||||
|
||||
dependencies = [
|
||||
polysolver_dep,
|
||||
config_dep,
|
||||
resourceManager_dep,
|
||||
python3_dep,
|
||||
pybind11_dep,
|
||||
]
|
||||
|
||||
shared_module('py_polytrope',
|
||||
bindings_sources,
|
||||
include_directories: include_directories('.'),
|
||||
cpp_args: ['-fvisibility=default'],
|
||||
install : true,
|
||||
dependencies: dependencies,
|
||||
)
|
||||
Reference in New Issue
Block a user