ENH: add UPstream::subProcs() static method

- returns a range of `int` values that can be iterated across.
  For example,

      for (const int proci : Pstream::subProcs()) { ... }

  instead of

      for
      (
          int proci = Pstream::firstSlave();
          proci <= Pstream::lastSlave();
          ++proci
      )
      {
          ...
      }
This commit is contained in:
Mark Olesen
2020-09-28 11:57:40 +02:00
parent e18ff114a6
commit 5dc5ea928a
43 changed files with 140 additions and 398 deletions

View File

@ -297,12 +297,7 @@ int main(int argc, char *argv[])
{
if (Pstream::master())
{
for
(
int proci = Pstream::firstSlave();
proci <= Pstream::lastSlave();
++proci
)
for (const int proci : Pstream::subProcs())
{
IPstream fromSlave(Pstream::commsTypes::blocking, proci);
FixedList<label, 2> list3(fromSlave);