5#include <pybind11/pybind11.h>
6#include <pybind11/stl.h>
7#include <pybind11/functional.h>
10#include <unordered_map>
14namespace py = pybind11;
21 py::gil_scoped_acquire gil;
26 py::function
override = py::get_override(
this,
"getNetworkSpecies");
29 py::object result =
override();
34 py::pybind11_fail(
"Tried to call pure virtual function \"DynamicEngine::getNetworkSpecies\"");
38 PYBIND11_OVERRIDE_PURE(
55 py::gil_scoped_acquire gil;
60 py::function
override = py::get_override(
this,
"getNetworkSpecies");
63 py::object result =
override();
68 py::pybind11_fail(
"Tried to call pure virtual function \"DynamicEngine::getNetworkSpecies\"");
71 PYBIND11_OVERRIDE_PURE(
80 PYBIND11_OVERRIDE_PURE(
89 PYBIND11_OVERRIDE_PURE(
93 Y_dynamic, T9, rho, sparsityPattern
98 PYBIND11_OVERRIDE_PURE(
107 PYBIND11_OVERRIDE_PURE(
115 PYBIND11_OVERRIDE_PURE(
119 speciesIndex, reactionIndex
124 PYBIND11_OVERRIDE_PURE(
133 PYBIND11_OVERRIDE_PURE(
141 PYBIND11_OVERRIDE_PURE(
150 PYBIND11_OVERRIDE_PURE(
159 PYBIND11_OVERRIDE_PURE(
168 PYBIND11_OVERRIDE_PURE(
169 fourdst::composition::Composition,
177 PYBIND11_OVERRIDE_PURE(
186 PYBIND11_OVERRIDE_PURE(
195 PYBIND11_OVERRIDE_PURE(
203 PYBIND11_OVERRIDE_PURE(
212 PYBIND11_OVERRIDE_PURE(
221 PYBIND11_OVERRIDE_PURE(
230 PYBIND11_OVERRIDE_PURE(
238 PYBIND11_OVERRIDE_PURE(
std::expected< std::unordered_map< fourdst::atomic::Species, double >, gridfire::expectations::StaleEngineError > getSpeciesDestructionTimescales(const std::vector< double > &Y, double T9, double rho) const override
std::expected< std::unordered_map< fourdst::atomic::Species, double >, gridfire::expectations::StaleEngineError > getSpeciesTimescales(const std::vector< double > &Y, double T9, double rho) const override
Compute timescales for all species in the network.
double getJacobianMatrixEntry(int i, int j) const override
Get an entry from the previously generated Jacobian matrix.
void generateStoichiometryMatrix() override
Generate the stoichiometry matrix for the network.
std::vector< fourdst::atomic::Species > m_species_cache
int getSpeciesIndex(const fourdst::atomic::Species &species) const override
bool isStale(const gridfire::NetIn &netIn) override
const gridfire::reaction::LogicalReactionSet & getNetworkReactions() const override
Get the set of logical reactions in the network.
std::expected< gridfire::StepDerivatives< double >, gridfire::expectations::StaleEngineError > calculateRHSAndEnergy(const std::vector< double > &Y, double T9, double rho) const override
Calculate the right-hand side (dY/dt) and energy generation.
void generateJacobianMatrix(const std::vector< double > &Y_dynamic, double T9, double rho) const override
Generate the Jacobian matrix for the current state.
std::vector< double > mapNetInToMolarAbundanceVector(const gridfire::NetIn &netIn) const override
double calculateMolarReactionFlow(const gridfire::reaction::Reaction &reaction, const std::vector< double > &Y, double T9, double rho) const override
Calculate the molar reaction flow for a given reaction.
int getStoichiometryMatrixEntry(int speciesIndex, int reactionIndex) const override
Get an entry from the stoichiometry matrix.
gridfire::screening::ScreeningType getScreeningModel() const override
Get the current electron screening model.
gridfire::PrimingReport primeEngine(const gridfire::NetIn &netIn) override
fourdst::composition::Composition update(const gridfire::NetIn &netIn) override
Update the internal state of the engine.
void setScreeningModel(gridfire::screening::ScreeningType model) override
Set the electron screening model.
const std::vector< fourdst::atomic::Species > & getNetworkSpecies() const override
PyDynamicEngine Implementation ///.
void setNetworkReactions(const gridfire::reaction::LogicalReactionSet &reactions) override
const gridfire::DynamicEngine & getBaseEngine() const override
Access the underlying engine instance.
const std::vector< fourdst::atomic::Species > & getNetworkSpecies() const override
Get the list of species in the network.
std::expected< gridfire::StepDerivatives< double >, gridfire::expectations::StaleEngineError > calculateRHSAndEnergy(const std::vector< double > &Y, double T9, double rho) const override
Calculate the right-hand side (dY/dt) and energy generation.
std::vector< fourdst::atomic::Species > m_species_cache
const gridfire::Engine & getBaseEngine() const override
Access the underlying engine instance.
Abstract class for engines supporting Jacobian and stoichiometry operations.
Abstract base class for a reaction network engine.
Abstract base class for a "view" of a reaction network engine.
Represents a single nuclear reaction from a specific data source.
Core header for the GridFire reaction network engine module.
TemplatedReactionSet< LogicalReaction > LogicalReactionSet
A set of logical reactions.
ScreeningType
Enumerates the available plasma screening models.
std::vector< std::pair< size_t, size_t > > SparsityPattern
Captures the result of a network priming operation.
Structure holding derivatives and energy generation for a network step.