42 #ifdef G4GEOMETRY_VOXELDEBUG
153 std::vector<G4SmartVoxelStat> stats;
154 if (verbose) { allTimer.
Start(); }
160 for (
size_t n=0;
n<Store->size();
n++)
162 if (verbose) timer.
Start();
176 #ifdef G4GEOMETRY_VOXELDEBUG
177 G4cout <<
"**** G4GeometryManager::BuildOptimisations" <<
G4endl
178 <<
" Examining logical volume name = "
188 std::ostringstream message;
189 message <<
"VoxelHeader allocation error." <<
G4endl
190 <<
"Allocation of new VoxelHeader" <<
G4endl
191 <<
" for volume " << volume->
GetName() <<
" failed.";
192 G4Exception(
"G4GeometryManager::BuildOptimisations()",
"GeomMgt0003",
206 #ifdef G4GEOMETRY_VOXELDEBUG
207 G4cout <<
"**** G4GeometryManager::BuildOptimisations" <<
G4endl
208 <<
" Skipping logical volume name = " << volume->
GetName()
228 if (!pVolume) {
return; }
251 std::ostringstream message;
252 message <<
"VoxelHeader allocation error." <<
G4endl
253 <<
"Allocation of new VoxelHeader" <<
G4endl
254 <<
" for volume " << tVolume->
GetName() <<
" failed.";
255 G4Exception(
"G4GeometryManager::BuildOptimisations()",
"GeomMgt0003",
262 #ifdef G4GEOMETRY_VOXELDEBUG
263 G4cout <<
"**** G4GeometryManager::BuildOptimisations" <<
G4endl
264 <<
" Skipping logical volume name = " << tVolume->
GetName()
287 for (
size_t n=0;
n<Store->size();
n++)
302 if (!pVolume) {
return; }
333 G4Exception(
"G4GeometryManager::SetMaximumExtent()",
335 "Extent can be set only BEFORE creating any geometry object!");
348 G4cout <<
"G4GeometryManager::ReportVoxelStats -- Voxel Statistics"
354 G4int i, nStat = stats.size();
357 for( i=0;i<nStat;++i ) { totalMemory += stats[i].GetMemoryUse(); }
359 G4cout <<
" Total memory consumed for geometry optimisation: "
360 << totalMemory/1024 <<
" kByte" <<
G4endl;
361 G4cout <<
" Total CPU time elapsed for geometry optimisation: "
362 << std::setprecision(2) << totalCpuTime <<
" seconds"
363 << std::setprecision(6) <<
G4endl;
370 G4int nPrint = nStat > 10 ? 10 : nStat;
375 G4cout <<
" Percent Total CPU System CPU Memory Volume\n"
376 <<
" ------- ---------- ---------- -------- ----------"
381 for(i=0;i<nPrint;++i)
384 G4double system = stats[i].GetSysTime();
387 if (system < 0) { system = 0.0; }
388 if ((total < 0) || (totalCpuTime <
perMillion))
391 { perc = total*100/totalCpuTime; }
393 G4cout << std::setprecision(2)
395 << std::setw(11) << perc
396 << std::setw(13) << total
397 << std::setw(13) << system
398 << std::setw(13) << (stats[i].GetMemoryUse()+512)/1024
400 << stats[i].GetVolume()->GetName()
401 << std::resetiosflags(std::ios::floatfield|std::ios::adjustfield)
402 << std::setprecision(6)
413 G4cout <<
"\n Voxelisation: top memory users:" <<
G4endl;
414 G4cout <<
" Percent Memory Heads Nodes Pointers Total CPU Volume\n"
415 <<
" ------- -------- ------ ------ -------- ---------- ----------"
420 for(i=0;i<nPrint;++i)
422 G4long memory = stats[i].GetMemoryUse();
423 G4double totTime = stats[i].GetTotalTime();
424 if (totTime < 0) { totTime = 0.0; }
426 G4cout << std::setprecision(2)
429 << std::setw(11) << memory/1024 <<
"k "
430 << std::setw( 9) << stats[i].GetNumberHeads()
431 << std::setw( 9) << stats[i].GetNumberNodes()
432 << std::setw(11) << stats[i].GetNumberPointers()
433 << std::setw(13) << totTime <<
" "
435 << stats[i].GetVolume()->GetName()
436 << std::resetiosflags(std::ios::floatfield|std::ios::adjustfield)
437 << std::setprecision(6)
G4SmartVoxelHeader * GetVoxelHeader() const
static G4ThreadLocal G4GeometryManager * fgInstance
G4double GetSystemElapsed() const
virtual G4bool IsReplicated() const =0
G4VPhysicalVolume * GetDaughter(const G4int i) const
void SetWorldMaximumExtent(G4double worldExtent)
void SetVoxelHeader(G4SmartVoxelHeader *pVoxel)
void BuildOptimisations(G4bool allOpt, G4bool verbose=false)
G4GLOB_DLL std::ostream G4cout
G4bool IsGeometryClosed()
virtual G4int GetRegularStructureId() const =0
G4double GetUserElapsed() const
static G4LogicalVolumeStore * GetInstance()
static G4SolidStore * GetInstance()
static G4GeometryManager * GetInstance()
G4LogicalVolume * GetMotherLogical() const
G4int GetNoDaughters() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
static const double perMillion
G4LogicalVolume * GetLogicalVolume() const
G4double total(Particle const *const p1, Particle const *const p2)
static void ReportVoxelStats(std::vector< G4SmartVoxelStat > &stats, G4double totalCpuTime)
const G4int kMinVoxelVolumesLevel1
void OpenGeometry(G4VPhysicalVolume *vol=0)
const G4String & GetName() const
G4bool IsToOptimise() const
void DeleteOptimisations()
static void SetSurfaceTolerance(G4double worldExtent)
G4bool CloseGeometry(G4bool pOptimise=true, G4bool verbose=false, G4VPhysicalVolume *vol=0)
static G4GeometryTolerance * GetInstance()