Import Geant4 10.4.0.beta source tree
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Ions.hh 98732 2016-08-09 10:50:57Z gcosmo $
|
||||
// $Id: G4Ions.hh 103892 2017-05-03 08:11:00Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
@@ -244,7 +244,7 @@ inline
|
||||
{
|
||||
static G4Ions::G4FloatLevelBase flb[] =
|
||||
{ noFloat,
|
||||
plusU, plusV, plusW, plusX, plusY, plusZ,
|
||||
plusX, plusY, plusZ, plusU, plusV, plusW,
|
||||
plusR, plusS, plusT, plusA, plusB, plusC, plusD, plusE };
|
||||
return flb[flbIdx];
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PDefManager.hh 101112 2016-11-07 08:19:33Z gcosmo $
|
||||
// $Id: G4PDefManager.hh 103108 2017-03-16 13:00:35Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
@@ -103,7 +103,6 @@ class G4PDefManager
|
||||
void FreeSlave();
|
||||
// Invoked by all threads to free the subinstance array.
|
||||
|
||||
|
||||
G4PDefData* GetOffset();
|
||||
|
||||
void UseWorkArea( G4PDefData* newOffset ); // , G4int numObjects, G4int numSpace)
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ParticleDefinition.hh 101025 2016-11-04 08:36:30Z gcosmo $
|
||||
// $Id: G4ParticleDefinition.hh 103108 2017-03-16 13:00:35Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
@@ -208,19 +208,23 @@ class G4ParticleDefinition
|
||||
inline G4ProcessManager* GetMasterProcessManager() const;
|
||||
// Returns the process manager master pointer.
|
||||
inline void SetMasterProcessManager(G4ProcessManager* aNewPM);
|
||||
//Sets the shadow master pointer (not to be used by user)
|
||||
// Sets the shadow master pointer (not to be used by user)
|
||||
|
||||
inline G4int GetInstanceID() const;
|
||||
// Returns the instance ID.
|
||||
|
||||
static const G4PDefManager& GetSubInstanceManager();
|
||||
// Returns the private data instance manager.
|
||||
|
||||
static void Clean();
|
||||
// Clear memory allocated by sub-instance manager.
|
||||
|
||||
private:
|
||||
// --- Shadow of master pointers.
|
||||
|
||||
G4ProcessManager *theProcessManagerShadow;
|
||||
// Each worker thread can access this field from the master thread
|
||||
// through this pointer.
|
||||
// Each worker thread can access this field from the master thread
|
||||
// through this pointer.
|
||||
|
||||
G4int g4particleDefinitionInstanceID;
|
||||
// This field is used as instance ID.
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4IonTable.cc 99621 2016-09-29 10:14:44Z gcosmo $
|
||||
// $Id: G4IonTable.cc 102916 2017-03-02 12:58:58Z gcosmo $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
@@ -1870,9 +1870,10 @@ G4double G4IonTable::GetLifeTime(G4int Z, G4int A, G4double E,
|
||||
////////////////////
|
||||
G4ParticleDefinition* G4IonTable::GetMuonicAtom(G4Ions const* base)
|
||||
{
|
||||
if (base==0 || !IsIon(base))
|
||||
if (base==0 || !IsIon(base)){
|
||||
G4Exception("G4IonTable::GetMuonicAtom()", "PART987654321",FatalException,"Constructor argument is not a G4Ions");
|
||||
|
||||
return 0;
|
||||
}
|
||||
// We're assuming here that we get a base that is actually
|
||||
// constructed and unexcited ... strip excitations, Lambdas, and
|
||||
// isomers from the encoding
|
||||
|
||||
@@ -24,12 +24,12 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PDefManager.cc 101112 2016-11-07 08:19:33Z gcosmo $
|
||||
// $Id: G4PDefManager.cc 103108 2017-03-16 13:00:35Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
//
|
||||
// GEANT 4 class header file
|
||||
// GEANT4 class header file
|
||||
//
|
||||
// ---------------- G4PDefManager ----------------
|
||||
//
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
void G4PDefData::initialize()
|
||||
{
|
||||
theProcessManager = 0;
|
||||
theProcessManager = 0;
|
||||
}
|
||||
|
||||
G4ThreadLocal G4int G4PDefManager::slavetotalspace=0;
|
||||
@@ -58,84 +58,78 @@ G4ThreadLocal G4PDefData* G4PDefManager::offset=0;
|
||||
|
||||
G4PDefManager::G4PDefManager() : totalobj(0)
|
||||
{
|
||||
G4MUTEXINIT(mutex);
|
||||
G4MUTEXINIT(mutex);
|
||||
}
|
||||
|
||||
G4int G4PDefManager::CreateSubInstance()
|
||||
// Invoked by the master or work thread to create a new subinstance
|
||||
// whenever a new split class instance is created. For each worker
|
||||
// thread, ions are created dynamically.
|
||||
// Invoked by the master or work thread to create a new subinstance
|
||||
// whenever a new split class instance is created. For each worker
|
||||
// thread, ions are created dynamically.
|
||||
{
|
||||
G4AutoLock l(&mutex);
|
||||
totalobj++;
|
||||
if (totalobj > slavetotalspace)
|
||||
{
|
||||
l.unlock();
|
||||
NewSubInstances();
|
||||
l.lock();
|
||||
}
|
||||
return (totalobj - 1);
|
||||
G4AutoLock l(&mutex);
|
||||
totalobj++;
|
||||
if (totalobj > slavetotalspace)
|
||||
{
|
||||
l.unlock();
|
||||
NewSubInstances();
|
||||
l.lock();
|
||||
}
|
||||
return (totalobj - 1);
|
||||
}
|
||||
|
||||
void G4PDefManager::NewSubInstances()
|
||||
// Invoked by each worker thread to grow the subinstance array and
|
||||
// initialize each new subinstance using a particular method defined
|
||||
// by the subclass.
|
||||
// Invoked by each worker thread to grow the subinstance array and
|
||||
// initialize each new subinstance using a particular method defined
|
||||
// by the subclass.
|
||||
{
|
||||
G4AutoLock l(&mutex);
|
||||
if (slavetotalspace >= totalobj) { return; }
|
||||
G4int originaltotalspace = slavetotalspace;
|
||||
slavetotalspace = totalobj + 512;
|
||||
offset = (G4PDefData *) realloc(offset, slavetotalspace * sizeof(G4PDefData));
|
||||
G4AutoLock l(&mutex);
|
||||
if (slavetotalspace >= totalobj) { return; }
|
||||
G4int originaltotalspace = slavetotalspace;
|
||||
slavetotalspace = totalobj + 512;
|
||||
offset = (G4PDefData *) realloc(offset, slavetotalspace * sizeof(G4PDefData));
|
||||
|
||||
if (offset == 0)
|
||||
{
|
||||
G4Exception("G4PDefManager::NewSubInstances()",
|
||||
"OutOfMemory", FatalException, "Cannot malloc space!");
|
||||
}
|
||||
if (offset == 0)
|
||||
{
|
||||
G4Exception("G4PDefManager::NewSubInstances()",
|
||||
"OutOfMemory", FatalException, "Cannot malloc space!");
|
||||
}
|
||||
|
||||
for (G4int i = originaltotalspace; i < slavetotalspace; i++)
|
||||
{
|
||||
offset[i].initialize();
|
||||
}
|
||||
for (G4int i = originaltotalspace; i < slavetotalspace; i++)
|
||||
{
|
||||
offset[i].initialize();
|
||||
}
|
||||
}
|
||||
|
||||
void G4PDefManager::FreeSlave()
|
||||
// Invoked by all threads to free the subinstance array.
|
||||
// Invoked by all threads to free the subinstance array.
|
||||
{
|
||||
if (!offset) { return; }
|
||||
free(offset);
|
||||
offset = 0;
|
||||
if (!offset) { return; }
|
||||
free(offset);
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
|
||||
G4PDefData* G4PDefManager::GetOffset()
|
||||
G4PDefData* G4PDefManager::GetOffset()
|
||||
{
|
||||
return offset;
|
||||
return offset;
|
||||
}
|
||||
|
||||
void G4PDefManager::UseWorkArea( G4PDefData* newOffset ) // , G4int numObjects, G4int numSpace)
|
||||
void G4PDefManager::UseWorkArea( G4PDefData* newOffset )
|
||||
// Use recycled work area, which was created previously.
|
||||
{
|
||||
// Use recycled work area - which was created previously
|
||||
if( offset && offset!=newOffset )
|
||||
{
|
||||
G4Exception("G4PDefManager::UseWorkspace()",
|
||||
"TwoWorkspaces", FatalException,
|
||||
"Thread already has workspace - cannot use another.");
|
||||
}
|
||||
offset= newOffset;
|
||||
// totalobj= numObjects;
|
||||
// totalspace= numSpace;
|
||||
if( offset && offset!=newOffset )
|
||||
{
|
||||
G4Exception("G4PDefManager::UseWorkspace()",
|
||||
"InvalidCondition", FatalException,
|
||||
"Thread already has workspace - cannot use another.");
|
||||
}
|
||||
offset= newOffset;
|
||||
}
|
||||
|
||||
G4PDefData* G4PDefManager::FreeWorkArea() // G4int* numObjects, G4int* numSpace)
|
||||
G4PDefData* G4PDefManager::FreeWorkArea()
|
||||
// Detach this thread from this Location
|
||||
// The object which calls this method is responsible for it.
|
||||
{
|
||||
// Detach this thread from this Location
|
||||
// The object which calls this method is responsible for it.
|
||||
//
|
||||
G4PDefData* offsetRet= offset;
|
||||
|
||||
offset= 0;
|
||||
|
||||
return offsetRet;
|
||||
G4PDefData* offsetRet= offset;
|
||||
offset= 0;
|
||||
return offsetRet;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ParticleDefinition.cc 100425 2016-10-21 12:57:06Z gcosmo $
|
||||
// $Id: G4ParticleDefinition.cc 103108 2017-03-16 13:00:35Z gcosmo $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
@@ -70,13 +70,6 @@ G4PDefManager G4ParticleDefinition::subInstanceManager;
|
||||
//
|
||||
#define G4MT_pmanager ((subInstanceManager.offset[g4particleDefinitionInstanceID]).theProcessManager)
|
||||
|
||||
// Returns the private data instance manager.
|
||||
//
|
||||
const G4PDefManager& G4ParticleDefinition::GetSubInstanceManager()
|
||||
{
|
||||
return subInstanceManager;
|
||||
}
|
||||
|
||||
G4ParticleDefinition::G4ParticleDefinition(
|
||||
const G4String& aName,
|
||||
G4double mass,
|
||||
@@ -244,6 +237,21 @@ G4int G4ParticleDefinition::operator!=(const G4ParticleDefinition &right) const
|
||||
return (this->theParticleName != right.theParticleName);
|
||||
}
|
||||
|
||||
|
||||
const G4PDefManager& G4ParticleDefinition::GetSubInstanceManager()
|
||||
// Returns the private data instance manager.
|
||||
{
|
||||
return subInstanceManager;
|
||||
}
|
||||
|
||||
|
||||
void G4ParticleDefinition::Clean()
|
||||
// Clears memory allocated by sub-instance manager
|
||||
{
|
||||
subInstanceManager.FreeSlave();
|
||||
}
|
||||
|
||||
|
||||
G4ProcessManager* G4ParticleDefinition::GetProcessManager() const
|
||||
{
|
||||
if(g4particleDefinitionInstanceID<0) return 0;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ParticleTable.cc 94421 2015-11-16 08:22:56Z gcosmo $
|
||||
// $Id: G4ParticleTable.cc 103108 2017-03-16 13:00:35Z gcosmo $
|
||||
//
|
||||
// class G4ParticleTable
|
||||
//
|
||||
@@ -227,6 +227,7 @@ G4ParticleTable::~G4ParticleTable()
|
||||
|
||||
fgParticleTable =0;
|
||||
|
||||
G4ParticleDefinition::Clean(); // Delete sub-instance static data
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PhaseSpaceDecayChannel.cc 98352 2016-07-08 08:21:00Z gcosmo $
|
||||
// $Id: G4PhaseSpaceDecayChannel.cc 102916 2017-03-02 12:58:58Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
@@ -635,6 +635,7 @@ G4DecayProducts *G4PhaseSpaceDecayChannel::ManyBodyDecayIt()
|
||||
delete [] sm;
|
||||
delete [] daughtermass;
|
||||
delete [] daughtermomentum;
|
||||
delete products;
|
||||
return 0; // Error detection
|
||||
}
|
||||
if ( weight < G4UniformRand()) break;
|
||||
|
||||
Reference in New Issue
Block a user