include/G4OCCT/G4OCCTLogicalVolume.hh
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // SPDX-License-Identifier: LGPL-2.1-or-later | ||
| 2 | // Copyright (C) 2026 G4OCCT Contributors | ||
| 3 | |||
| 4 | /// @file G4OCCTLogicalVolume.hh | ||
| 5 | /// @brief Declaration of G4OCCTLogicalVolume. | ||
| 6 | |||
| 7 | #ifndef G4OCCT_G4OCCTLogicalVolume_hh | ||
| 8 | #define G4OCCT_G4OCCTLogicalVolume_hh | ||
| 9 | |||
| 10 | #include <G4LogicalVolume.hh> | ||
| 11 | |||
| 12 | // OCCT | ||
| 13 | #include <TopoDS_Shape.hxx> | ||
| 14 | |||
| 15 | /** | ||
| 16 | * @brief Extends Geant4's G4LogicalVolume with an associated OCCT shape. | ||
| 17 | * | ||
| 18 | * Extends Geant4's G4LogicalVolume to carry an optional OCCT shape reference | ||
| 19 | * alongside the standard Geant4 solid, material, and field pointers. | ||
| 20 | * | ||
| 21 | * In the OCCT framework, a "logical volume" has no direct equivalent. The | ||
| 22 | * closest concept is a named compound or sub-assembly in a TopoDS_Compound | ||
| 23 | * tree: a node that groups child shapes under a common identity (name, | ||
| 24 | * material attributes, visual style) without a concrete spatial location. | ||
| 25 | * XDE (Extended Data Exchange via TDocStd_Document / XCAFDoc) provides the | ||
| 26 | * XDE label mechanism that can store shape, name, colour, material, and | ||
| 27 | * placement information in a structured document tree, which is the OCCT | ||
| 28 | * counterpart to the Geant4 volume hierarchy. | ||
| 29 | * | ||
| 30 | * Design strategies for connecting these representations are discussed in | ||
| 31 | * docs/geometry_mapping.md. | ||
| 32 | * | ||
| 33 | * NOTE: The OCCT shape stored here is informational only; it is not used | ||
| 34 | * during navigation in this initial implementation. | ||
| 35 | */ | ||
| 36 | class G4OCCTLogicalVolume : public G4LogicalVolume { | ||
| 37 | public: | ||
| 38 | /** | ||
| 39 | * Construct a logical volume. | ||
| 40 | * | ||
| 41 | * @param pSolid Pointer to the associated Geant4 solid (may be a | ||
| 42 | * G4OCCTSolid wrapping an OCCT shape). | ||
| 43 | * @param pMaterial Pointer to the material filling this volume. | ||
| 44 | * @param name Name of this logical volume. | ||
| 45 | * @param shape OCCT shape associated with this volume (optional). | ||
| 46 | */ | ||
| 47 | G4OCCTLogicalVolume(G4VSolid* pSolid, G4Material* pMaterial, const G4String& name, | ||
| 48 | const TopoDS_Shape& shape = TopoDS_Shape()); | ||
| 49 | |||
| 50 | 59 | ~G4OCCTLogicalVolume() override = default; | |
| 51 | |||
| 52 | // ── G4OCCTLogicalVolume-specific interface ──────────────────────────────── | ||
| 53 | |||
| 54 | /// Read access to the associated OCCT shape. | ||
| 55 | 4 | const TopoDS_Shape& GetOCCTShape() const { return fShape; } | |
| 56 | |||
| 57 | /// Replace the associated OCCT shape. | ||
| 58 | 1 | void SetOCCTShape(const TopoDS_Shape& shape) { fShape = shape; } | |
| 59 | |||
| 60 | private: | ||
| 61 | TopoDS_Shape fShape; | ||
| 62 | }; | ||
| 63 | |||
| 64 | #endif // G4OCCT_G4OCCTLogicalVolume_hh | ||
| 65 |