1#include <pybind11/pybind11.h>
2#include <pybind11/stl.h>
3#include <pybind11/stl_bind.h>
12PYBIND11_DECLARE_HOLDER_TYPE(T, std::unique_ptr<T>,
true)
14#include "trampoline/py_partition.h"
17namespace py = pybind11;
22 py::class_<PF, PyPartitionFunction>(m,
"PartitionFunction");
33 py::enum_<gridfire::partition::BasePartitionType>(m,
"BasePartitionType")
40 }, py::arg(
"type"),
"Convert BasePartitionType to string.");
42 m.def(
"stringToBasePartitionType", [](
const std::string &typeStr) {
44 }, py::arg(
"typeStr"),
"Convert string to BasePartitionType.");
50 py::class_<GSPF, PF>(m,
"GroundStatePartitionFunction")
53 py::arg(
"z"), py::arg(
"a"), py::arg(
"T9"),
54 "Evaluate the ground state partition function for given Z, A, and T9.")
56 py::arg(
"z"), py::arg(
"a"), py::arg(
"T9"),
57 "Evaluate the derivative of the ground state partition function for given Z, A, and T9.")
59 py::arg(
"z"), py::arg(
"a"),
60 "Check if the ground state partition function supports given Z and A.")
62 "Get the type of the partition function (should return 'GroundState').");
66 py::class_<gridfire::partition::record::RauscherThielemannPartitionDataRecord>(m,
"RauscherThielemannPartitionDataRecord")
77 py::class_<RTPF, PF>(m,
"RauscherThielemannPartitionFunction")
80 py::arg(
"z"), py::arg(
"a"), py::arg(
"T9"),
81 "Evaluate the Rauscher-Thielemann partition function for given Z, A, and T9.")
83 py::arg(
"z"), py::arg(
"a"), py::arg(
"T9"),
84 "Evaluate the derivative of the Rauscher-Thielemann partition function for given Z, A, and T9.")
86 py::arg(
"z"), py::arg(
"a"),
87 "Check if the Rauscher-Thielemann partition function supports given Z and A.")
89 "Get the type of the partition function (should return 'RauscherThielemann').");
93 py::class_<gridfire::partition::CompositePartitionFunction>(m,
"CompositePartitionFunction")
94 .def(py::init<
const std::vector<gridfire::partition::BasePartitionType>&>(),
95 py::arg(
"partitionFunctions"),
96 "Create a composite partition function from a list of base partition types.")
97 .def(py::init<const gridfire::partition::CompositePartitionFunction&>(),
98 "Copy constructor for CompositePartitionFunction.")
100 py::arg(
"z"), py::arg(
"a"), py::arg(
"T9"),
101 "Evaluate the composite partition function for given Z, A, and T9.")
103 py::arg(
"z"), py::arg(
"a"), py::arg(
"T9"),
104 "Evaluate the derivative of the composite partition function for given Z, A, and T9.")
106 py::arg(
"z"), py::arg(
"a"),
107 "Check if the composite partition function supports given Z and A.")
109 "Get the type of the partition function (should return 'Composite').");
std::string type() const override
double evaluate(int z, int a, double T9) const override
double evaluateDerivative(int z, int a, double T9) const override
bool supports(int z, int a) const override
Partition function implementation for nuclear ground states.
double evaluateDerivative(const int z, const int a, const double T9) const override
bool supports(const int z, const int a) const override
double evaluate(const int z, const int a, const double T9) const override
std::string type() const override
Abstract interface for evaluating nuclear partition functions.
Partition function using Rauscher-Thielemann tabulated normalized G-values.
std::string type() const override
Get type identifier for this partition function.
bool supports(int z, int a) const override
Check if partition data exists for given isotope.
double evaluateDerivative(int z, int a, double T9) const override
Evaluate temperature derivative of partition function.
double evaluate(int z, int a, double T9) const override
Evaluate partition function for isotope at temperature.
std::unordered_map< std::string, BasePartitionType > stringToBasePartitionType
Mapping from string to BasePartitionType enum.
std::unordered_map< BasePartitionType, std::string > basePartitionTypeToString
Mapping from BasePartitionType enum to human-readable string.
BasePartitionType
Enumerates available partition function implementations.
@ RauscherThielemann
Rauscher-Thielemann partition function.
@ GroundState
Ground state partition function.
void register_partition_bindings(pybind11::module &m)
void register_partition_types_bindings(pybind11::module &m)
void register_rauscher_thielemann_partition_bindings(pybind11::module &m)
void register_ground_state_partition_bindings(pybind11::module &m)
void register_rauscher_thielemann_partition_data_record_bindings(pybind11::module &m)
void register_composite_partition_bindings(pybind11::module &m)
double normalized_g_values[24]
Normalized g-values for the first 24 energy levels.
double ground_state_spin
Ground state spin.