File indexing completed on 2025-10-14 08:48:29
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include "corecel/Assert.hh"
0010 #include "corecel/Macros.hh"
0011 #include "celeritas/Types.hh"
0012 #include "celeritas/geo/GeoTrackView.hh"
0013 #include "celeritas/optical/CoreTrackView.hh"
0014 #include "celeritas/optical/MaterialView.hh"
0015 #include "celeritas/optical/SimTrackView.hh"
0016
0017 namespace celeritas
0018 {
0019 namespace optical
0020 {
0021 namespace detail
0022 {
0023
0024
0025
0026
0027
0028
0029
0030 struct BoundaryExecutor
0031 {
0032 inline CELER_FUNCTION void operator()(CoreTrackView& track);
0033 };
0034
0035
0036 CELER_FUNCTION void BoundaryExecutor::operator()(CoreTrackView& track)
0037 {
0038 CELER_EXPECT([track] {
0039 auto sim = track.sim();
0040 return sim.post_step_action() == track.boundary_action()
0041 && sim.status() == TrackStatus::alive;
0042 }());
0043
0044 auto geo = track.geometry();
0045 CELER_EXPECT(geo.is_on_boundary());
0046
0047
0048 geo.cross_boundary();
0049 if (CELER_UNLIKELY(geo.failed()))
0050 {
0051 track.apply_errored();
0052 return;
0053 }
0054 else
0055 {
0056 auto sim = track.sim();
0057 sim.status(TrackStatus::killed);
0058 }
0059 }
0060
0061
0062 }
0063 }
0064 }