Geant4  10.02.p03
G4GeometryWorkspacePool Class Reference

#include <G4GeometryWorkspacePool.hh>

Collaboration diagram for G4GeometryWorkspacePool:

Public Member Functions

G4GeometryWorkspaceCreateWorkspace ()
 
void CreateAndUseWorkspace ()
 
G4GeometryWorkspaceFindOrCreateWorkspace ()
 
G4GeometryWorkspaceGetWorkspace ()
 
void Recycle (G4GeometryWorkspace *)
 
void CleanUpAndDestroyAllWorkspaces ()
 

Static Public Member Functions

static G4GeometryWorkspacePoolGetInstance ()
 

Protected Member Functions

void ReleaseAndDestroyWorkspace (G4GeometryWorkspace *)
 

Private Member Functions

 G4GeometryWorkspacePool ()
 
 ~G4GeometryWorkspacePool ()
 

Static Private Attributes

static G4GeometryWorkspacePoolthePool =0
 
static G4ThreadLocal G4GeometryWorkspacefMyWorkspace =0
 

Detailed Description

Definition at line 50 of file G4GeometryWorkspacePool.hh.

Constructor & Destructor Documentation

◆ G4GeometryWorkspacePool()

G4GeometryWorkspacePool::G4GeometryWorkspacePool ( )
private

Definition at line 131 of file G4GeometryWorkspacePool.cc.

132 {
133  // fWarehouse=0;
134 }
Here is the caller graph for this function:

◆ ~G4GeometryWorkspacePool()

G4GeometryWorkspacePool::~G4GeometryWorkspacePool ( )
private

Definition at line 138 of file G4GeometryWorkspacePool.cc.

139 {
140 }
Here is the caller graph for this function:

Member Function Documentation

◆ CleanUpAndDestroyAllWorkspaces()

void G4GeometryWorkspacePool::CleanUpAndDestroyAllWorkspaces ( )

Definition at line 125 of file G4GeometryWorkspacePool.cc.

126 {
127 }
Here is the caller graph for this function:

◆ CreateAndUseWorkspace()

void G4GeometryWorkspacePool::CreateAndUseWorkspace ( )

Definition at line 91 of file G4GeometryWorkspacePool.cc.

92 {
93  (this->CreateWorkspace())->UseWorkspace();
94 }
G4GeometryWorkspace * CreateWorkspace()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateWorkspace()

G4GeometryWorkspace * G4GeometryWorkspacePool::CreateWorkspace ( )

Definition at line 60 of file G4GeometryWorkspacePool.cc.

61 {
62  G4GeometryWorkspace* geometryWrk=0;
63  if( !fMyWorkspace )
64  {
65  geometryWrk= new G4GeometryWorkspace();
66 
67  if( !geometryWrk )
68  {
69  G4Exception("GeometryWorspacePool::CreateWorkspace", "GeomVol003",
70  FatalException, "Failed to create workspace.");
71  }
72  else
73  {
74  fMyWorkspace= geometryWrk;
75  }
76  }
77  else
78  {
79  G4Exception("GeometryWorspacePool::CreateWorkspace", "GeomVol003",
81  "Cannot create workspace twice for the same thread.");
82  geometryWrk= fMyWorkspace;
83  }
84 
85  return geometryWrk;
86 }
static G4ThreadLocal G4GeometryWorkspace * fMyWorkspace
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindOrCreateWorkspace()

G4GeometryWorkspace * G4GeometryWorkspacePool::FindOrCreateWorkspace ( )

Definition at line 99 of file G4GeometryWorkspacePool.cc.

100 {
101  G4GeometryWorkspace* geometryWrk= fMyWorkspace;
102  if( !geometryWrk )
103  {
104  geometryWrk= this->CreateWorkspace();
105  }
106  geometryWrk->UseWorkspace();
107 
108  fMyWorkspace= geometryWrk; // assign it for use by this thread.
109  return geometryWrk;
110 }
static G4ThreadLocal G4GeometryWorkspace * fMyWorkspace
G4GeometryWorkspace * CreateWorkspace()
Here is the call graph for this function:

◆ GetInstance()

G4GeometryWorkspacePool * G4GeometryWorkspacePool::GetInstance ( void  )
static

Definition at line 50 of file G4GeometryWorkspacePool.cc.

51 {
52  G4AutoLock l(&singletonM);
53  if ( !thePool ) { thePool= new G4GeometryWorkspacePool(); }
54  return thePool;
55 }
static G4GeometryWorkspacePool * thePool
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetWorkspace()

G4GeometryWorkspace* G4GeometryWorkspacePool::GetWorkspace ( )
inline

Definition at line 68 of file G4GeometryWorkspacePool.hh.

68 { return fMyWorkspace; }
static G4ThreadLocal G4GeometryWorkspace * fMyWorkspace
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Recycle()

void G4GeometryWorkspacePool::Recycle ( G4GeometryWorkspace geometryWrk)

Definition at line 114 of file G4GeometryWorkspacePool.cc.

115 {
116  geometryWrk->ReleaseWorkspace();
117  // if( fWarehouse ){
118  // } else {
119  delete geometryWrk;
120  // }
121 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReleaseAndDestroyWorkspace()

void G4GeometryWorkspacePool::ReleaseAndDestroyWorkspace ( G4GeometryWorkspace )
protected
Here is the caller graph for this function:

Member Data Documentation

◆ fMyWorkspace

G4ThreadLocal G4GeometryWorkspace * G4GeometryWorkspacePool::fMyWorkspace =0
staticprivate

Definition at line 101 of file G4GeometryWorkspacePool.hh.

◆ thePool

G4GeometryWorkspacePool * G4GeometryWorkspacePool::thePool =0
staticprivate

Definition at line 92 of file G4GeometryWorkspacePool.hh.


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