Key struct for the QSE abundance cache.
More...
#include <engine_multiscale.h>
|
static long | bin (double value, double tol) |
| Converts a value to a discrete bin based on a tolerance.
|
|
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
.
◆ 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.
◆ 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)
.
◆ 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.
◆ operator==()
bool gridfire::QSECacheKey::operator== |
( |
const QSECacheKey & | other | ) |
const |
Equality operator for QSECacheKey.
- Parameters
-
- Returns
- True if the pre-computed hashes are equal, false otherwise.
◆ m_cacheConfig
◆ m_hash
std::size_t gridfire::QSECacheKey::m_hash = 0 |
Precomputed hash value for this key.
◆ m_rho
double gridfire::QSECacheKey::m_rho |
◆ m_T9
double gridfire::QSECacheKey::m_T9 |
◆ m_Y
std::vector<double> gridfire::QSECacheKey::m_Y |
Note that the ordering of Y must match the dynamic species indices in the view.
The documentation for this struct was generated from the following files: