Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:53:47

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/track/TrackFunctors.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include "corecel/Assert.hh"
0010 #include "corecel/sys/ThreadId.hh"
0011 #include "celeritas/Types.hh"
0012 
0013 namespace celeritas
0014 {
0015 //---------------------------------------------------------------------------//
0016 // CONDITIONS
0017 //---------------------------------------------------------------------------//
0018 /*!
0019  * Condition for ConditionalTrackExecutor for active, non-errored tracks.
0020  */
0021 struct AppliesValid
0022 {
0023     template<class T>
0024     CELER_FUNCTION bool operator()(T const& track) const
0025     {
0026         return is_track_valid(track.sim().status());
0027     }
0028 };
0029 
0030 //---------------------------------------------------------------------------//
0031 /*!
0032  * Apply only to tracks with the given post-step action ID.
0033  */
0034 struct IsStepActionEqual
0035 {
0036     ActionId action;
0037 
0038     template<class T>
0039     CELER_FUNCTION bool operator()(T const& track) const
0040     {
0041         return track.sim().post_step_action() == this->action;
0042     }
0043 };
0044 
0045 //---------------------------------------------------------------------------//
0046 /*!
0047  * Apply only to tracks with the given along-step action ID.
0048  */
0049 struct IsAlongStepActionEqual
0050 {
0051     ActionId action;
0052 
0053     template<class T>
0054     CELER_FUNCTION bool operator()(T const& track) const
0055     {
0056         CELER_EXPECT(AppliesValid{}(track)
0057                      == static_cast<bool>(track.sim().along_step_action()));
0058         return track.sim().along_step_action() == this->action;
0059     }
0060 };
0061 
0062 //---------------------------------------------------------------------------//
0063 }  // namespace celeritas