SI  2.5.4
A header only c++ library that provides type safety and user defined literals for handling physical values defined in the International System of Units.
magnetic_field.h
Go to the documentation of this file.
1 
12 #pragma once
13 
14 #include "area.h"
15 #include "detail/number_parser.h"
17 #include "detail/unit.h"
18 #include "detail/unit_symbol.h"
19 #include "magnetic_flux.h"
20 
21 namespace SI {
22 
24 template <typename _type, class _ratio = std::ratio<1>>
26 
28 template <typename _type>
30 template <typename _type>
32 template <typename _type>
34 template <typename _type>
36 template <typename _type>
38 template <typename _type>
40 template <typename _type>
42 template <typename _type>
44 template <typename _type>
46 template <typename _type>
48 template <typename _type>
50 template <typename _type>
52 template <typename _type> using exa_tesla_t = magnetic_field_t<_type, std::exa>;
53 
54 // specialize unit_symbol for usage with stream operators
55 template <>
56 struct unit_symbol<'B', std::ratio<1>> : SI::detail::unit_symbol_impl<'T'> {};
57 
58 template <typename _ratio>
59 struct unit_symbol<'B', _ratio>
60  : SI::detail::unit_symbol_impl<SI::detail::ratio_prefix<_ratio>::value,
61  'T'> {};
62 
63 namespace detail {
65 }
66 
67 inline namespace literals {
68 template <char... _digits> constexpr atto_tesla_t<int64_t> operator""_aT() {
69  return atto_tesla_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
70 }
71 
72 template <char... _digits> constexpr femto_tesla_t<int64_t> operator""_fT() {
73  return femto_tesla_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
74 }
75 
76 template <char... _digits> constexpr pico_tesla_t<int64_t> operator""_pT() {
77  return pico_tesla_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
78 }
79 
80 template <char... _digits> constexpr nano_tesla_t<int64_t> operator""_nT() {
81  return nano_tesla_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
82 }
83 
84 template <char... _digits> constexpr micro_tesla_t<int64_t> operator""_uT() {
85  return micro_tesla_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
86 }
87 
88 template <char... _digits> constexpr milli_tesla_t<int64_t> operator""_mT() {
89  return milli_tesla_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
90 }
91 
92 template <char... _digits> constexpr tesla_t<int64_t> operator""_T() {
93  return tesla_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
94 }
95 
96 template <char... _digits> constexpr kilo_tesla_t<int64_t> operator""_kT() {
97  return kilo_tesla_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
98 }
99 
100 template <char... _digits> constexpr mega_tesla_t<int64_t> operator""_MT() {
101  return mega_tesla_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
102 }
103 
104 template <char... _digits> constexpr giga_tesla_t<int64_t> operator""_GT() {
105  return giga_tesla_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
106 }
107 
108 template <char... _digits> constexpr tera_tesla_t<int64_t> operator""_TT() {
109  return tera_tesla_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
110 }
111 
112 template <char... _digits> constexpr peta_tesla_t<int64_t> operator""_PT() {
113  return peta_tesla_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
114 }
115 
116 template <char... _digits> constexpr exa_tesla_t<int64_t> operator""_ET() {
117  return exa_tesla_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
118 }
119 
120 constexpr atto_tesla_t<long double> operator""_aT(long double value) {
121  return atto_tesla_t<long double>{value};
122 }
123 
124 constexpr femto_tesla_t<long double> operator""_fT(long double value) {
125  return femto_tesla_t<long double>{value};
126 }
127 
128 constexpr pico_tesla_t<long double> operator""_pT(long double value) {
129  return pico_tesla_t<long double>{value};
130 }
131 
132 constexpr nano_tesla_t<long double> operator""_nT(long double value) {
133  return nano_tesla_t<long double>{value};
134 }
135 
136 constexpr micro_tesla_t<long double> operator""_uT(long double value) {
137  return micro_tesla_t<long double>{value};
138 }
139 
140 constexpr milli_tesla_t<long double> operator""_mT(long double value) {
141  return milli_tesla_t<long double>{value};
142 }
143 
144 constexpr tesla_t<long double> operator""_T(long double value) {
145  return tesla_t<long double>{value};
146 }
147 
148 constexpr kilo_tesla_t<long double> operator""_kT(long double value) {
149  return kilo_tesla_t<long double>{value};
150 }
151 
152 constexpr mega_tesla_t<long double> operator""_MT(long double value) {
153  return mega_tesla_t<long double>{value};
154 }
155 
156 constexpr giga_tesla_t<long double> operator""_GT(long double value) {
157  return giga_tesla_t<long double>{value};
158 }
159 
160 constexpr tera_tesla_t<long double> operator""_TT(long double value) {
161  return tera_tesla_t<long double>{value};
162 }
163 
164 constexpr peta_tesla_t<long double> operator""_PT(long double value) {
165  return peta_tesla_t<long double>{value};
166 }
167 
168 constexpr exa_tesla_t<long double> operator""_ET(long double value) {
169  return exa_tesla_t<long double>{value};
170 }
171 
172 } // namespace literals
173 } // namespace SI
BUILD_UNIT_FROM_DIVISION(electric_conductance_t, electric_current_t, electric_potential_t) template< typename _type
Definition: absorbed_dose.h:18
interface class for number
Definition: number_parser.h:111
Compile time string provider for conversion of unit types to strings.
Definition: unit_symbol.h:21
base template class for holding values of type _type to be multiplied with a ratio _ratio
Definition: unit.h:51
Base struct. Unusable needs template overloading.
Definition: unit_symbol.h:64