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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
 * File: null.rs
 * Project: backend
 * Created Date: 17/07/2023
 * Author: Shun Suzuki
 * -----
 * Last Modified: 12/09/2023
 * Modified By: Shun Suzuki (suzuki@hapis.k.u-tokyo.ac.jp)
 * -----
 * Copyright (c) 2023 Shun Suzuki. All rights reserved.
 *
 */

use crate::{Backend, Config};

use autd3::driver::defined::float;

/// Backend with no plotting
pub struct NullBackend {}

pub struct NullPlotConfig {}

impl Config for NullPlotConfig {
    fn print_progress(&self) -> bool {
        false
    }
}

impl Backend for NullBackend {
    type PlotConfig = NullPlotConfig;

    fn new() -> Self {
        Self {}
    }

    fn initialize(&mut self) -> Result<(), crate::error::VisualizerError> {
        Ok(())
    }

    fn plot_1d(
        _observe_points: Vec<float>,
        _acoustic_pressures: Vec<autd3::driver::acoustics::Complex>,
        _resolution: float,
        _x_label: &str,
        _config: Self::PlotConfig,
    ) -> Result<(), crate::error::VisualizerError> {
        Err(crate::error::VisualizerError::NotSupported)
    }

    fn plot_2d(
        _observe_x: Vec<float>,
        _observe_y: Vec<float>,
        _acoustic_pressures: Vec<autd3::driver::acoustics::Complex>,
        _resolution: float,
        _x_label: &str,
        _y_label: &str,
        _config: Self::PlotConfig,
    ) -> Result<(), crate::error::VisualizerError> {
        Err(crate::error::VisualizerError::NotSupported)
    }

    fn plot_modulation(
        _modulation: Vec<float>,
        _config: Self::PlotConfig,
    ) -> Result<(), crate::error::VisualizerError> {
        Err(crate::error::VisualizerError::NotSupported)
    }

    fn plot_phase<T: autd3::driver::geometry::Transducer>(
        _config: Self::PlotConfig,
        _geometry: &autd3::driver::geometry::Geometry<T>,
        _phases: Vec<float>,
    ) -> Result<(), crate::error::VisualizerError> {
        Err(crate::error::VisualizerError::NotSupported)
    }
}