9#include <unordered_map>
33 concept IsArithmeticOrAD = std::is_same_v<T, double> || std::is_same_v<T, CppAD::AD<double>>;
52 template <IsArithmeticOrAD T>
86 [[nodiscard]]
virtual const std::vector<fourdst::atomic::Species>&
getNetworkSpecies()
const = 0;
101 const std::vector<double>& Y,
134 const std::vector<double>& Y,
135 double T9,
double rho
188 const std::vector<double>& Y,
212 const std::vector<double>& Y,
Abstract class for engines supporting Jacobian and stoichiometry operations.
virtual double getJacobianMatrixEntry(int i, int j) const =0
Get an entry from the previously generated Jacobian matrix.
virtual void generateJacobianMatrix(const std::vector< double > &Y, double T9, double rho)=0
Generate the Jacobian matrix for the current state.
virtual void setScreeningModel(screening::ScreeningType model)=0
Set the electron screening model.
virtual std::unordered_map< fourdst::atomic::Species, double > getSpeciesTimescales(const std::vector< double > &Y, double T9, double rho) const =0
Compute timescales for all species in the network.
virtual double calculateMolarReactionFlow(const reaction::Reaction &reaction, const std::vector< double > &Y, double T9, double rho) const =0
Calculate the molar reaction flow for a given reaction.
virtual screening::ScreeningType getScreeningModel() const =0
Get the current electron screening model.
virtual void update(const NetIn &netIn)=0
Update the internal state of the engine.
virtual const reaction::LogicalReactionSet & getNetworkReactions() const =0
Get the set of logical reactions in the network.
virtual void generateStoichiometryMatrix()=0
Generate the stoichiometry matrix for the network.
virtual int getStoichiometryMatrixEntry(int speciesIndex, int reactionIndex) const =0
Get an entry from the stoichiometry matrix.
Abstract base class for a reaction network engine.
virtual const std::vector< fourdst::atomic::Species > & getNetworkSpecies() const =0
Get the list of species in the network.
virtual ~Engine()=default
Virtual destructor.
virtual StepDerivatives< double > calculateRHSAndEnergy(const std::vector< double > &Y, double T9, double rho) const =0
Calculate the right-hand side (dY/dt) and energy generation.
Represents a single nuclear reaction from a specific data source.
Concept for types allowed in engine calculations.
TemplatedReactionSet< LogicalReaction > LogicalReactionSet
A set of logical reactions.
ScreeningType
Enumerates the available plasma screening models.
Defines classes for representing and managing nuclear reactions.
Structure holding derivatives and energy generation for a network step.
T nuclearEnergyGenerationRate
Specific energy generation rate (e.g., erg/g/s).
std::vector< T > dydt
Derivatives of abundances (dY/dt for each species).