Import Geant4 10.5.0.beta source tree
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
$Id: History 107603 2017-11-27 07:21:59Z gcosmo $
|
||||
$Id: History 110263 2018-05-17 14:28:14Z gcosmo $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -17,6 +17,11 @@ committal in the CVS repository !
|
||||
----------------------------------------------------------
|
||||
* Reverse chronological order (last date on top), please *
|
||||
|
||||
- May 17, 2018 J.Madsen (track-V10-04-00)
|
||||
- updated "thread-local-static-var" model to
|
||||
"function-returning-thread-local-static-reference" model
|
||||
which fixes Windows DLL + MT
|
||||
|
||||
- November 25, 2017 V.Ivanchenko (track-V10-03-00)
|
||||
- G4VelocityTable - use G4ThreadLocalSingletone patern in order
|
||||
to provide correct deletion of these objects end of run;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Track.hh 94983 2016-01-13 11:02:33Z gcosmo $
|
||||
// $Id: G4Track.hh 110263 2018-05-17 14:28:14Z gcosmo $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
@@ -321,7 +321,7 @@ public: // With description
|
||||
mutable G4double prev_momentum;
|
||||
|
||||
G4bool is_OpticalPhoton;
|
||||
static G4ThreadLocal G4VelocityTable* velTable;
|
||||
static G4VelocityTable*& velTable();
|
||||
|
||||
G4bool useGivenVelocity;
|
||||
// do not calclulate velocity and just use current fVelocity
|
||||
|
||||
@@ -24,14 +24,14 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Track.icc 94983 2016-01-13 11:02:33Z gcosmo $
|
||||
// $Id: G4Track.icc 110263 2018-05-17 14:28:14Z gcosmo $
|
||||
//
|
||||
//-----------------------------------------------------------------
|
||||
// Definitions of inline functions
|
||||
//-----------------------------------------------------------------
|
||||
// change GetMaterial 16 Feb. 2000 H.Kurashige
|
||||
|
||||
extern G4TRACK_DLL G4ThreadLocal G4Allocator<G4Track> *aTrackAllocator;
|
||||
extern G4TRACK_DLL G4Allocator<G4Track>*& aTrackAllocator();
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// To implement bi-directional association between G4Step and
|
||||
@@ -44,13 +44,13 @@ extern G4TRACK_DLL G4ThreadLocal G4Allocator<G4Track> *aTrackAllocator;
|
||||
|
||||
inline void* G4Track::operator new(size_t)
|
||||
{
|
||||
if (!aTrackAllocator) aTrackAllocator = new G4Allocator<G4Track>;
|
||||
return (void *) aTrackAllocator->MallocSingle();
|
||||
if (!aTrackAllocator()) aTrackAllocator() = new G4Allocator<G4Track>;
|
||||
return (void *) aTrackAllocator()->MallocSingle();
|
||||
}
|
||||
// Override "new" for "G4Allocator".
|
||||
|
||||
inline void G4Track::operator delete(void *aTrack)
|
||||
{ aTrackAllocator->FreeSingle((G4Track *) aTrack); }
|
||||
{ aTrackAllocator()->FreeSingle((G4Track *) aTrack); }
|
||||
// Override "delete" for "G4Allocator".
|
||||
|
||||
inline G4bool G4Track::operator==( const G4Track& trk)
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Track.cc 91231 2015-06-26 10:40:45Z gcosmo $
|
||||
// $Id: G4Track.cc 110263 2018-05-17 14:28:14Z gcosmo $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
@@ -49,9 +49,17 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
G4ThreadLocal G4Allocator<G4Track> *aTrackAllocator = 0;
|
||||
G4Allocator<G4Track>*& aTrackAllocator()
|
||||
{
|
||||
G4ThreadLocalStatic G4Allocator<G4Track>* _instance = nullptr;
|
||||
return _instance;
|
||||
}
|
||||
|
||||
G4ThreadLocal G4VelocityTable* G4Track::velTable=0;
|
||||
G4VelocityTable*& G4Track::velTable()
|
||||
{
|
||||
G4ThreadLocalStatic G4VelocityTable* _instance = nullptr;
|
||||
return _instance;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
G4Track::G4Track(G4DynamicParticle* apValueDynamicParticle,
|
||||
@@ -88,7 +96,7 @@ G4Track::G4Track(G4DynamicParticle* apValueDynamicParticle,
|
||||
// check if the particle type is Optical Photon
|
||||
is_OpticalPhoton = (fpDynamicParticle->GetDefinition() == fOpticalPhoton);
|
||||
|
||||
if (velTable ==0 ) velTable = G4VelocityTable::GetVelocityTable();
|
||||
if (velTable() ==0 ) velTable() = G4VelocityTable::GetVelocityTable();
|
||||
|
||||
fVelocity = CalculateVelocity();
|
||||
|
||||
@@ -244,7 +252,7 @@ G4double G4Track::CalculateVelocity() const
|
||||
} else if (T<GetMinTOfVelocityTable()) {
|
||||
velocity = c_light*std::sqrt(T*(T+2.))/(T+1.0);
|
||||
} else {
|
||||
velocity = velTable->Value(T);
|
||||
velocity = velTable()->Value(T);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -302,7 +310,7 @@ void G4Track::SetVelocityTableProperties(G4double t_max, G4double t_min, G4int n
|
||||
///////////////////
|
||||
{
|
||||
G4VelocityTable::SetVelocityTableProperties(t_max, t_min, nbin);
|
||||
velTable = G4VelocityTable::GetVelocityTable();
|
||||
velTable() = G4VelocityTable::GetVelocityTable();
|
||||
}
|
||||
|
||||
///////////////////
|
||||
|
||||
Reference in New Issue
Block a user