GridFire 0.0.1a General Purpose Nuclear Network

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
5#include "bindings.h"
6
7 namespace py = pybind11;
8
9#include "gridfire/network.h"
10
11 void register_type_bindings(pybind11::module &m) {
12 py::class_<gridfire::NetIn>(m, "NetIn")
13 .def(py::init<>())
14 .def_readwrite("composition", &gridfire::NetIn::composition)
15 .def_readwrite("tMax", &gridfire::NetIn::tMax)
16 .def_readwrite("dt0", &gridfire::NetIn::dt0)
17 .def_readwrite("temperature", &gridfire::NetIn::temperature)
18 .def_readwrite("density", &gridfire::NetIn::density)
19 .def_readwrite("energy", &gridfire::NetIn::energy)
20 .def("__repr__", [](const gridfire::NetIn &netIn) {
21 std::stringstream ss;
22 ss << "NetIn(composition=" << netIn.composition
23 << ", tMax=" << netIn.tMax
24 << ", dt0=" << netIn.dt0
25 << ", temperature=" << netIn.temperature
26 << ", density=" << netIn.density
27 << ", energy=" << netIn.energy << ")";
28 return ss.str();
29 });
30
31 py::class_<gridfire::NetOut>(m, "NetOut")
32 .def_readonly("composition", &gridfire::NetOut::composition)
33 .def_readonly("num_steps", &gridfire::NetOut::num_steps)
34 .def_readonly("energy", &gridfire::NetOut::energy)
35 .def("__repr__", [](const gridfire::NetOut &netOut) {
36 std::stringstream ss;
37 ss << "NetOut(composition=" << netOut.composition
38 << ", num_steps=" << netOut.num_steps
39 << ", energy=" << netOut.energy << ")";
40 return ss.str();
41 });
42
43}
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