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
G4SolidsWorkspacePool Class Reference

#include <G4SolidsWorkspacePool.hh>

Public Member Functions

G4SolidsWorkspaceCreateWorkspace ()
 
void CreateAndUseWorkspace ()
 
G4SolidsWorkspaceFindOrCreateWorkspace ()
 
G4SolidsWorkspaceGetWorkspace ()
 
void Recycle (G4SolidsWorkspace *)
 
void CleanUpAndDestroyAllWorkspaces ()
 

Static Public Member Functions

static G4SolidsWorkspacePoolGetInstance ()
 

Protected Member Functions

void ReleaseAndDestroyWorkspace (G4SolidsWorkspace *)
 

Detailed Description

Definition at line 38 of file G4SolidsWorkspacePool.hh.

Member Function Documentation

void G4SolidsWorkspacePool::CleanUpAndDestroyAllWorkspaces ( )

Definition at line 118 of file G4SolidsWorkspacePool.cc.

119 {
120 }
void G4SolidsWorkspacePool::CreateAndUseWorkspace ( )

Definition at line 74 of file G4SolidsWorkspacePool.cc.

References CreateWorkspace().

Referenced by G4WorkerThread::BuildGeometryAndPhysicsVector().

75 {
76  (this->CreateWorkspace())->UseWorkspace();
77 }
G4SolidsWorkspace * CreateWorkspace()
G4SolidsWorkspace * G4SolidsWorkspacePool::CreateWorkspace ( )

Definition at line 50 of file G4SolidsWorkspacePool.cc.

References FatalException, and G4Exception().

Referenced by CreateAndUseWorkspace(), and FindOrCreateWorkspace().

51 {
52  G4SolidsWorkspace* geometryWrk=0;
53  if( !fMyWorkspace ){
54  geometryWrk= new G4SolidsWorkspace();
55 
56  if( !geometryWrk ) {
57  G4Exception("GeometryWorspacePool::CreateWorkspace", "Geom-003",
58  FatalException, "Failed to create workspace.");
59  }else{
60  // geometryWrk->UseWorkspace(); // Do not assign it already.
61  fMyWorkspace= geometryWrk;
62  }
63  }else{
64  G4Exception("GeometryWorspacePool::CreateWorkspace", "Geom-003",
66  "Cannot create workspace twice for the same thread.");
67  geometryWrk= fMyWorkspace;
68  }
69 
70  return geometryWrk;
71 }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4SolidsWorkspace * G4SolidsWorkspacePool::FindOrCreateWorkspace ( )

Definition at line 81 of file G4SolidsWorkspacePool.cc.

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

82 {
83  G4SolidsWorkspace* geometryWrk= fMyWorkspace;
84  if( !geometryWrk ){
85  geometryWrk= this->CreateWorkspace();
86  }
87  geometryWrk->UseWorkspace();
88 
89  fMyWorkspace= geometryWrk; // assign it for use by this thread.
90  return geometryWrk;
91 }
G4SolidsWorkspace * CreateWorkspace()
G4SolidsWorkspacePool * G4SolidsWorkspacePool::GetInstance ( void  )
static
G4SolidsWorkspace* G4SolidsWorkspacePool::GetWorkspace ( )
inline
void G4SolidsWorkspacePool::Recycle ( G4SolidsWorkspace geometryWrk)

Definition at line 107 of file G4SolidsWorkspacePool.cc.

References G4SolidsWorkspace::ReleaseWorkspace().

108 {
109  geometryWrk->ReleaseWorkspace();
110 // if( fWarehouse ){
111 // } else {
112  delete geometryWrk;
113 // }
114 }
void G4SolidsWorkspacePool::ReleaseAndDestroyWorkspace ( G4SolidsWorkspace )
protected

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