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