pub struct StaticSystem2D {
pub forces: Vec<Force2D>,
pub moments: Vec<f64>,
}Expand description
A simple planar static system made of force vectors and scalar moments.
Fields§
§forces: Vec<Force2D>The planar forces acting on the system.
moments: Vec<f64>Free moments acting on the system.
Implementations§
Source§impl StaticSystem2D
impl StaticSystem2D
Sourcepub fn new(forces: Vec<Force2D>, moments: Vec<f64>) -> Option<Self>
pub fn new(forces: Vec<Force2D>, moments: Vec<f64>) -> Option<Self>
Creates a validated static system.
Examples found in repository?
examples/basic_usage.rs (line 21)
13fn main() {
14 let Some(force_left) = Force2D::new(100.0, 0.0) else {
15 panic!("valid force should construct");
16 };
17 let Some(force_right) = Force2D::new(-100.0, 0.0) else {
18 panic!("valid force should construct");
19 };
20
21 let Some(system) = StaticSystem2D::new(vec![force_left, force_right], vec![0.0]) else {
22 panic!("valid system should construct");
23 };
24
25 assert_eq!(system.is_equilibrium(0.0), Some(true));
26
27 let Some((left, right)) = simply_supported_point_load_reactions(10.0, 100.0, 5.0) else {
28 panic!("valid point load should produce reactions");
29 };
30
31 approx_eq(left, 50.0, 1.0e-12);
32 approx_eq(right, 50.0, 1.0e-12);
33
34 assert_eq!(
35 cantilever_end_point_load_reaction(10.0, 100.0),
36 Some(CantileverReaction {
37 vertical_reaction: 100.0,
38 fixed_end_moment: 1000.0,
39 })
40 );
41}Sourcepub fn net_moment(&self) -> Option<f64>
pub fn net_moment(&self) -> Option<f64>
Returns the net free moment in the system.
Sourcepub fn is_equilibrium(&self, tolerance: f64) -> Option<bool>
pub fn is_equilibrium(&self, tolerance: f64) -> Option<bool>
Checks whether the system is in static equilibrium.
§Examples
use use_statics::{Force2D, StaticSystem2D};
let Some(system) = StaticSystem2D::new(
vec![
Force2D::new(1.0, 2.0).unwrap(),
Force2D::new(-1.0, -2.0).unwrap(),
],
vec![10.0, -10.0],
) else {
panic!("valid system should construct");
};
assert_eq!(system.is_equilibrium(0.0), Some(true));Examples found in repository?
examples/basic_usage.rs (line 25)
13fn main() {
14 let Some(force_left) = Force2D::new(100.0, 0.0) else {
15 panic!("valid force should construct");
16 };
17 let Some(force_right) = Force2D::new(-100.0, 0.0) else {
18 panic!("valid force should construct");
19 };
20
21 let Some(system) = StaticSystem2D::new(vec![force_left, force_right], vec![0.0]) else {
22 panic!("valid system should construct");
23 };
24
25 assert_eq!(system.is_equilibrium(0.0), Some(true));
26
27 let Some((left, right)) = simply_supported_point_load_reactions(10.0, 100.0, 5.0) else {
28 panic!("valid point load should produce reactions");
29 };
30
31 approx_eq(left, 50.0, 1.0e-12);
32 approx_eq(right, 50.0, 1.0e-12);
33
34 assert_eq!(
35 cantilever_end_point_load_reaction(10.0, 100.0),
36 Some(CantileverReaction {
37 vertical_reaction: 100.0,
38 fixed_end_moment: 1000.0,
39 })
40 );
41}Trait Implementations§
Source§impl Clone for StaticSystem2D
impl Clone for StaticSystem2D
Source§fn clone(&self) -> StaticSystem2D
fn clone(&self) -> StaticSystem2D
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StaticSystem2D
impl Debug for StaticSystem2D
Source§impl PartialEq for StaticSystem2D
impl PartialEq for StaticSystem2D
Source§fn eq(&self, other: &StaticSystem2D) -> bool
fn eq(&self, other: &StaticSystem2D) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for StaticSystem2D
Auto Trait Implementations§
impl Freeze for StaticSystem2D
impl RefUnwindSafe for StaticSystem2D
impl Send for StaticSystem2D
impl Sync for StaticSystem2D
impl Unpin for StaticSystem2D
impl UnsafeUnpin for StaticSystem2D
impl UnwindSafe for StaticSystem2D
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more