Spruce up formatting and error messages
Make the new code's formatting and error messages more consistent with the previous code. I don't necessarily have a strong preference for the previous conventions, but I do like stuff to be consistent.
This commit is contained in:
parent
6ad3ed1176
commit
5ee24aa91d
1 changed files with 28 additions and 14 deletions
|
@ -312,13 +312,14 @@ impl Element for Point {
|
|||
point(0.0, 0.0, 0.0),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
fn default_regulators(self: Rc<Self>) -> Vec<Rc<dyn Regulator>> {
|
||||
all::<Axis>()
|
||||
.map(|axis| {
|
||||
Rc::new(PointCoordinateRegulator::new(self.clone(), axis))
|
||||
as Rc::<dyn Regulator>
|
||||
})
|
||||
.map(
|
||||
|axis| Rc::new(
|
||||
PointCoordinateRegulator::new(self.clone(), axis)
|
||||
) as Rc::<dyn Regulator>
|
||||
)
|
||||
.collect()
|
||||
}
|
||||
|
||||
|
@ -543,19 +544,32 @@ impl PointCoordinateRegulator {
|
|||
let measurement = subject.representation().map(
|
||||
move |rep| rep[axis as usize]
|
||||
);
|
||||
|
||||
let set_point = create_signal(SpecifiedValue::from_empty_spec());
|
||||
Self { subject, axis, measurement, set_point, serial: Self::next_serial() }
|
||||
let serial = Self::next_serial();
|
||||
|
||||
Self { subject, axis, measurement, set_point, serial }
|
||||
}
|
||||
}
|
||||
|
||||
impl Serial for PointCoordinateRegulator {
|
||||
fn serial(&self) -> u64 { self.serial }
|
||||
fn serial(&self) -> u64 {
|
||||
self.serial
|
||||
}
|
||||
}
|
||||
|
||||
impl Regulator for PointCoordinateRegulator {
|
||||
fn subjects(&self) -> Vec<Rc<dyn Element>> { vec![self.subject.clone()] }
|
||||
fn measurement(&self) -> ReadSignal<f64> { self.measurement }
|
||||
fn set_point(&self) -> Signal<SpecifiedValue> { self.set_point }
|
||||
fn subjects(&self) -> Vec<Rc<dyn Element>> {
|
||||
vec![self.subject.clone()]
|
||||
}
|
||||
|
||||
fn measurement(&self) -> ReadSignal<f64> {
|
||||
self.measurement
|
||||
}
|
||||
|
||||
fn set_point(&self) -> Signal<SpecifiedValue> {
|
||||
self.set_point
|
||||
}
|
||||
}
|
||||
|
||||
impl ProblemPoser for PointCoordinateRegulator {
|
||||
|
@ -576,10 +590,10 @@ impl ProblemPoser for PointCoordinateRegulator {
|
|||
coords[index.0] = value
|
||||
}
|
||||
}
|
||||
if nset == Axis::CARDINALITY {
|
||||
let [x, y, z] = coords;
|
||||
problem.frozen.push(
|
||||
Point::NORM_COMPONENT, col, point(x,y,z)[Point::NORM_COMPONENT]);
|
||||
if n_set == Axis::CARDINALITY {
|
||||
let [x, y, z] = coords_frozen;
|
||||
let norm = point(x, y, z)[Point::NORM_COMPONENT];
|
||||
problem.frozen.push(Point::NORM_COMPONENT, col, norm);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue