|
Phyth v0.1.0
A dimensional safe C++ header-only mechanics and electromagnetics simulation library.
|
Namespaces | |
| namespace | Config |
| namespace | Consts |
| namespace | Electromagnetics |
| namespace | Mechanics |
| namespace | Utils |
Classes | |
| class | CombineField |
| Combine multiple fields of the same type. More... | |
| struct | DegreePerSecondTag |
| struct | DegreeTag |
| struct | DimComponent |
| Extract the N-th base exponent from a Dimension. More... | |
| struct | DimComponent< N, Dimension< Ratios... > > |
| struct | DimDiv |
| Divide one dimension by another: exponent-wise subtraction. More... | |
| struct | DimDiv< Dimension< R1... >, Dimension< R2... > > |
| struct | Dimension |
| Compile-time physical dimension as 7 SI base exponents. More... | |
| struct | DimEqual |
| Check if two dimensions are identical (all exponents equal) More... | |
| struct | DimEqual< Dimension< R1... >, Dimension< R2... > > |
| struct | DimMul |
| Add two dimensions: exponent-wise addition. More... | |
| struct | DimMul< Dimension< R1... >, Dimension< R2... > > |
| struct | DimPower |
| Extract the numeric value of the N-th exponent from a Dimension. More... | |
| struct | DimPower< N, Dimension< Ratios... > > |
| struct | DimPowerHelper |
| Raise a Dimension to an integer power. More... | |
| struct | DimPowerHelper< 0, D > |
| struct | DimPowerType |
| struct | DimRcp |
| Reciprocal of a dimension: negate all exponents. More... | |
| struct | DimRcp< Dimension< Ratios... > > |
| struct | DimRoot |
| Take the N-th root of a dimension: divide all exponents by N. More... | |
| struct | DimRoot< N, Dimension< Ratios... > > |
| struct | DimToString |
| Convert a Dimension to a human-readable string. More... | |
| struct | DimToString< Dimension< Ratios... > > |
| class | Field |
| Base class for physical fields (scalar or vector) More... | |
| struct | FoldLeft |
| struct | FoldLeft< F, T > |
| struct | FoldLeft< F, T1, T2, Rest... > |
| struct | Interval |
| Closed interval [min, max] of physical quantities. More... | |
| struct | is_dim |
| Trait: check if a type is a Dimension instantiation. More... | |
| struct | is_dim< Dimension< Ratios... > > |
| struct | is_dimensionless |
| Trait: check if a quantity's dimension is dimensionless. More... | |
| struct | is_field |
| Type trait to check if a type is a Field instantiation. More... | |
| struct | is_field_impl |
| Implementation helper for is_field trait. More... | |
| struct | is_field_impl< T, std::void_t< decltype(static_cast< Field< typename T::value_type > * >(std::declval< T * >())) > > |
| struct | is_quantity |
| Trait: check if a type is a Quantity instantiation. More... | |
| struct | is_quantity< Quantity< UnitT > > |
| struct | is_quaternion |
| Trait: check if a type is a Quaternion instantiation. More... | |
| struct | is_quaternion< Quaternion< T > > |
| struct | is_unit |
| Trait: check if a type is a Unit instantiation. More... | |
| struct | is_unit< Unit< DimT, Scale, TagT > > |
| struct | is_vector |
| struct | is_vector< Vector< N, QuantityT > > |
| struct | is_vector_of_n |
| struct | is_vector_of_n< N, Vector< N, T > > |
| class | IsotropicMaterial |
| Linear elastic isotropic material model. More... | |
| struct | Matrix |
| struct | Matrix< 3, 3, T > |
| 3x3 matrix with Quantity components More... | |
| struct | NewtonMeterTag |
| struct | Quantity |
| Physical quantity with a value and a compile-time unit. More... | |
| struct | Quaternion |
| Quaternion with Quantity components. More... | |
| struct | RadianTag |
| class | TimeHistory |
| Time-based history with linear interpolation. More... | |
| struct | Unit |
| Physical unit with dimension and scale factor relative to SI base. More... | |
| struct | UnitDivBin |
| struct | UnitInfo |
| Display information for a unit type. More... | |
| struct | UnitMulBin |
| struct | UnitRec |
| struct | UnitRegistrar |
| Static registrar for unit types. More... | |
| class | UnitRegistry |
| Singleton registry for unit names and symbols. More... | |
| struct | Vector |
| struct | Vector< 3, T > |
| 3D vector with Quantity components More... | |
| struct | VoltagePerMeterTag |
Enumerations | |
| enum class | OutputMode { Auto , Raw } |
Functions | |
| std::string | formatPower (const double power) |
| Format a floating-point exponent for string output. | |
| template<typename U1 , typename U2 > | |
| constexpr bool | operator== (Quantity< U1 > a, Quantity< U2 > b) |
| Equality comparison between two quantities. | |
| template<typename U1 , typename U2 > | |
| constexpr bool | operator!= (Quantity< U1 > a, Quantity< U2 > b) |
| Inequality comparison between two quantities. | |
| template<typename U1 , typename U2 > | |
| constexpr bool | operator< (Quantity< U1 > a, Quantity< U2 > b) |
| Less-than comparison between two quantities. | |
| template<typename U1 , typename U2 > | |
| constexpr bool | operator> (Quantity< U1 > a, Quantity< U2 > b) |
| Greater-than comparison between two quantities. | |
| template<typename U1 , typename U2 > | |
| constexpr bool | operator<= (Quantity< U1 > a, Quantity< U2 > b) |
| Less-than-or-equal comparison between two quantities. | |
| template<typename U1 , typename U2 > | |
| constexpr bool | operator>= (Quantity< U1 > a, Quantity< U2 > b) |
| Greater-than-or-equal comparison between two quantities. | |
| template<typename UnitT > | |
| constexpr bool | operator== (Quantity< UnitT > a, double scalar) |
| Equality comparison: dimensionless quantity == scalar. | |
| template<typename UnitT > | |
| constexpr bool | operator== (double scalar, Quantity< UnitT > a) |
| Equality comparison: scalar == dimensionless quantity. | |
| template<typename UnitT > | |
| constexpr bool | operator!= (Quantity< UnitT > a, double scalar) |
| Inequality comparison: dimensionless quantity != scalar. | |
| template<typename UnitT > | |
| constexpr bool | operator!= (double scalar, Quantity< UnitT > a) |
| Inequality comparison: scalar != dimensionless quantity. | |
| template<typename UnitT > | |
| constexpr bool | operator< (Quantity< UnitT > a, double scalar) |
| Less-than comparison: dimensionless quantity < scalar. | |
| template<typename UnitT > | |
| constexpr bool | operator< (double scalar, Quantity< UnitT > a) |
| Less-than comparison: scalar < dimensionless quantity. | |
| template<typename UnitT > | |
| constexpr bool | operator> (Quantity< UnitT > a, double scalar) |
| Greater-than comparison: dimensionless quantity > scalar. | |
| template<typename UnitT > | |
| constexpr bool | operator> (double scalar, Quantity< UnitT > a) |
| Greater-than comparison: scalar > dimensionless quantity. | |
| template<typename UnitT > | |
| constexpr bool | operator<= (Quantity< UnitT > a, double scalar) |
| Less-than-or-equal comparison: dimensionless quantity <= scalar. | |
| template<typename UnitT > | |
| constexpr bool | operator<= (double scalar, Quantity< UnitT > a) |
| Less-than-or-equal comparison: scalar <= dimensionless quantity. | |
| template<typename UnitT > | |
| constexpr bool | operator>= (Quantity< UnitT > a, double scalar) |
| Greater-than-or-equal comparison: dimensionless quantity >= scalar. | |
| template<typename UnitT > | |
| constexpr bool | operator>= (double scalar, Quantity< UnitT > a) |
| Greater-than-or-equal comparison: scalar >= dimensionless quantity. | |
| template<typename U1 , typename U2 > | |
| constexpr auto | operator+ (Quantity< U1 > a, Quantity< U2 > b) |
| Add two quantities of the same dimension. | |
| template<typename U1 , typename U2 > | |
| constexpr auto | operator- (Quantity< U1 > a, Quantity< U2 > b) |
| Subtract two quantities of the same dimension. | |
| template<typename U1 , typename U2 > | |
| constexpr auto | operator* (Quantity< U1 > a, Quantity< U2 > b) |
| Multiply two quantities. | |
| template<typename U1 , typename U2 > | |
| constexpr auto | operator/ (Quantity< U1 > a, Quantity< U2 > b) |
| Divide one quantity by another. | |
| template<typename UnitT > | |
| constexpr auto | operator+ (Quantity< UnitT > a, double scalar) |
| Add a dimensionless quantity and a scalar. | |
| template<typename UnitT > | |
| constexpr auto | operator+ (double scalar, Quantity< UnitT > a) |
| Add a scalar and a dimensionless quantity (commutative) | |
| template<typename UnitT > | |
| constexpr auto | operator- (Quantity< UnitT > a, double scalar) |
| Subtract a scalar from a dimensionless quantity. | |
| template<typename UnitT > | |
| constexpr auto | operator- (double scalar, Quantity< UnitT > a) |
| Subtract a dimensionless quantity from a scalar. | |
| template<typename UnitT > | |
| constexpr auto | operator* (Quantity< UnitT > a, double scalar) |
| Multiply a quantity by a scalar. | |
| template<typename UnitT > | |
| constexpr auto | operator* (double scalar, Quantity< UnitT > a) |
| Multiply a scalar by a quantity (commutative) | |
| template<typename UnitT > | |
| constexpr auto | operator/ (Quantity< UnitT > a, double scalar) |
| Divide a quantity by a scalar. | |
| template<typename UnitT > | |
| constexpr auto | operator/ (double scalar, Quantity< UnitT > a) |
| Divide a scalar by a quantity, producing an inverse unit. | |
| template<typename UnitT > | |
| constexpr auto | operator- (Quantity< UnitT > a) |
| Unary negation. | |
| template<typename UnitT > | |
| constexpr auto | operator+ (Quantity< UnitT > a) |
| Unary plus. | |
| template<typename UnitT > | |
| std::string | UnitSymbol () |
| Get the symbol string for a unit type (e.g., "m", "kg", "N") | |
| template<typename UnitT > | |
| std::string | UnitName () |
| Get the full name string for a unit type (e.g., "meter", "kilogram") | |
| std::string | FormatValue (const double value) |
| Format a raw numeric value for string output. | |
| template<typename UnitT > | |
| std::string | QuantityToString (const Quantity< UnitT > &q) |
| Convert a Quantity to a human-readable string. | |
| template<typename UnitT > | |
| std::ostream & | operator<< (std::ostream &os, const Quantity< UnitT > &q) |
| Stream insertion operator for Quantity. | |
| PHYTH_DEFINE_UNIT_WITH_NAME (AngularVelocity, RadianPerSecond, radps, 1, 1, "rad/s") | |
| template<typename T , typename U , std::size_t Row, std::size_t Col> | |
| constexpr auto | operator* (T scalar, const Matrix< Row, Col, U > &m) |
| template<typename T , typename U > | |
| constexpr auto | operator* (T scalar, const Matrix3x3< U > &m) |
| Scalar * Matrix multiplication. | |
| template<typename T , typename U > | |
| constexpr auto | operator* (const Quantity< T > scalar, const Quaternion< U > &q) |
| Scalar * Quaternion multiplication (commutative) | |
| template<typename T , std::size_t N, typename U , typename = std::enable_if_t<!is_vector_of_n_v<N, T>>> | |
| constexpr auto | operator* (T scalar, const Vector< N, U > &v) |
| template<typename T , typename U , typename = std::enable_if_t<!is_vector3_v<T>>> | |
| constexpr auto | operator* (T scalar, const Vector3< U > &v) |
| Scalar multiplication (scalar * vector) | |
Variables | |
| template<typename D1 , typename D2 > | |
| constexpr bool | dim_equal_v = DimEqual<D1, D2>::value |
| Convenience variable template for DimEqual. | |
| template<typename T > | |
| constexpr bool | is_dim_v = is_dim<T>::value |
| Convenience variable template for is_dim. | |
| template<typename UnitT > | |
| constexpr bool | is_dimensionless_v = is_dimensionless<UnitT>::value |
| Convenience variable template for is_dimensionless. | |
| template<int N, typename D > | |
| constexpr double | dim_power_v = DimPower<N, D>::value |
| Convenience variable template for DimPower. | |
| template<typename T > | |
| constexpr bool | is_quantity_v = is_quantity<T>::value |
| Convenience variable template for is_quantity. | |
| template<typename T > | |
| constexpr bool | is_unit_v = is_unit<T>::value |
| template<typename T > | |
| constexpr bool | is_field_v = is_field<T>::value |
| Convenience variable template for is_field. | |
| template<typename T > | |
| constexpr auto | is_quaternion_v = is_quaternion<T>::value |
| Convenience variable template for is_quaternion. | |
| template<typename VecT > | |
| constexpr auto | is_vector_v = is_vector<VecT>::value |
| template<std::size_t N, typename T > | |
| constexpr bool | is_vector_of_n_v = is_vector_of_n<N, T>::value |
| template<typename T > | |
| constexpr auto | is_vector3_v = is_vector_of_n_v<3, T> |
| Convenience variable template for is_vector3. | |
| struct Phyth::DimComponent |
| struct Phyth::DimComponent< N, Dimension< Ratios... > > |
Definition at line 42 of file Dimension.hpp.
| Class Members | ||
|---|---|---|
| typedef tuple_element_t< N, tuple< Ratios... > > | type | |
| struct Phyth::DimDiv |
| struct Phyth::DimDiv< Dimension< R1... >, Dimension< R2... > > |
Definition at line 82 of file Dimension.hpp.
| Class Members | ||
|---|---|---|
| typedef Dimension< ratio_subtract< R1, R2 >... > | type | |
| struct Phyth::DimEqual |
| struct Phyth::DimMul |
| struct Phyth::DimMul< Dimension< R1... >, Dimension< R2... > > |
| struct Phyth::DimPower |
| struct Phyth::DimPowerHelper |
| struct Phyth::DimPowerHelper< 0, D > |
Definition at line 381 of file Dimension.hpp.
| Class Members | ||
|---|---|---|
| typedef Dimensionless | type | |
| struct Phyth::DimPowerType |
| struct Phyth::DimRcp |
Reciprocal of a dimension: negate all exponents.
Example: reciprocal(Time) -> [s^-1] (frequency)
Definition at line 121 of file Dimension.hpp.
| struct Phyth::DimRcp< Dimension< Ratios... > > |
Definition at line 124 of file Dimension.hpp.
| Class Members | ||
|---|---|---|
| typedef Dimension< ratio_multiply< Ratios, ratio<-1 > >... > | type | |
| struct Phyth::DimRoot |
Take the N-th root of a dimension: divide all exponents by N.
Example: sqrt(Area) -> Length
| N | Root index (positive integer). Fails if N <= 0. |
Definition at line 101 of file Dimension.hpp.
| struct Phyth::DimRoot< N, Dimension< Ratios... > > |
Definition at line 104 of file Dimension.hpp.
| Class Members | ||
|---|---|---|
| typedef Dimension< ratio_divide< Ratios, ratio< N > >... > | type | |
| struct Phyth::DimToString |
Convert a Dimension to a human-readable string.
Example: DimToString<Velocity>::value() -> "m*s^-1" DimToString<Dimensionless>::value() -> "" (empty string)
Edge cases:
Definition at line 194 of file Dimension.hpp.
| struct Phyth::FoldLeft |
| struct Phyth::FoldLeft< F, T > |
| struct Phyth::FoldLeft< F, T1, T2, Rest... > |
| struct Phyth::UnitDivBin |
| struct Phyth::UnitInfo |
Display information for a unit type.
Contains human-readable strings used by QuantityToString().
Definition at line 15 of file UnitsRegistry.hpp.
| Class Members | ||
|---|---|---|
| string | name |
Full unit name, e.g., "Meter", "Kilogram" |
| string | symbol |
Unit symbol, e.g., "m", "kg", "N" |
| struct Phyth::UnitMulBin |
| struct Phyth::UnitRec |
Definition at line 297 of file Dimension.hpp.
| using Phyth::AmountOfSubstance = typedef Dimension< std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>, std::ratio<0> > |
Definition at line 286 of file Dimension.hpp.
Definition at line 324 of file Dimension.hpp.
Definition at line 311 of file Dimension.hpp.
Definition at line 320 of file Dimension.hpp.
Definition at line 307 of file Dimension.hpp.
Definition at line 303 of file Dimension.hpp.
Definition at line 314 of file Dimension.hpp.
| using Phyth::DimComponentT = typedef typename DimComponent<N, D>::type |
Convenience alias for DimComponent.
Definition at line 51 of file Dimension.hpp.
Convenience alias for DimDiv.
Definition at line 91 of file Dimension.hpp.
| using Phyth::Dimensionless = typedef Dimension< std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<0> > |
Definition at line 256 of file Dimension.hpp.
Convenience alias for DimMul.
Definition at line 71 of file Dimension.hpp.
| using Phyth::DimPowerTypeT = typedef typename DimPowerType<Power, D>::type |
Convenience alias for DimPowerType.
Example: DimPowerTypeT<2, Length> -> Area DimPowerTypeT<3, Length> -> Volume
Definition at line 398 of file Dimension.hpp.
Convenience alias for DimRcp.
Definition at line 132 of file Dimension.hpp.
Convenience alias for DimRoot.
Definition at line 113 of file Dimension.hpp.
| using Phyth::ElectricCurrent = typedef Dimension< std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>, std::ratio<0>, std::ratio<0>, std::ratio<0> > |
Definition at line 276 of file Dimension.hpp.
Definition at line 321 of file Dimension.hpp.
Definition at line 304 of file Dimension.hpp.
Definition at line 316 of file Dimension.hpp.
Definition at line 299 of file Dimension.hpp.
Definition at line 317 of file Dimension.hpp.
Definition at line 298 of file Dimension.hpp.
Definition at line 325 of file Dimension.hpp.
Definition at line 302 of file Dimension.hpp.
Definition at line 308 of file Dimension.hpp.
| using Phyth::Length = typedef Dimension< std::ratio<1>, std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<0> > |
Definition at line 261 of file Dimension.hpp.
Definition at line 318 of file Dimension.hpp.
| using Phyth::LuminousIntensity = typedef Dimension< std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1> > |
Definition at line 291 of file Dimension.hpp.
Definition at line 322 of file Dimension.hpp.
Definition at line 309 of file Dimension.hpp.
Definition at line 310 of file Dimension.hpp.
| using Phyth::Mass = typedef Dimension< std::ratio<0>, std::ratio<1>, std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<0> > |
Definition at line 266 of file Dimension.hpp.
Definition at line 315 of file Dimension.hpp.
Definition at line 12 of file Matrix3x3.hpp.
Definition at line 323 of file Dimension.hpp.
Definition at line 300 of file Dimension.hpp.
Definition at line 301 of file Dimension.hpp.
Definition at line 306 of file Dimension.hpp.
Definition at line 9 of file Quantities.hpp.
Definition at line 319 of file Dimension.hpp.
| using Phyth::ThermodynamicTemperature = typedef Dimension< std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>, std::ratio<0>, std::ratio<0> > |
Definition at line 281 of file Dimension.hpp.
| using Phyth::Time = typedef Dimension< std::ratio<0>, std::ratio<0>, std::ratio<1>, std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<0> > |
Definition at line 271 of file Dimension.hpp.
Definition at line 313 of file Dimension.hpp.
| using Phyth::UnitDivT = typedef FoldLeftT<UnitDivBin, Us...> |
| using Phyth::UnitMulT = typedef FoldLeftT<UnitMulBin, Us...> |
Definition at line 12 of file Vector3.hpp.
Definition at line 296 of file Dimension.hpp.
Definition at line 305 of file Dimension.hpp.
Definition at line 312 of file Dimension.hpp.
|
strong |
| Enumerator | |
|---|---|
| Auto | |
| Raw | |
Definition at line 5 of file Config.hpp.
Format a floating-point exponent for string output.
Converts 1.000000 -> "1", 0.5 -> "0.5", -1.0 -> "-1" Used by DimToString to produce readable dimension strings.
Definition at line 174 of file Dimension.hpp.
Format a raw numeric value for string output.
Uses std::ostringstream. Override this function for custom formatting.
| value | The value to format |
Definition at line 718 of file Quantity.hpp.
Inequality comparison: scalar != dimensionless quantity.
| UnitT | Must be dimensionless |
| scalar | The scalar value |
| a | The dimensionless quantity |
Definition at line 344 of file Quantity.hpp.
Inequality comparison between two quantities.
| a | Left quantity |
| b | Right quantity |
Example: 1.0_km != 1000.0_m // false 1.0_km != 999.0_m // true
Definition at line 202 of file Quantity.hpp.
Inequality comparison: dimensionless quantity != scalar.
| UnitT | Must be dimensionless |
| a | The dimensionless quantity |
| scalar | The scalar value to compare against |
Definition at line 329 of file Quantity.hpp.
|
constexpr |
Scalar * Quaternion multiplication (commutative)
| T | Scalar type (must be a Quantity, typically Scalar) |
| U | Quaternion component type |
| scalar | The scalar multiplier |
| q | The quaternion |
Definition at line 471 of file Quaternion.hpp.
Multiply a scalar by a quantity (commutative)
| scalar | The scalar multiplier |
| a | The quantity |
Definition at line 628 of file Quantity.hpp.
Multiply two quantities.
The resulting dimension is the product of the two input dimensions. The resulting unit is dimensionless (scale = 1) with the combined dimension.
| a | Left quantity |
| b | Right quantity |
Example: 5.0_m * 3.0_s // Quantity<Unit<DimMulT<Length, Time>>>(15)
Definition at line 524 of file Quantity.hpp.
Multiply a quantity by a scalar.
| a | The quantity |
| scalar | The scalar multiplier |
Definition at line 616 of file Quantity.hpp.
Definition at line 262 of file Matrix.hpp.
Scalar multiplication (scalar * vector)
This is the symmetric counterpart to Vector3::operator*(U scalar).
| T | Scalar type (must not be a Vector3) |
| U | Quantity type of the vector components |
| scalar | The scalar multiplier |
| v | The vector |
Example: auto v = 2.0 * Vector3<Quantity<Meter>>(1.0_m, 2.0_m, 3.0_m); // v = (2 m, 4 m, 6 m)
Definition at line 460 of file Vector3.hpp.
|
constexpr |
Definition at line 228 of file Vector.hpp.
Add a scalar and a dimensionless quantity (commutative)
| UnitT | Must be dimensionless |
| scalar | The scalar value |
| a | The dimensionless quantity |
Definition at line 572 of file Quantity.hpp.
Add two quantities of the same dimension.
| U1 | Unit type of the left operand (also the result unit) |
| U2 | Unit type of the right operand |
| a | Left quantity |
| b | Right quantity |
Example: 1.0_m + 50.0_cm // Quantity<Meter>(1.5)
Definition at line 483 of file Quantity.hpp.
Unary plus.
| a | The quantity |
Definition at line 684 of file Quantity.hpp.
Add a dimensionless quantity and a scalar.
| UnitT | Must be dimensionless |
| a | The dimensionless quantity |
| scalar | The scalar value to add |
Definition at line 557 of file Quantity.hpp.
Subtract a dimensionless quantity from a scalar.
| UnitT | Must be dimensionless |
| scalar | The scalar value |
| a | The dimensionless quantity to subtract |
Definition at line 602 of file Quantity.hpp.
Subtract two quantities of the same dimension.
| U1 | Unit type of the left operand (also the result unit) |
| U2 | Unit type of the right operand |
| a | Left quantity |
| b | Right quantity |
Example: 1.0_m - 50.0_cm // Quantity<Meter>(0.5)
Definition at line 502 of file Quantity.hpp.
Unary negation.
| a | The quantity to negate |
Definition at line 673 of file Quantity.hpp.
Subtract a scalar from a dimensionless quantity.
| UnitT | Must be dimensionless |
| a | The dimensionless quantity |
| scalar | The scalar value to subtract |
Definition at line 587 of file Quantity.hpp.
Divide a scalar by a quantity, producing an inverse unit.
This is the only way to create inverse dimensions from a scalar.
| UnitT | The unit type of the denominator |
| scalar | The scalar numerator |
| a | The quantity denominator |
Example: auto freq = 1.0 / 2.0_s; // Quantity<Unit<DimRcpT<Time>>>(0.5) // The dimension is s^-1, which is frequency.
Definition at line 659 of file Quantity.hpp.
Divide one quantity by another.
The resulting dimension is the quotient of the two input dimensions. The resulting unit is dimensionless (scale = 1) with the combined dimension.
| a | Numerator quantity |
| b | Denominator quantity |
Example: 10.0_m / 2.0_s // Quantity<Unit<Velocity>>(5)
Definition at line 544 of file Quantity.hpp.
Divide a quantity by a scalar.
| a | The quantity |
| scalar | The scalar divisor |
Definition at line 640 of file Quantity.hpp.
Less-than comparison: scalar < dimensionless quantity.
| UnitT | Must be dimensionless |
| scalar | The scalar value |
| a | The dimensionless quantity |
Definition at line 374 of file Quantity.hpp.
Less-than comparison between two quantities.
| a | Left quantity |
| b | Right quantity |
Example: 1.0_m < 100.0_cm // false (equal) 1.0_m < 150.0_cm // true (1m < 1.5m)
Definition at line 220 of file Quantity.hpp.
Less-than comparison: dimensionless quantity < scalar.
| UnitT | Must be dimensionless |
| a | The dimensionless quantity |
| scalar | The scalar value to compare against |
Definition at line 359 of file Quantity.hpp.
| std::ostream & Phyth::operator<< | ( | std::ostream & | os, |
| const Quantity< UnitT > & | q | ||
| ) |
Stream insertion operator for Quantity.
| UnitT | The unit type of the quantity |
| os | The output stream |
| q | The quantity to output |
Definition at line 763 of file Quantity.hpp.
Less-than-or-equal comparison: scalar <= dimensionless quantity.
| UnitT | Must be dimensionless |
| scalar | The scalar value |
| a | The dimensionless quantity |
Definition at line 434 of file Quantity.hpp.
Less-than-or-equal comparison between two quantities.
| a | Left quantity |
| b | Right quantity |
Example: 1.0_m <= 100.0_cm // true (equal) 1.0_m <= 150.0_cm // true 1.0_m <= 80.0_cm // false
Definition at line 259 of file Quantity.hpp.
Less-than-or-equal comparison: dimensionless quantity <= scalar.
| UnitT | Must be dimensionless |
| a | The dimensionless quantity |
| scalar | The scalar value to compare against |
Definition at line 419 of file Quantity.hpp.
Equality comparison: scalar == dimensionless quantity.
| UnitT | Must be dimensionless |
| scalar | The scalar value |
| a | The dimensionless quantity |
Example: auto angle = 1.0_rad; if (1.0 == angle) { ... } // true
Definition at line 314 of file Quantity.hpp.
Equality comparison between two quantities.
| a | Left quantity |
| b | Right quantity |
Example: 1.0_km == 1000.0_m // true 1.0_km == 999.0_m // false
Definition at line 182 of file Quantity.hpp.
Equality comparison: dimensionless quantity == scalar.
| UnitT | Must be dimensionless |
| a | The dimensionless quantity |
| scalar | The scalar value to compare against |
Example: auto angle = 1.0_rad; if (angle == 1.0) { ... } // true
Definition at line 295 of file Quantity.hpp.
Greater-than comparison: scalar > dimensionless quantity.
| UnitT | Must be dimensionless |
| scalar | The scalar value |
| a | The dimensionless quantity |
Definition at line 404 of file Quantity.hpp.
Greater-than comparison between two quantities.
| a | Left quantity |
| b | Right quantity |
Example: 1.0_m > 100.0_cm // false (equal) 1.0_m > 80.0_cm // true (1m > 0.8m)
Definition at line 240 of file Quantity.hpp.
Greater-than comparison: dimensionless quantity > scalar.
| UnitT | Must be dimensionless |
| a | The dimensionless quantity |
| scalar | The scalar value to compare against |
Definition at line 389 of file Quantity.hpp.
Greater-than-or-equal comparison: scalar >= dimensionless quantity.
| UnitT | Must be dimensionless |
| scalar | The scalar value |
| a | The dimensionless quantity |
Definition at line 464 of file Quantity.hpp.
Greater-than-or-equal comparison between two quantities.
| a | Left quantity |
| b | Right quantity |
Example: 1.0_m >= 100.0_cm // true (equal) 1.0_m >= 80.0_cm // true 1.0_m >= 150.0_cm // false
Definition at line 278 of file Quantity.hpp.
Greater-than-or-equal comparison: dimensionless quantity >= scalar.
| UnitT | Must be dimensionless |
| a | The dimensionless quantity |
| scalar | The scalar value to compare against |
Definition at line 449 of file Quantity.hpp.
| Phyth::PHYTH_DEFINE_UNIT_WITH_NAME | ( | AngularVelocity | , |
| RadianPerSecond | , | ||
| radps | , | ||
| 1 | , | ||
| 1 | , | ||
| "rad/s" | |||
| ) |
Convert a Quantity to a human-readable string.
Output format depends on Config::output_mode:
If the unit has no registered symbol or name, falls back to dimension string.
| UnitT | The unit type of the quantity |
| q | The quantity to convert |
Definition at line 738 of file Quantity.hpp.
Get the full name string for a unit type (e.g., "meter", "kilogram")
| UnitT | The unit type to look up |
Definition at line 706 of file Quantity.hpp.
Get the symbol string for a unit type (e.g., "m", "kg", "N")
| UnitT | The unit type to look up |
Definition at line 695 of file Quantity.hpp.
Convenience variable template for DimEqual.
Definition at line 149 of file Dimension.hpp.
Convenience variable template for DimPower.
Example: dim_power_v<0, Velocity> -> 1 (m^1) dim_power_v<2, Velocity> -> -1 (s^-1)
Definition at line 367 of file Dimension.hpp.
Convenience variable template for is_dim.
Definition at line 166 of file Dimension.hpp.
|
inlineconstexpr |
Convenience variable template for is_dimensionless.
Definition at line 341 of file Dimension.hpp.
Convenience variable template for is_quantity.
Definition at line 165 of file Quantity.hpp.
|
inlineconstexpr |
Convenience variable template for is_quaternion.
Definition at line 459 of file Quaternion.hpp.
|
inlineconstexpr |
Convenience variable template for is_vector3.
Definition at line 441 of file Vector3.hpp.
|
inlineconstexpr |
Definition at line 224 of file Vector.hpp.