pub fn cross_sections_on_grid(
data: &ResonanceData,
energies: &[f64],
) -> Vec<CrossSections>Expand description
Compute cross-sections over a grid of energies.
Optimized batch evaluation: precomputes J-groups and per-resonance
invariants (reduced width amplitudes, penetrability at E_r) once per
resonance range, then evaluates each energy point using the cached data.
This avoids redundant group_by_j + penetrability(l, rho_r) calls
that the per-point API (cross_sections_at_energy) would repeat.
Issue #87: the precompute is hoisted above the energy loop so that
precompute_jgroups_* runs O(ranges) times total, not O(ranges × energies).
§Arguments
data— Parsed resonance parameters from ENDF.energies— Slice of neutron energies in eV.
§Returns
Vector of cross-sections, one per energy point.
§Panics
Panics if any element of energies is non-finite or non-positive.
Validating the entire grid up-front (O(n) branch, one pass) means a
single bad energy fails fast with a clear message instead of being
hidden inside the inner loop, matches the symmetric contract on
cross_sections_at_energy, and protects direct Rust callers from
the same release-mode silent-zero footgun that the SLBW / RML / URR
leaf asserts guard against per-point.