Import Geant4 1.0.0 source tree
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
// the GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Material.cc,v 1.3 1999/04/14 12:49:03 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
// $Id: G4Material.cc,v 1.5.8.1 1999/12/07 20:49:20 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
// ---------- class G4Material ----------
|
||||
@@ -34,7 +34,8 @@
|
||||
// 05-10-98, change names: NumDensity -> NbOfAtomsPerVolume
|
||||
// 18-11-98, new interface to SandiaTable
|
||||
// 19-01-99 enlarge tolerance on test of coherence of gas conditions
|
||||
|
||||
// 19-07-99, Constructors with chemicalFormula added by V.Ivanchenko
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
|
||||
#include "G4Material.hh"
|
||||
@@ -56,7 +57,7 @@ G4Material::G4Material(const G4String& name, G4double z,
|
||||
InitializePointers();
|
||||
|
||||
if (density < universe_mean_density)
|
||||
{ G4cout << "--- Warning from G4Material::G4Material()"
|
||||
{ G4cerr << "--- Warning from G4Material::G4Material()"
|
||||
<< " define a material with density=0 is not allowed. \n"
|
||||
<< " The material " << name << " will be constructed with the"
|
||||
<< " default minimal density: " << universe_mean_density/(g/cm3)
|
||||
@@ -68,6 +69,7 @@ G4Material::G4Material(const G4String& name, G4double z,
|
||||
fState = state;
|
||||
fTemp = temp;
|
||||
fPressure = pressure;
|
||||
fChemicalFormula = " ";
|
||||
|
||||
// Initialize theElementVector allocating one
|
||||
// element corresponding to this material
|
||||
@@ -103,7 +105,93 @@ G4Material::G4Material(const G4String& name, G4double density, G4int nComponents
|
||||
InitializePointers();
|
||||
|
||||
if (density < universe_mean_density)
|
||||
{G4cout << "--- Warning from G4Material::G4Material()"
|
||||
{G4cerr << "--- Warning from G4Material::G4Material()"
|
||||
<< " define a material with density=0 is not allowed. \n"
|
||||
<< " The material " << name << " will be constructed with the"
|
||||
<< " default minimal density: " << universe_mean_density/(g/cm3)
|
||||
<< "g/cm3" << endl;
|
||||
density = universe_mean_density;
|
||||
}
|
||||
|
||||
fDensity = density;
|
||||
fState = state;
|
||||
fTemp = temp;
|
||||
fPressure = pressure;
|
||||
fChemicalFormula = " ";
|
||||
|
||||
maxNbComponents = nComponents;
|
||||
fNumberOfComponents = fNumberOfElements = 0;
|
||||
theElementVector = new G4ElementVector(maxNbComponents);
|
||||
|
||||
if (fState == kStateUndefined)
|
||||
{
|
||||
if (fDensity > kGasThreshold) fState = kStateSolid;
|
||||
else fState = kStateGas;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
|
||||
// Constructor to create a material with chemical formula from scratch
|
||||
|
||||
G4Material::G4Material(const G4String& name, const G4String& chFormula,
|
||||
G4double z, G4double a, G4double density,
|
||||
G4State state, G4double temp, G4double pressure)
|
||||
:fName(name),fChemicalFormula(chFormula)
|
||||
{
|
||||
InitializePointers();
|
||||
|
||||
if (density < universe_mean_density)
|
||||
{ G4cerr << "--- Warning from G4Material::G4Material()"
|
||||
<< " define a material with density=0 is not allowed. \n"
|
||||
<< " The material " << name << " will be constructed with the"
|
||||
<< " default minimal density: " << universe_mean_density/(g/cm3)
|
||||
<< "g/cm3" << endl;
|
||||
density = universe_mean_density;
|
||||
}
|
||||
|
||||
fDensity = density;
|
||||
fState = state;
|
||||
fTemp = temp;
|
||||
fPressure = pressure;
|
||||
|
||||
// Initialize theElementVector allocating one
|
||||
// element corresponding to this material
|
||||
maxNbComponents = fNumberOfComponents = fNumberOfElements = 1;
|
||||
theElementVector = new G4ElementVector(1);
|
||||
theElementVector[0] = new G4Element(name, " ", z, a);
|
||||
fMassFractionVector = new G4double[1];
|
||||
fMassFractionVector[0] = 1. ;
|
||||
|
||||
if (fState == kStateUndefined)
|
||||
{
|
||||
if (fDensity > kGasThreshold) fState = kStateSolid;
|
||||
else fState = kStateGas;
|
||||
}
|
||||
|
||||
ComputeDerivedQuantities();
|
||||
|
||||
// Store in the table of Materials
|
||||
theMaterialTable.insert(this);
|
||||
fIndexInTable = theMaterialTable.index(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
|
||||
|
||||
// Constructor to create a material with chemical formula from a List
|
||||
// of constituents (elements and/or materials) added with AddElement
|
||||
// or AddMaterial
|
||||
|
||||
G4Material::G4Material(const G4String& name, const G4String& chFormula,
|
||||
G4double density, G4int nComponents,
|
||||
G4State state, G4double temp, G4double pressure)
|
||||
:fName(name),fChemicalFormula(chFormula)
|
||||
{
|
||||
|
||||
InitializePointers();
|
||||
|
||||
if (density < universe_mean_density)
|
||||
{G4cerr << "--- Warning from G4Material::G4Material()"
|
||||
<< " define a material with density=0 is not allowed. \n"
|
||||
<< " The material " << name << " will be constructed with the"
|
||||
<< " default minimal density: " << universe_mean_density/(g/cm3)
|
||||
@@ -307,7 +395,7 @@ void G4Material::ComputeDerivedQuantities()
|
||||
if (fState == kStateGas) {
|
||||
G4double ratio = TotNbOfAtomsPerVolume*k_Boltzmann*fTemp/fPressure;
|
||||
if ((ratio<0.1)||(ratio>10.)) {
|
||||
G4cout << "---warning from G4Material-- The state conditions of the gas: "
|
||||
G4cerr << "---warning from G4Material-- The state conditions of the gas: "
|
||||
<< fName << " are not consistent."
|
||||
<< "\n density = " << fDensity/(mg/cm3) << " mg/cm3"
|
||||
<< "\t pressure = " << fPressure/atmosphere << " atmosphere"
|
||||
@@ -375,6 +463,7 @@ const G4Material& G4Material::operator=(const G4Material& right)
|
||||
if (this != &right)
|
||||
{
|
||||
fName = right.fName;
|
||||
fChemicalFormula = right.fChemicalFormula;
|
||||
fDensity = right.fDensity;
|
||||
fState = right.fState;
|
||||
fTemp = right.fTemp;
|
||||
@@ -420,6 +509,7 @@ ostream& operator<<(ostream& flux, G4Material* material)
|
||||
|
||||
flux
|
||||
<< " Material: " << setw(8) << material->fName
|
||||
<< " " << material->fChemicalFormula << " "
|
||||
<< " density: " << setw(6) << setprecision(3)
|
||||
<< G4BestUnit(material->fDensity,"Volumic Mass")
|
||||
<< " temperature: " << setw(6) << setprecision(2)
|
||||
|
||||
Reference in New Issue
Block a user