Problem 1880

Summary: Provide method to check existence of unit
Product: Geant4 Reporter: David Hall <david.hall.physics>
Component: global/managementAssignee: Gabriele Cosmo <Gabriele.Cosmo>
Status: RESOLVED FIXED    
Severity: minor    
Priority: P5    
Version: 10.2   
Hardware: All   
OS: All   

Description David Hall 2016-08-16 21:42:18 CEST
In Geant4.10.2.p02, the failure of G4UnitDefinition::GetValueOf(G4String unit) was raised from a warning to a fatal error (#1843). We were using this method to check that a unit is defined, but this is no longer possible.

Please could we have a new G4UnitDefinition::IsDefined(G4String unit) method?

Thanks,
David
Comment 1 Gabriele Cosmo 2016-08-18 09:42:07 CEST
Thanks for reporting the use-case. A new static method "G4bool IsUnitDefined(const G4String&)" has been added in the development version and will be available in the next release.
Comment 2 David Hall 2016-08-18 18:15:19 CEST
Thanks a lot, Gabriele!