File indexing completed on 2025-01-18 10:14:15
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef VECGEOM_VOLUMES_UNPLACEDPARABOLOID_H_
0010 #define VECGEOM_VOLUMES_UNPLACEDPARABOLOID_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/ParaboloidStruct.h" // the pure Paraboloid struct
0018 #include "VecGeom/volumes/kernel/ParaboloidImplementation.h"
0019 #include "VecGeom/volumes/UnplacedVolumeImplHelper.h"
0020
0021 namespace vecgeom {
0022
0023 VECGEOM_DEVICE_FORWARD_DECLARE(class UnplacedParaboloid;);
0024 VECGEOM_DEVICE_DECLARE_CONV(class, UnplacedParaboloid);
0025
0026 inline namespace VECGEOM_IMPL_NAMESPACE {
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042 class UnplacedParaboloid : public SIMDUnplacedVolumeImplHelper<ParaboloidImplementation>, public AlignedBase {
0043
0044 private:
0045 ParaboloidStruct<Precision> fParaboloid;
0046
0047 Precision fCubicVolume;
0048 Precision fSurfaceArea;
0049
0050 public:
0051
0052 VECCORE_ATT_HOST_DEVICE
0053 UnplacedParaboloid();
0054
0055
0056
0057
0058
0059 VECCORE_ATT_HOST_DEVICE
0060 UnplacedParaboloid(const Precision rlo, const Precision rhi, const Precision dz);
0061
0062
0063 VECCORE_ATT_HOST_DEVICE
0064 ParaboloidStruct<Precision> const &GetStruct() const { return fParaboloid; }
0065
0066
0067 VECCORE_ATT_HOST_DEVICE
0068 VECGEOM_FORCE_INLINE
0069 Precision GetRlo() const { return fParaboloid.fRlo; }
0070
0071
0072 VECCORE_ATT_HOST_DEVICE
0073 VECGEOM_FORCE_INLINE
0074 Precision GetRhi() const { return fParaboloid.fRhi; }
0075
0076
0077 VECCORE_ATT_HOST_DEVICE
0078 VECGEOM_FORCE_INLINE
0079 Precision GetDz() const { return fParaboloid.fDz; }
0080
0081
0082 VECCORE_ATT_HOST_DEVICE
0083 VECGEOM_FORCE_INLINE
0084 Precision GetA() const { return fParaboloid.fA; }
0085
0086
0087 VECCORE_ATT_HOST_DEVICE
0088 VECGEOM_FORCE_INLINE
0089 Precision GetB() const { return fParaboloid.fB; }
0090
0091
0092
0093 VECCORE_ATT_HOST_DEVICE
0094
0095 void SetRlo(Precision val)
0096 {
0097 fParaboloid.SetRlo(val);
0098 CalcCapacity();
0099 CalcSurfaceArea();
0100 }
0101
0102
0103
0104 VECCORE_ATT_HOST_DEVICE
0105 void SetRhi(Precision val)
0106 {
0107 fParaboloid.SetRhi(val);
0108 CalcCapacity();
0109 CalcSurfaceArea();
0110 }
0111
0112
0113
0114 VECCORE_ATT_HOST_DEVICE
0115 void SetDz(Precision val)
0116 {
0117 fParaboloid.SetDz(val);
0118 CalcCapacity();
0119 CalcSurfaceArea();
0120 }
0121
0122
0123
0124
0125
0126 VECCORE_ATT_HOST_DEVICE
0127 void SetRloAndRhiAndDz(Precision rlo, Precision rhi, Precision dz)
0128 {
0129 fParaboloid.SetRloAndRhiAndDz(rlo, rhi, dz);
0130 CalcCapacity();
0131 CalcSurfaceArea();
0132 }
0133
0134 VECCORE_ATT_HOST_DEVICE
0135 void Extent(Vector3D<Precision> &, Vector3D<Precision> &) const override;
0136
0137
0138 VECCORE_ATT_HOST_DEVICE
0139 void CalcCapacity();
0140
0141
0142 VECCORE_ATT_HOST_DEVICE
0143 void CalcSurfaceArea();
0144
0145 Precision Capacity() const override { return fCubicVolume; }
0146
0147 Precision SurfaceArea() const override { return fSurfaceArea; }
0148
0149 virtual Vector3D<Precision> SamplePointOnSurface() const override;
0150
0151 VECCORE_ATT_HOST_DEVICE
0152 virtual bool Normal(Vector3D<Precision> const &p, Vector3D<Precision> &normal) const override
0153 {
0154 bool valid = false;
0155 normal = ParaboloidImplementation::NormalKernel(fParaboloid, p, valid);
0156 return valid;
0157 }
0158
0159
0160
0161 std::string GetEntityType() const;
0162
0163
0164 VECCORE_ATT_HOST_DEVICE
0165 void GetParametersList(int aNumber, Precision *aArray) const;
0166
0167 VECCORE_ATT_HOST_DEVICE
0168 UnplacedParaboloid *Clone() const;
0169
0170 std::ostream &StreamInfo(std::ostream &os) const;
0171
0172 public:
0173 virtual int MemorySize() const final { return sizeof(*this); }
0174
0175 VECCORE_ATT_HOST_DEVICE
0176 virtual void Print() const override;
0177
0178 virtual void Print(std::ostream &os) const override;
0179
0180 #ifndef VECCORE_CUDA
0181 virtual SolidMesh *CreateMesh3D(Transformation3D const &trans, size_t nSegments) const override;
0182 #endif
0183
0184 #ifdef VECGEOM_CUDA_INTERFACE
0185 virtual size_t DeviceSizeOf() const override { return DevicePtr<cuda::UnplacedParaboloid>::SizeOf(); }
0186 virtual DevicePtr<cuda::VUnplacedVolume> CopyToGpu() const override;
0187 virtual DevicePtr<cuda::VUnplacedVolume> CopyToGpu(DevicePtr<cuda::VUnplacedVolume> const gpu_ptr) const override;
0188 #endif
0189
0190
0191 #ifndef VECCORE_CUDA
0192 template <TranslationCode trans_code, RotationCode rot_code>
0193 static VPlacedVolume *Create(LogicalVolume const *const logical_volume, Transformation3D const *const transformation,
0194 VPlacedVolume *const placement = NULL);
0195
0196 VPlacedVolume *SpecializedVolume(LogicalVolume const *const volume, Transformation3D const *const transformation,
0197 const TranslationCode trans_code, const RotationCode rot_code,
0198 VPlacedVolume *const placement) const override;
0199 #else
0200 template <TranslationCode trans_code, RotationCode rot_code>
0201 VECCORE_ATT_DEVICE
0202 static VPlacedVolume *Create(LogicalVolume const *const logical_volume, Transformation3D const *const transformation,
0203 const int id, const int copy_no, const int child_id,
0204 VPlacedVolume *const placement = NULL);
0205 VECCORE_ATT_DEVICE VPlacedVolume *SpecializedVolume(LogicalVolume const *const volume,
0206 Transformation3D const *const transformation,
0207 const TranslationCode trans_code, const RotationCode rot_code,
0208 const int id, const int copy_no, const int child_id,
0209 VPlacedVolume *const placement) const override;
0210
0211 #endif
0212 };
0213 }
0214 }
0215
0216 #endif