[831] | 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,v 1.4 2006/06/29 18:32:21 gunter Exp $ |
---|
[1058] | 27 | // GEANT4 tag $Name: geant4-09-02-ref-02 $ |
---|
[831] | 28 | // |
---|
| 29 | // -------------------------------------------------------------------- |
---|
| 30 | // GEANT 4 class header file |
---|
| 31 | // |
---|
| 32 | // G4SmartVoxelStat |
---|
| 33 | // |
---|
| 34 | // Class description: |
---|
| 35 | // |
---|
| 36 | // Stores information on the performance of the smart voxel algorithm |
---|
| 37 | // for an individual logical volume. |
---|
| 38 | |
---|
| 39 | // Author: D.C.Williams, UCSC (davidw@scipp.ucsc.edu) |
---|
| 40 | // -------------------------------------------------------------------- |
---|
| 41 | |
---|
| 42 | #ifndef G4SmartVoxelStat_hh |
---|
| 43 | #define G4SmartVoxelStat_hh |
---|
| 44 | |
---|
| 45 | #include "G4Types.hh" |
---|
| 46 | #include <functional> |
---|
| 47 | |
---|
| 48 | class G4LogicalVolume; |
---|
| 49 | class G4SmartVoxelHeader; |
---|
| 50 | |
---|
| 51 | class G4SmartVoxelStat |
---|
| 52 | { |
---|
| 53 | public: // with description |
---|
| 54 | |
---|
| 55 | G4SmartVoxelStat( const G4LogicalVolume *theVolume, |
---|
| 56 | const G4SmartVoxelHeader *theVoxel, |
---|
| 57 | G4double theSysTime, |
---|
| 58 | G4double theUserTime ); |
---|
| 59 | // Construct information on one volume's voxels |
---|
| 60 | |
---|
| 61 | const G4LogicalVolume *GetVolume() const; |
---|
| 62 | // Return a pointer to the logical volume |
---|
| 63 | |
---|
| 64 | const G4SmartVoxelHeader *GetVoxel() const; |
---|
| 65 | // Return a pointer to the voxel header |
---|
| 66 | |
---|
| 67 | G4double GetSysTime() const; |
---|
| 68 | // Get amount of system CPU time needed to build voxels |
---|
| 69 | |
---|
| 70 | G4double GetUserTime() const; |
---|
| 71 | // Get amount of user CPU time needed to build voxels |
---|
| 72 | |
---|
| 73 | G4double GetTotalTime() const; |
---|
| 74 | // Get total amount of CPU time needed to build voxels |
---|
| 75 | |
---|
| 76 | G4long GetNumberHeads() const; |
---|
| 77 | // Get number of voxel headers used in the volume |
---|
| 78 | |
---|
| 79 | G4long GetNumberNodes() const; |
---|
| 80 | // Get number of voxel slices used in the volume |
---|
| 81 | |
---|
| 82 | G4long GetNumberPointers() const; |
---|
| 83 | // Get number of voxel proxy pointers used in the volume |
---|
| 84 | |
---|
| 85 | G4long GetMemoryUse() const; |
---|
| 86 | // Get number of bytes needed to store voxel information |
---|
| 87 | |
---|
| 88 | |
---|
| 89 | protected: |
---|
| 90 | |
---|
| 91 | void CountHeadsAndNodes( const G4SmartVoxelHeader *head ); |
---|
| 92 | |
---|
| 93 | const G4LogicalVolume *volume; |
---|
| 94 | const G4SmartVoxelHeader *voxel; |
---|
| 95 | |
---|
| 96 | G4double sysTime; |
---|
| 97 | G4double userTime; |
---|
| 98 | |
---|
| 99 | G4long heads; |
---|
| 100 | G4long nodes; |
---|
| 101 | G4long pointers; |
---|
| 102 | |
---|
| 103 | |
---|
| 104 | public: |
---|
| 105 | |
---|
| 106 | // |
---|
| 107 | // Functor objects for sorting |
---|
| 108 | // |
---|
| 109 | struct ByCpu |
---|
| 110 | : public std::binary_function< const G4SmartVoxelStat, |
---|
| 111 | const G4SmartVoxelStat, G4bool > |
---|
| 112 | { |
---|
| 113 | G4bool operator()( const G4SmartVoxelStat &a, const G4SmartVoxelStat &b ) |
---|
| 114 | { |
---|
| 115 | return a.GetTotalTime() > b.GetTotalTime(); |
---|
| 116 | } |
---|
| 117 | }; |
---|
| 118 | |
---|
| 119 | struct ByMemory |
---|
| 120 | : public std::binary_function< const G4SmartVoxelStat, |
---|
| 121 | const G4SmartVoxelStat, G4bool > |
---|
| 122 | { |
---|
| 123 | G4bool operator()( const G4SmartVoxelStat &a, const G4SmartVoxelStat &b ) |
---|
| 124 | { |
---|
| 125 | return a.GetMemoryUse() > b.GetMemoryUse(); |
---|
| 126 | } |
---|
| 127 | }; |
---|
| 128 | }; |
---|
| 129 | |
---|
| 130 | #endif |
---|