|
|
|||
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/SurfacePhysicsParams.hh 0006 //---------------------------------------------------------------------------// 0007 #pragma once 0008 0009 #include <memory> 0010 #include <vector> 0011 0012 #include "corecel/cont/EnumArray.hh" 0013 #include "corecel/data/ParamsDataInterface.hh" 0014 #include "corecel/data/ParamsDataStore.hh" 0015 #include "celeritas/optical/Types.hh" 0016 0017 #include "BoundaryAction.hh" 0018 #include "SurfaceModel.hh" 0019 #include "SurfacePhysicsData.hh" 0020 #include "SurfaceSteppingAction.hh" 0021 0022 namespace celeritas 0023 { 0024 class ActionRegistry; 0025 0026 namespace inp 0027 { 0028 struct OpticalSurfacePhysics; 0029 } // namespace inp 0030 0031 namespace optical 0032 { 0033 //---------------------------------------------------------------------------// 0034 /*! 0035 * Manage properties for optical surface physics. 0036 * 0037 * Surface physics during boundary crossing is split into three actions. 0038 * 0039 * 1. Initialize the boundary crossing 0040 * (see \rstref{Boundary initialization,surface_boundary_init} ). 0041 * 2. Apply surface physics models. 0042 * 3. If exiting the surface, the crossing or move into the previous volume 0043 * (see \rstref{Boundary crossing,surface_boundary_post} ). 0044 * 0045 * The second action is broken down into sets of "internal" \c 0046 * celeritas::optical::SurfaceModel classes categorized by a 0047 * \c SurfacePhysicsOrder . These are called sequentially, with one model from 0048 * each set applying to each track on a surface. 0049 * 0050 * 1. Sample a local facet normal 0051 * (see \rstref{Roughness,surface_roughness} ). 0052 * 2. Select transmittance/reflectivity/absorption override 0053 * (see \rstref{Reflectivity,surface_reflectivity} ). 0054 * 3. Sample and perform reflection/refraction 0055 * (see \rstref{Interaction,surface_interaction} ). 0056 * 0057 * \note The developer documentation includes further details of the 0058 * low-level \c Executor classes that performs these actions. 0059 * 0060 * \internal See the user manual for high-level descriptions and low-level 0061 * samplers. The intermediate action/executor descriptions follow. 0062 * 0063 * The three actions from the surface physics params are: 0064 * 1. \c BoundaryAction instantiated to use \c detail::InitBoundaryExecutor 0065 * 2. \c SurfaceSteppingAction, which invokes the surface model kernels. 0066 * 3. \c BoundaryAction instantiated to use \c detail::PostBoundaryExecutor 0067 * 0068 * Each surface model launches a kernel: 0069 * - Gaussian roughness (\c detail::GaussianRoughnessExecutor which uses \c 0070 * GaussianRoughnessSampler and rejects with \c EnteringSurfaceNormalSampler 0071 * - Smear roughness (\c detail::SmearRoughnessExectuor) 0072 * - Grid reflectivity \c detail::GridReflectivityExecutor 0073 * - Dielectric interaciton, wrapping \c detail::DielectricInteractor with \c 0074 * SurfaceInteractionApplier . 0075 */ 0076 class SurfacePhysicsParams final 0077 : public ParamsDataInterface<SurfacePhysicsParamsData> 0078 { 0079 public: 0080 //!@{ 0081 //! \name Type aliases 0082 using SPModel = std::shared_ptr<SurfaceModel>; 0083 //!@} 0084 0085 public: 0086 // Construct surface physics from input 0087 explicit SurfacePhysicsParams(ActionRegistry* action_reg, 0088 inp::OpticalSurfacePhysics const& input); 0089 0090 //! Access surface physics data on host 0091 HostRef const& host_ref() const final { return data_.host_ref(); } 0092 0093 //! Access surface physics data on device 0094 DeviceRef const& device_ref() const final { return data_.device_ref(); } 0095 0096 //! Action ID for initializing boundary interactions 0097 ActionId init_boundary_action() const 0098 { 0099 return init_boundary_action_->action_id(); 0100 } 0101 0102 //! Action ID for surface stepping loop action 0103 ActionId surface_stepping_action() const 0104 { 0105 return surface_stepping_action_->action_id(); 0106 } 0107 0108 //! Action ID for finishing boundary interactions 0109 ActionId post_boundary_action() const 0110 { 0111 return post_boundary_action_->action_id(); 0112 } 0113 0114 //! Get models for a given sub-step 0115 std::vector<SPModel> const& models(SurfacePhysicsOrder step) const 0116 { 0117 return models_[step]; 0118 } 0119 0120 private: 0121 //// TYPES //// 0122 0123 using SurfaceStepModels 0124 = EnumArray<SurfacePhysicsOrder, std::vector<SPModel>>; 0125 0126 //// DATA //// 0127 0128 // Boundary actions 0129 std::shared_ptr<InitBoundaryAction> init_boundary_action_; 0130 std::shared_ptr<SurfaceSteppingAction> surface_stepping_action_; 0131 std::shared_ptr<PostBoundaryAction> post_boundary_action_; 0132 0133 SurfaceStepModels models_; 0134 0135 // Host/device storage 0136 ParamsDataStore<SurfacePhysicsParamsData> data_; 0137 0138 //// FUNCTIONS //// 0139 0140 // Build surface data 0141 void build_surfaces(std::vector<std::vector<OptMatId>> const&, 0142 HostVal<SurfacePhysicsParamsData>&) const; 0143 0144 // Build sub-step models 0145 SurfaceStepModels build_models(inp::OpticalSurfacePhysics const&, 0146 HostVal<SurfacePhysicsParamsData>&) const; 0147 }; 0148 0149 //---------------------------------------------------------------------------// 0150 } // namespace optical 0151 } // 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 |
|