hummingbird
Solving the self-adjoint angular flux transport equation using spectral elements on Cartesian geometry
Loading...
Searching...
No Matches
enums.h
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-3-Clause
2// Copyright (c) 2026, Liam Pohlmann
3
4#ifndef HUMMINGBIRD_UTILS_ENUMS_H_
5#define HUMMINGBIRD_UTILS_ENUMS_H_
6
7#include <nlohmann/json.hpp>
8#include <stdexcept>
9#include <string>
10
11namespace hummingbird {
12/**
13 * @brief Available boundary conditions
14 *
15 */
16enum class BC { VACUUM, REFLECTIVE, NONE };
17
18// TODO(https://github.com/lipohlmann/hummingbird/issues/41): Replace with
19// NLOHMANN_JSON_SERIALIZE_ENUM_STRICT once nlohmann_json >=3.13.0 is
20// available on conda-forge; that macro throws json::out_of_range on an
21// unmapped value, matching this hand-written behavior, without custom code.
22inline void to_json(nlohmann::json& j, const BC& bc) {
23 switch (bc) {
24 case BC::VACUUM:
25 j = "vacuum";
26 return;
27 case BC::REFLECTIVE:
28 j = "reflective";
29 return;
30 case BC::NONE:
31 break;
32 }
33 throw std::invalid_argument("BC::NONE has no JSON representation");
34}
35
36inline void from_json(const nlohmann::json& j, BC& bc) {
37 const std::string value = j.get<std::string>();
38 if (value == "vacuum") {
39 bc = BC::VACUUM;
40 } else if (value == "reflective") {
41 bc = BC::REFLECTIVE;
42 } else {
43 throw std::invalid_argument("Unrecognized BC type: \"" + value + "\"");
44 }
45}
46
47/**
48 * @brief Boundary locations
49 *
50 */
51enum class Boundary { NORTH, SOUTH, EAST, WEST };
52
53/**
54 * @brief Available volumetric source types
55 *
56 */
58
59/**
60 * @brief Available finite element formulations
61 *
62 */
63enum class FEFormulation { CG };
64
66
67/**
68 * @brief Available forms of the transport equation
69 *
70 */
71enum class TransportForm { SAAF };
72
74
75/**
76 * @brief Angular quadrature set
77 *
78 */
79enum class AngularQuadSet { GLT, GL, GLC };
80
82 {{AngularQuadSet::GLT, "gauss_legendre_trapezoid"},
83 {AngularQuadSet::GLC, "gauss_legendre_chebyshev"},
84 {AngularQuadSet::GL, "gauss_legendre"}});
85
86/**
87 * @brief Run modes available
88 *
89 */
90enum class RunMode { FIXED_SOURCE };
91
93 {{RunMode::FIXED_SOURCE, "fixed_source"}});
94
95/**
96 * @brief Output forms available for export
97 *
98 */
99enum class OutputFormat { VTK, CSV };
100
102 {OutputFormat::VTK, "vtk"}});
103
104} // namespace hummingbird
105
106#endif // HUMMINGBIRD_UTILS_ENUMS_H_
RunMode
Run modes available.
Definition enums.h:90
void from_json(const json &j, Material &material)
Get the Material information from the json input.
TransportForm
Available forms of the transport equation.
Definition enums.h:71
Boundary
Boundary locations.
Definition enums.h:51
void to_json(nlohmann::json &j, const BC &bc)
Definition enums.h:22
BC
Available boundary conditions.
Definition enums.h:16
AngularQuadSet
Angular quadrature set.
Definition enums.h:79
FEFormulation
Available finite element formulations.
Definition enums.h:63
NLOHMANN_JSON_SERIALIZE_ENUM(FEFormulation, {{FEFormulation::CG, "cg"}})
OutputFormat
Output forms available for export.
Definition enums.h:99
SourceType
Available volumetric source types.
Definition enums.h:57