File indexing completed on 2026-10-26 09:34:37
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include "corecel/Assert.hh"
0010 #include "corecel/Macros.hh"
0011 #include "corecel/Types.hh"
0012 #include "corecel/random/data/RanluxppRngData.hh"
0013 #include "corecel/random/engine/RanluxppRngEngine.hh"
0014
0015 namespace celeritas
0016 {
0017 namespace detail
0018 {
0019
0020
0021
0022
0023
0024 struct RanluxppRngSeedExecutor
0025 {
0026 NativeCRef<RanluxppRngParamsData> const params;
0027 NativeRef<RanluxppRngStateData> const state;
0028
0029
0030 inline CELER_FUNCTION void operator()(TrackSlotId tid) const
0031 {
0032 CELER_EXPECT(tid < state.size());
0033 RanluxppRngEngine rng(params, state, tid);
0034
0035
0036 RanluxppUInt offset = 0;
0037 rng = {params.seed, tid.unchecked_get(), offset};
0038 }
0039
0040
0041 CELER_FORCEINLINE_FUNCTION void operator()(ThreadId tid) const
0042 {
0043 return (*this)(TrackSlotId{tid.unchecked_get()});
0044 }
0045 };
0046
0047
0048
0049 void ranlux_state_init(DeviceCRef<RanluxppRngParamsData> const& params,
0050 DeviceRef<RanluxppRngStateData> const& state,
0051 StreamId stream);
0052
0053 void ranlux_state_init(HostCRef<RanluxppRngParamsData> const& params,
0054 HostRef<RanluxppRngStateData> const& state,
0055 StreamId);
0056
0057 #if !CELER_USE_DEVICE
0058
0059
0060
0061
0062 inline void ranlux_state_init(DeviceCRef<RanluxppRngParamsData> const&,
0063 DeviceRef<RanluxppRngStateData> const&,
0064 StreamId)
0065 {
0066 CELER_ASSERT_UNREACHABLE();
0067 }
0068 #endif
0069
0070
0071 }
0072 }