GridFire 0.0.1a General Purpose Nuclear Network

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
gridfire::QSECacheKey Struct Reference

Key struct for the QSE abundance cache. More...

`#include <engine_multiscale.h>`

## Public Member Functions
| QSECacheKey (const double T9, const double rho, const std::vector< double > &Y)
| Constructs a QSECacheKey.
size_t | hash () const
| Computes the hash value for this key.
bool | operator== (const QSECacheKey &other) const
| Equality operator for QSECacheKey.

## Static Public Member Functions
static long | bin (double value, double tol)
| Converts a value to a discrete bin based on a tolerance.

## Public Attributes
double | m_T9
double | m_rho
std::vector< double > | m_Y
| Note that the ordering of Y must match the dynamic species indices in the view.
std::size_t | m_hash = 0
| Precomputed hash value for this key.
QSECacheConfig | m_cacheConfig

## Detailed Description

Key struct for the QSE abundance cache.

@purpose This struct is used as the key for the QSE abundance cache (`m_qse_abundance_cache`) within the `MultiscalePartitioningEngineView`. Its primary goal is to avoid expensive re-partitioning and QSE solves for thermodynamic conditions that are "close enough" to previously computed ones.

@how It works by storing the temperature (`m_T9`), density (`m_rho`), and species abundances (`m_Y`). A pre-computed hash is generated in the constructor by calling the `hash()` method. This method discretizes the continuous physical values into bins using the tolerances defined in `QSECacheConfig`. The `operator==` simply compares the pre-computed hash values for fast lookups in the `std::unordered_map`.

Definition at line 47 of file engine_multiscale.h.

## Constructor & Destructor Documentation

## ◆ QSECacheKey()

gridfire::QSECacheKey::QSECacheKey | ( | const double | T9,
|  | const double | rho,
|  | const std::vector< double > & | Y )

Constructs a QSECacheKey.

Parameters

  T9 | Temperature in units of 10^9 K.
  rho | Density in g/cm^3.
  Y | Species molar abundances.

Postcondition
  The `m_hash` member is computed and stored.

Definition at line 1556 of file engine_multiscale.cpp.

## Member Function Documentation

## ◆ bin()

long gridfire::QSECacheKey::bin | ( | double | value,
|  | double | tol )
| static

Converts a value to a discrete bin based on a tolerance.

Parameters

  value | The value to bin.
  tol | The tolerance (bin width) to use for binning.

Returns
  The bin number as a long integer.

@how The algorithm is `floor(value / tol)`.

Definition at line 1588 of file engine_multiscale.cpp.

## ◆ hash()

size_t gridfire::QSECacheKey::hash | ( |  | ) | const

Computes the hash value for this key.

Returns
  The computed hash value.

@how This method combines the hashes of the binned temperature, density, and each species abundance. The `bin()` static method is used for discretization.

Definition at line 1567 of file engine_multiscale.cpp.

## ◆ operator==()

bool gridfire::QSECacheKey::operator== | ( | const QSECacheKey & | other | ) | const

Equality operator for QSECacheKey.

Parameters

  other | The other QSECacheKey to compare to.

Returns
  True if the pre-computed hashes are equal, false otherwise.

Definition at line 1592 of file engine_multiscale.cpp.

## Member Data Documentation

## ◆ m_cacheConfig

QSECacheConfig gridfire::QSECacheKey::m_cacheConfig

Initial value:
= {
1e-3,
1e-1,
1e-3
}

Definition at line 55 of file engine_multiscale.h.

## ◆ m_hash

std::size_t gridfire::QSECacheKey::m_hash = 0

Precomputed hash value for this key.

Definition at line 52 of file engine_multiscale.h.

## ◆ m_rho

double gridfire::QSECacheKey::m_rho

Definition at line 49 of file engine_multiscale.h.

## ◆ m_T9

double gridfire::QSECacheKey::m_T9

Definition at line 48 of file engine_multiscale.h.

## ◆ m_Y

std::vector<double> gridfire::QSECacheKey::m_Y

Note that the ordering of Y must match the dynamic species indices in the view.

Definition at line 50 of file engine_multiscale.h.

The documentation for this struct was generated from the following files:

- src/include/gridfire/engine/views/engine_multiscale.h
- src/lib/engine/views/engine_multiscale.cpp