From 2fa1937518962a7d4e203eab33604133d6f06a60 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <schaller@strw.leidenuniv.nl> Date: Mon, 25 Feb 2019 13:45:17 +0100 Subject: [PATCH] In the task_overlap function, escape early if the union is 0 --- .../IsolatedGalaxy_starformation/isolated_galaxy.yml | 2 +- src/task.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/IsolatedGalaxy/IsolatedGalaxy_starformation/isolated_galaxy.yml b/examples/IsolatedGalaxy/IsolatedGalaxy_starformation/isolated_galaxy.yml index 1bf7689b99..e4bea67340 100644 --- a/examples/IsolatedGalaxy/IsolatedGalaxy_starformation/isolated_galaxy.yml +++ b/examples/IsolatedGalaxy/IsolatedGalaxy_starformation/isolated_galaxy.yml @@ -35,7 +35,7 @@ Statistics: # Parameters related to the initial conditions InitialConditions: - file_name: fid.hdf5 # The file to read + file_name: lowres8.hdf5 # The file to read periodic: 0 # Are we running with periodic ICs? stars_smoothing_length: 0.5 diff --git a/src/task.c b/src/task.c index 40887aa593..34c636b48e 100644 --- a/src/task.c +++ b/src/task.c @@ -283,7 +283,6 @@ float task_overlap(const struct task *restrict ta, if (tb->ci != NULL) size_union += tb->ci->hydro.count; if (tb->cj != NULL) size_union += tb->cj->hydro.count; - // MATTHIEU: This should not be necessary if (size_union == 0) return 0.f; /* Compute the intersection of the cell data. */ @@ -305,6 +304,8 @@ float task_overlap(const struct task *restrict ta, if (tb->ci != NULL) size_union += tb->ci->grav.count; if (tb->cj != NULL) size_union += tb->cj->grav.count; + if (size_union == 0) return 0.f; + /* Compute the intersection of the cell data. */ const size_t size_intersect = task_cell_overlap_gpart(ta->ci, tb->ci) + task_cell_overlap_gpart(ta->ci, tb->cj) + -- GitLab