refactor(reaction): refactored to an abstract reaction class in prep for weak reactions

This commit is contained in:
2025-08-14 13:33:46 -04:00
parent d920a55ba6
commit 0b77f2e269
81 changed files with 1050041 additions and 913 deletions

View File

@@ -40,7 +40,7 @@ namespace gridfire::partition {
* @return Dimensionless partition function value = 2*spin + 1.
* @throws std::out_of_range If the isotope key is not found in m_ground_state_spin.
+ */
double evaluate(
[[nodiscard]] double evaluate(
const int z,
const int a,
const double T9
@@ -57,7 +57,7 @@ namespace gridfire::partition {
* @return Zero.
* @throws std::out_of_range If the isotope key is not found.
+ */
double evaluateDerivative(
[[nodiscard]] double evaluateDerivative(
const int z,
const int a,
const double T9
@@ -70,7 +70,7 @@ namespace gridfire::partition {
* @return True if m_ground_state_spin contains the key; false otherwise.
* @post No side effects.
+ */
bool supports(
[[nodiscard]] bool supports(
const int z,
const int a
) const override;
@@ -79,13 +79,13 @@ namespace gridfire::partition {
* @return The string literal "GroundState".
* @post No side effects.
+ */
std::string type() const override { return "GroundState"; }
[[nodiscard]] std::string type() const override { return "GroundState"; }
/**
* @brief Create a deep copy of this partition function.
* @return Unique_ptr to a new GroundStatePartitionFunction cloned from this object.
* @post Caller owns the returned instance.
+ */
std::unique_ptr<PartitionFunction> clone() const override {
[[nodiscard]] std::unique_ptr<PartitionFunction> clone() const override {
return std::make_unique<GroundStatePartitionFunction>(*this);
}
private:
@@ -94,15 +94,13 @@ namespace gridfire::partition {
/**
* @brief Generate a unique lookup key for an isotope.
+ *
* Combines atomic number z and mass number a into a single integer.
* Combines atomic number z and mass number an into a single integer.
* @param z Proton number of the isotope.
* @param a Mass number of the isotope; should be < 1000 to avoid collisions.
* @pre a < 1000.
* @return Integer key = z * 1000 + a.
+ */
static constexpr int make_key(
const int z,
const int a);
static constexpr int make_key(int z, int a);
};
}

View File

@@ -5,10 +5,8 @@
#include "fourdst/logging/logging.h"
#include <string>
#include <vector>
#include <unordered_map>
#include <array>
#include <utility>
#include <memory>
namespace gridfire::partition {
@@ -45,7 +43,7 @@ namespace gridfire::partition {
* @post No side effects.
* @throws std::out_of_range If isotope key not found in m_partitionData.
*/
double evaluate(int z, int a, double T9) const override;
[[nodiscard]] double evaluate(int z, int a, double T9) const override;
/**
* @brief Evaluate temperature derivative of partition function.
*
@@ -58,7 +56,7 @@ namespace gridfire::partition {
* @post No side effects.
* @throws std::out_of_range If isotope data is missing.
*/
double evaluateDerivative(int z, int a, double T9) const override;
[[nodiscard]] double evaluateDerivative(int z, int a, double T9) const override;
/**
* @brief Check if partition data exists for given isotope.
* @param z Atomic number.
@@ -66,19 +64,19 @@ namespace gridfire::partition {
* @return true if data available; false otherwise.
* @post No side effects.
*/
bool supports(int z, int a) const override;
[[nodiscard]] bool supports(int z, int a) const override;
/**
* @brief Get type identifier for this partition function.
* @return Literal string "RauscherThielemann".
* @post No side effects.
*/
std::string type() const override { return "RauscherThielemann"; }
[[nodiscard]] std::string type() const override { return "RauscherThielemann"; }
/**
* @brief Clone this partition function instance.
* @return Unique pointer to a copy of this object.
* @post Caller owns the returned object.
*/
std::unique_ptr<PartitionFunction> clone() const override {
[[nodiscard]] std::unique_ptr<PartitionFunction> clone() const override {
return std::make_unique<RauscherThielemannPartitionFunction>(*this);
}
private:
@@ -132,7 +130,7 @@ namespace gridfire::partition {
* @return IdentifiedIsotope with data reference and indices.
* @throws std::out_of_range If isotope not found in m_partitionData.
*/
IdentifiedIsotope find(int z, int a, double T9) const;
[[nodiscard]] IdentifiedIsotope find(int z, int a, double T9) const;
/**
* @brief Generate integer key for isotope (z,a).
* @param z Atomic number.

View File

@@ -1,5 +1,6 @@
#pragma once
// ReSharper disable once CppUnusedIncludeDirective
#include <cstdint>
namespace gridfire::partition::record {