GridFire 0.0.1a General Purpose Nuclear Network

Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | Friends | List of all members
gridfire::reaction::TemplatedReactionSet< ReactionT > Class Template Referencefinal

`#include <reaction.h>`

## Public Member Functions
| TemplatedReactionSet (std::vector< ReactionT > reactions)
| Constructs a ReactionSet from a vector of reactions.
| TemplatedReactionSet ()
| 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)

## Detailed Description

template<typename ReactionT>
class gridfire::reaction::TemplatedReactionSet< ReactionT >

Definition at line 406 of file reaction.h.

## Constructor & Destructor Documentation

## ◆ TemplatedReactionSet() [1/3]

template<typename ReactionT>

gridfire::reaction::TemplatedReactionSet< ReactionT >::TemplatedReactionSet | ( | std::vector< ReactionT > | reactions | ) |
| explicit

Constructs a ReactionSet from a vector of reactions.

Parameters

  reactions | The initial vector of Reaction objects.

Definition at line 568 of file reaction.h.

## ◆ TemplatedReactionSet() [2/3]

template<typename ReactionT>

gridfire::reaction::TemplatedReactionSet< ReactionT >::TemplatedReactionSet | ( |  | ) |

Definition at line 583 of file reaction.h.

## ◆ TemplatedReactionSet() [3/3]

template<typename ReactionT>

gridfire::reaction::TemplatedReactionSet< ReactionT >::TemplatedReactionSet | ( | const TemplatedReactionSet< ReactionT > & | other | ) |

Copy constructor.

Parameters

  other | The ReactionSet to copy.

Definition at line 586 of file reaction.h.

## Member Function Documentation

## ◆ add_reaction()

template<typename ReactionT>

void gridfire::reaction::TemplatedReactionSet< ReactionT >::add_reaction | ( | ReactionT | reaction | ) |

Adds a reaction to the set.

Parameters

  reaction | The Reaction to add.

Definition at line 609 of file reaction.h.

## ◆ begin() [1/2]

template<typename ReactionT>

auto gridfire::reaction::TemplatedReactionSet< ReactionT >::begin | ( |  | ) |
| inline

Definition at line 531 of file reaction.h.

## ◆ begin() [2/2]

template<typename ReactionT>

auto gridfire::reaction::TemplatedReactionSet< ReactionT >::begin | ( |  | ) | const
| inline nodiscard

Definition at line 532 of file reaction.h.

## ◆ clear()

template<typename ReactionT>

void gridfire::reaction::TemplatedReactionSet< ReactionT >::clear | ( |  | ) |

Removes all reactions from the set.

Definition at line 649 of file reaction.h.

## ◆ contains() [1/2]

template<typename ReactionT>

bool gridfire::reaction::TemplatedReactionSet< ReactionT >::contains | ( | const Reaction & | reaction | ) | const
| nodiscard

Checks if the set contains the given reaction.

Parameters

  reaction | The Reaction to find.

Returns
  True if the reaction is in the set, false otherwise.

Definition at line 639 of file reaction.h.

## ◆ contains() [2/2]

template<typename ReactionT>

bool gridfire::reaction::TemplatedReactionSet< ReactionT >::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 629 of file reaction.h.

## ◆ contains_product()

template<typename ReactionT>

bool gridfire::reaction::TemplatedReactionSet< ReactionT >::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 675 of file reaction.h.

## ◆ contains_reactant()

template<typename ReactionT>

bool gridfire::reaction::TemplatedReactionSet< ReactionT >::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 665 of file reaction.h.

## ◆ contains_species()

template<typename ReactionT>

bool gridfire::reaction::TemplatedReactionSet< ReactionT >::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 655 of file reaction.h.

## ◆ end() [1/2]

template<typename ReactionT>

auto gridfire::reaction::TemplatedReactionSet< ReactionT >::end | ( |  | ) |
| inline

Definition at line 533 of file reaction.h.

## ◆ end() [2/2]

template<typename ReactionT>

auto gridfire::reaction::TemplatedReactionSet< ReactionT >::end | ( |  | ) | const
| inline nodiscard

Definition at line 534 of file reaction.h.

## ◆ getReactionSetSpecies()

template<typename ReactionT>

