Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-07 10:11:39

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/surface/BoundaryAction.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include "celeritas/optical/action/ActionInterface.hh"
0010 
0011 namespace celeritas
0012 {
0013 namespace optical
0014 {
0015 //---------------------------------------------------------------------------//
0016 // FORWARD DECLARATIONS
0017 //---------------------------------------------------------------------------//
0018 namespace detail
0019 {
0020 
0021 struct InitBoundaryExecutor;
0022 struct PostBoundaryExecutor;
0023 
0024 }  // namespace detail
0025 
0026 //---------------------------------------------------------------------------//
0027 /*!
0028  * Optical boundary action templated by executor.
0029  *
0030  * Manages initialization and finalization of optical boundary crossing
0031  * actions. The template parameter \c E should be either \c
0032  * InitBoundaryExecutor or
0033  * \c PostBoundaryExecutor , which corresponds to the kernel this action will
0034  * execute during its stepping phase. The action name and description are
0035  * managed by \c BoundaryActionTraits<E> .
0036  *
0037  * \todo To improve documentation, make these a detail class with protected
0038  * interface. Most kernels can be declared and defined that way too.
0039  */
0040 template<class E>
0041 class BoundaryAction : public OpticalStepActionInterface, public ConcreteAction
0042 {
0043   public:
0044     // Construct from action ID
0045     explicit BoundaryAction(ActionId);
0046 
0047     // Launch kernel with host data
0048     void step(CoreParams const&, CoreStateHost&) const final;
0049     // Launch kernel with device data
0050     void step(CoreParams const&, CoreStateDevice&) const final;
0051 
0052     //! Dependency ordering of the action
0053     StepActionOrder order() const final { return StepActionOrder::post; }
0054 };
0055 
0056 //---------------------------------------------------------------------------//
0057 // EXPLICIT INSTANTIATION
0058 //---------------------------------------------------------------------------//
0059 
0060 extern template class BoundaryAction<detail::InitBoundaryExecutor>;
0061 extern template class BoundaryAction<detail::PostBoundaryExecutor>;
0062 
0063 //---------------------------------------------------------------------------//
0064 // TYPE ALIASES
0065 //---------------------------------------------------------------------------//
0066 
0067 using InitBoundaryAction = BoundaryAction<detail::InitBoundaryExecutor>;
0068 using PostBoundaryAction = BoundaryAction<detail::PostBoundaryExecutor>;
0069 
0070 //---------------------------------------------------------------------------//
0071 }  // namespace optical
0072 }  // namespace celeritas