Import Geant4 10.5.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2018-06-29 10:58:11 +02:00
parent fe81a77428
commit 6aa23be517
1581 changed files with 124288 additions and 83758 deletions
+14 -1
View File
@@ -1,4 +1,4 @@
$Id: History 106171 2017-09-15 13:02:56Z gcosmo $
$Id: History 110402 2018-05-22 11:35:41Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,19 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
May 22nd, 2018 J.Allison - geomvol-V10-04-02
- G4PVPlacement::CheckOverlaps: Add copy number to G4Exception printing.
May 17th, 2018 J.Madsen - geomvol-V10-04-01
- updated "thread-local-static-var" model to
"function-returning-thread-local-static-reference" model
which fixes Windows DLL + MT
May 9th, 2018 E.Tcherniaev - geomvol-V10-04-00
- Replaced use of Inverse() from G4AffineTransform with new dedicated
methods, to avoid creation of temporaries in G4TouchableHistory,
G4PVPlacement and G4PVParameterised.
September 15th, 2017 G.Cosmo - geomvol-V10-03-02
- G4GeometryWorkspacePool: use DLL export flag for static thread-local
symbol of the workspace.
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4GeometryWorkspacePool.hh 106171 2017-09-15 13:02:56Z gcosmo $
// $Id: G4GeometryWorkspacePool.hh 110271 2018-05-17 14:41:15Z gcosmo $
//
//
// ------------------------------------------------------------
@@ -66,7 +66,7 @@ class G4GeometryWorkspacePool
// Reuse an existing workspace or create a new one if needed.
// This will never fail, except if system is out of resources
inline G4GeometryWorkspace* GetWorkspace() { return fMyWorkspace; }
inline G4GeometryWorkspace* GetWorkspace() { return fMyWorkspace(); }
// Give back the existing, active workspace for my thread / task
void Recycle( G4GeometryWorkspace * );
@@ -96,7 +96,7 @@ class G4GeometryWorkspacePool
// for tbb.
// Further development: template parameter with portable default
G4GEOM_DLL static G4ThreadLocal G4GeometryWorkspace* fMyWorkspace;
G4GEOM_DLL static G4GeometryWorkspace*& fMyWorkspace();
// The thread's workspace - if assigned.
};
@@ -24,15 +24,14 @@
// ********************************************************************
//
//
// $Id: G4NavigationHistory.icc 86527 2014-11-13 15:06:24Z gcosmo $
// $Id: G4NavigationHistory.icc 110271 2018-05-17 14:41:15Z gcosmo $
//
//
// class G4NavigationHistory Inline implementation
//
// ----------------------------------------------------------------------
extern G4GEOM_DLL G4ThreadLocal
G4Allocator<G4NavigationHistory> *aNavigHistoryAllocator;
extern G4GEOM_DLL G4Allocator<G4NavigationHistory>*& aNavigHistoryAllocator();
// There is no provision that this class is subclassed.
// If it is subclassed & new data members are added then the
@@ -41,17 +40,17 @@ G4Allocator<G4NavigationHistory> *aNavigHistoryAllocator;
inline
void* G4NavigationHistory::operator new(size_t)
{
if (!aNavigHistoryAllocator)
if (!aNavigHistoryAllocator())
{
aNavigHistoryAllocator = new G4Allocator<G4NavigationHistory>;
aNavigHistoryAllocator() = new G4Allocator<G4NavigationHistory>;
}
return (void *) aNavigHistoryAllocator->MallocSingle();
return (void *) aNavigHistoryAllocator()->MallocSingle();
}
inline
void G4NavigationHistory::operator delete(void *aHistory)
{
aNavigHistoryAllocator->FreeSingle((G4NavigationHistory *) aHistory);
aNavigHistoryAllocator()->FreeSingle((G4NavigationHistory *) aHistory);
}
inline
@@ -24,14 +24,13 @@
// ********************************************************************
//
//
// $Id: G4NavigationLevel.icc 86527 2014-11-13 15:06:24Z gcosmo $
// $Id: G4NavigationLevel.icc 110271 2018-05-17 14:41:15Z gcosmo $
//
// 30.09.97 J.Apostolakis Initial version.
//
// ----------------------------------------------------------------------
extern G4GEOM_DLL G4ThreadLocal
G4Allocator<G4NavigationLevel> *aNavigationLevelAllocator;
extern G4GEOM_DLL G4Allocator<G4NavigationLevel>*& aNavigationLevelAllocator();
inline
G4VPhysicalVolume* G4NavigationLevel::GetPhysicalVolume() const
@@ -69,11 +68,11 @@ G4int G4NavigationLevel::GetReplicaNo() const
inline
void* G4NavigationLevel::operator new(size_t)
{
if (!aNavigationLevelAllocator)
if (!aNavigationLevelAllocator())
{
aNavigationLevelAllocator = new G4Allocator<G4NavigationLevel>;
aNavigationLevelAllocator() = new G4Allocator<G4NavigationLevel>;
}
return (void *) aNavigationLevelAllocator->MallocSingle();
return (void *) aNavigationLevelAllocator()->MallocSingle();
}
// Added for use by STL (used for pre-allocation).
@@ -87,7 +86,7 @@ void* G4NavigationLevel::operator new(size_t,void *a)
inline
void G4NavigationLevel::operator delete(void *aLevel)
{
aNavigationLevelAllocator->FreeSingle((G4NavigationLevel *) aLevel);
aNavigationLevelAllocator()->FreeSingle((G4NavigationLevel *) aLevel);
}
// Added for use by STL (used for free-ing pre-allocated?).
@@ -24,14 +24,13 @@
// ********************************************************************
//
//
// $Id: G4NavigationLevelRep.icc 87590 2014-12-11 14:30:29Z gcosmo $
// $Id: G4NavigationLevelRep.icc 110271 2018-05-17 14:41:15Z gcosmo $
//
// 1 October 1997 J.Apostolakis Initial version.
//
// ----------------------------------------------------------------------
extern G4GEOM_DLL G4ThreadLocal
G4Allocator<G4NavigationLevelRep> *aNavigLevelRepAllocator;
extern G4GEOM_DLL G4Allocator<G4NavigationLevelRep>*& aNavigLevelRepAllocator();
// Constructors
//--------------
@@ -172,15 +171,15 @@ G4bool G4NavigationLevelRep::RemoveAReference()
inline
void* G4NavigationLevelRep::operator new(size_t)
{
if (!aNavigLevelRepAllocator)
if (!aNavigLevelRepAllocator())
{
aNavigLevelRepAllocator = new G4Allocator<G4NavigationLevelRep>;
aNavigLevelRepAllocator() = new G4Allocator<G4NavigationLevelRep>;
}
return (void *) aNavigLevelRepAllocator->MallocSingle();
return (void *) aNavigLevelRepAllocator()->MallocSingle();
}
inline
void G4NavigationLevelRep::operator delete(void *aLevelRep)
{
aNavigLevelRepAllocator->FreeSingle((G4NavigationLevelRep *) aLevelRep);
aNavigLevelRepAllocator()->FreeSingle((G4NavigationLevelRep *) aLevelRep);
}
@@ -24,20 +24,20 @@
// ********************************************************************
//
//
// $Id: G4TouchableHistory.icc 86527 2014-11-13 15:06:24Z gcosmo $
// $Id: G4TouchableHistory.icc 110271 2018-05-17 14:41:15Z gcosmo $
//
//
// class G4TouchableHistory inline implementation
// ----------------------------------------------------------------------
extern G4GEOM_DLL G4ThreadLocal G4Allocator<G4TouchableHistory> *aTouchableHistoryAllocator;
extern G4GEOM_DLL G4Allocator<G4TouchableHistory>*& aTouchableHistoryAllocator();
inline
void G4TouchableHistory::UpdateYourself( G4VPhysicalVolume* pPhysVol,
const G4NavigationHistory* pHistory )
{
fhistory = *pHistory;
G4AffineTransform tf(fhistory.GetTopTransform().Inverse());
void G4TouchableHistory::UpdateYourself( G4VPhysicalVolume* pPhysVol,
const G4NavigationHistory* pHistory )
{
fhistory = *pHistory;
const G4AffineTransform& tf = fhistory.GetTopTransform();
if( pPhysVol == 0 )
{
// This means that the track has left the World Volume.
@@ -46,8 +46,8 @@ void G4TouchableHistory::UpdateYourself( G4VPhysicalVolume* pPhysVol,
//
fhistory.SetFirstEntry(pPhysVol);
}
ftlate = tf.NetTranslation();
frot = tf.NetRotation();
ftlate = tf.InverseNetTranslation();
frot = tf.InverseNetRotation();
}
inline
@@ -117,16 +117,16 @@ void* G4TouchableHistory::operator new(size_t)
// Once the Navigator calls InitializeAllocator,
// the if block below can be removed.
//
if (!aTouchableHistoryAllocator)
if (!aTouchableHistoryAllocator())
{
aTouchableHistoryAllocator = new G4Allocator<G4TouchableHistory>;
aTouchableHistoryAllocator() = new G4Allocator<G4TouchableHistory>;
}
return (void *) aTouchableHistoryAllocator->MallocSingle();
return (void *) aTouchableHistoryAllocator()->MallocSingle();
}
inline
void G4TouchableHistory::operator delete(void *aTH)
{
aTouchableHistoryAllocator->FreeSingle((G4TouchableHistory *) aTH);
aTouchableHistoryAllocator()->FreeSingle((G4TouchableHistory *) aTH);
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4GeometryWorkspacePool.cc 103041 2017-03-10 11:47:01Z gcosmo $
// $Id: G4GeometryWorkspacePool.cc 110271 2018-05-17 14:41:15Z gcosmo $
//
//
// Class G4GeometryWorkspacePool - implementation
@@ -41,7 +41,11 @@ namespace
G4Mutex singletonM = G4MUTEX_INITIALIZER;
}
G4ThreadLocal G4GeometryWorkspace* G4GeometryWorkspacePool::fMyWorkspace=0;
G4GeometryWorkspace*& G4GeometryWorkspacePool::fMyWorkspace()
{
G4ThreadLocalStatic G4GeometryWorkspace* _instance = nullptr;
return _instance;
}
G4GeometryWorkspacePool* G4GeometryWorkspacePool::thePool=0;
@@ -60,7 +64,7 @@ G4GeometryWorkspacePool* G4GeometryWorkspacePool::GetInstance()
G4GeometryWorkspace* G4GeometryWorkspacePool::CreateWorkspace()
{
G4GeometryWorkspace* geometryWrk=0;
if( !fMyWorkspace )
if( !fMyWorkspace() )
{
geometryWrk= new G4GeometryWorkspace();
@@ -71,7 +75,7 @@ G4GeometryWorkspace* G4GeometryWorkspacePool::CreateWorkspace()
}
else
{
fMyWorkspace= geometryWrk;
fMyWorkspace()= geometryWrk;
}
}
else
@@ -79,7 +83,7 @@ G4GeometryWorkspace* G4GeometryWorkspacePool::CreateWorkspace()
G4Exception("GeometryWorspacePool::CreateWorkspace", "GeomVol003",
FatalException,
"Cannot create workspace twice for the same thread.");
geometryWrk= fMyWorkspace;
geometryWrk= fMyWorkspace();
}
return geometryWrk;
@@ -98,14 +102,14 @@ void G4GeometryWorkspacePool::CreateAndUseWorkspace()
//
G4GeometryWorkspace* G4GeometryWorkspacePool::FindOrCreateWorkspace()
{
G4GeometryWorkspace* geometryWrk= fMyWorkspace;
G4GeometryWorkspace* geometryWrk= fMyWorkspace();
if( !geometryWrk )
{
geometryWrk= this->CreateWorkspace();
}
geometryWrk->UseWorkspace();
fMyWorkspace= geometryWrk; // assign it for use by this thread.
fMyWorkspace()= geometryWrk; // assign it for use by this thread.
return geometryWrk;
}
@@ -124,11 +128,11 @@ void G4GeometryWorkspacePool::Recycle( G4GeometryWorkspace *geometryWrk )
//
void G4GeometryWorkspacePool::CleanUpAndDestroyAllWorkspaces()
{
if (fMyWorkspace)
if (fMyWorkspace())
{
fMyWorkspace->DestroyWorkspace();
delete fMyWorkspace;
fMyWorkspace=0;
fMyWorkspace()->DestroyWorkspace();
delete fMyWorkspace();
fMyWorkspace()=0;
}
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4NavigationHistory.cc 102197 2017-01-10 14:25:23Z gcosmo $
// $Id: G4NavigationHistory.cc 110271 2018-05-17 14:41:15Z gcosmo $
//
//
// G4NavigationHistory Implementation
@@ -36,7 +36,11 @@
#include "G4ios.hh"
#include "G4NavigationHistory.hh"
G4ThreadLocal G4Allocator<G4NavigationHistory> *aNavigHistoryAllocator = 0;
G4Allocator<G4NavigationHistory>*& aNavigHistoryAllocator()
{
G4ThreadLocalStatic G4Allocator<G4NavigationHistory>* _instance = nullptr;
return _instance;
}
G4NavigationHistory::G4NavigationHistory()
: fStackDepth(0)
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4NavigationLevel.cc 86527 2014-11-13 15:06:24Z gcosmo $
// $Id: G4NavigationLevel.cc 110271 2018-05-17 14:41:15Z gcosmo $
//
// 30.09.97 J.Apostolakis Initial version.
//
@@ -32,7 +32,11 @@
#include "G4NavigationLevel.hh"
G4ThreadLocal G4Allocator<G4NavigationLevel> *aNavigationLevelAllocator = 0;
G4Allocator<G4NavigationLevel>*& aNavigationLevelAllocator()
{
G4ThreadLocalStatic G4Allocator<G4NavigationLevel>* _instance = nullptr;
return _instance;
}
G4NavigationLevel::G4NavigationLevel( G4VPhysicalVolume* pPhysVol,
const G4AffineTransform& afTransform,
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4NavigationLevelRep.cc 85846 2014-11-05 15:45:28Z gcosmo $
// $Id: G4NavigationLevelRep.cc 110271 2018-05-17 14:41:15Z gcosmo $
//
// 1 October 1997 J.Apostolakis Initial version.
//
@@ -32,4 +32,8 @@
#include "G4NavigationLevelRep.hh"
G4ThreadLocal G4Allocator<G4NavigationLevelRep> *aNavigLevelRepAllocator = 0;
G4Allocator<G4NavigationLevelRep>*& aNavigLevelRepAllocator()
{
G4ThreadLocalStatic G4Allocator<G4NavigationLevelRep>* _instance = nullptr;
return _instance;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4PVParameterised.cc 73250 2013-08-22 13:22:23Z gcosmo $
// $Id: G4PVParameterised.cc 109823 2018-05-09 10:42:34Z gcosmo $
//
//
// class G4PVParameterised
@@ -236,7 +236,7 @@ G4PVParameterised::CheckOverlaps(G4int res, G4double tol,
{
// Transform each point according to daughter's frame
//
G4ThreeVector md = Td.Inverse().TransformPoint(*pos);
G4ThreeVector md = Td.InverseTransformPoint(*pos);
if (solidB->Inside(md)==kInside)
{
+9 -8
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4PVPlacement.cc 85846 2014-11-05 15:45:28Z gcosmo $
// $Id: G4PVPlacement.cc 110402 2018-05-22 11:35:41Z gcosmo $
//
//
// class G4PVPlacement Implementation
@@ -277,7 +277,7 @@ G4bool G4PVPlacement::CheckOverlaps(G4int res, G4double tol,
std::ostringstream message;
message << "Overlap with mother volume !" << G4endl
<< " Overlap is detected for volume "
<< GetName() << G4endl
<< GetName() << ':' << GetCopyNo() << G4endl
<< " with its mother volume "
<< motherLog->GetName() << G4endl
<< " at mother local point " << mp << ", "
@@ -307,7 +307,7 @@ G4bool G4PVPlacement::CheckOverlaps(G4int res, G4double tol,
//
G4AffineTransform Td( daughter->GetRotation(),
daughter->GetTranslation() );
G4ThreeVector md = Td.Inverse().TransformPoint(mp);
G4ThreeVector md = Td.InverseTransformPoint(mp);
G4VSolid* daughterSolid = daughter->GetLogicalVolume()->GetSolid();
if (daughterSolid->Inside(md)==kInside)
@@ -319,8 +319,9 @@ G4bool G4PVPlacement::CheckOverlaps(G4int res, G4double tol,
std::ostringstream message;
message << "Overlap with volume already placed !" << G4endl
<< " Overlap is detected for volume "
<< GetName() << G4endl
<< " with " << daughter->GetName() << " volume's"
<< GetName() << ':' << GetCopyNo() << G4endl
<< " with " << daughter->GetName()
<< ':' << daughter->GetCopyNo() << " volume's"
<< G4endl
<< " local point " << md << ", "
<< "overlapping by at least: "
@@ -351,7 +352,7 @@ G4bool G4PVPlacement::CheckOverlaps(G4int res, G4double tol,
// and finally to current volume's coordinate system
//
G4ThreeVector mp2 = Td.TransformPoint(dPoint);
G4ThreeVector msi = Tm.Inverse().TransformPoint(mp2);
G4ThreeVector msi = Tm.InverseTransformPoint(mp2);
if (solid->Inside(msi)==kInside)
{
@@ -359,9 +360,9 @@ G4bool G4PVPlacement::CheckOverlaps(G4int res, G4double tol,
std::ostringstream message;
message << "Overlap with volume already placed !" << G4endl
<< " Overlap is detected for volume "
<< GetName() << G4endl
<< GetName() << ':' << GetCopyNo() << G4endl
<< " apparently fully encapsulating volume "
<< daughter->GetName() << G4endl
<< daughter->GetName() << ':' << daughter->GetCopyNo()
<< " at the same level !";
G4Exception("G4PVPlacement::CheckOverlaps()",
"GeomVol1002", JustWarning, message);
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4TouchableHistory.cc 86527 2014-11-13 15:06:24Z gcosmo $
// $Id: G4TouchableHistory.cc 110271 2018-05-17 14:41:15Z gcosmo $
//
//
// class G4TouchableHistory Implementation
@@ -33,7 +33,11 @@
#include "G4TouchableHistory.hh"
G4ThreadLocal G4Allocator<G4TouchableHistory> *aTouchableHistoryAllocator = 0;
G4Allocator<G4TouchableHistory>*& aTouchableHistoryAllocator()
{
G4ThreadLocalStatic G4Allocator<G4TouchableHistory>* _instance = nullptr;
return _instance;
}
G4TouchableHistory::G4TouchableHistory()
: frot(G4RotationMatrix()),
@@ -46,10 +50,10 @@ G4TouchableHistory::G4TouchableHistory()
G4TouchableHistory::G4TouchableHistory( const G4NavigationHistory &history )
: fhistory(history)
{
G4AffineTransform tf(fhistory.GetTopTransform().Inverse());
ftlate = tf.NetTranslation();
frot = tf.NetRotation();
{
const G4AffineTransform& tf = fhistory.GetTopTransform();
ftlate = tf.InverseNetTranslation();
frot = tf.InverseNetRotation();
}
G4TouchableHistory::~G4TouchableHistory()