Add trailing commas; clean up formatting
All checks were successful
/ test (pull_request) Successful in 3m55s
All checks were successful
/ test (pull_request) Successful in 3m55s
This commit is contained in:
parent
2eba80fb69
commit
af59166906
12 changed files with 235 additions and 213 deletions
|
@ -1,13 +1,13 @@
|
|||
use nalgebra::{DMatrix, DVector, DVectorView};
|
||||
use std::{
|
||||
cell::Cell,
|
||||
collections::{BTreeMap, BTreeSet},
|
||||
cmp::Ordering,
|
||||
collections::{BTreeMap, BTreeSet},
|
||||
fmt,
|
||||
fmt::{Debug, Formatter},
|
||||
hash::{Hash, Hasher},
|
||||
rc::Rc,
|
||||
sync::{atomic, atomic::AtomicU64}
|
||||
sync::{atomic, atomic::AtomicU64},
|
||||
};
|
||||
use sycamore::prelude::*;
|
||||
use web_sys::{console, wasm_bindgen::JsValue}; /* DEBUG */
|
||||
|
@ -26,9 +26,9 @@ use crate::{
|
|||
ConfigSubspace,
|
||||
ConstraintProblem,
|
||||
DescentHistory,
|
||||
Realization
|
||||
Realization,
|
||||
},
|
||||
specified::SpecifiedValue
|
||||
specified::SpecifiedValue,
|
||||
};
|
||||
|
||||
pub type ElementColor = [f32; 3];
|
||||
|
@ -164,7 +164,7 @@ pub struct Sphere {
|
|||
pub ghost: Signal<bool>,
|
||||
pub regulators: Signal<BTreeSet<Rc<dyn Regulator>>>,
|
||||
serial: u64,
|
||||
column_index: Cell<Option<usize>>
|
||||
column_index: Cell<Option<usize>>,
|
||||
}
|
||||
|
||||
impl Sphere {
|
||||
|
@ -174,17 +174,17 @@ impl Sphere {
|
|||
id: String,
|
||||
label: String,
|
||||
color: ElementColor,
|
||||
representation: DVector<f64>
|
||||
representation: DVector<f64>,
|
||||
) -> Sphere {
|
||||
Sphere {
|
||||
id: id,
|
||||
label: label,
|
||||
color: color,
|
||||
id,
|
||||
label,
|
||||
color,
|
||||
representation: create_signal(representation),
|
||||
ghost: create_signal(false),
|
||||
regulators: create_signal(BTreeSet::new()),
|
||||
serial: Self::next_serial(),
|
||||
column_index: None.into()
|
||||
column_index: None.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ impl Element for Sphere {
|
|||
id,
|
||||
format!("Sphere {id_num}"),
|
||||
[0.75_f32, 0.75_f32, 0.75_f32],
|
||||
sphere(0.0, 0.0, 0.0, 1.0)
|
||||
sphere(0.0, 0.0, 0.0, 1.0),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -264,7 +264,7 @@ pub struct Point {
|
|||
pub ghost: Signal<bool>,
|
||||
pub regulators: Signal<BTreeSet<Rc<dyn Regulator>>>,
|
||||
serial: u64,
|
||||
column_index: Cell<Option<usize>>
|
||||
column_index: Cell<Option<usize>>,
|
||||
}
|
||||
|
||||
impl Point {
|
||||
|
@ -274,7 +274,7 @@ impl Point {
|
|||
id: String,
|
||||
label: String,
|
||||
color: ElementColor,
|
||||
representation: DVector<f64>
|
||||
representation: DVector<f64>,
|
||||
) -> Point {
|
||||
Point {
|
||||
id,
|
||||
|
@ -284,7 +284,7 @@ impl Point {
|
|||
ghost: create_signal(false),
|
||||
regulators: create_signal(BTreeSet::new()),
|
||||
serial: Self::next_serial(),
|
||||
column_index: None.into()
|
||||
column_index: None.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -299,7 +299,7 @@ impl Element for Point {
|
|||
id,
|
||||
format!("Point {id_num}"),
|
||||
[0.75_f32, 0.75_f32, 0.75_f32],
|
||||
point(0.0, 0.0, 0.0)
|
||||
point(0.0, 0.0, 0.0),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -389,7 +389,7 @@ pub struct InversiveDistanceRegulator {
|
|||
pub subjects: [Rc<dyn Element>; 2],
|
||||
pub measurement: ReadSignal<f64>,
|
||||
pub set_point: Signal<SpecifiedValue>,
|
||||
serial: u64
|
||||
serial: u64,
|
||||
}
|
||||
|
||||
impl InversiveDistanceRegulator {
|
||||
|
@ -449,7 +449,7 @@ pub struct HalfCurvatureRegulator {
|
|||
pub subject: Rc<dyn Element>,
|
||||
pub measurement: ReadSignal<f64>,
|
||||
pub set_point: Signal<SpecifiedValue>,
|
||||
serial: u64
|
||||
serial: u64,
|
||||
}
|
||||
|
||||
impl HalfCurvatureRegulator {
|
||||
|
@ -501,7 +501,7 @@ impl ProblemPoser for HalfCurvatureRegulator {
|
|||
// the velocity is expressed in uniform coordinates
|
||||
pub struct ElementMotion<'a> {
|
||||
pub element: Rc<dyn Element>,
|
||||
pub velocity: DVectorView<'a, f64>
|
||||
pub velocity: DVectorView<'a, f64>,
|
||||
}
|
||||
|
||||
type AssemblyMotion<'a> = Vec<ElementMotion<'a>>;
|
||||
|
@ -533,7 +533,7 @@ pub struct Assembly {
|
|||
|
||||
// realization diagnostics
|
||||
pub realization_status: Signal<Result<(), String>>,
|
||||
pub descent_history: Signal<DescentHistory>
|
||||
pub descent_history: Signal<DescentHistory>,
|
||||
}
|
||||
|
||||
impl Assembly {
|
||||
|
@ -546,7 +546,7 @@ impl Assembly {
|
|||
elements_by_id: create_signal(BTreeMap::default()),
|
||||
realization_trigger: create_signal(()),
|
||||
realization_status: create_signal(Ok(())),
|
||||
descent_history: create_signal(DescentHistory::new())
|
||||
descent_history: create_signal(DescentHistory::new()),
|
||||
};
|
||||
|
||||
// realize the assembly whenever the element list, the regulator list,
|
||||
|
@ -717,7 +717,7 @@ impl Assembly {
|
|||
|
||||
// save the tangent space
|
||||
self.tangent.set_silent(tangent);
|
||||
},
|
||||
}
|
||||
Err(message) => {
|
||||
// report the realization status. the `Err(message)` we're
|
||||
// setting the status to has a different type than the
|
||||
|
@ -804,7 +804,7 @@ impl Assembly {
|
|||
// restore its normalization
|
||||
*rep += motion_proj.column(column_index);
|
||||
elt.project_to_normalized(rep);
|
||||
},
|
||||
}
|
||||
None => {
|
||||
console_log!("No velocity to unpack for fresh element \"{}\"", elt.id())
|
||||
}
|
||||
|
@ -867,7 +867,7 @@ mod tests {
|
|||
String::from(sphere_id),
|
||||
String::from("Sphere 0"),
|
||||
[0.75_f32, 0.75_f32, 0.75_f32],
|
||||
engine::sphere(0.0, 0.0, 0.0, INITIAL_RADIUS)
|
||||
engine::sphere(0.0, 0.0, 0.0, INITIAL_RADIUS),
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -881,7 +881,7 @@ mod tests {
|
|||
vec![
|
||||
ElementMotion {
|
||||
element: sphere.clone(),
|
||||
velocity: velocity.as_view()
|
||||
velocity: velocity.as_view(),
|
||||
}
|
||||
]
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue