Loading...
Searching...
No Matches
bindings.cpp
Go to the documentation of this file.
#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/network.h"
void register_type_bindings(pybind11::module &m) {
py::class_<gridfire::NetIn>(m, "NetIn")
.def(py::init<>())
.def_readwrite("composition", &gridfire::NetIn::composition)
.def_readwrite("tMax", &gridfire::NetIn::tMax)
.def_readwrite("dt0", &gridfire::NetIn::dt0)
.def_readwrite("temperature", &gridfire::NetIn::temperature)
.def_readwrite("density", &gridfire::NetIn::density)
.def_readwrite("energy", &gridfire::NetIn::energy)
.def("__repr__", [](const gridfire::NetIn &netIn) {
std::stringstream ss;
ss << "NetIn(composition=" << netIn.composition
<< ", tMax=" << netIn.tMax
<< ", dt0=" << netIn.dt0
<< ", temperature=" << netIn.temperature
<< ", density=" << netIn.density
<< ", energy=" << netIn.energy << ")";
return ss.str();
});
py::class_<gridfire::NetOut>(m, "NetOut")
.def_readonly("composition", &gridfire::NetOut::composition)
.def_readonly("num_steps", &gridfire::NetOut::num_steps)
.def_readonly("energy", &gridfire::NetOut::energy)
.def("__repr__", [](const gridfire::NetOut &netOut) {
std::stringstream ss;
ss << "NetOut(composition=" << netOut.composition
<< ", num_steps=" << netOut.num_steps
<< ", energy=" << netOut.energy << ")";
return ss.str();
});
}
network.h
gridfire::NetIn
Definition network.h:53
gridfire::NetIn::density
double density
Density in g/cm^3.
Definition network.h:58
gridfire::NetIn::tMax
double tMax
Maximum time.
Definition network.h:55
gridfire::NetIn::composition
fourdst::composition::Composition composition
Composition of the network.
Definition network.h:54
gridfire::NetIn::dt0
double dt0
Initial time step.
Definition network.h:56
gridfire::NetIn::temperature
double temperature
Temperature in Kelvin.
Definition network.h:57
gridfire::NetIn::energy
double energy
Energy in ergs.
Definition network.h:59
gridfire::NetOut
Definition network.h:65
gridfire::NetOut::composition
fourdst::composition::Composition composition
Composition of the network after evaluation.
Definition network.h:66
gridfire::NetOut::energy
double energy
Energy in ergs after evaluation.
Definition network.h:68
gridfire::NetOut::num_steps
int num_steps
Number of steps taken in the evaluation.
Definition network.h:67
register_type_bindings
void register_type_bindings(pybind11::module &m)
Definition bindings.cpp:11
bindings.h