From: Menno Fraters Date: Sat, 25 Jan 2020 02:39:20 +0000 (-0800) Subject: Fix particle probability density mpi problem X-Git-Tag: v9.2.0-rc1~606^2~7 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3c3bd8f98deb864c0b1f1f7cd6693d92e46fa044;p=dealii.git Fix particle probability density mpi problem --- diff --git a/source/particles/generators.cc b/source/particles/generators.cc index 1d3713b255..60d1b36f41 100644 --- a/source/particles/generators.cc +++ b/source/particles/generators.cc @@ -304,13 +304,16 @@ namespace Particles } #endif - // Calculate start id and number of local particles + // Calculate start id start_particle_id = std::llround(static_cast(n_particles_to_create) * local_start_weight / global_weight_integral); - n_local_particles = - std::llround(static_cast(n_particles_to_create) * - local_weight_integral / global_weight_integral); + + // Calcualate number of local particles + const types::particle_index end_particle_id = + llround(static_cast(n_particles_to_create) * + local_end_weight / global_weight_integral); + n_local_particles = end_particle_id - start_particle_id; if (random_cell_selection) {