| 73 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
| 74 | |
| 75 | G4Material* G4NistManager::BuildMaterialWithNewDensity(const G4String& name, |
| 76 | const G4String& basename, G4double density, G4double temperature, G4double pressure) |
| 77 | { |
| 78 | G4Material* bmat = FindOrBuildMaterial(name); |
| 79 | if (bmat != nullptr) { |
| 80 | G4cout << "G4NistManager::BuildMaterialWithNewDensity ERROR: " << G4endl; |
| 81 | G4cout << " New material <" << name << "> cannot be built because material" |
| 82 | << " with the same name already exists." << G4endl; |
| 83 | G4Exception("G4NistManager::BuildMaterialWithNewDensity()", "mat101", FatalException, |
| 84 | "Wrong material name"); |
| 85 | return nullptr; |
| 86 | } |
| 87 | bmat = FindOrBuildMaterial(basename); |
| 88 | if (bmat == nullptr) { |
| 89 | G4cout << "G4NistManager::BuildMaterialWithNewDensity ERROR: " << G4endl; |
| 90 | G4cout << " New material <" << name << "> cannot be built because " << G4endl; |
| 91 | G4cout << " base material <" << basename << "> does not exist." << G4endl; |
| 92 | G4Exception("G4NistManager::BuildMaterialWithNewDensity()", "mat102", FatalException, |
| 93 | "Wrong material name"); |
| 94 | return nullptr; |
| 95 | } |
| 96 | G4double dens = density; |
| 97 | G4double temp = temperature; |
| 98 | G4double pres = pressure; |
| 99 | if (dens == 0.0) { |
| 100 | dens = bmat->GetDensity(); |
| 101 | temp = bmat->GetTemperature(); |
| 102 | pres = bmat->GetPressure(); |
| 103 | } |
| 104 | auto mat = new G4Material(name, dens, bmat, bmat->GetState(), temp, pres); |
| 105 | return mat; |
| 106 | } |
| 107 | |
| 108 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
| 109 |
no test coverage detected