Geant4-11
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes
G4GeometryWorkspace Class Reference

#include <G4GeometryWorkspace.hh>

Public Types

using pool_type = G4TWorkspacePool< G4GeometryWorkspace >
 

Public Member Functions

void DestroyWorkspace ()
 
 G4GeometryWorkspace ()
 
void InitialiseWorkspace ()
 
void ReleaseWorkspace ()
 
void UseWorkspace ()
 
 ~G4GeometryWorkspace ()
 

Static Public Member Functions

static pool_typeGetPool ()
 

Protected Member Functions

G4bool CloneReplicaSolid (G4PVReplica *)
 
void InitialisePhysicalVolumes ()
 

Private Attributes

G4LVDatafLogicalVolumeOffset
 
G4PVDatafPhysicalVolumeOffset
 
G4LVManagerfpLogicalVolumeSIM
 
G4PVManagerfpPhysicalVolumeSIM
 
G4RegionManagerfpRegionSIM
 
G4PVRManagerfpReplicaSIM
 
G4RegionDatafRegionOffset
 
G4ReplicaDatafReplicaOffset
 

Detailed Description

Definition at line 56 of file G4GeometryWorkspace.hh.

Member Typedef Documentation

◆ pool_type

Definition at line 60 of file G4GeometryWorkspace.hh.

Constructor & Destructor Documentation

◆ G4GeometryWorkspace()

G4GeometryWorkspace::G4GeometryWorkspace ( )

Definition at line 50 of file G4GeometryWorkspace.cc.

51{
60
61 // Create a work area for Logical Volumes in this thread
62 // then capture its address
63 //
65
67
69
71
73}
G4PVManager * fpPhysicalVolumeSIM
G4RegionData * fRegionOffset
G4PVRManager * fpReplicaSIM
G4RegionManager * fpRegionSIM
G4LVManager * fpLogicalVolumeSIM
G4ReplicaData * fReplicaOffset
static const G4LVManager & GetSubInstanceManager()
static const G4PVRManager & GetSubInstanceManager()
Definition: G4PVReplica.cc:343
static const G4RegionManager & GetSubInstanceManager()
Definition: G4Region.cc:55
static const G4PVManager & GetSubInstanceManager()

References fLogicalVolumeOffset, fPhysicalVolumeOffset, fpLogicalVolumeSIM, fpPhysicalVolumeSIM, fpRegionSIM, fpReplicaSIM, fRegionOffset, fReplicaOffset, G4GeomSplitter< T >::GetOffset(), G4LogicalVolume::GetSubInstanceManager(), G4Region::GetSubInstanceManager(), G4VPhysicalVolume::GetSubInstanceManager(), G4PVReplica::GetSubInstanceManager(), and InitialiseWorkspace().

◆ ~G4GeometryWorkspace()

G4GeometryWorkspace::~G4GeometryWorkspace ( )

Definition at line 77 of file G4GeometryWorkspace.cc.

78{
79}

Member Function Documentation

◆ CloneReplicaSolid()

G4bool G4GeometryWorkspace::CloneReplicaSolid ( G4PVReplica replicaPV)
protected

Definition at line 148 of file G4GeometryWorkspace.cc.

149{
150 G4LogicalVolume* logicalV = replicaPV->GetLogicalVolume();
151 G4VSolid* solid = logicalV->GetSolid();
152
153 G4AutoLock aLock(&mutex_init);
154 G4VSolid* workerSolid = solid->Clone();
155 aLock.unlock();
156
157 if( workerSolid != nullptr )
158 {
159 logicalV->InitialiseWorker(logicalV,workerSolid,nullptr);
160 }
161 else
162 {
163 // In the case that not all solids support(ed) the Clone()
164 // method, we do similar thing here to dynamically cast
165 // and then get the clone method
166 //
168 ed << "ERROR - Unable to initialise geometry for worker node." << "\n"
169 << "A solid lacks the Clone() method - or Clone() failed." << "\n"
170 << " Type of solid: " << solid->GetEntityType() << "\n"
171 << " Parameters: " << *solid;
172 G4Exception("G4GeometryWorkspace::CloneReplicaSolid()",
173 "GeomVol0003", FatalException, ed);
174 return false;
175 }
176 return true; // It Worked
177}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
G4VSolid * GetSolid() const
void InitialiseWorker(G4LogicalVolume *ptrMasterObject, G4VSolid *pSolid, G4VSensitiveDetector *pSDetector)
G4LogicalVolume * GetLogicalVolume() const
virtual G4VSolid * Clone() const
Definition: G4VSolid.cc:391
virtual G4GeometryType GetEntityType() const =0