std::unordered_set< fourdst::atomic::Species > gridfire::reaction::TemplatedReactionSet< ReactionT >::getReactionSetSpecies | ( |  | ) | const
| nodiscard

Definition at line 734 of file reaction.h.

## ◆ hash()

template<typename ReactionT>

uint64_t gridfire::reaction::TemplatedReactionSet< ReactionT >::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 716 of file reaction.h.

## ◆ operator!=()

template<typename ReactionT>

bool gridfire::reaction::TemplatedReactionSet< ReactionT >::operator!= | ( | const TemplatedReactionSet< ReactionT > & | other | ) | const

Compares this set with another for inequality.

Parameters

  other | The other ReactionSet to compare with.

Returns
  True if the sets are not equal.

Definition at line 711 of file reaction.h.

## ◆ operator=()

template<typename ReactionT>

TemplatedReactionSet< ReactionT > & gridfire::reaction::TemplatedReactionSet< ReactionT >::operator= | ( | const TemplatedReactionSet< ReactionT > & | other | ) |

Copy assignment operator.

Parameters

  other | The ReactionSet to assign from.

Returns
  A reference to this ReactionSet.

Definition at line 599 of file reaction.h.

## ◆ operator==()

template<typename ReactionT>

bool gridfire::reaction::TemplatedReactionSet< ReactionT >::operator== | ( | const TemplatedReactionSet< ReactionT > & | other | ) | const

Compares this set with another for equality.

Parameters

  other | The other ReactionSet to compare with.

Returns
  True if the sets are equal (same size and hash).

Definition at line 703 of file reaction.h.

## ◆ operator[]() [1/2]

template<typename ReactionT>

const ReactionT & gridfire::reaction::TemplatedReactionSet< ReactionT >::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 694 of file reaction.h.

## ◆ operator[]() [2/2]

template<typename ReactionT>

const ReactionT & gridfire::reaction::TemplatedReactionSet< ReactionT >::operator[] | ( | size_t | index | ) | const
| nodiscard

Accesses a reaction by its index.

Parameters

  index | The index of the reaction to access.

Returns
  A const reference to the Reaction.

Exceptions

  std::out_of_range | if the index is out of bounds.

Definition at line 685 of file reaction.h.

## ◆ remove_reaction()

template<typename ReactionT>

void gridfire::reaction::TemplatedReactionSet< ReactionT >::remove_reaction | ( | const ReactionT & | reaction | ) |

Removes a reaction from the set.

Parameters

  reaction | The Reaction to remove.

Definition at line 616 of file reaction.h.

## ◆ size()

template<typename ReactionT>

size_t gridfire::reaction::TemplatedReactionSet< ReactionT >::size | ( |  | ) | const
| inline nodiscard

Gets the number of reactions in the set.

Returns
  The size of the set.

Definition at line 459 of file reaction.h.

## Friends And Related Symbol Documentation

## ◆ operator<<

template<typename ReactionT>

std::ostream & operator<< | ( | std::ostream & | os,
|  | const TemplatedReactionSet< ReactionT > & | r )
| friend

Definition at line 537 of file reaction.h.

## Member Data Documentation

## ◆ m_id

template<typename ReactionT>

std::string gridfire::reaction::TemplatedReactionSet< ReactionT >::m_id
| private

Definition at line 557 of file reaction.h.

## ◆ m_logger

template<typename ReactionT>

quill::Logger* gridfire::reaction::TemplatedReactionSet< ReactionT >::m_logger = fourdst::logging::LogManager::getInstance().getLogger("log")
| private

Definition at line 555 of file reaction.h.

## ◆ m_reactionNameMap

template<typename ReactionT>

std::unordered_map<std::string, ReactionT> gridfire::reaction::TemplatedReactionSet< ReactionT >::m_reactionNameMap
| private

Maps reaction IDs to Reaction objects for quick lookup.

Definition at line 558 of file reaction.h.

## ◆ m_reactions

template<typename ReactionT>

std::vector<ReactionT> gridfire::reaction::TemplatedReactionSet< ReactionT >::m_reactions
| private

Definition at line 556 of file reaction.h.

The documentation for this class was generated from the following file:

- src/include/gridfire/reaction/reaction.h