Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 10:31:26

0001 //----------------------------------*-C++-*----------------------------------//
0002 // Copyright 2024 UT-Battelle, LLC, and other Celeritas developers.
0003 // See the top-level COPYRIGHT file for details.
0004 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0005 //---------------------------------------------------------------------------//
0006 //! \file celeritas/optical/detail/OffloadGatherExecutor.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include "corecel/Macros.hh"
0011 #include "corecel/Types.hh"
0012 #include "celeritas/global/CoreTrackView.hh"
0013 #include "celeritas/optical/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.make_particle_view().speed();
0049     step.pos = track.make_geo_view().pos();
0050     step.time = track.make_sim_view().time();
0051     step.material
0052         = track.make_material_view().make_material_view().optical_material_id();
0053 }
0054 
0055 //---------------------------------------------------------------------------//
0056 }  // namespace detail
0057 }  // namespace celeritas