Make regulator naming more consistent
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:
Aaron Fenyes 2025-04-17 14:40:28 -07:00
parent 7f21e7e999
commit 620a6be918
3 changed files with 11 additions and 11 deletions

View file

@ -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())