Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ElectronOccupancy Class Reference

#include <G4ElectronOccupancy.hh>

Public Types

enum  { MaxSizeOfOrbit = 20 }
 

Public Member Functions

 G4ElectronOccupancy (G4int sizeOrbit=MaxSizeOfOrbit)
 
 G4ElectronOccupancy (const G4ElectronOccupancy &right)
 
virtual ~G4ElectronOccupancy ()
 
void * operator new (size_t)
 
void operator delete (void *aElectronOccupancy)
 
G4ElectronOccupancyoperator= (const G4ElectronOccupancy &right)
 
G4bool operator== (const G4ElectronOccupancy &right) const
 
G4bool operator!= (const G4ElectronOccupancy &right) const
 
G4int GetTotalOccupancy () const
 
G4int GetOccupancy (G4int orbit) const
 
G4int AddElectron (G4int orbit, G4int number=1)
 
G4int RemoveElectron (G4int orbit, G4int number=1)
 
G4int GetSizeOfOrbit () const
 
void DumpInfo () const
 

Detailed Description

Definition at line 50 of file G4ElectronOccupancy.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
MaxSizeOfOrbit 

Definition at line 53 of file G4ElectronOccupancy.hh.

Constructor & Destructor Documentation

◆ G4ElectronOccupancy() [1/2]

G4ElectronOccupancy::G4ElectronOccupancy ( G4int sizeOrbit = MaxSizeOfOrbit)

Definition at line 41 of file G4ElectronOccupancy.cc.

41 : theSizeOfOrbit(sizeOrbit)
42{
43 // check size
44 if ((theSizeOfOrbit < 1) || (theSizeOfOrbit > MaxSizeOfOrbit)) {
45 theSizeOfOrbit = MaxSizeOfOrbit;
46 }
47
48 // allocate and clear the array of theOccupancies
49 theOccupancies = new G4int[theSizeOfOrbit];
50 for (G4int index = 0; index < theSizeOfOrbit; ++index) {
51 theOccupancies[index] = 0;
52 }
53
54 theTotalOccupancy = 0;
55}
int G4int
Definition G4Types.hh:85

◆ G4ElectronOccupancy() [2/2]

G4ElectronOccupancy::G4ElectronOccupancy ( const G4ElectronOccupancy & right)

Definition at line 66 of file G4ElectronOccupancy.cc.

67{
68 theSizeOfOrbit = right.theSizeOfOrbit;
69
70 // allocate and clear the array of theOccupancies
71 theOccupancies = new G4int[theSizeOfOrbit];
72 for (G4int index = 0; index < theSizeOfOrbit; ++index) {
73 theOccupancies[index] = right.theOccupancies[index];
74 }
75
76 theTotalOccupancy = right.theTotalOccupancy;
77}

◆ ~G4ElectronOccupancy()

G4ElectronOccupancy::~G4ElectronOccupancy ( )
virtual

Definition at line 57 of file G4ElectronOccupancy.cc.

58{
59 theSizeOfOrbit = -1;
60
61 delete[] theOccupancies;
62 theOccupancies = nullptr;
63 theTotalOccupancy = 0;
64}

Member Function Documentation

◆ AddElectron()

G4int G4ElectronOccupancy::AddElectron ( G4int orbit,
G4int number = 1 )

Definition at line 126 of file G4ElectronOccupancy.cc.

127{
128 G4int value = 0;
129 if (orbit >= theSizeOfOrbit) {
130 std::ostringstream smsg;
131 smsg << "Orbit (" << orbit << ") exceeds the maximum(" << theSizeOfOrbit - 1 << ") ";
132 G4String msg = smsg.str();
133 G4Exception("G4ElectronOccupancy::AddElectron()", "PART131", JustWarning, msg);
134 }
135 else if (orbit >= 0) {
136 theOccupancies[orbit] += number;
137 theTotalOccupancy += number;
138 value = number;
139 }
140 return value;
141}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)

Referenced by G4MolecularConfiguration::AddElectron(), G4ChemDissociationChannels_option1::ConstructDissociationChannels(), G4MolecularConfiguration::ExciteMolecule(), G4MolecularConfiguration::MoveOneElectron(), and G4MoleculeDefinition::SetLevelOccupation().

◆ DumpInfo()

void G4ElectronOccupancy::DumpInfo ( ) const

Definition at line 118 of file G4ElectronOccupancy.cc.

119{
120 G4cout << " -- Electron Occupancy -- " << G4endl;
121 for (G4int index = 0; index < theSizeOfOrbit; ++index) {
122 G4cout << " " << index << "-th orbit " << theOccupancies[index] << G4endl;
123 }
124}
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout

Referenced by G4MolecularConfiguration::PrintState().

◆ GetOccupancy()

G4int G4ElectronOccupancy::GetOccupancy ( G4int orbit) const
inline

Definition at line 118 of file G4ElectronOccupancy.hh.

