File indexing completed on 2026-04-10 07:50:34
0001 #pragma once
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #include <cassert>
0019 #include <cstring>
0020 #include "stag.h"
0021
0022 enum
0023 {
0024 U4Stack_Unclassified = 0,
0025 U4Stack_RestDiscreteReset = 1,
0026 U4Stack_DiscreteReset = 2,
0027 U4Stack_ScintDiscreteReset = 3,
0028 U4Stack_BoundaryDiscreteReset = 4,
0029 U4Stack_RayleighDiscreteReset = 5,
0030 U4Stack_AbsorptionDiscreteReset = 6,
0031 U4Stack_BoundaryBurn_SurfaceReflectTransmitAbsorb = 7,
0032 U4Stack_BoundaryDiDiTransCoeff = 8,
0033 U4Stack_AbsorptionEffDetect = 9,
0034 U4Stack_RayleighScatter = 10,
0035 U4Stack_BoundaryDiMeReflectivity = 11,
0036 U4Stack_ChooseReflection = 12,
0037 U4Stack_RandomDirection = 13,
0038 U4Stack_LambertianRand = 14,
0039 U4Stack_Reemission = 15
0040
0041 };
0042
0043 struct U4Stack
0044 {
0045 static const char* Name(unsigned stack);
0046 static unsigned Code(const char* name);
0047 static unsigned TagToStack(unsigned tag);
0048
0049 static constexpr const char* Unclassified_ = "Unclassified" ;
0050 static constexpr const char* RestDiscreteReset_ = "RestDiscreteReset" ;
0051 static constexpr const char* DiscreteReset_ = "DiscreteReset" ;
0052 static constexpr const char* ScintDiscreteReset_ = "ScintDiscreteReset" ;
0053 static constexpr const char* BoundaryDiscreteReset_ = "BoundaryDiscreteReset" ;
0054 static constexpr const char* RayleighDiscreteReset_ = "RayleighDiscreteReset" ;
0055 static constexpr const char* AbsorptionDiscreteReset_ = "AbsorptionDiscreteReset" ;
0056 static constexpr const char* BoundaryBurn_SurfaceReflectTransmitAbsorb_ = "BoundaryBurn_SurfaceReflectTransmitAbsorb" ;
0057 static constexpr const char* BoundaryDiDiTransCoeff_ = "BoundaryDiDiTransCoeff" ;
0058 static constexpr const char* AbsorptionEffDetect_ = "AbsorptionEffDetect" ;
0059 static constexpr const char* RayleighScatter_ = "RayleighScatter" ;
0060 static constexpr const char* BoundaryDiMeReflectivity_ = "BoundaryDiMeReflectivity" ;
0061 static constexpr const char* ChooseReflection_ = "ChooseReflection" ;
0062 static constexpr const char* RandomDirection_ = "RandomDirection" ;
0063 static constexpr const char* LambertianRand_ = "LambertianRand" ;
0064 static constexpr const char* Reemission_ = "Reemission" ;
0065
0066
0067 static constexpr const char* BoundaryBurn_SurfaceReflectTransmitAbsorb_note = R"(
0068 BoundaryBurn_SurfaceReflectTransmitAbsorb : Chameleon Rand
0069 ------------------------------------------------------------
0070
0071 BoundaryBurn
0072 when no surface is associated to a boundary this random does nothing : always a burn
0073
0074 SurfaceReflectTransmitAbsorb
0075 when a surface with reflectivity less than 1. is associated this rand comes alive
0076 and determines the reflect/absorb/transmit decision
0077
0078 )" ;
0079
0080
0081 };
0082
0083
0084 inline const char* U4Stack::Name(unsigned stack)
0085 {
0086 const char* s = nullptr ;
0087 switch(stack)
0088 {
0089 case U4Stack_Unclassified: s = Unclassified_ ; break ;
0090 case U4Stack_RestDiscreteReset: s = RestDiscreteReset_ ; break ;
0091 case U4Stack_DiscreteReset: s = DiscreteReset_ ; break ;
0092 case U4Stack_ScintDiscreteReset: s = ScintDiscreteReset_ ; break ;
0093 case U4Stack_BoundaryDiscreteReset: s = BoundaryDiscreteReset_ ; break ;
0094 case U4Stack_RayleighDiscreteReset: s = RayleighDiscreteReset_ ; break ;
0095 case U4Stack_AbsorptionDiscreteReset: s = AbsorptionDiscreteReset_ ; break ;
0096 case U4Stack_BoundaryBurn_SurfaceReflectTransmitAbsorb: s = BoundaryBurn_SurfaceReflectTransmitAbsorb_ ; break ;
0097 case U4Stack_BoundaryDiDiTransCoeff: s = BoundaryDiDiTransCoeff_ ; break ;
0098 case U4Stack_AbsorptionEffDetect: s = AbsorptionEffDetect_ ; break ;
0099 case U4Stack_RayleighScatter: s = RayleighScatter_ ; break ;
0100 case U4Stack_BoundaryDiMeReflectivity: s = BoundaryDiMeReflectivity_ ; break ;
0101 case U4Stack_ChooseReflection: s = ChooseReflection_ ; break ;
0102 case U4Stack_RandomDirection: s = RandomDirection_ ; break ;
0103 case U4Stack_LambertianRand: s = LambertianRand_ ; break ;
0104 case U4Stack_Reemission: s = Reemission_ ; break ;
0105 }
0106 if(s) assert( Code(s) == stack ) ;
0107 return s ;
0108 }
0109
0110 inline unsigned U4Stack::Code(const char* name)
0111 {
0112 unsigned stack = U4Stack_Unclassified ;
0113 if(strcmp(name, Unclassified_) == 0 ) stack = U4Stack_Unclassified ;
0114 if(strcmp(name, RestDiscreteReset_) == 0 ) stack = U4Stack_RestDiscreteReset ;
0115 if(strcmp(name, DiscreteReset_) == 0) stack = U4Stack_DiscreteReset ;
0116 if(strcmp(name, ScintDiscreteReset_) == 0 ) stack = U4Stack_ScintDiscreteReset ;
0117 if(strcmp(name, BoundaryDiscreteReset_) == 0) stack = U4Stack_BoundaryDiscreteReset ;
0118 if(strcmp(name, RayleighDiscreteReset_) == 0 ) stack = U4Stack_RayleighDiscreteReset ;
0119 if(strcmp(name, AbsorptionDiscreteReset_) == 0 ) stack = U4Stack_AbsorptionDiscreteReset ;
0120 if(strcmp(name, BoundaryBurn_SurfaceReflectTransmitAbsorb_) == 0) stack = U4Stack_BoundaryBurn_SurfaceReflectTransmitAbsorb ;
0121 if(strcmp(name, BoundaryDiDiTransCoeff_) == 0) stack = U4Stack_BoundaryDiDiTransCoeff ;
0122 if(strcmp(name, AbsorptionEffDetect_) == 0) stack = U4Stack_AbsorptionEffDetect ;
0123 if(strcmp(name, RayleighScatter_) == 0 ) stack = U4Stack_RayleighScatter ;
0124 if(strcmp(name, BoundaryDiMeReflectivity_) == 0 ) stack = U4Stack_BoundaryDiMeReflectivity ;
0125 if(strcmp(name, ChooseReflection_) == 0 ) stack = U4Stack_ChooseReflection ;
0126 if(strcmp(name, RandomDirection_) == 0 ) stack = U4Stack_RandomDirection ;
0127 if(strcmp(name, LambertianRand_) == 0 ) stack = U4Stack_LambertianRand ;
0128 if(strcmp(name, Reemission_) == 0 ) stack = U4Stack_Reemission ;
0129
0130 return stack ;
0131 }
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149 inline unsigned U4Stack::TagToStack(unsigned tag)
0150 {
0151 unsigned stack = U4Stack_Unclassified ;
0152 switch(tag)
0153 {
0154 case stag_undef: stack = U4Stack_Unclassified ; break ;
0155 case stag_to_sci: stack = U4Stack_ScintDiscreteReset ; break ;
0156 case stag_to_bnd: stack = U4Stack_BoundaryDiscreteReset ; break ;
0157 case stag_to_sca: stack = U4Stack_RayleighDiscreteReset ; break ;
0158 case stag_to_abs: stack = U4Stack_AbsorptionDiscreteReset ; break ;
0159 case stag_at_burn_sf_sd: stack = U4Stack_BoundaryBurn_SurfaceReflectTransmitAbsorb ; break ;
0160 case stag_at_ref: stack = U4Stack_BoundaryDiDiTransCoeff ; break ;
0161 case stag_sf_burn: stack = U4Stack_AbsorptionEffDetect ; break ;
0162 case stag_sc: stack = U4Stack_RayleighScatter ; break ;
0163 case stag_to_ree: stack = U4Stack_Unclassified ; break ;
0164 case stag_re_wl: stack = U4Stack_Unclassified ; break ;
0165 case stag_re_mom_ph: stack = U4Stack_Unclassified ; break ;
0166 case stag_re_mom_ct: stack = U4Stack_Unclassified ; break ;
0167 case stag_re_pol_ph: stack = U4Stack_Unclassified ; break ;
0168 case stag_re_pol_ct: stack = U4Stack_Unclassified ; break ;
0169 case stag_hp_ph: stack = U4Stack_Unclassified ; break ;
0170
0171 }
0172 return stack ;
0173 }
0174