unitforge 0.5.7__tar.gz → 0.5.10__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. {unitforge-0.5.7 → unitforge-0.5.10}/Cargo.lock +2 -2
  2. {unitforge-0.5.7 → unitforge-0.5.10}/Cargo.toml +2 -2
  3. {unitforge-0.5.7 → unitforge-0.5.10}/PKG-INFO +3 -1
  4. {unitforge-0.5.7 → unitforge-0.5.10}/install_hooks.sh +0 -0
  5. {unitforge-0.5.7 → unitforge-0.5.10}/src/lib.rs +18 -0
  6. unitforge-0.5.10/src/quantities/heat_flux.rs +38 -0
  7. unitforge-0.5.10/src/quantities/power.rs +52 -0
  8. unitforge-0.5.10/src/quantities/specific_energy.rs +39 -0
  9. unitforge-0.5.10/src/quantities/specific_heat_capacity.rs +39 -0
  10. unitforge-0.5.10/src/quantities/temperature_gradient.rs +42 -0
  11. unitforge-0.5.10/src/quantities/thermal_conductance.rs +42 -0
  12. unitforge-0.5.10/src/quantities/thermal_conductivity.rs +42 -0
  13. unitforge-0.5.10/src/quantities/volumetric_energy_density.rs +39 -0
  14. unitforge-0.5.10/src/quantities/volumetric_heat_capacity.rs +39 -0
  15. {unitforge-0.5.7 → unitforge-0.5.10}/src/relations.rs +25 -8
  16. {unitforge-0.5.7 → unitforge-0.5.10}/test.sh +0 -0
  17. {unitforge-0.5.7 → unitforge-0.5.10}/tests/quantities.rs +166 -0
  18. {unitforge-0.5.7 → unitforge-0.5.10}/unitforge_macros/Cargo.toml +1 -1
  19. unitforge-0.5.7/python/unitforge/__init__.pyi +0 -2975
  20. unitforge-0.5.7/python/unitforge/py.typed +0 -0
  21. {unitforge-0.5.7 → unitforge-0.5.10}/.gitignore +0 -0
  22. {unitforge-0.5.7 → unitforge-0.5.10}/.gitlab-ci.yml +0 -0
  23. {unitforge-0.5.7 → unitforge-0.5.10}/Readme.md +0 -0
  24. {unitforge-0.5.7 → unitforge-0.5.10}/Readme_py.md +0 -0
  25. {unitforge-0.5.7 → unitforge-0.5.10}/pyproject.toml +0 -0
  26. {unitforge-0.5.7 → unitforge-0.5.10}/python/unitforge/__init__.py +0 -0
  27. {unitforge-0.5.7 → unitforge-0.5.10}/scripts/generate_python_stubs.py +0 -0
  28. {unitforge-0.5.7 → unitforge-0.5.10}/src/errors.rs +0 -0
  29. {unitforge-0.5.7 → unitforge-0.5.10}/src/impl_macros.rs +0 -0
  30. {unitforge-0.5.7 → unitforge-0.5.10}/src/internal.rs +0 -0
  31. {unitforge-0.5.7 → unitforge-0.5.10}/src/prelude.rs +0 -0
  32. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/acceleration.rs +0 -0
  33. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/angle.rs +0 -0
  34. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/angular_acceleration.rs +0 -0
  35. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/angular_velocity.rs +0 -0
  36. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/area.rs +0 -0
  37. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/area_of_moment.rs +0 -0
  38. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/charge.rs +0 -0
  39. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/compliance.rs +0 -0
  40. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/density.rs +0 -0
  41. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/density_rate.rs +0 -0
  42. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/density_temperature.rs +0 -0
  43. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/density_temperature_rate.rs +0 -0
  44. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/distance.rs +0 -0
  45. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/force.rs +0 -0
  46. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/force_area.rs +0 -0
  47. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/force_distance.rs +0 -0
  48. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/force_div_distance_power_four.rs +0 -0
  49. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/force_per_volume.rs +0 -0
  50. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/force_stress.rs +0 -0
  51. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/force_volume.rs +0 -0
  52. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/frequency.rs +0 -0
  53. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/inverse_angle.rs +0 -0
  54. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/inverse_area.rs +0 -0
  55. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/inverse_distance.rs +0 -0
  56. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/inverse_stress.rs +0 -0
  57. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/inverse_temperature.rs +0 -0
  58. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/mass.rs +0 -0
  59. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/mass_per_distance.rs +0 -0
  60. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/molar_mass.rs +0 -0
  61. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/pressure_rate.rs +0 -0
  62. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/rotational_stiffness.rs +0 -0
  63. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/specific_gas_constant.rs +0 -0
  64. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/stiffness.rs +0 -0
  65. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/strain.rs +0 -0
  66. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/strain_squared.rs +0 -0
  67. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/stress.rs +0 -0
  68. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/stress_cubed.rs +0 -0
  69. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/stress_per_temperature.rs +0 -0
  70. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/stress_rate.rs +0 -0
  71. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/stress_rate_per_temperature.rs +0 -0
  72. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/stress_squared.rs +0 -0
  73. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/temperature.rs +0 -0
  74. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/time.rs +0 -0
  75. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/universal_gas_constant.rs +0 -0
  76. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/velocity.rs +0 -0
  77. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/velocity_squared.rs +0 -0
  78. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/voltage.rs +0 -0
  79. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities/volume.rs +0 -0
  80. {unitforge-0.5.7 → unitforge-0.5.10}/src/quantities.template.rs +0 -0
  81. {unitforge-0.5.7 → unitforge-0.5.10}/src/small_linalg/bindings/matrix3_py.template.rs +0 -0
  82. {unitforge-0.5.7 → unitforge-0.5.10}/src/small_linalg/bindings/vector3_py.template.rs +0 -0
  83. {unitforge-0.5.7 → unitforge-0.5.10}/src/small_linalg/matrix2.rs +0 -0
  84. {unitforge-0.5.7 → unitforge-0.5.10}/src/small_linalg/matrix2x3.rs +0 -0
  85. {unitforge-0.5.7 → unitforge-0.5.10}/src/small_linalg/matrix3.rs +0 -0
  86. {unitforge-0.5.7 → unitforge-0.5.10}/src/small_linalg/matrix3x2.rs +0 -0
  87. {unitforge-0.5.7 → unitforge-0.5.10}/src/small_linalg/vector2.rs +0 -0
  88. {unitforge-0.5.7 → unitforge-0.5.10}/src/small_linalg/vector3.rs +0 -0
  89. {unitforge-0.5.7 → unitforge-0.5.10}/tests/common/mod.rs +0 -0
  90. {unitforge-0.5.7 → unitforge-0.5.10}/tests/matrix2.rs +0 -0
  91. {unitforge-0.5.7 → unitforge-0.5.10}/tests/matrix2x3.rs +0 -0
  92. {unitforge-0.5.7 → unitforge-0.5.10}/tests/matrix3.rs +0 -0
  93. {unitforge-0.5.7 → unitforge-0.5.10}/tests/matrix3x2.rs +0 -0
  94. {unitforge-0.5.7 → unitforge-0.5.10}/tests/ndarray_dot.rs +0 -0
  95. {unitforge-0.5.7 → unitforge-0.5.10}/tests/quantity_core/constants.rs +0 -0
  96. {unitforge-0.5.7 → unitforge-0.5.10}/tests/quantity_core/construction.rs +0 -0
  97. {unitforge-0.5.7 → unitforge-0.5.10}/tests/quantity_core/enum_iter.rs +0 -0
  98. {unitforge-0.5.7 → unitforge-0.5.10}/tests/quantity_core/metadata.rs +0 -0
  99. {unitforge-0.5.7 → unitforge-0.5.10}/tests/quantity_core/normalization.rs +0 -0
  100. {unitforge-0.5.7 → unitforge-0.5.10}/tests/quantity_core/plain_storage.rs +0 -0
  101. {unitforge-0.5.7 → unitforge-0.5.10}/tests/quantity_core/relations.rs +0 -0
  102. {unitforge-0.5.7 → unitforge-0.5.10}/tests/quantity_core/runtime_quantity.rs +0 -0
  103. {unitforge-0.5.7 → unitforge-0.5.10}/tests/quantity_core/scalar_edges.rs +0 -0
  104. {unitforge-0.5.7 → unitforge-0.5.10}/tests/quantity_core.rs +0 -0
  105. {unitforge-0.5.7 → unitforge-0.5.10}/tests/quantity_serde.rs +0 -0
  106. {unitforge-0.5.7 → unitforge-0.5.10}/tests/small_linalg_edge_cases.rs +0 -0
  107. {unitforge-0.5.7 → unitforge-0.5.10}/tests/small_linalg_interfaces.rs +0 -0
  108. {unitforge-0.5.7 → unitforge-0.5.10}/tests/test_quantities.py +0 -0
  109. {unitforge-0.5.7 → unitforge-0.5.10}/tests/test_small_linalg.py +0 -0
  110. {unitforge-0.5.7 → unitforge-0.5.10}/tests/typecheck/mypy_smoke.py +0 -0
  111. {unitforge-0.5.7 → unitforge-0.5.10}/tests/vector2.rs +0 -0
  112. {unitforge-0.5.7 → unitforge-0.5.10}/tests/vector3.rs +0 -0
  113. {unitforge-0.5.7 → unitforge-0.5.10}/unitforge_macros/src/lib.rs +0 -0
