mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
@ -409,7 +409,7 @@ bool Foam::functionObjects::externalCoupled::writeData
|
||||
}
|
||||
masterFilePtr() << os.str().c_str();
|
||||
|
||||
for (label proci = 1; proci < Pstream::nProcs(); proci++)
|
||||
for (const int proci : Pstream::subProcs())
|
||||
{
|
||||
IPstream fromSlave
|
||||
(
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -85,7 +85,7 @@ void Foam::functionObjects::dataCloud::writeListParallel
|
||||
Field<Type> recvField;
|
||||
|
||||
// Receive and write
|
||||
for (int slave=1; slave<Pstream::nProcs(); ++slave)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
IPstream fromSlave(Pstream::commsTypes::blocking, slave);
|
||||
|
||||
@ -142,7 +142,7 @@ void Foam::functionObjects::dataCloud::writeListParallel
|
||||
Field<Type> recvField;
|
||||
|
||||
// Receive and write
|
||||
for (int slave=1; slave<Pstream::nProcs(); ++slave)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
IPstream fromSlave(Pstream::commsTypes::blocking, slave);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user