1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
use crate::{consts::DataArray, geometry::Geometry};
use super::super::Gain;
pub struct NullGain {
data: Option<Vec<DataArray>>,
}
impl NullGain {
pub fn create() -> Self {
NullGain { data: None }
}
}
impl Gain for NullGain {
fn get_data(&self) -> &[DataArray] {
assert!(self.data.is_some());
match &self.data {
Some(data) => data,
None => panic!(),
}
}
fn build(&mut self, geometry: &Geometry) {
if self.data.is_some() {
return;
}
let num_devices = geometry.num_devices();
let buf: DataArray = unsafe { std::mem::zeroed() };
self.data = Some(vec![buf; num_devices]);
}
}