Skip to content

Commit 024e219

Browse files
committed
Avoid implicit 'this' capture in GPU lambda function
1 parent cd485b5 commit 024e219

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Source/Particles/Resampling/ParticleSplitting.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,8 @@ ParticleSplitting::ParticleSplitting (const std::string& species_name)
4444
" - position_axes_aligned_split\n"
4545
" - position_velocity_aligned_split.\n");
4646

47-
if (!m_resampling_random_splitting_angle) {
48-
utils::parser::queryWithParser(
49-
pp_species_name, "resampling_splitting_angle", m_splitting_angle);
50-
}
47+
utils::parser::queryWithParser(
48+
pp_species_name, "resampling_splitting_angle", m_splitting_angle);
5149
}
5250
void ParticleSplitting::operator() (
5351
const amrex::Geometry& geom_lev, WarpXParIter& pti,
@@ -85,6 +83,8 @@ void ParticleSplitting::operator() (
8583
}
8684

8785
const auto min_ppc = m_min_ppc;
86+
const auto resampling_random_splitting_angle = m_resampling_random_splitting_angle;
87+
const amrex::Real splitting_angle_fixed = m_splitting_angle;
8888

8989
amrex::Gpu::DeviceVector<int> n_new_children_per_cell(n_cells);
9090
int* num_new_children_ptr = n_new_children_per_cell.data();
@@ -170,9 +170,9 @@ void ParticleSplitting::operator() (
170170
amrex::ParticleReal offset_z = dx[2] * inv_split;
171171
#endif
172172

173-
const auto resampling_random_splitting_angle = m_resampling_random_splitting_angle;
174-
const amrex::Real splitting_angle = resampling_random_splitting_angle ?
175-
amrex::Random(engine) * 2.0_rt * MathConst::pi : m_splitting_angle;
173+
auto phi = amrex::Random(engine) * 2.0_rt * MathConst::pi;
174+
175+
amrex::Real splitting_angle = resampling_random_splitting_angle ? phi : splitting_angle_fixed;
176176

177177
// Starting index for new children particles for i_cell
178178
const int new_particle_start = num_particles_tile + offset_ptr[i_cell];

0 commit comments

Comments
 (0)