Import Geant4 11.0.0.beta source tree
This commit is contained in:
@@ -34,22 +34,19 @@
|
||||
//
|
||||
// All volumes should be registered with G4PhysicalVolumeStore, 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.
|
||||
//
|
||||
// If much additional functionality is added, should consider containment
|
||||
// instead of inheritance for std::vector<T>
|
||||
//
|
||||
// Member data:
|
||||
//
|
||||
// static G4PhysicalVolumeStore*
|
||||
// - Ptr to the single G4PhysicalVolumeStore.
|
||||
// instead of inheritance for std::vector<T>.
|
||||
|
||||
// 25.07.95, P.Kent - Initial version
|
||||
// 18.04.01, G.Cosmo - Migrated to STL vector
|
||||
// 25.07.95, P.Kent, G.Cosmo - Initial version
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef G4PHYSICALVOLUMESTORE_HH
|
||||
#define G4PHYSICALVOLUMESTORE_HH
|
||||
#define G4PHYSICALVOLUMESTORE_HH 1
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4VStoreNotifier.hh"
|
||||
@@ -73,7 +70,17 @@ class G4PhysicalVolumeStore : public std::vector<G4VPhysicalVolume*>
|
||||
G4VPhysicalVolume* GetVolume(const G4String& name,
|
||||
G4bool verbose = true) const;
|
||||
// Return the pointer of the first volume in the collection having
|
||||
// that name.
|
||||
// that name. Uses the internal map for fast search and warns if
|
||||
// a volume in the collection is not unique or not found.
|
||||
|
||||
inline G4bool IsMapValid() const { return mvalid; }
|
||||
inline void SetMapValid(G4bool val) { mvalid = val; }
|
||||
// Accessor to assess validity of the internal map.
|
||||
inline const std::map<G4String,
|
||||
std::vector<G4VPhysicalVolume*> >& GetMap() const { return bmap; }
|
||||
// Return the internal map.
|
||||
void UpdateMap();
|
||||
// Bring contents of internal map up to date and resets validity flag.
|
||||
|
||||
virtual ~G4PhysicalVolumeStore();
|
||||
// Destructor: takes care to delete allocated physical volumes.
|
||||
@@ -91,6 +98,9 @@ class G4PhysicalVolumeStore : public std::vector<G4VPhysicalVolume*>
|
||||
static G4PhysicalVolumeStore* fgInstance;
|
||||
static G4ThreadLocal G4VStoreNotifier* fgNotifier;
|
||||
static G4ThreadLocal G4bool locked;
|
||||
|
||||
std::map<G4String, std::vector<G4VPhysicalVolume*> > bmap;
|
||||
G4bool mvalid = false; // Flag to indicate if map is up to date or not
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user