File indexing completed on 2025-01-30 10:26:04
0001
0002
0003
0004 #ifndef VECGEOM_MANAGEMENT_BVHMANAGER_H_
0005 #define VECGEOM_MANAGEMENT_BVHMANAGER_H_
0006
0007 #include "VecGeom/base/Config.h"
0008 #include "VecGeom/base/Cuda.h"
0009 #include "VecGeom/base/BVH.h"
0010 #include "VecGeom/volumes/LogicalVolume.h"
0011
0012 #ifdef VECGEOM_ENABLE_CUDA
0013 #include "VecGeom/backend/cuda/Interface.h"
0014 #endif
0015
0016 namespace vecgeom {
0017 inline namespace VECGEOM_IMPL_NAMESPACE {
0018 inline std::vector<BVH *> hBVH;
0019 #ifdef VECGEOM_ENABLE_CUDA
0020 inline __device__ BVH *dBVH;
0021 #endif
0022
0023
0024
0025
0026
0027
0028 class BVHManager {
0029 public:
0030 BVHManager() = delete;
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042 static void Init();
0043
0044 #ifdef VECGEOM_CUDA_INTERFACE
0045
0046 static void DeviceInit();
0047 #endif
0048
0049 VECCORE_ATT_HOST_DEVICE
0050 static BVH const *GetBVH(int id)
0051 {
0052 #ifdef VECCORE_CUDA_DEVICE_COMPILATION
0053 return &cuda::dBVH[id];
0054 #else
0055 return hBVH[id];
0056 #endif
0057 }
0058
0059 VECCORE_ATT_HOST_DEVICE
0060 static BVH const *GetBVH(LogicalVolume const *v) { return GetBVH(v->id()); }
0061 };
0062
0063 }
0064 }
0065
0066 #endif