Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4GeometryManager Class Reference

G4GeometryManager is a singleton class responsible for high level geometrical functions, and for high level objects in the geometry subdomain. More...

#include <G4GeometryManager.hh>

Public Member Functions

 ~G4GeometryManager ()
G4bool CloseGeometry (G4bool pOptimise=true, G4bool verbose=false, G4VPhysicalVolume *vol=nullptr)
void OpenGeometry (G4VPhysicalVolume *vol=nullptr)
G4bool IsGeometryClosed ()
void SetWorldMaximumExtent (G4double worldExtent)
void OptimiseInParallel (G4bool val=true)
void UndertakeOptimisation ()
void RequestParallelOptimisation (G4bool val=true, G4bool verbose=true)
G4bool IsParallelOptimisationConfigured ()
G4bool IsParallelOptimisationFinished ()

Static Public Member Functions

static G4GeometryManagerGetInstance ()
static G4GeometryManagerGetInstanceIfExist ()

Detailed Description

G4GeometryManager is a singleton class responsible for high level geometrical functions, and for high level objects in the geometry subdomain.

Definition at line 56 of file G4GeometryManager.hh.

Constructor & Destructor Documentation

◆ ~G4GeometryManager()

G4GeometryManager::~G4GeometryManager ( )

Destructor; called by G4RunManagerKernel.

Definition at line 103 of file G4GeometryManager.cc.

104{
105 fgInstance = nullptr;
106 fIsClosed = false;
107
108 // Only the master thread can delete the helper objects
109 // - a different mechanism is needed for setups with no master
110 // TODO: See if shared_ptr could help here?
112 {
113 if( fParallelVoxeliser != nullptr )
114 {
115 delete fParallelVoxeliser;
116 fParallelVoxeliser = nullptr;
117 }
118 }
119}
G4bool IsMasterThread()

Member Function Documentation

◆ CloseGeometry()

G4bool G4GeometryManager::CloseGeometry ( G4bool pOptimise = true,
G4bool verbose = false,
G4VPhysicalVolume * vol = nullptr )

Closes ('locks') the geometry: performs sanity and 'completion' checks and optionally [default=yes] builds the optimisation structure. Applies to just a specific subtree if a physical volume is specified.

Parameters
[in]pOptimiseFlag to enabling/disabling optimisation structure.
[in]verboseFlag for verbosity.
[in]volOptional pointer to a physical volume (subtree) for optimisation.
Returns
true if process succeeds.

Definition at line 128 of file G4GeometryManager.cc.

130{
131 if (!fIsClosed && G4Threading::IsMasterThread())
132 {
133 G4bool workDone= false;
134 if (pVolume != nullptr)
135 {
136 workDone= BuildOptimisations(pOptimise, pVolume);
137 }
138 else
139 {
140 workDone= BuildOptimisations(pOptimise, verbose);
141 }
142 fIsClosed = workDone; // Sequential will be done; parallel ongoing
143 }
144 return true;
145}
bool G4bool
Definition G4Types.hh:86

Referenced by G4TheRayTracer::CreateBitMap(), G4DNAChemistryManager::HandleStandaloneInitialization(), G4RunManagerKernel::ResetNavigator(), and G4TheRayTracer::StoreUserActions().

◆ GetInstance()

◆ GetInstanceIfExist()

G4GeometryManager * G4GeometryManager::GetInstanceIfExist ( )
static

Simply returns a pointer to the singleton instance.

Definition at line 201 of file G4GeometryManager.cc.

202{
203 return fgInstance;
204}

Referenced by G4RunManagerKernel::~G4RunManagerKernel().

◆ IsGeometryClosed()

G4bool G4GeometryManager::IsGeometryClosed ( )

Returns true/false according to the state of the optimised geometry.

Definition at line 151 of file G4GeometryManager.cc.

152{
153 if( fOptimiseInParallelConfigured )
154 {
155 fIsClosed= fParallelVoxeliser->IsParallelOptimisationFinished();
156 }
157 return fIsClosed;
158}

◆ IsParallelOptimisationConfigured()

G4bool G4GeometryManager::IsParallelOptimisationConfigured ( )

