Import Geant4 11.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2023-12-08 10:43:34 +01:00
parent dd1f179cda
commit 860a2b92bf
3962 changed files with 139318 additions and 164259 deletions
@@ -29,7 +29,7 @@
//
// This class has information of occupation of electrons in atomic orbits.
// GetOccupancy(N) gives the number of electron in N-th orbit
// For example : Carbon atom should be
// For example : Carbon atom should be
// GetOccupancy(0) --> 2
// GetOccupancy(1) --> 4
// GetOccupancy(2..7) --> 0
@@ -41,96 +41,87 @@
#ifndef G4ElectronOccupancy_hh
#define G4ElectronOccupancy_hh 1
#include "globals.hh"
#include "G4Allocator.hh"
#include "G4ios.hh"
#include "globals.hh"
#include "pwdefs.hh"
class G4ElectronOccupancy
class G4ElectronOccupancy
{
public:
enum
{
MaxSizeOfOrbit = 20
};
enum { MaxSizeOfOrbit = 20};
G4ElectronOccupancy( G4int sizeOrbit = MaxSizeOfOrbit );
G4ElectronOccupancy( const G4ElectronOccupancy& right );
G4ElectronOccupancy(G4int sizeOrbit = MaxSizeOfOrbit);
G4ElectronOccupancy(const G4ElectronOccupancy& right);
virtual ~G4ElectronOccupancy();
inline void *operator new(size_t);
inline void operator delete(void *aElectronOccupancy);
// new/delete operators are overloaded to use G4Allocator
// new/delete operators are overloaded to use G4Allocator
inline void* operator new(size_t);
inline void operator delete(void* aElectronOccupancy);
G4ElectronOccupancy& operator=(const G4ElectronOccupancy& right);
G4bool operator==(const G4ElectronOccupancy& right) const;
G4bool operator!=(const G4ElectronOccupancy& right) const;
// operators
inline G4int GetTotalOccupancy() const;
inline G4int GetOccupancy(G4int orbit) const;
// The following methods returns
// 0: if the orbit(atom) is vacant
// >0: number of electrons in orbit
// The following methods returns
// 0: if the orbit(atom) is vacant
// >0: number of electrons in orbit
G4int AddElectron(G4int orbit, G4int number = 1);
G4int RemoveElectron(G4int orbit, G4int number = 1);
inline G4int GetSizeOfOrbit() const;
void DumpInfo() const;
inline G4int GetSizeOfOrbit() const;
void DumpInfo() const;
private:
G4int theSizeOfOrbit = 0;
G4int theTotalOccupancy = 0;
G4int theSizeOfOrbit = 0;
G4int theTotalOccupancy = 0;
G4int* theOccupancies = nullptr;
};
extern G4PART_DLL
G4Allocator<G4ElectronOccupancy>*& aElectronOccupancyAllocator();
extern G4PART_DLL G4Allocator<G4ElectronOccupancy>*& aElectronOccupancyAllocator();
// ------------------------
// Inline methods
// ------------------------
inline
void * G4ElectronOccupancy::operator new(size_t)
inline void* G4ElectronOccupancy::operator new(size_t)
{
if (aElectronOccupancyAllocator() == nullptr)
{
if (aElectronOccupancyAllocator() == nullptr) {
aElectronOccupancyAllocator() = new G4Allocator<G4ElectronOccupancy>;
}
return (void*) aElectronOccupancyAllocator()->MallocSingle();
return (void*)aElectronOccupancyAllocator()->MallocSingle();
}
inline
void G4ElectronOccupancy::operator delete(void* aElectronOccupancy)
inline void G4ElectronOccupancy::operator delete(void* aElectronOccupancy)
{
aElectronOccupancyAllocator()
->FreeSingle((G4ElectronOccupancy *) aElectronOccupancy);
aElectronOccupancyAllocator()->FreeSingle((G4ElectronOccupancy*)aElectronOccupancy);
}
inline
G4int G4ElectronOccupancy::GetSizeOfOrbit() const
inline G4int G4ElectronOccupancy::GetSizeOfOrbit() const
{
return theSizeOfOrbit;
return theSizeOfOrbit;
}
inline
G4int G4ElectronOccupancy::GetTotalOccupancy() const
inline G4int G4ElectronOccupancy::GetTotalOccupancy() const
{
return theTotalOccupancy;
return theTotalOccupancy;
}
inline
G4int G4ElectronOccupancy::GetOccupancy(G4int orbit) const
inline G4int G4ElectronOccupancy::GetOccupancy(G4int orbit) const
{
G4int value = 0;
if ((orbit >=0)&&(orbit<theSizeOfOrbit))
{
if ((orbit >= 0) && (orbit < theSizeOfOrbit)) {
value = theOccupancies[orbit];
}
return value;
return value;
}
#endif