Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-15 08:54:46

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/detail/OffloadGatherExecutor.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include "corecel/Macros.hh"
0010 #include "corecel/Types.hh"
0011 #include "celeritas/global/CoreTrackView.hh"
0012 
0013 #include "../OffloadData.hh"
0014 
0015 namespace celeritas
0016 {
0017 namespace detail
0018 {
0019 //---------------------------------------------------------------------------//
0020 // LAUNCHER
0021 //---------------------------------------------------------------------------//
0022 /*!
0023  * Gather pre-step data needed to generate optical distributions.
0024  *
0025  * TODO: check optical material first, skip storing if it's false. Also maybe
0026  * skip storing for tracks that can't lose energy over the step?
0027  */
0028 struct OffloadGatherExecutor
0029 {
0030     inline CELER_FUNCTION void
0031     operator()(celeritas::CoreTrackView const& track);
0032 
0033     NativeRef<OffloadStateData> const state;
0034 };
0035 
0036 //---------------------------------------------------------------------------//
0037 // INLINE DEFINITIONS
0038 //---------------------------------------------------------------------------//
0039 /*!
0040  */
0041 CELER_FUNCTION void
0042 OffloadGatherExecutor::operator()(CoreTrackView const& track)
0043 {
0044     CELER_EXPECT(state);
0045     CELER_EXPECT(track.track_slot_id() < state.step.size());
0046 
0047     OffloadPreStepData& step = state.step[track.track_slot_id()];
0048     step.speed = track.particle().speed();
0049     step.pos = track.geometry().pos();
0050     step.time = track.sim().time();
0051     step.material = track.material().material_record().optical_material_id();
0052 }
0053 
0054 //---------------------------------------------------------------------------//
0055 }  // namespace detail
0056 }  // namespace celeritas