BornAgain
1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Defines class Unit.
Definition in file Unit.h.
Go to the source code of this file.
Enumerations | |
enum class | Unit { unitless , nanometer , nanometer2 , nanometerMinus2 , angstrom , angstrom2 , angstromMinus2 , degree , radiant , other } |
Defines units, mainly to be able to convert between units. More... | |
Functions | |
double | convert (double d, Unit from, Unit to) |
Convert the given value d from unit "from" to unit "to" Throws an exception if no conversion possible. More... | |
QString | unitAsString (const Unit &unit) |
Returns the string for the given unit. More... | |
|
strong |
Defines units, mainly to be able to convert between units.
E.g. internal unit is nanometer, displayed unit is angstrom. Units which do not support conversion do not have to be part of the enum, since the relevant code parts support defining a unit via enum or via string
Enumerator | |
---|---|
unitless | |
nanometer | |
nanometer2 | |
nanometerMinus2 | |
angstrom | |
angstrom2 | |
angstromMinus2 | |
degree | |
radiant | |
other | The unit has no enum value defined in here (e.g. when defined as an explicit string) |
Definition at line 26 of file Unit.h.
Convert the given value d from unit "from" to unit "to" Throws an exception if no conversion possible.
Definition at line 20 of file Unit.cpp.
References angstrom, angstrom2, angstromMinus2, degree, nanometer, nanometer2, nanometerMinus2, other, and radiant.
Referenced by DoubleSpinBox::toBaseValue(), and DoubleSpinBox::toDisplayValue().
QString unitAsString | ( | const Unit & | unit | ) |
Returns the string for the given unit.
Definition at line 58 of file Unit.cpp.
References angstrom, angstrom2, angstromMinus2, degree, nanometer, nanometer2, nanometerMinus2, other, radiant, and unitless.
Referenced by ParameterTreeBuilder::addDetector(), and DoubleSpinBox::displayUnitAsString().