Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-19 08:49:41

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/alongstep/detail/MscStepLimitApplier.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include "celeritas/global/CoreTrackView.hh"
0010 
0011 namespace celeritas
0012 {
0013 namespace detail
0014 {
0015 //---------------------------------------------------------------------------//
0016 /*!
0017  * Apply MSC step limiters.
0018  *
0019  * TODO: think about integrating this into the pre-step sequence. Maybe the
0020  * geo/phys path transformation would be best suited to the \c
0021  * apply_propagation step?
0022  */
0023 template<class MH>
0024 struct MscStepLimitApplier
0025 {
0026     inline CELER_FUNCTION void operator()(CoreTrackView const& track);
0027 
0028     MH msc;
0029 };
0030 
0031 //---------------------------------------------------------------------------//
0032 // DEDUCTION GUIDES
0033 //---------------------------------------------------------------------------//
0034 
0035 template<class MH>
0036 CELER_FUNCTION MscStepLimitApplier(MH&&) -> MscStepLimitApplier<MH>;
0037 
0038 //---------------------------------------------------------------------------//
0039 // INLINE DEFINITIONS
0040 //---------------------------------------------------------------------------//
0041 
0042 template<class MH>
0043 CELER_FUNCTION void
0044 MscStepLimitApplier<MH>::operator()(CoreTrackView const& track)
0045 {
0046     if (msc.is_applicable(track, track.sim().step_length()))
0047     {
0048         // Apply MSC step limiters and transform "physical" step (with MSC) to
0049         // "geometrical" step (smooth curve)
0050         msc.limit_step(track);
0051 
0052         auto step_view = track.physics_step();
0053         CELER_ASSERT(step_view.msc_step().geom_path > 0);
0054     }
0055     else
0056     {
0057         // TODO: hack flag for saving "use_msc"
0058         auto step_view = track.physics_step();
0059         step_view.msc_step().geom_path = 0;
0060     }
0061 }
0062 
0063 //---------------------------------------------------------------------------//
0064 }  // namespace detail
0065 }  // namespace celeritas