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/AlongStepExecutor.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  * Complete end-of-step activity for a track.
0024  *
0025  * - Update track time
0026  * - Update number of steps
0027  * - Update remaining MFPs to interaction
0028  */
0029 struct AlongStepExecutor
0030 {
0031     inline CELER_FUNCTION void operator()(CoreTrackView& track);
0032 };
0033 
0034 //---------------------------------------------------------------------------//
0035 CELER_FUNCTION void AlongStepExecutor::operator()(CoreTrackView& track)
0036 {
0037     auto sim = track.sim();
0038 
0039     // Update time
0040     sim.add_time(sim.step_length() / constants::c_light);
0041 
0042     CELER_ASSERT(sim.status() == TrackStatus::alive);
0043     CELER_ASSERT(sim.step_length() > 0);
0044     CELER_ASSERT(sim.post_step_action());
0045 
0046     // TODO: update step count and check max step cut
0047     // TODO: reduce MFP by step * xs
0048 }
0049 
0050 //---------------------------------------------------------------------------//
0051 }  // namespace detail
0052 }  // namespace optical
0053 }  // namespace celeritas