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:
@ -58,24 +58,14 @@ Gather<T0>::Gather(const T0& localData, const bool redistribute)
|
||||
*outIter = localData;
|
||||
|
||||
// Receive data
|
||||
for
|
||||
(
|
||||
int proci = Pstream::firstSlave();
|
||||
proci <= Pstream::lastSlave();
|
||||
++proci
|
||||
)
|
||||
for (const int proci : Pstream::subProcs())
|
||||
{
|
||||
IPstream fromSlave(Pstream::commsTypes::scheduled, proci);
|
||||
fromSlave >> *(++outIter);
|
||||
}
|
||||
|
||||
// Send data
|
||||
for
|
||||
(
|
||||
int proci = Pstream::firstSlave();
|
||||
proci <= Pstream::lastSlave();
|
||||
++proci
|
||||
)
|
||||
for (const int proci : Pstream::subProcs())
|
||||
{
|
||||
OPstream toSlave(Pstream::commsTypes::scheduled, proci);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user