diff --git a/examples/test_bh.c b/examples/test_bh.c index 0431479ad07e93c1fbafb909e13ce3a75674b664..ff038ee4becc102cf870905915236b1f30276740 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); } }