Rename Cell -> Sample

This commit is contained in:
2021-06-07 15:26:26 -07:00
parent cd0debb209
commit 0f56d0390e
2 changed files with 25 additions and 23 deletions

View File

@@ -1,7 +1,6 @@
use crate::geom::{Index, Meters, Vec2, Vec3, Vec3u};
use crate::mat;
use crate::real::ToFloat as _;
use crate::sim::{Cell, GenericSim, StaticSim};
use crate::sim::{GenericSim, Sample, StaticSim};
use crate::meas::AbstractMeasurement;
use crossterm::{cursor, QueueableCommand as _};
use crossterm::style::{style, Color, PrintStyledContent};
@@ -188,7 +187,7 @@ impl<'a, S: GenericSim> RenderSteps<'a, S> {
}
}
fn get_at_px(&self, x_px: u32, y_px: u32) -> Cell {
fn get_at_px(&self, x_px: u32, y_px: u32) -> Sample {
let x_prop = x_px as f32 / self.im.width() as f32;
let x_m = x_prop * (self.sim.width() as f32 * self.sim.feature_size() as f32);
let y_prop = y_px as f32 / self.im.height() as f32;
@@ -231,7 +230,7 @@ impl<'a, S: GenericSim> RenderSteps<'a, S> {
self.render_vector_field(Rgb([0xff, 0xff, 0xff]), 1.0e5 * scale, |cell| cell.m().xy().to_f32());
}
fn render_vector_field<F: Fn(&Cell<mat::Static>) -> Vec2<f32>>(&mut self, color: Rgb<u8>, typical: f32, measure: F) {
fn render_vector_field<F: Fn(&Sample) -> Vec2<f32>>(&mut self, color: Rgb<u8>, typical: f32, measure: F) {
let w = self.im.width();
let h = self.im.height();
let vec_spacing = 10;
@@ -246,7 +245,7 @@ impl<'a, S: GenericSim> RenderSteps<'a, S> {
}
}
}
fn render_scalar_field<F: Fn(&Cell<mat::Static>) -> f32 + Sync>(&mut self, typical: f32, signed: bool, slot: u32, measure: F) {
fn render_scalar_field<F: Fn(&Sample) -> f32 + Sync>(&mut self, typical: f32, signed: bool, slot: u32, measure: F) {
// XXX: get_at_px borrows self, so we need to clone the image to operate on it mutably.
let mut im = self.im.clone();
let w = im.width();
@@ -292,7 +291,7 @@ impl<'a, S: GenericSim> RenderSteps<'a, S> {
}
}
fn field_vector<F: Fn(&Cell<mat::Static>) -> Vec2<f32>>(&self, xidx: u32, yidx: u32, size: u32, measure: &F) -> Vec2<f32> {
fn field_vector<F: Fn(&Sample) -> Vec2<f32>>(&self, xidx: u32, yidx: u32, size: u32, measure: &F) -> Vec2<f32> {
let mut field = Vec2::default();
let w = self.im.width();
let h = self.im.height();