-
Mark OLESEN authored
- define returnReduce *after* defining all specializations for reduce so that the compiler does not take the generic templated reduce. ENH: add UPstream::reduceAnd, UPstream::reduceOr - direct wrapper of MPI_LAND, MPI_LOR intrinsics ENH: provide special purpose returnReduce for logical operations - returnReduceAnd(bool), returnReduceOr(bool) as a inline wrappers for returnReduce with andOp<bool>(), orOp<bool>() operators, respectively. These forms are more succinct and force casting of the parameter into a bool. Using MPI bool operations allows vendor/hardware MPI optimisations. * Test for existence on any rank: 1. if (returnReduceOr(list.size()) { ... } 1b. if (returnReduceOr(!list.empty()) { ... } 2. if (returnReduce(bool(list.size(), orOp<bool>())) { ... } 3. if (returnReduce(list.size(), sumOp<label>()) != 0) { ... } 3b. if (returnReduce(list.size(), sumOp<label>()) > 0) { ... } * Test for non-existence on all ranks: 1. if (returnReduceAnd(list.empty()) { ... } 1b. if (!returnReduceOr(list.size()) { ... } 2. if (returnReduce(list.empty(), andOp<bool>())) { ... } 3. if (returnReduce(list.size(), sumOp<label>()) == 0) { ... } Notes: Form 1. succinct Form 2. may require explicit bool() for correct dispatch Form 3. more expensive sumOp<label> just for testing size! There are also some places using maxOp<label> instead of sumOp<label>
512f5585