119{
120 G4int value = 0;
121 if ((orbit >= 0) && (orbit < theSizeOfOrbit)) {
122 value = theOccupancies[orbit];
123 }
124 return value;
125}

Referenced by G4MolecularConfiguration::IonizeMolecule(), G4MolecularConfiguration::MoveOneElectron(), comparator::operator()(), G4MolecularConfiguration::RemoveElectron(), and G4MoleculeDefinition::SetLevelOccupation().

◆ GetSizeOfOrbit()

G4int G4ElectronOccupancy::GetSizeOfOrbit ( ) const
inline

Definition at line 108 of file G4ElectronOccupancy.hh.

109{
110 return theSizeOfOrbit;
111}

Referenced by G4MoleculeDefinition::GetNbMolecularShells(), comparator::operator()(), and G4MoleculeDefinition::Serialize().

◆ GetTotalOccupancy()

G4int G4ElectronOccupancy::GetTotalOccupancy ( ) const
inline

◆ operator delete()

void G4ElectronOccupancy::operator delete ( void * aElectronOccupancy)
inline

Definition at line 103 of file G4ElectronOccupancy.hh.

104{
105 aElectronOccupancyAllocator()->FreeSingle((G4ElectronOccupancy*)aElectronOccupancy);
106}
G4PART_DLL G4Allocator< G4ElectronOccupancy > *& aElectronOccupancyAllocator()

◆ operator new()

void * G4ElectronOccupancy::operator new ( size_t )
inline

Definition at line 95 of file G4ElectronOccupancy.hh.

96{
97 if (aElectronOccupancyAllocator() == nullptr) {
99 }
100 return (void*)aElectronOccupancyAllocator()->MallocSingle();
101}

◆ operator!=()

G4bool G4ElectronOccupancy::operator!= ( const G4ElectronOccupancy & right) const

Definition at line 113 of file G4ElectronOccupancy.cc.

114{
115 return !(*this == right);
116}

◆ operator=()

G4ElectronOccupancy & G4ElectronOccupancy::operator= ( const G4ElectronOccupancy & right)

Definition at line 79 of file G4ElectronOccupancy.cc.

80{
81 if (this != &right) {
82 theSizeOfOrbit = right.theSizeOfOrbit;
83
84 // allocate and clear the array of theOccupancies
85 delete[] theOccupancies;
86 theOccupancies = new G4int[theSizeOfOrbit];
87 for (G4int index = 0; index < theSizeOfOrbit; ++index) {
88 theOccupancies[index] = right.theOccupancies[index];
89 }
90
91 theTotalOccupancy = right.theTotalOccupancy;
92 }
93 return *this;
94}

◆ operator==()

G4bool G4ElectronOccupancy::operator== ( const G4ElectronOccupancy & right) const

Definition at line 96 of file G4ElectronOccupancy.cc.

97{
98 G4bool value = true;
99 for (G4int index = 0; index < MaxSizeOfOrbit; ++index) {
100 if ((index < theSizeOfOrbit) && (index < right.theSizeOfOrbit)) {
101 value = value && (theOccupancies[index] == right.theOccupancies[index]);
102 }
103 else if ((index < theSizeOfOrbit) && (index >= right.theSizeOfOrbit)) {
104 value = value && (!static_cast<G4bool>(theOccupancies[index]));
105 }
106 else if ((index >= theSizeOfOrbit) && (index < right.theSizeOfOrbit)) {
107 value = value && (!static_cast<G4bool>(right.theOccupancies[index]));
108 }
109 }
110 return value;
111}
bool G4bool
Definition G4Types.hh:86

◆ RemoveElectron()

G4int G4ElectronOccupancy::RemoveElectron ( G4int orbit,
G4int number = 1 )

Definition at line 143 of file G4ElectronOccupancy.cc.

144{
145 G4int value = 0;
146 if (orbit >= theSizeOfOrbit) {
147 std::ostringstream smsg;
148 smsg << "Orbit (" << orbit << ") exceeds the maximum(" << theSizeOfOrbit - 1 << ") ";
149 G4String msg = smsg.str();
150 G4Exception("G4ElectronOccupancy::RemoveElectron()", "PART131", JustWarning, msg);
151 }
152 else if (orbit >= 0) {
153 if (theOccupancies[orbit] < number) number = theOccupancies[orbit];
154 theOccupancies[orbit] -= number;
155 theTotalOccupancy -= number;
156 value = number;
157 }
158 return value;
159}

Referenced by G4ChemDissociationChannels_option1::ConstructDissociationChannels(), G4MolecularConfiguration::ExciteMolecule(), G4MolecularConfiguration::IonizeMolecule(), G4MolecularConfiguration::MoveOneElectron(), G4MolecularConfiguration::RemoveElectron(), and G4MoleculeDefinition::SetLevelOccupation().


The documentation for this class was generated from the following files: