Import Geant4 10.6.0 source tree

This commit is contained in:
Gabriele Cosmo
2019-12-06 15:12:28 +01:00
parent b2a62ae692
commit 5baee230e9
2997 changed files with 141580 additions and 98673 deletions
@@ -23,14 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// Class G4GeometryManager implementation
//
//
// class G4GeometryManager
//
// Implementation
//
// Author:
// 26.07.95 P.Kent Initial version, including optimisation Build
// 26.07.95, P.Kent - Initial version, including optimisation build
// --------------------------------------------------------------------
#include <iomanip>
@@ -59,7 +54,7 @@
// Static class data
// ***************************************************************************
//
G4ThreadLocal G4GeometryManager* G4GeometryManager::fgInstance = 0;
G4ThreadLocal G4GeometryManager* G4GeometryManager::fgInstance = nullptr;
G4ThreadLocal G4bool G4GeometryManager::fIsClosed = false;
// ***************************************************************************
@@ -76,7 +71,7 @@ G4GeometryManager::G4GeometryManager()
//
G4GeometryManager::~G4GeometryManager()
{
fgInstance = 0;
fgInstance = nullptr;
fIsClosed = false;
}
@@ -92,7 +87,7 @@ G4bool G4GeometryManager::CloseGeometry(G4bool pOptimise, G4bool verbose,
{
if (!fIsClosed)
{
if (pVolume)
if (pVolume != nullptr)
{
BuildOptimisations(pOptimise, pVolume);
}
@@ -100,7 +95,7 @@ G4bool G4GeometryManager::CloseGeometry(G4bool pOptimise, G4bool verbose,
{
BuildOptimisations(pOptimise, verbose);
}
fIsClosed=true;
fIsClosed = true;
}
return true;
}
@@ -115,7 +110,7 @@ void G4GeometryManager::OpenGeometry(G4VPhysicalVolume* pVolume)
{
if (fIsClosed)
{
if (pVolume)
if (pVolume != nullptr)
{
DeleteOptimisations(pVolume);
}
@@ -123,7 +118,7 @@ void G4GeometryManager::OpenGeometry(G4VPhysicalVolume* pVolume)
{
DeleteOptimisations();
}
fIsClosed=false;
fIsClosed = false;
}
}
@@ -143,7 +138,7 @@ G4bool G4GeometryManager::IsGeometryClosed()
//
G4GeometryManager* G4GeometryManager::GetInstance()
{
if (!fgInstance)
if (fgInstance == nullptr)
{
fgInstance = new G4GeometryManager;
}
@@ -175,7 +170,7 @@ void G4GeometryManager::BuildOptimisations(G4bool allOpts, G4bool verbose)
G4LogicalVolume* volume;
G4SmartVoxelHeader* head;
for (size_t n=0; n<Store->size(); n++)
for (size_t n=0; n<Store->size(); ++n)
{
if (verbose) timer.Start();
volume=(*Store)[n];
@@ -197,7 +192,7 @@ void G4GeometryManager::BuildOptimisations(G4bool allOpts, G4bool verbose)
<< volume->GetName() << G4endl;
#endif
head = new G4SmartVoxelHeader(volume);
if (head)
if (head != nullptr)
{
volume->SetVoxelHeader(head);
}
@@ -243,24 +238,24 @@ void G4GeometryManager::BuildOptimisations(G4bool allOpts, G4bool verbose)
void G4GeometryManager::BuildOptimisations(G4bool allOpts,
G4VPhysicalVolume* pVolume)
{
if (!pVolume) { return; }
if (pVolume == nullptr) { return; }
// Retrieve the mother logical volume, if not NULL,
// otherwise apply global optimisation for the world volume
//
G4LogicalVolume* tVolume = pVolume->GetMotherLogical();
if (!tVolume) { return BuildOptimisations(allOpts, false); }
if (tVolume == nullptr) { return BuildOptimisations(allOpts, false); }
G4SmartVoxelHeader* head = tVolume->GetVoxelHeader();
delete head;
tVolume->SetVoxelHeader(0);
tVolume->SetVoxelHeader(nullptr);
if ( ( (tVolume->IsToOptimise())
&& (tVolume->GetNoDaughters()>=kMinVoxelVolumesLevel1&&allOpts) )
|| ( (tVolume->GetNoDaughters()==1)
&& (tVolume->GetDaughter(0)->IsReplicated()==true) ) )
{
head = new G4SmartVoxelHeader(tVolume);
if (head)
if (head != nullptr)
{
tVolume->SetVoxelHeader(head);
}
@@ -300,13 +295,13 @@ void G4GeometryManager::BuildOptimisations(G4bool allOpts,
//
void G4GeometryManager::DeleteOptimisations()
{
G4LogicalVolume* tVolume = 0;
G4LogicalVolume* tVolume = nullptr;
G4LogicalVolumeStore* Store = G4LogicalVolumeStore::GetInstance();
for (size_t n=0; n<Store->size(); n++)
for (size_t n=0; n<Store->size(); ++n)
{
tVolume=(*Store)[n];
delete tVolume->GetVoxelHeader();
tVolume->SetVoxelHeader(0);
tVolume->SetVoxelHeader(nullptr);
}
}
@@ -323,9 +318,9 @@ void G4GeometryManager::DeleteOptimisations(G4VPhysicalVolume* pVolume)
// otherwise global deletion to world volume.
//
G4LogicalVolume* tVolume = pVolume->GetMotherLogical();
if (!tVolume) { return DeleteOptimisations(); }
if (tVolume == nullptr) { return DeleteOptimisations(); }
delete tVolume->GetVoxelHeader();
tVolume->SetVoxelHeader(0);
tVolume->SetVoxelHeader(nullptr);
// Scan recursively the associated logical volume tree
//
@@ -372,7 +367,7 @@ G4GeometryManager::ReportVoxelStats( std::vector<G4SmartVoxelStat> & stats,
G4int i, nStat = stats.size();
G4long totalMemory = 0;
for( i=0;i<nStat;++i ) { totalMemory += stats[i].GetMemoryUse(); }
for( i=0; i<nStat; ++i ) { totalMemory += stats[i].GetMemoryUse(); }
G4cout << " Total memory consumed for geometry optimisation: "
<< totalMemory/1024 << " kByte" << G4endl;
@@ -400,7 +395,7 @@ G4GeometryManager::ReportVoxelStats( std::vector<G4SmartVoxelStat> & stats,
// 12345678901.234567890123.234567890123.234567890123k .
}
for(i=0;i<nPrint;++i)
for(i=0; i<nPrint; ++i)
{
G4double total = stats[i].GetTotalTime();
G4double system = stats[i].GetSysTime();
@@ -443,7 +438,7 @@ G4GeometryManager::ReportVoxelStats( std::vector<G4SmartVoxelStat> & stats,
// 12345678901.2345678901k .23456789.23456789.2345678901.234567890123. .
}
for(i=0;i<nPrint;++i)
for(i=0; i<nPrint; ++i)
{
G4long memory = stats[i].GetMemoryUse();
G4double totTime = stats[i].GetTotalTime();