Elements  6.2
A C++ base framework for the Euclid Software.
SystemOfUnits.h
Go to the documentation of this file.
1 
26 #ifndef ELEMENTSKERNEL_ELEMENTSKERNEL_SYSTEMOFUNITS_H_
27 #define ELEMENTSKERNEL_ELEMENTSKERNEL_SYSTEMOFUNITS_H_
28 
30 
31 namespace Elements {
32 inline namespace Kernel {
33 namespace Units {
34 
35 //
36 // Length [L]
37 //
38 constexpr double meter = 1.0;
39 constexpr double meter2 = meter * meter;
40 constexpr double meter3 = meter * meter * meter;
41 
42 constexpr double millimeter = 1.e-3 * meter;
43 constexpr double millimeter2 = millimeter * millimeter;
45 
46 constexpr double centimeter = 1.e-2 * meter;
47 constexpr double centimeter2 = centimeter * centimeter;
49 
50 constexpr double kilometer = 1000. * meter;
51 constexpr double kilometer2 = kilometer * kilometer;
52 constexpr double kilometer3 = kilometer * kilometer * kilometer;
53 
54 constexpr double parsec = 3.0856775807e+16 * meter;
55 
56 constexpr double micrometer = 1.e-6 * meter;
57 constexpr double nanometer = 1.e-9 * meter;
58 constexpr double angstrom = 1.e-10 * meter;
59 constexpr double fermi = 1.e-15 * meter;
60 
61 constexpr double barn = 1.e-28 * meter2;
62 constexpr double millibarn = 1.e-3 * barn;
63 constexpr double microbarn = 1.e-6 * barn;
64 constexpr double nanobarn = 1.e-9 * barn;
65 constexpr double picobarn = 1.e-12 * barn;
66 
67 // symbols
68 constexpr double nm = nanometer;
69 constexpr double um = micrometer;
70 
71 constexpr double mm = millimeter;
72 constexpr double mm2 = millimeter2;
73 constexpr double mm3 = millimeter3;
74 
75 constexpr double cm = centimeter;
76 constexpr double cm2 = centimeter2;
77 constexpr double cm3 = centimeter3;
78 
79 constexpr double m = meter;
80 constexpr double m2 = meter2;
81 constexpr double m3 = meter3;
82 
83 constexpr double km = kilometer;
84 constexpr double km2 = kilometer2;
85 constexpr double km3 = kilometer3;
86 
87 constexpr double pc = parsec;
88 
89 //
90 // Angle
91 //
92 constexpr double radian = 1.;
93 constexpr double milliradian = 1.e-3 * radian;
94 constexpr double degree = (pi / 180.0) * radian;
95 
96 constexpr double steradian = 1.;
97 
98 // symbols
99 constexpr double rad = radian;
100 constexpr double mrad = milliradian;
101 constexpr double sr = steradian;
102 constexpr double deg = degree;
103 
104 //
105 // Time [T]
106 //
107 constexpr double second = 1.;
108 
109 constexpr double nanosecond = 1.e-9 * second;
110 constexpr double millisecond = 1.e-3 * second;
111 constexpr double microsecond = 1.e-6 * second;
112 constexpr double picosecond = 1.e-12 * second;
113 constexpr double femtosecond = 1.e-15 * second;
114 
115 constexpr double hertz = 1. / second;
116 constexpr double kilohertz = 1.e+3 * hertz;
117 constexpr double megahertz = 1.e+6 * hertz;
118 
119 // symbols
120 constexpr double ns = nanosecond;
121 constexpr double s = second;
122 constexpr double ms = millisecond;
123 
124 //
125 // Electric current [I]
126 //
127 constexpr double ampere = 1.0;
128 constexpr double milliampere = 1.e-3 * ampere;
129 constexpr double microampere = 1.e-6 * ampere;
130 constexpr double nanoampere = 1.e-9 * ampere;
131 
132 //
133 // Electric charge [I][T]
134 //
135 constexpr double coulomb = ampere * second;
136 constexpr double eplus = 1.; // positron charge
137 constexpr double e_SI = 1.602176565e-19 * coulomb; // positron charge in coulomb
138 
139 //
140 // Mass [M]
141 //
142 constexpr double kilogram = 1.0;
143 constexpr double gram = 1.e-3 * kilogram;
144 constexpr double milligram = 1.e-3 * gram;
145 
146 // symbols
147 constexpr double kg = kilogram;
148 constexpr double g = gram;
149 constexpr double mg = milligram;
150 
151 //
152 // Energy [M][L^2][T^-2]
153 //
154 constexpr double joule = kilogram * (meter * meter) / (second * second);
155 constexpr double electronvolt = joule * e_SI;
156 constexpr double megaelectronvolt = 1.e+6 * electronvolt;
157 constexpr double kiloelectronvolt = 1.e+3 * electronvolt;
158 constexpr double gigaelectronvolt = 1.e+9 * electronvolt;
159 constexpr double teraelectronvolt = 1.e+12 * electronvolt;
160 constexpr double petaelectronvolt = 1.e+15 * electronvolt;
161 constexpr double erg = 1.e-7 * joule;
162 
163 // symbols
164 constexpr double MeV = megaelectronvolt;
165 constexpr double eV = electronvolt;
166 constexpr double keV = kiloelectronvolt;
167 constexpr double GeV = gigaelectronvolt;
168 constexpr double TeV = teraelectronvolt;
169 constexpr double PeV = petaelectronvolt;
170 
171 //
172 // Power [E][T^-1]
173 //
174 constexpr double watt = joule / second;
175 
176 //
177 // Force [E][L^-1]
178 //
179 constexpr double newton = joule / meter;
180 
181 //
182 // Pressure [E][L^-3]
183 //
184 constexpr double Pa = newton / m2;
185 constexpr double bar = 100000 * Pa;
186 constexpr double atmosphere = 101325 * Pa;
187 
188 //
189 // Electric potential [E][Q^-1]
190 //
191 constexpr double volt = electronvolt / eplus;
192 constexpr double megavolt = 1.e+6 * volt;
193 constexpr double kilovolt = 1.e+3 * volt;
194 
195 //
196 // Electric resistance [E][T][Q^-2]
197 //
198 constexpr double ohm = volt / ampere;
199 
200 //
201 // Electric capacitance [Q^2][E^-1]
202 //
203 constexpr double farad = coulomb / volt;
204 constexpr double millifarad = 1.e-3 * farad;
205 constexpr double microfarad = 1.e-6 * farad;
206 constexpr double nanofarad = 1.e-9 * farad;
207 constexpr double picofarad = 1.e-12 * farad;
208 
209 //
210 // Magnetic Flux [T][E][Q^-1]
211 //
212 constexpr double weber = volt * second;
213 //
214 // Magnetic Field [T][E][Q^-1][L^-2]
215 //
216 constexpr double tesla = volt * second / meter2;
217 
218 constexpr double gauss = 1.e-4 * tesla;
219 constexpr double kilogauss = 1.e-1 * tesla;
220 
221 //
222 // Inductance [T^2][E][Q^-2]
223 //
224 constexpr double henry = weber / ampere;
225 
226 //
227 // Temperature
228 //
229 constexpr double kelvin = 1.;
230 
231 //
232 // Amount of substance
233 //
234 constexpr double mole = 1.;
235 
236 //
237 // Activity [T^-1]
238 //
239 constexpr double becquerel = 1. / second;
240 constexpr double curie = 3.7e+10 * becquerel;
241 
242 //
243 // Absorbed dose [L^2][T^-2]
244 //
245 constexpr double gray = joule / kilogram;
246 
247 //
248 // Luminous intensity [I]
249 //
250 constexpr double candela = 1.;
251 
252 //
253 // Luminous flux [I]
254 //
255 constexpr double lumen = candela * steradian;
256 constexpr double jansky = 1.e-26 * watt / (m2 * hertz);
257 constexpr double microjansky = 1.e-6 * jansky;
258 
259 //
260 // Illuminance [I][L^-2]
261 //
262 constexpr double lux = lumen / meter2;
263 
264 //
265 // Miscellaneous
266 //
267 constexpr double perCent = 0.01;
268 constexpr double perThousand = 0.001;
269 constexpr double perMillion = 0.000001;
270 
271 } // namespace Units
272 } // namespace Kernel
273 } // namespace Elements
274 
275 #endif // ELEMENTSKERNEL_ELEMENTSKERNEL_SYSTEMOFUNITS_H_
276 
Elements::Kernel::Units::mg
constexpr double mg
Definition: SystemOfUnits.h:149
Elements::Kernel::Units::candela
constexpr double candela
Definition: SystemOfUnits.h:250
Elements::Kernel::Units::becquerel
constexpr double becquerel
Definition: SystemOfUnits.h:239
Elements::Kernel::Units::steradian
constexpr double steradian
Definition: SystemOfUnits.h:96
Elements::Kernel::Units::megahertz
constexpr double megahertz
Definition: SystemOfUnits.h:117
Elements::Kernel::Units::millimeter3
constexpr double millimeter3
Definition: SystemOfUnits.h:44
Elements::Kernel::Units::newton
constexpr double newton
Definition: SystemOfUnits.h:179
Elements::Kernel::Units::teraelectronvolt
constexpr double teraelectronvolt
Definition: SystemOfUnits.h:159
Elements::Kernel::Units::m2
constexpr double m2
Definition: SystemOfUnits.h:80
Elements::Kernel::Units::microampere
constexpr double microampere
Definition: SystemOfUnits.h:129
Elements::Kernel::Units::femtosecond
constexpr double femtosecond
Definition: SystemOfUnits.h:113
Elements::Kernel::Units::erg
constexpr double erg
Definition: SystemOfUnits.h:161
Elements::Kernel::Units::microjansky
constexpr double microjansky
Definition: SystemOfUnits.h:257
Elements::Kernel::Units::MeV
constexpr double MeV
Definition: SystemOfUnits.h:164
Elements::Kernel::Units::ns
constexpr double ns
Definition: SystemOfUnits.h:120
Elements::Kernel::Units::e_SI
constexpr double e_SI
Definition: SystemOfUnits.h:137
Elements::Kernel::Units::millimeter2
constexpr double millimeter2
Definition: SystemOfUnits.h:43
Elements::Kernel::Units::g
constexpr double g
Definition: SystemOfUnits.h:148
Elements::Kernel::Units::kilohertz
constexpr double kilohertz
Definition: SystemOfUnits.h:116
Elements::Kernel::Units::rad
constexpr double rad
Definition: SystemOfUnits.h:99
Elements::Kernel::Units::ampere
constexpr double ampere
Definition: SystemOfUnits.h:127
Elements::Kernel::Units::mm
constexpr double mm
Definition: SystemOfUnits.h:71
Elements::Kernel::Units::nanosecond
constexpr double nanosecond
Definition: SystemOfUnits.h:109
Elements::Kernel::Units::watt
constexpr double watt
Definition: SystemOfUnits.h:174
Elements::Kernel::Units::TeV
constexpr double TeV
Definition: SystemOfUnits.h:168
Elements::Kernel::Units::second
constexpr double second
Definition: SystemOfUnits.h:107
MathConstants.h
A few math constants.
Elements::Kernel::Units::volt
constexpr double volt
Definition: SystemOfUnits.h:191
Elements::Kernel::Units::km3
constexpr double km3
Definition: SystemOfUnits.h:85
Elements::Kernel::Units::atmosphere
constexpr double atmosphere
Definition: SystemOfUnits.h:186
Elements::Kernel::Units::degree
constexpr double degree
Definition: SystemOfUnits.h:94
Elements::Kernel::Units::m
constexpr double m
Definition: SystemOfUnits.h:79
Elements::Kernel::Units::pi
constexpr double pi
Definition: MathConstants.h:34
Elements::Kernel::Units::lux
constexpr double lux
Definition: SystemOfUnits.h:262
Elements::Kernel::Units::eplus
constexpr double eplus
Definition: SystemOfUnits.h:136
Elements::Kernel::Units::cm
constexpr double cm
Definition: SystemOfUnits.h:75
Elements::Kernel::Units::lumen
constexpr double lumen
Definition: SystemOfUnits.h:255
Elements::Kernel::Units::ms
constexpr double ms
Definition: SystemOfUnits.h:122
Elements::Kernel::Units::nanofarad
constexpr double nanofarad
Definition: SystemOfUnits.h:206
Elements::Kernel::Units::nanoampere
constexpr double nanoampere
Definition: SystemOfUnits.h:130
Elements::Kernel::Units::hertz
constexpr double hertz
Definition: SystemOfUnits.h:115
Elements::Kernel::Units::kilogauss
constexpr double kilogauss
Definition: SystemOfUnits.h:219
Elements::Kernel::Units::picosecond
constexpr double picosecond
Definition: SystemOfUnits.h:112
Elements::Kernel::Units::centimeter3
constexpr double centimeter3
Definition: SystemOfUnits.h:48
Elements::Kernel::Units::gigaelectronvolt
constexpr double gigaelectronvolt
Definition: SystemOfUnits.h:158
Elements::Kernel::Units::parsec
constexpr double parsec
Definition: SystemOfUnits.h:54
Elements::Kernel::Units::microbarn
constexpr double microbarn
Definition: SystemOfUnits.h:63
Elements::Kernel::Units::pc
constexpr double pc
Definition: SystemOfUnits.h:87
Elements::Kernel::Units::angstrom
constexpr double angstrom
Definition: SystemOfUnits.h:58
Elements::Kernel::Units::coulomb
constexpr double coulomb
Definition: SystemOfUnits.h:135
Elements::Kernel::Units::electronvolt
constexpr double electronvolt
Definition: SystemOfUnits.h:155
Elements::Kernel::Units::milliradian
constexpr double milliradian
Definition: SystemOfUnits.h:93
Elements::Kernel::Units::eV
constexpr double eV
Definition: SystemOfUnits.h:165
Elements::Kernel::Units::centimeter
constexpr double centimeter
Definition: SystemOfUnits.h:46
Elements::Kernel::Units::meter2
constexpr double meter2
Definition: SystemOfUnits.h:39
Elements::Kernel::Units::cm3
constexpr double cm3
Definition: SystemOfUnits.h:77
Elements::Kernel::Units::perCent
constexpr double perCent
Definition: SystemOfUnits.h:267
Elements::Kernel::Units::nanometer
constexpr double nanometer
Definition: SystemOfUnits.h:57
Elements::Kernel::Units::petaelectronvolt
constexpr double petaelectronvolt
Definition: SystemOfUnits.h:160
Elements::Kernel::Units::mm3
constexpr double mm3
Definition: SystemOfUnits.h:73
Elements::Kernel::Units::weber
constexpr double weber
Definition: SystemOfUnits.h:212
Elements::Kernel::Units::kiloelectronvolt
constexpr double kiloelectronvolt
Definition: SystemOfUnits.h:157
Elements::Kernel::Units::kilometer
constexpr double kilometer
Definition: SystemOfUnits.h:50
Elements::Kernel::Units::joule
constexpr double joule
Definition: SystemOfUnits.h:154
Elements::Kernel::Units::ohm
constexpr double ohm
Definition: SystemOfUnits.h:198
Elements::Kernel::Units::gray
constexpr double gray
Definition: SystemOfUnits.h:245
Elements::Kernel::Units::km
constexpr double km
Definition: SystemOfUnits.h:83
Elements::Kernel::Units::gram
constexpr double gram
Definition: SystemOfUnits.h:143
Elements::Kernel::Units::kilometer2
constexpr double kilometer2
Definition: SystemOfUnits.h:51
Elements::Kernel::Units::keV
constexpr double keV
Definition: SystemOfUnits.h:166
Elements::Kernel::Units::milligram
constexpr double milligram
Definition: SystemOfUnits.h:144
Elements::Kernel::Units::kg
constexpr double kg
Definition: SystemOfUnits.h:147
Elements::Kernel::Units::kelvin
constexpr double kelvin
Definition: SystemOfUnits.h:229
Elements::Kernel::Units::megaelectronvolt
constexpr double megaelectronvolt
Definition: SystemOfUnits.h:156
Elements::Kernel::Units::perThousand
constexpr double perThousand
Definition: SystemOfUnits.h:268
Elements::Kernel::Units::um
constexpr double um
Definition: SystemOfUnits.h:69
Elements::Kernel::Units::mm2
constexpr double mm2
Definition: SystemOfUnits.h:72
Elements::Kernel::Units::microfarad
constexpr double microfarad
Definition: SystemOfUnits.h:205
Elements::Kernel::Units::jansky
constexpr double jansky
Definition: SystemOfUnits.h:256
Elements::Kernel::Units::millisecond
constexpr double millisecond
Definition: SystemOfUnits.h:110
Elements::Kernel::Units::meter3
constexpr double meter3
Definition: SystemOfUnits.h:40
Elements::Kernel::Units::nm
constexpr double nm
Definition: SystemOfUnits.h:68
Elements::Kernel::Units::henry
constexpr double henry
Definition: SystemOfUnits.h:224
Elements::Kernel::Units::kilometer3
constexpr double kilometer3
Definition: SystemOfUnits.h:52
Elements::Kernel::Units::kilovolt
constexpr double kilovolt
Definition: SystemOfUnits.h:193
Elements::Kernel::Units::megavolt
constexpr double megavolt
Definition: SystemOfUnits.h:192
Elements::Kernel::Units::kilogram
constexpr double kilogram
Definition: SystemOfUnits.h:142
Elements::Kernel::Units::PeV
constexpr double PeV
Definition: SystemOfUnits.h:169
Elements::Kernel::Units::perMillion
constexpr double perMillion
Definition: SystemOfUnits.h:269
Elements::Kernel::Units::milliampere
constexpr double milliampere
Definition: SystemOfUnits.h:128
Elements::Kernel::Units::mrad
constexpr double mrad
Definition: SystemOfUnits.h:100
Elements::Kernel::Units::barn
constexpr double barn
Definition: SystemOfUnits.h:61
Elements::Kernel::Units::farad
constexpr double farad
Definition: SystemOfUnits.h:203
Elements::Kernel::Units::sr
constexpr double sr
Definition: SystemOfUnits.h:101
Elements::Kernel::Units::bar
constexpr double bar
Definition: SystemOfUnits.h:185
Elements::Kernel::Units::millibarn
constexpr double millibarn
Definition: SystemOfUnits.h:62
Elements::Kernel::Units::deg
constexpr double deg
Definition: SystemOfUnits.h:102
Elements::Kernel::Units::meter
constexpr double meter
Definition: SystemOfUnits.h:38
Elements::Kernel::Units::Pa
constexpr double Pa
Definition: SystemOfUnits.h:184
Elements::Kernel::Units::nanobarn
constexpr double nanobarn
Definition: SystemOfUnits.h:64
Elements::Kernel::Units::centimeter2
constexpr double centimeter2
Definition: SystemOfUnits.h:47
Elements::Kernel::Units::radian
constexpr double radian
Definition: SystemOfUnits.h:92
Elements::Kernel::Units::microsecond
constexpr double microsecond
Definition: SystemOfUnits.h:111
Elements::Kernel::Units::picobarn
constexpr double picobarn
Definition: SystemOfUnits.h:65
Elements::Kernel::Units::mole
constexpr double mole
Definition: SystemOfUnits.h:234
Elements::Kernel::Units::km2
constexpr double km2
Definition: SystemOfUnits.h:84
Elements::Kernel::Units::s
constexpr double s
Definition: SystemOfUnits.h:121
Elements::Kernel::Units::curie
constexpr double curie
Definition: SystemOfUnits.h:240
Elements::Kernel::Units::m3
constexpr double m3
Definition: SystemOfUnits.h:81
Elements::Kernel::Units::millimeter
constexpr double millimeter
Definition: SystemOfUnits.h:42
Elements::Kernel::Units::millifarad
constexpr double millifarad
Definition: SystemOfUnits.h:204
Elements::Kernel::Units::tesla
constexpr double tesla
Definition: SystemOfUnits.h:216
Elements::Kernel::Units::fermi
constexpr double fermi
Definition: SystemOfUnits.h:59
Elements::Kernel::Units::cm2
constexpr double cm2
Definition: SystemOfUnits.h:76
Elements::Kernel::Units::gauss
constexpr double gauss
Definition: SystemOfUnits.h:218
Elements::Kernel::Units::micrometer
constexpr double micrometer
Definition: SystemOfUnits.h:56
Elements::Kernel::Units::GeV
constexpr double GeV
Definition: SystemOfUnits.h:167
Elements
Definition: callBackExample.h:35
Elements::Kernel::Units::picofarad
constexpr double picofarad
Definition: SystemOfUnits.h:207