References G4VSolid::Clone(), FatalException, G4Exception(), G4VSolid::GetEntityType(), G4VPhysicalVolume::GetLogicalVolume(), G4LogicalVolume::GetSolid(), G4LogicalVolume::InitialiseWorker(), anonymous_namespace{G4GeometryWorkspace.cc}::mutex_init, and G4TemplateAutoLock< _Mutex_t >::unlock().

Referenced by InitialisePhysicalVolumes().

◆ DestroyWorkspace()

void G4GeometryWorkspace::DestroyWorkspace ( )

Definition at line 196 of file G4GeometryWorkspace.cc.

197{
199 for (std::size_t ip=0; ip<physVolStore->size(); ++ip)
200 {
201 G4VPhysicalVolume* physVol = (*physVolStore)[ip];
202 G4LogicalVolume* logicalVol = physVol->GetLogicalVolume();
203 G4PVReplica* g4PVReplica = dynamic_cast<G4PVReplica*>(physVol);
204 if (g4PVReplica != nullptr)
205 {
206 g4PVReplica->TerminateWorker(g4PVReplica);
207 }
208 logicalVol->TerminateWorker(logicalVol);
209 }
210
211 // Threads may attempt to free memory simultaneously.
212 // Need a lock to guarantee thread safety
213 //
214 G4AutoLock aLock(&mutex_init);
219 aLock.unlock();
220}
void TerminateWorker(G4LogicalVolume *ptrMasterObject)
void TerminateWorker(G4PVReplica *pMasterObject)
Definition: G4PVReplica.cc:400
static G4PhysicalVolumeStore * GetInstance()

References fpLogicalVolumeSIM, fpPhysicalVolumeSIM, fpRegionSIM, fpReplicaSIM, G4GeomSplitter< T >::FreeSlave(), G4PhysicalVolumeStore::GetInstance(), G4VPhysicalVolume::GetLogicalVolume(), anonymous_namespace{G4GeometryWorkspace.cc}::mutex_init, G4LogicalVolume::TerminateWorker(), G4PVReplica::TerminateWorker(), and G4TemplateAutoLock< _Mutex_t >::unlock().

Referenced by G4WorkerThread::UpdateGeometryAndPhysicsVectorFromMaster().

◆ GetPool()

G4GeometryWorkspace::pool_type * G4GeometryWorkspace::GetPool ( )
static

◆ InitialisePhysicalVolumes()

void G4GeometryWorkspace::InitialisePhysicalVolumes ( )
protected

Definition at line 114 of file G4GeometryWorkspace.cc.

115{
117 for (std::size_t ip=0; ip<physVolStore->size(); ++ip)
118 {
119 G4VPhysicalVolume* physVol = (*physVolStore)[ip];
120 G4LogicalVolume *logicalVol = physVol->GetLogicalVolume();
121
122 // Use shadow pointer
123 //
124 G4VSolid* solid = logicalVol->GetMasterSolid();
125 G4PVReplica* g4PVReplica = dynamic_cast<G4PVReplica*>(physVol);
126 if (g4PVReplica == nullptr)
127 {
128 // Placement volume
129 //
130 logicalVol->InitialiseWorker(logicalVol,solid,nullptr);
131 }
132 else
133 {
134 g4PVReplica->InitialiseWorker(g4PVReplica);
135 logicalVol->InitialiseWorker(logicalVol,solid,nullptr);
136
137 // If the replica's solid (in LV) is changed during navigation,
138 // it must be thread-private
139 //
140 CloneReplicaSolid( g4PVReplica );
141 }
142 }
143}
G4bool CloneReplicaSolid(G4PVReplica *)
G4VSolid * GetMasterSolid() const
void InitialiseWorker(G4PVReplica *pMasterObject)
Definition: G4PVReplica.cc:355

