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:
@ -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);
|
||||
|
||||
@ -148,12 +148,7 @@ int main(int argc, char *argv[])
|
||||
Pout<< "full: " << flatOutput(idl3.values()) << nl
|
||||
<< "send: " << flatOutput(idl3) << endl;
|
||||
|
||||
for
|
||||
(
|
||||
int proci = Pstream::firstSlave();
|
||||
proci <= Pstream::lastSlave();
|
||||
++proci
|
||||
)
|
||||
for (const int proci : Pstream::subProcs())
|
||||
{
|
||||
OPstream toSlave(Pstream::commsTypes::scheduled, proci);
|
||||
toSlave << idl3;
|
||||
|
||||
@ -57,12 +57,7 @@ scalar sumReduce
|
||||
// Add master value and all slaves
|
||||
sum = localValue;
|
||||
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave(comm);
|
||||
slave++
|
||||
)
|
||||
for (const int slave : UPstream::subProcs(comm))
|
||||
{
|
||||
scalar slaveValue;
|
||||
UIPstream::read
|
||||
@ -80,12 +75,7 @@ scalar sumReduce
|
||||
|
||||
// Send back to slaves
|
||||
|
||||
for
|
||||
(
|
||||
int slave=UPstream::firstSlave();
|
||||
slave<=UPstream::lastSlave(comm);
|
||||
slave++
|
||||
)
|
||||
for (const int slave : UPstream::subProcs(comm))
|
||||
{
|
||||
UOPstream::write
|
||||
(
|
||||
|
||||
@ -87,12 +87,7 @@ int main(int argc, char *argv[])
|
||||
// Collect my own data
|
||||
allData.append(data);
|
||||
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
slave++
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
Perr << "master receiving from slave " << slave << endl;
|
||||
UIPstream fromSlave(slave, pBufs);
|
||||
@ -105,12 +100,7 @@ int main(int argc, char *argv[])
|
||||
PstreamBuffers pBufs2(Pstream::commsTypes::nonBlocking);
|
||||
if (Pstream::master())
|
||||
{
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
slave++
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
Perr << "master sending to slave " << slave << endl;
|
||||
UOPstream toSlave(slave, pBufs2);
|
||||
|
||||
@ -154,12 +154,7 @@ void testTransfer(const T& input)
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
for
|
||||
(
|
||||
int slave = Pstream::firstSlave();
|
||||
slave <= Pstream::lastSlave();
|
||||
++slave
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
Perr<< "master receiving from slave " << slave << endl;
|
||||
IPstream fromSlave(Pstream::commsTypes::blocking, slave);
|
||||
@ -167,12 +162,7 @@ void testTransfer(const T& input)
|
||||
perrInfo(data) << endl;
|
||||
}
|
||||
|
||||
for
|
||||
(
|
||||
int slave = Pstream::firstSlave();
|
||||
slave <= Pstream::lastSlave();
|
||||
++slave
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
Perr<< "master sending to slave " << slave << endl;
|
||||
OPstream toSlave(Pstream::commsTypes::blocking, slave);
|
||||
@ -207,12 +197,7 @@ void testTokenized(const T& data)
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
for
|
||||
(
|
||||
int slave = Pstream::firstSlave();
|
||||
slave <= Pstream::lastSlave();
|
||||
++slave
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
Perr<< "master receiving from slave " << slave << endl;
|
||||
IPstream fromSlave(Pstream::commsTypes::blocking, slave);
|
||||
@ -220,12 +205,7 @@ void testTokenized(const T& data)
|
||||
Perr<< tok.info() << endl;
|
||||
}
|
||||
|
||||
for
|
||||
(
|
||||
int slave = Pstream::firstSlave();
|
||||
slave <= Pstream::lastSlave();
|
||||
++slave
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
Perr<< "master sending to slave " << slave << endl;
|
||||
OPstream toSlave(Pstream::commsTypes::blocking, slave);
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -445,7 +445,7 @@ void Foam::mergeAndWrite
|
||||
pOffset += myPoints.size();
|
||||
|
||||
// Receive slave ones
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -387,12 +387,7 @@ void getInterfaceSizes
|
||||
if (Pstream::master())
|
||||
{
|
||||
// Receive and add to my sizes
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
slave++
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
IPstream fromSlave(Pstream::commsTypes::blocking, slave);
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -124,12 +124,7 @@ Foam::autoPtr<Foam::fvMesh> Foam::loadOrCreateMesh
|
||||
);
|
||||
|
||||
// Send patches
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
slave++
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
OPstream toSlave(Pstream::commsTypes::scheduled, slave);
|
||||
toSlave << patchEntries;
|
||||
|
||||
@ -677,7 +677,7 @@ void readFields
|
||||
tmp<GeoField> tsubfld = subsetterPtr->interpolate(fields[i]);
|
||||
|
||||
// Send to all processors that don't have a mesh
|
||||
for (label procI = 1; procI < Pstream::nProcs(); ++procI)
|
||||
for (const int procI : Pstream::subProcs())
|
||||
{
|
||||
if (!haveMesh[procI])
|
||||
{
|
||||
|
||||
@ -340,12 +340,7 @@ bool Foam::decomposedBlockData::readBlocks
|
||||
}
|
||||
|
||||
// Read slave data
|
||||
for
|
||||
(
|
||||
label proci = 1;
|
||||
proci < UPstream::nProcs(comm);
|
||||
++proci
|
||||
)
|
||||
for (const int proci : UPstream::subProcs(comm))
|
||||
{
|
||||
List<char> elems(is);
|
||||
is.fatalCheck("read(Istream&) : reading entry");
|
||||
@ -397,12 +392,7 @@ bool Foam::decomposedBlockData::readBlocks
|
||||
}
|
||||
|
||||
// Read slave data
|
||||
for
|
||||
(
|
||||
label proci = 1;
|
||||
proci < UPstream::nProcs(comm);
|
||||
++proci
|
||||
)
|
||||
for (const int proci : UPstream::subProcs(comm))
|
||||
{
|
||||
List<char> elems(is);
|
||||
is.fatalCheck("read(Istream&) : reading entry");
|
||||
@ -474,12 +464,7 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlocks
|
||||
}
|
||||
|
||||
// Read slave data
|
||||
for
|
||||
(
|
||||
label proci = 1;
|
||||
proci < UPstream::nProcs(comm);
|
||||
++proci
|
||||
)
|
||||
for (const int proci : UPstream::subProcs(comm))
|
||||
{
|
||||
is >> data;
|
||||
is.fatalCheck("read(Istream&) : reading entry");
|
||||
@ -545,12 +530,7 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlocks
|
||||
}
|
||||
|
||||
// Read slave data
|
||||
for
|
||||
(
|
||||
label proci = 1;
|
||||
proci < UPstream::nProcs(comm);
|
||||
++proci
|
||||
)
|
||||
for (const int proci : UPstream::subProcs(comm))
|
||||
{
|
||||
List<char> elems(is);
|
||||
is.fatalCheck("read(Istream&) : reading entry");
|
||||
|
||||
@ -154,7 +154,7 @@ void Foam::masterOFstream::commit()
|
||||
*std::max_element(recvSizes.cbegin(), recvSizes.cend())
|
||||
);
|
||||
|
||||
for (label proci = 1; proci < Pstream::nProcs(); ++proci)
|
||||
for (const int proci : Pstream::subProcs())
|
||||
{
|
||||
UIPstream is(proci, pBufs);
|
||||
|
||||
|
||||
@ -374,7 +374,7 @@ public:
|
||||
static void addValidParOptions(HashTable<string>& validParOptions);
|
||||
|
||||
//- Initialisation function called from main
|
||||
// Spawns slave processes and initialises inter-communication
|
||||
// Spawns sub-processes and initialises inter-communication
|
||||
static bool init(int& argc, char**& argv, const bool needsThread);
|
||||
|
||||
//- Special purpose initialisation function.
|
||||
@ -459,18 +459,6 @@ public:
|
||||
return procIDs_[communicator];
|
||||
}
|
||||
|
||||
//- Process index of first slave
|
||||
static constexpr int firstSlave() noexcept
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
//- Process index of last slave
|
||||
static int lastSlave(const label communicator = 0)
|
||||
{
|
||||
return nProcs(communicator) - 1;
|
||||
}
|
||||
|
||||
//- Range of process indices for all processes
|
||||
static IntRange<int> allProcs(const label communicator = 0)
|
||||
{
|
||||
@ -478,6 +466,13 @@ public:
|
||||
return IntRange<int>(static_cast<int>(nProcs(communicator)));
|
||||
}
|
||||
|
||||
//- Range of process indices for sub-processes
|
||||
static IntRange<int> subProcs(const label communicator = 0)
|
||||
{
|
||||
// Proc 1 -> nProcs
|
||||
return IntRange<int>(1, static_cast<int>(nProcs(communicator)-1));
|
||||
}
|
||||
|
||||
//- Communication schedule for linear all-to-master (proc 0)
|
||||
static const List<commsStruct>& linearCommunication
|
||||
(
|
||||
@ -578,6 +573,23 @@ public:
|
||||
int recvSize,
|
||||
const label communicator = 0
|
||||
);
|
||||
|
||||
|
||||
// Housekeeping
|
||||
|
||||
//- Process index of first sub-process
|
||||
// \deprecated(2020-09) use subProcs() method instead
|
||||
static constexpr int firstSlave() noexcept
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
//- Process index of last sub-process
|
||||
// \deprecated(2020-09) use subProcs() method instead
|
||||
static int lastSlave(const label communicator = 0)
|
||||
{
|
||||
return nProcs(communicator) - 1;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -1105,12 +1105,7 @@ void Foam::argList::parse
|
||||
slaveProcs.resize(Pstream::nProcs()-1);
|
||||
slaveMachine.resize(Pstream::nProcs()-1);
|
||||
label proci = 0;
|
||||
for
|
||||
(
|
||||
int slave = Pstream::firstSlave();
|
||||
slave <= Pstream::lastSlave();
|
||||
slave++
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
|
||||
|
||||
@ -1119,7 +1114,7 @@ void Foam::argList::parse
|
||||
fromSlave >> slaveBuild >> slaveMachine[proci] >> slavePid;
|
||||
|
||||
slaveProcs[proci] = slaveMachine[proci] + "." + name(slavePid);
|
||||
proci++;
|
||||
++proci;
|
||||
|
||||
// Verify that all processors are running the same build
|
||||
if (slaveBuild != foamVersion::build)
|
||||
@ -1339,12 +1334,7 @@ void Foam::argList::parse
|
||||
|
||||
// Distribute the master's argument list (with new root)
|
||||
const bool hadCaseOpt = options_.found("case");
|
||||
for
|
||||
(
|
||||
int slave = Pstream::firstSlave();
|
||||
slave <= Pstream::lastSlave();
|
||||
slave++
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
options_.set("case", roots[slave-1]/globalCase_);
|
||||
|
||||
@ -1392,12 +1382,7 @@ void Foam::argList::parse
|
||||
}
|
||||
|
||||
// Distribute the master's argument list (unaltered)
|
||||
for
|
||||
(
|
||||
int slave = Pstream::firstSlave();
|
||||
slave <= Pstream::lastSlave();
|
||||
slave++
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
OPstream toSlave(Pstream::commsTypes::scheduled, slave);
|
||||
toSlave << args_ << options_ << roots.size();
|
||||
|
||||
@ -642,12 +642,7 @@ Foam::fileOperations::masterUncollatedFileOperation::read
|
||||
}
|
||||
|
||||
// Read slave files
|
||||
for
|
||||
(
|
||||
label proci = 1;
|
||||
proci < Pstream::nProcs(comm);
|
||||
proci++
|
||||
)
|
||||
for (const int proci : Pstream::subProcs(comm))
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
@ -2391,12 +2386,7 @@ Foam::fileOperations::masterUncollatedFileOperation::NewIFstream
|
||||
}
|
||||
else
|
||||
{
|
||||
for
|
||||
(
|
||||
label proci = 1;
|
||||
proci < Pstream::nProcs(Pstream::worldComm);
|
||||
proci++
|
||||
)
|
||||
for (const int proci : Pstream::subProcs(Pstream::worldComm))
|
||||
{
|
||||
readAndSend
|
||||
(
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2018 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -42,7 +43,7 @@ Type Foam::fileOperations::masterUncollatedFileOperation::scatterList
|
||||
PstreamBuffers pBufs(UPstream::commsTypes::nonBlocking, tag, comm);
|
||||
if (Pstream::master(comm))
|
||||
{
|
||||
for (label proci = 1; proci < Pstream::nProcs(comm); proci++)
|
||||
for (const int proci : Pstream::subProcs(comm))
|
||||
{
|
||||
UOPstream os(proci, pBufs);
|
||||
os << masterLst[proci];
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -85,12 +86,7 @@ Foam::LUscalarMatrix::LUscalarMatrix
|
||||
|
||||
if (Pstream::master(comm_))
|
||||
{
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave(comm_);
|
||||
slave++
|
||||
)
|
||||
for (const int slave : Pstream::subProcs(comm_))
|
||||
{
|
||||
lduMatrices.set
|
||||
(
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -54,12 +54,7 @@ void Foam::LUscalarMatrix::solve
|
||||
|
||||
SubList<Type>(X, x.size()) = x;
|
||||
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave(comm_);
|
||||
slave++
|
||||
)
|
||||
for (const int slave : Pstream::subProcs(comm_))
|
||||
{
|
||||
IPstream::read
|
||||
(
|
||||
@ -94,12 +89,7 @@ void Foam::LUscalarMatrix::solve
|
||||
|
||||
x = SubList<Type>(X, x.size());
|
||||
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave(comm_);
|
||||
slave++
|
||||
)
|
||||
for (const int slave : Pstream::subProcs(comm_))
|
||||
{
|
||||
OPstream::write
|
||||
(
|
||||
|
||||
@ -391,12 +391,7 @@ void Foam::globalMeshData::calcSharedEdges() const
|
||||
// Receive data from slaves and insert
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
slave++
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
// Receive the edges using shared points from the slave.
|
||||
IPstream fromSlave(Pstream::commsTypes::blocking, slave);
|
||||
@ -440,12 +435,7 @@ void Foam::globalMeshData::calcSharedEdges() const
|
||||
// Send back to slaves.
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
slave++
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
// Receive the edges using shared points from the slave.
|
||||
OPstream toSlave(Pstream::commsTypes::blocking, slave);
|
||||
@ -1907,12 +1897,7 @@ Foam::pointField Foam::globalMeshData::sharedPoints() const
|
||||
}
|
||||
|
||||
// Receive data from slaves and insert
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
slave++
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
IPstream fromSlave(Pstream::commsTypes::blocking, slave);
|
||||
|
||||
@ -1929,12 +1914,7 @@ Foam::pointField Foam::globalMeshData::sharedPoints() const
|
||||
}
|
||||
|
||||
// Send back
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
slave++
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
OPstream toSlave
|
||||
(
|
||||
|
||||
@ -80,12 +80,7 @@ Foam::List<Foam::labelPair> Foam::mapDistributeBase::schedule
|
||||
if (Pstream::master())
|
||||
{
|
||||
// Receive and merge
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
slave++
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
IPstream fromSlave(Pstream::commsTypes::scheduled, slave, 0, tag);
|
||||
List<labelPair> nbrData(fromSlave);
|
||||
@ -101,12 +96,7 @@ Foam::List<Foam::labelPair> Foam::mapDistributeBase::schedule
|
||||
}
|
||||
}
|
||||
// Send back
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
slave++
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
OPstream toSlave(Pstream::commsTypes::scheduled, slave, 0, tag);
|
||||
toSlave << allComms;
|
||||
|
||||
@ -1007,7 +1007,7 @@ bool Foam::polyBoundaryMesh::checkParallelSync(const bool report) const
|
||||
// Have every processor check but print error on master
|
||||
// (in processor sequence).
|
||||
|
||||
for (label proci = 1; proci < Pstream::nProcs(); ++proci)
|
||||
for (const int proci : Pstream::subProcs())
|
||||
{
|
||||
if
|
||||
(
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -291,12 +291,7 @@ void Foam::syncTools::syncPointMap
|
||||
if (Pstream::master())
|
||||
{
|
||||
// Receive the edges using shared points from the slave.
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
slave++
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
|
||||
Map<T> nbrValues(fromSlave);
|
||||
@ -315,12 +310,7 @@ void Foam::syncTools::syncPointMap
|
||||
}
|
||||
|
||||
// Send back
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
slave++
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
OPstream toSlave(Pstream::commsTypes::scheduled, slave);
|
||||
toSlave << sharedPointValues;
|
||||
@ -656,12 +646,7 @@ void Foam::syncTools::syncEdgeMap
|
||||
if (Pstream::master())
|
||||
{
|
||||
// Receive the edges using shared points from the slave.
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
slave++
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
|
||||
EdgeMap<T> nbrValues(fromSlave);
|
||||
@ -680,14 +665,8 @@ void Foam::syncTools::syncEdgeMap
|
||||
}
|
||||
|
||||
// Send back
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
slave++
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
|
||||
OPstream toSlave(Pstream::commsTypes::scheduled, slave);
|
||||
toSlave << sharedEdgeValues;
|
||||
}
|
||||
|
||||
@ -170,7 +170,7 @@ void Foam::PatchTools::gatherAndMerge
|
||||
|
||||
|
||||
// Receive slave ones
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
|
||||
|
||||
|
||||
@ -54,12 +54,7 @@ void Foam::allReduce
|
||||
{
|
||||
if (UPstream::master(communicator))
|
||||
{
|
||||
for
|
||||
(
|
||||
int proci=UPstream::firstSlave();
|
||||
proci<=UPstream::lastSlave(communicator);
|
||||
++proci
|
||||
)
|
||||
for (const int proci : UPstream::subProcs(communicator))
|
||||
{
|
||||
Type value;
|
||||
|
||||
@ -109,12 +104,7 @@ void Foam::allReduce
|
||||
|
||||
if (UPstream::master(communicator))
|
||||
{
|
||||
for
|
||||
(
|
||||
int proci=UPstream::firstSlave();
|
||||
proci<=UPstream::lastSlave(communicator);
|
||||
++proci
|
||||
)
|
||||
for (const int proci : UPstream::subProcs(communicator))
|
||||
{
|
||||
if
|
||||
(
|
||||
|
||||
@ -97,12 +97,7 @@ void Foam::vtk::patchWriter::write
|
||||
Field<Type> recv;
|
||||
|
||||
// Receive each patch field and write
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
++slave
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
IPstream fromSlave(Pstream::commsTypes::blocking, slave);
|
||||
|
||||
@ -214,12 +209,7 @@ void Foam::vtk::patchWriter::write
|
||||
Field<Type> recv;
|
||||
|
||||
// Receive each patch field and write
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
++slave
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
IPstream fromSlave(Pstream::commsTypes::blocking, slave);
|
||||
|
||||
@ -348,12 +338,7 @@ void Foam::vtk::patchWriter::write
|
||||
Field<Type> recv;
|
||||
|
||||
// Receive each patch field and write
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
++slave
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
IPstream fromSlave(Pstream::commsTypes::blocking, slave);
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -307,7 +307,7 @@ void Foam::fvMeshDistribute::getFieldNames
|
||||
Pstream::gatherList(allNames);
|
||||
Pstream::scatterList(allNames);
|
||||
|
||||
for (label proci = 1; proci < Pstream::nProcs(); proci++)
|
||||
for (const int proci : Pstream::subProcs())
|
||||
{
|
||||
if (allNames[proci] != allNames[0])
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -472,12 +472,7 @@ Foam::autoPtr<Foam::fvMesh> Foam::fvMeshTools::newMesh
|
||||
);
|
||||
|
||||
// Send patches
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
slave++
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
OPstream toSlave(Pstream::commsTypes::scheduled, slave);
|
||||
toSlave << patchEntries;
|
||||
|
||||
@ -290,11 +290,11 @@ void Foam::ensightOutput::writeFaceConnectivity
|
||||
|
||||
parallel = parallel && Pstream::parRun();
|
||||
|
||||
const labelRange senders =
|
||||
const IntRange<int> senders =
|
||||
(
|
||||
parallel
|
||||
? labelRange(1, Pstream::nProcs()-1)
|
||||
: labelRange()
|
||||
? Pstream::subProcs()
|
||||
: IntRange<int>()
|
||||
);
|
||||
|
||||
if (Pstream::master())
|
||||
@ -381,11 +381,11 @@ void Foam::ensightOutput::writeFaceConnectivity
|
||||
|
||||
parallel = parallel && Pstream::parRun();
|
||||
|
||||
const labelRange senders =
|
||||
const IntRange<int> senders =
|
||||
(
|
||||
parallel
|
||||
? labelRange(1, Pstream::nProcs()-1)
|
||||
: labelRange()
|
||||
? Pstream::subProcs()
|
||||
: IntRange<int>()
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -63,11 +63,11 @@ bool Foam::ensightOutput::Detail::writeCoordinates
|
||||
{
|
||||
parallel = parallel && Pstream::parRun();
|
||||
|
||||
const labelRange senders =
|
||||
const IntRange<int> senders =
|
||||
(
|
||||
parallel
|
||||
? labelRange(1, Pstream::nProcs()-1)
|
||||
: labelRange()
|
||||
? Pstream::subProcs()
|
||||
: IntRange<int>()
|
||||
);
|
||||
|
||||
|
||||
@ -130,11 +130,11 @@ bool Foam::ensightOutput::Detail::writeFieldComponents
|
||||
{
|
||||
parallel = parallel && Pstream::parRun();
|
||||
|
||||
const labelRange senders =
|
||||
const IntRange<int> senders =
|
||||
(
|
||||
parallel
|
||||
? labelRange(1, Pstream::nProcs()-1)
|
||||
: labelRange()
|
||||
? Pstream::subProcs()
|
||||
: IntRange<int>()
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -52,11 +52,11 @@ void Foam::ensightCells::writePolysConnectivity
|
||||
return;
|
||||
}
|
||||
|
||||
const labelRange senders =
|
||||
const IntRange<int> senders =
|
||||
(
|
||||
parallel
|
||||
? labelRange(1, Pstream::nProcs()-1)
|
||||
: labelRange()
|
||||
? Pstream::subProcs()
|
||||
: IntRange<int>()
|
||||
);
|
||||
|
||||
|
||||
@ -213,11 +213,11 @@ void Foam::ensightCells::writeShapeConnectivity
|
||||
}
|
||||
|
||||
|
||||
const labelRange senders =
|
||||
const IntRange<int> senders =
|
||||
(
|
||||
parallel
|
||||
? labelRange(1, Pstream::nProcs()-1)
|
||||
: labelRange()
|
||||
? Pstream::subProcs()
|
||||
: IntRange<int>()
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -135,12 +135,7 @@ void Foam::vtk::writeListParallel
|
||||
List<uint8_t> recv;
|
||||
|
||||
// Receive and write
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
++slave
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
IPstream fromSlave(Pstream::commsTypes::blocking, slave);
|
||||
|
||||
@ -183,12 +178,7 @@ void Foam::vtk::writeListParallel
|
||||
labelList recv;
|
||||
|
||||
// Receive and write
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
++slave
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
IPstream fromSlave(Pstream::commsTypes::blocking, slave);
|
||||
|
||||
@ -219,7 +209,6 @@ void Foam::vtk::writeListParallel
|
||||
|
||||
// * * * * * * * * * * * * * * Legacy Functions * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
void Foam::vtk::legacy::fileHeader
|
||||
(
|
||||
std::ostream& os,
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -136,12 +136,7 @@ void Foam::vtk::writeListParallel
|
||||
List<Type> recv;
|
||||
|
||||
// Receive and write
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
++slave
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
IPstream fromSlave(Pstream::commsTypes::blocking, slave);
|
||||
|
||||
@ -179,12 +174,7 @@ void Foam::vtk::writeListParallel
|
||||
List<Type> recv;
|
||||
|
||||
// Receive and write
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
++slave
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
IPstream fromSlave(Pstream::commsTypes::blocking, slave);
|
||||
|
||||
@ -222,12 +212,7 @@ void Foam::vtk::writeListParallel
|
||||
List<Type> recv;
|
||||
|
||||
// Receive and write
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
++slave
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
IPstream fromSlave(Pstream::commsTypes::blocking, slave);
|
||||
|
||||
@ -266,12 +251,7 @@ void Foam::vtk::writeListsParallel
|
||||
List<Type> recv1, recv2;
|
||||
|
||||
// Receive and write
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
++slave
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
IPstream fromSlave(Pstream::commsTypes::blocking, slave);
|
||||
|
||||
@ -310,14 +290,9 @@ void Foam::vtk::writeListsParallel
|
||||
vtk::writeList(fmt, values2, addressing);
|
||||
|
||||
List<Type> recv1, recv2;
|
||||
;
|
||||
|
||||
// Receive and write
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
++slave
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
IPstream fromSlave(Pstream::commsTypes::blocking, slave);
|
||||
|
||||
|
||||
@ -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.
|
||||
@ -104,12 +104,7 @@ void Foam::vtk::surfaceWriter::writePoints()
|
||||
pointField recv;
|
||||
|
||||
// Receive each point field and write
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
++slave
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
IPstream fromSlave(Pstream::commsTypes::blocking, slave);
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -132,7 +132,7 @@ bool Foam::ensightOutput::writeCloudPositions
|
||||
writeMeasured(os, positions);
|
||||
|
||||
// Slaves
|
||||
for (int slave=1; slave<Pstream::nProcs(); ++slave)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
IPstream fromSlave(comm, slave);
|
||||
pointField recv(fromSlave);
|
||||
@ -149,7 +149,7 @@ bool Foam::ensightOutput::writeCloudPositions
|
||||
parcelId = writeMeasured(os, parcelId, positions);
|
||||
|
||||
// Slaves
|
||||
for (int slave=1; slave<Pstream::nProcs(); ++slave)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
IPstream fromSlave(comm, slave);
|
||||
pointField recv(fromSlave);
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -71,7 +71,7 @@ bool Foam::ensightOutput::writeCloudField
|
||||
}
|
||||
|
||||
// Slaves
|
||||
for (int slave=1; slave<Pstream::nProcs(); ++slave)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
IPstream fromSlave(comm, slave);
|
||||
Field<Type> recv(fromSlave);
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -104,12 +104,7 @@ void Foam::vtk::indirectPatchWriter::writePoints()
|
||||
pointField recv;
|
||||
|
||||
// Receive each point field and write
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
++slave
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
IPstream fromSlave(Pstream::commsTypes::blocking, slave);
|
||||
|
||||
|
||||
@ -125,12 +125,7 @@ void Foam::vtk::patchMeshWriter::writePoints()
|
||||
pointField recv;
|
||||
|
||||
// Receive each point field and write
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
++slave
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
IPstream fromSlave(Pstream::commsTypes::blocking, slave);
|
||||
|
||||
@ -584,12 +579,7 @@ void Foam::vtk::patchMeshWriter::writePatchIDs()
|
||||
labelList recv;
|
||||
|
||||
// Receive each pair
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
++slave
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
IPstream fromSlave(Pstream::commsTypes::blocking, slave);
|
||||
|
||||
@ -793,12 +783,7 @@ bool Foam::vtk::patchMeshWriter::writeNeighIDs()
|
||||
labelList recv;
|
||||
|
||||
// Receive each pair
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
++slave
|
||||
)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
IPstream fromSlave(Pstream::commsTypes::blocking, slave);
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -78,7 +78,7 @@ Foam::label Foam::metisLikeDecomp::decomposeGeneral
|
||||
allAdjncy[nTotalConnections++] = adjncy[i];
|
||||
}
|
||||
|
||||
for (int slave=1; slave<Pstream::nProcs(); ++slave)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
|
||||
List<label> nbrAdjncy(fromSlave);
|
||||
@ -110,7 +110,7 @@ Foam::label Foam::metisLikeDecomp::decomposeGeneral
|
||||
|
||||
|
||||
// Send allFinalDecomp back
|
||||
for (int slave=1; slave<Pstream::nProcs(); ++slave)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
OPstream toSlave(Pstream::commsTypes::scheduled, slave);
|
||||
toSlave << SubList<label>
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -350,7 +350,7 @@ Foam::labelList Foam::simpleGeomDecomp::decompose
|
||||
nTotalPoints += points.size();
|
||||
|
||||
// Add slaves
|
||||
for (int slave=1; slave<Pstream::nProcs(); ++slave)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
|
||||
pointField nbrPoints(fromSlave);
|
||||
@ -367,7 +367,7 @@ Foam::labelList Foam::simpleGeomDecomp::decompose
|
||||
labelList finalDecomp(decomposeOneProc(allPoints));
|
||||
|
||||
// Send back
|
||||
for (int slave=1; slave<Pstream::nProcs(); ++slave)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
OPstream toSlave(Pstream::commsTypes::scheduled, slave);
|
||||
toSlave << SubField<label>
|
||||
@ -435,7 +435,7 @@ Foam::labelList Foam::simpleGeomDecomp::decompose
|
||||
nTotalPoints += points.size();
|
||||
|
||||
// Add slaves
|
||||
for (int slave=1; slave<Pstream::nProcs(); ++slave)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
|
||||
pointField nbrPoints(fromSlave);
|
||||
@ -459,7 +459,7 @@ Foam::labelList Foam::simpleGeomDecomp::decompose
|
||||
labelList finalDecomp(decomposeOneProc(allPoints, allWeights));
|
||||
|
||||
// Send back
|
||||
for (int slave=1; slave<Pstream::nProcs(); ++slave)
|
||||
for (const int slave : Pstream::subProcs())
|
||||
{
|
||||
OPstream toSlave(Pstream::commsTypes::scheduled, slave);
|
||||
toSlave << SubField<label>
|
||||
|
||||
@ -1655,7 +1655,7 @@ Foam::distributedTriSurfaceMesh::independentlyDistributedBbs
|
||||
bool masterOnly;
|
||||
{
|
||||
masterOnly = true;
|
||||
for (label proci = 1; proci < Pstream::nProcs(); proci++)
|
||||
for (const int proci : Pstream::subProcs())
|
||||
{
|
||||
if (triIndexer.localSize(proci) != 0)
|
||||
{
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -267,7 +267,7 @@ Foam::scalar surfaceNoise::writeSurfaceData
|
||||
allData[faceI] = data[faceI];
|
||||
}
|
||||
|
||||
for (label procI = 1; procI < Pstream::nProcs(); ++procI)
|
||||
for (const int procI : Pstream::subProcs())
|
||||
{
|
||||
UIPstream fromProc(procI, pBufs);
|
||||
scalarList dataSlice(fromProc);
|
||||
@ -370,7 +370,7 @@ Foam::scalar surfaceNoise::surfaceAverage
|
||||
allData[faceI] = data[faceI];
|
||||
}
|
||||
|
||||
for (label procI = 1; procI < Pstream::nProcs(); procI++)
|
||||
for (const int procI : Pstream::subProcs())
|
||||
{
|
||||
UIPstream fromProc(procI, pBufs);
|
||||
scalarList dataSlice(fromProc);
|
||||
|
||||
Reference in New Issue
Block a user