File indexing completed on 2025-01-30 10:26:25
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef VECGEOM_VOLUMES_UNPLACEDELLIPTICALTUBE_H_
0010 #define VECGEOM_VOLUMES_UNPLACEDELLIPTICALTUBE_H_
0011
0012 #include "VecGeom/base/Cuda.h"
0013 #include "VecGeom/base/Global.h"
0014 #include "VecGeom/base/AlignedBase.h"
0015 #include "VecGeom/base/Vector3D.h"
0016 #include "VecGeom/volumes/UnplacedVolume.h"
0017 #include "VecGeom/volumes/EllipticalTubeStruct.h" // the pure EllipticalTube struct
0018 #include "VecGeom/volumes/kernel/EllipticalTubeImplementation.h"
0019 #include "VecGeom/volumes/UnplacedVolumeImplHelper.h"
0020
0021 namespace vecgeom {
0022
0023 VECGEOM_DEVICE_FORWARD_DECLARE(class UnplacedEllipticalTube;);
0024 VECGEOM_DEVICE_DECLARE_CONV(class, UnplacedEllipticalTube);
0025
0026 inline namespace VECGEOM_IMPL_NAMESPACE {
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 class UnplacedEllipticalTube : public SIMDUnplacedVolumeImplHelper<EllipticalTubeImplementation>, public AlignedBase {
0037
0038 private:
0039 EllipticalTubeStruct<Precision> fEllipticalTube;
0040
0041
0042 VECCORE_ATT_HOST_DEVICE
0043 void CheckParameters();
0044
0045 public:
0046
0047
0048
0049
0050 VECCORE_ATT_HOST_DEVICE
0051 UnplacedEllipticalTube(Precision dx, Precision dy, Precision dz);
0052
0053
0054 VECCORE_ATT_HOST_DEVICE
0055 EllipticalTubeStruct<Precision> const &GetStruct() const { return fEllipticalTube; }
0056
0057
0058 VECCORE_ATT_HOST_DEVICE
0059 VECGEOM_FORCE_INLINE
0060 Precision GetDx() const { return fEllipticalTube.fDx; }
0061
0062
0063 VECCORE_ATT_HOST_DEVICE
0064 VECGEOM_FORCE_INLINE
0065 Precision GetDy() const { return fEllipticalTube.fDy; }
0066
0067
0068 VECCORE_ATT_HOST_DEVICE
0069 VECGEOM_FORCE_INLINE
0070 Precision GetDz() const { return fEllipticalTube.fDz; }
0071
0072
0073
0074
0075
0076 VECCORE_ATT_HOST_DEVICE
0077 VECGEOM_FORCE_INLINE
0078 void SetParameters(Precision dx, Precision dy, Precision dz)
0079 {
0080 fEllipticalTube.fDx = dx;
0081 fEllipticalTube.fDy = dy;
0082 fEllipticalTube.fDz = dz;
0083 CheckParameters();
0084 };
0085
0086
0087 VECCORE_ATT_HOST_DEVICE
0088 VECGEOM_FORCE_INLINE
0089 void SetDx(Precision dx)
0090 {
0091 fEllipticalTube.fDx = dx;
0092 CheckParameters();
0093 };
0094
0095
0096 VECCORE_ATT_HOST_DEVICE
0097 VECGEOM_FORCE_INLINE
0098 void SetDy(Precision dy)
0099 {
0100 fEllipticalTube.fDy = dy;
0101 CheckParameters();
0102 };
0103
0104
0105 VECCORE_ATT_HOST_DEVICE
0106 VECGEOM_FORCE_INLINE
0107 void SetDz(Precision dz)
0108 {
0109 fEllipticalTube.fDz = dz;
0110 CheckParameters();
0111 };
0112
0113 VECCORE_ATT_HOST_DEVICE
0114 void Extent(Vector3D<Precision> &, Vector3D<Precision> &) const override;
0115
0116 Precision Capacity() const override { return fEllipticalTube.fCubicVolume; }
0117
0118 Precision SurfaceArea() const override { return fEllipticalTube.fSurfaceArea; }
0119
0120 Vector3D<Precision> SamplePointOnSurface() const override;
0121
0122 VECCORE_ATT_HOST_DEVICE
0123 virtual bool Normal(Vector3D<Precision> const &p, Vector3D<Precision> &normal) const override
0124 {
0125 bool valid;
0126 normal = EllipticalTubeImplementation::NormalKernel(fEllipticalTube, p, valid);
0127 return valid;
0128 }
0129
0130
0131
0132 std::string GetEntityType() const { return "EllipticalTube"; }
0133
0134 std::ostream &StreamInfo(std::ostream &os) const;
0135
0136 public:
0137 virtual int MemorySize() const final { return sizeof(*this); }
0138
0139 VECCORE_ATT_HOST_DEVICE
0140 virtual void Print() const override;
0141
0142 virtual void Print(std::ostream &os) const override;
0143
0144 #ifndef VECCORE_CUDA
0145 virtual SolidMesh *CreateMesh3D(Transformation3D const &trans, size_t nSegments) const override;
0146 #endif
0147
0148 #ifdef VECGEOM_CUDA_INTERFACE
0149 virtual size_t DeviceSizeOf() const override { return DevicePtr<cuda::UnplacedEllipticalTube>::SizeOf(); }
0150 virtual DevicePtr<cuda::VUnplacedVolume> CopyToGpu() const override;
0151 virtual DevicePtr<cuda::VUnplacedVolume> CopyToGpu(DevicePtr<cuda::VUnplacedVolume> const gpu_ptr) const override;
0152 #endif
0153
0154
0155 #ifndef VECCORE_CUDA
0156 template <TranslationCode trans_code, RotationCode rot_code>
0157 static VPlacedVolume *Create(LogicalVolume const *const logical_volume, Transformation3D const *const transformation,
0158 VPlacedVolume *const placement = NULL);
0159
0160 VPlacedVolume *SpecializedVolume(LogicalVolume const *const volume, Transformation3D const *const transformation,
0161 const TranslationCode trans_code, const RotationCode rot_code,
0162 VPlacedVolume *const placement) const override;
0163 #else
0164 template <TranslationCode trans_code, RotationCode rot_code>
0165 VECCORE_ATT_DEVICE
0166 static VPlacedVolume *Create(LogicalVolume const *const logical_volume, Transformation3D const *const transformation,
0167 const int id, const int copy_no, const int child_id,
0168 VPlacedVolume *const placement = NULL);
0169 VECCORE_ATT_DEVICE VPlacedVolume *SpecializedVolume(LogicalVolume const *const volume,
0170 Transformation3D const *const transformation,
0171 const TranslationCode trans_code, const RotationCode rot_code,
0172 const int id, const int copy_no, const int child_id,
0173 VPlacedVolume *const placement) const override;
0174
0175 #endif
0176 };
0177 }
0178 }
0179
0180 #endif