Checks whether parallel optimisation was requested and configured.

Definition at line 229 of file G4GeometryManager.cc.

230{
231 return fOptimiseInParallelConfigured;
232}

Referenced by G4WorkerRunManager::InitializeGeometry(), and G4RunManagerKernel::ResetNavigator().

◆ IsParallelOptimisationFinished()

G4bool G4GeometryManager::IsParallelOptimisationFinished ( )

Reports whether parallel optimisation was completed.

Definition at line 219 of file G4GeometryManager.cc.

220{
221 return fParallelVoxeliser->IsParallelOptimisationFinished();
222}

Referenced by G4WorkerRunManager::InitializeGeometry(), and G4RunManagerKernel::ResetNavigator().

◆ OpenGeometry()

void G4GeometryManager::OpenGeometry ( G4VPhysicalVolume * vol = nullptr)

Opens ('unlocks') the geometry and removes the optimisation structure if present. Applies to just a specific subtree if a physical volume is specified.

Parameters
[in]volOptional pointer to a physical volume (subtree) for optimisation.

Definition at line 166 of file G4GeometryManager.cc.

167{
168 if (fIsClosed && G4Threading::IsMasterThread())
169 {
170 if (pVolume != nullptr)
171 {
172 DeleteOptimisations(pVolume);
173 }
174 else
175 {
176 DeleteOptimisations();
177 }
178 fIsClosed = false;
179 // fGeometryCloseRequested= false;
180 }
181}

Referenced by G4ErrorPropagatorManager::CloseGeometry(), G4TheRayTracer::CreateBitMap(), G4DNAChemistryManager::HandleStandaloneInitialization(), G4RunManager::ReinitializeGeometry(), G4RunManagerKernel::ResetNavigator(), G4GDMLMessenger::SetNewValue(), G4TheRayTracer::StoreUserActions(), and G4RunManagerKernel::~G4RunManagerKernel().

◆ OptimiseInParallel()

void G4GeometryManager::OptimiseInParallel ( G4bool val = true)

Requests optimisation using threads (if MT is enabled & used ).

Definition at line 210 of file G4GeometryManager.cc.

211{
213}
void RequestParallelOptimisation(G4bool val=true, G4bool verbose=true)

◆ RequestParallelOptimisation()

void G4GeometryManager::RequestParallelOptimisation ( G4bool val = true,
G4bool verbose = true )

Detailed method for user to request parallel optimisation (if verbosity is required). Calling this method is enough to ask for it. It will be used if Geant4 is built with MT/tasks. Parallelism will be used if Geant4 is built with MT/tasks.

Definition at line 369 of file G4GeometryManager.cc.

370{
371 fParallelVoxelOptimisationRequested = flag;
372 if( flag )
373 {
374 fParallelVoxeliser->SetVerbosity(verbose);
375 }
376}

Referenced by OptimiseInParallel().

◆ SetWorldMaximumExtent()

void G4GeometryManager::SetWorldMaximumExtent ( G4double worldExtent)

Sets the maximum extent of the world volume. The operation is allowed only if NO solids have been created already.

Definition at line 500 of file G4GeometryManager.cc.

501{
502 if (!G4SolidStore::GetInstance()->empty())
503 {
504 // Sanity check to assure that extent is fixed BEFORE creating
505 // any geometry object (solids in this case)
506 //
507 G4Exception("G4GeometryManager::SetMaximumExtent()",
508 "GeomMgt0003", FatalException,
509 "Extent can be set only BEFORE creating any geometry object!");
510 }
512}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
void SetSurfaceTolerance(G4double worldExtent)
static G4GeometryTolerance * GetInstance()
static G4SolidStore * GetInstance()

◆ UndertakeOptimisation()

void G4GeometryManager::UndertakeOptimisation ( )

Method that contributes to (voxel) optimisation until all work is done. To be called by a worker thread initialisation - not by the user.

Definition at line 382 of file G4GeometryManager.cc.

383{
384 fParallelVoxeliser->UndertakeOptimisation();
385}

Referenced by G4WorkerRunManager::InitializeGeometry(), and G4RunManagerKernel::ResetNavigator().


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