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/OffloadAlgorithms.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include "corecel/Macros.hh"
0010 #include "corecel/Types.hh"
0011 #include "corecel/data/Collection.hh"
0012 #include "celeritas/optical/CoreState.hh"
0013 #include "celeritas/optical/WavelengthShiftData.hh"
0014 
0015 #include "../GeneratorData.hh"
0016 
0017 namespace celeritas
0018 {
0019 namespace detail
0020 {
0021 //---------------------------------------------------------------------------//
0022 using celeritas::optical::GeneratorDistributionData;
0023 using celeritas::optical::WlsDistributionData;
0024 
0025 template<class T, MemSpace M>
0026 using ItemsRef = Collection<T, Ownership::reference, M>;
0027 
0028 //---------------------------------------------------------------------------//
0029 // Remove all invalid distributions from the buffer.
0030 template<class T>
0031 size_type remove_if_invalid(
0032     ItemsRef<T, MemSpace::host> const&, size_type, size_type, StreamId);
0033 template<class T>
0034 size_type remove_if_invalid(
0035     ItemsRef<T, MemSpace::device> const&, size_type, size_type, StreamId);
0036 
0037 //---------------------------------------------------------------------------//
0038 // Count the number of optical photons in the distributions and add these to
0039 // the number of pending  tracks.
0040 void add_pending_photon_count(
0041     optical::CoreState<MemSpace::host>&,
0042     ItemsRef<GeneratorDistributionData, MemSpace::host> const&,
0043     size_type,
0044     size_type,
0045     StreamId);
0046 void add_pending_photon_count(
0047     optical::CoreState<MemSpace::device>&,
0048     ItemsRef<GeneratorDistributionData, MemSpace::device> const&,
0049     size_type,
0050     size_type,
0051     StreamId);
0052 
0053 //---------------------------------------------------------------------------//
0054 // INLINE DEFINITIONS
0055 //---------------------------------------------------------------------------//
0056 #if !CELER_USE_DEVICE
0057 template<class T>
0058 inline size_type remove_if_invalid(
0059     ItemsRef<T, MemSpace::device> const&, size_type, size_type, StreamId)
0060 {
0061     CELER_NOT_CONFIGURED("CUDA OR HIP");
0062 }
0063 
0064 inline void add_pending_photon_count(
0065     optical::CoreState<MemSpace::device>&,
0066     ItemsRef<GeneratorDistributionData, MemSpace::device> const&,
0067     size_type,
0068     size_type,
0069     StreamId)
0070 {
0071     CELER_NOT_CONFIGURED("CUDA OR HIP");
0072 }
0073 #endif
0074 
0075 //---------------------------------------------------------------------------//
0076 }  // namespace detail
0077 }  // namespace celeritas