File indexing completed on 2025-02-22 10:31:32
0001
0002
0003
0004
0005
0006
0007
0008 #pragma once
0009
0010 #include "corecel/Assert.hh"
0011 #include "corecel/Macros.hh"
0012 #include "corecel/data/ObserverPtr.hh"
0013 #include "corecel/math/Algorithms.hh"
0014 #include "corecel/math/Atomics.hh"
0015 #include "celeritas/global/CoreTrackView.hh"
0016
0017 #include "../ParticleTallyData.hh"
0018
0019 namespace celeritas
0020 {
0021 namespace detail
0022 {
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032 struct SlotDiagnosticExecutor
0033 {
0034 inline CELER_FUNCTION void
0035 operator()(celeritas::CoreTrackView const& track);
0036
0037 ObserverPtr<int> output;
0038 };
0039
0040
0041 CELER_FUNCTION void
0042 SlotDiagnosticExecutor::operator()(CoreTrackView const& track)
0043 {
0044 int result = [&track] {
0045 auto sim = track.make_sim_view();
0046 if (sim.status() == TrackStatus::inactive)
0047 {
0048 return -1;
0049 }
0050 else if (sim.status() == TrackStatus::errored)
0051 {
0052 return -2;
0053 }
0054
0055 return static_cast<int>(track.make_particle_view().particle_id().get());
0056 }();
0057
0058 size_type const index = track.track_slot_id().get();
0059 (&*output)[index] = result;
0060 }
0061
0062
0063 }
0064 }