Import Geant4 11.0.0.beta source tree
This commit is contained in:
@@ -15,6 +15,25 @@ commit in the repository !
|
||||
----------------------------------------------------------
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
June 15, 2021 J.Apostolakis (geommng-V10-07-04)
|
||||
- G4UAdapter: added std::ostream& operator << to avoid compilation clash
|
||||
between similar methods for G4VSolid and VecGeom UnplacedVolume.
|
||||
|
||||
April 12, 2021 G.Cosmo (geommng-V10-07-03)
|
||||
- Fixed potential thread contention in stores when clearing/updating maps
|
||||
at initialisation.
|
||||
|
||||
April 9, 2021 G.Cosmo (geommng-V10-07-02)
|
||||
- Added missing implementation of inline method GetMap() in stores.
|
||||
|
||||
March 30, 2021 B.Morgan (geommng-V10-07-01)
|
||||
- Migrate sources.cmake to modular build API
|
||||
|
||||
March 23, 2021 G.Cosmo (geommng-V10-07-00)
|
||||
- Added map for fast search based on name in G4SolidStore, G4RegionStore,
|
||||
G4logicalVolumeStore and G4PhysicalVolumeStore. Pointers to elements are
|
||||
stored in the map as buckets, grouping elements with same name.
|
||||
|
||||
November 8, 2020 E.Tcherniaev (geommng-V10-06-06)
|
||||
- Bug fix in calculation of normal in G4UAdapter::DistanceToOut()
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ class G4LogicalVolume
|
||||
// Copy-constructor and assignment operator not allowed.
|
||||
|
||||
inline const G4String& GetName() const;
|
||||
inline void SetName(const G4String& pName);
|
||||
void SetName(const G4String& pName);
|
||||
// Returns and sets the name of the logical volume.
|
||||
|
||||
inline size_t GetNoDaughters() const;
|
||||
|
||||
@@ -44,16 +44,6 @@ const G4String& G4LogicalVolume::GetName() const
|
||||
return fName;
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// SetName
|
||||
// ********************************************************************
|
||||
//
|
||||
inline
|
||||
void G4LogicalVolume::SetName(const G4String& pName)
|
||||
{
|
||||
fName = pName;
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// GetInstanceID
|
||||
// ********************************************************************
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -121,7 +121,7 @@ class G4Region
|
||||
// NOT already inserted, in which case significant speedup can be
|
||||
// achieved in very complex flat geometry setups.
|
||||
|
||||
inline void SetName(const G4String& name);
|
||||
void SetName(const G4String& name);
|
||||
inline const G4String& GetName() const;
|
||||
// Set/get region's name.
|
||||
|
||||
|
||||
@@ -58,16 +58,6 @@ const G4String& G4Region::GetName() const
|
||||
return fName;
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// SetName
|
||||
// ********************************************************************
|
||||
//
|
||||
inline
|
||||
void G4Region::SetName(const G4String& pName)
|
||||
{
|
||||
fName = pName;
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// RegionModified
|
||||
// ********************************************************************
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -34,23 +34,19 @@
|
||||
//
|
||||
// All solids should be registered with G4SolidStore, and removed on their
|
||||
// destruction. The underlying container initially has a capacity of 100.
|
||||
// A map indexed by solid names is also recorded for fast search;
|
||||
// pointers to solids 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 G4SolidStore*
|
||||
// - Ptr to the single G4SolidStore
|
||||
// instead of inheritance for std::vector<T>.
|
||||
|
||||
// History:
|
||||
// 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 G4VSOLIDSTORE_HH
|
||||
#define G4VSOLIDSTORE_HH
|
||||
#define G4VSOLIDSTORE_HH 1
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4VStoreNotifier.hh"
|
||||
@@ -72,7 +68,17 @@ class G4SolidStore : public std::vector<G4VSolid*>
|
||||
|
||||
G4VSolid* GetSolid(const G4String& name, G4bool verbose = true) const;
|
||||
// Return the pointer of the first solid in the collection having
|
||||
// that name.
|
||||
// that name. Uses the internal map for fast search and warns if
|
||||
// a solid 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<G4VSolid*> >& GetMap() const { return bmap; }
|
||||
// Return the internal map.
|
||||
void UpdateMap();
|
||||
// Bring contents of internal map up to date and resets validity flag.
|
||||
|
||||
virtual ~G4SolidStore();
|
||||
// Destructor: takes care to delete allocated solids.
|
||||
@@ -90,6 +96,9 @@ class G4SolidStore : public std::vector<G4VSolid*>
|
||||
static G4SolidStore* fgInstance;
|
||||
static G4ThreadLocal G4VStoreNotifier* fgNotifier;
|
||||
static G4ThreadLocal G4bool locked;
|
||||
|
||||
std::map<G4String, std::vector<G4VSolid*> > bmap;
|
||||
G4bool mvalid = false; // Flag to indicate if map is up to date or not
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -189,6 +189,10 @@ class G4UAdapter : public G4VSolid, protected UnplacedVolume_t
|
||||
// Smart access function - creates on request and stores for future
|
||||
// access. A null pointer means "not available".
|
||||
|
||||
inline friend std::ostream& operator<< ( std::ostream& os, const G4UAdapter<UnplacedVolume_t>& uad )
|
||||
{ const UnplacedVolume_t& origUnplaced = uad; return operator<< ( os, origUnplaced ); }
|
||||
// Streaming operator, forward to VecGeom method
|
||||
|
||||
public: // without description
|
||||
|
||||
G4UAdapter(__void__&);
|
||||
|
||||
@@ -151,7 +151,7 @@ class G4VPhysicalVolume
|
||||
|
||||
inline const G4String& GetName() const;
|
||||
// Return the volume's name.
|
||||
inline void SetName(const G4String& pName);
|
||||
void SetName(const G4String& pName);
|
||||
// Set the volume's name.
|
||||
|
||||
virtual G4int GetMultiplicity() const;
|
||||
|
||||
@@ -69,12 +69,6 @@ const G4String& G4VPhysicalVolume::GetName() const
|
||||
return fname;
|
||||
}
|
||||
|
||||
inline
|
||||
void G4VPhysicalVolume::SetName(const G4String& pName)
|
||||
{
|
||||
fname = pName;
|
||||
}
|
||||
|
||||
inline
|
||||
EVolume G4VPhysicalVolume::DeduceVolumeType() const
|
||||
{
|
||||
|
||||
@@ -97,7 +97,7 @@ class G4VSolid
|
||||
|
||||
inline G4String GetName() const;
|
||||
// Returns the current shape's name.
|
||||
inline void SetName(const G4String& name);
|
||||
void SetName(const G4String& name);
|
||||
// Sets the current shape's name.
|
||||
|
||||
inline G4double GetTolerance() const;
|
||||
|
||||
@@ -45,12 +45,6 @@ G4String G4VSolid::GetName() const
|
||||
return fshapeName;
|
||||
}
|
||||
|
||||
inline
|
||||
void G4VSolid::SetName(const G4String& name)
|
||||
{
|
||||
fshapeName = name;
|
||||
}
|
||||
|
||||
inline
|
||||
G4double G4VSolid::GetTolerance() const
|
||||
{
|
||||
|
||||
@@ -1,25 +1,12 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# Module : G4geometrymng
|
||||
# Package: Geant4.src.G4geometry.G4geometrymng
|
||||
#------------------------------------------------------------------------------
|
||||
# - G4geometrymng module build definition
|
||||
|
||||
# Configure header for preprocessor symbols for USolids
|
||||
configure_file(${CMAKE_CURRENT_LIST_DIR}/include/G4GeomConfig.hh.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include/G4GeomConfig.hh
|
||||
)
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include/G4GeomConfig.hh)
|
||||
|
||||
# WORKAROUND: When building/testing examples uing ROOT, ROOT's
|
||||
# dictionary generation is not smart enough to handle target usage
|
||||
# requirements for include paths. Explicitly add the path to the
|
||||
# generated header into build time include paths...
|
||||
set_property(GLOBAL APPEND
|
||||
PROPERTY GEANT4_BUILDTREE_INCLUDE_DIRS "${CMAKE_CURRENT_BINARY_DIR}/include")
|
||||
|
||||
#
|
||||
# Define the Geant4 Module.
|
||||
#
|
||||
geant4_define_module(NAME G4geometrymng
|
||||
HEADERS
|
||||
geant4_add_module(G4geometrymng
|
||||
PUBLIC_HEADERS
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include/G4GeomConfig.hh
|
||||
G4AffineTransform.hh
|
||||
G4AffineTransform.icc
|
||||
@@ -108,23 +95,21 @@ geant4_define_module(NAME G4geometrymng
|
||||
G4VPhysicalVolume.cc
|
||||
G4VSolid.cc
|
||||
G4VTouchable.cc
|
||||
G4VoxelLimits.cc
|
||||
GRANULAR_DEPENDENCIES
|
||||
G4globman
|
||||
G4graphics_reps
|
||||
G4intercoms
|
||||
G4materials
|
||||
GLOBAL_DEPENDENCIES
|
||||
G4global
|
||||
G4graphics_reps
|
||||
G4intercoms
|
||||
G4materials
|
||||
LINK_LIBRARIES
|
||||
${VECGEOM_LIBRARIES}
|
||||
)
|
||||
G4VoxelLimits.cc)
|
||||
|
||||
# List any source specific properties here
|
||||
# For new system, must explicitly add path for generated header
|
||||
# - Add path to generated header
|
||||
geant4_module_include_directories(G4geometrymng
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
|
||||
)
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>)
|
||||
|
||||
# - Link to modules/deps
|
||||
geant4_module_link_libraries(G4geometrymng
|
||||
PUBLIC G4globman G4hepgeometry G4graphics_reps ${VECGEOM_LIBRARIES}
|
||||
PRIVATE G4materials)
|
||||
|
||||
# WORKAROUND: When building/testing examples uing ROOT, ROOT's
|
||||
# dictionary generation is not smart enough to handle target usage
|
||||
# requirements for include paths. Explicitly add the path to the
|
||||
# generated header into build time include paths...
|
||||
set_property(GLOBAL APPEND
|
||||
PROPERTY GEANT4_BUILDTREE_INCLUDE_DIRS "${CMAKE_CURRENT_BINARY_DIR}/include")
|
||||
|
||||
|
||||
@@ -141,6 +141,16 @@ G4LogicalVolume::~G4LogicalVolume()
|
||||
G4LogicalVolumeStore::DeRegister(this);
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// SetName - Set volume name and notify store of the change
|
||||
// ********************************************************************
|
||||
//
|
||||
void G4LogicalVolume::SetName(const G4String& pName)
|
||||
{
|
||||
fName = pName;
|
||||
G4LogicalVolumeStore::GetInstance()->SetMapValid(false);
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// InitialiseWorker
|
||||
//
|
||||
|
||||
@@ -23,15 +23,22 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4LogicalVolumeStore implementation for singleton container
|
||||
// G4LogicalVolumeStore implementation
|
||||
//
|
||||
// 10.07.95 - P.Kent, Initial version
|
||||
// 10.07.95, P.Kent, G.Cosmo
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4Types.hh"
|
||||
#include "G4LogicalVolumeStore.hh"
|
||||
#include "G4GeometryManager.hh"
|
||||
|
||||
#include "G4AutoLock.hh"
|
||||
|
||||
namespace
|
||||
{
|
||||
G4Mutex mapMutex = G4MUTEX_INITIALIZER;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// Static class variables
|
||||
// ***************************************************************************
|
||||
@@ -81,7 +88,7 @@ void G4LogicalVolumeStore::Clean()
|
||||
//
|
||||
locked = true;
|
||||
|
||||
size_t i = 0;
|
||||
std::size_t i = 0;
|
||||
G4LogicalVolumeStore* store = GetInstance();
|
||||
|
||||
#ifdef G4GEOMETRY_VOXELDEBUG
|
||||
@@ -102,6 +109,7 @@ void G4LogicalVolumeStore::Clean()
|
||||
{ G4cout << i-1 << " volumes deleted !" << G4endl; }
|
||||
#endif
|
||||
|
||||
store->bmap.clear(); store->mvalid = false;
|
||||
locked = false;
|
||||
store->clear();
|
||||
}
|
||||
@@ -116,14 +124,54 @@ void G4LogicalVolumeStore::SetNotifier(G4VStoreNotifier* pNotifier)
|
||||
fgNotifier = pNotifier;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// Bring contents of internal map up to date and reset validity flag
|
||||
// ***************************************************************************
|
||||
//
|
||||
void G4LogicalVolumeStore::UpdateMap()
|
||||
{
|
||||
G4AutoLock l(&mapMutex); // to avoid thread contention at initialisation
|
||||
if (mvalid) return;
|
||||
bmap.clear();
|
||||
for(auto pos=GetInstance()->cbegin(); pos!=GetInstance()->cend(); ++pos)
|
||||
{
|
||||
const G4String& vol_name = (*pos)->GetName();
|
||||
auto it = bmap.find(vol_name);
|
||||
if (it != bmap.cend())
|
||||
{
|
||||
it->second.push_back(*pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<G4LogicalVolume*> vol_vec { *pos };
|
||||
bmap.insert(std::make_pair(vol_name, vol_vec));
|
||||
}
|
||||
}
|
||||
mvalid = true;
|
||||
l.unlock();
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// Add volume to container
|
||||
// ***************************************************************************
|
||||
//
|
||||
void G4LogicalVolumeStore::Register(G4LogicalVolume* pVolume)
|
||||
{
|
||||
GetInstance()->push_back(pVolume);
|
||||
G4LogicalVolumeStore* store = GetInstance();
|
||||
store->push_back(pVolume);
|
||||
const G4String& vol_name = pVolume->GetName();
|
||||
auto it = store->bmap.find(vol_name);
|
||||
if (it != store->bmap.cend())
|
||||
{
|
||||
it->second.push_back(pVolume);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<G4LogicalVolume*> vol_vec { pVolume };
|
||||
store->bmap.insert(std::make_pair(vol_name, vol_vec));
|
||||
}
|
||||
if (fgNotifier) { fgNotifier->NotifyRegistration(); }
|
||||
store->mvalid = true;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
@@ -132,17 +180,38 @@ void G4LogicalVolumeStore::Register(G4LogicalVolume* pVolume)
|
||||
//
|
||||
void G4LogicalVolumeStore::DeRegister(G4LogicalVolume* pVolume)
|
||||
{
|
||||
G4LogicalVolumeStore* store = GetInstance();
|
||||
if (!locked) // Do not de-register if locked !
|
||||
{
|
||||
if (fgNotifier != nullptr) { fgNotifier->NotifyDeRegistration(); }
|
||||
for (auto i=GetInstance()->cbegin(); i!=GetInstance()->cend(); ++i)
|
||||
for (auto i=store->cbegin(); i!=store->cend(); ++i)
|
||||
{
|
||||
if (**i==*pVolume)
|
||||
{
|
||||
GetInstance()->erase(i);
|
||||
store->erase(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
const G4String& vol_name = pVolume->GetName();
|
||||
auto it = store->bmap.find(vol_name);
|
||||
if (it != store->bmap.cend())
|
||||
{
|
||||
if (it->second.size() > 1)
|
||||
{
|
||||
for (auto i=it->second.cbegin(); i!=it->second.cend(); ++i)
|
||||
{
|
||||
if (**i==*pVolume)
|
||||
{
|
||||
it->second.erase(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
store->bmap.erase(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,9 +222,21 @@ void G4LogicalVolumeStore::DeRegister(G4LogicalVolume* pVolume)
|
||||
G4LogicalVolume*
|
||||
G4LogicalVolumeStore::GetVolume(const G4String& name, G4bool verbose) const
|
||||
{
|
||||
for (auto i=GetInstance()->cbegin(); i!=GetInstance()->cend(); ++i)
|
||||
G4LogicalVolumeStore* store = GetInstance();
|
||||
if (!store->mvalid) { store->UpdateMap(); }
|
||||
auto pos = store->bmap.find(name);
|
||||
if(pos != store->bmap.cend())
|
||||
{
|
||||
if ((*i)->GetName() == name) { return *i; }
|
||||
if ((verbose) && (pos->second.size()>1))
|
||||
{
|
||||
std::ostringstream message;
|
||||
message << "There exists more than ONE logical volume in store named: "
|
||||
<< name << "!" << G4endl
|
||||
<< "Returning the first found.";
|
||||
G4Exception("G4LogicalVolumeStore::GetVolume()",
|
||||
"GeomMgt1001", JustWarning, message);
|
||||
}
|
||||
return pos->second[0];
|
||||
}
|
||||
if (verbose)
|
||||
{
|
||||
@@ -166,7 +247,7 @@ G4LogicalVolumeStore::GetVolume(const G4String& name, G4bool verbose) const
|
||||
G4Exception("G4LogicalVolumeStore::GetVolume()",
|
||||
"GeomMgt1001", JustWarning, message);
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4PhysicalVolumeStore implementation for singleton container
|
||||
// G4PhysicalVolumeStore implementation
|
||||
//
|
||||
// 25.07.95, P.Kent - Initial version
|
||||
// 25.07.95, P.Kent, G.Cosmo
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4Types.hh"
|
||||
@@ -33,6 +33,13 @@
|
||||
#include "G4GeometryManager.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
|
||||
#include "G4AutoLock.hh"
|
||||
|
||||
namespace
|
||||
{
|
||||
G4Mutex mapMutex = G4MUTEX_INITIALIZER;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// Static class variables
|
||||
// ***************************************************************************
|
||||
@@ -83,7 +90,7 @@ void G4PhysicalVolumeStore::Clean()
|
||||
//
|
||||
locked = true;
|
||||
|
||||
size_t i=0;
|
||||
std::size_t i=0;
|
||||
G4PhysicalVolumeStore* store = GetInstance();
|
||||
|
||||
#ifdef G4GEOMETRY_VOXELDEBUG
|
||||
@@ -103,6 +110,7 @@ void G4PhysicalVolumeStore::Clean()
|
||||
{ G4cout << i-1 << " volumes deleted !" << G4endl; }
|
||||
#endif
|
||||
|
||||
store->bmap.clear(); store->mvalid = false;
|
||||
locked = false;
|
||||
store->clear();
|
||||
}
|
||||
@@ -117,14 +125,54 @@ void G4PhysicalVolumeStore::SetNotifier(G4VStoreNotifier* pNotifier)
|
||||
fgNotifier = pNotifier;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// Bring contents of internal map up to date and reset validity flag
|
||||
// ***************************************************************************
|
||||
//
|
||||
void G4PhysicalVolumeStore::UpdateMap()
|
||||
{
|
||||
G4AutoLock l(&mapMutex); // to avoid thread contention at initialisation
|
||||
if (mvalid) return;
|
||||
bmap.clear();
|
||||
for(auto pos=GetInstance()->cbegin(); pos!=GetInstance()->cend(); ++pos)
|
||||
{
|
||||
const G4String& vol_name = (*pos)->GetName();
|
||||
auto it = bmap.find(vol_name);
|
||||
if (it != bmap.cend())
|
||||
{
|
||||
it->second.push_back(*pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<G4VPhysicalVolume*> vol_vec { *pos };
|
||||
bmap.insert(std::make_pair(vol_name, vol_vec));
|
||||
}
|
||||
}
|
||||
mvalid = true;
|
||||
l.unlock();
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// Add Volume to container
|
||||
// ***************************************************************************
|
||||
//
|
||||
void G4PhysicalVolumeStore::Register(G4VPhysicalVolume* pVolume)
|
||||
{
|
||||
GetInstance()->push_back(pVolume);
|
||||
G4PhysicalVolumeStore* store = GetInstance();
|
||||
store->push_back(pVolume);
|
||||
const G4String& vol_name = pVolume->GetName();
|
||||
auto it = store->bmap.find(vol_name);
|
||||
if (it != store->bmap.cend())
|
||||
{
|
||||
it->second.push_back(pVolume);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<G4VPhysicalVolume*> vol_vec { pVolume };
|
||||
store->bmap.insert(std::make_pair(vol_name, vol_vec));
|
||||
}
|
||||
if (fgNotifier) { fgNotifier->NotifyRegistration(); }
|
||||
store->mvalid = true;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
@@ -134,19 +182,40 @@ void G4PhysicalVolumeStore::Register(G4VPhysicalVolume* pVolume)
|
||||
//
|
||||
void G4PhysicalVolumeStore::DeRegister(G4VPhysicalVolume* pVolume)
|
||||
{
|
||||
G4PhysicalVolumeStore* store = GetInstance();
|
||||
if (!locked) // Do not de-register if locked !
|
||||
{
|
||||
if (fgNotifier != nullptr) { fgNotifier->NotifyDeRegistration(); }
|
||||
G4LogicalVolume* motherLogical = pVolume->GetMotherLogical();
|
||||
if (motherLogical != nullptr) { motherLogical->RemoveDaughter(pVolume); }
|
||||
for (auto i=GetInstance()->cbegin(); i!=GetInstance()->cend(); ++i)
|
||||
for (auto i=store->cbegin(); i!=store->cend(); ++i)
|
||||
{
|
||||
if (**i==*pVolume)
|
||||
{
|
||||
GetInstance()->erase(i);
|
||||
store->erase(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
const G4String& vol_name = pVolume->GetName();
|
||||
auto it = store->bmap.find(vol_name);
|
||||
if (it != store->bmap.cend())
|
||||
{
|
||||
if (it->second.size() > 1)
|
||||
{
|
||||
for (auto i=it->second.cbegin(); i!=it->second.cend(); ++i)
|
||||
{
|
||||
if (**i==*pVolume)
|
||||
{
|
||||
it->second.erase(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
store->bmap.erase(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,9 +226,21 @@ void G4PhysicalVolumeStore::DeRegister(G4VPhysicalVolume* pVolume)
|
||||
G4VPhysicalVolume*
|
||||
G4PhysicalVolumeStore::GetVolume(const G4String& name, G4bool verbose) const
|
||||
{
|
||||
for (auto i=GetInstance()->cbegin(); i!=GetInstance()->cend(); ++i)
|
||||
G4PhysicalVolumeStore* store = GetInstance();
|
||||
if (!store->mvalid) { store->UpdateMap(); }
|
||||
auto pos = store->bmap.find(name);
|
||||
if(pos != store->bmap.cend())
|
||||
{
|
||||
if ((*i)->GetName() == name) { return *i; }
|
||||
if ((verbose) && (pos->second.size()>1))
|
||||
{
|
||||
std::ostringstream message;
|
||||
message << "There exists more than ONE physical volume in store named: "
|
||||
<< name << "!" << G4endl
|
||||
<< "Returning the first found.";
|
||||
G4Exception("G4PhysicalVolumeStore::GetVolume()",
|
||||
"GeomMgt1001", JustWarning, message);
|
||||
}
|
||||
return pos->second[0];
|
||||
}
|
||||
if (verbose)
|
||||
{
|
||||
|
||||
@@ -114,6 +114,16 @@ G4Region::~G4Region()
|
||||
if(fUserInfo != nullptr) { delete fUserInfo; }
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// SetName - Set region name and notify store of the change
|
||||
// ********************************************************************
|
||||
//
|
||||
void G4Region::SetName(const G4String& pName)
|
||||
{
|
||||
fName = pName;
|
||||
G4RegionStore::GetInstance()->SetMapValid(false);
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// SetFastSimulationManager
|
||||
// ********************************************************************
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4RegionStore implementation for singleton container
|
||||
// G4RegionStore implementation
|
||||
//
|
||||
// 18.09.02, G.Cosmo - Initial version
|
||||
// --------------------------------------------------------------------
|
||||
@@ -35,6 +35,12 @@
|
||||
#include "G4PhysicalVolumeStore.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include "G4AutoLock.hh"
|
||||
|
||||
namespace
|
||||
{
|
||||
G4Mutex mapMutex = G4MUTEX_INITIALIZER;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// Static class variables
|
||||
@@ -85,7 +91,7 @@ void G4RegionStore::Clean()
|
||||
//
|
||||
locked = true;
|
||||
|
||||
size_t i=0;
|
||||
std::size_t i=0;
|
||||
G4RegionStore* store = GetInstance();
|
||||
|
||||
#ifdef G4GEOMETRY_VOXELDEBUG
|
||||
@@ -105,6 +111,7 @@ void G4RegionStore::Clean()
|
||||
{ G4cout << i-1 << " regions deleted !" << G4endl; }
|
||||
#endif
|
||||
|
||||
store->bmap.clear(); store->mvalid = false;
|
||||
locked = false;
|
||||
store->clear();
|
||||
}
|
||||
@@ -119,14 +126,54 @@ void G4RegionStore::SetNotifier(G4VStoreNotifier* pNotifier)
|
||||
fgNotifier = pNotifier;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// Bring contents of internal map up to date and reset validity flag
|
||||
// ***************************************************************************
|
||||
//
|
||||
void G4RegionStore::UpdateMap()
|
||||
{
|
||||
G4AutoLock l(&mapMutex); // to avoid thread contention at initialisation
|
||||
if (mvalid) return;
|
||||
bmap.clear();
|
||||
for(auto pos=GetInstance()->cbegin(); pos!=GetInstance()->cend(); ++pos)
|
||||
{
|
||||
const G4String& reg_name = (*pos)->GetName();
|
||||
auto it = bmap.find(reg_name);
|
||||
if (it != bmap.cend())
|
||||
{
|
||||
it->second.push_back(*pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<G4Region*> reg_vec { *pos };
|
||||
bmap.insert(std::make_pair(reg_name, reg_vec));
|
||||
}
|
||||
}
|
||||
mvalid = true;
|
||||
l.unlock();
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// Add Region to container
|
||||
// ***************************************************************************
|
||||
//
|
||||
void G4RegionStore::Register(G4Region* pRegion)
|
||||
{
|
||||
GetInstance()->push_back(pRegion);
|
||||
if (fgNotifier) { fgNotifier->NotifyRegistration(); }
|
||||
G4RegionStore* store = GetInstance();
|
||||
store->push_back(pRegion);
|
||||
const G4String& reg_name = pRegion->GetName();
|
||||
auto it = store->bmap.find(reg_name);
|
||||
if (it != store->bmap.cend())
|
||||
{
|
||||
it->second.push_back(pRegion);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<G4Region*> reg_vec { pRegion };
|
||||
store->bmap.insert(std::make_pair(reg_name, reg_vec));
|
||||
}
|
||||
if (fgNotifier) { fgNotifier->NotifyRegistration(); }
|
||||
store->mvalid = true;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
@@ -135,17 +182,38 @@ void G4RegionStore::Register(G4Region* pRegion)
|
||||
//
|
||||
void G4RegionStore::DeRegister(G4Region* pRegion)
|
||||
{
|
||||
G4RegionStore* store = GetInstance();
|
||||
if (!locked) // Do not de-register if locked !
|
||||
{
|
||||
if (fgNotifier != nullptr) { fgNotifier->NotifyDeRegistration(); }
|
||||
for (auto i=GetInstance()->cbegin(); i!=GetInstance()->cend(); ++i)
|
||||
for (auto i=store->cbegin(); i!=store->cend(); ++i)
|
||||
{
|
||||
if (**i==*pRegion)
|
||||
{
|
||||
GetInstance()->erase(i);
|
||||
store->erase(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
const G4String& reg_name = pRegion->GetName();
|
||||
auto it = store->bmap.find(reg_name);
|
||||
if (it != store->bmap.cend())
|
||||
{
|
||||
if (it->second.size() > 1)
|
||||
{
|
||||
for (auto i=it->second.cbegin(); i!=it->second.cend(); ++i)
|
||||
{
|
||||
if (**i==*pRegion)
|
||||
{
|
||||
it->second.erase(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
store->bmap.erase(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,9 +278,21 @@ void G4RegionStore::UpdateMaterialList(G4VPhysicalVolume* currentWorld)
|
||||
//
|
||||
G4Region* G4RegionStore::GetRegion(const G4String& name, G4bool verbose) const
|
||||
{
|
||||
for (auto i=GetInstance()->cbegin(); i!=GetInstance()->cend(); ++i)
|
||||
G4RegionStore* store = GetInstance();
|
||||
if (!store->mvalid) { store->UpdateMap(); }
|
||||
auto pos = store->bmap.find(name);
|
||||
if(pos != store->bmap.cend())
|
||||
{
|
||||
if ((*i)->GetName() == name) { return *i; }
|
||||
if ((verbose) && (pos->second.size()>1))
|
||||
{
|
||||
std::ostringstream message;
|
||||
message << "There exists more than ONE region in store named: "
|
||||
<< name << "!" << G4endl
|
||||
<< "Returning the first found.";
|
||||
G4Exception("G4RegionStore::GetSolid()",
|
||||
"GeomMgt1001", JustWarning, message);
|
||||
}
|
||||
return pos->second[0];
|
||||
}
|
||||
if (verbose)
|
||||
{
|
||||
@@ -223,7 +303,7 @@ G4Region* G4RegionStore::GetRegion(const G4String& name, G4bool verbose) const
|
||||
G4Exception("G4RegionStore::GetRegion()",
|
||||
"GeomMgt1001", JustWarning, message);
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
@@ -23,16 +23,22 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4SolidStore implementation for singleton container
|
||||
// G4SolidStore implementation
|
||||
//
|
||||
// 18.04.01, G.Cosmo - Migrated to STL vector
|
||||
// 10.07.95, P.Kent - Initial version
|
||||
// 10.07.95, P.Kent, G.Cosmo
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4SolidStore.hh"
|
||||
#include "G4GeometryManager.hh"
|
||||
|
||||
#include "G4AutoLock.hh"
|
||||
|
||||
namespace
|
||||
{
|
||||
G4Mutex mapMutex = G4MUTEX_INITIALIZER;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// Static class variables
|
||||
// ***************************************************************************
|
||||
@@ -81,7 +87,7 @@ void G4SolidStore::Clean()
|
||||
//
|
||||
locked = true;
|
||||
|
||||
size_t i = 0;
|
||||
std::size_t i = 0;
|
||||
G4SolidStore* store = GetInstance();
|
||||
|
||||
#ifdef G4GEOMETRY_VOXELDEBUG
|
||||
@@ -101,6 +107,7 @@ void G4SolidStore::Clean()
|
||||
{ G4cout << i-1 << " solids deleted !" << G4endl; }
|
||||
#endif
|
||||
|
||||
store->bmap.clear(); store->mvalid = false;
|
||||
locked = false;
|
||||
store->clear();
|
||||
}
|
||||
@@ -115,14 +122,54 @@ void G4SolidStore::SetNotifier(G4VStoreNotifier* pNotifier)
|
||||
fgNotifier = pNotifier;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// Bring contents of internal map up to date and reset validity flag
|
||||
// ***************************************************************************
|
||||
//
|
||||
void G4SolidStore::UpdateMap()
|
||||
{
|
||||
G4AutoLock l(&mapMutex); // to avoid thread contention at initialisation
|
||||
if (mvalid) return;
|
||||
bmap.clear();
|
||||
for(auto pos=GetInstance()->cbegin(); pos!=GetInstance()->cend(); ++pos)
|
||||
{
|
||||
const G4String& sol_name = (*pos)->GetName();
|
||||
auto it = bmap.find(sol_name);
|
||||
if (it != bmap.cend())
|
||||
{
|
||||
it->second.push_back(*pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<G4VSolid*> sol_vec { *pos };
|
||||
bmap.insert(std::make_pair(sol_name, sol_vec));
|
||||
}
|
||||
}
|
||||
mvalid = true;
|
||||
l.unlock();
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// Add Solid to container
|
||||
// ***************************************************************************
|
||||
//
|
||||
void G4SolidStore::Register(G4VSolid* pSolid)
|
||||
{
|
||||
GetInstance()->push_back(pSolid);
|
||||
if (fgNotifier != nullptr) { fgNotifier->NotifyRegistration(); }
|
||||
G4SolidStore* store = GetInstance();
|
||||
store->push_back(pSolid);
|
||||
const G4String& sol_name = pSolid->GetName();
|
||||
auto it = store->bmap.find(sol_name);
|
||||
if (it != store->bmap.cend())
|
||||
{
|
||||
it->second.push_back(pSolid);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<G4VSolid*> sol_vec { pSolid };
|
||||
store->bmap.insert(std::make_pair(sol_name, sol_vec));
|
||||
}
|
||||
if (fgNotifier) { fgNotifier->NotifyRegistration(); }
|
||||
store->mvalid = true;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
@@ -131,17 +178,39 @@ void G4SolidStore::Register(G4VSolid* pSolid)
|
||||
//
|
||||
void G4SolidStore::DeRegister(G4VSolid* pSolid)
|
||||
{
|
||||
G4SolidStore* store = GetInstance();
|
||||
if (!locked) // Do not de-register if locked !
|
||||
{
|
||||
if (fgNotifier != nullptr) { fgNotifier->NotifyDeRegistration(); }
|
||||
for (auto i=GetInstance()->crbegin(); i!=GetInstance()->crend(); ++i)
|
||||
for (auto i=store->crbegin(); i!=store->crend(); ++i)
|
||||
{
|
||||
if (**i==*pSolid)
|
||||
{
|
||||
GetInstance()->erase(std::next(i).base());
|
||||
store->erase(std::next(i).base());
|
||||
store->mvalid = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
const G4String& sol_name = pSolid->GetName();
|
||||
auto it = store->bmap.find(sol_name);
|
||||
if (it != store->bmap.cend())
|
||||
{
|
||||
if (it->second.size() > 1)
|
||||
{
|
||||
for (auto i=it->second.cbegin(); i!=it->second.cend(); ++i)
|
||||
{
|
||||
if (**i==*pSolid)
|
||||
{
|
||||
it->second.erase(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
store->bmap.erase(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,17 +220,29 @@ void G4SolidStore::DeRegister(G4VSolid* pSolid)
|
||||
//
|
||||
G4VSolid* G4SolidStore::GetSolid(const G4String& name, G4bool verbose) const
|
||||
{
|
||||
for (auto i=GetInstance()->cbegin(); i!=GetInstance()->cend(); ++i)
|
||||
G4SolidStore* store = GetInstance();
|
||||
if (!store->mvalid) { store->UpdateMap(); }
|
||||
auto pos = store->bmap.find(name);
|
||||
if(pos != store->bmap.cend())
|
||||
{
|
||||
if ((*i)->GetName() == name) { return *i; }
|
||||
if ((verbose) && (pos->second.size()>1))
|
||||
{
|
||||
std::ostringstream message;
|
||||
message << "There exists more than ONE solid in store named: "
|
||||
<< name << "!" << G4endl
|
||||
<< "Returning the first found.";
|
||||
G4Exception("G4SolidStore::GetSolid()",
|
||||
"GeomMgt1001", JustWarning, message);
|
||||
}
|
||||
return pos->second[0];
|
||||
}
|
||||
if (verbose)
|
||||
{
|
||||
std::ostringstream message;
|
||||
message << "Solid " << name << " not found in store !" << G4endl
|
||||
<< "Returning NULL pointer.";
|
||||
G4Exception("G4SolidStore::GetSolid()",
|
||||
"GeomMgt1001", JustWarning, message);
|
||||
std::ostringstream message;
|
||||
message << "Solid " << name << " not found in store !" << G4endl
|
||||
<< "Returning NULL pointer.";
|
||||
G4Exception("G4SolidStore::GetSolid()",
|
||||
"GeomMgt1001", JustWarning, message);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -94,6 +94,14 @@ G4VPhysicalVolume::~G4VPhysicalVolume()
|
||||
G4PhysicalVolumeStore::DeRegister(this);
|
||||
}
|
||||
|
||||
// Set volume name and notify store of the change
|
||||
//
|
||||
void G4VPhysicalVolume::SetName(const G4String& pName)
|
||||
{
|
||||
fname = pName;
|
||||
G4PhysicalVolumeStore::GetInstance()->SetMapValid(false);
|
||||
}
|
||||
|
||||
// This method is similar to the constructor. It is used by each worker
|
||||
// thread to achieve the same effect as that of the master thread exept
|
||||
// to register the new created instance. This method is invoked explicitly.
|
||||
|
||||
@@ -118,6 +118,16 @@ std::ostream& operator<< ( std::ostream& os, const G4VSolid& e )
|
||||
return e.StreamInfo(os);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Set solid name and notify store of the change
|
||||
|
||||
void G4VSolid::SetName(const G4String& name)
|
||||
{
|
||||
fshapeName = name;
|
||||
G4SolidStore::GetInstance()->SetMapValid(false);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Throw exception if ComputeDimensions called for illegal derived class
|
||||
|
||||
Reference in New Issue
Block a user