File indexing completed on 2026-10-27 09:40:47
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include "corecel/math/Algorithms.hh"
0010 #include "orange/OrangeTypes.hh"
0011
0012 namespace celeritas
0013 {
0014
0015 struct SimpleUnitRecord;
0016 class SimpleUnitTracker;
0017 class RectArrayTracker;
0018
0019
0020
0021
0022
0023 template<UnivType U>
0024 struct UnivTypeTraits;
0025
0026 #define ORANGE_UNIV_TRAITS(ENUM_VALUE, CLS) \
0027 template<> \
0028 struct UnivTypeTraits<UnivType::ENUM_VALUE> \
0029 { \
0030 using record_type = CLS##Record; \
0031 using tracker_type = CLS##Tracker; \
0032 }
0033
0034 ORANGE_UNIV_TRAITS(simple, SimpleUnit);
0035 ORANGE_UNIV_TRAITS(rect_array, RectArray);
0036
0037 #undef ORANGE_UNIV_TRAITS
0038
0039
0040
0041
0042
0043
0044
0045
0046 template<class F>
0047 CELER_CONSTEXPR_FUNCTION decltype(auto) visit_univ_type(F&& func, UnivType ut)
0048 {
0049 #define ORANGE_UT_VISIT_CASE(TYPE) \
0050 case UnivType::TYPE: \
0051 return celeritas::forward<F>(func)(UnivTypeTraits<UnivType::TYPE>{})
0052
0053 switch (ut)
0054 {
0055 ORANGE_UT_VISIT_CASE(simple);
0056 ORANGE_UT_VISIT_CASE(rect_array);
0057 default:
0058 CELER_ASSERT_UNREACHABLE();
0059 }
0060 #undef ORANGE_UT_VISIT_CASE
0061 }
0062
0063
0064 }