|
TBTK
|
#include <UnitHandler.h>
Public Types | |
| enum | TemperatureUnit { kK, K, mK, uK, nK } |
| enum | TimeUnit { s, ms, us, ns, ps, fs, as } |
| enum | LengthUnit { m, mm, um, nm, pm, fm, am, Ao } |
| enum | EnergyUnit { GeV, MeV, keV, eV, meV, ueV, J } |
| enum | ChargeUnit { kC, C, mC, uC, nC, pC, fC, aC, Te, Ge, Me, ke, e } |
| enum | CountUnit { pcs, mol } |
| enum | MassUnit { kg, g, mg, ug, ng, pg, fg, ag, u } |
| enum | MagneticFieldUnit { MT, kT, T, mT, uT, nT, GG, MG, kG, G, mG, uG } |
Static Public Member Functions | |
| static double | getHbarB () |
| static double | getHbarN () |
| static double | getK_bB () |
| static double | getK_bN () |
| static double | getEB () |
| static double | getEN () |
| static double | getCB () |
| static double | getCN () |
| static double | getN_aB () |
| static double | getN_aN () |
| static double | getM_eB () |
| static double | getM_eN () |
| static double | getM_pB () |
| static double | getM_pN () |
| static double | getMu_bB () |
| static double | getMu_bN () |
| static double | getMu_nB () |
| static double | getMu_nN () |
| static double | getMu_0B () |
| static double | getMu_0N () |
| static double | getEpsilon_0B () |
| static double | getEpsilon_0N () |
| static void | setTemperatureUnit (TemperatureUnit unit) |
| static void | setTimeUnit (TimeUnit unit) |
| static void | setLengthUnit (LengthUnit unit) |
| static void | setEnergyUnit (EnergyUnit unit) |
| static void | setChargeUnit (ChargeUnit unit) |
| static void | setCountUnit (CountUnit unit) |
| static void | setTemperatureScale (double scale) |
| static void | setTimeScale (double scale) |
| static void | setLengthScale (double scale) |
| static void | setEnergyScale (double scale) |
| static void | setChargeScale (double scale) |
| static void | setCountScale (double scale) |
| static double | convertTemperatureNtB (double temperature) |
| static double | convertTimeNtB (double time) |
| static double | convertLengthNtB (double length) |
| static double | convertEnergyNtB (double energy) |
| static double | convertChargeNtB (double charge) |
| static double | convertCountNtB (double count) |
| static double | convertTemperatureBtN (double temperature) |
| static double | convertTimeBtN (double time) |
| static double | convertLengthBtN (double length) |
| static double | convertEnergyBtN (double energy) |
| static double | convertChargeBtN (double charge) |
| static double | convertCountBtN (double count) |
| static double | convertMassDtB (double mass, MassUnit unit) |
| static double | convertMassBtD (double mass, MassUnit unit) |
| static double | convertMassDtN (double mass, MassUnit unit) |
| static double | convertMassNtD (double mass, MassUnit unit) |
| static double | convertMagneticFieldDtB (double field, MagneticFieldUnit unit) |
| static double | convertMagneticFieldBtD (double field, MagneticFieldUnit unit) |
| static double | convertMagneticFieldDtN (double field, MagneticFieldUnit unit) |
| static double | convertMagneticFieldNtD (double field, MagneticFieldUnit unit) |
| static std::string | getTemperatureUnitString () |
| static std::string | getTimeUnitString () |
| static std::string | getLengthUnitString () |
| static std::string | getEnergyUnitString () |
| static std::string | getChargeUnitString () |
| static std::string | getCountUnitString () |
| static std::string | getMassUnitString () |
| static std::string | getMagneticFieldUnitString () |
| static std::string | getHBARUnitString () |
| static std::string | getK_BUnitString () |
| static std::string | getEUnitString () |
| static std::string | getCUnitString () |
| static std::string | getN_aUnitString () |
| static std::string | getM_eUnitString () |
| static std::string | getM_pUnitString () |
| static std::string | getMu_bUnitString () |
| static std::string | getMu_nUnitString () |
| static std::string | getMu_0UnitString () |
| static std::string | getEpsilon_0UnitString () |
!!! Note: Numerica values are picked from Wikipedia, and have not yet been checked agains an authoritative source. Some values that should be the same are even known to differ in some of the least significant digits. !!!
The UnitHandler handles conversion between the 'natural units' used in the calculations and standard 'base units'. The base quantities are Temperature, time, length, energy, charge, and count, and the default units are Kelvin (K), second (s), meter (m), electron Volt (eV), Coulomb (C), and pieces (pcs).
The current base units can be changed with setXXXUnit(), where
, and subsequent calls will take input paramaters and return output parameters in corresponding units.
The functions setXXXScale() can be used to specify the scale of the 'ruler' with which parameters in the calculation are meassured. This sets the scale which relates the natrual units to the base units. For example:
UnitHandler::setEnergyUnits(UnitHandler::EnergyUnit:meV); UnitHandler::setEnergyScale(1.47);
Here the energy base unit is first set to meV, and the scale subsequently set to 1.47meV. The natural unit 1.0, now corresponds to the base unit 1.47meV. An energy parameter with value 1.0 will therefore be interpreted as having the physical value 1.47meV whenever a multiplication with a physical constant is required to generate a unitless number.
Note that the order of the above calls are important. Setting the energy scale to 1.47 while the default energy unit eV is used and then changing to meV as units will result in the scale becoming 1.47eV = 1470meV.
In addition to base units and natural units, there are also derived units. These are used to convert to and from units not included among the base units, such as kg for mass. That a u unit is derived means that it can be expressed in terms of the already existing base units. For example: kg = eVs^2/m^2.
|
strong |
Charge units (base unit):
kC - kilocoulomb
C - Coulomb
mC - millicoulomb
uC - microcoulomb
nC - nanocoulomb
pC - picocoulomb
fC - femtocoulomb
aC - attocoulomb
Te - terrae
Ge - gigae
Me - megae
ke - kiloe
e - e (elementary charge)
|
strong |
Count unit (base unit): pcs - pieces mol - Mole
|
strong |
Energy units (base unit):
GeV - gigaelectron Volt
MeV - megaelectron Volt
keV - kiloelectron Volt
eV - electron Volt
meV - millielectron Volt
ueV - microelectron Volt
J - Joule
|
strong |
Length units (base unit):
m - meter
mm - millimeter
um - micrometer
nm - nanometer
pm - picometer
fm - femtometer
am - attometer
Ao - Angstrom
|
strong |
Magnetic unit (derived unit):
MT - megatesla
kT - kilotesla
T - Tesla
mT - millitesla
uT - microtesla
nT - nanotesla
GG - gigagauss
MG - megagauss
kG - kilogauss
G - Gauss
mG - milligauss
uG - microgauss
|
strong |
Mass units (derived unit):
kg - kilogram
g - gram
mg - milligram
ug - microgram
ng - nanogram
pg - picogram
fg - femtogram
ag - attogram
u - atomic mass
|
strong |
Temperature units (base unit):
kK - kilokelvin
K - Kelvin
mK - millikelvin
uK - microkelvin
nK - nanokelvin
|
inlinestatic |
Convert charge from base units to natural units.
|
inlinestatic |
Convert charge from natural units to base units.
|
inlinestatic |
Convert count from base units to natural units.
|
inlinestatic |
Conver counting from natural units to base units.
|
inlinestatic |
Convert energy from base units to natural units.
|
inlinestatic |
Convert energy from natural units to base units
|
inlinestatic |
Convert length from base units to natural units.
|
inlinestatic |
Convert length from natural units to base units.
|
static |
Convert magnetic field from base units to derived units.
|
static |
Convert magnetic field from derived units to base units.
|
static |
Convert magnetic field from derived units to natural units.
|
static |
Convert magnetic field from natural units to derived units.
|
static |
Convert mass from base units to derived units.
|
static |
Convert mass from derived units to base units.
|
static |
Convert mass from derived units to natural units.
|
static |
Convert mass from natural units to derived units.
|
inlinestatic |
Convert temperature from base units to natural units.
|
inlinestatic |
Convert temperature from natural units to base units.
|
inlinestatic |
Convert time from base units to natural units.
|
inlinestatic |
Convert time to from natural units to base units.
|
inlinestatic |
Get the speed of light in the curently set base units.
|
static |
Get charge unit string
|
inlinestatic |
Get the speed of light in the curently set natural units.
|
static |
Get count unit string
|
static |
Get speed of light unit string.
|
inlinestatic |
Get the elementary charge in the currently set base units.
|
inlinestatic |
Get the elementary charge in the currently set natural units.
|
static |
Get energy unit string
|
inlinestatic |
Get the vacuum permittivity in the currently set base units.
|
inlinestatic |
Get the vacuum permittivity in the currently set natural units.
|
static |
Get vacuum permittivity unit string
|
static |
Get elementary charge unit string.
|
inlinestatic |
Get the Planck constant in the currently set base units.
|
inlinestatic |
Get the Planck constant in the currently set natural units.
|
static |
Get Planck constant unit string
|
inlinestatic |
Get the Boltzmann constant in the currently set base units.
|
inlinestatic |
Get the Boltzmann constant in the currently set natural units.
|
static |
Get Boltzmann constant unit string.
|
static |
Get length unit string
|
inlinestatic |
Get the electron mass in the currently set base units.
|
inlinestatic |
Get the electron mass in the currently set natural units.
|
static |
Get electron mass unit string.
|
inlinestatic |
Get the proton mass in the currently set base units.
|
inlinestatic |
Get the proton mass in the currently set natural units.
|
static |
Get proton mass unit string.
|
static |
Get mass unit string.
|
static |
Get mass unit string.
|
inlinestatic |
Get the vacuum permeability in the currently set base units.
|
inlinestatic |
Get the vacuum permeability in the currently set natural units.
|
static |
Get vacuum permeability unit string.
|
inlinestatic |
Get the Bohr magneton in the currently set base units.
|
inlinestatic |
Get the Bohr magneton in the currently set natural units.
|
static |
Get Bohr magneton unit string.
|
inlinestatic |
Get the nuclear magneton in the currently set base units.
|
inlinestatic |
Get the nuclear magneton in the currently set natural units.
|
static |
Get nuclear magneton unit string.
|
inlinestatic |
Get Avogadros number in the currently set base units.
|
inlinestatic |
Get Avogadros number in the currently set natural units.
|
static |
GetAvogadros number unit string.
|
static |
Get temperature unit string
|
static |
Get time unit string
|
static |
Set charge scale.
|
static |
Set charge unit.
|
static |
Set count unit.
|
static |
Set counting unit.
|
static |
Set energy scale.
|
static |
Set energy unit.
|
static |
Set length scale.
|
static |
Set length unit.
|
static |
Set temperature scale.
|
static |
Set temperature unit.
|
static |
Set time scale.
|
static |
Set time unit.
1.8.11