G4OCCT 0.1.0
Geant4 interface to Open CASCADE Technology (OCCT) geometry definitions
Loading...
Searching...
No Matches
G4OCCTMaterialMap Class Reference

Maps STEP material names to Geant4 G4Material objects. More...

#include <G4OCCTMaterialMap.hh>

Public Member Functions

 G4OCCTMaterialMap ()=default
 
void Add (const G4String &stepName, G4Material *material)
 
G4Material * Resolve (const G4String &stepName) const
 
bool Contains (const G4String &stepName) const
 
std::size_t Size () const
 
void Merge (const G4OCCTMaterialMap &other)
 

Detailed Description

Maps STEP material names to Geant4 G4Material objects.

Provides a strict, no-fallback lookup table from the material name strings found in a STEP file (via the XDE material attribute) to the corresponding Geant4 G4Material pointers. The design follows the material-bridging policy described in docs/material_bridging.md: every name encountered during STEP import must have a registered entry; unresolved names produce a fatal G4Exception.

Usage

matMap.Add("Al 6061-T6", G4NistManager::Instance()->FindOrBuildMaterial("G4_Al"));
matMap.Add("FR4", myFR4Material);
G4Material* mat = matMap.Resolve("Al 6061-T6"); // returns the G4_Al pointer
G4Material* unknownMat = matMap.Resolve("Unknown"); // throws fatal G4Exception
Maps STEP material names to Geant4 G4Material objects.
void Add(const G4String &stepName, G4Material *material)
G4Material * Resolve(const G4String &stepName) const

Definition at line 37 of file G4OCCTMaterialMap.hh.

Constructor & Destructor Documentation

◆ G4OCCTMaterialMap()

G4OCCTMaterialMap::G4OCCTMaterialMap ( )
default

Member Function Documentation

◆ Add()

void G4OCCTMaterialMap::Add ( const G4String &  stepName,
G4Material *  material 
)

Register a mapping from a STEP material name to a Geant4 material.

If stepName is already registered the previous entry is silently overwritten.

Parameters
stepNameSTEP material name string (case-sensitive).
materialNon-null pointer to a Geant4 material.

Definition at line 12 of file G4OCCTMaterialMap.cc.

Referenced by G4OCCT_ImportSTEPAssembly(), Merge(), and G4OCCTMaterialMapReader::ReadFile().

◆ Contains()

bool G4OCCTMaterialMap::Contains ( const G4String &  stepName) const

Return true if stepName has been registered.

Definition at line 35 of file G4OCCTMaterialMap.cc.

Referenced by G4OCCTDetectorConstruction::Construct().

◆ Merge()

void G4OCCTMaterialMap::Merge ( const G4OCCTMaterialMap other)

Merge all entries from other into this map.

If a STEP name already exists in this map, the entry from other overwrites it (later files win on conflict).

Parameters
otherSource map whose entries are merged into this one.

Definition at line 39 of file G4OCCTMaterialMap.cc.

References Add().

Referenced by G4OCCTDetectorConstruction::Construct().

◆ Resolve()

G4Material * G4OCCTMaterialMap::Resolve ( const G4String &  stepName) const

Look up the Geant4 material for a given STEP material name.

Parameters
stepNameSTEP material name to resolve.
Returns
Non-null pointer to the registered G4Material.
Exceptions
G4Exception(severity FatalException) if stepName is not registered.

Definition at line 23 of file G4OCCTMaterialMap.cc.

Referenced by G4OCCTDetectorConstruction::Construct().

◆ Size()

std::size_t G4OCCTMaterialMap::Size ( ) const
inline

Return the number of registered entries.

Definition at line 70 of file G4OCCTMaterialMap.hh.


The documentation for this class was generated from the following files: