feat(io): added ability to export the rate calculations of any engine to a python file
GridFire can now (to a very limited degree) approximate the abilities of pynucastro in so far as it can not just solve an engine but it can also export it to a python file. Currently only the rates are exported so no solver can yet be used (since things like the rest of the RHS and the jacobian are missing) but this is a step in that direction
This commit is contained in:
@@ -344,6 +344,9 @@ namespace gridfire::reaction {
|
||||
os << "Reaction(ID: " << r.id() << ")";
|
||||
return os;
|
||||
}
|
||||
|
||||
virtual std::optional<std::vector<RateCoefficientSet>> getRateCoefficients() const = 0;
|
||||
|
||||
};
|
||||
class ReaclibReaction : public Reaction {
|
||||
public:
|
||||
@@ -443,6 +446,8 @@ namespace gridfire::reaction {
|
||||
*/
|
||||
[[nodiscard]] const RateCoefficientSet& rateCoefficients() const { return m_rateCoefficients; }
|
||||
|
||||
[[nodiscard]] std::optional<std::vector<RateCoefficientSet>> getRateCoefficients() const override;
|
||||
|
||||
/**
|
||||
* @brief Checks if the reaction involves a given species as a reactant or product.
|
||||
* @param species The species to check for.
|
||||
@@ -695,6 +700,8 @@ namespace gridfire::reaction {
|
||||
CppAD::AD<double> mue, const std::vector<CppAD::AD<double>>& Y, const std::unordered_map<size_t,fourdst::atomic::Species>& index_to_species_map
|
||||
) const override;
|
||||
|
||||
[[nodiscard]] std::optional<std::vector<RateCoefficientSet>> getRateCoefficients() const override;
|
||||
|
||||
/** @name Iterators
|
||||
* Provides iterators to loop over the rate coefficient sets.
|
||||
*/
|
||||
|
||||
@@ -361,6 +361,8 @@ namespace gridfire::rates::weak {
|
||||
*/
|
||||
[[nodiscard]] const WeakRateInterpolator& getWeakRateInterpolator() const;
|
||||
|
||||
[[nodiscard]] std::optional<std::vector<reaction::RateCoefficientSet>> getRateCoefficients() const override { return std::nullopt; }
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Internal unified implementation for scalar/AD rate evaluation.
|
||||
|
||||
Reference in New Issue
Block a user