Skip to content

Commit

Permalink
setup_particles: fix when 0<n<.5
Browse files Browse the repository at this point in the history
  • Loading branch information
James committed Apr 3, 2024
1 parent 62a4ece commit da98c4f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/include/setup_particles.hxx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

#pragma once

#include <algorithm>
#include <functional>
#include <type_traits>
#include "centering.hxx"
Expand Down Expand Up @@ -122,7 +123,7 @@ struct SetupParticles
if (fractional_n_particles_per_cell) {
return np.n / norm_.cori + dist.get();
}
return np.n / norm_.cori + .5;
return std::max(1, int(np.n / norm_.cori + .5));
}

// ----------------------------------------------------------------------
Expand Down

0 comments on commit da98c4f

Please sign in to comment.