Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-18 09:09:09

0001 //------------------------------- -*- C++ -*- -------------------------------//
0002 // Copyright Celeritas contributors: see top-level COPYRIGHT file for details
0003 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0004 //---------------------------------------------------------------------------//
0005 //! \file celeritas/optical/action/detail/PropagateExecutor.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include "corecel/Assert.hh"
0010 #include "corecel/Macros.hh"
0011 #include "celeritas/Types.hh"
0012 #include "celeritas/optical/CoreTrackView.hh"
0013 #include "celeritas/optical/SimTrackView.hh"
0014 
0015 namespace celeritas
0016 {
0017 namespace optical
0018 {
0019 namespace detail
0020 {
0021 //---------------------------------------------------------------------------//
0022 /*!
0023  * Move a track to the next interaction or geometry boundary.
0024  *
0025  * This should only apply to alive tracks.
0026  */
0027 struct PropagateExecutor
0028 {
0029     inline CELER_FUNCTION void operator()(CoreTrackView& track);
0030 };
0031 
0032 //---------------------------------------------------------------------------//
0033 CELER_FUNCTION void PropagateExecutor::operator()(CoreTrackView& track)
0034 {
0035     auto&& sim = track.sim();
0036     CELER_ASSERT(sim.status() == TrackStatus::alive);
0037 
0038     // Propagate up to the physics distance
0039     real_type step = sim.step_length();
0040     CELER_ASSERT(step > 0);
0041 
0042     auto&& geo = track.geometry();
0043     Propagation p = geo.find_next_step(step);
0044     if (p.boundary)
0045     {
0046         geo.move_to_boundary();
0047         sim.step_length(p.distance);
0048         sim.post_step_action(track.boundary_action());
0049     }
0050     else
0051     {
0052         CELER_ASSERT(step == p.distance);
0053         geo.move_internal(step);
0054     }
0055 }
0056 
0057 //---------------------------------------------------------------------------//
0058 }  // namespace detail
0059 }  // namespace optical
0060 }  // namespace celeritas