References CloneReplicaSolid(), G4PhysicalVolumeStore::GetInstance(), G4VPhysicalVolume::GetLogicalVolume(), G4LogicalVolume::GetMasterSolid(), G4LogicalVolume::InitialiseWorker(), and G4PVReplica::InitialiseWorker().

Referenced by InitialiseWorkspace().

◆ InitialiseWorkspace()

void G4GeometryWorkspace::InitialiseWorkspace ( )

◆ ReleaseWorkspace()

void G4GeometryWorkspace::ReleaseWorkspace ( )

Definition at line 103 of file G4GeometryWorkspace.cc.

104{
107
108 fpReplicaSIM->UseWorkArea(nullptr);
109 fpRegionSIM->UseWorkArea(nullptr);
110}
void UseWorkArea(T *newOffset)

References fpLogicalVolumeSIM, fpPhysicalVolumeSIM, fpRegionSIM, fpReplicaSIM, and G4GeomSplitter< T >::UseWorkArea().

◆ UseWorkspace()

void G4GeometryWorkspace::UseWorkspace ( )

Definition at line 84 of file G4GeometryWorkspace.cc.

85{
86 // Geometry related, split classes mechanism: instantiate sub-instance
87 // for this thread
88 //
91
94
95 // When recycling a workspace
96 // - it must be a lightweight operation, to reuse a valid work area
97 // - so it must NOT Initialise anything!
98 // Do not call InitialisePhysicalVolumes();
99}

References fLogicalVolumeOffset, fPhysicalVolumeOffset, fpLogicalVolumeSIM, fpPhysicalVolumeSIM, fpRegionSIM, fpReplicaSIM, fRegionOffset, fReplicaOffset, and G4GeomSplitter< T >::UseWorkArea().

Field Documentation

◆ fLogicalVolumeOffset

G4LVData* G4GeometryWorkspace::fLogicalVolumeOffset
private

Definition at line 90 of file G4GeometryWorkspace.hh.

Referenced by G4GeometryWorkspace(), and UseWorkspace().

◆ fPhysicalVolumeOffset

G4PVData* G4GeometryWorkspace::fPhysicalVolumeOffset
private

Definition at line 91 of file G4GeometryWorkspace.hh.

Referenced by G4GeometryWorkspace(), and UseWorkspace().

◆ fpLogicalVolumeSIM

G4LVManager* G4GeometryWorkspace::fpLogicalVolumeSIM
private

◆ fpPhysicalVolumeSIM

G4PVManager* G4GeometryWorkspace::fpPhysicalVolumeSIM
private

◆ fpRegionSIM

G4RegionManager* G4GeometryWorkspace::fpRegionSIM
private

◆ fpReplicaSIM

G4PVRManager* G4GeometryWorkspace::fpReplicaSIM
private

◆ fRegionOffset

G4RegionData* G4GeometryWorkspace::fRegionOffset
private

Definition at line 93 of file G4GeometryWorkspace.hh.

Referenced by G4GeometryWorkspace(), and UseWorkspace().

◆ fReplicaOffset

G4ReplicaData* G4GeometryWorkspace::fReplicaOffset
private

Definition at line 92 of file G4GeometryWorkspace.hh.

Referenced by G4GeometryWorkspace(), and UseWorkspace().


The documentation for this class was generated from the following files: