pub struct Tab1 {
pub boundaries: Vec<usize>,
pub interp_codes: Vec<u32>,
pub points: Vec<(f64, f64)>,
}Expand description
One-dimensional interpolation table (ENDF TAB1 record).
Stores piecewise-interpolated y(x) data. Multiple interpolation regions are supported via ENDF NBT/INT boundary pairs.
Interpolation law codes (ENDF INT), per ENDF-6 Formats Manual §0.5:
- 1: Histogram (y constant = y_left)
- 2: Linear-linear
- 3: Log in x, linear in y (y linear in ln(x))
- 4: Linear in x, log in y (ln(y) linear in x)
- 5: Log-log
Verified against SAMMY OpenScale CELibrary/Interpolate.h:
case 3 → LinByLog = log-x/linear-y
case 4 → LogByLin = linear-x/log-y
Reference: ENDF-6 Formats Manual §0.5; SAMMY OpenScale CELibrary/Interpolate.h
Fields§
§boundaries: Vec<usize>Interpolation region boundaries (NBT, 1-based index of the last point
in each region). boundaries.len() == interp_codes.len().
interp_codes: Vec<u32>Interpolation law codes (INT) for each region.
points: Vec<(f64, f64)>Data points as (x, y) pairs, sorted ascending in x.
Implementations§
Source§impl Tab1
impl Tab1
Sourcepub fn evaluate(&self, x: f64) -> f64
pub fn evaluate(&self, x: f64) -> f64
Evaluate the tabulated function at x by piecewise interpolation.
Values outside the tabulated range are clamped to the nearest endpoint (no extrapolation).
Log-interpolation modes (INT=3, 4, 5) require strictly positive arguments for the logarithm. If a tabulated value or x-coordinate is non-positive where a logarithm would be taken, the function transparently falls back to lin-lin interpolation for that interval rather than producing NaN or panicking. In practice, ENDF AP(E) tables always have positive x (energy) and positive y (radius in fm), so this guard is defensive only.