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