File indexing completed on 2025-01-18 10:14:02
0001 #ifndef VECGEOM_VOLUMES_KERNEL_INDIRECTIMPLEMENTATION_H_
0002 #define VECGEOM_VOLUMES_KERNEL_INDIRECTIMPLEMENTATION_H_
0003
0004 #include "VecGeom/base/Vector3D.h"
0005 #include <VecCore/VecCore>
0006 #include <VecGeom/volumes/PlacedImplAs.h>
0007
0008 namespace vecgeom {
0009
0010 VECGEOM_DEVICE_DECLARE_CONV_TEMPLATE_2t(struct, IndirectImplementation, typename, typename);
0011
0012 inline namespace VECGEOM_IMPL_NAMESPACE {
0013
0014
0015
0016
0017 template <typename UnplVol_t, typename DispatchingImplementation>
0018 struct IndirectImplementation {
0019
0020 using PlacedShape_t = PlacedImplAs<UnplVol_t>;
0021 using UnplacedStruct_t = typename DispatchingImplementation::UnplacedStruct_t;
0022 using UnplacedVolume_t = UnplVol_t;
0023
0024 VECCORE_ATT_HOST_DEVICE
0025 static void PrintType()
0026 {
0027
0028 }
0029
0030 template <typename Stream>
0031 static void PrintType(Stream &st, int transCodeT = translation::kGeneric, int rotCodeT = rotation::kGeneric)
0032 {
0033 DispatchingImplementation::PrintType(st, transCodeT, rotCodeT);
0034 }
0035
0036 template <typename Stream>
0037 static void PrintImplementationType(Stream &st)
0038 {
0039 (void)st;
0040
0041 }
0042
0043 template <typename Stream>
0044 static void PrintUnplacedType(Stream &st)
0045 {
0046 (void)st;
0047 }
0048
0049 template <typename Real_v, typename Bool_v>
0050 VECGEOM_FORCE_INLINE
0051 VECCORE_ATT_HOST_DEVICE
0052 static void Contains(UnplacedStruct_t const &s, Vector3D<Real_v> const &point, Bool_v &inside)
0053 {
0054 DispatchingImplementation::template Contains(s, point, inside);
0055 }
0056
0057 template <typename Real_v, typename Inside_t>
0058 VECGEOM_FORCE_INLINE
0059 VECCORE_ATT_HOST_DEVICE
0060 static void Inside(UnplacedStruct_t const &s, Vector3D<Real_v> const &point, Inside_t &inside)
0061 {
0062 DispatchingImplementation::template Inside(s, point, inside);
0063 }
0064
0065 template <typename Real_v>
0066 VECGEOM_FORCE_INLINE
0067 VECCORE_ATT_HOST_DEVICE
0068 static void DistanceToIn(UnplacedStruct_t const &s, Vector3D<Real_v> const &point, Vector3D<Real_v> const &direction,
0069 Real_v const &stepMax, Real_v &distance)
0070 {
0071 DispatchingImplementation::template DistanceToIn(s, point, direction, stepMax, distance);
0072 }
0073
0074 template <typename Real_v>
0075 VECGEOM_FORCE_INLINE
0076 VECCORE_ATT_HOST_DEVICE
0077 static void DistanceToOut(UnplacedStruct_t const &s, Vector3D<Real_v> const &point, Vector3D<Real_v> const &direction,
0078 Real_v const &stepMax, Real_v &distance)
0079 {
0080 DispatchingImplementation::template DistanceToOut(s, point, direction, stepMax, distance);
0081 }
0082
0083 template <typename Real_v>
0084 VECGEOM_FORCE_INLINE
0085 VECCORE_ATT_HOST_DEVICE
0086 static void SafetyToIn(UnplacedStruct_t const &s, Vector3D<Real_v> const &point, Real_v &safety)
0087 {
0088 DispatchingImplementation::template SafetyToIn(s, point, safety);
0089 }
0090
0091 template <typename Real_v>
0092 VECGEOM_FORCE_INLINE
0093 VECCORE_ATT_HOST_DEVICE
0094 static void SafetyToOut(UnplacedStruct_t const &s, Vector3D<Real_v> const &point, Real_v &safety)
0095 {
0096 DispatchingImplementation::template SafetyToOut(s, point, safety);
0097 }
0098
0099 template <typename Real_v>
0100 VECGEOM_FORCE_INLINE
0101 VECCORE_ATT_HOST_DEVICE
0102 static Vector3D<Real_v> NormalKernel(UnplacedStruct_t const &s, Vector3D<Real_v> const &point,
0103 typename vecCore::Mask_v<Real_v> &valid)
0104 {
0105 DispatchingImplementation::template NormalKernel(s, point, valid);
0106 }
0107 };
0108
0109 }
0110 }
0111
0112 #endif