File indexing completed on 2025-01-18 10:14:15
0001
0002
0003
0004 #ifndef VECGEOM_VOLUMES_UNPLACEDGENERICPOLYCONE_H_
0005 #define VECGEOM_VOLUMES_UNPLACEDGENERICPOLYCONE_H_
0006
0007 #include "VecGeom/base/Cuda.h"
0008 #include "VecGeom/base/Global.h"
0009 #include "VecGeom/base/AlignedBase.h"
0010 #include "VecGeom/base/Vector3D.h"
0011 #include "VecGeom/volumes/UnplacedVolume.h"
0012 #include "VecGeom/volumes/GenericPolyconeStruct.h"
0013 #include "VecGeom/volumes/kernel/GenericPolyconeImplementation.h"
0014 #include "VecGeom/volumes/UnplacedVolumeImplHelper.h"
0015 #include "VecGeom/volumes/ReducedPolycone.h"
0016
0017 namespace vecgeom {
0018
0019 VECGEOM_DEVICE_FORWARD_DECLARE(class UnplacedGenericPolycone;);
0020 VECGEOM_DEVICE_DECLARE_CONV(class, UnplacedGenericPolycone);
0021
0022 inline namespace VECGEOM_IMPL_NAMESPACE {
0023
0024 class UnplacedGenericPolycone : public LoopUnplacedVolumeImplHelper<GenericPolyconeImplementation>, public AlignedBase {
0025
0026 private:
0027 GenericPolyconeStruct<Precision> fGenericPolycone;
0028
0029
0030 Precision fSPhi;
0031 Precision fDPhi;
0032 int fNumRZ;
0033 Vector<Precision> fR;
0034 Vector<Precision> fZ;
0035
0036
0037 Vector3D<Precision> fAMin;
0038 Vector3D<Precision> fAMax;
0039
0040 public:
0041
0042
0043
0044
0045 VECCORE_ATT_HOST_DEVICE
0046 UnplacedGenericPolycone();
0047
0048 VECCORE_ATT_HOST_DEVICE
0049 UnplacedGenericPolycone(Precision phiStart,
0050 Precision phiTotal,
0051 int numRZ,
0052 Precision const *r,
0053 Precision const *z);
0054
0055 VECCORE_ATT_HOST_DEVICE
0056 GenericPolyconeStruct<Precision> const &GetStruct() const { return fGenericPolycone; }
0057
0058
0059
0060
0061
0062
0063 VECCORE_ATT_HOST_DEVICE
0064 VECGEOM_FORCE_INLINE
0065 Precision GetSPhi() const { return fSPhi; }
0066
0067 VECCORE_ATT_HOST_DEVICE
0068 VECGEOM_FORCE_INLINE
0069 Precision GetDPhi() const { return fDPhi; }
0070
0071 VECCORE_ATT_HOST_DEVICE
0072 VECGEOM_FORCE_INLINE
0073 int GetNumRz() const { return fNumRZ; }
0074
0075 VECCORE_ATT_HOST_DEVICE
0076 VECGEOM_FORCE_INLINE
0077 Vector<Precision> GetR() const { return fR; }
0078
0079 VECCORE_ATT_HOST_DEVICE
0080 VECGEOM_FORCE_INLINE
0081 Vector<Precision> GetZ() const { return fZ; }
0082
0083 VECCORE_ATT_HOST_DEVICE
0084 void Extent(Vector3D<Precision> &, Vector3D<Precision> &) const override;
0085
0086 VECCORE_ATT_HOST_DEVICE
0087 bool Normal(Vector3D<Precision> const &point, Vector3D<Precision> &norm) const override;
0088
0089 Precision Capacity() const override { return fGenericPolycone.fCubicVolume; }
0090
0091
0092 Precision SurfaceArea() const override { return EstimateSurfaceArea(); }
0093
0094 Vector3D<Precision> SamplePointOnSurface() const override;
0095
0096 std::string GetEntityType() const { return "GenericPolycone"; }
0097
0098 public:
0099 virtual int MemorySize() const final { return sizeof(*this); }
0100
0101 VECCORE_ATT_HOST_DEVICE
0102 virtual void Print() const override;
0103
0104 virtual void Print(std::ostream &os) const override;
0105
0106 #ifdef VECGEOM_CUDA_INTERFACE
0107 virtual size_t DeviceSizeOf() const override { return DevicePtr<cuda::UnplacedGenericPolycone>::SizeOf(); }
0108 virtual DevicePtr<cuda::VUnplacedVolume> CopyToGpu() const override;
0109 virtual DevicePtr<cuda::VUnplacedVolume> CopyToGpu(DevicePtr<cuda::VUnplacedVolume> const gpu_ptr) const override;
0110 #endif
0111
0112 #ifndef VECCORE_CUDA
0113
0114
0115 template <TranslationCode trans_code, RotationCode rot_code>
0116 static VPlacedVolume *Create(LogicalVolume const *const logical_volume, Transformation3D const *const transformation,
0117 VPlacedVolume *const placement = NULL);
0118
0119 VPlacedVolume *SpecializedVolume(LogicalVolume const *const volume, Transformation3D const *const transformation,
0120 const TranslationCode trans_code, const RotationCode rot_code,
0121 VPlacedVolume *const placement) const override;
0122 #else
0123 template <TranslationCode trans_code, RotationCode rot_code>
0124 VECCORE_ATT_DEVICE
0125 static VPlacedVolume *Create(LogicalVolume const *const logical_volume, Transformation3D const *const transformation,
0126 const int id, const int copy_no, const int child_id,
0127 VPlacedVolume *const placement = NULL);
0128 VECCORE_ATT_DEVICE VPlacedVolume *SpecializedVolume(LogicalVolume const *const volume,
0129 Transformation3D const *const transformation,
0130 const TranslationCode trans_code, const RotationCode rot_code,
0131 const int id, const int copy_no, const int child_id,
0132 VPlacedVolume *const placement) const override;
0133
0134 #endif
0135 };
0136
0137 using GenericUnplacedGenericPolycone = UnplacedGenericPolycone;
0138 }
0139 }
0140
0141 #endif