78 |
78 |
79 /// A simple test on the cube |
79 /// A simple test on the cube |
80 fn simple_cube_test() -> DynError { |
80 fn simple_cube_test() -> DynError { |
81 |
81 |
82 let points = [ |
82 let points = [ |
83 OnCube::new(F1, Loc([0.5, 0.7])), |
83 // OnCube::new(F1, Loc([0.5, 0.7])), |
84 OnCube::new(F2, Loc([0.3, 0.5])), |
84 OnCube::new(F2, Loc([0.3, 0.5])), |
85 OnCube::new(F4, Loc([0.9, 0.9])), |
85 // OnCube::new(F4, Loc([0.9, 0.9])), |
86 OnCube::new(F6, Loc([0.4, 0.3])), |
86 //OnCube::new(F6, Loc([0.4, 0.3])), |
87 OnCube::new(F4, Loc([0.3, 0.7])), |
87 // OnCube::new(F4, Loc([0.3, 0.7])), |
88 OnCube::new(F3, Loc([0.3, 0.7])), |
88 // OnCube::new(F3, Loc([0.3, 0.7])), |
89 ]; |
89 ]; |
90 |
90 |
91 let origin = OnCube::new(F4, Loc([0.5, 0.5])); |
91 let origin = OnCube::new(F4, Loc([0.5, 0.5])); |
92 |
92 |
93 write_points(format!("{PREFIX}/data"), points.iter())?; |
93 write_points(format!("{PREFIX}/data"), points.iter())?; |
94 write_points(format!("{PREFIX}/origin"), std::iter::once(&origin))?; |
94 write_points(format!("{PREFIX}/origin"), std::iter::once(&origin))?; |
95 |
95 |
96 let f = Sum::new(points.into_iter().map(DistToSquaredDiv2)); |
96 let f = Sum::new(points.into_iter().map(DistToSquaredDiv2)); |
97 //let g = ZeroFn::new(); |
97 let g = ZeroFn::new(); |
98 let g = Scaled::new(0.5, DistTo(origin)); |
98 //let g = Scaled::new(0.5, DistTo(origin)); |
99 let τ = 0.1; |
99 let τ = 0.1; |
100 |
100 |
101 std::fs::create_dir_all(PREFIX)?; |
101 std::fs::create_dir_all(PREFIX)?; |
102 for face in Face::all() { |
102 for face in Face::all() { |
103 write_face_csv(format!("{PREFIX}/{face}"), face, 32, |x| f.apply(x) + g.apply(x))?; |
103 write_face_csv(format!("{PREFIX}/{face}"), face, 32, |x| f.apply(x) + g.apply(x))?; |