File indexing completed on 2026-11-09 10:21:12
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include <type_traits>
0010 #include <VecGeom/base/Cuda.h>
0011 #include <VecGeom/base/Global.h>
0012 #include <VecGeom/base/Version.h>
0013 #include <VecGeom/navigation/NavStateFwd.h>
0014 #include <VecGeom/volumes/PlacedVolume.h>
0015
0016 #include "corecel/OpaqueId.hh"
0017 #include "corecel/Types.hh"
0018
0019 #define CELER_VGNAV_TUPLE 1
0020 #define CELER_VGNAV_INDEX 2
0021 #define CELER_VGNAV_PATH 3
0022
0023 #if defined(VECGEOM_USE_NAVTUPLE)
0024 # define CELER_VGNAV CELER_VGNAV_TUPLE
0025 #elif defined(VECGEOM_USE_NAVINDEX)
0026 # define CELER_VGNAV CELER_VGNAV_INDEX
0027 #else
0028 # define CELER_VGNAV CELER_VGNAV_PATH
0029 #endif
0030
0031 #ifdef VECGEOM_SINGLE_PRECISION
0032 static_assert(CELERITAS_REAL_TYPE == CELERITAS_REAL_TYPE_FLOAT);
0033 #else
0034 static_assert(CELERITAS_REAL_TYPE == CELERITAS_REAL_TYPE_DOUBLE);
0035 #endif
0036
0037 namespace vecgeom
0038 {
0039 #if VECGEOM_VERSION >= 0x020000
0040 template<vecgeom::uint MD>
0041 struct NavTuple;
0042 class NavStateTuple;
0043 #endif
0044 VECGEOM_HOST_FORWARD_DECLARE(class LogicalVolume;);
0045 VECGEOM_DEVICE_FORWARD_DECLARE(class LogicalVolume;);
0046 VECGEOM_HOST_FORWARD_DECLARE(class VPlacedVolume;);
0047 VECGEOM_DEVICE_FORWARD_DECLARE(class VPlacedVolume;);
0048 VECGEOM_HOST_FORWARD_DECLARE(template<class T> class Vector3D;);
0049 VECGEOM_DEVICE_FORWARD_DECLARE(template<class T> class Vector3D;);
0050 }
0051
0052 namespace celeritas
0053 {
0054
0055
0056 using VgPlacedVolumeInt = int;
0057
0058 #if VECGEOM_VERSION >= 0x020000
0059 using vg_real_type = vecgeom::Precision;
0060 #else
0061 using vg_real_type = ::Precision;
0062 #endif
0063
0064 #if defined(VECGEOM_BVH_SINGLE) || defined(__DOXYGEN__)
0065 using vgbvh_real_type = float;
0066 #else
0067 using vgbvh_real_type = double;
0068 #endif
0069
0070 #if VECGEOM_VERSION >= 0x020000
0071
0072 template<vecgeom::uint MD>
0073 struct IsTriviallyCopyable<vecgeom::NavTuple<MD>> : std::true_type
0074 {
0075 };
0076
0077
0078 template<>
0079 struct IsTriviallyCopyable<vecgeom::NavStateTuple> : std::true_type
0080 {
0081 };
0082 #endif
0083
0084
0085
0086
0087
0088
0089 using VgVolumeInstanceId = OpaqueId<struct VecgeomPlacedVolume_,
0090 std::make_unsigned_t<VgPlacedVolumeInt>>;
0091
0092
0093
0094
0095
0096 template<MemSpace M>
0097 using VgLogicalVolume
0098 = MemSpaceCond_t<M, vecgeom::cxx::LogicalVolume, vecgeom::cuda::LogicalVolume>;
0099
0100 template<MemSpace M>
0101 using VgPlacedVolume
0102 = MemSpaceCond_t<M, vecgeom::cxx::VPlacedVolume, vecgeom::cuda::VPlacedVolume>;
0103
0104 template<class T, MemSpace M>
0105 using VgVector3
0106 = MemSpaceCond_t<M, vecgeom::cxx::Vector3D<T>, vecgeom::cuda::Vector3D<T>>;
0107
0108 using VgReal3 = VgVector3<vg_real_type, MemSpace::native>;
0109
0110
0111
0112
0113
0114 #if VECGEOM_VERSION >= 0x020000
0115 using VgNavIndex = vecgeom::NavIndex_t;
0116 #else
0117 using VgNavIndex = ::NavIndex_t;
0118 #endif
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128 using VgNavState = vecgeom::NavigationState;
0129
0130
0131
0132
0133
0134
0135
0136 template<class T>
0137 inline CELER_FUNCTION auto to_vgvector(Array<T, 3> const& a)
0138 -> VgVector3<T, MemSpace::native>
0139 {
0140 return {a[0], a[1], a[2]};
0141 }
0142
0143
0144
0145
0146
0147 template<class T>
0148 inline CELER_FUNCTION auto to_array(vecgeom::Vector3D<T> const& vgv)
0149 -> Array<T, 3>
0150 {
0151 return {vgv[0], vgv[1], vgv[2]};
0152 }
0153
0154
0155 }