pub struct FrequencyGrid {
pub x: Vec<f64>,
pub dx: Vec<f64>,
pub x_half: Vec<f64>,
pub x_half_cubed: Vec<f64>,
pub n: usize,
}Expand description
The frequency grid with precomputed helper arrays.
Fields§
§x: Vec<f64>Grid points x_i
dx: Vec<f64>Grid spacing dx_i = x_{i+1} - x_i (length n-1)
x_half: Vec<f64>Cell-center values: x_{i+1/2} = (x_i + x_{i+1}) / 2 (length n-1)
x_half_cubed: Vec<f64>Precomputed x_half[j]³ (length n-1).
n: usizeNumber of points
Implementations§
Source§impl FrequencyGrid
impl FrequencyGrid
Sourcepub fn from_points(x: Vec<f64>) -> Self
pub fn from_points(x: Vec<f64>) -> Self
Build a FrequencyGrid from a sorted vector of grid points.
§Panics
Panics if x has fewer than 2 elements.
Sourcepub fn new(config: &GridConfig) -> Self
pub fn new(config: &GridConfig) -> Self
Create a frequency grid from configuration.
Uses logarithmic spacing for x < x_transition and linear spacing above, with a smooth blending zone around x_transition. The blending uses a cubic Hermite (smoothstep) interpolation of the local spacing, avoiding the discontinuous 30× jump in dx that a hard log-to-linear transition would produce. This improves local truncation error near x_transition.
Sourcepub fn log_uniform(x_min: f64, x_max: f64, n: usize) -> Self
pub fn log_uniform(x_min: f64, x_max: f64, n: usize) -> Self
Sourcepub fn find_index(&self, x_target: f64) -> usize
pub fn find_index(&self, x_target: f64) -> usize
Find the index of the grid point closest to a given x value.
Trait Implementations§
Source§impl Clone for FrequencyGrid
impl Clone for FrequencyGrid
Source§fn clone(&self) -> FrequencyGrid
fn clone(&self) -> FrequencyGrid
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more