Project
Loading...
Searching...
No Matches
datatypes.h
Go to the documentation of this file.
1
3
4#pragma once
5#include <SI/internal.h>
6#define DATATYPE(_name, _lengthExp, _massExp, _timeExp, _temperatureExp, _currentExp, _substanceExp, _intensityExp) \
7 namespace detail { using _name ## _dimension = dimension<_lengthExp, _massExp, _timeExp, _temperatureExp, \
8 _currentExp, _substanceExp, _intensityExp>; } \
9 template <class T> using _name ## _t = detail::quantity<detail:: _name ## _dimension, T>; \
10 using _name = _name ## _t<SIdouble>; \
11 using _name ## 2 = _name ## _t<detail::vec2<SIdouble>>; \
12 using _name ## 3 = _name ## _t<detail::vec3<SIdouble>>
13
14namespace SI {
15
16 // The Dimensionless Datatype
17 // --------------------------
18 typedef double dimensionless;
19
20 // The 7 SI Base Datatypes
21 // -----------------------
22 // Exponents: Internal base unit:
23 // l m t T c s i
24 DATATYPE(length, 1, 0, 0, 0, 0, 0, 0); // in meters
25 DATATYPE(mass, 0, 1, 0, 0, 0, 0, 0); // in kilograms
26 DATATYPE(time, 0, 0, 1, 0, 0, 0, 0); // in seconds
27 DATATYPE(temperature, 0, 0, 0, 1, 0, 0, 0); // in kelvins
28 DATATYPE(electric_current, 0, 0, 0, 0, 1, 0, 0); // in amperes
29 DATATYPE(amount_of_substance, 0, 0, 0, 0, 0, 1, 0); // in moles
30 DATATYPE(luminous_intensity, 0, 0, 0, 0, 0, 0, 1); // in candelas
31
32 // The Derived SI Datatypes
33 // ------------------------
34 DATATYPE(area, 2, 0, 0, 0, 0, 0, 0); // in square meters
35 DATATYPE(volume, 3, 0, 0, 0, 0, 0, 0); // in cubic meter
36 DATATYPE(velocity, 1, 0,-1, 0, 0, 0, 0); // in meter per second
37 DATATYPE(acceleration, 1, 0,-2, 0, 0, 0, 0); // in meter per square meter
38 DATATYPE(jerk, 1, 0,-3, 0, 0, 0, 0); // in meter per cubic meter
39 DATATYPE(force, 1, 1,-2, 0, 0, 0, 0); // in newtons
40 DATATYPE(energy, 2, 1,-2, 0, 0, 0, 0); // in newtonmeter
41 DATATYPE(impulse, 1, 1,-1, 0, 0, 0, 0); // in kilogram meter per second
42 DATATYPE(torque, 2, 1,-2, 0, 0, 0, 0); // in kilogram square meter per square second
43 DATATYPE(pressure, -1, 1,-2, 0, 0, 0, 0); // in pascals
44 DATATYPE(power, 2, 1,-3, 0, 0, 0, 0); // in watts
45 DATATYPE(power_intensity, 0, 1,-3, 0, 0, 0, 0); // in watts per square meter
46 DATATYPE(density, -3, 1, 0, 0, 0, 0, 0); // in kilograms per cubic meter
47 DATATYPE(electric_potential, 2, 1,-3, 0,-1, 0, 0); // in volts
48 DATATYPE(electric_charge, 0, 0, 1, 0, 1, 0, 0); // in amperes per second
49 DATATYPE(mass_per_area, -2, 1, 0, 0, 0, 0, 0); // in kilograms per square meter
50 DATATYPE(mass_per_power, -2, 0, 3, 0, 0, 0, 0); // in kilograms per watt
51 DATATYPE(angular_speed, 0, 0,-1, 0, 1, 0, 0); // in degrees per second
52 DATATYPE(specific_energy, 2, 0,-2, 0, 0, 0, 0); // in joules per kilogram
53 DATATYPE(energy_per_mol, 2, 1,-2, 0, 0, 1, 0); // in joules per mol
54 DATATYPE(volume_per_time_squared,3, 0,-2, 0, 0, 0, 0); // in cubic meter per square second
55 DATATYPE(per_length, -1, 0, 0, 0, 0, 0, 0); // per meter (reciprocal)
56 DATATYPE(per_area, -2, 0, 0, 0, 0, 0, 0); // per square meter (reciprocal)
57 DATATYPE(frequency, 0, 0,-1, 0, 0, 0, 0); // per second (reciprocal)
58 DATATYPE(per_amount_of_substance,0, 0, 0, 0,-1, 0, 0); // per mol (reciprocal)
59
60} // end of namespace SI
61
62#undef DATATYPE
#define DATATYPE(_name, _lengthExp, _massExp, _timeExp, _temperatureExp, _currentExp, _substanceExp, _intensityExp)
Definition datatypes.h:6
Internal header file (providing datatypes, classes, etc.).
Definition constants.h:12
double dimensionless
to hold a quantity without any unit, e.g. 42
Definition datatypes.h:18