heatflow/heat_flow/
mod.rs1use std::fmt::{Debug, Formatter};
2use std::ops::Range;
3use ndarray::{Array2, Array3, ArrayView1, Axis, s};
4use shape_core::{Point, Rectangle};
5
6pub mod iters;
7mod display;
8mod mapping;
9mod flow;
10
11pub struct HeatFlow {
19 area: Rectangle<f32>,
20 data: Array3<f32>,
21 time: usize,
22}
23
24pub struct HeatMap {
26 area: Rectangle<f32>,
27 data: Array2<f32>,
28 range: Range<f32>,
29 time: usize,
30}
31
32pub struct LineView<'i> {
33 line: ArrayView1<'i, f32>,
34}
35
36#[test]
37pub fn test() {
38 let mut map = HeatFlow::new(Rectangle::new(Point::new(0.0, 0.0), (8.0, 6.0)), 1.0, 5);
39 map.sampling(Point::new(0.5, 0.5), 1.0);
40 println!("(1, 1): {:?}", map.view_z().next().unwrap());
41 map.time_fly();
42 map.sampling(Point::new(1.5, 0.5), 2.0);
43 println!("(1, 1): {:?}", map.view_z().next().unwrap());
44 map.time_fly();
45 map.sampling(Point::new(0.5, 0.5), 3.0);
46 println!("(1, 1): {:?}", map.view_z().next().unwrap());
47
48 println!("{:?}", map.data.shape());
49 println!("{:#?}", map.as_heatmap());
50 println!("{:?}", map.data.iter().take(6).collect::<Vec<_>>());
51}