Function write_multi_particle

pub fn write_multi_particle(
    weight_windows: &[WeightWindow],
    output: &str,
    padded: bool,
)
Expand description

Combine multiple weight window sets into a single wwout file

A WeightWindow instance corresponds to a full set of weight windows for a single particle type. This can be written simply using the write_single_particle() function or calling write() directly.

This function attempts to combine a list of weight windows into a single wwout file for multiple particles.

Note that:

  • Weight window sets are re-sorted by particle type
  • Duplicate particle types are removed
  • Sets with inconsistent geometries are removed

The remaining weight window sets that can be combined will be written to the path provided as output.

let mut neutron = WeightWindow {
    weights: vec![0.2, 0.15, 0.4],
    particle: 1,                    // Particle::Neutron
    ..Default::default()
};

let mut photon = WeightWindow {
    weights: vec![0.2, 0.15, 0.4],
    particle: 2,                    // Particle::Photon
    ..Default::default()
};

// Write a combined NP weight window file
let ww_sets = [photon, neutron];
let weight_window = write_multi_particle(&ww_sets, "wwout_NP", false);