|
|
|||
File indexing completed on 2026-12-04 11:15:28
0001 #ifndef VECGEOM_VOLUMES_BOOLEANSTRUCT_H_ 0002 #define VECGEOM_VOLUMES_BOOLEANSTRUCT_H_ 0003 #include "VecGeom/base/Global.h" 0004 #include <cstdint> 0005 0006 namespace vecgeom { 0007 0008 // Declare types shared by cxx and cuda. 0009 enum BooleanOperation { kUnion, kIntersection, kSubtraction }; 0010 0011 inline namespace VECGEOM_IMPL_NAMESPACE { 0012 0013 /** 0014 * A class representing a simple UNPLACED boolean volume A-B 0015 * It takes two template arguments: 0016 * 1.: the mother (or left) volume A in unplaced form 0017 * 2.: the (or right) volume B in placed form, acting on A with a boolean operation; 0018 * the placement is with respect to the left volume 0019 */ 0020 struct BooleanStruct { 0021 VPlacedVolume const *fLeftVolume; 0022 VPlacedVolume const *fRightVolume; 0023 BooleanOperation const fOp; 0024 std::uint16_t fLeftScore = 1; ///< Cached left Inside cost in approximate box units, saturated at 65535. 0025 std::uint16_t fRightScore = 1; ///< Cached right Inside cost in approximate box units, saturated at 65535. 0026 std::uint8_t fIdentityMask = 0; ///< Exact identity placements: bit 0 left, bit 1 right; zero disables shortcuts. 0027 mutable Precision fCapacity = -1; 0028 mutable Precision fSurfaceArea = -1; 0029 0030 VECCORE_ATT_HOST_DEVICE 0031 BooleanStruct(BooleanOperation op, VPlacedVolume const *left, VPlacedVolume const *right) 0032 : fLeftVolume(left), fRightVolume(right), fOp(op) 0033 { 0034 #ifndef VECCORE_CUDA 0035 UpdateScores(); 0036 #endif 0037 } 0038 0039 #ifndef VECCORE_CUDA 0040 /// @brief Refresh operand costs and placement flags after construction or a subtree rewrite. 0041 /// @details Children must already be updated. Adds cached child costs without traversing the Boolean tree. 0042 /// Leaves with existing bounds checks retain unit cost; polygon scans and polycone lookup get coarse weights. 0043 void UpdateScores(); 0044 #endif 0045 0046 /// @brief Refresh exact-identity flags after operand replacement; placements must be finalized. 0047 VECCORE_ATT_HOST_DEVICE 0048 void UpdatePlacementFlags(); 0049 }; // End struct 0050 0051 } // namespace VECGEOM_IMPL_NAMESPACE 0052 0053 } // namespace vecgeom 0054 0055 #endif /* VECGEOM_VOLUMES_BOOLEANSTRUCT_H_ */
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|