Import Geant4 10.7.0.beta source tree
This commit is contained in:
@@ -23,24 +23,39 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4PDefManager
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// Utility template class for splitting read/write data for
|
||||
// thread-safety from classes: G4ParticleDefinition, G4VDecayChannel.
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
//
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// ---------------- G4PDefManager ----------------
|
||||
//
|
||||
// Utility template class for splitting RW data for thread-safety from
|
||||
// classes: G4ParticleDefinition, G4VDecayChannel.
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// History:
|
||||
// 01.25.2009 Xin Dong: First implementation from automatic MT conversion.
|
||||
// ------------------------------------------------------------
|
||||
#ifndef G4PDefManager_HH
|
||||
#define G4PDefManager_HH
|
||||
// The type G4PDefManager is introduced to encapsulate the methods used by
|
||||
// both the master thread and worker threads to allocate memory space for
|
||||
// the fields encapsulated by the class G4PDefData. When each thread
|
||||
// changes the value for these fields, it refers to them using a macro
|
||||
// definition defined below. For every G4ParticleDefinition instance,
|
||||
// there is a corresponding G4PDefData instance. All G4PDefData instances
|
||||
// are organized by the class G4PDefManager as an array.
|
||||
// The field "int g4particleDefinitionInstanceID" is added to the class
|
||||
// G4ParticleDefinition.
|
||||
// The value of this field in each G4ParticleDefinition instance is the
|
||||
// subscript of the corresponding G4PDefData instance.
|
||||
// In order to use the class G4PDefManager, we add a static member in the
|
||||
// class G4ParticleDefinition as follows:
|
||||
// "static G4PDefManager subInstanceManager".
|
||||
// Both the master thread and worker threads change the length of the array
|
||||
// for G4PDefData instances mutually along with G4ParticleDefinition
|
||||
// instances are created. For each worker thread, it dynamically creates ions.
|
||||
// Consider any thread A, if there is any other thread which creates an ion.
|
||||
// This ion is shared by the thread A. So the thread A leaves an empty space
|
||||
// in the array of G4PDefData instances for the ion.
|
||||
|
||||
// Author: Xin Dong, 25.01.2009 - First implementation
|
||||
// from automatic MT conversion
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef G4PDefManager_hh
|
||||
#define G4PDefManager_hh
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -50,9 +65,9 @@
|
||||
|
||||
class G4ProcessManager;
|
||||
|
||||
// G4PDefData is the private data from the object to be split
|
||||
class G4PDefData
|
||||
{
|
||||
// G4PDefData is the private data from the object to be split.
|
||||
// Encapsulates the fields of the class G4ParticleDefinition
|
||||
// that may not be read-only.
|
||||
|
||||
@@ -60,29 +75,9 @@ class G4PDefData
|
||||
|
||||
void initialize();
|
||||
|
||||
G4ProcessManager *theProcessManager;
|
||||
G4ProcessManager* theProcessManager = nullptr;
|
||||
};
|
||||
|
||||
// The type G4PDefManager is introduced to encapsulate the methods used by
|
||||
// both the master thread and worker threads to allocate memory space for
|
||||
// the fields encapsulated by the class G4PDefData. When each thread
|
||||
// changes the value for these fields, it refers to them using a macro
|
||||
// definition defined below. For every G4ParticleDefinition instance,
|
||||
// there is a corresponding G4PDefData instance. All G4PDefData instances
|
||||
// are organized by the class G4PDefManager as an array.
|
||||
// The field "int g4particleDefinitionInstanceID" is added to the class G4ParticleDefinition.
|
||||
// The value of this field in each G4ParticleDefinition instance is the
|
||||
// subscript of the corresponding G4PDefData instance.
|
||||
// In order to use the class G4PDefManager, we add a static member in the class
|
||||
// G4ParticleDefinition as follows: "static G4PDefManager subInstanceManager".
|
||||
// Both the master thread and worker threads change the length of the array
|
||||
// for G4PDefData instances mutually along with G4ParticleDefinition
|
||||
// instances are created. For each worker thread, it dynamically creates ions.
|
||||
// Consider any thread A, if there is any other thread which creates an ion.
|
||||
// This ion is shared by the thread A. So the thread A leaves an empty space
|
||||
// in the array of G4PDefData instances for the ion.
|
||||
//
|
||||
|
||||
class G4PDefManager
|
||||
{
|
||||
public:
|
||||
@@ -102,13 +97,11 @@ class G4PDefManager
|
||||
void FreeSlave();
|
||||
// Invoked by all threads to free the subinstance array.
|
||||
|
||||
G4PDefData* GetOffset();
|
||||
G4PDefData* GetOffset();
|
||||
|
||||
void UseWorkArea( G4PDefData* newOffset ); // , G4int numObjects, G4int numSpace)
|
||||
void UseWorkArea( G4PDefData* newOffset );
|
||||
|
||||
G4PDefData* FreeWorkArea(); // G4int* numObjects, G4int* numSpace)
|
||||
|
||||
public:
|
||||
G4PDefData* FreeWorkArea();
|
||||
|
||||
G4PART_DLL static G4int& slavetotalspace(); // thread-local
|
||||
G4PART_DLL static G4PDefData*& offset(); // thread-local
|
||||
|
||||
Reference in New Issue
Block a user