autd3_gain_holo/
lib.rs

1#![cfg_attr(docsrs, feature(doc_cfg))]
2#![warn(missing_docs)]
3#![warn(rustdoc::missing_crate_level_docs)]
4#![warn(rustdoc::unescaped_backticks)]
5
6//! This crate provides [`Gain`] that produces multiple focal points.
7//!
8//! [`Gain`]: autd3_core::gain::Gain
9
10#[cfg(feature = "use_nalgebra")]
11#[cfg(any(feature = "naive", feature = "gs", feature = "gspat"))]
12pub(crate) mod math {
13    use autd3_core::geometry::Complex;
14    use nalgebra::{Dyn, U1, VecStorage};
15
16    pub(crate) type MatrixXc = nalgebra::Matrix<Complex, Dyn, Dyn, VecStorage<Complex, Dyn, Dyn>>;
17    pub(crate) type VectorXc = nalgebra::Matrix<Complex, Dyn, U1, VecStorage<Complex, Dyn, U1>>;
18    pub(crate) type RowVectorXc = nalgebra::Matrix<Complex, U1, Dyn, VecStorage<Complex, U1, Dyn>>;
19}
20
21#[cfg(not(feature = "use_nalgebra"))]
22pub mod math;
23
24#[cfg(any(feature = "naive", feature = "gs", feature = "gspat"))]
25pub(crate) use math::*;
26
27mod amp;
28#[cfg(feature = "greedy")]
29mod combinatorial;
30mod constraint;
31#[cfg(any(
32    feature = "naive",
33    feature = "gs",
34    feature = "gspat",
35    feature = "greedy"
36))]
37mod helper;
38#[cfg(any(feature = "naive", feature = "gs", feature = "gspat"))]
39mod linear_synthesis;
40
41#[cfg(feature = "greedy")]
42pub use combinatorial::*;
43pub use constraint::*;
44#[cfg(any(feature = "naive", feature = "gs", feature = "gspat"))]
45pub use linear_synthesis::*;
46
47pub use amp::{Amplitude, Pa, dB, kPa};
48pub use autd3_core::acoustics::directivity::{Sphere, T4010A1};
49
50#[cfg(test)]
51pub(crate) mod tests {
52    use autd3_core::{
53        devices::AUTD3,
54        geometry::{Geometry, Point3},
55    };
56
57    pub fn create_geometry(row: usize, col: usize) -> Geometry {
58        Geometry::new(
59            (0..col)
60                .flat_map(|i| {
61                    (0..row).map(move |j| {
62                        AUTD3 {
63                            pos: Point3::new(i as f32 * 192., j as f32 * 151.4, 0.),
64                            ..Default::default()
65                        }
66                        .into()
67                    })
68                })
69                .collect(),
70        )
71    }
72}