File indexing completed on 2025-01-18 10:13:57
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 #ifndef VECCORE_CUDA
0024
0025 template <typename VolumeType>
0026 static VPlacedVolume *CreateByTransformation(LogicalVolume const *const logical_volume,
0027 Transformation3D const *const transformation,
0028 const TranslationCode trans_code, const RotationCode rot_code,
0029 VPlacedVolume *const placement = NULL);
0030
0031
0032
0033
0034 template <template <typename, int, int> class SpecializedHelper, typename ImplKernel>
0035 static VPlacedVolume *ChangeTypeKeepTransformation(VPlacedVolume const *);
0036
0037 #else
0038
0039 template <typename VolumeType>
0040 VECCORE_ATT_DEVICE
0041 static VPlacedVolume *CreateByTransformation(LogicalVolume const *const logical_volume,
0042 Transformation3D const *const transformation,
0043 const TranslationCode trans_code, const RotationCode rot_code,
0044 const int id, const int copy_no, const int child_id,
0045 VPlacedVolume *const placement = NULL);
0046
0047 #endif
0048
0049 private:
0050 VolumeFactory() {}
0051 VolumeFactory(VolumeFactory const &);
0052 VolumeFactory &operator=(VolumeFactory const &);
0053 };
0054
0055 template <typename VolumeType>
0056 VECCORE_ATT_DEVICE
0057 VPlacedVolume *VolumeFactory::CreateByTransformation(LogicalVolume const *const logical_volume,
0058 Transformation3D const *const transformation,
0059 const TranslationCode trans_code, const RotationCode rot_code,
0060 #ifdef VECCORE_CUDA
0061 const int id, const int copy_no, const int child_id,
0062 #endif
0063 VPlacedVolume *const placement)
0064 {
0065
0066 (void)trans_code;
0067 (void)rot_code;
0068
0069
0070
0071 #include "TransformationSpecializations.icc"
0072 }
0073
0074 #ifndef VECCORE_CUDA
0075 template <template <typename, int, int> class SpecializedHelper, typename ImplKernel>
0076 VPlacedVolume *VolumeFactory::ChangeTypeKeepTransformation(VPlacedVolume const *pvol)
0077 {
0078 #ifndef VECGEOM_NO_SPECIALIZATION
0079 const auto trans_code = pvol->GetTransCode();
0080 const auto rot_code = pvol->GetRotCode();
0081
0082 if (trans_code == translation::kGeneric && rot_code == 0x1b1) {
0083 return new SpecializedHelper<ImplKernel, translation::kGeneric, 0x1b1>(pvol);
0084 }
0085 if (trans_code == translation::kIdentity && rot_code == 0x1b1) {
0086 return new SpecializedHelper<ImplKernel, translation::kIdentity, 0x1b1>(pvol);
0087 }
0088 if (trans_code == translation::kGeneric && rot_code == 0x18e) {
0089 return new SpecializedHelper<ImplKernel, translation::kGeneric, 0x18e>(pvol);
0090 }
0091 if (trans_code == translation::kIdentity && rot_code == 0x18e) {
0092 return new SpecializedHelper<ImplKernel, translation::kIdentity, 0x18e>(pvol);
0093 }
0094 if (trans_code == translation::kGeneric && rot_code == 0x076) {
0095 return new SpecializedHelper<ImplKernel, translation::kGeneric, 0x076>(pvol);
0096 }
0097 if (trans_code == translation::kIdentity && rot_code == 0x076) {
0098 return new SpecializedHelper<ImplKernel, translation::kIdentity, 0x076>(pvol);
0099 }
0100 if (trans_code == translation::kGeneric && rot_code == 0x16a) {
0101 return new SpecializedHelper<ImplKernel, translation::kGeneric, 0x16a>(pvol);
0102 }
0103 if (trans_code == translation::kIdentity && rot_code == 0x16a) {
0104 return new SpecializedHelper<ImplKernel, translation::kIdentity, 0x16a>(pvol);
0105 }
0106 if (trans_code == translation::kGeneric && rot_code == 0x155) {
0107 return new SpecializedHelper<ImplKernel, translation::kGeneric, 0x155>(pvol);
0108 }
0109 if (trans_code == translation::kIdentity && rot_code == 0x155) {
0110 return new SpecializedHelper<ImplKernel, translation::kIdentity, 0x155>(pvol);
0111 }
0112 if (trans_code == translation::kGeneric && rot_code == 0x0ad) {
0113 return new SpecializedHelper<ImplKernel, translation::kGeneric, 0x0ad>(pvol);
0114 }
0115 if (trans_code == translation::kIdentity && rot_code == 0x0ad) {
0116 return new SpecializedHelper<ImplKernel, translation::kIdentity, 0x0ad>(pvol);
0117 }
0118 if (trans_code == translation::kGeneric && rot_code == 0x0dc) {
0119 return new SpecializedHelper<ImplKernel, translation::kGeneric, 0x0dc>(pvol);
0120 }
0121 if (trans_code == translation::kIdentity && rot_code == 0x0dc) {
0122 return new SpecializedHelper<ImplKernel, translation::kIdentity, 0x0dc>(pvol);
0123 }
0124 if (trans_code == translation::kGeneric && rot_code == 0x0e3) {
0125 return new SpecializedHelper<ImplKernel, translation::kGeneric, 0x0e3>(pvol);
0126 }
0127 if (trans_code == translation::kIdentity && rot_code == 0x0e3) {
0128 return new SpecializedHelper<ImplKernel, translation::kIdentity, 0x0e3>(pvol);
0129 }
0130 if (trans_code == translation::kGeneric && rot_code == 0x11b) {
0131 return new SpecializedHelper<ImplKernel, translation::kGeneric, 0x11b>(pvol);
0132 }
0133 if (trans_code == translation::kIdentity && rot_code == 0x11b) {
0134 return new SpecializedHelper<ImplKernel, translation::kIdentity, 0x11b>(pvol);
0135 }
0136 if (trans_code == translation::kGeneric && rot_code == 0x0a1) {
0137 return new SpecializedHelper<ImplKernel, translation::kGeneric, 0x0a1>(pvol);
0138 }
0139 if (trans_code == translation::kIdentity && rot_code == 0x0a1) {
0140 return new SpecializedHelper<ImplKernel, translation::kIdentity, 0x0a1>(pvol);
0141 }
0142 if (trans_code == translation::kGeneric && rot_code == 0x10a) {
0143 return new SpecializedHelper<ImplKernel, translation::kGeneric, 0x10a>(pvol);
0144 }
0145 if (trans_code == translation::kIdentity && rot_code == 0x10a) {
0146 return new SpecializedHelper<ImplKernel, translation::kIdentity, 0x10a>(pvol);
0147 }
0148 if (trans_code == translation::kGeneric && rot_code == 0x046) {
0149 return new SpecializedHelper<ImplKernel, translation::kGeneric, 0x046>(pvol);
0150 }
0151 if (trans_code == translation::kIdentity && rot_code == 0x046) {
0152 return new SpecializedHelper<ImplKernel, translation::kIdentity, 0x046>(pvol);
0153 }
0154 if (trans_code == translation::kGeneric && rot_code == 0x062) {
0155 return new SpecializedHelper<ImplKernel, translation::kGeneric, 0x062>(pvol);
0156 }
0157 if (trans_code == translation::kIdentity && rot_code == 0x062) {
0158 return new SpecializedHelper<ImplKernel, translation::kIdentity, 0x062>(pvol);
0159 }
0160 if (trans_code == translation::kGeneric && rot_code == 0x054) {
0161 return new SpecializedHelper<ImplKernel, translation::kGeneric, 0x054>(pvol);
0162 }
0163 if (trans_code == translation::kIdentity && rot_code == 0x054) {
0164 return new SpecializedHelper<ImplKernel, translation::kIdentity, 0x054>(pvol);
0165 }
0166 if (trans_code == translation::kGeneric && rot_code == 0x111) {
0167 return new SpecializedHelper<ImplKernel, translation::kGeneric, 0x111>(pvol);
0168 }
0169 if (trans_code == translation::kIdentity && rot_code == 0x111) {
0170 return new SpecializedHelper<ImplKernel, translation::kIdentity, 0x111>(pvol);
0171 }
0172 if (trans_code == translation::kGeneric && rot_code == 0x200) {
0173 return new SpecializedHelper<ImplKernel, translation::kGeneric, 0x200>(pvol);
0174 }
0175 if (trans_code == translation::kIdentity && rot_code == 0x200) {
0176 return new SpecializedHelper<ImplKernel, translation::kIdentity, 0x200>(pvol);
0177 }
0178 #endif
0179 return new SpecializedHelper<ImplKernel, translation::kGeneric, rotation::kGeneric>(pvol);
0180 }
0181 #endif
0182 }
0183 }
0184
0185 #endif