ENH: add UPstream::allProcs() method

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

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

  instead of

      for (label proci = 0; proci < Pstream::nProcs(); ++proci) { ... }
This commit is contained in:
Mark Olesen
2020-09-28 11:41:24 +02:00
parent f8a8728f8f
commit e18ff114a6
35 changed files with 102 additions and 99 deletions

View File

@ -1303,7 +1303,7 @@ void Foam::refinementHistory::distribute(const mapDistributePolyMesh& map)
// Create subsetted refinement tree consisting of all parents that
// move in their whole to other processor.
for (label proci = 0; proci < Pstream::nProcs(); proci++)
for (const int proci : Pstream::allProcs())
{
//Pout<< "-- Subetting for processor " << proci << endl;
@ -1412,7 +1412,7 @@ void Foam::refinementHistory::distribute(const mapDistributePolyMesh& map)
visibleCells_.setSize(mesh.nCells());
visibleCells_ = -1;
for (label proci = 0; proci < Pstream::nProcs(); proci++)
for (const int proci : Pstream::allProcs())
{
IPstream fromNbr(Pstream::commsTypes::blocking, proci);
List<splitCell8> newSplitCells(fromNbr);