|
7 | 7 | #include <actual_integrator.H>
|
8 | 8 | #endif
|
9 | 9 |
|
10 |
| -template <typename BurnT> |
| 10 | +template <typename BurnT, bool enable_retry> |
11 | 11 | AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
|
12 |
| -void integrator (BurnT& state, Real dt) |
| 12 | +void integrator_wrapper (BurnT& state, Real dt) |
13 | 13 | {
|
14 | 14 |
|
15 |
| - burn_t old_state; |
16 |
| - if (use_burn_retry) { |
17 |
| - old_state = state; |
| 15 | + if constexpr (enable_retry) { |
| 16 | + burn_t old_state{state}; |
| 17 | + |
| 18 | + actual_integrator(state, dt); |
| 19 | + |
| 20 | + if (!state.success) { |
| 21 | + state = old_state; |
| 22 | + const bool is_retry = true; |
| 23 | + actual_integrator(state, dt, is_retry); |
| 24 | + } |
| 25 | + } else { |
| 26 | + actual_integrator(state, dt); |
18 | 27 | }
|
19 | 28 |
|
20 |
| - actual_integrator(state, dt); |
| 29 | +} |
| 30 | + |
| 31 | + |
| 32 | +template <typename BurnT> |
| 33 | +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE |
| 34 | +void integrator (BurnT& state, Real dt) |
| 35 | +{ |
| 36 | + |
| 37 | + if (integrator_rp::use_burn_retry) { |
| 38 | + constexpr bool enable_retry{true}; |
| 39 | + integrator_wrapper<BurnT, enable_retry>(state, dt); |
| 40 | + } else { |
| 41 | + constexpr bool enable_retry{false}; |
| 42 | + integrator_wrapper<BurnT, enable_retry>(state, dt); |
21 | 43 |
|
22 |
| - if (!state.success && use_burn_retry) { |
23 |
| - state = old_state; |
24 |
| - const bool is_retry = true; |
25 |
| - actual_integrator(state, dt, is_retry); |
26 | 44 | }
|
27 | 45 | }
|
28 | 46 |
|
|
0 commit comments