Skip to content
Snippets Groups Projects
Commit e4df2b48 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Cleaner version of the proxy existence check in the task creation.

parent 9ec191a9
No related branches found
No related tags found
1 merge request!673Reduce the number of proxies constructed in the case with gravity
......@@ -868,13 +868,12 @@ void engine_make_self_gravity_tasks_mapper(void *map_data, int num_elements,
const struct proxy *p = &e->proxies[proxy_id];
/* Check whether the cell exists in the proxy */
int n = 0, err = 1;
int n = 0;
for (; n < p->nr_cells_in; n++)
if (p->cells_in[n] == cj) {
err = 0;
break;
}
if (err)
if (n == p->nr_cells_in)
error(
"Cell %d not found in the proxy but trying to construct "
"grav task!",
......@@ -889,13 +888,12 @@ void engine_make_self_gravity_tasks_mapper(void *map_data, int num_elements,
const struct proxy *p = &e->proxies[proxy_id];
/* Check whether the cell exists in the proxy */
int n = 0, err = 1;
int n = 0;
for (; n < p->nr_cells_in; n++)
if (p->cells_in[n] == ci) {
err = 0;
break;
}
if (err)
if (n == p->nr_cells_in)
error(
"Cell %d not found in the proxy but trying to construct "
"grav task!",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment