GridFire 0.0.1a
General Purpose Nuclear Network
|
#include <reaction.h>
Public Member Functions | |
TemplatedReactionSet (std::vector< ReactionT > reactions) | |
Constructs a ReactionSet from a vector of reactions. | |
TemplatedReactionSet (const TemplatedReactionSet< ReactionT > &other) | |
Copy constructor. | |
TemplatedReactionSet< ReactionT > & | operator= (const TemplatedReactionSet< ReactionT > &other) |
Copy assignment operator. | |
void | add_reaction (ReactionT reaction) |
Adds a reaction to the set. | |
void | remove_reaction (const ReactionT &reaction) |
Removes a reaction from the set. | |
bool | contains (const std::string_view &id) const |
Checks if the set contains a reaction with the given ID. | |
bool | contains (const Reaction &reaction) const |
Checks if the set contains the given reaction. | |
size_t | size () const |
Gets the number of reactions in the set. | |
void | clear () |
Removes all reactions from the set. | |
bool | contains_species (const fourdst::atomic::Species &species) const |
Checks if any reaction in the set involves the given species. | |
bool | contains_reactant (const fourdst::atomic::Species &species) const |
Checks if any reaction in the set contains the given species as a reactant. | |
bool | contains_product (const fourdst::atomic::Species &species) const |
Checks if any reaction in the set contains the given species as a product. | |
const ReactionT & | operator[] (size_t index) const |
Accesses a reaction by its index. | |
const ReactionT & | operator[] (const std::string_view &id) const |
Accesses a reaction by its ID. | |
bool | operator== (const TemplatedReactionSet &other) const |
Compares this set with another for equality. | |
bool | operator!= (const TemplatedReactionSet &other) const |
Compares this set with another for inequality. | |
uint64_t | hash (uint64_t seed=0) const |
Computes a hash for the entire set. | |
std::unordered_set< fourdst::atomic::Species > | getReactionSetSpecies () const |
Iterators | |
Provides iterators to loop over the reactions in the set. | |
auto | begin () |
auto | begin () const |
auto | end () |
auto | end () const |
Private Attributes | |
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 |
Maps reaction IDs to Reaction objects for quick lookup. | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const TemplatedReactionSet< ReactionT > &r) |
Definition at line 402 of file reaction.h.
|
explicit |
Constructs a ReactionSet from a vector of reactions.
reactions | The initial vector of Reaction objects. |
Definition at line 562 of file reaction.h.
gridfire::reaction::TemplatedReactionSet< ReactionT >::TemplatedReactionSet | ( | const TemplatedReactionSet< ReactionT > & | other | ) |
Copy constructor.
other | The ReactionSet to copy. |
Definition at line 577 of file reaction.h.
void gridfire::reaction::TemplatedReactionSet< ReactionT >::add_reaction | ( | ReactionT | reaction | ) |
Adds a reaction to the set.
reaction | The Reaction to add. |
Definition at line 600 of file reaction.h.
|
inline |
Definition at line 525 of file reaction.h.
|
inlinenodiscard |
Definition at line 526 of file reaction.h.
void gridfire::reaction::TemplatedReactionSet< ReactionT >::clear | ( | ) |
Removes all reactions from the set.
Definition at line 640 of file reaction.h.
|
nodiscard |
Checks if the set contains the given reaction.
reaction | The Reaction to find. |
Definition at line 630 of file reaction.h.
|
nodiscard |
Checks if the set contains a reaction with the given ID.
id | The ID of the reaction to find. |
Definition at line 620 of file reaction.h.
|
nodiscard |
Checks if any reaction in the set contains the given species as a product.
species | The species to check for. |
Definition at line 666 of file reaction.h.
|
nodiscard |
Checks if any reaction in the set contains the given species as a reactant.
species | The species to check for. |
Definition at line 656 of file reaction.h.
|
nodiscard |
Checks if any reaction in the set involves the given species.
species | The species to check for. |
Definition at line 646 of file reaction.h.
|
inline |
Definition at line 527 of file reaction.h.
|
inlinenodiscard |
Definition at line 528 of file reaction.h.
|
nodiscard |
Definition at line 725 of file reaction.h.
|
nodiscard |
Computes a hash for the entire set.
seed | The seed for the hash function. |
The algorithm computes the hash of each individual reaction, sorts the hashes, and then computes a final hash over the sorted list of hashes. This ensures the hash is order-independent.
Definition at line 707 of file reaction.h.
bool gridfire::reaction::TemplatedReactionSet< ReactionT >::operator!= | ( | const TemplatedReactionSet< ReactionT > & | other | ) | const |
Compares this set with another for inequality.
other | The other ReactionSet to compare with. |
Definition at line 702 of file reaction.h.
TemplatedReactionSet< ReactionT > & gridfire::reaction::TemplatedReactionSet< ReactionT >::operator= | ( | const TemplatedReactionSet< ReactionT > & | other | ) |
Copy assignment operator.
other | The ReactionSet to assign from. |
Definition at line 590 of file reaction.h.
bool gridfire::reaction::TemplatedReactionSet< ReactionT >::operator== | ( | const TemplatedReactionSet< ReactionT > & | other | ) | const |
Compares this set with another for equality.
other | The other ReactionSet to compare with. |
Definition at line 694 of file reaction.h.
|
nodiscard |
Accesses a reaction by its ID.
id | The ID of the reaction to access. |
std::out_of_range | if no reaction with the given ID exists. |
Definition at line 685 of file reaction.h.
|
nodiscard |
Accesses a reaction by its index.
index | The index of the reaction to access. |
std::out_of_range | if the index is out of bounds. |
Definition at line 676 of file reaction.h.
void gridfire::reaction::TemplatedReactionSet< ReactionT >::remove_reaction | ( | const ReactionT & | reaction | ) |
Removes a reaction from the set.
reaction | The Reaction to remove. |
Definition at line 607 of file reaction.h.
|
inlinenodiscard |
Gets the number of reactions in the set.
Definition at line 453 of file reaction.h.
|
friend |
Definition at line 531 of file reaction.h.
|
private |
Definition at line 551 of file reaction.h.
|
private |
Definition at line 549 of file reaction.h.
|
private |
Maps reaction IDs to Reaction objects for quick lookup.
Definition at line 552 of file reaction.h.
|
private |
Definition at line 550 of file reaction.h.