Merge pull request #1454 from gridley/add_enums2

Attempt number two at enum conversion!
This commit is contained in:
Paul Romano 2020-01-21 17:13:35 -06:00 committed by GitHub
commit 832c32e16a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
90 changed files with 865 additions and 894 deletions

View file

@ -25,10 +25,11 @@ namespace openmc {
// Constants
//==============================================================================
// TODO: Convert to enum
constexpr int FILL_MATERIAL {1};
constexpr int FILL_UNIVERSE {2};
constexpr int FILL_LATTICE {3};
enum class Fill {
MATERIAL,
UNIVERSE,
LATTICE
};
// TODO: Convert to enum
constexpr int32_t OP_LEFT_PAREN {std::numeric_limits<int32_t>::max()};
@ -149,7 +150,7 @@ public:
int32_t id_; //!< Unique ID
std::string name_; //!< User-defined name
int type_; //!< Material, universe, or lattice
Fill type_; //!< Material, universe, or lattice
int32_t universe_; //!< Universe # this cell is in
int32_t fill_; //!< Universe # filling this cell
int32_t n_instances_{0}; //!< Number of instances of this cell

View file

@ -113,192 +113,170 @@ constexpr int NUCLIDE_NONE {-1};
// ============================================================================
// CROSS SECTION RELATED CONSTANTS
// Angular distribution type
// TODO: Convert to enum
constexpr int ANGLE_ISOTROPIC {1};
constexpr int ANGLE_32_EQUI {2};
constexpr int ANGLE_TABULAR {3};
constexpr int ANGLE_LEGENDRE {4};
constexpr int ANGLE_HISTOGRAM {5};
// Temperature treatment method
// TODO: Convert to enum?
constexpr int TEMPERATURE_NEAREST {1};
constexpr int TEMPERATURE_INTERPOLATION {2};
enum class TemperatureMethod {
NEAREST,
INTERPOLATION
};
// Reaction types
// TODO: Convert to enum
constexpr int REACTION_NONE {0};
constexpr int TOTAL_XS {1};
constexpr int ELASTIC {2};
constexpr int N_NONELASTIC {3};
constexpr int N_LEVEL {4};
constexpr int MISC {5};
constexpr int N_2ND {11};
constexpr int N_2N {16};
constexpr int N_3N {17};
constexpr int N_FISSION {18};
constexpr int N_F {19};
constexpr int N_NF {20};
constexpr int N_2NF {21};
constexpr int N_NA {22};
constexpr int N_N3A {23};
constexpr int N_2NA {24};
constexpr int N_3NA {25};
constexpr int N_NP {28};
constexpr int N_N2A {29};
constexpr int N_2N2A {30};
constexpr int N_ND {32};
constexpr int N_NT {33};
constexpr int N_N3HE {34};
constexpr int N_ND2A {35};
constexpr int N_NT2A {36};
constexpr int N_4N {37};
constexpr int N_3NF {38};
constexpr int N_2NP {41};
constexpr int N_3NP {42};
constexpr int N_N2P {44};
constexpr int N_NPA {45};
constexpr int N_N1 {51};
constexpr int N_N40 {90};
constexpr int N_NC {91};
constexpr int N_DISAPPEAR {101};
constexpr int N_GAMMA {102};
constexpr int N_P {103};
constexpr int N_D {104};
constexpr int N_T {105};
constexpr int N_3HE {106};
constexpr int N_A {107};
constexpr int N_2A {108};
constexpr int N_3A {109};
constexpr int N_2P {111};
constexpr int N_PA {112};
constexpr int N_T2A {113};
constexpr int N_D2A {114};
constexpr int N_PD {115};
constexpr int N_PT {116};
constexpr int N_DA {117};
constexpr int N_5N {152};
constexpr int N_6N {153};
constexpr int N_2NT {154};
constexpr int N_TA {155};
constexpr int N_4NP {156};
constexpr int N_3ND {157};
constexpr int N_NDA {158};
constexpr int N_2NPA {159};
constexpr int N_7N {160};
constexpr int N_8N {161};
constexpr int N_5NP {162};
constexpr int N_6NP {163};
constexpr int N_7NP {164};
constexpr int N_4NA {165};
constexpr int N_5NA {166};
constexpr int N_6NA {167};
constexpr int N_7NA {168};
constexpr int N_4ND {169};
constexpr int N_5ND {170};
constexpr int N_6ND {171};
constexpr int N_3NT {172};
constexpr int N_4NT {173};
constexpr int N_5NT {174};
constexpr int N_6NT {175};
constexpr int N_2N3HE {176};
constexpr int N_3N3HE {177};
constexpr int N_4N3HE {178};
constexpr int N_3N2P {179};
constexpr int N_3N3A {180};
constexpr int N_3NPA {181};
constexpr int N_DT {182};
constexpr int N_NPD {183};
constexpr int N_NPT {184};
constexpr int N_NDT {185};
constexpr int N_NP3HE {186};
constexpr int N_ND3HE {187};
constexpr int N_NT3HE {188};
constexpr int N_NTA {189};
constexpr int N_2N2P {190};
constexpr int N_P3HE {191};
constexpr int N_D3HE {192};
constexpr int N_3HEA {193};
constexpr int N_4N2P {194};
constexpr int N_4N2A {195};
constexpr int N_4NPA {196};
constexpr int N_3P {197};
constexpr int N_N3P {198};
constexpr int N_3N2PA {199};
constexpr int N_5N2P {200};
constexpr int N_XP {203};
constexpr int N_XD {204};
constexpr int N_XT {205};
constexpr int N_X3HE {206};
constexpr int N_XA {207};
constexpr int HEATING {301};
constexpr int DAMAGE_ENERGY {444};
constexpr int COHERENT {502};
constexpr int INCOHERENT {504};
constexpr int PAIR_PROD_ELEC {515};
constexpr int PAIR_PROD {516};
constexpr int PAIR_PROD_NUC {517};
constexpr int PHOTOELECTRIC {522};
constexpr int N_P0 {600};
constexpr int N_PC {649};
constexpr int N_D0 {650};
constexpr int N_DC {699};
constexpr int N_T0 {700};
constexpr int N_TC {749};
constexpr int N_3HE0 {750};
constexpr int N_3HEC {799};
constexpr int N_A0 {800};
constexpr int N_AC {849};
constexpr int N_2N0 {875};
constexpr int N_2NC {891};
constexpr int HEATING_LOCAL {901};
enum ReactionType {
REACTION_NONE = 0,
TOTAL_XS = 1,
ELASTIC = 2,
N_NONELASTIC = 3,
N_LEVEL = 4,
MISC = 5,
N_2ND = 11,
N_2N = 16,
N_3N = 17,
N_FISSION = 18,
N_F = 19,
N_NF = 20,
N_2NF = 21,
N_NA = 22,
N_N3A = 23,
N_2NA = 24,
N_3NA = 25,
N_NP = 28,
N_N2A = 29,
N_2N2A = 30,
N_ND = 32,
N_NT = 33,
N_N3HE = 34,
N_ND2A = 35,
N_NT2A = 36,
N_4N = 37,
N_3NF = 38,
N_2NP = 41,
N_3NP = 42,
N_N2P = 44,
N_NPA = 45,
N_N1 = 51,
N_N40 = 90,
N_NC = 91,
N_DISAPPEAR = 101,
N_GAMMA = 102,
N_P = 103,
N_D = 104,
N_T = 105,
N_3HE = 106,
N_A = 107,
N_2A = 108,
N_3A = 109,
N_2P = 111,
N_PA = 112,
N_T2A = 113,
N_D2A = 114,
N_PD = 115,
N_PT = 116,
N_DA = 117,
N_5N = 152,
N_6N = 153,
N_2NT = 154,
N_TA = 155,
N_4NP = 156,
N_3ND = 157,
N_NDA = 158,
N_2NPA = 159,
N_7N = 160,
N_8N = 161,
N_5NP = 162,
N_6NP = 163,
N_7NP = 164,
N_4NA = 165,
N_5NA = 166,
N_6NA = 167,
N_7NA = 168,
N_4ND = 169,
N_5ND = 170,
N_6ND = 171,
N_3NT = 172,
N_4NT = 173,
N_5NT = 174,
N_6NT = 175,
N_2N3HE = 176,
N_3N3HE = 177,
N_4N3HE = 178,
N_3N2P = 179,
N_3N3A = 180,
N_3NPA = 181,
N_DT = 182,
N_NPD = 183,
N_NPT = 184,
N_NDT = 185,
N_NP3HE = 186,
N_ND3HE = 187,
N_NT3HE = 188,
N_NTA = 189,
N_2N2P = 190,
N_P3HE = 191,
N_D3HE = 192,
N_3HEA = 193,
N_4N2P = 194,
N_4N2A = 195,
N_4NPA = 196,
N_3P = 197,
N_N3P = 198,
N_3N2PA = 199,
N_5N2P = 200,
N_XP = 203,
N_XD = 204,
N_XT = 205,
N_X3HE = 206,
N_XA = 207,
HEATING = 301,
DAMAGE_ENERGY = 444,
COHERENT = 502,
INCOHERENT = 504,
PAIR_PROD_ELEC = 515,
PAIR_PROD = 516,
PAIR_PROD_NUC = 517,
PHOTOELECTRIC = 522,
N_P0 = 600,
N_PC = 649,
N_D0 = 650,
N_DC = 699,
N_T0 = 700,
N_TC = 749,
N_3HE0 = 750,
N_3HEC = 799,
N_A0 = 800,
N_AC = 849,
N_2N0 = 875,
N_2NC = 891,
HEATING_LOCAL = 901
};
constexpr std::array<int, 6> DEPLETION_RX {N_GAMMA, N_P, N_A, N_2N, N_3N, N_4N};
// Fission neutron emission (nu) type
constexpr int NU_NONE {0}; // No nu values (non-fissionable)
constexpr int NU_POLYNOMIAL {1}; // Nu values given by polynomial
constexpr int NU_TABULAR {2}; // Nu values given by tabular distribution
// Library types
constexpr int LIBRARY_NEUTRON {1};
constexpr int LIBRARY_THERMAL {2};
constexpr int LIBRARY_PHOTON {3};
constexpr int LIBRARY_MULTIGROUP {4};
// Probability table parameters
constexpr int URR_CUM_PROB {0};
constexpr int URR_TOTAL {1};
constexpr int URR_ELASTIC {2};
constexpr int URR_FISSION {3};
constexpr int URR_N_GAMMA {4};
constexpr int URR_HEATING {5};
enum class URRTableParam {
CUM_PROB,
TOTAL,
ELASTIC,
FISSION,
N_GAMMA,
HEATING
};
// Maximum number of partial fission reactions
constexpr int PARTIAL_FISSION_MAX {4};
// Resonance elastic scattering methods
// TODO: Convert to enum
enum class ResScatMethod {
rvs, // Relative velocity sampling
dbrc, // Doppler broadening rejection correction
cxs // Constant cross section
};
// Electron treatments
// TODO: Convert to enum
constexpr int ELECTRON_LED {1}; // Local Energy Deposition
constexpr int ELECTRON_TTB {2}; // Thick Target Bremsstrahlung
enum class ElectronTreatment {
LED, // Local Energy Deposition
TTB // Thick Target Bremsstrahlung
};
// ============================================================================
// MULTIGROUP RELATED
// MGXS Table Types
// TODO: Convert to enum
constexpr int MGXS_ISOTROPIC {1}; // Isotroically weighted data
constexpr int MGXS_ANGLE {2}; // Data by angular bins
// Flag to denote this was a macroscopic data object
constexpr double MACROSCOPIC_AWR {-2.};
@ -306,103 +284,86 @@ constexpr double MACROSCOPIC_AWR {-2.};
constexpr int DEFAULT_NMU {33};
// Mgxs::get_xs enumerated types
// TODO: Convert to enum
constexpr int MG_GET_XS_TOTAL {0};
constexpr int MG_GET_XS_ABSORPTION {1};
constexpr int MG_GET_XS_INVERSE_VELOCITY {2};
constexpr int MG_GET_XS_DECAY_RATE {3};
constexpr int MG_GET_XS_SCATTER {4};
constexpr int MG_GET_XS_SCATTER_MULT {5};
constexpr int MG_GET_XS_SCATTER_FMU_MULT {6};
constexpr int MG_GET_XS_SCATTER_FMU {7};
constexpr int MG_GET_XS_FISSION {8};
constexpr int MG_GET_XS_KAPPA_FISSION {9};
constexpr int MG_GET_XS_PROMPT_NU_FISSION {10};
constexpr int MG_GET_XS_DELAYED_NU_FISSION {11};
constexpr int MG_GET_XS_NU_FISSION {12};
constexpr int MG_GET_XS_CHI_PROMPT {13};
constexpr int MG_GET_XS_CHI_DELAYED {14};
enum class MgxsType {
TOTAL,
ABSORPTION,
INVERSE_VELOCITY,
DECAY_RATE,
SCATTER,
SCATTER_MULT,
SCATTER_FMU_MULT,
SCATTER_FMU,
FISSION,
KAPPA_FISSION,
PROMPT_NU_FISSION,
DELAYED_NU_FISSION,
NU_FISSION,
CHI_PROMPT,
CHI_DELAYED
};
// ============================================================================
// TALLY-RELATED CONSTANTS
// Tally result entries
constexpr int RESULT_VALUE {0};
constexpr int RESULT_SUM {1};
constexpr int RESULT_SUM_SQ {2};
enum class TallyResult {
VALUE,
SUM,
SUM_SQ
};
// Tally type
// TODO: Convert to enum
constexpr int TALLY_VOLUME {1};
constexpr int TALLY_MESH_SURFACE {2};
constexpr int TALLY_SURFACE {3};
enum class TallyType {
VOLUME,
MESH_SURFACE,
SURFACE
};
// Tally estimator types
// TODO: Convert to enum
constexpr int ESTIMATOR_ANALOG {1};
constexpr int ESTIMATOR_TRACKLENGTH {2};
constexpr int ESTIMATOR_COLLISION {3};
enum class TallyEstimator {
ANALOG,
TRACKLENGTH,
COLLISION
};
// Event types for tallies
// TODO: Convert to enum
constexpr int EVENT_SURFACE {-2};
constexpr int EVENT_LATTICE {-1};
constexpr int EVENT_KILL {0};
constexpr int EVENT_SCATTER {1};
constexpr int EVENT_ABSORB {2};
enum class TallyEvent {
SURFACE,
LATTICE,
KILL,
SCATTER,
ABSORB
};
// Tally score type -- if you change these, make sure you also update the
// _SCORES dictionary in openmc/capi/tally.py
// TODO: Convert to enum
constexpr int SCORE_FLUX {-1}; // flux
constexpr int SCORE_TOTAL {-2}; // total reaction rate
constexpr int SCORE_SCATTER {-3}; // scattering rate
constexpr int SCORE_NU_SCATTER {-4}; // scattering production rate
constexpr int SCORE_ABSORPTION {-5}; // absorption rate
constexpr int SCORE_FISSION {-6}; // fission rate
constexpr int SCORE_NU_FISSION {-7}; // neutron production rate
constexpr int SCORE_KAPPA_FISSION {-8}; // fission energy production rate
constexpr int SCORE_CURRENT {-9}; // current
constexpr int SCORE_EVENTS {-10}; // number of events
constexpr int SCORE_DELAYED_NU_FISSION {-11}; // delayed neutron production rate
constexpr int SCORE_PROMPT_NU_FISSION {-12}; // prompt neutron production rate
constexpr int SCORE_INVERSE_VELOCITY {-13}; // flux-weighted inverse velocity
constexpr int SCORE_FISS_Q_PROMPT {-14}; // prompt fission Q-value
constexpr int SCORE_FISS_Q_RECOV {-15}; // recoverable fission Q-value
constexpr int SCORE_DECAY_RATE {-16}; // delayed neutron precursor decay rate
// Tally map bin finding
constexpr int NO_BIN_FOUND {-1};
// Tally filter and map types
// TODO: Refactor to remove or convert to enum
constexpr int FILTER_UNIVERSE {1};
constexpr int FILTER_MATERIAL {2};
constexpr int FILTER_CELL {3};
// Mesh types
constexpr int MESH_REGULAR {1};
// Tally surface current directions
constexpr int OUT_LEFT {1}; // x min
constexpr int IN_LEFT {2}; // x min
constexpr int OUT_RIGHT {3}; // x max
constexpr int IN_RIGHT {4}; // x max
constexpr int OUT_BACK {5}; // y min
constexpr int IN_BACK {6}; // y min
constexpr int OUT_FRONT {7}; // y max
constexpr int IN_FRONT {8}; // y max
constexpr int OUT_BOTTOM {9}; // z min
constexpr int IN_BOTTOM {10}; // z min
constexpr int OUT_TOP {11}; // z max
constexpr int IN_TOP {12}; // z max
//
// These are kept as a normal enum and made negative, since variables which
// store one of these enum values usually also may be responsible for storing
// MT numbers from the long enum above.
enum TallyScore {
SCORE_FLUX = -1, // flux
SCORE_TOTAL = -2, // total reaction rate
SCORE_SCATTER = -3, // scattering rate
SCORE_NU_SCATTER = -4, // scattering production rate
SCORE_ABSORPTION = -5, // absorption rate
SCORE_FISSION = -6, // fission rate
SCORE_NU_FISSION = -7, // neutron production rate
SCORE_KAPPA_FISSION = -8, // fission energy production rate
SCORE_CURRENT = -9, // current
SCORE_EVENTS = -10, // number of events
SCORE_DELAYED_NU_FISSION = -11, // delayed neutron production rate
SCORE_PROMPT_NU_FISSION = -12, // prompt neutron production rate
SCORE_INVERSE_VELOCITY = -13, // flux-weighted inverse velocity
SCORE_FISS_Q_PROMPT = -14, // prompt fission Q-value
SCORE_FISS_Q_RECOV = -15, // recoverable fission Q-value
SCORE_DECAY_RATE = -16 // delayed neutron precursor decay rate
};
// Global tally parameters
constexpr int N_GLOBAL_TALLIES {4};
constexpr int K_COLLISION {0};
constexpr int K_ABSORPTION {1};
constexpr int K_TRACKLENGTH {2};
constexpr int LEAKAGE {3};
enum class GlobalTally {
K_COLLISION,
K_ABSORPTION,
K_TRACKLENGTH,
LEAKAGE
};
// Miscellaneous
constexpr int C_NONE {-1};
@ -413,12 +374,14 @@ enum class Interpolation {
histogram = 1, lin_lin = 2, lin_log = 3, log_lin = 4, log_log = 5
};
// Run modes
constexpr int RUN_MODE_FIXEDSOURCE {1};
constexpr int RUN_MODE_EIGENVALUE {2};
constexpr int RUN_MODE_PLOTTING {3};
constexpr int RUN_MODE_PARTICLE {4};
constexpr int RUN_MODE_VOLUME {5};
enum class RunMode {
UNSET, // default value, OpenMC throws error if left to this
FIXED_SOURCE,
EIGENVALUE,
PLOTTING,
PARTICLE,
VOLUME
};
// ============================================================================
// CMFD CONSTANTS

View file

@ -39,7 +39,7 @@ class Mgxs {
private:
xt::xtensor<double, 1> kTs; // temperature in eV (k * T)
int scatter_format; // flag for if this is legendre, histogram, or tabular
AngleDistributionType scatter_format; // flag for if this is legendre, histogram, or tabular
int num_delayed_groups; // number of delayed neutron groups
int num_groups; // number of energy groups
std::vector<XsData> xs; // Cross section data
@ -64,7 +64,7 @@ class Mgxs {
//! @param in_azimuthal Azimuthal angle grid.
void
init(const std::string& in_name, double in_awr, const std::vector<double>& in_kTs,
bool in_fissionable, int in_scatter_format, bool in_is_isotropic,
bool in_fissionable, AngleDistributionType in_scatter_format, bool in_is_isotropic,
const std::vector<double>& in_polar, const std::vector<double>& in_azimuthal);
//! \brief Initializes the Mgxs object metadata from the HDF5 file
@ -141,11 +141,11 @@ class Mgxs {
//! @param dg delayed group index; use nullptr if irrelevant.
//! @return Requested cross section value.
double
get_xs(int xstype, int gin, const int* gout, const double* mu,
get_xs(MgxsType xstype, int gin, const int* gout, const double* mu,
const int* dg);
inline double
get_xs(int xstype, int gin)
get_xs(MgxsType xstype, int gin)
{return get_xs(xstype, gin, nullptr, nullptr, nullptr);}

View file

@ -300,7 +300,7 @@ public:
// What event took place
bool fission_ {false}; //!< did particle cause implicit fission
int event_; //!< scatter, absorption
TallyEvent event_; //!< scatter, absorption
int event_nuclide_; //!< index in nuclides array
int event_mt_; //!< reaction MT
int delayed_group_ {0}; //!< delayed group

View file

@ -27,15 +27,15 @@ void sample_neutron_reaction(Particle* p);
void sample_photon_reaction(Particle* p);
//! Terminates the particle and either deposits all energy locally
//! (electron_treatment = ELECTRON_LED) or creates secondary bremsstrahlung
//! (electron_treatment = ElectronTreatment::LED) or creates secondary bremsstrahlung
//! photons from electron deflections with charged particles (electron_treatment
//! = ELECTRON_TTB).
//! = ElectronTreatment::TTB).
void sample_electron_reaction(Particle* p);
//! Terminates the particle and either deposits all energy locally
//! (electron_treatment = ELECTRON_LED) or creates secondary bremsstrahlung
//! (electron_treatment = ElectronTreatment::LED) or creates secondary bremsstrahlung
//! photons from electron deflections with charged particles (electron_treatment
//! = ELECTRON_TTB). Two annihilation photons of energy MASS_ELECTRON_EV (0.511
//! = ElectronTreatment::TTB). Two annihilation photons of energy MASS_ELECTRON_EV (0.511
//! MeV) are created and travel in opposite directions.
void sample_positron_reaction(Particle* p);

View file

@ -125,7 +125,7 @@ class ScattData {
//! use nullptr if irrelevant.
//! @return Requested cross section value.
double
get_xs(int xstype, int gin, const int* gout, const double* mu);
get_xs(MgxsType xstype, int gin, const int* gout, const double* mu);
};
//==============================================================================

View file

@ -67,7 +67,7 @@ extern "C" int32_t n_inactive; //!< number of inactive batches
extern "C" int32_t gen_per_batch; //!< number of generations per batch
extern "C" int64_t n_particles; //!< number of particles per generation
extern int electron_treatment; //!< how to treat secondary electrons
extern ElectronTreatment electron_treatment; //!< how to treat secondary electrons
extern std::array<double, 4> energy_cutoff; //!< Energy cutoff in [eV] for each particle type
extern int legendre_to_tabular_points; //!< number of points to convert Legendres
extern int max_order; //!< Maximum Legendre order for multigroup data
@ -77,10 +77,10 @@ extern ResScatMethod res_scat_method; //!< resonance upscattering method
extern double res_scat_energy_min; //!< Min energy in [eV] for res. upscattering
extern double res_scat_energy_max; //!< Max energy in [eV] for res. upscattering
extern std::vector<std::string> res_scat_nuclides; //!< Nuclides using res. upscattering treatment
extern "C" int run_mode; //!< Run mode (eigenvalue, fixed src, etc.)
extern RunMode run_mode; //!< Run mode (eigenvalue, fixed src, etc.)
extern std::unordered_set<int> sourcepoint_batch; //!< Batches when source should be written
extern std::unordered_set<int> statepoint_batch; //!< Batches when state should be written
extern int temperature_method; //!< method for choosing temperatures
extern TemperatureMethod temperature_method; //!< method for choosing temperatures
extern double temperature_tolerance; //!< Tolerance in [K] on choosing temperatures
extern double temperature_default; //!< Default T in [K]
extern std::array<double, 2> temperature_range; //!< Min/max T in [K] over which to load xs

View file

@ -17,17 +17,6 @@
namespace openmc {
//==============================================================================
// Module constant declarations (defined in .cpp)
//==============================================================================
// TODO: Convert to enum
extern "C" const int BC_TRANSMIT;
extern "C" const int BC_VACUUM;
extern "C" const int BC_REFLECT;
extern "C" const int BC_PERIODIC;
extern "C" const int BC_WHITE;
//==============================================================================
// Global variables
//==============================================================================
@ -94,8 +83,18 @@ struct BoundingBox
class Surface
{
public:
// Types of available boundary conditions on a surface
enum class BoundaryType {
TRANSMIT,
VACUUM,
REFLECT,
PERIODIC,
WHITE
};
int id_; //!< Unique ID
int bc_; //!< Boundary condition
BoundaryType bc_; //!< Boundary condition
std::string name_; //!< User-defined name
explicit Surface(pugi::xml_node surf_node);

View file

@ -14,9 +14,17 @@
namespace openmc {
// Different independent variables
enum class DerivativeVariable {
DENSITY,
NUCLIDE_DENSITY,
TEMPERATURE
};
struct TallyDerivative {
DerivativeVariable variable; //!< Independent variable (like temperature)
int id; //!< User-defined identifier
int variable; //!< Independent variable (like temperature)
int diff_material; //!< Material this derivative is applied to
int diff_nuclide; //!< Nuclide this material is applied to
@ -66,12 +74,6 @@ extern std::vector<TallyDerivative> tally_derivs;
extern std::unordered_map<int, int> tally_deriv_map;
} // namespace model
// Independent variables
//TODO: convert to enum
constexpr int DIFF_DENSITY {1};
constexpr int DIFF_NUCLIDE_DENSITY {2};
constexpr int DIFF_TEMPERATURE {3};
} // namespace openmc
#endif // OPENMC_TALLIES_DERIVATIVE_H

View file

@ -58,7 +58,7 @@ public:
//! \param[out] match will contain the matching bins and corresponding
//! weights; note that there may be zero matching bins
virtual void
get_all_bins(const Particle* p, int estimator, FilterMatch& match) const = 0;
get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match) const = 0;
//! Writes data describing this filter to an HDF5 statepoint group.
virtual void

View file

@ -29,7 +29,7 @@ public:
void from_xml(pugi::xml_node node) override;
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
const override;
void to_statepoint(hid_t filter_group) const override;

View file

@ -30,7 +30,7 @@ public:
void from_xml(pugi::xml_node node) override;
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
const override;
void to_statepoint(hid_t filter_group) const override;

View file

@ -33,7 +33,7 @@ public:
void from_xml(pugi::xml_node node) override;
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
const override;
void to_statepoint(hid_t filter_group) const override;

View file

@ -19,7 +19,7 @@ public:
std::string type() const override {return "cellborn";}
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
const override;
std::string text_label(int bin) const override;

View file

@ -19,7 +19,7 @@ public:
std::string type() const override {return "cellfrom";}
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
const override;
std::string text_label(int bin) const override;

View file

@ -31,7 +31,7 @@ public:
void from_xml(pugi::xml_node node) override;
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
const override;
void to_statepoint(hid_t filter_group) const override;

View file

@ -26,7 +26,7 @@ public:
void from_xml(pugi::xml_node node) override;
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
const override;
void to_statepoint(hid_t filter_group) const override;

View file

@ -28,7 +28,7 @@ public:
void from_xml(pugi::xml_node node) override;
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
const override;
void to_statepoint(hid_t filter_group) const override;
@ -68,7 +68,7 @@ public:
std::string type() const override {return "energyout";}
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
const override;
std::string text_label(int bin) const override;

View file

@ -33,7 +33,7 @@ public:
void from_xml(pugi::xml_node node) override;
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
const override;
void to_statepoint(hid_t filter_group) const override;

View file

@ -26,7 +26,7 @@ public:
void from_xml(pugi::xml_node node) override;
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
const override;
void to_statepoint(hid_t filter_group) const override;

View file

@ -30,7 +30,7 @@ public:
void from_xml(pugi::xml_node node) override;
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
const override;
void to_statepoint(hid_t filter_group) const override;

View file

@ -28,7 +28,7 @@ public:
void from_xml(pugi::xml_node node) override;
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
const override;
void to_statepoint(hid_t filter_group) const override;

View file

@ -13,7 +13,7 @@ public:
std::string type() const override {return "meshsurface";}
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
const override;
std::string text_label(int bin) const override;
@ -22,6 +22,21 @@ public:
// Accessors
void set_mesh(int32_t mesh) override;
enum class MeshDir {
OUT_LEFT, // x min
IN_LEFT, // x min
OUT_RIGHT, // x max
IN_RIGHT, // x max
OUT_BACK, // y min
IN_BACK, // y min
OUT_FRONT, // y max
IN_FRONT, // y max
OUT_BOTTOM, // z min
IN_BOTTOM, // z min
OUT_TOP, // z max
IN_TOP // z max
};
};
} // namespace openmc

View file

@ -29,7 +29,7 @@ public:
void from_xml(pugi::xml_node node) override;
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
const override;
void to_statepoint(hid_t filter_group) const override;

View file

@ -27,7 +27,7 @@ public:
void from_xml(pugi::xml_node node) override;
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
const override;
void to_statepoint(hid_t filter_group) const override;

View file

@ -29,7 +29,7 @@ public:
void from_xml(pugi::xml_node node) override;
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
const override;
void to_statepoint(hid_t filter_group) const override;

View file

@ -32,7 +32,7 @@ public:
void from_xml(pugi::xml_node node) override;
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
const override;
void to_statepoint(hid_t filter_group) const override;

View file

@ -30,7 +30,7 @@ public:
void from_xml(pugi::xml_node node) override;
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
const override;
void to_statepoint(hid_t filter_group) const override;

View file

@ -30,7 +30,7 @@ public:
void from_xml(pugi::xml_node node) override;
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
const override;
void to_statepoint(hid_t filter_group) const override;

View file

@ -30,7 +30,7 @@ public:
void from_xml(pugi::xml_node node) override;
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
const override;
void to_statepoint(hid_t filter_group) const override;

View file

@ -26,7 +26,7 @@ public:
void from_xml(pugi::xml_node node) override;
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
const override;
void to_statepoint(hid_t filter_group) const override;
@ -76,7 +76,7 @@ public:
std::string type() const override {return "zernikeradial";}
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
const override;
std::string text_label(int bin) const override;

View file

@ -79,10 +79,10 @@ public:
std::string name_; //!< User-defined name
int type_ {TALLY_VOLUME}; //!< e.g. volume, surface current
TallyType type_ {TallyType::VOLUME}; //!< e.g. volume, surface current
//! Event type that contributes to this tally
int estimator_ {ESTIMATOR_TRACKLENGTH};
TallyEstimator estimator_ {TallyEstimator::TRACKLENGTH};
//! Whether this tally is currently being updated
bool active_ {false};

View file

@ -16,21 +16,6 @@
namespace openmc {
//==============================================================================
// Constants
//==============================================================================
// Secondary energy mode for S(a,b) inelastic scattering
// TODO: Convert to enum
constexpr int SAB_SECONDARY_EQUAL {0}; // Equally-likely outgoing energy bins
constexpr int SAB_SECONDARY_SKEWED {1}; // Skewed outgoing energy bins
constexpr int SAB_SECONDARY_CONT {2}; // Continuous, linear-linear interpolation
// Elastic mode for S(a,b) elastic scattering
// TODO: Convert to enum
constexpr int SAB_ELASTIC_INCOHERENT {3}; // Incoherent elastic scattering
constexpr int SAB_ELASTIC_COHERENT {4}; // Coherent elastic scattering (Bragg edges)
//==============================================================================
// Global variables
//==============================================================================

View file

@ -46,8 +46,15 @@ public:
//! \param[in] results Vector of results for each domain
void to_hdf5(const std::string& filename, const std::vector<Result>& results) const;
// Tally filter and map types
enum class TallyDomain {
UNIVERSE,
MATERIAL,
CELL
};
// Data members
int domain_type_; //!< Type of domain (cell, material, etc.)
TallyDomain domain_type_; //!< Type of domain (cell, material, etc.)
size_t n_samples_; //!< Number of samples to use
double threshold_ {-1.0}; //!< Error threshold for domain volumes
TriggerMetric trigger_type_ {TriggerMetric::not_active}; //!< Trigger metric for the volume calculation

View file

@ -15,6 +15,15 @@
namespace openmc {
// Angular distribution type
enum class AngleDistributionType {
ISOTROPIC,
EQUI_32,
TABULAR,
LEGENDRE,
HISTOGRAM
};
//==============================================================================
// XSDATA contains the temperature-independent cross section data for an MGXS
//==============================================================================
@ -25,8 +34,8 @@ class XsData {
//! \brief Reads scattering data from the HDF5 file
void
scatter_from_hdf5(hid_t xsdata_grp, size_t n_ang,
int scatter_format, int final_scatter_format, int order_data);
scatter_from_hdf5(hid_t xsdata_grp, size_t n_ang, AngleDistributionType scatter_format,
AngleDistributionType final_scatter_format, int order_data);
//! \brief Reads fission data from the HDF5 file
void
@ -104,8 +113,8 @@ class XsData {
//! @param n_azi Number of azimuthal angles.
//! @param n_groups Number of energy groups.
//! @param n_d_groups Number of delayed neutron groups.
XsData(bool fissionable, int scatter_format, int n_pol, int n_azi,
size_t n_groups, size_t n_d_groups);
XsData(bool fissionable, AngleDistributionType scatter_format, int n_pol,
int n_azi, size_t n_groups, size_t n_d_groups);
//! \brief Loads the XsData object from the HDF5 file
//!
@ -121,8 +130,8 @@ class XsData {
//! @param n_pol Number of polar angles.
//! @param n_azi Number of azimuthal angles.
void
from_hdf5(hid_t xsdata_grp, bool fissionable, int scatter_format,
int final_scatter_format, int order_data, bool is_isotropic, int n_pol,
from_hdf5(hid_t xsdata_grp, bool fissionable, AngleDistributionType scatter_format,
AngleDistributionType final_scatter_format, int order_data, bool is_isotropic, int n_pol,
int n_azi);
//! \brief Combines the microscopic data to a macroscopic object.