Geant4  10.00.p02
G4ElectronOccupancy.cc
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 //
27 // $Id: G4ElectronOccupancy.cc 67971 2013-03-13 10:13:24Z gcosmo $
28 //
29 //
30 // ----------------------------------------------------------------------
31 // GEANT 4 class implementation file
32 //
33 // History: first implementation, based on object model of
34 // Hisaya Kurashige, 17 Aug 1999
35 // ----------------------------------------------------------------
36 // This class has information of occupation of electrons
37 // in atomic orbits
38 // ---------------------------------------------------------------
39 
40 #include "G4ElectronOccupancy.hh"
41 
43 
45  : theSizeOfOrbit(sizeOrbit)
46 {
47  // check size
48  if ( (theSizeOfOrbit <1 ) || (theSizeOfOrbit > MaxSizeOfOrbit) ) {
50  }
51 
52  // allocate and clear the array of theOccupancies
54  G4int index =0;
55  for (index = 0; index < theSizeOfOrbit; index++) {
56  theOccupancies[index] =0;
57  }
58 
60 }
61 
63 {
64  theSizeOfOrbit = -1;
65 
66  delete [] theOccupancies;
67  theOccupancies =0;
69 }
70 
72 {
74 
75  // allocate and clear the array of theOccupancies
77  G4int index =0;
78  for (index = 0; index < theSizeOfOrbit; index++) {
79  theOccupancies[index] = right.theOccupancies[index];
80  }
81 
83 }
84 
86 {
87  if ( this != &right) {
89 
90  // allocate and clear the array of theOccupancies
91  if ( theOccupancies != 0 ) delete [] theOccupancies;
93  G4int index =0;
94  for (index = 0; index < theSizeOfOrbit; index++) {
95  theOccupancies[index] = right.theOccupancies[index];
96  }
97 
99  }
100  return *this;
101 }
102 
104 {
105  G4int index;
106  G4bool value = true;
107  for (index = 0; index < MaxSizeOfOrbit; index++) {
108  if ( (index < theSizeOfOrbit ) && ( index < right.theSizeOfOrbit) ) {
109  value = value &&
110  (theOccupancies[index] == right.theOccupancies[index]) ;
111  } else if ((index < theSizeOfOrbit ) && ( index >= right.theSizeOfOrbit)) {
112  value = value && (theOccupancies[index] == 0);
113  } else if ((index >= theSizeOfOrbit ) && ( index <right.theSizeOfOrbit)) {
114  value = value && (right.theOccupancies[index] == 0);
115  }
116  }
117  return value;
118 }
119 
121 {
122  return !(*this == right);
123 }
124 
126 {
127  G4cout << " -- Electron Occupancy -- " << G4endl;
128  G4int index;
129  for (index = 0; index < theSizeOfOrbit; index++) {
130  G4cout << " " << index << "-th orbit "
131  << theOccupancies[index] << G4endl;
132  }
133 }
G4ThreadLocal G4Allocator< G4ElectronOccupancy > * aElectronOccupancyAllocator
G4ElectronOccupancy(G4int sizeOrbit=MaxSizeOfOrbit)
G4int operator==(const G4ElectronOccupancy &right) const
#define G4ThreadLocal
Definition: tls.hh:52
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
G4int operator!=(const G4ElectronOccupancy &right) const
#define G4endl
Definition: G4ios.hh:61
G4ElectronOccupancy & operator=(const G4ElectronOccupancy &right)