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 <string_view>
6#include <vector>
7
8#include "bindings.h"
9
10#include "gridfire/screening/screening.h"
11#include "trampoline/py_screening.h"
12
13 namespace py = pybind11;
14
15 void register_screening_bindings(py::module &m) {
16 py::class_<gridfire::screening::ScreeningModel, PyScreening>(m, "ScreeningModel");
17
18 py::enum_<gridfire::screening::ScreeningType>(m, "ScreeningType")
19 .value("BARE", gridfire::screening::ScreeningType::BARE)
20 .value("WEAK", gridfire::screening::ScreeningType::WEAK)
21 .export_values();
22
23 m.def("selectScreeningModel", &gridfire::screening::selectScreeningModel,
24 py::arg("type"),
25 "Select a screening model based on the specified type. Returns a pointer to the selected model.");
26
27 py::class_<gridfire::screening::BareScreeningModel>(m, "BareScreeningModel")
28 .def(py::init<>())
29 .def("calculateScreeningFactors",
30 py::overload_cast<const gridfire::reaction::LogicalReactionSet&, const std::vector<fourdst::atomic::Species>&, const std::vector<double>&, double, double>(&gridfire::screening::BareScreeningModel::calculateScreeningFactors, py::const_),
31 py::arg("reactions"), py::arg("species"), py::arg("Y"), py::arg("T9"), py::arg("rho"),
32 "Calculate the bare plasma screening factors. This always returns 1.0 (bare)"
33 );
34
35 py::class_<gridfire::screening::WeakScreeningModel>(m, "WeakScreeningModel")
36 .def(py::init<>())
37 .def("calculateScreeningFactors",
38 py::overload_cast<const gridfire::reaction::LogicalReactionSet&, const std::vector<fourdst::atomic::Species>&, const std::vector<double>&, double, double>(&gridfire::screening::WeakScreeningModel::calculateScreeningFactors, py::const_),
39 py::arg("reactions"), py::arg("species"), py::arg("Y"), py::arg("T9"), py::arg("rho"),
40 "Calculate the weak plasma screening factors using the Salpeter (1954) model."
41 );
42}
gridfire::screening::BareScreeningModel::calculateScreeningFactors
std::vector< double > calculateScreeningFactors(const reaction::LogicalReactionSet &reactions, const std::vector< fourdst::atomic::Species > &species, const std::vector< double > &Y, const double T9, const double rho) const override
Calculates screening factors, which are always 1.0.
Definition screening_bare.cpp:22
gridfire::screening::WeakScreeningModel::calculateScreeningFactors
std::vector< double > calculateScreeningFactors(const reaction::LogicalReactionSet &reactions, const std::vector< fourdst::atomic::Species > &species, const std::vector< double > &Y, const double T9, const double rho) const override
Calculates weak screening factors for a set of reactions.
Definition screening_weak.cpp:22
gridfire::reaction::LogicalReactionSet
TemplatedReactionSet< LogicalReaction > LogicalReactionSet
A set of logical reactions.
Definition reaction.h:563
gridfire::screening::selectScreeningModel
std::unique_ptr< ScreeningModel > selectScreeningModel(ScreeningType type)
A factory function to select and create a screening model.
Definition screening_types.cpp:9
gridfire::screening::ScreeningType::WEAK
@ WEAK
Weak screening model (Salpeter, 1954).
Definition screening_types.h:35
gridfire::screening::ScreeningType::BARE
@ BARE
No screening applied. The screening factor is always 1.0.
Definition screening_types.h:16
py_screening.h
register_screening_bindings
void register_screening_bindings(py::module &m)
Definition bindings.cpp:15
bindings.h
screening.h