00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 #include <iomanip>
00045
00046 #include "G4Isotope.hh"
00047 #include "G4NistManager.hh"
00048 #include "G4PhysicalConstants.hh"
00049 #include "G4SystemOfUnits.hh"
00050
00051
00052
00053 G4IsotopeTable G4Isotope::theIsotopeTable;
00054
00055
00056
00057
00058
00059 G4Isotope::G4Isotope(const G4String& Name,G4int Z,G4int N,G4double A,G4int il)
00060 : fName(Name), fZ(Z), fN(N), fA(A), fm(il), fCountUse(0)
00061 {
00062 if (Z<1) {
00063 G4ExceptionDescription ed;
00064 ed << "Wrong Isotope " << Name << " Z= " << Z << G4endl;
00065 G4Exception ("G4Isotope::G4Isotope()", "mat001", FatalException, ed);
00066 }
00067 if (N<Z) {
00068 G4ExceptionDescription ed;
00069 ed << "Wrong Isotope " << Name << " Z= " << Z << " > N= " << N << G4endl;
00070 G4Exception ("G4Isotope::G4Isotope()", "mat002", FatalException, ed);
00071 }
00072 if (A<=0.0) {
00073 fA = (G4NistManager::Instance()->GetAtomicMass(Z,N))*g/(mole*amu_c2);
00074 }
00075 theIsotopeTable.push_back(this);
00076 fIndexInTable = theIsotopeTable.size() - 1;
00077 }
00078
00079
00080
00081
00082
00083
00084 G4Isotope::G4Isotope(__void__&)
00085 : fZ(0), fN(0), fA(0), fm(0), fCountUse(0), fIndexInTable(0)
00086 {
00087 }
00088
00089
00090
00091 G4Isotope::~G4Isotope()
00092 {
00093 theIsotopeTable[fIndexInTable] = 0;
00094 }
00095
00096
00097
00098 G4Isotope::G4Isotope(G4Isotope& right)
00099 {
00100 *this = right;
00101
00102
00103 theIsotopeTable.push_back(this);
00104 fIndexInTable = theIsotopeTable.size() - 1;
00105 }
00106
00107
00108
00109 G4Isotope & G4Isotope::operator=(const G4Isotope& right)
00110 {
00111 if (this != &right)
00112 {
00113 fName = right.fName;
00114 fZ = right.fZ;
00115 fN = right.fN;
00116 fA = right.fA;
00117 fm = right.fm;
00118 fCountUse = right.fCountUse;
00119 }
00120 return *this;
00121 }
00122
00123
00124
00125 G4int G4Isotope::operator==(const G4Isotope &right) const
00126 {
00127 return (this == (G4Isotope *) &right);
00128 }
00129
00130
00131
00132 G4int G4Isotope::operator!=(const G4Isotope &right) const
00133 {
00134 return (this != (G4Isotope *) &right);
00135 }
00136
00137
00138
00139 std::ostream& operator<<(std::ostream& flux, G4Isotope* isotope)
00140 {
00141 std::ios::fmtflags mode = flux.flags();
00142 flux.setf(std::ios::fixed,std::ios::floatfield);
00143 G4long prec = flux.precision(3);
00144
00145 flux
00146 << " Isotope: " << std::setw(5) << isotope->fName
00147 << " Z = " << std::setw(2) << isotope->fZ
00148 << " N = " << std::setw(3) << isotope->fN
00149 << " A = " << std::setw(6) << std::setprecision(2)
00150 << (isotope->fA)/(g/mole) << " g/mole";
00151
00152 flux.precision(prec);
00153 flux.setf(mode,std::ios::floatfield);
00154 return flux;
00155 }
00156
00157
00158
00159 std::ostream& operator<<(std::ostream& flux, G4Isotope& isotope)
00160 {
00161 flux << &isotope;
00162 return flux;
00163 }
00164
00165
00166
00167 std::ostream& operator<<(std::ostream& flux, G4IsotopeTable IsotopeTable)
00168 {
00169
00170 flux
00171 << "\n***** Table : Nb of isotopes = " << IsotopeTable.size()
00172 << " *****\n" << G4endl;
00173
00174 for (size_t i=0; i<IsotopeTable.size(); i++)
00175 flux << IsotopeTable[i] << G4endl;
00176
00177 return flux;
00178 }
00179
00180
00181
00182 const G4IsotopeTable* G4Isotope::GetIsotopeTable()
00183 {
00184 return &theIsotopeTable;
00185 }
00186
00187
00188
00189 size_t G4Isotope::GetNumberOfIsotopes()
00190 {
00191 return theIsotopeTable.size();
00192 }
00193
00194
00195
00196 G4Isotope* G4Isotope::GetIsotope(const G4String& isotopeName, G4bool warning)
00197 {
00198
00199 for (size_t J=0 ; J<theIsotopeTable.size() ; J++)
00200 {
00201 if (theIsotopeTable[J]->GetName() == isotopeName)
00202 { return theIsotopeTable[J]; }
00203 }
00204
00205
00206 if (warning) {
00207 G4cout << "\n---> warning from G4Isotope::GetIsotope(). The isotope: "
00208 << isotopeName << " does not exist in the table. Return NULL pointer."
00209 << G4endl;
00210 }
00211 return 0;
00212 }
00213
00214