Apply Max Number of Events Check to Random Rays (#3438)

Co-authored-by: Jonathan Shimwell <drshimwell@gmail.com>
This commit is contained in:
John Tramm 2025-06-11 12:41:38 -05:00 committed by GitHub
parent f571be87c5
commit 2eeba89992
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -265,6 +265,12 @@ uint64_t RandomRay::transport_history_based_single_ray()
if (!alive())
break;
event_cross_surface();
// If ray has too many events, display warning and kill it
if (n_event() >= settings::max_particle_events) {
warning("Ray " + std::to_string(id()) +
" underwent maximum number of events, terminating ray.");
wgt() = 0.0;
}
}
return n_event();