Warning, file /include/orange/surf/SurfaceTypeTraits.hh was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 
0002 
0003 
0004 
0005 
0006 
0007 #pragma once
0008 
0009 #include "corecel/cont/EnumClassUtils.hh"
0010 #include "corecel/math/Algorithms.hh"
0011 #include "orange/OrangeTypes.hh"
0012 
0013 #include "SurfaceFwd.hh"
0014 
0015 namespace celeritas
0016 {
0017 
0018 
0019 
0020 
0021 
0022 
0023 
0024 
0025 template<SurfaceType S>
0026 struct SurfaceTypeTraits;
0027 
0028 #define ORANGE_SURFACE_TRAITS(ENUM_VALUE, CLS)                          \
0029     template<>                                                          \
0030     struct SurfaceTypeTraits<SurfaceType::ENUM_VALUE>                   \
0031         : public EnumToClass<SurfaceType, SurfaceType::ENUM_VALUE, CLS> \
0032     {                                                                   \
0033     }
0034 
0035 
0036 ORANGE_SURFACE_TRAITS(px,  PlaneAligned<Axis::x>);
0037 ORANGE_SURFACE_TRAITS(py,  PlaneAligned<Axis::y>);
0038 ORANGE_SURFACE_TRAITS(pz,  PlaneAligned<Axis::z>);
0039 ORANGE_SURFACE_TRAITS(cxc, CylCentered<Axis::x>);
0040 ORANGE_SURFACE_TRAITS(cyc, CylCentered<Axis::y>);
0041 ORANGE_SURFACE_TRAITS(czc, CylCentered<Axis::z>);
0042 ORANGE_SURFACE_TRAITS(sc,  SphereCentered);
0043 ORANGE_SURFACE_TRAITS(cx,  CylAligned<Axis::x>);
0044 ORANGE_SURFACE_TRAITS(cy,  CylAligned<Axis::y>);
0045 ORANGE_SURFACE_TRAITS(cz,  CylAligned<Axis::z>);
0046 ORANGE_SURFACE_TRAITS(p,   Plane);
0047 ORANGE_SURFACE_TRAITS(s,   Sphere);
0048 ORANGE_SURFACE_TRAITS(kx,  ConeAligned<Axis::x>);
0049 ORANGE_SURFACE_TRAITS(ky,  ConeAligned<Axis::y>);
0050 ORANGE_SURFACE_TRAITS(kz,  ConeAligned<Axis::z>);
0051 ORANGE_SURFACE_TRAITS(sq,  SimpleQuadric);
0052 ORANGE_SURFACE_TRAITS(gq,  GeneralQuadric);
0053 ORANGE_SURFACE_TRAITS(inv, Involute);
0054 
0055 
0056 #undef ORANGE_SURFACE_TRAITS
0057 
0058 
0059 
0060 
0061 
0062 
0063 
0064 
0065 template<class F>
0066 CELER_CONSTEXPR_FUNCTION decltype(auto)
0067 visit_surface_type(F&& func, SurfaceType st)
0068 {
0069 #define ORANGE_ST_VISIT_CASE(TYPE)          \
0070     case SurfaceType::TYPE:                 \
0071         return celeritas::forward<F>(func)( \
0072             SurfaceTypeTraits<SurfaceType::TYPE>{})
0073 
0074     switch (st)
0075     {
0076         ORANGE_ST_VISIT_CASE(px);
0077         ORANGE_ST_VISIT_CASE(py);
0078         ORANGE_ST_VISIT_CASE(pz);
0079         ORANGE_ST_VISIT_CASE(cxc);
0080         ORANGE_ST_VISIT_CASE(cyc);
0081         ORANGE_ST_VISIT_CASE(czc);
0082         ORANGE_ST_VISIT_CASE(sc);
0083         ORANGE_ST_VISIT_CASE(cx);
0084         ORANGE_ST_VISIT_CASE(cy);
0085         ORANGE_ST_VISIT_CASE(cz);
0086         ORANGE_ST_VISIT_CASE(p);
0087         ORANGE_ST_VISIT_CASE(s);
0088         ORANGE_ST_VISIT_CASE(kx);
0089         ORANGE_ST_VISIT_CASE(ky);
0090         ORANGE_ST_VISIT_CASE(kz);
0091         ORANGE_ST_VISIT_CASE(sq);
0092         ORANGE_ST_VISIT_CASE(gq);
0093         case SurfaceType::inv:
0094             
0095             
0096             CELER_ASSERT_UNREACHABLE();
0097         default:
0098             CELER_ASSERT_UNREACHABLE();
0099     }
0100 #undef ORANGE_ST_VISIT_CASE
0101 }
0102 
0103 
0104 }