GridFire 0.0.1a General Purpose Nuclear Network

Loading...
Searching...
No Matches
partition_ground.cpp
Go to the documentation of this file.
1#include "gridfire/partition/partition_ground.h"
2
3#include <ranges>
4
5#include "fourdst/logging/logging.h"
6#include "fourdst/composition/atomicSpecies.h"
7#include "fourdst/composition/species.h"
8
9#include "quill/LogMacros.h"
10
11 namespace gridfire::partition {
12 GroundStatePartitionFunction::GroundStatePartitionFunction() {
13 for (const auto &isotope: fourdst::atomic::species | std::views::values) {
14 m_ground_state_spin[make_key(isotope.z(), isotope.a())] = isotope.spin();
15 }
16 }
17
18 double GroundStatePartitionFunction::evaluate(
19 const int z,
20 const int a,
21 const double T9
22 ) const {
23 LOG_TRACE_L2(m_logger, "Evaluating ground state partition function for Z={} A={} T9={}", z, a, T9);
24 const int key = make_key(z, a);
25 const double spin = m_ground_state_spin.at(key);
26 return (2.0 * spin) + 1.0;
27 }
28
29 double GroundStatePartitionFunction::evaluateDerivative(
30 const int z,
31 const int a,
32 const double T9
33 ) const {
34 LOG_TRACE_L2(m_logger, "Evaluating derivative of ground state partition function for Z={} A={} T9={}", z, a, T9);
35 return 0.0;
36 }
37
38 bool GroundStatePartitionFunction::supports(
39 const int z,
40 const int a
41 ) const {
42 return m_ground_state_spin.contains(make_key(z, a));
43 }
44 constexpr int GroundStatePartitionFunction::make_key(
45 const int z,
46 const int a
47 ) {
48 return z * 1000 + a; // Simple key generation for Z and A
49 }
50}
gridfire::partition::GroundStatePartitionFunction::evaluateDerivative
double evaluateDerivative(const int z, const int a, const double T9) const override
Definition partition_ground.cpp:29
gridfire::partition::GroundStatePartitionFunction::supports
bool supports(const int z, const int a) const override
Definition partition_ground.cpp:38
gridfire::partition::GroundStatePartitionFunction::GroundStatePartitionFunction
GroundStatePartitionFunction()
Definition partition_ground.cpp:12
gridfire::partition::GroundStatePartitionFunction::make_key
static constexpr int make_key(const int z, const int a)
Definition partition_ground.cpp:44
gridfire::partition::GroundStatePartitionFunction::evaluate
double evaluate(const int z, const int a, const double T9) const override
Definition partition_ground.cpp:18
gridfire::partition::GroundStatePartitionFunction::m_ground_state_spin
std::unordered_map< int, double > m_ground_state_spin
Definition partition_ground.h:93
gridfire::partition::GroundStatePartitionFunction::m_logger
quill::Logger * m_logger
Definition partition_ground.h:92
gridfire::partition
Definition partition_composite.h:15
partition_ground.h