refactor: scalar and complex renamed to real_scalar and complex_scalar respectively + concepts refactoring + electromagnetism fixes

This commit is contained in:
Mateusz Pusz
2025-02-11 17:26:19 +01:00
parent 9fb08e3c95
commit 47a82f466c
21 changed files with 569 additions and 579 deletions

View File

@ -1704,7 +1704,7 @@ and is equal to
\item
\tcode{Ch} if specified,
\item
otherwise, \tcode{quantity_character::scalar} for the first signature, and
otherwise, \tcode{quantity_character::real_scalar} for the first signature, and
\item
otherwise, \tcode{(BC).character},
where \tcode{BC} is the argument preceding \tcode{Ch} in the signatures above.
@ -1788,7 +1788,7 @@ be packs denoting the template arguments of
\item
\tcode{\placeholdernc{QUANTITY-CHARACTER-OF}(Pack)} be
\begin{codeblock}
std::max({quantity_character::scalar, @\exposidnc{expr-type}@<Pack>::character...})
std::max({quantity_character::real_scalar, @\exposidnc{expr-type}@<Pack>::character...})
\end{codeblock}
and
\item
@ -1796,7 +1796,7 @@ and
\tcode{den_char} be \tcode{\placeholdernc{QUANTITY-CHARACTER-OF}(Dens)}.
\end{itemize}
The member \tcode{character} is equal to
\tcode{quantity_character::scalar} if \tcode{num_char == den_char} is \tcode{true}, and
\tcode{quantity_character::real_scalar} if \tcode{num_char == den_char} is \tcode{true}, and
\tcode{std::max(num_char, den_char)} otherwise.
\rSec4[dimless.qty]{Base quantity of dimension one}
@ -4033,8 +4033,8 @@ it represents the numerical value of a quantity\irefiev{112-01-29}.
\begin{itemdecl}
template<typename T, quantity_character Ch>
concept @\defexposconceptnc{IsOfCharacter}@ = (Ch == quantity_character::scalar && @\exposconceptnc{Scalar}@<T>) || // \expos
(Ch == quantity_character::complex && @\exposconceptnc{Complex}@<T>) ||
concept @\defexposconceptnc{IsOfCharacter}@ = (Ch == quantity_character::real_scalar && @\exposconceptnc{Scalar}@<T>) || // \expos
(Ch == quantity_character::complex_scalar && @\exposconceptnc{Complex}@<T>) ||
(Ch == quantity_character::vector && @\exposconceptnc{Vector}@<T>);
template<typename T, auto V>

View File

@ -34,8 +34,8 @@ A quantity character determines the properties and operations that can be perfor
Quantities defined by the ISQ may be of the following characters:
- scalar (e.g., _time_, _width_, _speed_, _apparent power_),
- complex (e.g., _complex power_, _voltage phasor_, _electric current phasor_),
- real scalar (e.g., _time_, _width_, _speed_, _apparent power_),
- complex scalar (e.g., _voltage phasor_, _complex power_, _impedance_),
- vector (e.g., _displacement_, _velocity_, _force_),
- tensor (e.g., _moment of inertia_, _stress_, _strain_).

View File

@ -90,7 +90,7 @@ in one line of code. In the above code:
!!! note
Some quantities may be specified to have complex, vector, or tensor character
Some quantities may be specified to have complex scalar, vector, or tensor character
(e.g., `displacement`). The quantity character can be set with the last parameter of
`quantity_spec`.

View File

@ -395,11 +395,11 @@ the same kind.
Some quantities are more complicated than others. For example, _power_ has:
- scalar quantities expressed in:
- real scalar quantities expressed in:
- W (watts) (e.g., _mechanical power_, _active power_),
- VA (volt-ampere) (e.g., _apparent power_),
- var (e.g., _reactive power_),
- complex quantities expressed in VA (volt-ampere) (e.g., _complex power_).
- complex scalar quantities expressed in VA (volt-ampere) (e.g., _complex power_).
How should we model this? Maybe those should be two or three independent trees of quantities, each
having its own unit?

View File

@ -119,15 +119,15 @@ results in the `derived_dimension<isq::dim_length, per<isq::dim_time>>` type.
[ISO 80000](../../appendix/references.md#ISO80000) explicitly states that quantities (even of the same kind) may have
different [characters](../../appendix/glossary.md#character):
- scalar,
- complex,
- vector,
- tensor.
- real scalar (e.g., _time_, _width_, _speed_, _apparent power_),
- complex scalar (e.g., _voltage phasor_, _complex power_, _impedance_),
- vector (e.g., _displacement_, _velocity_, _force_),
- tensor (e.g., _moment of inertia_, _stress_, _strain_).
The quantity character in the **mp-units** library is implemented with the `quantity_character` enumeration:
```cpp
enum class quantity_character { scalar, complex, vector, tensor };
enum class quantity_character { real_scalar, complex_scalar, vector, tensor };
```
!!! info