Warning, file /include/celeritas/optical/action/ActionLauncher.hh was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008 #pragma once
0009
0010 #include <utility>
0011
0012 #include "corecel/Config.hh"
0013
0014 #include "corecel/Assert.hh"
0015 #include "corecel/Types.hh"
0016 #include "corecel/sys/MultiExceptionHandler.hh"
0017 #include "corecel/sys/ThreadId.hh"
0018 #include "celeritas/optical/CoreState.hh"
0019
0020 namespace celeritas
0021 {
0022 namespace optical
0023 {
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037 template<class F>
0038 void launch_action(CoreState<MemSpace::host>& state, F&& execute_thread)
0039 {
0040 MultiExceptionHandler capture_exception;
0041 #if defined(_OPENMP) && CELERITAS_OPENMP == CELERITAS_OPENMP_TRACK
0042 # pragma omp parallel for
0043 #endif
0044 for (size_type i = 0, size = state.size(); i != size; ++i)
0045 {
0046 CELER_TRY_HANDLE(execute_thread(ThreadId{i}), capture_exception);
0047 }
0048 log_and_rethrow(std::move(capture_exception));
0049 }
0050
0051
0052 }
0053 }