Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 10:31:22

0001 //----------------------------------*-C++-*----------------------------------//
0002 // Copyright 2023-2024 UT-Battelle, LLC, and other Celeritas developers.
0003 // See the top-level COPYRIGHT file for details.
0004 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0005 //---------------------------------------------------------------------------//
0006 //! \file celeritas/global/alongstep/detail/MscStepLimitApplier.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include "celeritas/global/CoreTrackView.hh"
0011 
0012 namespace celeritas
0013 {
0014 namespace detail
0015 {
0016 //---------------------------------------------------------------------------//
0017 /*!
0018  * Apply MSC step limiters.
0019  *
0020  * TODO: think about integrating this into the pre-step sequence. Maybe the
0021  * geo/phys path transformation would be best suited to the \c
0022  * apply_propagation step?
0023  */
0024 template<class MH>
0025 struct MscStepLimitApplier
0026 {
0027     inline CELER_FUNCTION void operator()(CoreTrackView const& track);
0028 
0029     MH msc;
0030 };
0031 
0032 //---------------------------------------------------------------------------//
0033 // DEDUCTION GUIDES
0034 //---------------------------------------------------------------------------//
0035 
0036 template<class MH>
0037 CELER_FUNCTION MscStepLimitApplier(MH&&) -> MscStepLimitApplier<MH>;
0038 
0039 //---------------------------------------------------------------------------//
0040 // INLINE DEFINITIONS
0041 //---------------------------------------------------------------------------//
0042 
0043 template<class MH>
0044 CELER_FUNCTION void
0045 MscStepLimitApplier<MH>::operator()(CoreTrackView const& track)
0046 {
0047     if (msc.is_applicable(track, track.make_sim_view().step_length()))
0048     {
0049         // Apply MSC step limiters and transform "physical" step (with MSC) to
0050         // "geometrical" step (smooth curve)
0051         msc.limit_step(track);
0052 
0053         auto step_view = track.make_physics_step_view();
0054         CELER_ASSERT(step_view.msc_step().geom_path > 0);
0055     }
0056     else
0057     {
0058         // TODO: hack flag for saving "use_msc"
0059         auto step_view = track.make_physics_step_view();
0060         step_view.msc_step().geom_path = 0;
0061     }
0062 }
0063 
0064 //---------------------------------------------------------------------------//
0065 }  // namespace detail
0066 }  // namespace celeritas