File indexing completed on 2026-09-17 09:33:19
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 UnplacedVolumeImplHelper<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 VECCORE_ATT_HOST_DEVICE
0063 VECGEOM_FORCE_INLINE
0064 virtual ESolidType GetType() const override { return ESolidType::paraboloid; }
0065
0066
0067 VECCORE_ATT_HOST_DEVICE
0068 ParaboloidStruct<Precision> const &GetStruct() const { return fParaboloid; }
0069
0070
0071 VECCORE_ATT_HOST_DEVICE
0072 VECGEOM_FORCE_INLINE
0073 Precision GetRlo() const { return fParaboloid.fRlo; }
0074
0075
0076 VECCORE_ATT_HOST_DEVICE
0077 VECGEOM_FORCE_INLINE
0078 Precision GetRhi() const { return fParaboloid.fRhi; }
0079
0080
0081 VECCORE_ATT_HOST_DEVICE
0082 VECGEOM_FORCE_INLINE
0083 Precision GetDz() const { return fParaboloid.fDz; }
0084
0085
0086 VECCORE_ATT_HOST_DEVICE
0087 VECGEOM_FORCE_INLINE
0088 Precision GetA() const { return fParaboloid.fA; }
0089
0090
0091 VECCORE_ATT_HOST_DEVICE
0092 VECGEOM_FORCE_INLINE
0093 Precision GetB() const { return fParaboloid.fB; }
0094
0095
0096
0097 VECCORE_ATT_HOST_DEVICE
0098
0099 void SetRlo(Precision val)
0100 {
0101 fParaboloid.SetRlo(val);
0102 CalcCapacity();
0103 CalcSurfaceArea();
0104 }
0105
0106
0107
0108 VECCORE_ATT_HOST_DEVICE
0109 void SetRhi(Precision val)
0110 {
0111 fParaboloid.SetRhi(val);
0112 CalcCapacity();
0113 CalcSurfaceArea();
0114 }
0115
0116
0117
0118 VECCORE_ATT_HOST_DEVICE
0119 void SetDz(Precision val)
0120 {
0121 fParaboloid.SetDz(val);
0122 CalcCapacity();
0123 CalcSurfaceArea();
0124 }
0125
0126
0127
0128
0129
0130 VECCORE_ATT_HOST_DEVICE
0131 void SetRloAndRhiAndDz(Precision rlo, Precision rhi, Precision dz)
0132 {
0133 fParaboloid.SetRloAndRhiAndDz(rlo, rhi, dz);
0134 CalcCapacity();
0135 CalcSurfaceArea();
0136 }
0137
0138 VECCORE_ATT_HOST_DEVICE
0139 void Extent(Vector3D<Precision> &, Vector3D<Precision> &) const override;
0140
0141
0142 VECCORE_ATT_HOST_DEVICE
0143 void CalcCapacity();
0144
0145
0146 VECCORE_ATT_HOST_DEVICE
0147 void CalcSurfaceArea();
0148
0149 Precision Capacity() const override { return fCubicVolume; }
0150
0151 Precision SurfaceArea() const override { return fSurfaceArea; }
0152
0153 virtual Vector3D<Precision> SamplePointOnSurface() const override;
0154
0155 VECCORE_ATT_HOST_DEVICE
0156 virtual bool Normal(Vector3D<Precision> const &p, Vector3D<Precision> &normal) const override
0157 {
0158 bool valid = false;
0159 normal = ParaboloidImplementation::NormalKernel(fParaboloid, p, valid);
0160 return valid;
0161 }
0162
0163
0164
0165 std::string GetEntityType() const;
0166
0167
0168 VECCORE_ATT_HOST_DEVICE
0169 void GetParametersList(int aNumber, Precision *aArray) const;
0170
0171 VECCORE_ATT_HOST_DEVICE
0172 UnplacedParaboloid *Clone() const;
0173
0174 std::ostream &StreamInfo(std::ostream &os) const;
0175
0176 public:
0177 virtual int MemorySize() const final { return sizeof(*this); }
0178
0179 VECCORE_ATT_HOST_DEVICE
0180 virtual void Print() const override;
0181
0182 virtual void Print(std::ostream &os) const override;
0183
0184 #ifndef VECCORE_CUDA
0185 virtual SolidMesh *CreateMesh3D(Transformation3D const &trans, size_t nSegments) const override;
0186 #endif
0187
0188 #ifdef VECGEOM_CUDA_INTERFACE
0189 virtual size_t DeviceSizeOf() const override { return DevicePtr<cuda::UnplacedParaboloid>::SizeOf(); }
0190 virtual DevicePtr<cuda::VUnplacedVolume> CopyToGpu() const override;
0191 virtual DevicePtr<cuda::VUnplacedVolume> CopyToGpu(DevicePtr<cuda::VUnplacedVolume> const gpu_ptr) const override;
0192 #endif
0193
0194
0195 #ifndef VECCORE_CUDA
0196 static VPlacedVolume *Create(LogicalVolume const *const logical_volume, Transformation3D const *const transformation,
0197 VPlacedVolume *const placement = NULL);
0198
0199 VPlacedVolume *SpecializedVolume(LogicalVolume const *const volume, Transformation3D const *const transformation,
0200 VPlacedVolume *const placement) const override;
0201 #else
0202 VECCORE_ATT_DEVICE
0203 static VPlacedVolume *Create(LogicalVolume const *const logical_volume, Transformation3D const *const transformation,
0204 const int id, const int copy_no, const int child_id,
0205 VPlacedVolume *const placement = NULL);
0206 VECCORE_ATT_DEVICE VPlacedVolume *SpecializedVolume(LogicalVolume const *const volume,
0207 Transformation3D const *const transformation, const int id,
0208 const int copy_no, const int child_id,
0209 VPlacedVolume *const placement) const override;
0210
0211 #endif
0212 };
0213 }
0214 }
0215
0216 #endif