Commit 7a595a27 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Only finalize the centre of mass calculation if the mass is non-zero

parent 161e8cb1
......@@ -4469,8 +4469,7 @@ void engine_init(struct engine *e, struct space *s,
* do this once we've made at least one call to engine_entry_affinity and
* maybe numa_node_of_cpu(sched_getcpu()), even if the engine isn't already
* pinned. */
if (with_aff)
engine_unpin();
if (with_aff) engine_unpin();
#endif
if (with_aff) {
......
......@@ -301,9 +301,11 @@ void stats_collect(const struct space *s, struct statistics *stats) {
*/
void stats_finalize(struct statistics *stats) {
stats->centre_of_mass[0] /= stats->mass;
stats->centre_of_mass[1] /= stats->mass;
stats->centre_of_mass[2] /= stats->mass;
if (stats->mass > 0.) {
stats->centre_of_mass[0] /= stats->mass;
stats->centre_of_mass[1] /= stats->mass;
stats->centre_of_mass[2] /= stats->mass;
}
}
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment