Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-08 09:28:09

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 // structure that provides (indirect) implementation kernels
0015 // for a certain unplaced volume which is implemented in terms of
0016 // another one
0017 template <typename UnplVol_t, typename DispatchingImplementation>
0018 struct IndirectImplementation {
0019 
0020   using PlacedShape_t    = PlacedImplAs<UnplVol_t>; // typename DispatchingImplementation::PlacedShape_t;
0021   using UnplacedStruct_t = typename DispatchingImplementation::UnplacedStruct_t;
0022   using UnplacedVolume_t = UnplVol_t;
0023 
0024   template <typename Real_v, typename Bool_v>
0025   VECGEOM_FORCE_INLINE VECCORE_ATT_HOST_DEVICE static void Contains(UnplacedStruct_t const &s,
0026                                                                     Vector3D<Real_v> const &point, Bool_v &inside)
0027   {
0028     DispatchingImplementation::template Contains<>(s, point, inside);
0029   }
0030 
0031   template <typename Real_v, typename Inside_t>
0032   VECGEOM_FORCE_INLINE VECCORE_ATT_HOST_DEVICE static void Inside(UnplacedStruct_t const &s,
0033                                                                   Vector3D<Real_v> const &point, Inside_t &inside)
0034   {
0035     DispatchingImplementation::template Inside<>(s, point, inside);
0036   }
0037 
0038   template <typename Real_v>
0039   VECGEOM_FORCE_INLINE VECCORE_ATT_HOST_DEVICE static void DistanceToIn(UnplacedStruct_t const &s,
0040                                                                         Vector3D<Real_v> const &point,
0041                                                                         Vector3D<Real_v> const &direction,
0042                                                                         Real_v const &stepMax, Real_v &distance)
0043   {
0044     DispatchingImplementation::template DistanceToIn<>(s, point, direction, stepMax, distance);
0045   }
0046 
0047   template <typename Real_v>
0048   VECGEOM_FORCE_INLINE VECCORE_ATT_HOST_DEVICE static void DistanceToOut(UnplacedStruct_t const &s,
0049                                                                          Vector3D<Real_v> const &point,
0050                                                                          Vector3D<Real_v> const &direction,
0051                                                                          Real_v const &stepMax, Real_v &distance)
0052   {
0053     DispatchingImplementation::template DistanceToOut<>(s, point, direction, stepMax, distance);
0054   }
0055 
0056   template <typename Real_v>
0057   VECGEOM_FORCE_INLINE VECCORE_ATT_HOST_DEVICE static void SafetyToIn(UnplacedStruct_t const &s,
0058                                                                       Vector3D<Real_v> const &point, Real_v &safety)
0059   {
0060     DispatchingImplementation::template SafetyToIn<>(s, point, safety);
0061   }
0062 
0063   template <typename Real_v>
0064   VECGEOM_FORCE_INLINE VECCORE_ATT_HOST_DEVICE static void SafetyToOut(UnplacedStruct_t const &s,
0065                                                                        Vector3D<Real_v> const &point, Real_v &safety)
0066   {
0067     DispatchingImplementation::template SafetyToOut<>(s, point, safety);
0068   }
0069 
0070   template <typename Real_v>
0071   VECGEOM_FORCE_INLINE VECCORE_ATT_HOST_DEVICE static Vector3D<Real_v> NormalKernel(
0072       UnplacedStruct_t const &s, Vector3D<Real_v> const &point, typename vecCore::Mask_v<Real_v> &valid)
0073   {
0074     DispatchingImplementation::template NormalKernel<>(s, point, valid);
0075   }
0076 };
0077 
0078 } // namespace VECGEOM_IMPL_NAMESPACE
0079 } // namespace vecgeom
0080 
0081 #endif // VECGEOM_VOLUMES_KERNEL_INDIRECTIMPLEMENTATION_H_