![]() |
|
|||
File indexing completed on 2025-02-22 10:31:27
0001 //----------------------------------*-C++-*----------------------------------// 0002 // Copyright 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/optical/Interaction.hh 0007 //---------------------------------------------------------------------------// 0008 #pragma once 0009 0010 #include "corecel/Macros.hh" 0011 #include "geocel/Types.hh" 0012 0013 namespace celeritas 0014 { 0015 namespace optical 0016 { 0017 //---------------------------------------------------------------------------// 0018 /*! 0019 * The result of a discrete optical interaction. 0020 * 0021 * All optical interactions are discrete. The wavelength of a photon is only 0022 * changed through absorption re-emission processes. 0023 */ 0024 struct Interaction 0025 { 0026 //! Interaction result category 0027 enum class Action 0028 { 0029 scattered, //!< Still alive, state has changed 0030 absorbed, //!< Absorbed by the material 0031 unchanged, //!< No state change, no secondaries 0032 }; 0033 0034 Real3 direction; //!< Post-interaction direction 0035 Real3 polarization; //!< Post-interaction polarization 0036 Action action{Action::scattered}; //!< Flags for interaction result 0037 0038 //! Return an interaction respresenting an absorbed process 0039 static inline CELER_FUNCTION Interaction from_absorption(); 0040 0041 //! Return an interaction with no change in the track state 0042 static inline CELER_FUNCTION Interaction from_unchanged(); 0043 0044 //! Whether the state changed but did not fail 0045 CELER_FUNCTION bool changed() const 0046 { 0047 return static_cast<int>(action) < static_cast<int>(Action::unchanged); 0048 } 0049 }; 0050 0051 //---------------------------------------------------------------------------// 0052 // INLINE DEFINITIONS 0053 //---------------------------------------------------------------------------// 0054 /*! 0055 * Construct an interaction for an absorbed optical photon. 0056 */ 0057 CELER_FUNCTION Interaction Interaction::from_absorption() 0058 { 0059 Interaction result; 0060 result.action = Action::absorbed; 0061 return result; 0062 } 0063 0064 //---------------------------------------------------------------------------// 0065 /*! 0066 * Construct an interaction for edge cases where this is no state change. 0067 */ 0068 CELER_FUNCTION Interaction Interaction::from_unchanged() 0069 { 0070 Interaction result; 0071 result.action = Action::unchanged; 0072 return result; 0073 } 0074 0075 //---------------------------------------------------------------------------// 0076 } // namespace optical 0077 } // namespace celeritas
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |