|
GridFire v0.7.0-alpha
General Purpose Nuclear Network
|
#include <reaction.h>
Public Member Functions | |
| ReactionSet (std::vector< std::unique_ptr< Reaction > > &&reactions) | |
| Constructs a ReactionSet from a vector of reactions. | |
| ReactionSet (const std::vector< Reaction * > &reactions) | |
| ReactionSet () | |
| ReactionSet (const ReactionSet &other) | |
| Copy constructor. | |
| ReactionSet & | operator= (const ReactionSet &other) |
| Copy assignment operator. | |
| void | add_reaction (const Reaction &reaction) |
| Adds a reaction to the set. | |
| void | add_reaction (std::unique_ptr< Reaction > &&reaction) |
| void | extend (const ReactionSet &other) |
| std::optional< std::unique_ptr< Reaction > > | get (const std::string_view &id) const |
| void | remove_reaction (const Reaction &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 Reaction & | operator[] (size_t index) const |
| Accesses a reaction by its index. | |
| const Reaction & | operator[] (const std::string_view &id) const |
| Accesses a reaction by its ID. | |
| bool | operator== (const ReactionSet &other) const |
| Compares this set with another for equality. | |
| bool | operator!= (const ReactionSet &other) const |
| Compares this set with another for inequality. | |
| uint64_t | hash (uint64_t seed) 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< std::unique_ptr< Reaction > > | m_reactions |
| std::string | m_id |
| std::unordered_map< std::string, size_t > | m_reactionNameMap |
| Maps reaction IDs to Reaction objects for quick lookup. | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const ReactionSet &rs) |
|
explicit |
Constructs a ReactionSet from a vector of reactions.
| reactions | The initial vector of Reaction objects. |
|
explicit |
|
default |
| gridfire::reaction::ReactionSet::ReactionSet | ( | const ReactionSet & | other | ) |
Copy constructor.
| other | The ReactionSet to copy. |
| void gridfire::reaction::ReactionSet::add_reaction | ( | const Reaction & | reaction | ) |
Adds a reaction to the set.
| reaction | The Reaction to add. |
| void gridfire::reaction::ReactionSet::add_reaction | ( | std::unique_ptr< Reaction > && | reaction | ) |
|
inline |
|
inlinenodiscard |
| void gridfire::reaction::ReactionSet::clear | ( | ) |
Removes all reactions from the set.
|
nodiscard |
Checks if the set contains the given reaction.
| reaction | The Reaction to find. |
|
nodiscard |
Checks if the set contains a reaction with the given ID.
| id | The ID of the reaction to find. |
|
nodiscard |
Checks if any reaction in the set contains the given species as a product.
| species | The species to check for. |
|
nodiscard |
Checks if any reaction in the set contains the given species as a reactant.
| species | The species to check for. |
|
nodiscard |
Checks if any reaction in the set involves the given species.
| species | The species to check for. |
|
inline |
|
inlinenodiscard |
| void gridfire::reaction::ReactionSet::extend | ( | const ReactionSet & | other | ) |
|
nodiscard |
|
nodiscard |
|
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.
| bool gridfire::reaction::ReactionSet::operator!= | ( | const ReactionSet & | other | ) | const |
Compares this set with another for inequality.
| other | The other ReactionSet to compare with. |
| ReactionSet & gridfire::reaction::ReactionSet::operator= | ( | const ReactionSet & | other | ) |
Copy assignment operator.
| other | The ReactionSet to assign from. |
| bool gridfire::reaction::ReactionSet::operator== | ( | const ReactionSet & | other | ) | const |
Compares this set with another for equality.
| other | The other ReactionSet to compare with. |
|
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. |
|
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. |
| void gridfire::reaction::ReactionSet::remove_reaction | ( | const Reaction & | reaction | ) |
Removes a reaction from the set.
| reaction | The Reaction to remove. |
|
inlinenodiscard |
Gets the number of reactions in the set.
|
friend |
|
private |
|
private |
|
private |
Maps reaction IDs to Reaction objects for quick lookup.
|
private |