Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-27 10:26:31

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/gen/detail/OffloadPreGatherExecutor.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 struct OffloadPreGatherExecutor
0026 {
0027     inline CELER_FUNCTION void operator()(
0028         celeritas::CoreTrackView const& track);
0029 
0030     NativeRef<OffloadPreStateData> const state;
0031 };
0032 
0033 //---------------------------------------------------------------------------//
0034 // INLINE DEFINITIONS
0035 //---------------------------------------------------------------------------//
0036 /*!
0037  * Gather pre-step data needed to generate optical distributions.
0038  */
0039 CELER_FUNCTION void OffloadPreGatherExecutor::operator()(
0040     CoreTrackView const& track)
0041 {
0042     CELER_EXPECT(state);
0043     CELER_EXPECT(track.track_slot_id() < state.step.size());
0044 
0045     OffloadPreStepData& step = state.step[track.track_slot_id()];
0046     step.material = track.material().material_record().optical_material_id();
0047     if (step.material)
0048     {
0049         step.speed = track.particle().speed();
0050         step.pos = track.geometry().pos();
0051         step.time = track.sim().time();
0052     }
0053 }
0054 
0055 //---------------------------------------------------------------------------//
0056 }  // namespace detail
0057 }  // namespace celeritas