celeritas icon indicating copy to clipboard operation
celeritas copied to clipboard

Add compile-time polymorphism for distributions for on-device separable user sampling

Open sethrj opened this issue 1 month ago • 0 comments

Related to #2122 , add the infrastructure to sample from arbitrary distributions on device

  • Add inp directory to corecel (Grid input should be moved there)
  • Move distribution inputs from celeritas/inp/Events.hh to corecel/inp/Distributions.hh
  • For each sampling type (1D, 3D, size_type/ParticleId, ...?), define a distribution enum and type dispatch for samplers similar to orange/surf but improved with our latest techniques
    • Define a DistributionCollectionGroup that has enums, offsets, records (needed for dynamic-sized distributions), and reals/ints (for backend storage)
    • Write setup-time DistributionInserter that takes inp::... and adds to the collection group, returning distribution ID for that type
    • Write compile-time DistributionVisitor that takes NativeCRef<DistributionCollectionGroup>, locally constructs the distribution, and returns a sample given an RNG
  • Update primary generators to use on-device sampling

sethrj avatar Nov 20 '25 12:11 sethrj