Skip to content

Commit 934d912

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

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Source/Particles/Resampling/ParticleSplitting.cpp

Lines changed: 6 additions & 6 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,
@@ -171,8 +169,10 @@ void ParticleSplitting::operator() (
171169
#endif
172170

173171
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;
172+
const amrex::Real splitting_angle_fixed = m_splitting_angle;
173+
const amrex::Real random_number = amrex::Random(engine);
174+
175+
amrex::Real splitting_angle = resampling_random_splitting_angle ? random_number * 2.0_rt * MathConst::pi : 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)