|
G4OCCT 0.1.0
Geant4 interface to Open CASCADE Technology (OCCT) geometry definitions
|
Extends Geant4's G4AssemblyVolume with an OCCT XDE label reference. More...
#include <G4OCCTAssemblyVolume.hh>
Classes | |
| struct | BuildContext |
| State threaded through the recursive XDE label traversal. More... | |
Public Member Functions | |
| G4OCCTAssemblyVolume ()=default | |
| ~G4OCCTAssemblyVolume ()=default | |
| const std::map< G4String, G4OCCTLogicalVolume * > & | GetLogicalVolumes () const |
Static Public Member Functions | |
| static G4OCCTAssemblyVolume * | FromSTEP (const std::string &path, const G4OCCTMaterialMap &materialMap) |
Extends Geant4's G4AssemblyVolume with an OCCT XDE label reference.
Imports a STEP assembly file using the OCCT Extended Data Exchange (XDE) layer and constructs the corresponding Geant4 volume hierarchy.
| XDE entity | Geant4 result |
|---|---|
| Top-level assembly label | G4OCCTAssemblyVolume (this class) |
| Simple-shape label (first use) | G4OCCTSolid + G4OCCTLogicalVolume |
| Simple-shape label (repeated use) | Shared G4OCCTLogicalVolume |
| Reference label + TopLoc_Location | AddPlacedVolume() on parent assembly |
| XDE name attribute | Volume name string |
| XDE material attribute (if present) | G4Material* via G4OCCTMaterialMap |
| Part name (fallback when no mat attr) | G4Material* via G4OCCTMaterialMap |
When the same XDE shape label is referenced from multiple locations the corresponding G4OCCTLogicalVolume is created only once and reused for each placement (incrementing the copy number each time). This mirrors Geant4's own convention.
This class constructs the Geant4 geometry during FromSTEP() and is subsequently read-only. It inherits G4AssemblyVolume's thread-safety guarantees after construction.
See docs/step_assembly_import.md for the full design and background.
Definition at line 69 of file G4OCCTAssemblyVolume.hh.
|
default |
Referenced by FromSTEP().
|
default |
|
static |
Import a STEP assembly file and construct the Geant4 volume hierarchy.
Reads the STEP file at path using STEPCAFControl_Reader (the OCCT XDE reader that preserves assembly structure, names, and material attributes). The label tree is traversed depth-first; each simple-shape leaf creates a G4OCCTSolid + G4OCCTLogicalVolume, and each placement is recorded via AddPlacedVolume() on the top-level assembly.
Every material name encountered in the STEP file must be present in materialMap; an unresolved name triggers a fatal G4Exception. When a shape carries no XDE material attribute, its part (label) name is used as the lookup key instead, accommodating STEP writers that do not write material attributes.
The leaf shapes are recentered (bounding-box centroid moved to the OCCT origin) before being wrapped in G4OCCTSolid; the recentering offset is absorbed into the placement transformation so that parts appear at their correct world positions.
| path | Filesystem path to the STEP file. |
| materialMap | Map from STEP material name or part name to G4Material*. |
G4OCCTAssemblyVolume owned by the caller. The returned object already contains all child volumes; call MakeImprint() to place it in the world. | std::runtime_error | if the file cannot be read or yields no shapes. |
Definition at line 312 of file G4OCCTAssemblyVolume.cc.
References G4OCCTAssemblyVolume(), and G4OCCTAssemblyVolume::BuildContext::materialMap.
Referenced by G4OCCTDetectorConstruction::Construct(), and G4OCCT_ImportSTEPAssembly().
|
inline |
Return all logical volumes created during import, keyed by part name.
The map is populated during FromSTEP(). When two STEP parts share the same name the later name is suffixed with _<n> so that every entry is unique.
Definition at line 111 of file G4OCCTAssemblyVolume.hh.
Referenced by G4OCCT_ImportSTEPAssembly().