|
Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
|
G4LogicalVolumeStore is a singleton class, acting as container for all logical volumes, with functionality derived from std::vector<T>. All logical volumes should be registered with G4LogicalVolumeStore, and removed on their destruction. The underlying container initially has a capacity of 100. A map indexed by volume names is also recorded for fast search; pointers to volumes with same name are stored in buckets. More...
#include <G4LogicalVolumeStore.hh>
Public Member Functions | |
| virtual | ~G4LogicalVolumeStore () |
| G4LogicalVolumeStore (const G4LogicalVolumeStore &)=delete | |
| G4LogicalVolumeStore & | operator= (const G4LogicalVolumeStore &)=delete |
| G4LogicalVolume * | GetVolume (const G4String &name, G4bool verbose=true, G4bool reverseSearch=false) const |
| G4bool | IsMapValid () const |
| void | SetMapValid (G4bool val) |
| const std::map< G4String, std::vector< G4LogicalVolume * > > & | GetMap () const |
| void | UpdateMap () |
Static Public Member Functions | |
| static void | Register (G4LogicalVolume *pVolume) |
| static void | DeRegister (G4LogicalVolume *pVolume) |
| static G4LogicalVolumeStore * | GetInstance () |
| static void | SetNotifier (G4VStoreNotifier *pNotifier) |
| static void | Clean () |
Protected Member Functions | |
| G4LogicalVolumeStore () | |
G4LogicalVolumeStore is a singleton class, acting as container for all logical volumes, with functionality derived from std::vector<T>. All logical volumes should be registered with G4LogicalVolumeStore, and removed on their destruction. The underlying container initially has a capacity of 100. A map indexed by volume names is also recorded for fast search; pointers to volumes with same name are stored in buckets.
Definition at line 64 of file G4LogicalVolumeStore.hh.
|
virtual |
Destructor: takes care to delete allocated logical volumes.
Definition at line 65 of file G4LogicalVolumeStore.cc.
|
delete |
Copy constructor and assignment operator not allowed.
Referenced by Clean(), DeRegister(), G4LogicalVolumeStore(), GetInstance(), GetVolume(), operator=(), and Register().
|
protected |
Protected singleton constructor.
Definition at line 55 of file G4LogicalVolumeStore.cc.
|
static |
Deletes all volumes from the store.
Definition at line 75 of file G4LogicalVolumeStore.cc.
Referenced by G4RunManager::ReinitializeGeometry(), and ~G4LogicalVolumeStore().
|
static |
Removes the logical volume 'pVolume' from the collection.
Definition at line 168 of file G4LogicalVolumeStore.cc.
Referenced by G4LogicalVolume::~G4LogicalVolume().
|
static |
Returns a pointer to the unique instance of G4LogicalVolumeStore, creating it if necessary.
Definition at line 249 of file G4LogicalVolumeStore.cc.
Referenced by checkVol(), Clean(), G4VUserDetectorConstruction::CloneF(), G4VUserDetectorConstruction::CloneSD(), DeRegister(), G4VRadioactiveDecay::DeselectAVolume(), G4Region::GetParentRegion(), G4GDMLReadStructure::GetVolume(), GetVolume(), G4GeneralCerenkov::PreparePhysicsTable(), Register(), G4RunManager::ReinitializeGeometry(), G4VRadioactiveDecay::SelectAllVolumes(), G4VRadioactiveDecay::SelectAVolume(), G4VVisCommandGeometrySet::Set(), G4LogicalVolume::SetName(), G4GDMLMessenger::SetNewValue(), G4VisCommandGeometryList::SetNewValue(), G4VisCommandGeometryRestore::SetNewValue(), G4VisCommandSceneAddLogicalVolume::SetNewValue(), SetNotifier(), G4VUserDetectorConstruction::SetSensitiveDetector(), G4VUserParallelWorld::SetSensitiveDetector(), G4ScoringProbe::SetupGeometry(), G4ScoringRealWorld::SetupGeometry(), G4GDMLRead::StripNames(), G4WorkerThread::UpdateGeometryAndPhysicsVectorFromMaster(), and UpdateMap().
|
inline |
Returns the internal map.
Definition at line 126 of file G4LogicalVolumeStore.hh.
Referenced by G4VUserDetectorConstruction::SetSensitiveDetector(), and G4VUserParallelWorld::SetSensitiveDetector().
| G4LogicalVolume * G4LogicalVolumeStore::GetVolume | ( | const G4String & | name, |
| G4bool | verbose = true, | ||
| G4bool | reverseSearch = false ) const |
Returns a pointer to the first or last volume in the collection having that 'name'. Uses the internal map for fast search and warns if a volume in the collection is not unique or not found.
| [in] | name | The name of the volume to search. |
| [in] | verbose | Flag for enabling verbosity (default true). |
| [in] | reverseSearch | Flag to enable inverse search (default false). |
Definition at line 210 of file G4LogicalVolumeStore.cc.
Referenced by G4VRadioactiveDecay::DeselectAVolume(), G4GDMLReadStructure::GetVolume(), G4VRadioactiveDecay::SelectAVolume(), G4GDMLMessenger::SetNewValue(), G4VisCommandSceneAddLogicalVolume::SetNewValue(), and G4ScoringProbe::SetupGeometry().
|
inline |
Accessor and modifier to assess validity of the internal map.
Definition at line 119 of file G4LogicalVolumeStore.hh.
|
delete |
|
static |
Adds the logical volume 'pVolume' to the collection.
Definition at line 145 of file G4LogicalVolumeStore.cc.
Referenced by G4LogicalVolume::G4LogicalVolume(), and G4LogicalVolume::G4LogicalVolume().
|
inline |
Definition at line 120 of file G4LogicalVolumeStore.hh.
Referenced by G4LogicalVolume::SetName().
|
static |
Assigns a notifier for allocation/deallocation of the logical volumes.
Definition at line 108 of file G4LogicalVolumeStore.cc.
| void G4LogicalVolumeStore::UpdateMap | ( | ) |
Brings contents of the internal map up to date and resets validity flag.
Definition at line 118 of file G4LogicalVolumeStore.cc.
Referenced by GetVolume(), and G4GDMLRead::StripNames().