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 <string_view>
#include <vector>
#include "bindings.h"
#include "gridfire/screening/screening.h"
#include "trampoline/py_screening.h"
namespace py = pybind11;
void register_screening_bindings(py::module &m) {
py::class_<gridfire::screening::ScreeningModel, PyScreening>(m, "ScreeningModel");
py::enum_<gridfire::screening::ScreeningType>(m, "ScreeningType")
.value("BARE", gridfire::screening::ScreeningType::BARE)
.value("WEAK", gridfire::screening::ScreeningType::WEAK)
.export_values();
m.def("selectScreeningModel", &gridfire::screening::selectScreeningModel,
py::arg("type"),
"Select a screening model based on the specified type. Returns a pointer to the selected model.");
py::class_<gridfire::screening::BareScreeningModel>(m, "BareScreeningModel")
.def(py::init<>())
.def("calculateScreeningFactors",
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_),
py::arg("reactions"), py::arg("species"), py::arg("Y"), py::arg("T9"), py::arg("rho"),
"Calculate the bare plasma screening factors. This always returns 1.0 (bare)"
);
py::class_<gridfire::screening::WeakScreeningModel>(m, "WeakScreeningModel")
.def(py::init<>())
.def("calculateScreeningFactors",
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_),
py::arg("reactions"), py::arg("species"), py::arg("Y"), py::arg("T9"), py::arg("rho"),
"Calculate the weak plasma screening factors using the Salpeter (1954) model."
);
}
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