@@ -351,7 +351,7 @@ checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
351
351
 
352
352
  [[package]]
353
353
  name = "unitforge"
354
- version = "0.5.7"
354
+ version = "0.5.10"
355
355
  dependencies = [
356
356
  "ndarray",
357
357
  "num-traits",
@@ -367,7 +367,7 @@ dependencies = [
367
367
 
368
368
  [[package]]
369
369
  name = "unitforge_macros"
370
- version = "0.5.7"
370
+ version = "0.5.10"
371
371
  dependencies = [
372
372
  "regex",
373
373
  ]
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "unitforge"
3
- version = "0.5.7"
3
+ version = "0.5.10"
4
4
  edition = "2021"
5
5
  authors = ["Dr.Q team <info@askdrq.com>", "Henrik Stromberg <henrik@askdrq.com>"]
6
6
  description = "A library for unit and quantity consistent computations in Rust"
@@ -20,7 +20,7 @@ pyo3 = { version = "0.28.3", features = ["extension-module", "auto-initialize",
20
20
  numpy = { version = "0.28.0", optional = true }
21
21
  strum = { version = "0.28.0", optional = true }
22
22
  strum_macros = { version = "0.28.0", optional = true }
23
- unitforge_macros = { version = "0.5.7", path = "unitforge_macros" }
23
+ unitforge_macros = { version = "0.5.10", path = "unitforge_macros" }
24
24
 
25
25
  [features]
26
26
  default = []
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: unitforge
3
- Version: 0.5.7
3
+ Version: 0.5.10
4
4
  Classifier: Programming Language :: Python :: 3
5
5
  Classifier: Programming Language :: Rust
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -9,7 +9,9 @@ Classifier: Topic :: Scientific/Engineering :: Physics
9
9
  Requires-Dist: numpy>=2.2.0
10
10
  Summary: A library for unit and quantity consistent computations in Rust
11
11
  Keywords: units,quantities,simulation,physics
12
+ Author: Dr.Q team <info@askdrq.com>, Henrik Stromberg <henrik@askdrq.com>
12
13
  Author-email: "Dr.Q team" <info@askdrq.com>, Henrik Stromberg <henrik@askdrq.com>
14
+ License: MIT
13
15
  Requires-Python: >=3.7
14
16
  Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
15
17
  Project-URL: Repository, https://gitlab.com/henrikjstromberg/unitforge
File without changes
@@ -93,6 +93,8 @@ pub mod quantities {
93
93
  pub use force_volume::*;
94
94
  pub mod frequency;
95
95
  pub use frequency::*;
96
+ pub mod heat_flux;
97
+ pub use heat_flux::*;
96
98
  pub mod inverse_distance;
97
99
  pub use inverse_distance::*;
98
100
  pub mod inverse_area;
@@ -107,12 +109,18 @@ pub mod quantities {
107
109
  pub use mass_per_distance::*;
108
110
  pub mod pressure_rate;
109
111
  pub use pressure_rate::*;
112
+ pub mod power;
113
+ pub use power::*;
110
114
  pub mod force_distance;
111
115
  pub use force_distance::*;
112
116
  pub mod force_stress;
113
117
  pub use force_stress::*;
114
118
  pub mod specific_gas_constant;
115
119
  pub use specific_gas_constant::*;
120
+ pub mod specific_energy;
121
+ pub use specific_energy::*;
122
+ pub mod specific_heat_capacity;
123
+ pub use specific_heat_capacity::*;
116
124
  pub mod stiffness;
117
125
  pub use stiffness::*;
118
126
  pub mod rotational_stiffness;
@@ -135,8 +143,14 @@ pub mod quantities {
135
143
  pub use stress_squared::*;
136
144
  pub mod temperature;
137
145
  pub use temperature::*;
146
+ pub mod temperature_gradient;
147
+ pub use temperature_gradient::*;
148
+ pub mod thermal_conductance;
149
+ pub use thermal_conductance::*;
138
150
  pub mod inverse_temperature;
139
151
  pub use inverse_temperature::*;
152
+ pub mod thermal_conductivity;
153
+ pub use thermal_conductivity::*;
140
154
  pub mod time;
141
155
  pub use time::*;
142
156
  pub mod universal_gas_constant;
@@ -151,6 +165,10 @@ pub mod quantities {
151
165
  pub use voltage::*;
152
166
  pub mod inverse_angle;
153
167
  pub use inverse_angle::*;
168
+ pub mod volumetric_heat_capacity;
169
+ pub use volumetric_heat_capacity::*;
170
+ pub mod volumetric_energy_density;
171
+ pub use volumetric_energy_density::*;
154
172
  }
155
173
  pub use quantities::*;
156
174
 
@@ -0,0 +1,38 @@
1
+ use crate::impl_macros::macros::*;
2
+
3
+ #[cfg_attr(feature = "strum", derive(EnumIter))]
4
+ #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
5
+ #[derive(Copy, Clone, PartialEq, Debug, Hash, Eq)]
6
+ #[cfg_attr(feature = "pyo3", pyclass(eq, eq_int, from_py_object))]
7
+ pub enum HeatFluxUnit {
8
+ W_msq,
9
+ mW_msq,
10
+ kW_msq,
11
+ }
12
+
13
+ impl HeatFluxUnit {
14
+ pub const fn base_per_x_const(self) -> (f64, i32) {
15
+ match self {
16
+ HeatFluxUnit::W_msq => (1., 0),
17
+ HeatFluxUnit::mW_msq => (1., -3),
18
+ HeatFluxUnit::kW_msq => (1., 3),
19
+ }
20
+ }
21
+ }
22
+
23
+ impl PhysicsUnit for HeatFluxUnit {
24
+ fn name(&self) -> &str {
25
+ match &self {
26
+ HeatFluxUnit::W_msq => "W/m²",
27
+ HeatFluxUnit::mW_msq => "mW/m²",
28
+ HeatFluxUnit::kW_msq => "kW/m²",
29
+ }
30
+ }
31
+
32
+ fn base_per_x(&self) -> (f64, i32) {
33
+ (*self).base_per_x_const()
34
+ }
35
+ }
36
+
37
+ impl_quantity!(HeatFlux, HeatFluxUnit, [HeatFluxUnit::W_msq]);
38
+ impl_div_with_self_to_f64!(HeatFlux);
@@ -0,0 +1,52 @@
1
+ use crate::impl_macros::macros::*;
2
+
3
+ #[cfg_attr(feature = "strum", derive(EnumIter))]
4
+ #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
5
+ #[derive(Copy, Clone, PartialEq, Debug, Hash, Eq)]
6
+ #[cfg_attr(feature = "pyo3", pyclass(eq, eq_int, from_py_object))]
7
+ pub enum PowerUnit {
8
+ GW,
9
+ MW,
10
+ kW,
11
+ W,
12
+ mW,
13
+ muW,
14
+ nW,
15
+ }
16
+
17
+ make_alias!(Power, PowerUnit, HeatRate, HeatRateUnit);
18
+
19
+ impl PowerUnit {
20
+ pub const fn base_per_x_const(self) -> (f64, i32) {
21
+ match self {
22
+ PowerUnit::GW => (1., 9),
23
+ PowerUnit::MW => (1., 6),
24
+ PowerUnit::kW => (1., 3),
25
+ PowerUnit::W => (1., 0),
26
+ PowerUnit::mW => (1., -3),
27
+ PowerUnit::muW => (1., -6),
28
+ PowerUnit::nW => (1., -9),
29
+ }
30
+ }
31
+ }
32
+
33
+ impl PhysicsUnit for PowerUnit {
34
+ fn name(&self) -> &str {
35
+ match &self {
36
+ PowerUnit::GW => "GW",
37
+ PowerUnit::MW => "MW",
38
+ PowerUnit::kW => "kW",
39
+ PowerUnit::W => "W",
40
+ PowerUnit::mW => "mW",
41
+ PowerUnit::muW => "μW",
42
+ PowerUnit::nW => "nW",
43
+ }
44
+ }
45
+
46
+ fn base_per_x(&self) -> (f64, i32) {
47
+ (*self).base_per_x_const()
48
+ }
49
+ }
50
+
51
+ impl_quantity!(Power, PowerUnit, [PowerUnit::W]);
52
+ impl_div_with_self_to_f64!(Power);
@@ -0,0 +1,39 @@
1
+ use crate::impl_macros::macros::*;
2
+
3
+ #[cfg_attr(feature = "strum", derive(EnumIter))]
4
+ #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
5
+ #[derive(Copy, Clone, PartialEq, Debug, Hash, Eq)]
6
+ #[cfg_attr(feature = "pyo3", pyclass(eq, eq_int, from_py_object))]
7
+ pub enum SpecificEnergyUnit {
8
+ J_kg,
9
+ kJ_kg,
10
+ }
11
+
12
+ impl SpecificEnergyUnit {
13
+ pub const fn base_per_x_const(self) -> (f64, i32) {
14
+ match self {
15
+ SpecificEnergyUnit::J_kg => (1., 0),
16
+ SpecificEnergyUnit::kJ_kg => (1., 3),
17
+ }
18
+ }
19
+ }
20
+
21
+ impl PhysicsUnit for SpecificEnergyUnit {
22
+ fn name(&self) -> &str {
23
+ match &self {
24
+ SpecificEnergyUnit::J_kg => "J/kg",
25
+ SpecificEnergyUnit::kJ_kg => "kJ/kg",
26
+ }
27
+ }
28
+
29
+ fn base_per_x(&self) -> (f64, i32) {
30
+ (*self).base_per_x_const()
31
+ }
32
+ }
33
+
34
+ impl_quantity!(
35
+ SpecificEnergy,
36
+ SpecificEnergyUnit,
37
+ [SpecificEnergyUnit::J_kg]
38
+ );
39
+ impl_div_with_self_to_f64!(SpecificEnergy);
@@ -0,0 +1,39 @@
1
+ use crate::impl_macros::macros::*;
2
+
3
+ #[cfg_attr(feature = "strum", derive(EnumIter))]
4
+ #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
5
+ #[derive(Copy, Clone, PartialEq, Debug, Hash, Eq)]
6
+ #[cfg_attr(feature = "pyo3", pyclass(eq, eq_int, from_py_object))]
7
+ pub enum SpecificHeatCapacityUnit {
8
+ J_kgK,
9
+ kJ_kgK,
10
+ }
11
+
12
+ impl SpecificHeatCapacityUnit {
13
+ pub const fn base_per_x_const(self) -> (f64, i32) {
14
+ match self {
15
+ SpecificHeatCapacityUnit::J_kgK => (1., 0),
16
+ SpecificHeatCapacityUnit::kJ_kgK => (1., 3),
17
+ }
18
+ }
19
+ }
20
+
21
+ impl PhysicsUnit for SpecificHeatCapacityUnit {
22
+ fn name(&self) -> &str {
23
+ match &self {
24
+ SpecificHeatCapacityUnit::J_kgK => "J/(kg*K)",
25
+ SpecificHeatCapacityUnit::kJ_kgK => "kJ/(kg*K)",
26
+ }
27
+ }
28
+
29
+ fn base_per_x(&self) -> (f64, i32) {
30
+ (*self).base_per_x_const()
31
+ }
32
+ }
33
+
34
+ impl_quantity!(
35
+ SpecificHeatCapacity,
36
+ SpecificHeatCapacityUnit,
37
+ [SpecificHeatCapacityUnit::J_kgK]
38
+ );
39
+ impl_div_with_self_to_f64!(SpecificHeatCapacity);
@@ -0,0 +1,42 @@
1
+ use crate::impl_macros::macros::*;
2
+
3
+ #[cfg_attr(feature = "strum", derive(EnumIter))]
4
+ #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
5
+ #[derive(Copy, Clone, PartialEq, Debug, Hash, Eq)]
6
+ #[cfg_attr(feature = "pyo3", pyclass(eq, eq_int, from_py_object))]
7
+ pub enum TemperatureGradientUnit {
8
+ K_m,
9
+ K_mm,
10
+ K_km,
11
+ }
12
+
13
+ impl TemperatureGradientUnit {
14
+ pub const fn base_per_x_const(self) -> (f64, i32) {
15
+ match self {
16
+ TemperatureGradientUnit::K_m => (1., 0),
17
+ TemperatureGradientUnit::K_mm => (1., 3),
18
+ TemperatureGradientUnit::K_km => (1., -3),
19
+ }
20
+ }
21
+ }
22
+
23
+ impl PhysicsUnit for TemperatureGradientUnit {
24
+ fn name(&self) -> &str {
25
+ match &self {
26
+ TemperatureGradientUnit::K_m => "K/m",
27
+ TemperatureGradientUnit::K_mm => "K/mm",
28
+ TemperatureGradientUnit::K_km => "K/km",
29
+ }
30
+ }
31
+
32
+ fn base_per_x(&self) -> (f64, i32) {
33
+ (*self).base_per_x_const()
34
+ }
35
+ }
36
+
37
+ impl_quantity!(
38
+ TemperatureGradient,
39
+ TemperatureGradientUnit,
40
+ [TemperatureGradientUnit::K_m]
41
+ );
42
+ impl_div_with_self_to_f64!(TemperatureGradient);
@@ -0,0 +1,42 @@
1
+ use crate::impl_macros::macros::*;
2
+
3
+ #[cfg_attr(feature = "strum", derive(EnumIter))]
4
+ #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
5
+ #[derive(Copy, Clone, PartialEq, Debug, Hash, Eq)]
6
+ #[cfg_attr(feature = "pyo3", pyclass(eq, eq_int, from_py_object))]
7
+ pub enum ThermalConductanceUnit {
8
+ mW_K,
9
+ W_K,
10
+ kW_K,
11
+ }
12
+
13
+ impl ThermalConductanceUnit {
14
+ pub const fn base_per_x_const(self) -> (f64, i32) {
15
+ match self {
16
+ ThermalConductanceUnit::mW_K => (1., -3),
17
+ ThermalConductanceUnit::W_K => (1., 0),
18
+ ThermalConductanceUnit::kW_K => (1., 3),
19
+ }
20
+ }
21
+ }
22
+
23
+ impl PhysicsUnit for ThermalConductanceUnit {
24
+ fn name(&self) -> &str {
25
+ match self {
26
+ ThermalConductanceUnit::mW_K => "mW/K",
27
+ ThermalConductanceUnit::W_K => "W/K",
28
+ ThermalConductanceUnit::kW_K => "kW/K",
29
+ }
30
+ }
31
+
32
+ fn base_per_x(&self) -> (f64, i32) {
33
+ (*self).base_per_x_const()
34
+ }
35
+ }
36
+
37
+ impl_quantity!(
38
+ ThermalConductance,
39
+ ThermalConductanceUnit,
40
+ [ThermalConductanceUnit::W_K]
41
+ );
42
+ impl_div_with_self_to_f64!(ThermalConductance);
@@ -0,0 +1,42 @@
1
+ use crate::impl_macros::macros::*;
2
+
3
+ #[cfg_attr(feature = "strum", derive(EnumIter))]
4
+ #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
5
+ #[derive(Copy, Clone, PartialEq, Debug, Hash, Eq)]
6
+ #[cfg_attr(feature = "pyo3", pyclass(eq, eq_int, from_py_object))]
7
+ pub enum ThermalConductivityUnit {
8
+ W_mK,
9
+ mW_mK,
10
+ kW_mK,
11
+ }
12
+
13
+ impl ThermalConductivityUnit {
14
+ pub const fn base_per_x_const(self) -> (f64, i32) {
15
+ match self {
16
+ ThermalConductivityUnit::W_mK => (1., 0),
17
+ ThermalConductivityUnit::mW_mK => (1., -3),
18
+ ThermalConductivityUnit::kW_mK => (1., 3),
19
+ }
20
+ }
21
+ }
22
+
23
+ impl PhysicsUnit for ThermalConductivityUnit {
24
+ fn name(&self) -> &str {
25
+ match &self {
26
+ ThermalConductivityUnit::W_mK => "W/(m*K)",
27
+ ThermalConductivityUnit::mW_mK => "mW/(m*K)",
28
+ ThermalConductivityUnit::kW_mK => "kW/(m*K)",
29
+ }
30
+ }
31
+
32
+ fn base_per_x(&self) -> (f64, i32) {
33
+ (*self).base_per_x_const()
34
+ }
35
+ }
36
+
37
+ impl_quantity!(
38
+ ThermalConductivity,
39
+ ThermalConductivityUnit,
40
+ [ThermalConductivityUnit::W_mK]
41
+ );
42
+ impl_div_with_self_to_f64!(ThermalConductivity);
@@ -0,0 +1,39 @@
1
+ use crate::impl_macros::macros::*;
2
+
3
+ #[cfg_attr(feature = "strum", derive(EnumIter))]
4
+ #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
5
+ #[derive(Copy, Clone, PartialEq, Debug, Hash, Eq)]
6
+ #[cfg_attr(feature = "pyo3", pyclass(eq, eq_int, from_py_object))]
7
+ pub enum VolumetricEnergyDensityUnit {
8
+ J_mcb,
9
+ kJ_mcb,
10
+ }
11
+
12
+ impl VolumetricEnergyDensityUnit {
13
+ pub const fn base_per_x_const(self) -> (f64, i32) {
14
+ match self {
15
+ VolumetricEnergyDensityUnit::J_mcb => (1., 0),
16
+ VolumetricEnergyDensityUnit::kJ_mcb => (1., 3),
17
+ }
18
+ }
19
+ }
20
+
21
+ impl PhysicsUnit for VolumetricEnergyDensityUnit {
22
+ fn name(&self) -> &str {
23
+ match &self {
24
+ VolumetricEnergyDensityUnit::J_mcb => "J/m³",
25
+ VolumetricEnergyDensityUnit::kJ_mcb => "kJ/m³",
26
+ }
27
+ }
28
+
29
+ fn base_per_x(&self) -> (f64, i32) {
30
+ (*self).base_per_x_const()
31
+ }
32
+ }
33
+
34
+ impl_quantity!(
35
+ VolumetricEnergyDensity,
36
+ VolumetricEnergyDensityUnit,
37
+ [VolumetricEnergyDensityUnit::J_mcb]
38
+ );
39
+ impl_div_with_self_to_f64!(VolumetricEnergyDensity);
@@ -0,0 +1,39 @@
1
+ use crate::impl_macros::macros::*;
2
+
3
+ #[cfg_attr(feature = "strum", derive(EnumIter))]
4
+ #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
5
+ #[derive(Copy, Clone, PartialEq, Debug, Hash, Eq)]
6
+ #[cfg_attr(feature = "pyo3", pyclass(eq, eq_int, from_py_object))]
7
+ pub enum VolumetricHeatCapacityUnit {
8
+ J_mcbK,
9
+ kJ_mcbK,
10
+ }
11
+
12
+ impl VolumetricHeatCapacityUnit {
13
+ pub const fn base_per_x_const(self) -> (f64, i32) {
14
+ match self {
15
+ VolumetricHeatCapacityUnit::J_mcbK => (1., 0),
16
+ VolumetricHeatCapacityUnit::kJ_mcbK => (1., 3),
17
+ }
18
+ }
19
+ }
20
+
21
+ impl PhysicsUnit for VolumetricHeatCapacityUnit {
22
+ fn name(&self) -> &str {
23
+ match &self {
24
+ VolumetricHeatCapacityUnit::J_mcbK => "J/(m³*K)",
25
+ VolumetricHeatCapacityUnit::kJ_mcbK => "kJ/(m³*K)",
26
+ }
27
+ }
28
+
29
+ fn base_per_x(&self) -> (f64, i32) {
30
+ (*self).base_per_x_const()
31
+ }
32
+ }
33
+
34
+ impl_quantity!(
35
+ VolumetricHeatCapacity,
36
+ VolumetricHeatCapacityUnit,
37
+ [VolumetricHeatCapacityUnit::J_mcbK]
38
+ );
39
+ impl_div_with_self_to_f64!(VolumetricHeatCapacity);
@@ -28,6 +28,13 @@ impl_mul_relation_with_other!(Distance, InverseArea, InverseDistance);
28
28
  impl_mul_relation_with_other!(InverseDistance, Area, Distance);
29
29
  impl_mul_relation_with_other!(Velocity, Time, Distance);
30
30
  impl_mul_relation_with_other!(Force, Distance, ForceDistance);
31
+ impl_mul_relation_with_other!(Power, Time, ForceDistance);
32
+ impl_mul_relation_with_other!(Force, Velocity, Power);
33
+ impl_mul_relation_with_other!(HeatFlux, Area, Power);
34
+ impl_mul_relation_with_other!(ThermalConductivity, TemperatureGradient, HeatFlux);
35
+ impl_mul_relation_with_other!(TemperatureGradient, Distance, Temperature);
36
+ impl_mul_relation_with_other!(ThermalConductivity, Distance, ThermalConductance);
37
+ impl_mul_relation_with_other!(ThermalConductance, Temperature, Power);
31
38
  impl_mul_relation_with_other!(Force, Area, ForceArea);
32
39
  impl_mul_relation_with_other!(ForceArea, Distance, ForceVolume);
33
40
  impl_mul_relation_with_other!(AreaOfMoment, Stress, ForceArea);
@@ -73,18 +80,28 @@ impl_mul_relation_with_other!(SpecificGasConstant, DensityTemperatureRate, Stres
73
80
  impl_mul_relation_with_other!(DensityRate, SpecificGasConstant, StressRatePerTemperature);
74
81
  impl_mul_relation_with_other!(StressRatePerTemperature, Temperature, StressRate);
75
82
  impl_mul_relation_with_other!(InverseTemperature, Temperature, Strain);
76
- impl_mul!(InverseDistance, Distance, f64);
77
- impl_mul!(InverseAngle, Angle, f64);
78
- impl_mul!(InverseStress, Stress, f64);
79
- impl_mul!(Frequency, Time, f64);
80
- impl_div!(Stress, Strain, Stress);
81
- impl_mul!(Stress, Strain, Stress);
82
-
83
83
  impl_mul_relation_with_self!(Distance, Area);
84
84
  impl_mul_relation_with_self!(Area, AreaOfMoment);
85
85
  impl_mul_relation_with_self!(InverseDistance, InverseArea);
86
86
  impl_mul_relation_with_self!(Strain, StrainSquared);
87
87
  impl_mul_relation_with_self!(Stress, StressSquared);
88
88
  impl_mul_relation_with_other!(Stress, StressSquared, StressCubed);
89
- impl_div!(StressSquared, StressCubed, InverseStress);
90
89
  impl_mul_relation_with_self!(AngularVelocity, AngularAcceleration);
90
+ impl_mul_relation_with_other!(ForceDistance, Frequency, Power);
91
+ impl_mul_relation_with_other!(Density, SpecificHeatCapacity, VolumetricHeatCapacity);
92
+ impl_mul_relation_with_other!(VolumetricHeatCapacity, Temperature, VolumetricEnergyDensity);
93
+ impl_mul_relation_with_other!(SpecificHeatCapacity, Temperature, SpecificEnergy);
94
+ impl_mul_relation_with_other!(SpecificEnergy, Density, VolumetricEnergyDensity);
95
+ impl_mul_relation_with_other!(
96
+ DensityTemperature,
97
+ SpecificHeatCapacity,
98
+ VolumetricEnergyDensity
99
+ );
100
+
101
+ impl_mul!(InverseDistance, Distance, f64);
102
+ impl_mul!(InverseAngle, Angle, f64);
103
+ impl_mul!(InverseStress, Stress, f64);
104
+ impl_mul!(Frequency, Time, f64);
105
+ impl_div!(Stress, Strain, Stress);
106
+ impl_mul!(Stress, Strain, Stress);
107
+ impl_div!(StressSquared, StressCubed, InverseStress);
File without changes