Geant4  10.02.p01
G4SmartVoxelStat.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // $Id: G4SmartVoxelStat.hh 66356 2012-12-18 09:02:32Z gcosmo $
27 //
28 // --------------------------------------------------------------------
29 // GEANT 4 class header file
30 //
31 // G4SmartVoxelStat
32 //
33 // Class description:
34 //
35 // Stores information on the performance of the smart voxel algorithm
36 // for an individual logical volume.
37 
38 // Author: D.C.Williams, UCSC (davidw@scipp.ucsc.edu)
39 // --------------------------------------------------------------------
40 
41 #ifndef G4SmartVoxelStat_hh
42 #define G4SmartVoxelStat_hh
43 
44 #include "G4Types.hh"
45 #include <functional>
46 
47 class G4LogicalVolume;
48 class G4SmartVoxelHeader;
49 
51 {
52  public: // with description
53 
54  G4SmartVoxelStat( const G4LogicalVolume *theVolume,
55  const G4SmartVoxelHeader *theVoxel,
56  G4double theSysTime,
57  G4double theUserTime );
58  // Construct information on one volume's voxels
59 
60  const G4LogicalVolume *GetVolume() const;
61  // Return a pointer to the logical volume
62 
63  const G4SmartVoxelHeader *GetVoxel() const;
64  // Return a pointer to the voxel header
65 
66  G4double GetSysTime() const;
67  // Get amount of system CPU time needed to build voxels
68 
69  G4double GetUserTime() const;
70  // Get amount of user CPU time needed to build voxels
71 
72  G4double GetTotalTime() const;
73  // Get total amount of CPU time needed to build voxels
74 
75  G4long GetNumberHeads() const;
76  // Get number of voxel headers used in the volume
77 
78  G4long GetNumberNodes() const;
79  // Get number of voxel slices used in the volume
80 
81  G4long GetNumberPointers() const;
82  // Get number of voxel proxy pointers used in the volume
83 
84  G4long GetMemoryUse() const;
85  // Get number of bytes needed to store voxel information
86 
87 
88  protected:
89 
90  void CountHeadsAndNodes( const G4SmartVoxelHeader *head );
91 
94 
97 
101 
102 
103  public:
104 
105  //
106  // Functor objects for sorting
107  //
108  struct ByCpu
109  : public std::binary_function< const G4SmartVoxelStat,
110  const G4SmartVoxelStat, G4bool >
111  {
113  {
114  return a.GetTotalTime() > b.GetTotalTime();
115  }
116  };
117 
118  struct ByMemory
119  : public std::binary_function< const G4SmartVoxelStat,
120  const G4SmartVoxelStat, G4bool >
121  {
123  {
124  return a.GetMemoryUse() > b.GetMemoryUse();
125  }
126  };
127 };
128 
129 #endif
const G4SmartVoxelHeader * voxel
long G4long
Definition: G4Types.hh:80
G4long GetNumberHeads() const
G4double a
Definition: TRTMaterials.hh:39
G4SmartVoxelStat(const G4LogicalVolume *theVolume, const G4SmartVoxelHeader *theVoxel, G4double theSysTime, G4double theUserTime)
G4long GetNumberNodes() const
G4long GetNumberPointers() const
const G4LogicalVolume * GetVolume() const
G4double GetSysTime() const
bool G4bool
Definition: G4Types.hh:79
G4double GetTotalTime() const
const G4LogicalVolume * volume
G4long GetMemoryUse() const
G4bool operator()(const G4SmartVoxelStat &a, const G4SmartVoxelStat &b)
void CountHeadsAndNodes(const G4SmartVoxelHeader *head)
G4bool operator()(const G4SmartVoxelStat &a, const G4SmartVoxelStat &b)
double G4double
Definition: G4Types.hh:76
G4double GetUserTime() const
const G4SmartVoxelHeader * GetVoxel() const