Skip to content

Commit

Permalink
Fix particle probability density mpi problem
Browse files Browse the repository at this point in the history
  • Loading branch information
MFraters committed Jan 25, 2020
1 parent 2b23b25 commit 3c3bd8f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions source/particles/generators.cc
Expand Up @@ -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<double>(n_particles_to_create) *
local_start_weight / global_weight_integral);
n_local_particles =
std::llround(static_cast<double>(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<double>(n_particles_to_create) *
local_end_weight / global_weight_integral);
n_local_particles = end_particle_id - start_particle_id;

if (random_cell_selection)
{
Expand Down

0 comments on commit 3c3bd8f

Please sign in to comment.