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
77
78
79
80
81
82
//! Generic 3-D finite-difference operators.
//!
//! SSOT extension of the 1-D [`FiniteDifference`](super::FiniteDifference) and
//! the 2-D [`crate::laplacian_2d_into`] operators to three spatial dimensions.
//! Replaces the per-consumer FD kernels previously duplicated in
//! `kwavers-math`, `cfd-math`, and `helios-imaging`.
//!
//! The provider covers the families the FDTD / acoustic / CFD / RT kernels
//! actually call:
//!
//! | Scheme | Order | Stencil | dst shape on diff axis |
//! |--------|-------|---------|------------------------|
//! | [`FiniteDifference3DScheme::CentralSecondOrder`] | O(Δx²) 3-point | symmetric interior | matches `field` |
//! | [`FiniteDifference3DScheme::CentralFourthOrder`] | O(Δx⁴) 5-point + 2nd/1st fall-back, any axis length | matches `field` |
//! | [`FiniteDifference3DScheme::CentralSixthOrder`] | O(Δx⁶) 7-point + 4th/2nd/1st fall-back | matches `field` |
//! | [`FiniteDifference3DScheme::StaggeredForward`] | O(Δx) Yee face | one cell smaller |
//! | [`FiniteDifference3DScheme::StaggeredBackward`] | O(Δx) cell-on-integer-grid | matches `field` |
//!
//! All stencils are explicit, allocation-free, and operate on caller-supplied
//! `ArrayView3<T>` slices writing into pre-allocated `&mut Array3<T>` buffers.
//!
//! ```rust,ignore
//! use leto_ops::{FiniteDifference3D, FiniteDifference3DScheme};
//!
//! let op = FiniteDifference3D::central_fourth_order(0.001, 0.001, 0.001)?;
//! let grad_x = op.apply_x(field.view());
//! ```
use FloatElement;
pub
/// Stencil family + kernel ordering for [`FiniteDifference3D`].
///
/// Variant naming follows the FDTD / CFD cell-sweep vocabulary. Note that
/// [`Self::StaggeredBackward`] is the kwavers-side convention: dst shape
/// matches `field.shape` (the integer-cell arrangement rather than the
/// half-cell staggered arrangement), and `i=0` falls back to a forward
/// difference. This preserves the kwavers-side Yee-coupling solver contract
/// bit-equivalent to the previous `StaggeredGridOperator::apply_backward_*_into`
/// kernels.
pub use ;
pub use ;
pub use FiniteDifference3D;
pub use ;