]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix particle probability density mpi problem
authorMenno Fraters <menno.fraters@outlook.com>
Sat, 25 Jan 2020 02:39:20 +0000 (18:39 -0800)
committerMenno Fraters <menno.fraters@outlook.com>
Sat, 25 Jan 2020 02:39:20 +0000 (18:39 -0800)
source/particles/generators.cc

index 1d3713b255af213d15457219f4a22c41d06e825a..60d1b36f4140352fe3b0688cf38968f7c7f9307a 100644 (file)
@@ -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)
           {

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.