File indexing completed on 2026-11-13 11:00:39
0001
0002
0003
0004 #ifndef VECGEOM_VOLUMES_UNPLACEDHALFSPACE_H_
0005 #define VECGEOM_VOLUMES_UNPLACEDHALFSPACE_H_
0006
0007 #include "VecGeom/base/AlignedBase.h"
0008 #include "VecGeom/base/Cuda.h"
0009 #include "VecGeom/base/Global.h"
0010 #include "VecGeom/base/Vector3D.h"
0011 #include "VecGeom/volumes/HalfSpaceStruct.h"
0012 #include "VecGeom/volumes/UnplacedVolume.h"
0013 #include "VecGeom/volumes/UnplacedVolumeImplHelper.h"
0014 #include "VecGeom/volumes/kernel/HalfSpaceImplementation.h"
0015
0016 namespace vecgeom {
0017
0018 VECGEOM_DEVICE_FORWARD_DECLARE(class UnplacedHalfSpace;);
0019 VECGEOM_DEVICE_DECLARE_CONV(class, UnplacedHalfSpace);
0020
0021 inline namespace VECGEOM_IMPL_NAMESPACE {
0022
0023
0024
0025
0026
0027 class UnplacedHalfSpace : public UnplacedVolumeImplHelper<HalfSpaceImplementation>, public AlignedBase {
0028 private:
0029 HalfSpaceStruct<Precision> fHalfSpace;
0030
0031 public:
0032 using Kernel = HalfSpaceImplementation;
0033
0034
0035
0036
0037 VECCORE_ATT_HOST_DEVICE
0038 UnplacedHalfSpace(Vector3D<Precision> const &point, Vector3D<Precision> const &normal);
0039
0040
0041 VECCORE_ATT_HOST_DEVICE
0042 UnplacedHalfSpace(Precision px, Precision py, Precision pz, Precision nx, Precision ny, Precision nz)
0043 : UnplacedHalfSpace(Vector3D<Precision>(px, py, pz), Vector3D<Precision>(nx, ny, nz))
0044 {
0045 }
0046
0047 VECCORE_ATT_HOST_DEVICE
0048 VECGEOM_FORCE_INLINE
0049 virtual ESolidType GetType() const override { return ESolidType::halfspace; }
0050
0051
0052 VECCORE_ATT_HOST_DEVICE
0053 HalfSpaceStruct<Precision> const &GetStruct() const { return fHalfSpace; }
0054
0055
0056 VECCORE_ATT_HOST_DEVICE
0057 Vector3D<Precision> const &GetPoint() const { return fHalfSpace.fPoint; }
0058
0059
0060 VECCORE_ATT_HOST_DEVICE
0061 Vector3D<Precision> const &GetNormal() const { return fHalfSpace.fNormal; }
0062
0063
0064
0065
0066 Precision Capacity() const override { return 0.; }
0067
0068
0069
0070
0071 Precision SurfaceArea() const override { return 0.; }
0072
0073
0074 VECCORE_ATT_HOST_DEVICE
0075 void Extent(Vector3D<Precision> &aMin, Vector3D<Precision> &aMax) const override;
0076
0077 #ifndef VECCORE_CUDA
0078
0079
0080
0081
0082
0083
0084
0085 bool CalculateClippedExtent(Axis axis, VoxelLimits const &limits, Transformation3D const &transform, Precision &min,
0086 Precision &max) const override;
0087 #endif
0088
0089
0090
0091
0092 Vector3D<Precision> SamplePointOnSurface() const override;
0093
0094
0095
0096
0097
0098 VECCORE_ATT_HOST_DEVICE
0099 virtual bool Normal(Vector3D<Precision> const &p, Vector3D<Precision> &normal) const override
0100 {
0101 bool valid;
0102 normal = HalfSpaceImplementation::NormalKernel(fHalfSpace, p, valid);
0103 return valid;
0104 }
0105
0106 VECCORE_ATT_HOST_DEVICE
0107 virtual void Print() const override;
0108
0109
0110 virtual void Print(std::ostream &os) const override;
0111
0112 #ifndef VECCORE_CUDA
0113
0114 virtual SolidMesh *CreateMesh3D(Transformation3D const &trans, size_t nSegments) const override;
0115 #endif
0116
0117 #ifdef VECGEOM_CUDA_INTERFACE
0118
0119 virtual size_t DeviceSizeOf() const override { return DevicePtr<cuda::UnplacedHalfSpace>::SizeOf(); }
0120
0121 virtual DevicePtr<cuda::VUnplacedVolume> CopyToGpu() const override;
0122
0123 virtual DevicePtr<cuda::VUnplacedVolume> CopyToGpu(DevicePtr<cuda::VUnplacedVolume> const gpu_ptr) const override;
0124 #endif
0125
0126 #ifndef VECCORE_CUDA
0127
0128 static VPlacedVolume *Create(LogicalVolume const *const logical_volume, Transformation3D const *const transformation,
0129 VPlacedVolume *const placement = NULL);
0130
0131
0132 VPlacedVolume *SpecializedVolume(LogicalVolume const *const volume, Transformation3D const *const transformation,
0133 VPlacedVolume *const placement) const override;
0134 #else
0135
0136 VECCORE_ATT_DEVICE
0137 static VPlacedVolume *Create(LogicalVolume const *const logical_volume, Transformation3D const *const transformation,
0138 const int id, const int copy_no, const int child_id,
0139 VPlacedVolume *const placement = NULL);
0140
0141
0142 VECCORE_ATT_DEVICE
0143 VPlacedVolume *SpecializedVolume(LogicalVolume const *const volume, Transformation3D const *const transformation,
0144 const int id, const int copy_no, const int child_id,
0145 VPlacedVolume *const placement) const override;
0146 #endif
0147
0148 #ifndef VECCORE_CUDA
0149 #ifdef VECGEOM_ROOT
0150
0151 TGeoShape const *ConvertToRoot(char const *label = "") const;
0152 #endif
0153 #endif
0154 };
0155
0156 using GenericUnplacedHalfSpace = UnplacedHalfSpace;
0157
0158 }
0159 }
0160
0161 #endif