Import Geant4 4.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:18:25 +02:00
parent 36c080dca6
commit 921d3b1cda
3990 changed files with 185376 additions and 82884 deletions
+78 -32
View File
@@ -21,54 +21,69 @@
// ********************************************************************
//
//
// $Id: G4Isotope.cc,v 1.5.2.1 2001/06/28 19:10:30 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4Isotope.cc,v 1.11 2001/11/29 15:19:15 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// 03-05-01, flux.precision(prec) at begin/end of operator<<
// 29-01-97: Forbidden to create Isotope with Z<1 or N<Z, M.Maire
// 26-06-96: Code uses operators (+=, *=, ++, -> etc.) correctly, P. Urban
// 14.09.01: fCountUse: nb of elements which use this isotope
// 13.09.01: suppression of the data member fIndexInTable
// 17.07.01: migration to STL. M. Verderi.
// 03.05.01: flux.precision(prec) at begin/end of operator<<
// 29.01.97: Forbidden to create Isotope with Z<1 or N<Z, M.Maire
// 26.06.96: Code uses operators (+=, *=, ++, -> etc.) correctly, P. Urban
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4Isotope.hh"
#include "g4std/iomanip"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4IsotopeTable G4Isotope::theIsotopeTable;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// Create an isotope
//
G4Isotope::G4Isotope(const G4String& Name, G4int Z, G4int N, G4double A)
: fName(Name), fZ(Z), fN(N), fA(A)
: fName(Name), fZ(Z), fN(N), fA(A), fCountUse(0)
{
if (Z<1) G4Exception
(" ERROR! It is not allowed to create an Isotope with Z < 1" );
if (Z<1) G4Exception
(" ERROR! It is not allowed to create an Isotope with Z < 1" );
if (N<Z) G4Exception
(" ERROR! Attempt to create an Isotope with N < Z !!!" );
if (N<Z) G4Exception
(" ERROR! Attempt to create an Isotope with N < Z !!!" );
theIsotopeTable.insert(this);
fIndexInTable = theIsotopeTable.index(this);
theIsotopeTable.push_back(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Isotope::~G4Isotope() {}
G4Isotope::~G4Isotope()
{
if (fCountUse != 0)
G4cout << "--> warning from ~G4Isotope(): the isotope " << fName
<< " is still referenced by " << fCountUse << " G4Elements \n"
<< G4endl;
//remove this isotope from theIsotopeTable
G4IsotopeTable::iterator iter = theIsotopeTable.begin();
while ((iter != theIsotopeTable.end())&&(*iter != this)) iter++;
if (iter != theIsotopeTable.end()) theIsotopeTable.erase(iter);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Isotope::G4Isotope(G4Isotope& right)
{
*this = right;
//insert this new isotope in table
theIsotopeTable.insert(this);
fIndexInTable = theIsotopeTable.index(this);
theIsotopeTable.push_back(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Isotope & G4Isotope::operator=(const G4Isotope& right)
{
@@ -78,36 +93,40 @@ G4Isotope & G4Isotope::operator=(const G4Isotope& right)
fZ = right.fZ;
fN = right.fZ;
fA = right.fA;
fIndexInTable = theIsotopeTable.index(this);
}
return *this;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4int G4Isotope::operator==(const G4Isotope &right) const
{
return (this == (G4Isotope *) &right);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4int G4Isotope::operator!=(const G4Isotope &right) const
{
return (this != (G4Isotope *) &right);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4std::ostream& operator<<(G4std::ostream& flux, G4Isotope* isotope)
{
#ifdef G4USE_STD_NAMESPACE
G4std::ios::fmtflags mode = flux.flags();
flux.setf(G4std::ios::fixed,G4std::ios::floatfield);
#else
long mode = flux.setf(G4std::ios::fixed,G4std::ios::floatfield);
#endif
long prec = flux.precision(3);
flux
<< " Isotope: " << G4std::setw(5) << isotope->fName
<< " Z = " << G4std::setw(2) << isotope->fZ
<< " N = " << G4std::setw(3) << isotope->fN
<< " Z = " << G4std::setw(2) << isotope->fZ
<< " N = " << G4std::setw(3) << isotope->fN
<< " A = " << G4std::setw(6) << G4std::setprecision(2)
<< (isotope->fA)/(g/mole) << " g/mole";
@@ -116,7 +135,7 @@ G4std::ostream& operator<<(G4std::ostream& flux, G4Isotope* isotope)
return flux;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4std::ostream& operator<<(G4std::ostream& flux, G4Isotope& isotope)
{
@@ -124,19 +143,46 @@ G4std::ostream& operator<<(G4std::ostream& flux, G4Isotope* isotope)
return flux;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4std::ostream& operator<<(G4std::ostream& flux, G4IsotopeTable IsotopeTable)
{
//Dump info for all known isotopes
flux
<< "\n***** Table : Nb of isotopes = " << IsotopeTable.length()
<< "\n***** Table : Nb of isotopes = " << IsotopeTable.size()
<< " *****\n" << G4endl;
for (size_t i=0; i<IsotopeTable.length(); i++)
for (size_t i=0; i<IsotopeTable.size(); i++)
flux << IsotopeTable[i] << G4endl;
return flux;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const G4IsotopeTable* G4Isotope::GetIsotopeTable()
{
return &theIsotopeTable;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
size_t G4Isotope::GetNumberOfIsotopes()
{
return theIsotopeTable.size();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Isotope* G4Isotope::GetIsotope(G4String isotopeName)
{
// search the isotope by its name
for (size_t J=0 ; J<theIsotopeTable.size() ; J++)
{
if (theIsotopeTable[J]->GetName() == isotopeName)
return theIsotopeTable[J];
}
// the isotope does not exist in the table
return 0;
}