GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 3 / 0 / 3
Functions: 100.0% 3 / 0 / 3
Branches: -% 0 / 0 / 0

include/G4OCCT/G4OCCTPlacement.hh
Line Branch Exec Source
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 // Copyright (C) 2026 G4OCCT Contributors
3
4 /// @file G4OCCTPlacement.hh
5 /// @brief Declaration of G4OCCTPlacement.
6
7 #ifndef G4OCCT_G4OCCTPlacement_hh
8 #define G4OCCT_G4OCCTPlacement_hh
9
10 #include <G4PVPlacement.hh>
11
12 // OCCT
13 #include <TopLoc_Location.hxx>
14
15 /**
16 * @brief Extends Geant4's G4PVPlacement with the corresponding OCCT placement.
17 *
18 * Extends Geant4's G4PVPlacement to carry the corresponding OCCT placement
19 * (TopLoc_Location), enabling round-trip translation between the two geometry
20 * frameworks.
21 *
22 * In OCCT, placement information is encoded in TopLoc_Location objects that
23 * are attached to TopoDS_Shape instances. A TopLoc_Location wraps a
24 * gp_Trsf (4×3 homogeneous transformation), which may be a pure rotation,
25 * translation, or a general rigid-body motion—closely matching the rotation
26 * (G4RotationMatrix*) and translation (G4ThreeVector) pair stored in a
27 * Geant4 physical volume.
28 *
29 * The correspondence between the two representations is:
30 * G4PVPlacement / G4VPhysicalVolume ↔ TopoDS_Shape with TopLoc_Location
31 * G4RotationMatrix + G4ThreeVector ↔ gp_Trsf (stored in TopLoc_Location)
32 *
33 * Design strategies for efficiently converting between these representations
34 * are discussed in docs/geometry_mapping.md.
35 *
36 * NOTE: The OCCT location stored here is informational only; conversion
37 * helpers are planned for a future milestone.
38 */
39 class G4OCCTPlacement : public G4PVPlacement {
40 public:
41 /**
42 * Construct a placement using a rotation matrix and translation.
43 *
44 * @param pRot Rotation relative to the mother volume (may be
45 * nullptr for identity).
46 * @param tlate Translation relative to the mother volume.
47 * @param pCurrentLogical Logical volume being placed.
48 * @param pName Name of this physical volume.
49 * @param pMotherLogical Mother logical volume (nullptr for world).
50 * @param pMany Overlapping flag (must be false for now).
51 * @param pCopyNo Copy number.
52 * @param location Corresponding OCCT placement location (optional).
53 * @param pSurfChk Run overlap check during construction if true.
54 */
55 G4OCCTPlacement(G4RotationMatrix* pRot, const G4ThreeVector& tlate,
56 G4LogicalVolume* pCurrentLogical, const G4String& pName,
57 G4LogicalVolume* pMotherLogical, G4bool pMany, G4int pCopyNo,
58 const TopLoc_Location& location = TopLoc_Location(), G4bool pSurfChk = false);
59
60 3 ~G4OCCTPlacement() override = default;
61
62 // ── G4OCCTPlacement-specific interface ────────────────────────────────────
63
64 /// Read access to the OCCT placement location.
65 4 const TopLoc_Location& GetOCCTLocation() const { return fLocation; }
66
67 /// Replace the OCCT placement location.
68 1 void SetOCCTLocation(const TopLoc_Location& location) { fLocation = location; }
69
70 private:
71 TopLoc_Location fLocation;
72 };
73
74 #endif // G4OCCT_G4OCCTPlacement_hh
75