SERiF 0.0.1a
3+1D Stellar Structure and Evolution
Loading...
Searching...
No Matches
bindings.cpp
Go to the documentation of this file.
1#include <pybind11/pybind11.h>
2#include <pybind11/stl.h> // Needed for vectors, maps, sets, strings
3#include <pybind11/stl_bind.h> // Needed for binding std::vector, std::map etc if needed directly
4#include <pybind11/numpy.h>
5
6#include "bindings.h"
7#include "EOSio.h"
8#include "helm.h"
9#include "polySolver.h"
10#include "mfem.hpp"
11
12namespace py = pybind11;
13
14void register_polytrope_bindings(pybind11::module &polytrope_submodule) {
15 py::class_<serif::polytrope::PolySolver>(polytrope_submodule, "PolySolver")
16 .def(py::init<double, int>(), py::arg("polytropic_index"), py::arg("FEM_order"))
17 .def("solve", &serif::polytrope::PolySolver::solve, "Solve the polytrope equation.")
18 .def("get_theta", &serif::polytrope::PolySolver::getTheta, py::return_value_policy::reference_internal)
19 .def("get_phi", &serif::polytrope::PolySolver::getPhi, py::return_value_policy::reference_internal)
22
23 py::class_<serif::polytrope::PolytropeOperator, mfem::Operator>(polytrope_submodule, "PolytropeOperator")
25
26}
void solve() const
Solves the polytropic system.
mfem::GridFunction & getPhi() const
Gets a reference to the solution grid function for .
Definition polySolver.h:281
mfem::GridFunction & getTheta() const
Gets a reference to the solution grid function for .
Definition polySolver.h:274
double getN() const
Gets the polytropic index .
Definition polySolver.h:255
double getOrder() const
Gets the finite element order used for the variable.
Definition polySolver.h:261
void Mult(const mfem::Vector &xFree, mfem::Vector &yFree) const override
Applies the PolytropeOperator: y = F(x). This computes the residual of the nonlinear system.
void register_polytrope_bindings(pybind11::module &polytrope_submodule)
Registers C++ classes and functions from the serif::polytrope namespace to Python.
Definition bindings.cpp:14
Declares the function to register polytrope module C++ components with pybind11.