A collection of Reaction objects.
More...
#include <reaction.h>
|
| | ReactionSet (std::vector< Reaction > reactions) |
| | Constructs a ReactionSet from a vector of reactions.
|
| |
| | ReactionSet (const ReactionSet &other) |
| | Copy constructor.
|
| |
| ReactionSet & | operator= (const ReactionSet &other) |
| | Copy assignment operator.
|
| |
| virtual | ~ReactionSet ()=default |
| | Virtual destructor.
|
| |
| virtual void | add_reaction (Reaction reaction) |
| | Adds a reaction to the set.
|
| |
| virtual 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.
|
| |
| virtual 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.
|
| |
| virtual 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=0) const |
| | Computes a hash for the entire set.
|
| |
|
Provides iterators to loop over the reactions in the set.
|
| auto | begin () |
| |
| auto | begin () const |
| |
| auto | end () |
| |
| auto | end () const |
| |
A collection of Reaction objects.
This class manages a set of individual Reaction objects, providing efficient lookup by ID and functionality to query the entire set.
Example:
my_set.add_reaction(reaction3);
if (my_set.contains("h1(p,g)h2")) {
const Reaction& r = my_set[
"h1(p,g)h2"];
}
Represents a single nuclear reaction from a specific data source.
ReactionSet(std::vector< Reaction > reactions)
Constructs a ReactionSet from a vector of reactions.
Definition at line 307 of file reaction.h.
◆ ReactionSet() [1/2]
| gridfire::reaction::ReactionSet::ReactionSet |
( |
std::vector< Reaction > | reactions | ) |
|
|
explicit |
◆ ReactionSet() [2/2]
| gridfire::reaction::ReactionSet::ReactionSet |
( |
const ReactionSet & | other | ) |
|
◆ ~ReactionSet()
| virtual gridfire::reaction::ReactionSet::~ReactionSet |
( |
| ) |
|
|
virtualdefault |
◆ add_reaction()
| void gridfire::reaction::ReactionSet::add_reaction |
( |
Reaction | reaction | ) |
|
|
virtual |
Adds a reaction to the set.
- Parameters
-
Definition at line 175 of file reaction.cpp.
◆ begin() [1/2]
| auto gridfire::reaction::ReactionSet::begin |
( |
| ) |
|
|
inline |
◆ begin() [2/2]
| auto gridfire::reaction::ReactionSet::begin |
( |
| ) |
const |
|
inlinenodiscard |
◆ clear()
| void gridfire::reaction::ReactionSet::clear |
( |
| ) |
|
Removes all reactions from the set.
Definition at line 211 of file reaction.cpp.
◆ contains() [1/2]
| bool gridfire::reaction::ReactionSet::contains |
( |
const Reaction & | reaction | ) |
const |
|
nodiscard |
Checks if the set contains the given reaction.
- Parameters
-
- Returns
- True if the reaction is in the set, false otherwise.
Definition at line 202 of file reaction.cpp.
◆ contains() [2/2]
| bool gridfire::reaction::ReactionSet::contains |
( |
const std::string_view & | id | ) |
const |
|
nodiscard |
Checks if the set contains a reaction with the given ID.
- Parameters
-
| id | The ID of the reaction to find. |
- Returns
- True if the reaction is in the set, false otherwise.
Definition at line 193 of file reaction.cpp.
◆ contains_product()
| bool gridfire::reaction::ReactionSet::contains_product |
( |
const fourdst::atomic::Species & | species | ) |
const |
|
nodiscard |
Checks if any reaction in the set contains the given species as a product.
- Parameters
-
| species | The species to check for. |
- Returns
- True if the species is a product in any reaction.
Definition at line 234 of file reaction.cpp.
◆ contains_reactant()
| bool gridfire::reaction::ReactionSet::contains_reactant |
( |
const fourdst::atomic::Species & | species | ) |
const |
|
nodiscard |
Checks if any reaction in the set contains the given species as a reactant.
- Parameters
-
| species | The species to check for. |
- Returns
- True if the species is a reactant in any reaction.
Definition at line 225 of file reaction.cpp.
◆ contains_species()
| bool gridfire::reaction::ReactionSet::contains_species |
( |
const fourdst::atomic::Species & | species | ) |
const |
|
nodiscard |
Checks if any reaction in the set involves the given species.
- Parameters
-
| species | The species to check for. |
- Returns
- True if the species is involved in any reaction.
Definition at line 216 of file reaction.cpp.
◆ end() [1/2]
| auto gridfire::reaction::ReactionSet::end |
( |
| ) |
|
|
inline |
◆ end() [2/2]
| auto gridfire::reaction::ReactionSet::end |
( |
| ) |
const |
|
inlinenodiscard |
◆ hash()
| uint64_t gridfire::reaction::ReactionSet::hash |
( |
uint64_t | seed = 0 | ) |
const |
|
nodiscard |
Computes a hash for the entire set.
- Parameters
-
| seed | The seed for the hash function. |
- Returns
- A 64-bit hash value.
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 270 of file reaction.cpp.
◆ operator!=()
| bool gridfire::reaction::ReactionSet::operator!= |
( |
const ReactionSet & | other | ) |
const |
Compares this set with another for inequality.
- Parameters
-
- Returns
- True if the sets are not equal.
Definition at line 266 of file reaction.cpp.
◆ operator=()
◆ operator==()
| bool gridfire::reaction::ReactionSet::operator== |
( |
const ReactionSet & | other | ) |
const |
Compares this set with another for equality.
- Parameters
-
- Returns
- True if the sets are equal (same size and hash).
Definition at line 259 of file reaction.cpp.
◆ operator[]() [1/2]
| const Reaction & gridfire::reaction::ReactionSet::operator[] |
( |
const std::string_view & | id | ) |
const |
|
nodiscard |
Accesses a reaction by its ID.
- Parameters
-
| id | The ID of the reaction to access. |
- Returns
- A const reference to the Reaction.
- Exceptions
-
| std::out_of_range | if no reaction with the given ID exists. |
Definition at line 251 of file reaction.cpp.
◆ operator[]() [2/2]
| const Reaction & gridfire::reaction::ReactionSet::operator[] |
( |
size_t | index | ) |
const |
|
nodiscardvirtual |
◆ remove_reaction()
| void gridfire::reaction::ReactionSet::remove_reaction |
( |
const Reaction & | reaction | ) |
|
|
virtual |
Removes a reaction from the set.
- Parameters
-
Definition at line 181 of file reaction.cpp.
◆ size()
| virtual size_t gridfire::reaction::ReactionSet::size |
( |
| ) |
const |
|
inlinenodiscardvirtual |
◆ m_id
| std::string gridfire::reaction::ReactionSet::m_id |
|
private |
◆ m_logger
| quill::Logger* gridfire::reaction::ReactionSet::m_logger = fourdst::logging::LogManager::getInstance().getLogger("log") |
|
private |
◆ m_reactionNameMap
| std::unordered_map<std::string, Reaction> gridfire::reaction::ReactionSet::m_reactionNameMap |
|
private |
◆ m_reactions
| std::vector<Reaction> gridfire::reaction::ReactionSet::m_reactions |
|
private |
The documentation for this class was generated from the following files: