Loading...
Searching...
No Matches
reaction.h
Go to the documentation of this file.
#pragma once
#include <string_view>
#include "fourdst/composition/atomicSpecies.h"
#include "fourdst/logging/logging.h"
#include "quill/Logger.h"
#include <unordered_map>
#include <vector>
#include <unordered_set>
#include "cppad/cppad.hpp"
#include "xxhash64.h"
namespace gridfire::reaction {
struct RateCoefficientSet {
double a0;
double a1;
double a2;
double a3;
double a4;
double a5;
double a6;
friend std::ostream& operator<<(std::ostream& os, const RateCoefficientSet& r) {
os << "[" << r.a0 << ", " << r.a1 << ", " << r.a2 << ", "
<< r.a3 << ", " << r.a4 << ", " << r.a5 << ", " << r.a6 << "]";
return os;
}
};
class Reaction {
public:
virtual ~Reaction() = default;
Reaction(
const std::string_view id,
const std::string_view peName,
const int chapter,
const std::vector<fourdst::atomic::Species> &reactants,
const std::vector<fourdst::atomic::Species> &products,
const double qValue,
const std::string_view label,
const RateCoefficientSet &sets,
const bool reverse = false);
[[nodiscard]] virtual double calculate_rate(const double T9) const;
[[nodiscard]] virtual CppAD::AD<double> calculate_rate(const CppAD::AD<double> T9) const;
[[nodiscard]] virtual double calculate_forward_rate_log_derivative(const double T9) const;
[[nodiscard]] virtual std::string_view peName() const { return m_peName; }
[[nodiscard]] int chapter() const { return m_chapter; }
[[nodiscard]] std::string_view sourceLabel() const { return m_sourceLabel; }
[[nodiscard]] const RateCoefficientSet& rateCoefficients() const { return m_rateCoefficients; }
[[nodiscard]] bool contains(const fourdst::atomic::Species& species) const;
[[nodiscard]] bool contains_reactant(const fourdst::atomic::Species& species) const;
[[nodiscard]] bool contains_product(const fourdst::atomic::Species& species) const;
[[nodiscard]] std::unordered_set<fourdst::atomic::Species> all_species() const;
[[nodiscard]] std::unordered_set<fourdst::atomic::Species> reactant_species() const;
[[nodiscard]] std::unordered_set<fourdst::atomic::Species> product_species() const;
[[nodiscard]] size_t num_species() const;
[[nodiscard]] int stoichiometry(const fourdst::atomic::Species& species) const;
[[nodiscard]] std::unordered_map<fourdst::atomic::Species, int> stoichiometry() const;
[[nodiscard]] std::string_view id() const { return m_id; }
[[nodiscard]] double qValue() const { return m_qValue; }
[[nodiscard]] const std::vector<fourdst::atomic::Species>& reactants() const { return m_reactants; }
[[nodiscard]] const std::vector<fourdst::atomic::Species>& products() const { return m_products; }
[[nodiscard]] bool is_reverse() const { return m_reverse; }
[[nodiscard]] double excess_energy() const;
bool operator==(const Reaction& other) const { return m_id == other.m_id; }
bool operator!=(const Reaction& other) const { return !(*this == other); }
[[nodiscard]] uint64_t hash(uint64_t seed = 0) const;
friend std::ostream& operator<<(std::ostream& os, const Reaction& r) {
return os << "(Reaction:" << r.m_id << ")";
}
protected:
quill::Logger* m_logger = fourdst::logging::LogManager::getInstance().getLogger("log");
std::string m_id;
std::string m_peName;
int m_chapter;
double m_qValue = 0.0;
std::vector<fourdst::atomic::Species> m_reactants;
std::vector<fourdst::atomic::Species> m_products;
std::string m_sourceLabel;
RateCoefficientSet m_rateCoefficients;
bool m_reverse = false;
private:
template <typename T>
[[nodiscard]] T calculate_rate(const T T9) const {
const T T913 = CppAD::pow(T9, 1.0/3.0);
const T T953 = CppAD::pow(T9, 5.0/3.0);
const T logT9 = CppAD::log(T9);
const T exponent = m_rateCoefficients.a0 +
m_rateCoefficients.a1 / T9 +
m_rateCoefficients.a2 / T913 +
m_rateCoefficients.a3 * T913 +
m_rateCoefficients.a4 * T9 +
m_rateCoefficients.a5 * T953 +
m_rateCoefficients.a6 * logT9;
return CppAD::exp(exponent);
}
};
class LogicalReaction final : public Reaction {
public:
explicit LogicalReaction(const std::vector<Reaction> &reactions);
void add_reaction(const Reaction& reaction);
[[nodiscard]] size_t size() const { return m_rates.size(); }
[[nodiscard]] std::vector<std::string> sources() const { return m_sources; }
[[nodiscard]] double calculate_rate(const double T9) const override;
[[nodiscard]] virtual double calculate_forward_rate_log_derivative(const double T9) const override;
[[nodiscard]] CppAD::AD<double> calculate_rate(const CppAD::AD<double> T9) const override;
auto begin() { return m_rates.begin(); }
[[nodiscard]] auto begin() const { return m_rates.cbegin(); }
auto end() { return m_rates.end(); }
[[nodiscard]] auto end() const { return m_rates.cend(); }
friend std::ostream& operator<<(std::ostream& os, const LogicalReaction& r) {
os << "(LogicalReaction: " << r.id() << ", reverse: " << r.is_reverse() << ")";
return os;
}
private:
std::vector<std::string> m_sources;
std::vector<RateCoefficientSet> m_rates;
private:
template <typename T>
[[nodiscard]] T calculate_rate(const T T9) const {
T sum = static_cast<T>(0.0);
const T T913 = CppAD::pow(T9, 1.0/3.0);
const T T953 = CppAD::pow(T9, 5.0/3.0);
const T logT9 = CppAD::log(T9);
// ReSharper disable once CppUseStructuredBinding
for (const auto& rate : m_rates) {
const T exponent = rate.a0 +
rate.a1 / T9 +
rate.a2 / T913 +
rate.a3 * T913 +
rate.a4 * T9 +
rate.a5 * T953 +
rate.a6 * logT9;
sum += CppAD::exp(exponent);
}
return sum;
}
};
template <typename ReactionT>
class TemplatedReactionSet final {
public:
explicit TemplatedReactionSet(std::vector<ReactionT> reactions);
TemplatedReactionSet();
TemplatedReactionSet(const TemplatedReactionSet<ReactionT>& other);
TemplatedReactionSet<ReactionT>& operator=(const TemplatedReactionSet<ReactionT>& other);
void add_reaction(ReactionT reaction);
void remove_reaction(const ReactionT& reaction);
[[nodiscard]] bool contains(const std::string_view& id) const;
[[nodiscard]] bool contains(const Reaction& reaction) const;
[[nodiscard]] size_t size() const { return m_reactions.size(); }
void clear();
[[nodiscard]] bool contains_species(const fourdst::atomic::Species& species) const;
[[nodiscard]] bool contains_reactant(const fourdst::atomic::Species& species) const;
[[nodiscard]] bool contains_product(const fourdst::atomic::Species& species) const;
[[nodiscard]] const ReactionT& operator[](size_t index) const;
[[nodiscard]] const ReactionT& operator[](const std::string_view& id) const;
bool operator==(const TemplatedReactionSet& other) const;
bool operator!=(const TemplatedReactionSet& other) const;
[[nodiscard]] uint64_t hash(uint64_t seed = 0) const;
auto begin() { return m_reactions.begin(); }
[[nodiscard]] auto begin() const { return m_reactions.cbegin(); }
auto end() { return m_reactions.end(); }
[[nodiscard]] auto end() const { return m_reactions.cend(); }
friend std::ostream& operator<<(std::ostream& os, const TemplatedReactionSet<ReactionT>& r) {
os << "(ReactionSet: [";
size_t counter = 0;
for (const auto& reaction : r.m_reactions) {
os << reaction;
if (counter < r.m_reactions.size() - 2) {
os << ", ";
} else if (counter == r.m_reactions.size() - 2) {
os << " and ";
}
++counter;
}
os << "])";
return os;
}
[[nodiscard]] std::unordered_set<fourdst::atomic::Species> getReactionSetSpecies() const;
private:
quill::Logger* m_logger = fourdst::logging::LogManager::getInstance().getLogger("log");
std::vector<ReactionT> m_reactions;
std::string m_id;
std::unordered_map<std::string, ReactionT> m_reactionNameMap;
};
using ReactionSet = TemplatedReactionSet<Reaction>;
using LogicalReactionSet = TemplatedReactionSet<LogicalReaction>;
LogicalReactionSet packReactionSetToLogicalReactionSet(const ReactionSet& reactionSet);
template <typename ReactionT>
TemplatedReactionSet<ReactionT>::TemplatedReactionSet(
std::vector<ReactionT> reactions
) :
m_reactions(std::move(reactions)) {
if (m_reactions.empty()) {
return; // Case where the reactions will be added later.
}
m_reactionNameMap.reserve(reactions.size());
for (const auto& reaction : m_reactions) {
m_id += reaction.id();
m_reactionNameMap.emplace(reaction.id(), reaction);
}
}
template<typename ReactionT>
TemplatedReactionSet<ReactionT>::TemplatedReactionSet() {}
template <typename ReactionT>
TemplatedReactionSet<ReactionT>::TemplatedReactionSet(const TemplatedReactionSet<ReactionT> &other) {
m_reactions.reserve(other.m_reactions.size());
for (const auto& reaction_ptr: other.m_reactions) {
m_reactions.push_back(reaction_ptr);
}
m_reactionNameMap.reserve(other.m_reactionNameMap.size());
for (const auto& reaction_ptr : m_reactions) {
m_reactionNameMap.emplace(reaction_ptr.id(), reaction_ptr);
}
}
template <typename ReactionT>
TemplatedReactionSet<ReactionT>& TemplatedReactionSet<ReactionT>::operator=(const TemplatedReactionSet<ReactionT> &other) {
if (this != &other) {
TemplatedReactionSet temp(other);
std::swap(m_reactions, temp.m_reactions);
std::swap(m_reactionNameMap, temp.m_reactionNameMap);
}
return *this;
}
template <typename ReactionT>
void TemplatedReactionSet<ReactionT>::add_reaction(ReactionT reaction) {
m_reactions.emplace_back(reaction);
m_id += m_reactions.back().id();
m_reactionNameMap.emplace(m_reactions.back().id(), m_reactions.back());
}
template <typename ReactionT>
void TemplatedReactionSet<ReactionT>::remove_reaction(const ReactionT& reaction) {
if (!m_reactionNameMap.contains(std::string(reaction.id()))) {
return;
}
m_reactionNameMap.erase(std::string(reaction.id()));
std::erase_if(m_reactions, [&reaction](const Reaction& r) {
return r == reaction;
});
}
template <typename ReactionT>
bool TemplatedReactionSet<ReactionT>::contains(const std::string_view& id) const {
for (const auto& reaction : m_reactions) {
if (reaction.id() == id) {
return true;
}
}
return false;
}
template <typename ReactionT>
bool TemplatedReactionSet<ReactionT>::contains(const Reaction& reaction) const {
for (const auto& r : m_reactions) {
if (r == reaction) {
return true;
}
}
return false;
}
template <typename ReactionT>
void TemplatedReactionSet<ReactionT>::clear() {
m_reactions.clear();
m_reactionNameMap.clear();
}
template <typename ReactionT>
bool TemplatedReactionSet<ReactionT>::contains_species(const fourdst::atomic::Species& species) const {
for (const auto& reaction : m_reactions) {
if (reaction.contains(species)) {
return true;
}
}
return false;
}
template <typename ReactionT>
bool TemplatedReactionSet<ReactionT>::contains_reactant(const fourdst::atomic::Species& species) const {
for (const auto& r : m_reactions) {
if (r.contains_reactant(species)) {
return true;
}
}
return false;
}
template <typename ReactionT>
bool TemplatedReactionSet<ReactionT>::contains_product(const fourdst::atomic::Species& species) const {
for (const auto& r : m_reactions) {
if (r.contains_product(species)) {
return true;
}
}
return false;
}
template <typename ReactionT>
const ReactionT& TemplatedReactionSet<ReactionT>::operator[](const size_t index) const {
if (index >= m_reactions.size()) {
m_logger -> flush_log();
throw std::out_of_range("Index" + std::to_string(index) + " out of range for ReactionSet of size " + std::to_string(m_reactions.size()) + ".");
}
return m_reactions[index];
}
template <typename ReactionT>
const ReactionT& TemplatedReactionSet<ReactionT>::operator[](const std::string_view& id) const {
if (auto it = m_reactionNameMap.find(std::string(id)); it != m_reactionNameMap.end()) {
return it->second;
}
m_logger -> flush_log();
throw std::out_of_range("Species " + std::string(id) + " does not exist in ReactionSet.");
}
template <typename ReactionT>
bool TemplatedReactionSet<ReactionT>::operator==(const TemplatedReactionSet<ReactionT>& other) const {
if (size() != other.size()) {
return false;
}
return hash() == other.hash();
}
template <typename ReactionT>
bool TemplatedReactionSet<ReactionT>::operator!=(const TemplatedReactionSet<ReactionT>& other) const {
return !(*this == other);
}
template <typename ReactionT>
uint64_t TemplatedReactionSet<ReactionT>::hash(uint64_t seed) const {
if (m_reactions.empty()) {
return XXHash64::hash(nullptr, 0, seed);
}
std::vector<uint64_t> individualReactionHashes;
individualReactionHashes.reserve(m_reactions.size());
for (const auto& reaction : m_reactions) {
individualReactionHashes.push_back(reaction.hash(seed));
}
std::ranges::sort(individualReactionHashes);
const auto data = static_cast<const void*>(individualReactionHashes.data());
const size_t sizeInBytes = individualReactionHashes.size() * sizeof(uint64_t);
return XXHash64::hash(data, sizeInBytes, seed);
}
template<typename ReactionT>
std::unordered_set<fourdst::atomic::Species> TemplatedReactionSet<ReactionT>::getReactionSetSpecies() const {
std::unordered_set<fourdst::atomic::Species> species;
for (const auto& reaction : m_reactions) {
const auto reactionSpecies = reaction.all_species();
species.insert(reactionSpecies.begin(), reactionSpecies.end());
}
return species;
}
}
gridfire::Reaction::Reaction
Reaction(const std::string_view id, const std::string_view peName, const int chapter, const std::vector< fourdst::atomic::Species > &reactants, const std::vector< fourdst::atomic::Species > &products, const double qValue, const std::string_view label, const RateCoefficientSet &sets, const bool reverse=false)
Constructs a Reaction object.
Definition reaction.cpp:19
gridfire::reaction::LogicalReaction::calculate_rate
T calculate_rate(const T T9) const
Template implementation for calculating the total reaction rate.
Definition reaction.h:385
gridfire::reaction::LogicalReaction::end
auto end() const
Definition reaction.h:362
gridfire::reaction::LogicalReaction::operator<<
friend std::ostream & operator<<(std::ostream &os, const LogicalReaction &r)
Definition reaction.h:366
gridfire::reaction::LogicalReaction::add_reaction
void add_reaction(const Reaction &reaction)
Adds another Reaction source to this logical reaction.
Definition reaction.cpp:192
gridfire::reaction::LogicalReaction::calculate_rate
double calculate_rate(const double T9) const override
Calculates the total reaction rate by summing all source rates.
Definition reaction.cpp:214
gridfire::reaction::LogicalReaction::begin
auto begin()
Definition reaction.h:359
gridfire::reaction::LogicalReaction::begin
auto begin() const
Definition reaction.h:360
gridfire::reaction::LogicalReaction::LogicalReaction
LogicalReaction(const std::vector< Reaction > &reactions)
Constructs a LogicalReaction from a vector of Reaction objects.
Definition reaction.cpp:163
gridfire::reaction::LogicalReaction::m_sources
std::vector< std::string > m_sources
List of source labels.
Definition reaction.h:372
gridfire::reaction::LogicalReaction::m_rates
std::vector< RateCoefficientSet > m_rates
List of rate coefficient sets from each source.
Definition reaction.h:373
gridfire::reaction::LogicalReaction::calculate_forward_rate_log_derivative
virtual double calculate_forward_rate_log_derivative(const double T9) const override
Definition reaction.cpp:218
gridfire::reaction::LogicalReaction::sources
std::vector< std::string > sources() const
Gets the list of source labels for the aggregated rates.
Definition reaction.h:337
gridfire::reaction::LogicalReaction::end
auto end()
Definition reaction.h:361
gridfire::reaction::LogicalReaction::size
size_t size() const
Gets the number of source rates contributing to this logical reaction.
Definition reaction.h:331
gridfire::reaction::Reaction
Represents a single nuclear reaction from a specific data source.
Definition reaction.h:72
gridfire::reaction::Reaction::m_sourceLabel
std::string m_sourceLabel
Source label for the rate data (e.g., "wc12w", "st08").
Definition reaction.h:270
gridfire::reaction::Reaction::product_species
std::unordered_set< fourdst::atomic::Species > product_species() const
Gets a set of all unique product species.
Definition reaction.cpp:106
gridfire::reaction::Reaction::contains_product
bool contains_product(const fourdst::atomic::Species &species) const
Checks if the reaction involves a given species as a product.
Definition reaction.cpp:82
gridfire::reaction::Reaction::id
std::string_view id() const
Gets the unique identifier of the reaction.
Definition reaction.h:204
gridfire::reaction::Reaction::m_reverse
bool m_reverse
Flag indicating if this is a reverse reaction rate.
Definition reaction.h:272
gridfire::reaction::Reaction::reactants
const std::vector< fourdst::atomic::Species > & reactants() const
Gets the vector of reactant species.
Definition reaction.h:216
gridfire::reaction::Reaction::m_chapter
int m_chapter
Chapter number from the REACLIB database, defining the reaction structure.
Definition reaction.h:266
gridfire::reaction::Reaction::num_species
size_t num_species() const
Gets the number of unique species involved in the reaction.
Definition reaction.cpp:129
gridfire::reaction::Reaction::operator<<
friend std::ostream & operator<<(std::ostream &os, const Reaction &r)
Definition reaction.h:258
gridfire::reaction::Reaction::operator!=
bool operator!=(const Reaction &other) const
Compares this reaction with another for inequality.
Definition reaction.h:248
gridfire::reaction::Reaction::calculate_forward_rate_log_derivative
virtual double calculate_forward_rate_log_derivative(const double T9) const
Definition reaction.cpp:47
gridfire::reaction::Reaction::sourceLabel
std::string_view sourceLabel() const
Gets the source label for the rate data.
Definition reaction.h:134
gridfire::reaction::Reaction::m_products
std::vector< fourdst::atomic::Species > m_products
Products of the reaction.
Definition reaction.h:269
gridfire::reaction::Reaction::m_qValue
double m_qValue
Q-value of the reaction in MeV.
Definition reaction.h:267
gridfire::reaction::Reaction::m_id
std::string m_id
Unique identifier for the reaction (e.g., "h1+h1=>h2+e+nu").
Definition reaction.h:264
gridfire::reaction::Reaction::chapter
int chapter() const
Gets the REACLIB chapter number.
Definition reaction.h:128
gridfire::reaction::Reaction::m_peName
std::string m_peName
Name of the reaction in (projectile, ejectile) notation (e.g. "p(p,g)d").
Definition reaction.h:265
gridfire::reaction::Reaction::calculate_rate
T calculate_rate(const T T9) const
Template implementation for calculating the reaction rate.
Definition reaction.h:283
gridfire::reaction::Reaction::products
const std::vector< fourdst::atomic::Species > & products() const
Gets the vector of product species.
Definition reaction.h:222
gridfire::reaction::Reaction::m_logger
quill::Logger * m_logger
Definition reaction.h:263
gridfire::reaction::Reaction::peName
virtual std::string_view peName() const
Gets the reaction name in (projectile, ejectile) notation.
Definition reaction.h:122
gridfire::reaction::Reaction::all_species
std::unordered_set< fourdst::atomic::Species > all_species() const
Gets a set of all unique species involved in the reaction.
Definition reaction.cpp:91
gridfire::reaction::Reaction::Reaction
Reaction(const std::string_view id, const std::string_view peName, const int chapter, const std::vector< fourdst::atomic::Species > &reactants, const std::vector< fourdst::atomic::Species > &products, const double qValue, const std::string_view label, const RateCoefficientSet &sets, const bool reverse=false)
Constructs a Reaction object.
Definition reaction.cpp:19
gridfire::reaction::Reaction::reactant_species
std::unordered_set< fourdst::atomic::Species > reactant_species() const
Gets a set of all unique reactant species.
Definition reaction.cpp:98
gridfire::reaction::Reaction::rateCoefficients
const RateCoefficientSet & rateCoefficients() const
Gets the set of rate coefficients.
Definition reaction.h:140
gridfire::reaction::Reaction::m_reactants
std::vector< fourdst::atomic::Species > m_reactants
Reactants of the reaction.
Definition reaction.h:268
gridfire::reaction::Reaction::excess_energy
double excess_energy() const
Calculates the excess energy from the mass difference of reactants and products.
Definition reaction.cpp:144
gridfire::reaction::Reaction::m_rateCoefficients
RateCoefficientSet m_rateCoefficients
The seven rate coefficients.
Definition reaction.h:271
gridfire::reaction::Reaction::is_reverse
bool is_reverse() const
Checks if this is a reverse reaction rate.
Definition reaction.h:228
gridfire::reaction::Reaction::stoichiometry
int stoichiometry(const fourdst::atomic::Species &species) const
Calculates the stoichiometric coefficient for a given species.
gridfire::reaction::Reaction::~Reaction
virtual ~Reaction()=default
Virtual destructor.
gridfire::reaction::Reaction::contains
bool contains(const fourdst::atomic::Species &species) const
Checks if the reaction involves a given species as a reactant or product.
Definition reaction.cpp:68
gridfire::reaction::Reaction::contains_reactant
bool contains_reactant(const fourdst::atomic::Species &species) const
Checks if the reaction involves a given species as a reactant.
Definition reaction.cpp:73
gridfire::reaction::Reaction::qValue
double qValue() const
Gets the Q-value of the reaction.
Definition reaction.h:210
gridfire::reaction::Reaction::operator==
bool operator==(const Reaction &other) const
Compares this reaction with another for equality based on their IDs.
Definition reaction.h:241
gridfire::reaction::Reaction::stoichiometry
std::unordered_map< fourdst::atomic::Species, int > stoichiometry() const
Gets a map of all species to their stoichiometric coefficients.
Definition reaction.cpp:133
gridfire::reaction::Reaction::calculate_rate
virtual double calculate_rate(const double T9) const
Calculates the reaction rate for a given temperature.
Definition reaction.cpp:39
gridfire::reaction::Reaction::hash
uint64_t hash(uint64_t seed=0) const
Computes a hash for the reaction based on its ID.
Definition reaction.cpp:157
gridfire::reaction::TemplatedReactionSet
Definition reaction.h:406
gridfire::reaction::TemplatedReactionSet::clear
void clear()
Removes all reactions from the set.
Definition reaction.h:649
gridfire::reaction::TemplatedReactionSet::operator==
bool operator==(const TemplatedReactionSet &other) const
Compares this set with another for equality.
Definition reaction.h:703
gridfire::reaction::TemplatedReactionSet::operator[]
const ReactionT & operator[](const std::string_view &id) const
Accesses a reaction by its ID.
Definition reaction.h:694
gridfire::reaction::TemplatedReactionSet::getReactionSetSpecies
std::unordered_set< fourdst::atomic::Species > getReactionSetSpecies() const
Definition reaction.h:734
gridfire::reaction::TemplatedReactionSet::hash
uint64_t hash(uint64_t seed=0) const
Computes a hash for the entire set.
Definition reaction.h:716
gridfire::reaction::TemplatedReactionSet::add_reaction
void add_reaction(ReactionT reaction)
Adds a reaction to the set.
Definition reaction.h:609
gridfire::reaction::TemplatedReactionSet< Reaction >::m_reactionNameMap
std::unordered_map< std::string, Reaction > m_reactionNameMap
Definition reaction.h:558
gridfire::reaction::TemplatedReactionSet::contains_product
bool contains_product(const fourdst::atomic::Species &species) const
Checks if any reaction in the set contains the given species as a product.
Definition reaction.h:675
gridfire::reaction::TemplatedReactionSet::operator<<
friend std::ostream & operator<<(std::ostream &os, const TemplatedReactionSet< ReactionT > &r)
Definition reaction.h:537
gridfire::reaction::TemplatedReactionSet::TemplatedReactionSet
TemplatedReactionSet(std::vector< ReactionT > reactions)
Constructs a ReactionSet from a vector of reactions.
Definition reaction.h:568
gridfire::reaction::TemplatedReactionSet< Reaction >::m_reactions
std::vector< Reaction > m_reactions
Definition reaction.h:556
gridfire::reaction::TemplatedReactionSet< Reaction >::m_id
std::string m_id
Definition reaction.h:557
gridfire::reaction::TemplatedReactionSet::operator[]
const ReactionT & operator[](size_t index) const
Accesses a reaction by its index.
Definition reaction.h:685
gridfire::reaction::TemplatedReactionSet::size
size_t size() const
Gets the number of reactions in the set.
Definition reaction.h:459
gridfire::reaction::TemplatedReactionSet::contains
bool contains(const std::string_view &id) const
Checks if the set contains a reaction with the given ID.
Definition reaction.h:629
gridfire::reaction::TemplatedReactionSet::begin
auto begin()
Definition reaction.h:531
gridfire::reaction::TemplatedReactionSet::remove_reaction
void remove_reaction(const ReactionT &reaction)
Removes a reaction from the set.
Definition reaction.h:616
gridfire::reaction::TemplatedReactionSet::TemplatedReactionSet
TemplatedReactionSet()
Definition reaction.h:583
gridfire::reaction::TemplatedReactionSet::operator!=
bool operator!=(const TemplatedReactionSet &other) const
Compares this set with another for inequality.
Definition reaction.h:711
gridfire::reaction::TemplatedReactionSet::contains
bool contains(const Reaction &reaction) const
Checks if the set contains the given reaction.
Definition reaction.h:639
gridfire::reaction::TemplatedReactionSet::end
auto end() const
Definition reaction.h:534
gridfire::reaction::TemplatedReactionSet::contains_reactant
bool contains_reactant(const fourdst::atomic::Species &species) const
Checks if any reaction in the set contains the given species as a reactant.
Definition reaction.h:665
gridfire::reaction::TemplatedReactionSet::operator=
TemplatedReactionSet< ReactionT > & operator=(const TemplatedReactionSet< ReactionT > &other)
Copy assignment operator.
Definition reaction.h:599
gridfire::reaction::TemplatedReactionSet< Reaction >::m_logger
quill::Logger * m_logger
Definition reaction.h:555
gridfire::reaction::TemplatedReactionSet::end
auto end()
Definition reaction.h:533
gridfire::reaction::TemplatedReactionSet::contains_species
bool contains_species(const fourdst::atomic::Species &species) const
Checks if any reaction in the set involves the given species.
Definition reaction.h:655
gridfire::reaction::TemplatedReactionSet::TemplatedReactionSet
TemplatedReactionSet(const TemplatedReactionSet< ReactionT > &other)
Copy constructor.
Definition reaction.h:586
gridfire::reaction::TemplatedReactionSet::begin
auto begin() const
Definition reaction.h:532
gridfire::reaction
Definition reaction.h:25
gridfire::reaction::LogicalReactionSet
TemplatedReactionSet< LogicalReaction > LogicalReactionSet
A set of logical reactions.
Definition reaction.h:563
gridfire::reaction::packReactionSetToLogicalReactionSet
LogicalReactionSet packReactionSetToLogicalReactionSet(const ReactionSet &reactionSet)
Definition reaction.cpp:273
gridfire::reaction::ReactionSet
TemplatedReactionSet< Reaction > ReactionSet
A set of reactions, typically from a single source like REACLIB.
Definition reaction.h:562
std
STL namespace.
gridfire::reaction::RateCoefficientSet
Holds the seven coefficients for the REACLIB rate equation.
Definition reaction.h:33
gridfire::reaction::RateCoefficientSet::a2
double a2
Coefficient a2.
Definition reaction.h:36
gridfire::reaction::RateCoefficientSet::a0
double a0
Coefficient a0.
Definition reaction.h:34
gridfire::reaction::RateCoefficientSet::operator<<
friend std::ostream & operator<<(std::ostream &os, const RateCoefficientSet &r)
Overloads the stream insertion operator for easy printing.
Definition reaction.h:48
gridfire::reaction::RateCoefficientSet::a3
double a3
Coefficient a3.
Definition reaction.h:37
gridfire::reaction::RateCoefficientSet::a5
double a5
Coefficient a5.
Definition reaction.h:39
gridfire::reaction::RateCoefficientSet::a1
double a1
Coefficient a1.
Definition reaction.h:35
gridfire::reaction::RateCoefficientSet::a6
double a6
Coefficient a6.
Definition reaction.h:40
gridfire::reaction::RateCoefficientSet::a4
double a4
Coefficient a4.
Definition reaction.h:38