Import Geant4 11.0.0.beta source tree
This commit is contained in:
@@ -35,22 +35,19 @@
|
||||
// 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.
|
||||
//
|
||||
// If much additional functionality is added, should consider containment
|
||||
// instead of inheritance for std::vector<T>.
|
||||
//
|
||||
// Member data:
|
||||
//
|
||||
// static G4LogicalVolumeStore* fgInstance
|
||||
// - Ptr to the single G4LogicalVolumeStore.
|
||||
|
||||
// 10.07.95 - P.Kent, Initial version
|
||||
// 18.04.01 - G.Cosmo, Migrated to STL vector
|
||||
// 10.07.95, P.Kent, G.Cosmo - Initial version
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef G4LOGICALVOLUMESTORE_HH
|
||||
#define G4LOGICALVOLUMESTORE_HH
|
||||
#define G4LOGICALVOLUMESTORE_HH 1
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4VStoreNotifier.hh"
|
||||
@@ -72,7 +69,17 @@ class G4LogicalVolumeStore : public std::vector<G4LogicalVolume*>
|
||||
|
||||
G4LogicalVolume* 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<G4LogicalVolume*> >& GetMap() const { return bmap; }
|
||||
// Return the internal map.
|
||||
void UpdateMap();
|
||||
// Bring contents of internal map up to date and resets validity flag.
|
||||
|
||||
virtual ~G4LogicalVolumeStore();
|
||||
// Destructor: takes care to delete allocated logical volumes.
|
||||
@@ -90,6 +97,9 @@ class G4LogicalVolumeStore : public std::vector<G4LogicalVolume*>
|
||||
static G4LogicalVolumeStore* fgInstance;
|
||||
static G4ThreadLocal G4VStoreNotifier* fgNotifier;
|
||||
static G4ThreadLocal G4bool locked;
|
||||
|
||||
std::map<G4String, std::vector<G4LogicalVolume*> > bmap;
|
||||
G4bool mvalid = false; // Flag to indicate if map is up to date or not
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user