GridFire 0.0.1a General Purpose Nuclear Network

Loading...
Searching...
No Matches
reporting.h
Go to the documentation of this file.
1#pragma once
2
3#include <map>
4#include <string>
5#include <ranges>
6// Required for PrimingReport fields and streaming
7#include <vector>
8#include <utility>
9#include <ostream>
10#include <sstream>
11#include "fourdst/composition/composition.h"
12#include "fourdst/composition/atomicSpecies.h"
13
14 namespace gridfire {
15
31 enum class PrimingReportStatus {
32 FULL_SUCCESS = 0,
33 NO_SPECIES_TO_PRIME = 1,
34 MAX_ITERATIONS_REACHED = 2,
35 FAILED_TO_FINALIZE_COMPOSITION = 3,
36 FAILED_TO_FIND_CREATION_CHANNEL = 4,
37 FAILED_TO_FIND_PRIMING_REACTIONS = 5,
38 BASE_NETWORK_TOO_SHALLOW = 6
39 };
40
47 inline std::map<PrimingReportStatus, std::string> PrimingReportStatusStrings = {
48 {PrimingReportStatus::FULL_SUCCESS, "Full Success"},
49 {PrimingReportStatus::NO_SPECIES_TO_PRIME, "No Species to Prime"},
50 {PrimingReportStatus::MAX_ITERATIONS_REACHED, "Max Iterations Reached"},
51 {PrimingReportStatus::FAILED_TO_FINALIZE_COMPOSITION, "Failed to Finalize Composition"},
52 {PrimingReportStatus::FAILED_TO_FIND_CREATION_CHANNEL, "Failed to Find Creation Channel"},
53 {PrimingReportStatus::FAILED_TO_FIND_PRIMING_REACTIONS, "Failed to Find Priming Reactions"},
54 {PrimingReportStatus::BASE_NETWORK_TOO_SHALLOW, "Base Network Too Shallow"}
55 };
56
67 struct PrimingReport {
69 fourdst::composition::Composition primedComposition;
74 std::vector<std::pair<fourdst::atomic::Species, double>> massFractionChanges;
76 bool success;
78 PrimingReportStatus status;
79
89 friend std::ostream& operator<<(std::ostream& os, const PrimingReport& report) {
90 std::stringstream ss;
91 const std::string successStr = report.success ? "true" : "false";
92 ss << "PrimingReport(success=" << successStr
93 << ", status=" << PrimingReportStatusStrings[report.status] << ")";
94 return os << ss.str();
95 }
96 };
97
98}
gridfire
Definition engine_abstract.h:31
gridfire::PrimingReportStatusStrings
std::map< PrimingReportStatus, std::string > PrimingReportStatusStrings
Mapping from PrimingReportStatus codes to human-readable strings.
Definition reporting.h:47
gridfire::PrimingReportStatus
PrimingReportStatus
Enumerates outcome codes for a network priming operation.
Definition reporting.h:31
gridfire::PrimingReportStatus::FAILED_TO_FIND_PRIMING_REACTIONS
@ FAILED_TO_FIND_PRIMING_REACTIONS
Definition reporting.h:37
gridfire::PrimingReportStatus::MAX_ITERATIONS_REACHED
@ MAX_ITERATIONS_REACHED
Definition reporting.h:34
gridfire::PrimingReportStatus::FULL_SUCCESS
@ FULL_SUCCESS
Definition reporting.h:32
gridfire::PrimingReportStatus::NO_SPECIES_TO_PRIME
@ NO_SPECIES_TO_PRIME
Definition reporting.h:33
gridfire::PrimingReportStatus::FAILED_TO_FIND_CREATION_CHANNEL
@ FAILED_TO_FIND_CREATION_CHANNEL
Definition reporting.h:36
gridfire::PrimingReportStatus::BASE_NETWORK_TOO_SHALLOW
@ BASE_NETWORK_TOO_SHALLOW
Definition reporting.h:38
gridfire::PrimingReportStatus::FAILED_TO_FINALIZE_COMPOSITION
@ FAILED_TO_FINALIZE_COMPOSITION
Definition reporting.h:35
gridfire::PrimingReport
Captures the result of a network priming operation.
Definition reporting.h:67
gridfire::PrimingReport::primedComposition
fourdst::composition::Composition primedComposition
Definition reporting.h:69
gridfire::PrimingReport::massFractionChanges
std::vector< std::pair< fourdst::atomic::Species, double > > massFractionChanges
Definition reporting.h:74
gridfire::PrimingReport::status
PrimingReportStatus status
Definition reporting.h:78
gridfire::PrimingReport::operator<<
friend std::ostream & operator<<(std::ostream &os, const PrimingReport &report)
Serialize the report to a stream.
Definition reporting.h:89
gridfire::PrimingReport::success
bool success
Definition reporting.h:76