unitforge 0.3.2__tar.gz → 0.3.3__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 (64) hide show
  1. {unitforge-0.3.2 → unitforge-0.3.3}/Cargo.lock +1 -1
  2. {unitforge-0.3.2 → unitforge-0.3.3}/Cargo.toml +1 -1
  3. {unitforge-0.3.2 → unitforge-0.3.3}/PKG-INFO +1 -3
  4. {unitforge-0.3.2 → unitforge-0.3.3}/src/lib.rs +2 -0
  5. unitforge-0.3.3/src/quantities/rotational_stiffness.rs +43 -0
  6. {unitforge-0.3.2 → unitforge-0.3.3}/src/relations.rs +1 -0
  7. {unitforge-0.3.2 → unitforge-0.3.3}/src/small_linalg/matrix2.rs +6 -0
  8. {unitforge-0.3.2 → unitforge-0.3.3}/tests/matrix2.rs +6 -0
  9. {unitforge-0.3.2 → unitforge-0.3.3}/.gitignore +0 -0
  10. {unitforge-0.3.2 → unitforge-0.3.3}/.gitlab-ci.yml +0 -0
  11. {unitforge-0.3.2 → unitforge-0.3.3}/Readme.md +0 -0
  12. {unitforge-0.3.2 → unitforge-0.3.3}/Readme_py.md +0 -0
  13. {unitforge-0.3.2 → unitforge-0.3.3}/build.rs +0 -0
  14. {unitforge-0.3.2 → unitforge-0.3.3}/pyproject.toml +0 -0
  15. {unitforge-0.3.2 → unitforge-0.3.3}/src/impl_macros.rs +0 -0
  16. {unitforge-0.3.2 → unitforge-0.3.3}/src/prelude.rs +0 -0
  17. {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/acceleration.rs +0 -0
  18. {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/angle.rs +0 -0
  19. {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/angular_acceleration.rs +0 -0
  20. {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/angular_velocity.rs +0 -0
  21. {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/area.rs +0 -0
  22. {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/area_of_moment.rs +0 -0
  23. {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/charge.rs +0 -0
  24. {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/compliance.rs +0 -0
  25. {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/density.rs +0 -0
  26. {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/distance.rs +0 -0
  27. {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/force.rs +0 -0
  28. {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/force_area.rs +0 -0
  29. {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/force_distance.rs +0 -0
  30. {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/force_div_distance_power_four.rs +0 -0
  31. {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/force_per_volume.rs +0 -0
  32. {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/force_volume.rs +0 -0
  33. {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/inverse_area.rs +0 -0
  34. {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/inverse_distance.rs +0 -0
  35. {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/mass.rs +0 -0
  36. {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/mass_per_distance.rs +0 -0
  37. {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/stiffness.rs +0 -0
  38. {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/strain.rs +0 -0
  39. {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/stress.rs +0 -0
  40. {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/stress_squared.rs +0 -0
  41. {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/time.rs +0 -0
  42. {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/velocity.rs +0 -0
  43. {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/velocity_squared.rs +0 -0
  44. {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/voltage.rs +0 -0
  45. {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/volume.rs +0 -0
  46. {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities.template.rs +0 -0
  47. {unitforge-0.3.2 → unitforge-0.3.3}/src/small_linalg/bindings/matrix3_py.template.rs +0 -0
  48. {unitforge-0.3.2 → unitforge-0.3.3}/src/small_linalg/bindings/vector3_py.template.rs +0 -0
  49. {unitforge-0.3.2 → unitforge-0.3.3}/src/small_linalg/matrix2x3.rs +0 -0
  50. {unitforge-0.3.2 → unitforge-0.3.3}/src/small_linalg/matrix3.rs +0 -0
  51. {unitforge-0.3.2 → unitforge-0.3.3}/src/small_linalg/matrix3x2.rs +0 -0
  52. {unitforge-0.3.2 → unitforge-0.3.3}/src/small_linalg/vector2.rs +0 -0
  53. {unitforge-0.3.2 → unitforge-0.3.3}/src/small_linalg/vector3.rs +0 -0
  54. {unitforge-0.3.2 → unitforge-0.3.3}/src/tests/quantity_unit_tests.rs +0 -0
  55. {unitforge-0.3.2 → unitforge-0.3.3}/src/tests/serde_tests.rs +0 -0
  56. {unitforge-0.3.2 → unitforge-0.3.3}/tests/matrix2x3.rs +0 -0
  57. {unitforge-0.3.2 → unitforge-0.3.3}/tests/matrix3.rs +0 -0
  58. {unitforge-0.3.2 → unitforge-0.3.3}/tests/matrix3x2.rs +0 -0
  59. {unitforge-0.3.2 → unitforge-0.3.3}/tests/quantities.rs +0 -0
  60. {unitforge-0.3.2 → unitforge-0.3.3}/tests/small_linalg_interfaces.rs +0 -0
  61. {unitforge-0.3.2 → unitforge-0.3.3}/tests/test_quantities.py +0 -0
  62. {unitforge-0.3.2 → unitforge-0.3.3}/tests/test_small_linalg.py +0 -0
  63. {unitforge-0.3.2 → unitforge-0.3.3}/tests/vector2.rs +0 -0
  64. {unitforge-0.3.2 → unitforge-0.3.3}/tests/vector3.rs +0 -0
@@ -369,7 +369,7 @@ checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
369
369
 
370
370
  [[package]]
371
371
  name = "unitforge"
372
- version = "0.3.2"
372
+ version = "0.3.3"
373
373
  dependencies = [
374
374
  "ndarray",
375
375
  "num-traits",
@@ -4,7 +4,7 @@ crate-type = ["cdylib", "rlib"]
4
4
 
5
5
  [package]
6
6
  name = "unitforge"
7
- version = "0.3.2"
7
+ version = "0.3.3"
8
8
  edition = "2021"
9
9
  authors = ["Dr.Q team <info@askdrq.com>", "Henrik Stromberg <henrik@askdrq.com>"]
10
10
  description = "A library for unit and quantity consistent computations in Rust"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: unitforge
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Classifier: Programming Language :: Python :: 3
5
5
  Classifier: Programming Language :: Rust
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -9,9 +9,7 @@ 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>
13
12
  Author-email: "Dr.Q team" <info@askdrq.com>, Henrik Stromberg <henrik@askdrq.com>
14
- License: MIT
15
13
  Requires-Python: >=3.7
16
14
  Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
17
15
  Project-URL: Repository, https://gitlab.com/henrikjstromberg/unitforge
@@ -58,6 +58,8 @@ pub mod quantities {
58
58
  pub use force_distance::*;
59
59
  pub mod stiffness;
60
60
  pub use stiffness::*;
61
+ pub mod rotational_stiffness;
62
+ pub use rotational_stiffness::*;
61
63
  pub mod strain;
62
64
  pub use strain::*;
63
65
  pub mod stress;
@@ -0,0 +1,43 @@
1
+ use crate::impl_macros::macros::*;
2
+ use crate::prelude::*;
3
+ use crate::PhysicsUnit;
4
+ use ndarray::{Array1, Array2, ArrayView1, ArrayView2};
5
+ use num_traits::identities::Zero;
6
+ use num_traits::FromPrimitive;
7
+ #[cfg(feature = "pyo3")]
8
+ use pyo3::pyclass;
9
+ #[cfg(feature = "serde")]
10
+ use serde::{Deserialize, Serialize};
11
+ use std::cmp::Ordering;
12
+ use std::fmt;
13
+ use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Sub, SubAssign};
14
+ #[cfg(feature = "strum")]
15
+ use strum_macros::EnumIter;
16
+
17
+ #[cfg_attr(feature = "strum", derive(EnumIter))]
18
+ #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
19
+ #[derive(Copy, Clone, PartialEq, Debug)]
20
+ #[cfg_attr(feature = "pyo3", pyclass(eq, eq_int))]
21
+ pub enum RotationalStiffnessUnit {
22
+ Nmm_deg,
23
+ Nm_deg,
24
+ }
25
+
26
+ impl PhysicsUnit for RotationalStiffnessUnit {
27
+ fn name(&self) -> &str {
28
+ match &self {
29
+ RotationalStiffnessUnit::Nmm_deg => "Nmm/°",
30
+ RotationalStiffnessUnit::Nm_deg => "Nm/°",
31
+ }
32
+ }
33
+
34
+ fn base_per_x(&self) -> (f64, i32) {
35
+ match self {
36
+ RotationalStiffnessUnit::Nmm_deg => (1., -3),
37
+ RotationalStiffnessUnit::Nm_deg => (1., 0),
38
+ }
39
+ }
40
+ }
41
+
42
+ impl_quantity!(RotationalStiffness, RotationalStiffnessUnit, [RotationalStiffnessUnit::Nm_deg]);
43
+ impl_div_with_self_to_f64!(RotationalStiffness);
@@ -47,6 +47,7 @@ impl_mul_relation_with_other!(MassPerDistance, Distance, Mass);
47
47
  impl_mul_relation_with_other!(Area, Density, MassPerDistance);
48
48
  impl_mul_relation_with_other!(MassPerDistance, Acceleration, Stiffness);
49
49
  impl_mul_relation_with_other!(Stiffness, AreaOfMoment, ForceVolume);
50
+ impl_mul_relation_with_other!(RotationalStiffness, Angle, ForceDistance);
50
51
 
51
52
  impl_mul_relation_with_self!(Distance, Area);
52
53
  impl_mul_relation_with_self!(Area, AreaOfMoment);
@@ -257,3 +257,9 @@ where
257
257
  ]))
258
258
  }
259
259
  }
260
+
261
+ impl Matrix2<f64> {
262
+ pub fn identity() -> Matrix2<f64> {
263
+ Matrix2::new([[1., 0.],[0., 1.]])
264
+ }
265
+ }
@@ -100,6 +100,12 @@ mod matrix2_tests {
100
100
  assert_eq!(abs, Matrix2::from_f64([[1.0, 2.0], [3.0, 4.0]]));
101
101
  }
102
102
 
103
+ #[test]
104
+ fn test_identity() {
105
+ let eye = Matrix2::identity();
106
+ assert_eq!(eye, Matrix2::from_f64([[1.0, 0.0], [0.0, 1.0]]));
107
+ }
108
+
103
109
  #[test]
104
110
  fn test_to_ndarray() {
105
111
  let mat = Matrix2::new([[1.0, 2.0], [3.0, 4.0]]);
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes