Physical Quantities  v1.0.0
C++ library of physical quantities, physical models, and units of measure for scientific computing. https://github.com/acodcha/phq
Loading...
Searching...
No Matches
AngularAcceleration.hpp
Go to the documentation of this file.
1// Copyright © 2020-2024 Alexandre Coderre-Chabot
2//
3// This file is part of Physical Quantities (PhQ), a C++ library of physical quantities, physical
4// models, and units of measure for scientific computing.
5//
6// Physical Quantities is hosted at:
7// https://github.com/acodcha/phq
8//
9// Physical Quantities is licensed under the MIT License:
10// https://mit-license.org
11//
12// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
13// associated documentation files (the "Software"), to deal in the Software without restriction,
14// including without limitation the rights to use, copy, modify, merge, publish, distribute,
15// sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
16// furnished to do so, subject to the following conditions:
17// - The above copyright notice and this permission notice shall be included in all copies or
18// substantial portions of the Software.
19// - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
20// BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
22// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM
23// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
25#ifndef PHQ_UNIT_ANGULAR_ACCELERATION_HPP
26#define PHQ_UNIT_ANGULAR_ACCELERATION_HPP
27
28#include <cstddef>
29#include <cstdint>
30#include <functional>
31#include <map>
32#include <ostream>
33#include <string_view>
34#include <unordered_map>
35
36#include "../Base.hpp"
37#include "../Dimension/ElectricCurrent.hpp"
38#include "../Dimension/Length.hpp"
39#include "../Dimension/LuminousIntensity.hpp"
40#include "../Dimension/Mass.hpp"
41#include "../Dimension/SubstanceAmount.hpp"
42#include "../Dimension/Temperature.hpp"
43#include "../Dimension/Time.hpp"
44#include "../Dimensions.hpp"
45#include "../Unit.hpp"
46#include "../UnitSystem.hpp"
47
48namespace PhQ {
49
50namespace Unit {
51
52/// \brief Angular acceleration units.
53enum class AngularAcceleration : int8_t {
54 /// \brief Radian per square second (rad/s^2) angular acceleration unit.
56
57 /// \brief Radian per square minute (rad/min^2) angular acceleration unit.
59
60 /// \brief Radian per square hour (rad/hr^2) angular acceleration unit.
62
63 /// \brief Degree per square second (deg/s^2) angular acceleration unit.
65
66 /// \brief Degree per square minute (deg/min^2) angular acceleration unit.
68
69 /// \brief Degree per square hour (deg/hr^2) angular acceleration unit.
71
72 /// \brief Arcminute per square second (arcmin/s^2) angular acceleration unit.
74
75 /// \brief Arcminute per square minute (arcmin/min^2) angular acceleration unit.
77
78 /// \brief Arcminute per square hour (arcmin/hr^2) angular acceleration unit.
80
81 /// \brief Arcsecond per square second (arcsec/s^2) angular acceleration unit.
83
84 /// \brief Arcsecond per square minute (arcsec/min^2) angular acceleration unit.
86
87 /// \brief Arcsecond per square hour (arcsec/hr^2) angular acceleration unit.
89
90 /// \brief Revolution per square second (rev/s^2) angular acceleration unit.
92
93 /// \brief Revolution per square minute (rev/min^2) angular acceleration unit.
95
96 /// \brief Revolution per square hour (rev/hr^2) angular acceleration unit.
98};
99
100} // namespace Unit
101
102/// \brief Standard angular acceleration unit: radian per square second (rad/s^2).
103template <>
104inline constexpr const Unit::AngularAcceleration Standard<Unit::AngularAcceleration>{
106
107/// \brief Physical dimension set of angular acceleration units.
108template <>
109inline constexpr const Dimensions RelatedDimensions<Unit::AngularAcceleration>{
110 Dimensions{Dimension::Time{-2}, Dimension::Length{0}, Dimension::Mass{0},
111 Dimension::ElectricCurrent{0}, Dimension::Temperature{0},
112 Dimension::SubstanceAmount{0}, Dimension::LuminousIntensity{0}}
113};
114
115inline std::ostream& operator<<(std::ostream& stream, const Unit::AngularAcceleration unit) {
116 stream << Abbreviation(unit);
117 return stream;
118}
119
120namespace Internal {
121
122template <>
123inline const std::map<UnitSystem, Unit::AngularAcceleration>
124 ConsistentUnits<Unit::AngularAcceleration>{
129};
130
131template <>
132inline const std::map<Unit::AngularAcceleration, UnitSystem>
133 RelatedUnitSystems<Unit::AngularAcceleration>{};
134
135template <>
136inline const std::map<Unit::AngularAcceleration, std::string_view>
137 Abbreviations<Unit::AngularAcceleration>{
153};
154
155// clang-format off
156
157template <>
158inline const std::unordered_map<std::string_view, Unit::AngularAcceleration> Spellings<
214};
215
216// clang-format on
217
218template <>
219template <typename NumericType>
220inline constexpr void
221Conversion<Unit::AngularAcceleration, Unit::AngularAcceleration::RadianPerSquareSecond>::
222 FromStandard(NumericType& /*value*/) noexcept {}
223
224template <>
225template <typename NumericType>
226inline constexpr void
227Conversion<Unit::AngularAcceleration, Unit::AngularAcceleration::RadianPerSquareSecond>::ToStandard(
228 NumericType& /*value*/) noexcept {}
229
230template <>
231template <typename NumericType>
232inline constexpr void
233Conversion<Unit::AngularAcceleration, Unit::AngularAcceleration::RadianPerSquareMinute>::
234 FromStandard(NumericType& value) noexcept {
235 value *= static_cast<NumericType>(3600.0L);
236}
237
238template <>
239template <typename NumericType>
240inline constexpr void
241Conversion<Unit::AngularAcceleration, Unit::AngularAcceleration::RadianPerSquareMinute>::ToStandard(
242 NumericType& value) noexcept {
243 value /= static_cast<NumericType>(3600.0L);
244}
245
246template <>
247template <typename NumericType>
248inline constexpr void
249Conversion<Unit::AngularAcceleration, Unit::AngularAcceleration::RadianPerSquareHour>::FromStandard(
250 NumericType& value) noexcept {
251 value *= static_cast<NumericType>(12960000.0L);
252}
253
254template <>
255template <typename NumericType>
256inline constexpr void
257Conversion<Unit::AngularAcceleration, Unit::AngularAcceleration::RadianPerSquareHour>::ToStandard(
258 NumericType& value) noexcept {
259 value /= static_cast<NumericType>(12960000.0L);
260}
261
262template <>
263template <typename NumericType>
264inline constexpr void
265Conversion<Unit::AngularAcceleration, Unit::AngularAcceleration::DegreePerSquareSecond>::
266 FromStandard(NumericType& value) noexcept {
267 value *= static_cast<NumericType>(180.0L) / Pi<NumericType>;
268}
269
270template <>
271template <typename NumericType>
272inline constexpr void
273Conversion<Unit::AngularAcceleration, Unit::AngularAcceleration::DegreePerSquareSecond>::ToStandard(
274 NumericType& value) noexcept {
275 value *= Pi<NumericType> / static_cast<NumericType>(180.0L);
276}
277
278template <>
279template <typename NumericType>
280inline constexpr void
281Conversion<Unit::AngularAcceleration, Unit::AngularAcceleration::DegreePerSquareMinute>::
282 FromStandard(NumericType& value) noexcept {
283 value *= static_cast<NumericType>(648000.0L) / Pi<NumericType>;
284}
285
286template <>
287template <typename NumericType>
288inline constexpr void
289Conversion<Unit::AngularAcceleration, Unit::AngularAcceleration::DegreePerSquareMinute>::ToStandard(
290 NumericType& value) noexcept {
291 value *= Pi<NumericType> / static_cast<NumericType>(648000.0L);
292}
293
294template <>
295template <typename NumericType>
296inline constexpr void
297Conversion<Unit::AngularAcceleration, Unit::AngularAcceleration::DegreePerSquareHour>::FromStandard(
298 NumericType& value) noexcept {
299 value *= static_cast<NumericType>(2332800000.0L) / Pi<NumericType>;
300}
301
302template <>
303template <typename NumericType>
304inline constexpr void
305Conversion<Unit::AngularAcceleration, Unit::AngularAcceleration::DegreePerSquareHour>::ToStandard(
306 NumericType& value) noexcept {
307 value *= Pi<NumericType> / static_cast<NumericType>(2332800000.0L);
308}
309
310template <>
311template <typename NumericType>
312inline constexpr void
313Conversion<Unit::AngularAcceleration, Unit::AngularAcceleration::ArcminutePerSquareSecond>::
314 FromStandard(NumericType& value) noexcept {
315 value *= static_cast<NumericType>(10800.0L) / Pi<NumericType>;
316}
317
318template <>
319template <typename NumericType>
320inline constexpr void
321Conversion<Unit::AngularAcceleration, Unit::AngularAcceleration::ArcminutePerSquareSecond>::
322 ToStandard(NumericType& value) noexcept {
323 value *= Pi<NumericType> / static_cast<NumericType>(10800.0L);
324}
325
326template <>
327template <typename NumericType>
328inline constexpr void
329Conversion<Unit::AngularAcceleration, Unit::AngularAcceleration::ArcminutePerSquareMinute>::
330 FromStandard(NumericType& value) noexcept {
331 value *= static_cast<NumericType>(38880000.0L) / Pi<NumericType>;
332}
333
334template <>
335template <typename NumericType>
336inline constexpr void
337Conversion<Unit::AngularAcceleration, Unit::AngularAcceleration::ArcminutePerSquareMinute>::
338 ToStandard(NumericType& value) noexcept {
339 value *= Pi<NumericType> / static_cast<NumericType>(38880000.0L);
340}
341
342template <>
343template <typename NumericType>
344inline constexpr void
345Conversion<Unit::AngularAcceleration, Unit::AngularAcceleration::ArcminutePerSquareHour>::
346 FromStandard(NumericType& value) noexcept {
347 value *= static_cast<NumericType>(139968000000.0L) / Pi<NumericType>;
348}
349
350template <>
351template <typename NumericType>
352inline constexpr void
353Conversion<Unit::AngularAcceleration, Unit::AngularAcceleration::ArcminutePerSquareHour>::
354 ToStandard(NumericType& value) noexcept {
355 value *= Pi<NumericType> / static_cast<NumericType>(139968000000.0L);
356}
357
358template <>
359template <typename NumericType>
360inline constexpr void
361Conversion<Unit::AngularAcceleration, Unit::AngularAcceleration::ArcsecondPerSquareSecond>::
362 FromStandard(NumericType& value) noexcept {
363 value *= static_cast<NumericType>(648000.0L) / Pi<NumericType>;
364}
365
366template <>
367template <typename NumericType>
368inline constexpr void
369Conversion<Unit::AngularAcceleration, Unit::AngularAcceleration::ArcsecondPerSquareSecond>::
370 ToStandard(NumericType& value) noexcept {
371 value *= Pi<NumericType> / static_cast<NumericType>(648000.0L);
372}
373
374template <>
375template <typename NumericType>
376inline constexpr void
377Conversion<Unit::AngularAcceleration, Unit::AngularAcceleration::ArcsecondPerSquareMinute>::
378 FromStandard(NumericType& value) noexcept {
379 value *= static_cast<NumericType>(2332800000.0L) / Pi<NumericType>;
380}
381
382template <>
383template <typename NumericType>
384inline constexpr void
385Conversion<Unit::AngularAcceleration, Unit::AngularAcceleration::ArcsecondPerSquareMinute>::
386 ToStandard(NumericType& value) noexcept {
387 value *= Pi<NumericType> / static_cast<NumericType>(2332800000.0L);
388}
389
390template <>
391template <typename NumericType>
392inline constexpr void
393Conversion<Unit::AngularAcceleration, Unit::AngularAcceleration::ArcsecondPerSquareHour>::
394 FromStandard(NumericType& value) noexcept {
395 value *= static_cast<NumericType>(8398080000000.0L) / Pi<NumericType>;
396}
397
398template <>
399template <typename NumericType>
400inline constexpr void
401Conversion<Unit::AngularAcceleration, Unit::AngularAcceleration::ArcsecondPerSquareHour>::
402 ToStandard(NumericType& value) noexcept {
403 value *= Pi<NumericType> / static_cast<NumericType>(8398080000000.0L);
404}
405
406template <>
407template <typename NumericType>
408inline constexpr void
409Conversion<Unit::AngularAcceleration, Unit::AngularAcceleration::RevolutionPerSquareSecond>::
410 FromStandard(NumericType& value) noexcept {
411 value *= static_cast<NumericType>(0.5L) / Pi<NumericType>;
412}
413
414template <>
415template <typename NumericType>
416inline constexpr void
417Conversion<Unit::AngularAcceleration, Unit::AngularAcceleration::RevolutionPerSquareSecond>::
418 ToStandard(NumericType& value) noexcept {
419 value *= static_cast<NumericType>(2.0L) * Pi<NumericType>;
420}
421
422template <>
423template <typename NumericType>
424inline constexpr void
425Conversion<Unit::AngularAcceleration, Unit::AngularAcceleration::RevolutionPerSquareMinute>::
426 FromStandard(NumericType& value) noexcept {
427 value *= static_cast<NumericType>(1800.0L) / Pi<NumericType>;
428}
429
430template <>
431template <typename NumericType>
432inline constexpr void
433Conversion<Unit::AngularAcceleration, Unit::AngularAcceleration::RevolutionPerSquareMinute>::
434 ToStandard(NumericType& value) noexcept {
435 value *= Pi<NumericType> / static_cast<NumericType>(1800.0L);
436}
437
438template <>
439template <typename NumericType>
440inline constexpr void
441Conversion<Unit::AngularAcceleration, Unit::AngularAcceleration::RevolutionPerSquareHour>::
442 FromStandard(NumericType& value) noexcept {
443 value *= static_cast<NumericType>(6480000.0L) / Pi<NumericType>;
444}
445
446template <>
447template <typename NumericType>
448inline constexpr void
449Conversion<Unit::AngularAcceleration, Unit::AngularAcceleration::RevolutionPerSquareHour>::
450 ToStandard(NumericType& value) noexcept {
451 value *= Pi<NumericType> / static_cast<NumericType>(6480000.0L);
452}
453
454template <typename NumericType>
455inline const std::map<Unit::AngularAcceleration,
456 std::function<void(NumericType* values, const std::size_t size)>>
457 MapOfConversionsFromStandard<Unit::AngularAcceleration, NumericType>{
459 Conversions<Unit::AngularAcceleration, Unit::AngularAcceleration::RadianPerSquareSecond>::
460 FromStandard<NumericType>},
462 Conversions<Unit::AngularAcceleration, Unit::AngularAcceleration::RadianPerSquareMinute>::
463 FromStandard<NumericType>},
465 Conversions<Unit::AngularAcceleration, Unit::AngularAcceleration::RadianPerSquareHour>::
466 FromStandard<NumericType>},
468 Conversions<Unit::AngularAcceleration, Unit::AngularAcceleration::DegreePerSquareSecond>::
469 FromStandard<NumericType>},
471 Conversions<Unit::AngularAcceleration, Unit::AngularAcceleration::DegreePerSquareMinute>::
472 FromStandard<NumericType>},
474 Conversions<Unit::AngularAcceleration, Unit::AngularAcceleration::DegreePerSquareHour>::
475 FromStandard<NumericType>},
477 Conversions<Unit::AngularAcceleration, Unit::AngularAcceleration::ArcminutePerSquareSecond>::
478 FromStandard<NumericType>},
480 Conversions<Unit::AngularAcceleration, Unit::AngularAcceleration::ArcminutePerSquareMinute>::
481 FromStandard<NumericType>},
483 Conversions<Unit::AngularAcceleration, Unit::AngularAcceleration::ArcminutePerSquareHour>::
484 FromStandard<NumericType>},
486 Conversions<Unit::AngularAcceleration, Unit::AngularAcceleration::ArcsecondPerSquareSecond>::
487 FromStandard<NumericType>},
489 Conversions<Unit::AngularAcceleration, Unit::AngularAcceleration::ArcsecondPerSquareMinute>::
490 FromStandard<NumericType>},
492 Conversions<Unit::AngularAcceleration, Unit::AngularAcceleration::ArcsecondPerSquareHour>::
493 FromStandard<NumericType>},
495 Conversions<Unit::AngularAcceleration,
497 FromStandard<NumericType> },
499 Conversions<Unit::AngularAcceleration,
501 FromStandard<NumericType> },
503 Conversions<Unit::AngularAcceleration, Unit::AngularAcceleration::RevolutionPerSquareHour>::
504 FromStandard<NumericType>},
505};
506
507template <typename NumericType>
508inline const std::map<Unit::AngularAcceleration,
509 std::function<void(NumericType* const values, const std::size_t size)>>
510 MapOfConversionsToStandard<Unit::AngularAcceleration, NumericType>{
512 Conversions<Unit::AngularAcceleration, Unit::AngularAcceleration::RadianPerSquareSecond>::
513 ToStandard<NumericType> },
515 Conversions<Unit::AngularAcceleration, Unit::AngularAcceleration::RadianPerSquareMinute>::
516 ToStandard<NumericType> },
518 Conversions<Unit::AngularAcceleration, Unit::AngularAcceleration::RadianPerSquareHour>::
519 ToStandard<NumericType> },
521 Conversions<Unit::AngularAcceleration, Unit::AngularAcceleration::DegreePerSquareSecond>::
522 ToStandard<NumericType> },
524 Conversions<Unit::AngularAcceleration, Unit::AngularAcceleration::DegreePerSquareMinute>::
525 ToStandard<NumericType> },
527 Conversions<Unit::AngularAcceleration, Unit::AngularAcceleration::DegreePerSquareHour>::
528 ToStandard<NumericType> },
530 Conversions<Unit::AngularAcceleration, Unit::AngularAcceleration::ArcminutePerSquareSecond>::
531 ToStandard<NumericType> },
533 Conversions<Unit::AngularAcceleration, Unit::AngularAcceleration::ArcminutePerSquareMinute>::
534 ToStandard<NumericType> },
536 Conversions<Unit::AngularAcceleration, Unit::AngularAcceleration::ArcminutePerSquareHour>::
537 ToStandard<NumericType> },
539 Conversions<Unit::AngularAcceleration, Unit::AngularAcceleration::ArcsecondPerSquareSecond>::
540 ToStandard<NumericType> },
542 Conversions<Unit::AngularAcceleration, Unit::AngularAcceleration::ArcsecondPerSquareMinute>::
543 ToStandard<NumericType> },
545 Conversions<Unit::AngularAcceleration, Unit::AngularAcceleration::ArcsecondPerSquareHour>::
546 ToStandard<NumericType> },
548 Conversions<Unit::AngularAcceleration,
551 Conversions<Unit::AngularAcceleration,
554 Conversions<Unit::AngularAcceleration, Unit::AngularAcceleration::RevolutionPerSquareHour>::
555 ToStandard<NumericType> },
556};
557
558} // namespace Internal
559
560} // namespace PhQ
561
562#endif // PHQ_UNIT_ANGULAR_ACCELERATION_HPP
AngularAcceleration
Angular acceleration units.
@ ArcminutePerSquareMinute
Arcminute per square minute (arcmin/min^2) angular acceleration unit.
@ RevolutionPerSquareMinute
Revolution per square minute (rev/min^2) angular acceleration unit.
@ DegreePerSquareSecond
Degree per square second (deg/s^2) angular acceleration unit.
@ ArcminutePerSquareHour
Arcminute per square hour (arcmin/hr^2) angular acceleration unit.
@ RadianPerSquareHour
Radian per square hour (rad/hr^2) angular acceleration unit.
@ DegreePerSquareHour
Degree per square hour (deg/hr^2) angular acceleration unit.
@ RevolutionPerSquareSecond
Revolution per square second (rev/s^2) angular acceleration unit.
@ ArcsecondPerSquareSecond
Arcsecond per square second (arcsec/s^2) angular acceleration unit.
@ ArcsecondPerSquareHour
Arcsecond per square hour (arcsec/hr^2) angular acceleration unit.
@ ArcminutePerSquareSecond
Arcminute per square second (arcmin/s^2) angular acceleration unit.
@ ArcsecondPerSquareMinute
Arcsecond per square minute (arcsec/min^2) angular acceleration unit.
@ DegreePerSquareMinute
Degree per square minute (deg/min^2) angular acceleration unit.
@ RadianPerSquareMinute
Radian per square minute (rad/min^2) angular acceleration unit.
@ RevolutionPerSquareHour
Revolution per square hour (rev/hr^2) angular acceleration unit.
@ RadianPerSquareSecond
Radian per square second (rad/s^2) angular acceleration unit.
Namespace that encompasses all of the Physical Quantities library's content.
std::ostream & operator<<(std::ostream &stream, const Acceleration< NumericType > &acceleration)
@ FootPoundSecondRankine
Foot-pound-second-rankine (ft·lbf·s·°R) system.
@ MillimetreGramSecondKelvin
Millimetre-gram-second-kelvin (mm·g·s·K) system.
@ MetreKilogramSecondKelvin
Metre-kilogram-second-kelvin (m·kg·s·K) system.
@ InchPoundSecondRankine
Inch-pound-second-rankine (in·lbf·s·°R) system.
std::string_view Abbreviation(const Enumeration enumeration)
Returns the abbreviation of a given enumeration value. For example, PhQ::Abbreviation(PhQ::Unit::Time...
Definition Base.hpp:89