Import Geant4 11.0.0.beta source tree
This commit is contained in:
@@ -34,21 +34,20 @@
|
||||
//
|
||||
// All regions should be registered with G4RegionStore, and removed on their
|
||||
// destruction. The underlying container initially has a capacity of 20.
|
||||
// A map indexed by volume names is also recorded for fast search;
|
||||
// pointers to regions 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 G4RegionStore*
|
||||
// - Pointer to the single G4RegionStore
|
||||
// instead of inheritance for std::vector<T>.
|
||||
|
||||
// 18.09.02, G.Cosmo - Initial version
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef G4REGIONSTORE_HH
|
||||
#define G4REGIONSTORE_HH
|
||||
#define G4REGIONSTORE_HH 1
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include "G4Types.hh"
|
||||
#include "G4String.hh"
|
||||
#include "G4VStoreNotifier.hh"
|
||||
@@ -84,7 +83,18 @@ class G4RegionStore : public std::vector<G4Region*>
|
||||
// in the store.
|
||||
|
||||
G4Region* GetRegion(const G4String& name, G4bool verbose = true) const;
|
||||
// Returns a region through its name specification.
|
||||
// Returns a region through its name specification. Uses the internal
|
||||
// map for fast search and warns if a region 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<G4Region*> >& GetMap() const { return bmap; }
|
||||
// Return the internal map.
|
||||
void UpdateMap();
|
||||
// Bring contents of internal map up to date and resets validity flag.
|
||||
|
||||
G4Region* FindOrCreateRegion(const G4String& name);
|
||||
// Returns a region through its name specification, if it exists.
|
||||
@@ -113,6 +123,9 @@ class G4RegionStore : public std::vector<G4Region*>
|
||||
static G4RegionStore* fgInstance;
|
||||
static G4ThreadLocal G4VStoreNotifier* fgNotifier;
|
||||
static G4ThreadLocal G4bool locked;
|
||||
|
||||
std::map<G4String, std::vector<G4Region*> > bmap;
|
||||
G4bool mvalid = false; // Flag to indicate if map is up to date or not
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user