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
Speed.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_SPEED_HPP
26#define PHQ_UNIT_SPEED_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 Speed units.
53enum class Speed : int8_t {
54 /// \brief Metre per second (m/s) speed unit.
56
57 /// \brief Metre per minute (m/min) speed unit.
59
60 /// \brief Metre per hour (m/hr) speed unit.
62
63 /// \brief Nautical mile per second (nmi/s) speed unit.
65
66 /// \brief Nautical mile per minute (nmi/min) speed unit.
68
69 /// \brief Knot (kn) speed unit, also known as nautical mile per hour.
70 Knot,
71
72 /// \brief Mile per second (mi/s) speed unit.
74
75 /// \brief Mile per minute (mi/min) speed unit.
77
78 /// \brief Mile per hour (mi/hr) speed unit.
80
81 /// \brief Kilometre per second (km/s) speed unit.
83
84 /// \brief Kilometre per minute (km/min) speed unit.
86
87 /// \brief Kilometre per hour (km/hr) speed unit.
89
90 /// \brief Yard per second (yd/s) speed unit.
92
93 /// \brief Yard per minute (yd/min) speed unit.
95
96 /// \brief Yard per hour (yd/hr) speed unit.
98
99 /// \brief Foot per second (ft/s) speed unit.
101
102 /// \brief Foot per minute (ft/min) speed unit.
104
105 /// \brief Foot per hour (ft/hr) speed unit.
107
108 /// \brief Decimetre per second (dm/s) speed unit.
110
111 /// \brief Decimetre per minute (dm/min) speed unit.
113
114 /// \brief Decimetre per hour (dm/hr) speed unit.
116
117 /// \brief Inch per second (in/s) speed unit.
119
120 /// \brief Inch per minute (in/min) speed unit.
122
123 /// \brief Inch per hour (in/hr) speed unit.
125
126 /// \brief Centimetre per second (cm/s) speed unit.
128
129 /// \brief Centimetre per minute (cm/min) speed unit.
131
132 /// \brief Centimetre per hour (cm/hr) speed unit.
134
135 /// \brief Millimetre per second (mm/s) speed unit.
137
138 /// \brief Millimetre per minute (mm/min) speed unit.
140
141 /// \brief Millimetre per hour (mm/hr) speed unit.
143
144 /// \brief Milliinch per second (mil/s) speed unit.
146
147 /// \brief Milliinch per minute (mil/min) speed unit.
149
150 /// \brief Milliinch per hour (mil/hr) speed unit.
152
153 /// \brief Micrometre per second (μm/s) speed unit.
155
156 /// \brief Micrometre per minute (μm/min) speed unit.
158
159 /// \brief Micrometre per hour (μm/hr) speed unit.
161
162 /// \brief Microinch per second (μin/s) speed unit.
164
165 /// \brief Microinch per minute (μin/min) speed unit.
167
168 /// \brief Microinch per hour (μin/hr) speed unit.
170};
171
172} // namespace Unit
173
174/// \brief Standard speed unit: metre per second (m/s).
175template <>
176inline constexpr const Unit::Speed Standard<Unit::Speed>{Unit::Speed::MetrePerSecond};
177
178/// \brief Physical dimension set of speed units.
179template <>
180inline constexpr const Dimensions RelatedDimensions<Unit::Speed>{
181 Dimensions{Dimension::Time{-1}, Dimension::Length{1}, Dimension::Mass{0},
182 Dimension::ElectricCurrent{0}, Dimension::Temperature{0},
183 Dimension::SubstanceAmount{0}, Dimension::LuminousIntensity{0}}
184};
185
186inline std::ostream& operator<<(std::ostream& stream, const Unit::Speed unit) {
187 stream << Abbreviation(unit);
188 return stream;
189}
190
191namespace Internal {
192
193template <>
194inline const std::map<UnitSystem, Unit::Speed> ConsistentUnits<Unit::Speed>{
199};
200
201template <>
202inline const std::map<Unit::Speed, UnitSystem> RelatedUnitSystems<Unit::Speed>{
207};
208
209// clang-format off
210
211template <>
212inline const std::map<Unit::Speed, std::string_view> Abbreviations<Unit::Speed>{
214 {Unit::Speed::MetrePerMinute, "m/min" },
215 {Unit::Speed::MetrePerHour, "m/hr" },
218 {Unit::Speed::Knot, "kn" },
220 {Unit::Speed::MilePerMinute, "mi/min" },
221 {Unit::Speed::MilePerHour, "mi/hr" },
226 {Unit::Speed::YardPerMinute, "yd/min" },
227 {Unit::Speed::YardPerHour, "yd/hr" },
229 {Unit::Speed::FootPerMinute, "ft/min" },
230 {Unit::Speed::FootPerHour, "ft/hr" },
235 {Unit::Speed::InchPerMinute, "in/min" },
236 {Unit::Speed::InchPerHour, "in/hr" },
251 {Unit::Speed::MicroinchPerHour, "μin/hr" },
252};
253
254template <>
255inline const std::unordered_map<std::string_view, Unit::Speed> Spellings<Unit::Speed>{
257 {"m/min", Unit::Speed::MetrePerMinute },
258 {"m/hr", Unit::Speed::MetrePerHour },
261 {"kn", Unit::Speed::Knot },
262 {"knot", Unit::Speed::Knot },
263 {"knots", Unit::Speed::Knot },
264 {"nmi/hr", Unit::Speed::Knot },
266 {"mi/min", Unit::Speed::MilePerMinute },
267 {"mi/hr", Unit::Speed::MilePerHour },
272 {"yd/min", Unit::Speed::YardPerMinute },
273 {"yd/hr", Unit::Speed::YardPerHour },
275 {"ft/min", Unit::Speed::FootPerMinute },
276 {"ft/hr", Unit::Speed::FootPerHour },
281 {"in/min", Unit::Speed::InchPerMinute },
282 {"in/hr", Unit::Speed::InchPerHour },
290 {"milin/min", Unit::Speed::MilliinchPerMinute },
291 {"milin/hr", Unit::Speed::MilliinchPerHour },
292 {"milliinch/s", Unit::Speed::MilliinchPerSecond },
293 {"milliinch/min", Unit::Speed::MilliinchPerMinute },
294 {"milliinch/hr", Unit::Speed::MilliinchPerHour },
299 {"thou/min", Unit::Speed::MilliinchPerMinute },
300 {"thou/hr", Unit::Speed::MilliinchPerHour },
308 {"μin/min", Unit::Speed::MicroinchPerMinute },
309 {"μin/hr", Unit::Speed::MicroinchPerHour },
313};
314
315// clang-format on
316
317template <>
318template <typename NumericType>
319inline constexpr void Conversion<Unit::Speed, Unit::Speed::MetrePerSecond>::FromStandard(
320 NumericType& /*value*/) noexcept {}
321
322template <>
323template <typename NumericType>
324inline constexpr void Conversion<Unit::Speed, Unit::Speed::MetrePerSecond>::ToStandard(
325 NumericType& /*value*/) noexcept {}
326
327template <>
328template <typename NumericType>
329inline constexpr void Conversion<Unit::Speed, Unit::Speed::MetrePerMinute>::FromStandard(
330 NumericType& value) noexcept {
331 value *= static_cast<NumericType>(60.0L);
332}
333
334template <>
335template <typename NumericType>
336inline constexpr void Conversion<Unit::Speed, Unit::Speed::MetrePerMinute>::ToStandard(
337 NumericType& value) noexcept {
338 value /= static_cast<NumericType>(60.0L);
339}
340
341template <>
342template <typename NumericType>
343inline constexpr void Conversion<Unit::Speed, Unit::Speed::MetrePerHour>::FromStandard(
344 NumericType& value) noexcept {
345 value *= static_cast<NumericType>(3600.0L);
346}
347
348template <>
349template <typename NumericType>
350inline constexpr void Conversion<Unit::Speed, Unit::Speed::MetrePerHour>::ToStandard(
351 NumericType& value) noexcept {
352 value /= static_cast<NumericType>(3600.0L);
353}
354
355template <>
356template <typename NumericType>
357inline constexpr void Conversion<Unit::Speed, Unit::Speed::NauticalMilePerSecond>::FromStandard(
358 NumericType& value) noexcept {
359 value /= static_cast<NumericType>(1852.0L);
360}
361
362template <>
363template <typename NumericType>
364inline constexpr void Conversion<Unit::Speed, Unit::Speed::NauticalMilePerSecond>::ToStandard(
365 NumericType& value) noexcept {
366 value *= static_cast<NumericType>(1852.0L);
367}
368
369template <>
370template <typename NumericType>
371inline constexpr void Conversion<Unit::Speed, Unit::Speed::NauticalMilePerMinute>::FromStandard(
372 NumericType& value) noexcept {
373 value *= static_cast<NumericType>(60.0L) / static_cast<NumericType>(1852.0L);
374}
375
376template <>
377template <typename NumericType>
378inline constexpr void Conversion<Unit::Speed, Unit::Speed::NauticalMilePerMinute>::ToStandard(
379 NumericType& value) noexcept {
380 value *= static_cast<NumericType>(1852.0L) / static_cast<NumericType>(60.0L);
381}
382
383template <>
384template <typename NumericType>
385inline constexpr void Conversion<Unit::Speed, Unit::Speed::Knot>::FromStandard(
386 NumericType& value) noexcept {
387 value *= static_cast<NumericType>(3600.0L) / static_cast<NumericType>(1852.0L);
388}
389
390template <>
391template <typename NumericType>
392inline constexpr void Conversion<Unit::Speed, Unit::Speed::Knot>::ToStandard(
393 NumericType& value) noexcept {
394 value *= static_cast<NumericType>(1852.0L) / static_cast<NumericType>(3600.0L);
395}
396
397template <>
398template <typename NumericType>
399inline constexpr void Conversion<Unit::Speed, Unit::Speed::MilePerSecond>::FromStandard(
400 NumericType& value) noexcept {
401 value /= static_cast<NumericType>(1609.344L);
402}
403
404template <>
405template <typename NumericType>
406inline constexpr void Conversion<Unit::Speed, Unit::Speed::MilePerSecond>::ToStandard(
407 NumericType& value) noexcept {
408 value *= static_cast<NumericType>(1609.344L);
409}
410
411template <>
412template <typename NumericType>
413inline constexpr void Conversion<Unit::Speed, Unit::Speed::MilePerMinute>::FromStandard(
414 NumericType& value) noexcept {
415 value *= static_cast<NumericType>(60.0L) / static_cast<NumericType>(1609.344L);
416}
417
418template <>
419template <typename NumericType>
420inline constexpr void Conversion<Unit::Speed, Unit::Speed::MilePerMinute>::ToStandard(
421 NumericType& value) noexcept {
422 value *= static_cast<NumericType>(1609.344L) / static_cast<NumericType>(60.0L);
423}
424
425template <>
426template <typename NumericType>
427inline constexpr void Conversion<Unit::Speed, Unit::Speed::MilePerHour>::FromStandard(
428 NumericType& value) noexcept {
429 value *= static_cast<NumericType>(3600.0L) / static_cast<NumericType>(1609.344L);
430}
431
432template <>
433template <typename NumericType>
434inline constexpr void Conversion<Unit::Speed, Unit::Speed::MilePerHour>::ToStandard(
435 NumericType& value) noexcept {
436 value *= static_cast<NumericType>(1609.344L) / static_cast<NumericType>(3600.0L);
437}
438
439template <>
440template <typename NumericType>
441inline constexpr void Conversion<Unit::Speed, Unit::Speed::KilometrePerSecond>::FromStandard(
442 NumericType& value) noexcept {
443 value *= static_cast<NumericType>(0.001L);
444}
445
446template <>
447template <typename NumericType>
448inline constexpr void Conversion<Unit::Speed, Unit::Speed::KilometrePerSecond>::ToStandard(
449 NumericType& value) noexcept {
450 value *= static_cast<NumericType>(1000.0L);
451}
452
453template <>
454template <typename NumericType>
455inline constexpr void Conversion<Unit::Speed, Unit::Speed::KilometrePerMinute>::FromStandard(
456 NumericType& value) noexcept {
457 value *= static_cast<NumericType>(0.06L);
458}
459
460template <>
461template <typename NumericType>
462inline constexpr void Conversion<Unit::Speed, Unit::Speed::KilometrePerMinute>::ToStandard(
463 NumericType& value) noexcept {
464 value *= static_cast<NumericType>(1000.0L) / static_cast<NumericType>(60.0L);
465}
466
467template <>
468template <typename NumericType>
469inline constexpr void Conversion<Unit::Speed, Unit::Speed::KilometrePerHour>::FromStandard(
470 NumericType& value) noexcept {
471 value *= static_cast<NumericType>(3.6L);
472}
473
474template <>
475template <typename NumericType>
476inline constexpr void Conversion<Unit::Speed, Unit::Speed::KilometrePerHour>::ToStandard(
477 NumericType& value) noexcept {
478 value *= static_cast<NumericType>(1000.0L) / static_cast<NumericType>(3600.0L);
479}
480
481template <>
482template <typename NumericType>
483inline constexpr void Conversion<Unit::Speed, Unit::Speed::YardPerSecond>::FromStandard(
484 NumericType& value) noexcept {
485 value /= static_cast<NumericType>(0.9144L);
486}
487
488template <>
489template <typename NumericType>
490inline constexpr void Conversion<Unit::Speed, Unit::Speed::YardPerSecond>::ToStandard(
491 NumericType& value) noexcept {
492 value *= static_cast<NumericType>(0.9144L);
493}
494
495template <>
496template <typename NumericType>
497inline constexpr void Conversion<Unit::Speed, Unit::Speed::YardPerMinute>::FromStandard(
498 NumericType& value) noexcept {
499 value *= static_cast<NumericType>(60.0L) / static_cast<NumericType>(0.9144L);
500}
501
502template <>
503template <typename NumericType>
504inline constexpr void Conversion<Unit::Speed, Unit::Speed::YardPerMinute>::ToStandard(
505 NumericType& value) noexcept {
506 value *= static_cast<NumericType>(0.9144L) / static_cast<NumericType>(60.0L);
507}
508
509template <>
510template <typename NumericType>
511inline constexpr void Conversion<Unit::Speed, Unit::Speed::YardPerHour>::FromStandard(
512 NumericType& value) noexcept {
513 value *= static_cast<NumericType>(3600.0L) / static_cast<NumericType>(0.9144L);
514}
515
516template <>
517template <typename NumericType>
518inline constexpr void Conversion<Unit::Speed, Unit::Speed::YardPerHour>::ToStandard(
519 NumericType& value) noexcept {
520 value *= static_cast<NumericType>(0.9144L) / static_cast<NumericType>(3600.0L);
521}
522
523template <>
524template <typename NumericType>
525inline constexpr void Conversion<Unit::Speed, Unit::Speed::FootPerSecond>::FromStandard(
526 NumericType& value) noexcept {
527 value /= static_cast<NumericType>(0.3048L);
528}
529
530template <>
531template <typename NumericType>
532inline constexpr void Conversion<Unit::Speed, Unit::Speed::FootPerSecond>::ToStandard(
533 NumericType& value) noexcept {
534 value *= static_cast<NumericType>(0.3048L);
535}
536
537template <>
538template <typename NumericType>
539inline constexpr void Conversion<Unit::Speed, Unit::Speed::FootPerMinute>::FromStandard(
540 NumericType& value) noexcept {
541 value *= static_cast<NumericType>(60.0L) / static_cast<NumericType>(0.3048L);
542}
543
544template <>
545template <typename NumericType>
546inline constexpr void Conversion<Unit::Speed, Unit::Speed::FootPerMinute>::ToStandard(
547 NumericType& value) noexcept {
548 value *= static_cast<NumericType>(0.3048L) / static_cast<NumericType>(60.0L);
549}
550
551template <>
552template <typename NumericType>
553inline constexpr void Conversion<Unit::Speed, Unit::Speed::FootPerHour>::FromStandard(
554 NumericType& value) noexcept {
555 value *= static_cast<NumericType>(3600.0L) / static_cast<NumericType>(0.3048L);
556}
557
558template <>
559template <typename NumericType>
560inline constexpr void Conversion<Unit::Speed, Unit::Speed::FootPerHour>::ToStandard(
561 NumericType& value) noexcept {
562 value *= static_cast<NumericType>(0.3048L) / static_cast<NumericType>(3600.0L);
563}
564
565template <>
566template <typename NumericType>
567inline constexpr void Conversion<Unit::Speed, Unit::Speed::DecimetrePerSecond>::FromStandard(
568 NumericType& value) noexcept {
569 value *= static_cast<NumericType>(10.0L);
570}
571
572template <>
573template <typename NumericType>
574inline constexpr void Conversion<Unit::Speed, Unit::Speed::DecimetrePerSecond>::ToStandard(
575 NumericType& value) noexcept {
576 value *= static_cast<NumericType>(0.1L);
577}
578
579template <>
580template <typename NumericType>
581inline constexpr void Conversion<Unit::Speed, Unit::Speed::DecimetrePerMinute>::FromStandard(
582 NumericType& value) noexcept {
583 value *= static_cast<NumericType>(600.0L);
584}
585
586template <>
587template <typename NumericType>
588inline constexpr void Conversion<Unit::Speed, Unit::Speed::DecimetrePerMinute>::ToStandard(
589 NumericType& value) noexcept {
590 value /= static_cast<NumericType>(600.0L);
591}
592
593template <>
594template <typename NumericType>
595inline constexpr void Conversion<Unit::Speed, Unit::Speed::DecimetrePerHour>::FromStandard(
596 NumericType& value) noexcept {
597 value *= static_cast<NumericType>(36000.0L);
598}
599
600template <>
601template <typename NumericType>
602inline constexpr void Conversion<Unit::Speed, Unit::Speed::DecimetrePerHour>::ToStandard(
603 NumericType& value) noexcept {
604 value /= static_cast<NumericType>(36000.0L);
605}
606
607template <>
608template <typename NumericType>
609inline constexpr void Conversion<Unit::Speed, Unit::Speed::InchPerSecond>::FromStandard(
610 NumericType& value) noexcept {
611 value /= static_cast<NumericType>(0.0254L);
612}
613
614template <>
615template <typename NumericType>
616inline constexpr void Conversion<Unit::Speed, Unit::Speed::InchPerSecond>::ToStandard(
617 NumericType& value) noexcept {
618 value *= static_cast<NumericType>(0.0254L);
619}
620
621template <>
622template <typename NumericType>
623inline constexpr void Conversion<Unit::Speed, Unit::Speed::InchPerMinute>::FromStandard(
624 NumericType& value) noexcept {
625 value *= static_cast<NumericType>(60.0L) / static_cast<NumericType>(0.0254L);
626}
627
628template <>
629template <typename NumericType>
630inline constexpr void Conversion<Unit::Speed, Unit::Speed::InchPerMinute>::ToStandard(
631 NumericType& value) noexcept {
632 value *= static_cast<NumericType>(0.0254L) / static_cast<NumericType>(60.0L);
633}
634
635template <>
636template <typename NumericType>
637inline constexpr void Conversion<Unit::Speed, Unit::Speed::InchPerHour>::FromStandard(
638 NumericType& value) noexcept {
639 value *= static_cast<NumericType>(3600.0L) / static_cast<NumericType>(0.0254L);
640}
641
642template <>
643template <typename NumericType>
644inline constexpr void Conversion<Unit::Speed, Unit::Speed::InchPerHour>::ToStandard(
645 NumericType& value) noexcept {
646 value *= static_cast<NumericType>(0.0254L) / static_cast<NumericType>(3600.0L);
647}
648
649template <>
650template <typename NumericType>
651inline constexpr void Conversion<Unit::Speed, Unit::Speed::CentimetrePerSecond>::FromStandard(
652 NumericType& value) noexcept {
653 value *= static_cast<NumericType>(100.0L);
654}
655
656template <>
657template <typename NumericType>
658inline constexpr void Conversion<Unit::Speed, Unit::Speed::CentimetrePerSecond>::ToStandard(
659 NumericType& value) noexcept {
660 value *= static_cast<NumericType>(0.01L);
661}
662
663template <>
664template <typename NumericType>
665inline constexpr void Conversion<Unit::Speed, Unit::Speed::CentimetrePerMinute>::FromStandard(
666 NumericType& value) noexcept {
667 value *= static_cast<NumericType>(6000.0L);
668}
669
670template <>
671template <typename NumericType>
672inline constexpr void Conversion<Unit::Speed, Unit::Speed::CentimetrePerMinute>::ToStandard(
673 NumericType& value) noexcept {
674 value /= static_cast<NumericType>(6000.0L);
675}
676
677template <>
678template <typename NumericType>
679inline constexpr void Conversion<Unit::Speed, Unit::Speed::CentimetrePerHour>::FromStandard(
680 NumericType& value) noexcept {
681 value *= static_cast<NumericType>(360000.0L);
682}
683
684template <>
685template <typename NumericType>
686inline constexpr void Conversion<Unit::Speed, Unit::Speed::CentimetrePerHour>::ToStandard(
687 NumericType& value) noexcept {
688 value /= static_cast<NumericType>(360000.0L);
689}
690
691template <>
692template <typename NumericType>
693inline constexpr void Conversion<Unit::Speed, Unit::Speed::MillimetrePerSecond>::FromStandard(
694 NumericType& value) noexcept {
695 value *= static_cast<NumericType>(1000.0L);
696}
697
698template <>
699template <typename NumericType>
700inline constexpr void Conversion<Unit::Speed, Unit::Speed::MillimetrePerSecond>::ToStandard(
701 NumericType& value) noexcept {
702 value *= static_cast<NumericType>(0.001L);
703}
704
705template <>
706template <typename NumericType>
707inline constexpr void Conversion<Unit::Speed, Unit::Speed::MillimetrePerMinute>::FromStandard(
708 NumericType& value) noexcept {
709 value *= static_cast<NumericType>(60000.0L);
710}
711
712template <>
713template <typename NumericType>
714inline constexpr void Conversion<Unit::Speed, Unit::Speed::MillimetrePerMinute>::ToStandard(
715 NumericType& value) noexcept {
716 value /= static_cast<NumericType>(60000.0L);
717}
718
719template <>
720template <typename NumericType>
721inline constexpr void Conversion<Unit::Speed, Unit::Speed::MillimetrePerHour>::FromStandard(
722 NumericType& value) noexcept {
723 value *= static_cast<NumericType>(3600000.0L);
724}
725
726template <>
727template <typename NumericType>
728inline constexpr void Conversion<Unit::Speed, Unit::Speed::MillimetrePerHour>::ToStandard(
729 NumericType& value) noexcept {
730 value /= static_cast<NumericType>(3600000.0L);
731}
732
733template <>
734template <typename NumericType>
735inline constexpr void Conversion<Unit::Speed, Unit::Speed::MilliinchPerSecond>::FromStandard(
736 NumericType& value) noexcept {
737 value /= static_cast<NumericType>(0.0000254L);
738}
739
740template <>
741template <typename NumericType>
742inline constexpr void Conversion<Unit::Speed, Unit::Speed::MilliinchPerSecond>::ToStandard(
743 NumericType& value) noexcept {
744 value *= static_cast<NumericType>(0.0000254L);
745}
746
747template <>
748template <typename NumericType>
749inline constexpr void Conversion<Unit::Speed, Unit::Speed::MilliinchPerMinute>::FromStandard(
750 NumericType& value) noexcept {
751 value *= static_cast<NumericType>(60.0L) / static_cast<NumericType>(0.0000254L);
752}
753
754template <>
755template <typename NumericType>
756inline constexpr void Conversion<Unit::Speed, Unit::Speed::MilliinchPerMinute>::ToStandard(
757 NumericType& value) noexcept {
758 value *= static_cast<NumericType>(0.0000254L) / static_cast<NumericType>(60.0L);
759}
760
761template <>
762template <typename NumericType>
763inline constexpr void Conversion<Unit::Speed, Unit::Speed::MilliinchPerHour>::FromStandard(
764 NumericType& value) noexcept {
765 value *= static_cast<NumericType>(3600.0L) / static_cast<NumericType>(0.0000254L);
766}
767
768template <>
769template <typename NumericType>
770inline constexpr void Conversion<Unit::Speed, Unit::Speed::MilliinchPerHour>::ToStandard(
771 NumericType& value) noexcept {
772 value *= static_cast<NumericType>(0.0000254L) / static_cast<NumericType>(3600.0L);
773}
774
775template <>
776template <typename NumericType>
777inline constexpr void Conversion<Unit::Speed, Unit::Speed::MicrometrePerSecond>::FromStandard(
778 NumericType& value) noexcept {
779 value *= static_cast<NumericType>(1000000.0L);
780}
781
782template <>
783template <typename NumericType>
784inline constexpr void Conversion<Unit::Speed, Unit::Speed::MicrometrePerSecond>::ToStandard(
785 NumericType& value) noexcept {
786 value *= static_cast<NumericType>(0.000001L);
787}
788
789template <>
790template <typename NumericType>
791inline constexpr void Conversion<Unit::Speed, Unit::Speed::MicrometrePerMinute>::FromStandard(
792 NumericType& value) noexcept {
793 value *= static_cast<NumericType>(60000000.0L);
794}
795
796template <>
797template <typename NumericType>
798inline constexpr void Conversion<Unit::Speed, Unit::Speed::MicrometrePerMinute>::ToStandard(
799 NumericType& value) noexcept {
800 value /= static_cast<NumericType>(60000000.0L);
801}
802
803template <>
804template <typename NumericType>
805inline constexpr void Conversion<Unit::Speed, Unit::Speed::MicrometrePerHour>::FromStandard(
806 NumericType& value) noexcept {
807 value *= static_cast<NumericType>(3600000000.0L);
808}
809
810template <>
811template <typename NumericType>
812inline constexpr void Conversion<Unit::Speed, Unit::Speed::MicrometrePerHour>::ToStandard(
813 NumericType& value) noexcept {
814 value /= static_cast<NumericType>(3600000000.0L);
815}
816
817template <>
818template <typename NumericType>
819inline constexpr void Conversion<Unit::Speed, Unit::Speed::MicroinchPerSecond>::FromStandard(
820 NumericType& value) noexcept {
821 value /= static_cast<NumericType>(0.0000000254L);
822}
823
824template <>
825template <typename NumericType>
826inline constexpr void Conversion<Unit::Speed, Unit::Speed::MicroinchPerSecond>::ToStandard(
827 NumericType& value) noexcept {
828 value *= static_cast<NumericType>(0.0000000254L);
829}
830
831template <>
832template <typename NumericType>
833inline constexpr void Conversion<Unit::Speed, Unit::Speed::MicroinchPerMinute>::FromStandard(
834 NumericType& value) noexcept {
835 value *= static_cast<NumericType>(60.0L) / static_cast<NumericType>(0.0000000254L);
836}
837
838template <>
839template <typename NumericType>
840inline constexpr void Conversion<Unit::Speed, Unit::Speed::MicroinchPerMinute>::ToStandard(
841 NumericType& value) noexcept {
842 value *= static_cast<NumericType>(0.0000000254L) / static_cast<NumericType>(60.0L);
843}
844
845template <>
846template <typename NumericType>
847inline constexpr void Conversion<Unit::Speed, Unit::Speed::MicroinchPerHour>::FromStandard(
848 NumericType& value) noexcept {
849 value *= static_cast<NumericType>(3600.0L) / static_cast<NumericType>(0.0000000254L);
850}
851
852template <>
853template <typename NumericType>
854inline constexpr void Conversion<Unit::Speed, Unit::Speed::MicroinchPerHour>::ToStandard(
855 NumericType& value) noexcept {
856 value *= static_cast<NumericType>(0.0000000254L) / static_cast<NumericType>(3600.0L);
857}
858
859template <typename NumericType>
860inline const std::map<Unit::Speed, std::function<void(NumericType* values, const std::size_t size)>>
861 MapOfConversionsFromStandard<Unit::Speed, NumericType>{
863 Conversions<Unit::Speed, Unit::Speed::MetrePerSecond>::FromStandard<NumericType> },
865 Conversions<Unit::Speed, Unit::Speed::MetrePerMinute>::FromStandard<NumericType> },
867 Conversions<Unit::Speed, Unit::Speed::MetrePerHour>::FromStandard<NumericType> },
869 Conversions<Unit::Speed, Unit::Speed::NauticalMilePerSecond>::FromStandard<NumericType>},
871 Conversions<Unit::Speed, Unit::Speed::NauticalMilePerMinute>::FromStandard<NumericType>},
872 {Unit::Speed::Knot, Conversions<Unit::Speed, Unit::Speed::Knot>::FromStandard<NumericType> },
874 Conversions<Unit::Speed, Unit::Speed::MilePerSecond>::FromStandard<NumericType> },
876 Conversions<Unit::Speed, Unit::Speed::MilePerMinute>::FromStandard<NumericType> },
878 Conversions<Unit::Speed, Unit::Speed::MilePerHour>::FromStandard<NumericType> },
880 Conversions<Unit::Speed, Unit::Speed::KilometrePerSecond>::FromStandard<NumericType> },
882 Conversions<Unit::Speed, Unit::Speed::KilometrePerMinute>::FromStandard<NumericType> },
884 Conversions<Unit::Speed, Unit::Speed::KilometrePerHour>::FromStandard<NumericType> },
886 Conversions<Unit::Speed, Unit::Speed::YardPerSecond>::FromStandard<NumericType> },
888 Conversions<Unit::Speed, Unit::Speed::YardPerMinute>::FromStandard<NumericType> },
890 Conversions<Unit::Speed, Unit::Speed::YardPerHour>::FromStandard<NumericType> },
892 Conversions<Unit::Speed, Unit::Speed::FootPerSecond>::FromStandard<NumericType> },
894 Conversions<Unit::Speed, Unit::Speed::FootPerMinute>::FromStandard<NumericType> },
896 Conversions<Unit::Speed, Unit::Speed::FootPerHour>::FromStandard<NumericType> },
898 Conversions<Unit::Speed, Unit::Speed::DecimetrePerSecond>::FromStandard<NumericType> },
900 Conversions<Unit::Speed, Unit::Speed::DecimetrePerMinute>::FromStandard<NumericType> },
902 Conversions<Unit::Speed, Unit::Speed::DecimetrePerHour>::FromStandard<NumericType> },
904 Conversions<Unit::Speed, Unit::Speed::InchPerSecond>::FromStandard<NumericType> },
906 Conversions<Unit::Speed, Unit::Speed::InchPerMinute>::FromStandard<NumericType> },
908 Conversions<Unit::Speed, Unit::Speed::InchPerHour>::FromStandard<NumericType> },
910 Conversions<Unit::Speed, Unit::Speed::CentimetrePerSecond>::FromStandard<NumericType> },
912 Conversions<Unit::Speed, Unit::Speed::CentimetrePerMinute>::FromStandard<NumericType> },
914 Conversions<Unit::Speed, Unit::Speed::CentimetrePerHour>::FromStandard<NumericType> },
916 Conversions<Unit::Speed, Unit::Speed::MillimetrePerSecond>::FromStandard<NumericType> },
918 Conversions<Unit::Speed, Unit::Speed::MillimetrePerMinute>::FromStandard<NumericType> },
920 Conversions<Unit::Speed, Unit::Speed::MillimetrePerHour>::FromStandard<NumericType> },
922 Conversions<Unit::Speed, Unit::Speed::MilliinchPerSecond>::FromStandard<NumericType> },
924 Conversions<Unit::Speed, Unit::Speed::MilliinchPerMinute>::FromStandard<NumericType> },
926 Conversions<Unit::Speed, Unit::Speed::MilliinchPerHour>::FromStandard<NumericType> },
928 Conversions<Unit::Speed, Unit::Speed::MicrometrePerSecond>::FromStandard<NumericType> },
930 Conversions<Unit::Speed, Unit::Speed::MicrometrePerMinute>::FromStandard<NumericType> },
932 Conversions<Unit::Speed, Unit::Speed::MicrometrePerHour>::FromStandard<NumericType> },
934 Conversions<Unit::Speed, Unit::Speed::MicroinchPerSecond>::FromStandard<NumericType> },
936 Conversions<Unit::Speed, Unit::Speed::MicroinchPerMinute>::FromStandard<NumericType> },
938 Conversions<Unit::Speed, Unit::Speed::MicroinchPerHour>::FromStandard<NumericType> },
939};
940
941template <typename NumericType>
942inline const std::map<Unit::Speed,
943 std::function<void(NumericType* const values, const std::size_t size)>>
944 MapOfConversionsToStandard<Unit::Speed, NumericType>{
946 Conversions<Unit::Speed, Unit::Speed::MetrePerSecond>::ToStandard<NumericType> },
948 Conversions<Unit::Speed, Unit::Speed::MetrePerMinute>::ToStandard<NumericType> },
950 Conversions<Unit::Speed, Unit::Speed::MetrePerHour>::ToStandard<NumericType> },
952 Conversions<Unit::Speed, Unit::Speed::NauticalMilePerSecond>::ToStandard<NumericType>},
954 Conversions<Unit::Speed, Unit::Speed::NauticalMilePerMinute>::ToStandard<NumericType>},
955 {Unit::Speed::Knot, Conversions<Unit::Speed, Unit::Speed::Knot>::ToStandard<NumericType> },
957 Conversions<Unit::Speed, Unit::Speed::MilePerSecond>::ToStandard<NumericType> },
959 Conversions<Unit::Speed, Unit::Speed::MilePerMinute>::ToStandard<NumericType> },
961 Conversions<Unit::Speed, Unit::Speed::MilePerHour>::ToStandard<NumericType> },
963 Conversions<Unit::Speed, Unit::Speed::KilometrePerSecond>::ToStandard<NumericType> },
965 Conversions<Unit::Speed, Unit::Speed::KilometrePerMinute>::ToStandard<NumericType> },
967 Conversions<Unit::Speed, Unit::Speed::KilometrePerHour>::ToStandard<NumericType> },
969 Conversions<Unit::Speed, Unit::Speed::YardPerSecond>::ToStandard<NumericType> },
971 Conversions<Unit::Speed, Unit::Speed::YardPerMinute>::ToStandard<NumericType> },
973 Conversions<Unit::Speed, Unit::Speed::YardPerHour>::ToStandard<NumericType> },
975 Conversions<Unit::Speed, Unit::Speed::FootPerSecond>::ToStandard<NumericType> },
977 Conversions<Unit::Speed, Unit::Speed::FootPerMinute>::ToStandard<NumericType> },
979 Conversions<Unit::Speed, Unit::Speed::FootPerHour>::ToStandard<NumericType> },
981 Conversions<Unit::Speed, Unit::Speed::DecimetrePerSecond>::ToStandard<NumericType> },
983 Conversions<Unit::Speed, Unit::Speed::DecimetrePerMinute>::ToStandard<NumericType> },
985 Conversions<Unit::Speed, Unit::Speed::DecimetrePerHour>::ToStandard<NumericType> },
987 Conversions<Unit::Speed, Unit::Speed::InchPerSecond>::ToStandard<NumericType> },
989 Conversions<Unit::Speed, Unit::Speed::InchPerMinute>::ToStandard<NumericType> },
991 Conversions<Unit::Speed, Unit::Speed::InchPerHour>::ToStandard<NumericType> },
993 Conversions<Unit::Speed, Unit::Speed::CentimetrePerSecond>::ToStandard<NumericType> },
995 Conversions<Unit::Speed, Unit::Speed::CentimetrePerMinute>::ToStandard<NumericType> },
997 Conversions<Unit::Speed, Unit::Speed::CentimetrePerHour>::ToStandard<NumericType> },
999 Conversions<Unit::Speed, Unit::Speed::MillimetrePerSecond>::ToStandard<NumericType> },
1001 Conversions<Unit::Speed, Unit::Speed::MillimetrePerMinute>::ToStandard<NumericType> },
1003 Conversions<Unit::Speed, Unit::Speed::MillimetrePerHour>::ToStandard<NumericType> },
1005 Conversions<Unit::Speed, Unit::Speed::MilliinchPerSecond>::ToStandard<NumericType> },
1007 Conversions<Unit::Speed, Unit::Speed::MilliinchPerMinute>::ToStandard<NumericType> },
1009 Conversions<Unit::Speed, Unit::Speed::MilliinchPerHour>::ToStandard<NumericType> },
1011 Conversions<Unit::Speed, Unit::Speed::MicrometrePerSecond>::ToStandard<NumericType> },
1013 Conversions<Unit::Speed, Unit::Speed::MicrometrePerMinute>::ToStandard<NumericType> },
1015 Conversions<Unit::Speed, Unit::Speed::MicrometrePerHour>::ToStandard<NumericType> },
1017 Conversions<Unit::Speed, Unit::Speed::MicroinchPerSecond>::ToStandard<NumericType> },
1019 Conversions<Unit::Speed, Unit::Speed::MicroinchPerMinute>::ToStandard<NumericType> },
1021 Conversions<Unit::Speed, Unit::Speed::MicroinchPerHour>::ToStandard<NumericType> },
1022};
1023
1024} // namespace Internal
1025
1026} // namespace PhQ
1027
1028#endif // PHQ_UNIT_SPEED_HPP
Speed
Speed units.
Definition Speed.hpp:53
@ YardPerSecond
Yard per second (yd/s) speed unit.
@ MetrePerSecond
Metre per second (m/s) speed unit.
@ CentimetrePerHour
Centimetre per hour (cm/hr) speed unit.
@ FootPerHour
Foot per hour (ft/hr) speed unit.
@ MetrePerMinute
Metre per minute (m/min) speed unit.
@ NauticalMilePerSecond
Nautical mile per second (nmi/s) speed unit.
@ MilePerSecond
Mile per second (mi/s) speed unit.
@ DecimetrePerSecond
Decimetre per second (dm/s) speed unit.
@ MillimetrePerMinute
Millimetre per minute (mm/min) speed unit.
@ KilometrePerSecond
Kilometre per second (km/s) speed unit.
@ InchPerHour
Inch per hour (in/hr) speed unit.
@ Knot
Knot (kn) speed unit, also known as nautical mile per hour.
@ InchPerMinute
Inch per minute (in/min) speed unit.
@ KilometrePerHour
Kilometre per hour (km/hr) speed unit.
@ DecimetrePerHour
Decimetre per hour (dm/hr) speed unit.
@ MillimetrePerHour
Millimetre per hour (mm/hr) speed unit.
@ MilePerMinute
Mile per minute (mi/min) speed unit.
@ YardPerHour
Yard per hour (yd/hr) speed unit.
@ DecimetrePerMinute
Decimetre per minute (dm/min) speed unit.
@ MilliinchPerHour
Milliinch per hour (mil/hr) speed unit.
@ MilliinchPerSecond
Milliinch per second (mil/s) speed unit.
@ FootPerMinute
Foot per minute (ft/min) speed unit.
@ FootPerSecond
Foot per second (ft/s) speed unit.
@ MetrePerHour
Metre per hour (m/hr) speed unit.
@ MilePerHour
Mile per hour (mi/hr) speed unit.
@ MilliinchPerMinute
Milliinch per minute (mil/min) speed unit.
@ MicrometrePerSecond
Micrometre per second (μm/s) speed unit.
@ YardPerMinute
Yard per minute (yd/min) speed unit.
@ MicroinchPerSecond
Microinch per second (μin/s) speed unit.
@ MicrometrePerHour
Micrometre per hour (μm/hr) speed unit.
@ KilometrePerMinute
Kilometre per minute (km/min) speed unit.
@ InchPerSecond
Inch per second (in/s) speed unit.
@ CentimetrePerSecond
Centimetre per second (cm/s) speed unit.
@ MicrometrePerMinute
Micrometre per minute (μm/min) speed unit.
@ MillimetrePerSecond
Millimetre per second (mm/s) speed unit.
@ NauticalMilePerMinute
Nautical mile per minute (nmi/min) speed unit.
@ MicroinchPerMinute
Microinch per minute (μin/min) speed unit.
@ CentimetrePerMinute
Centimetre per minute (cm/min) speed unit.
@ MicroinchPerHour
Microinch per hour (μin/hr) speed 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