|
|
|||
File indexing completed on 2026-11-13 11:00:06
0001 // This file is part of VecGeom and is distributed under the 0002 // conditions in the file LICENSE.txt in the top directory. 0003 0004 /// @file BooleanFactory.h 0005 /// @brief Build equivalent Boolean solids with accelerated MultiUnion components. 0006 0007 #ifndef VECGEOM_MANAGEMENT_BOOLEANFACTORY_H_ 0008 #define VECGEOM_MANAGEMENT_BOOLEANFACTORY_H_ 0009 0010 #include "VecGeom/base/Global.h" 0011 #include <unordered_map> 0012 0013 namespace vecgeom { 0014 inline namespace VECGEOM_IMPL_NAMESPACE { 0015 0016 class LogicalVolume; 0017 class Transformation3D; 0018 class VPlacedVolume; 0019 class VUnplacedVolume; 0020 0021 /** 0022 * @brief Convert sufficiently large union groups and subtraction cutters to MultiUnions. 0023 * @details Input solids are unchanged. Repeated inputs share their replacement within 0024 * this factory. Created shapes, logical volumes, placements and transforms follow the 0025 * usual geometry lifetime; destroying the factory only releases its lookup tables. 0026 * Results can reuse input geometry; keep that geometry alive and unchanged 0027 * while using the factory or its results. 0028 * External adapters should call Create on the complete solid before publishing 0029 * their final logical volume or placement. This factory does not update existing 0030 * wrappers or make geometry compaction safe for externally retained placements. 0031 */ 0032 class BooleanFactory { 0033 size_t fMinComponents; 0034 std::unordered_map<VUnplacedVolume const *, VUnplacedVolume const *> fResults; 0035 std::unordered_map<VUnplacedVolume const *, LogicalVolume *> fLogicalVolumes; 0036 0037 VPlacedVolume const *Place(VUnplacedVolume const *solid, Transformation3D const &transform); 0038 VPlacedVolume const *ConvertPlaced(VPlacedVolume const *placed); 0039 0040 public: 0041 /** 0042 * @brief Configure the minimum number of resulting MultiUnion components. 0043 * @param minComponents Minimum component count; zero disables conversion. 0044 * @details A MultiUnion always needs at least two components. This threshold 0045 * counts components, independently of the operand Inside-cost scores. 0046 */ 0047 explicit BooleanFactory(size_t minComponents) : fMinComponents(minComponents) {} 0048 0049 /** 0050 * @brief Build an equivalent solid, reusing previous results for shared inputs. 0051 * @param solid Input solid, or null. 0052 * @return Replacement solid, the original pointer if unchanged, or null for null input. 0053 * @details Flatten union groups and left subtraction spines only when the 0054 * resulting union has enough finite components. Right subtraction and 0055 * intersection grouping are retained; their children can be converted. 0056 * Existing MultiUnions and scaled shapes retain their outer operation. 0057 */ 0058 VUnplacedVolume const *Create(VUnplacedVolume const *solid); 0059 }; 0060 0061 } // namespace VECGEOM_IMPL_NAMESPACE 0062 } // namespace vecgeom 0063 0064 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|