phase/data.rs
1use ndarray::Array3;
2use std::ops::AddAssign;
3
4/// Simulation data.
5pub struct Data {
6 /// Scattering.
7 pub scatters: Array3<f64>,
8 /// Test
9 pub total: usize,
10}
11
12impl Data {
13 /// Construct an empty object.
14 #[inline]
15 #[must_use]
16 pub fn new(num_voxels: [usize; 3]) -> Self {
17 Self {
18 scatters: Array3::zeros((num_voxels[0], num_voxels[1], num_voxels[2])),
19 total: 0,
20 }
21 }
22}
23
24impl AddAssign<&Self> for Data {
25 #[inline]
26 fn add_assign(&mut self, rhs: &Self) {
27 self.scatters += &rhs.scatters;
28 self.total += rhs.total;
29 }
30}