Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:39:32

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 // Copyright (C) 2026 G4OCCT Contributors
0003 
0004 /// @file G4OCCTLogicalVolume.hh
0005 /// @brief Declaration of G4OCCTLogicalVolume.
0006 
0007 #ifndef G4OCCT_G4OCCTLogicalVolume_hh
0008 #define G4OCCT_G4OCCTLogicalVolume_hh
0009 
0010 #include <G4LogicalVolume.hh>
0011 
0012 // OCCT
0013 #include <TopoDS_Shape.hxx>
0014 
0015 /**
0016  * @brief Extends Geant4's G4LogicalVolume with an associated OCCT shape.
0017  *
0018  * Extends Geant4's G4LogicalVolume to carry an optional OCCT shape reference
0019  * alongside the standard Geant4 solid, material, and field pointers.
0020  *
0021  * In the OCCT framework, a "logical volume" has no direct equivalent.  The
0022  * closest concept is a named compound or sub-assembly in a TopoDS_Compound
0023  * tree: a node that groups child shapes under a common identity (name,
0024  * material attributes, visual style) without a concrete spatial location.
0025  * XDE (Extended Data Exchange via TDocStd_Document / XCAFDoc) provides the
0026  * XDE label mechanism that can store shape, name, colour, material, and
0027  * placement information in a structured document tree, which is the OCCT
0028  * counterpart to the Geant4 volume hierarchy.
0029  *
0030  * Design strategies for connecting these representations are discussed in
0031  * docs/geometry_mapping.md.
0032  *
0033  * NOTE: The OCCT shape stored here is informational only; it is not used
0034  *       during navigation in this initial implementation.
0035  */
0036 class G4OCCTLogicalVolume : public G4LogicalVolume {
0037 public:
0038   /**
0039    * Construct a logical volume.
0040    *
0041    * @param pSolid    Pointer to the associated Geant4 solid (may be a
0042    *                  G4OCCTSolid wrapping an OCCT shape).
0043    * @param pMaterial Pointer to the material filling this volume.
0044    * @param name      Name of this logical volume.
0045    * @param shape     OCCT shape associated with this volume (optional).
0046    */
0047   G4OCCTLogicalVolume(G4VSolid* pSolid, G4Material* pMaterial, const G4String& name,
0048                       const TopoDS_Shape& shape = TopoDS_Shape());
0049 
0050   ~G4OCCTLogicalVolume() override = default;
0051 
0052   // ── G4OCCTLogicalVolume-specific interface ────────────────────────────────
0053 
0054   /// Read access to the associated OCCT shape.
0055   const TopoDS_Shape& GetOCCTShape() const { return fShape; }
0056 
0057   /// Replace the associated OCCT shape.
0058   void SetOCCTShape(const TopoDS_Shape& shape) { fShape = shape; }
0059 
0060 private:
0061   TopoDS_Shape fShape;
0062 };
0063 
0064 #endif // G4OCCT_G4OCCTLogicalVolume_hh