Make regulator naming more consistent
All checks were successful
/ test (pull_request) Successful in 2m27s
All checks were successful
/ test (pull_request) Successful in 2m27s
Although the inversive distance regulator mostly acts as a general Lorentz product regulator, calling it `InversiveDistanceRegulator` explains how we intend to use it and demonstrates our naming convention.
This commit is contained in:
parent
7f21e7e999
commit
620a6be918
3 changed files with 11 additions and 11 deletions
|
@ -4,7 +4,7 @@ use web_sys::{console, wasm_bindgen::JsValue};
|
|||
use crate::{
|
||||
engine,
|
||||
AppState,
|
||||
assembly::{Assembly, Element, ProductRegulator}
|
||||
assembly::{Assembly, Element, InversiveDistanceRegulator}
|
||||
};
|
||||
|
||||
/* DEBUG */
|
||||
|
@ -190,7 +190,7 @@ pub fn AddRemove() -> View {
|
|||
.unwrap()
|
||||
);
|
||||
state.assembly.insert_regulator(
|
||||
ProductRegulator::new(subjects, &state.assembly)
|
||||
InversiveDistanceRegulator::new(subjects, &state.assembly)
|
||||
);
|
||||
state.selection.update(|sel| sel.clear());
|
||||
}
|
||||
|
|
|
@ -151,14 +151,14 @@ pub trait Regulator: ProblemPoser + OutlineItem {
|
|||
fn activate(&self, _assembly: &Assembly) {}
|
||||
}
|
||||
|
||||
pub struct ProductRegulator {
|
||||
pub struct InversiveDistanceRegulator {
|
||||
pub subjects: [ElementKey; 2],
|
||||
pub measurement: ReadSignal<f64>,
|
||||
pub set_point: Signal<SpecifiedValue>
|
||||
}
|
||||
|
||||
impl ProductRegulator {
|
||||
pub fn new(subjects: [ElementKey; 2], assembly: &Assembly) -> ProductRegulator {
|
||||
impl InversiveDistanceRegulator {
|
||||
pub fn new(subjects: [ElementKey; 2], assembly: &Assembly) -> InversiveDistanceRegulator {
|
||||
let measurement = assembly.elements.map(
|
||||
move |elts| {
|
||||
let representations = subjects.map(|subj| elts[subj].representation);
|
||||
|
@ -172,7 +172,7 @@ impl ProductRegulator {
|
|||
|
||||
let set_point = create_signal(SpecifiedValue::from_empty_spec());
|
||||
|
||||
ProductRegulator {
|
||||
InversiveDistanceRegulator {
|
||||
subjects: subjects,
|
||||
measurement: measurement,
|
||||
set_point: set_point
|
||||
|
@ -180,7 +180,7 @@ impl ProductRegulator {
|
|||
}
|
||||
}
|
||||
|
||||
impl Regulator for ProductRegulator {
|
||||
impl Regulator for InversiveDistanceRegulator {
|
||||
fn subjects(&self) -> Vec<ElementKey> {
|
||||
self.subjects.into()
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ impl Regulator for ProductRegulator {
|
|||
}
|
||||
}
|
||||
|
||||
impl ProblemPoser for ProductRegulator {
|
||||
impl ProblemPoser for InversiveDistanceRegulator {
|
||||
fn pose(&self, problem: &mut ConstraintProblem, elts: &Slab<Element>) {
|
||||
self.set_point.with_untracked(|set_pt| {
|
||||
if let Some(val) = set_pt.value {
|
||||
|
@ -633,7 +633,7 @@ mod tests {
|
|||
)
|
||||
});
|
||||
elts[subjects[0]].column_index = Some(0);
|
||||
ProductRegulator {
|
||||
InversiveDistanceRegulator {
|
||||
subjects: subjects,
|
||||
measurement: create_memo(|| 0.0),
|
||||
set_point: create_signal(SpecifiedValue::try_from("0.0".to_string()).unwrap())
|
||||
|
|
|
@ -13,7 +13,7 @@ use crate::{
|
|||
assembly::{
|
||||
ElementKey,
|
||||
HalfCurvatureRegulator,
|
||||
ProductRegulator,
|
||||
InversiveDistanceRegulator,
|
||||
Regulator,
|
||||
RegulatorKey
|
||||
},
|
||||
|
@ -94,7 +94,7 @@ pub trait OutlineItem {
|
|||
fn outline_item(self: Rc<Self>, element_key: ElementKey) -> View;
|
||||
}
|
||||
|
||||
impl OutlineItem for ProductRegulator {
|
||||
impl OutlineItem for InversiveDistanceRegulator {
|
||||
fn outline_item(self: Rc<Self>, element_key: ElementKey) -> View {
|
||||
let state = use_context::<AppState>();
|
||||
let other_subject = if self.subjects[0] == element_key {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue