diff --git a/solver/src/bow/output.rs b/solver/src/bow/output.rs index 025c57d0..31903500 100644 --- a/solver/src/bow/output.rs +++ b/solver/src/bow/output.rs @@ -1,7 +1,6 @@ use std::fs::File; use std::io::{BufReader, Write}; use std::path::Path; -use nalgebra::{SMatrix, SVector}; use serde::{Deserialize, Serialize}; use soa_derive::StructOfArray; use rmpv::Value; @@ -129,16 +128,16 @@ pub struct State { pub time: f64, pub draw_length: f64, - pub limb_pos: Vec>, // x, y, φ - pub limb_vel: Vec>, // x, y, φ - pub limb_acc: Vec>, // x, y, φ + pub limb_pos: Vec<[f64; 3]>, // x, y, φ + pub limb_vel: Vec<[f64; 3]>, // x, y, φ + pub limb_acc: Vec<[f64; 3]>, // x, y, φ - pub string_pos: Vec>, // x, y - pub string_vel: Vec>, // x, y - pub string_acc: Vec>, // x, y + pub string_pos: Vec<[f64; 2]>, // x, y + pub string_vel: Vec<[f64; 2]>, // x, y + pub string_acc: Vec<[f64; 2]>, // x, y - pub limb_strain: Vec>, // epsilon, kappa, gamma - pub limb_force: Vec>, // N, M, Q + pub limb_strain: Vec<[f64; 3]>, // epsilon, kappa, gamma + pub limb_force: Vec<[f64; 3]>, // N, M, Q pub layer_strain: Vec>, // layer, point, back/belly pub layer_stress: Vec>, // layer, point, back/belly @@ -166,7 +165,7 @@ pub struct LimbSetup { // Geometry at eval points pub length: Vec, - pub position: Vec>, // x, y, φ + pub position: Vec<[f64; 3]>, // x, y, φ pub width: Vec, pub height: Vec, } diff --git a/solver/src/bow/simulation.rs b/solver/src/bow/simulation.rs index fa0889c6..07da8513 100644 --- a/solver/src/bow/simulation.rs +++ b/solver/src/bow/simulation.rs @@ -81,7 +81,7 @@ impl<'a> Simulation<'a> { // Additional setup data let limb_position = s_eval.iter().map(|&s| { let position = profile.position(s); - vector![position[0], position[1], profile.angle(s)] + [position[0], position[1], profile.angle(s)] }).collect(); let limb_width = s_eval.iter().map(|&s| { section.width(s) }).collect(); let limb_height = s_eval.iter().map(|&s| { section.height(s) }).collect(); @@ -306,13 +306,13 @@ impl<'a> Simulation<'a> { let limb_tip = self.limb_nodes.last().unwrap(); let string_pos = self.string_node.map(|node| vec![ - vector![ system.get_displacement(limb_tip.x()), system.get_displacement(limb_tip.y()) ], - vector![ system.get_displacement(node.x()), system.get_displacement(node.y()) ], + [ system.get_displacement(limb_tip.x()), system.get_displacement(limb_tip.y()) ], + [ system.get_displacement(node.x()), system.get_displacement(node.y()) ], ]).unwrap_or_default(); let string_vel = self.string_node.map(|node| vec![ - vector![ system.get_velocity(limb_tip.x()), system.get_velocity(limb_tip.y()) ], - vector![ system.get_velocity(node.x()), system.get_velocity(node.y()) ], + [ system.get_velocity(limb_tip.x()), system.get_velocity(limb_tip.y()) ], + [ system.get_velocity(node.x()), system.get_velocity(node.y()) ], ]).unwrap_or_default(); /* @@ -324,15 +324,15 @@ impl<'a> Simulation<'a> { // Evaluate positions, forces and strains at the limb's evaluation points - let mut limb_pos = Vec::new(); // TODO: Capacity - let mut limb_strain = Vec::>::new(); // TODO: Capacity - let mut limb_force = Vec::>::new(); // TODO: Capacity + let mut limb_pos = Vec::<[f64; 3]>::new(); // TODO: Capacity + let mut limb_strain = Vec::<[f64; 3]>::new(); // TODO: Capacity + let mut limb_force = Vec::<[f64; 3]>::new(); // TODO: Capacity for &element in &self.limb_elements { let element = system.element_ref::(element); - element.eval_positions().for_each(|u| limb_pos.push(u)); - element.eval_strains().for_each(|e| limb_strain.push(e)); - element.eval_forces().for_each(|f| limb_force.push(f)); + element.eval_positions().for_each(|u| limb_pos.push(u.into())); + element.eval_strains().for_each(|e| limb_strain.push(e.into())); + element.eval_forces().for_each(|f| limb_force.push(f.into())); } // The grip force is the y component of the forces at the start of the limb. @@ -355,12 +355,12 @@ impl<'a> Simulation<'a> { draw_length, limb_pos, - limb_vel: vec![SVector::zeros(); self.model.settings.n_limb_eval_points], - limb_acc: vec![SVector::zeros(); self.model.settings.n_limb_eval_points], + limb_vel: vec![[0.0; 3]; self.model.settings.n_limb_eval_points], + limb_acc: vec![[0.0; 3]; self.model.settings.n_limb_eval_points], string_pos, string_vel, - string_acc: vec![SVector::zeros(); 2], + string_acc: vec![[0.0; 2]; 2], limb_strain, limb_force,