File indexing completed on 2026-11-07 10:11:39
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include "celeritas/optical/CoreTrackView.hh"
0010 #include "celeritas/optical/surface/SmearRoughnessSampler.hh"
0011 #include "celeritas/optical/surface/SurfacePhysicsUtils.hh"
0012
0013 #include "SmearRoughnessData.hh"
0014
0015 namespace celeritas
0016 {
0017 namespace optical
0018 {
0019
0020
0021
0022
0023
0024
0025 struct SmearRoughnessExecutor
0026 {
0027 NativeCRef<SmearRoughnessData> data;
0028
0029
0030 CELER_FUNCTION void operator()(CoreTrackView& track) const
0031 {
0032 auto s_phys = track.surface_physics();
0033 auto sub_model_id
0034 = s_phys.interface(SurfacePhysicsOrder::roughness).internal_surface_id();
0035 CELER_ASSERT(sub_model_id < data.roughness.size());
0036 EnteringSurfaceNormalSampler<SmearRoughnessSampler> sample_facet{
0037 track.geometry().dir(),
0038 s_phys.global_normal(),
0039 data.roughness[sub_model_id]};
0040 auto rng = track.rng();
0041 s_phys.facet_normal(sample_facet(rng));
0042 }
0043 };
0044
0045
0046 }
0047 }