File indexing completed on 2026-09-28 09:32:20
0001
0002
0003
0004 #ifndef VECGEOM_MANAGEMENT_VOLUMEFACTORY_H_
0005 #define VECGEOM_MANAGEMENT_VOLUMEFACTORY_H_
0006
0007 #include "VecGeom/volumes/PlacedVolume.h"
0008 #include "VecGeom/base/Transformation3D.h"
0009 #include "VecGeom/volumes/LogicalVolume.h"
0010
0011 namespace vecgeom {
0012 inline namespace VECGEOM_IMPL_NAMESPACE {
0013
0014 class VolumeFactory {
0015
0016 public:
0017 static VolumeFactory &Instance()
0018 {
0019 static VolumeFactory instance;
0020 return instance;
0021 }
0022
0023
0024
0025
0026 template <template <typename> class SpecializedHelper, typename ImplKernel>
0027 static VPlacedVolume *ChangeTypeKeepTransformation(VPlacedVolume const *);
0028
0029 #ifndef VECCORE_CUDA
0030
0031 template <typename VolumeType>
0032 static VPlacedVolume *CreateByTransformation(LogicalVolume const *const logical_volume,
0033 Transformation3D const *const transformation,
0034 VPlacedVolume *const placement = NULL);
0035
0036 #else
0037
0038 template <typename VolumeType>
0039 VECCORE_ATT_DEVICE static VPlacedVolume *CreateByTransformation(LogicalVolume const *const logical_volume,
0040 Transformation3D const *const transformation,
0041 const int id, const int copy_no, const int child_id,
0042 VPlacedVolume *const placement = NULL);
0043
0044 #endif
0045
0046 private:
0047 VolumeFactory() {}
0048 VolumeFactory(VolumeFactory const &);
0049 VolumeFactory &operator=(VolumeFactory const &);
0050 };
0051
0052 template <typename VolumeType>
0053 VECCORE_ATT_DEVICE VPlacedVolume *VolumeFactory::CreateByTransformation(LogicalVolume const *const logical_volume,
0054 Transformation3D const *const transformation,
0055 #ifdef VECCORE_CUDA
0056 const int id, const int copy_no,
0057 const int child_id,
0058 #endif
0059 VPlacedVolume *const placement)
0060 {
0061 return VolumeType::Create(logical_volume, transformation,
0062 #ifdef VECCORE_CUDA
0063 id, copy_no, child_id,
0064 #endif
0065 placement);
0066 }
0067
0068 template <template <typename> class SpecializedHelper, typename ImplKernel>
0069 VPlacedVolume *VolumeFactory::ChangeTypeKeepTransformation(VPlacedVolume const *pvol)
0070 {
0071 return new SpecializedHelper<ImplKernel>(pvol);
0072 }
0073 }
0074 }
0075
0076 #endif