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.
- {unitforge-0.3.2 → unitforge-0.3.3}/Cargo.lock +1 -1
- {unitforge-0.3.2 → unitforge-0.3.3}/Cargo.toml +1 -1
- {unitforge-0.3.2 → unitforge-0.3.3}/PKG-INFO +1 -3
- {unitforge-0.3.2 → unitforge-0.3.3}/src/lib.rs +2 -0
- unitforge-0.3.3/src/quantities/rotational_stiffness.rs +43 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/relations.rs +1 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/small_linalg/matrix2.rs +6 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/tests/matrix2.rs +6 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/.gitignore +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/.gitlab-ci.yml +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/Readme.md +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/Readme_py.md +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/build.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/pyproject.toml +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/impl_macros.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/prelude.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/acceleration.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/angle.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/angular_acceleration.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/angular_velocity.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/area.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/area_of_moment.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/charge.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/compliance.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/density.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/distance.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/force.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/force_area.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/force_distance.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/force_div_distance_power_four.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/force_per_volume.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/force_volume.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/inverse_area.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/inverse_distance.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/mass.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/mass_per_distance.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/stiffness.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/strain.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/stress.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/stress_squared.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/time.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/velocity.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/velocity_squared.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/voltage.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities/volume.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/quantities.template.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/small_linalg/bindings/matrix3_py.template.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/small_linalg/bindings/vector3_py.template.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/small_linalg/matrix2x3.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/small_linalg/matrix3.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/small_linalg/matrix3x2.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/small_linalg/vector2.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/small_linalg/vector3.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/tests/quantity_unit_tests.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/src/tests/serde_tests.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/tests/matrix2x3.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/tests/matrix3.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/tests/matrix3x2.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/tests/quantities.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/tests/small_linalg_interfaces.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/tests/test_quantities.py +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/tests/test_small_linalg.py +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/tests/vector2.rs +0 -0
- {unitforge-0.3.2 → unitforge-0.3.3}/tests/vector3.rs +0 -0
|
@@ -4,7 +4,7 @@ crate-type = ["cdylib", "rlib"]
|
|
|
4
4
|
|
|
5
5
|
[package]
|
|
6
6
|
name = "unitforge"
|
|
7
|
-
version = "0.3.
|
|
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.
|
|
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
|
|
@@ -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);
|
|
@@ -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
|
|
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
|
|
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
|
|
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
|