Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-01-10 10:05:49

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/phys/GeneratorCounters.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include "corecel/Macros.hh"
0010 #include "corecel/Types.hh"
0011 #include "celeritas/Types.hh"
0012 
0013 namespace celeritas
0014 {
0015 //---------------------------------------------------------------------------//
0016 /*!
0017  * Current sizes of the buffered generator data.
0018  *
0019  * The number of pending and generated tracks are updated by value on the host
0020  * at each core step. To allow accumulation over many steps which each may have
0021  * many photons, the type is templated.
0022  */
0023 template<class T = ::celeritas::size_type>
0024 struct GeneratorCounters
0025 {
0026     using size_type = T;
0027 
0028     //! Number of generators
0029     size_type buffer_size{0};
0030     //! Number of photons remaining to be generated
0031     size_type num_pending{0};
0032     //! Number of photons generated
0033     size_type num_generated{0};
0034 
0035     //! True if any queued generators/tracks exist
0036     CELER_FUNCTION bool empty() const
0037     {
0038         return buffer_size == 0 && num_pending == 0;
0039     }
0040 };
0041 
0042 //---------------------------------------------------------------------------//
0043 }  // namespace celeritas