Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions
G4GeometryWorkspacePool Class Reference

#include <G4GeometryWorkspacePool.hh>

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 *)
 

Detailed Description

Definition at line 38 of file G4GeometryWorkspacePool.hh.

Member Function Documentation

void G4GeometryWorkspacePool::CleanUpAndDestroyAllWorkspaces ( )

Definition at line 113 of file G4GeometryWorkspacePool.cc.

114 {
115 }
void G4GeometryWorkspacePool::CreateAndUseWorkspace ( )

Definition at line 71 of file G4GeometryWorkspacePool.cc.

References CreateWorkspace().

Referenced by G4WorkerThread::BuildGeometryAndPhysicsVector().

72 {
73  (this->CreateWorkspace())->UseWorkspace();
74 }
G4GeometryWorkspace * CreateWorkspace()
G4GeometryWorkspace * G4GeometryWorkspacePool::CreateWorkspace ( )

Definition at line 48 of file G4GeometryWorkspacePool.cc.

References FatalException, and G4Exception().

Referenced by CreateAndUseWorkspace(), and FindOrCreateWorkspace().

49 {
50  G4GeometryWorkspace* geometryWrk=0;
51  if( !fMyWorkspace ){
52  geometryWrk= new G4GeometryWorkspace();
53 
54  if( !geometryWrk ) {
55  G4Exception("GeometryWorspacePool::CreateWorkspace", "Geom-003",
56  FatalException, "Failed to create workspace.");
57  }else{
58  fMyWorkspace= geometryWrk;
59  }
60  }else{
61  G4Exception("GeometryWorspacePool::CreateWorkspace", "Geom-003",
63  "Cannot create workspace twice for the same thread.");
64  geometryWrk= fMyWorkspace;
65  }
66 
67  return geometryWrk;
68 }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4GeometryWorkspace * G4GeometryWorkspacePool::FindOrCreateWorkspace ( )

Definition at line 78 of file G4GeometryWorkspacePool.cc.

References CreateWorkspace(), and G4GeometryWorkspace::UseWorkspace().

79 {
80  G4GeometryWorkspace* geometryWrk= fMyWorkspace;
81  if( !geometryWrk ){
82  geometryWrk= this->CreateWorkspace();
83  }
84  geometryWrk->UseWorkspace();
85 
86  fMyWorkspace= geometryWrk; // assign it for use by this thread.
87  return geometryWrk;
88 }
G4GeometryWorkspace * CreateWorkspace()
G4GeometryWorkspacePool * G4GeometryWorkspacePool::GetInstance ( void  )
static
G4GeometryWorkspace* G4GeometryWorkspacePool::GetWorkspace ( )
inline
void G4GeometryWorkspacePool::Recycle ( G4GeometryWorkspace geometryWrk)

Definition at line 104 of file G4GeometryWorkspacePool.cc.

References G4GeometryWorkspace::ReleaseWorkspace().

105 {
106  geometryWrk->ReleaseWorkspace();
107  //if( fWarehouse ){
108  //} else {
109  delete geometryWrk;
110  //}
111 }
void G4GeometryWorkspacePool::ReleaseAndDestroyWorkspace ( G4GeometryWorkspace )
protected

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