42 #ifdef G4GEOMETRY_VOXELDEBUG
172 std::vector<G4SmartVoxelStat> stats;
173 if (verbose) { allTimer.
Start(); }
179 for (
size_t n=0;
n<Store->size();
n++)
181 if (verbose) timer.
Start();
195 #ifdef G4GEOMETRY_VOXELDEBUG
196 G4cout <<
"**** G4GeometryManager::BuildOptimisations" <<
G4endl
197 <<
" Examining logical volume name = "
208 message <<
"VoxelHeader allocation error." <<
G4endl
209 <<
"Allocation of new VoxelHeader" <<
G4endl
210 <<
" for volume " << volume->
GetName() <<
" failed.";
211 G4Exception(
"G4GeometryManager::BuildOptimisations()",
"GeomMgt0003",
225 #ifdef G4GEOMETRY_VOXELDEBUG
226 G4cout <<
"**** G4GeometryManager::BuildOptimisations" <<
G4endl
227 <<
" Skipping logical volume name = " << volume->
GetName()
247 if (!pVolume) {
return; }
271 message <<
"VoxelHeader allocation error." <<
G4endl
272 <<
"Allocation of new VoxelHeader" <<
G4endl
273 <<
" for volume " << tVolume->
GetName() <<
" failed.";
274 G4Exception(
"G4GeometryManager::BuildOptimisations()",
"GeomMgt0003",
281 #ifdef G4GEOMETRY_VOXELDEBUG
282 G4cout <<
"**** G4GeometryManager::BuildOptimisations" <<
G4endl
283 <<
" Skipping logical volume name = " << tVolume->
GetName()
306 for (
size_t n=0;
n<Store->size();
n++)
321 if (!pVolume) {
return; }
352 G4Exception(
"G4GeometryManager::SetMaximumExtent()",
354 "Extent can be set only BEFORE creating any geometry object!");
367 G4cout <<
"G4GeometryManager::ReportVoxelStats -- Voxel Statistics"
373 G4int i, nStat = stats.size();
376 for( i=0;i<nStat;++i ) { totalMemory += stats[i].GetMemoryUse(); }
378 G4cout <<
" Total memory consumed for geometry optimisation: "
379 << totalMemory/1024 <<
" kByte" <<
G4endl;
380 G4cout <<
" Total CPU time elapsed for geometry optimisation: "
381 << std::setprecision(2) << totalCpuTime <<
" seconds"
382 << std::setprecision(6) <<
G4endl;
389 G4int nPrint = nStat > 10 ? 10 : nStat;
394 G4cout <<
" Percent Total CPU System CPU Memory Volume\n"
395 <<
" ------- ---------- ---------- -------- ----------"
400 for(i=0;i<nPrint;++i)
406 if (system < 0) { system = 0.0; }
407 if ((total < 0) || (totalCpuTime <
perMillion))
410 { perc = total*100/totalCpuTime; }
412 G4cout << std::setprecision(2)
414 << std::setw(11) << perc
415 << std::setw(13) << total
416 << std::setw(13) << system
417 << std::setw(13) << (stats[i].GetMemoryUse()+512)/1024
419 << stats[i].GetVolume()->GetName()
420 << std::resetiosflags(std::ios::floatfield|std::ios::adjustfield)
421 << std::setprecision(6)
432 G4cout <<
"\n Voxelisation: top memory users:" <<
G4endl;
433 G4cout <<
" Percent Memory Heads Nodes Pointers Total CPU Volume\n"
434 <<
" ------- -------- ------ ------ -------- ---------- ----------"
439 for(i=0;i<nPrint;++i)
441 G4long memory = stats[i].GetMemoryUse();
442 G4double totTime = stats[i].GetTotalTime();
443 if (totTime < 0) { totTime = 0.0; }
445 G4cout << std::setprecision(2)
448 << std::setw(11) << memory/1024 <<
"k "
449 << std::setw( 9) << stats[i].GetNumberHeads()
450 << std::setw( 9) << stats[i].GetNumberNodes()
451 << std::setw(11) << stats[i].GetNumberPointers()
452 << std::setw(13) << totTime <<
" "
454 << stats[i].GetVolume()->GetName()
455 << std::resetiosflags(std::ios::floatfield|std::ios::adjustfield)
456 << std::setprecision(6)
void SetSurfaceTolerance(G4double worldExtent)
static G4GeometryManager * GetInstanceIfExist()
G4double total(Particle const *const p1, Particle const *const p2)
system("rm -rf microbeam.root")
G4LogicalVolume * GetLogicalVolume() const
G4SmartVoxelHeader * GetVoxelHeader() const
void message(RunManager *runmanager)
G4int GetNoDaughters() const
static constexpr double perMillion
void SetVoxelHeader(G4SmartVoxelHeader *pVoxel)
G4LogicalVolume * GetMotherLogical() const
virtual G4int GetRegularStructureId() const =0
G4double GetSystemElapsed() const
static G4GeometryManager * GetInstance()
G4double GetUserElapsed() const
G4bool IsToOptimise() const
static G4ThreadLocal G4GeometryManager * fgInstance
void OpenGeometry(G4VPhysicalVolume *vol=0)
void SetWorldMaximumExtent(G4double worldExtent)
static G4ThreadLocal G4bool fIsClosed
static void ReportVoxelStats(std::vector< G4SmartVoxelStat > &stats, G4double totalCpuTime)
static G4SolidStore * GetInstance()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
static G4bool IsGeometryClosed()
void BuildOptimisations(G4bool allOpt, G4bool verbose=false)
void DeleteOptimisations()
G4bool CloseGeometry(G4bool pOptimise=true, G4bool verbose=false, G4VPhysicalVolume *vol=0)
const G4int kMinVoxelVolumesLevel1
G4GLOB_DLL std::ostream G4cout
virtual G4bool IsReplicated() const =0
static G4GeometryTolerance * GetInstance()
static G4LogicalVolumeStore * GetInstance()
G4VPhysicalVolume * GetDaughter(const G4int i) const
const G4String & GetName() const