Warning, file /include/Geant4/G4ElectronOccupancy.hh was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041 #ifndef G4ElectronOccupancy_hh
0042 #define G4ElectronOccupancy_hh 1
0043
0044 #include "G4Allocator.hh"
0045 #include "G4ios.hh"
0046 #include "globals.hh"
0047
0048 #include "pwdefs.hh"
0049
0050 class G4ElectronOccupancy
0051 {
0052 public:
0053 enum
0054 {
0055 MaxSizeOfOrbit = 20
0056 };
0057
0058 G4ElectronOccupancy(G4int sizeOrbit = MaxSizeOfOrbit);
0059 G4ElectronOccupancy(const G4ElectronOccupancy& right);
0060
0061 virtual ~G4ElectronOccupancy();
0062
0063
0064 inline void* operator new(size_t);
0065 inline void operator delete(void* aElectronOccupancy);
0066
0067 G4ElectronOccupancy& operator=(const G4ElectronOccupancy& right);
0068 G4bool operator==(const G4ElectronOccupancy& right) const;
0069 G4bool operator!=(const G4ElectronOccupancy& right) const;
0070
0071 inline G4int GetTotalOccupancy() const;
0072 inline G4int GetOccupancy(G4int orbit) const;
0073
0074
0075
0076
0077 G4int AddElectron(G4int orbit, G4int number = 1);
0078 G4int RemoveElectron(G4int orbit, G4int number = 1);
0079
0080 inline G4int GetSizeOfOrbit() const;
0081 void DumpInfo() const;
0082
0083 private:
0084 G4int theSizeOfOrbit = 0;
0085 G4int theTotalOccupancy = 0;
0086 G4int* theOccupancies = nullptr;
0087 };
0088
0089 extern G4PART_DLL G4Allocator<G4ElectronOccupancy>*& aElectronOccupancyAllocator();
0090
0091
0092
0093
0094
0095 inline void* G4ElectronOccupancy::operator new(size_t)
0096 {
0097 if (aElectronOccupancyAllocator() == nullptr) {
0098 aElectronOccupancyAllocator() = new G4Allocator<G4ElectronOccupancy>;
0099 }
0100 return (void*)aElectronOccupancyAllocator()->MallocSingle();
0101 }
0102
0103 inline void G4ElectronOccupancy::operator delete(void* aElectronOccupancy)
0104 {
0105 aElectronOccupancyAllocator()->FreeSingle((G4ElectronOccupancy*)aElectronOccupancy);
0106 }
0107
0108 inline G4int G4ElectronOccupancy::GetSizeOfOrbit() const
0109 {
0110 return theSizeOfOrbit;
0111 }
0112
0113 inline G4int G4ElectronOccupancy::GetTotalOccupancy() const
0114 {
0115 return theTotalOccupancy;
0116 }
0117
0118 inline G4int G4ElectronOccupancy::GetOccupancy(G4int orbit) const
0119 {
0120 G4int value = 0;
0121 if ((orbit >= 0) && (orbit < theSizeOfOrbit)) {
0122 value = theOccupancies[orbit];
0123 }
0124 return value;
0125 }
0126
0127 #endif