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.
Loading...
Searching...
No Matches
magnetic_field.h
Go to the documentation of this file.
1
12#pragma once
13
14#include "area.h"
17#include "detail/unit.h"
18#include "detail/unit_symbol.h"
19#include "magnetic_flux.h"
20
21namespace SI {
22
24template <typename _type, class _ratio = std::ratio<1>>
25using magnetic_field_t = detail::unit_t<'B', std::ratio<1>, _type, _ratio>;
26
28template <typename _type>
30template <typename _type>
32template <typename _type>
34template <typename _type>
36template <typename _type>
38template <typename _type>
40template <typename _type>
42template <typename _type>
44template <typename _type>
46template <typename _type>
48template <typename _type>
50template <typename _type>
52template <typename _type> using exa_tesla_t = magnetic_field_t<_type, std::exa>;
53
54// specialize unit_symbol for usage with stream operators
55template <>
56struct unit_symbol<'B', std::ratio<1>> : SI::detail::unit_symbol_impl<'T'> {};
57
58template <typename _ratio>
59struct unit_symbol<'B', _ratio>
60 : SI::detail::unit_symbol_impl<SI::detail::ratio_prefix<_ratio>::value,
61 'T'> {};
62
63namespace detail {
65}
66
67inline namespace literals {
68template <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
72template <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
76template <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
80template <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
84template <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
88template <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
92template <char... _digits> constexpr tesla_t<int64_t> operator""_T() {
93 return tesla_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
94}
95
96template <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
100template <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
104template <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
108template <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
112template <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
116template <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
120constexpr atto_tesla_t<long double> operator""_aT(long double value) {
121 return atto_tesla_t<long double>{value};
122}
123
124constexpr femto_tesla_t<long double> operator""_fT(long double value) {
125 return femto_tesla_t<long double>{value};
126}
127
128constexpr pico_tesla_t<long double> operator""_pT(long double value) {
129 return pico_tesla_t<long double>{value};
130}
131
132constexpr nano_tesla_t<long double> operator""_nT(long double value) {
133 return nano_tesla_t<long double>{value};
134}
135
136constexpr micro_tesla_t<long double> operator""_uT(long double value) {
137 return micro_tesla_t<long double>{value};
138}
139
140constexpr milli_tesla_t<long double> operator""_mT(long double value) {
141 return milli_tesla_t<long double>{value};
142}
143
144constexpr tesla_t<long double> operator""_T(long double value) {
145 return tesla_t<long double>{value};
146}
147
148constexpr kilo_tesla_t<long double> operator""_kT(long double value) {
149 return kilo_tesla_t<long double>{value};
150}
151
152constexpr mega_tesla_t<long double> operator""_MT(long double value) {
153 return mega_tesla_t<long double>{value};
154}
155
156constexpr giga_tesla_t<long double> operator""_GT(long double value) {
157 return giga_tesla_t<long double>{value};
158}
159
160constexpr tera_tesla_t<long double> operator""_TT(long double value) {
161 return tera_tesla_t<long double>{value};
162}
163
164constexpr peta_tesla_t<long double> operator""_PT(long double value) {
165 return peta_tesla_t<long double>{value};
166}
167
168constexpr 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
Definition absorbed_dose.h:18
#define BUILD_UNIT_FROM_DIVISION(RESULTING_UNIT_T, DIVIDEND_UNIT_T, DIVISOR_UNIT_T)
Definition operator_helpers.h:22
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