From 14252fc0398c32a69f75d76f96ac0fb988671b49 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <matthieu.schaller@durham.ac.uk> Date: Wed, 4 Mar 2015 12:35:12 +0000 Subject: [PATCH] Removed an unnecessary test of neighbourhood in iact_pair() --- examples/test_bh.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/examples/test_bh.c b/examples/test_bh.c index 0431479..ff038ee 100644 --- a/examples/test_bh.c +++ b/examples/test_bh.c @@ -820,27 +820,27 @@ void iact_pair(struct cell *ci, struct cell *cj) { error("The impossible has happened: pair interaction between a cell and " "itself."); -#endif - /* Are the cells direct neighbours? */ - if (are_neighbours(ci, cj)) { + if (!are_neighbours(ci, cj)) + error("Non-neighbouring cells !"); - /* Are both cells split ? */ - if (ci->split && cj->split) { - - /* Let's split both cells and build all possible pairs */ - for (cp = ci->firstchild; cp != ci->sibling; cp = cp->sibling) { - for (cps = cj->firstchild; cps != cj->sibling; cps = cps->sibling) { +#endif - /* If the cells are neighbours, recurse. */ - if (are_neighbours(cp, cps)) { - iact_pair(cp, cps); - } - } + /* Are both cells split ? */ + if (ci->split && cj->split) { + + /* Let's split both cells and build all possible pairs */ + for (cp = ci->firstchild; cp != ci->sibling; cp = cp->sibling) { + for (cps = cj->firstchild; cps != cj->sibling; cps = cps->sibling) { + + /* If the cells are neighbours, recurse. */ + if (are_neighbours(cp, cps)) { + iact_pair(cp, cps); + } } - } else {/* Otherwise, compute the interactions at this level directly. */ - iact_pair_direct(ci, cj); } + } else {/* Otherwise, compute the interactions at this level directly. */ + iact_pair_direct(ci, cj); } } -- GitLab