mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
@ -707,7 +707,7 @@ void Foam::radiation::laserDTRM::calculate()
|
||||
Pstream::gatherList(p0);
|
||||
Pstream::scatterList(p0);
|
||||
|
||||
for (label proci = 0; proci < Pstream::nProcs(); ++proci)
|
||||
for (const int proci : Pstream::allProcs())
|
||||
{
|
||||
const pointField& pos = positions[proci];
|
||||
const pointField& pfinal = p0[proci];
|
||||
|
||||
@ -50,7 +50,6 @@ using namespace Foam;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
@ -154,7 +153,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
|
||||
|
||||
for (label proci = 0; proci < Pstream::nProcs(); proci++)
|
||||
for (const int proci : Pstream::allProcs())
|
||||
{
|
||||
UOPstream toProc(proci, pBufs);
|
||||
toProc << Pstream::myProcNo();
|
||||
@ -164,7 +163,7 @@ int main(int argc, char *argv[])
|
||||
pBufs.finishedSends();
|
||||
|
||||
// Consume
|
||||
for (label proci = 0; proci < Pstream::nProcs(); proci++)
|
||||
for (const int proci : Pstream::allProcs())
|
||||
{
|
||||
UIPstream fromProc(proci, pBufs);
|
||||
label data;
|
||||
|
||||
@ -489,7 +489,7 @@ Foam::label Foam::DistributedDelaunayMesh<Triangulation>::referVertices
|
||||
|
||||
pointMap.distribute(parallelVertices);
|
||||
|
||||
for (label proci = 0; proci < Pstream::nProcs(); proci++)
|
||||
for (const int proci : Pstream::allProcs())
|
||||
{
|
||||
const labelList& constructMap = pointMap.constructMap()[proci];
|
||||
|
||||
|
||||
@ -473,7 +473,7 @@ void Foam::backgroundMeshDecomposition::printMeshData
|
||||
|
||||
// globalIndex globalBoundaryFaces(mesh.nBoundaryFaces());
|
||||
|
||||
for (label proci = 0; proci < Pstream::nProcs(); proci++)
|
||||
for (const int proci : Pstream::allProcs())
|
||||
{
|
||||
Info<< "Processor " << proci << " "
|
||||
<< "Number of cells = " << globalCells.localSize(proci)
|
||||
|
||||
@ -703,7 +703,7 @@ Foam::label Foam::conformalVoronoiMesh::synchroniseSurfaceTrees
|
||||
label nStoppedInsertion = 0;
|
||||
|
||||
// Do the nearness tests here
|
||||
for (label proci = 0; proci < Pstream::nProcs(); ++proci)
|
||||
for (const int proci : Pstream::allProcs())
|
||||
{
|
||||
// Skip own points
|
||||
if (proci >= Pstream::myProcNo())
|
||||
@ -795,7 +795,7 @@ Foam::label Foam::conformalVoronoiMesh::synchroniseEdgeTrees
|
||||
label nStoppedInsertion = 0;
|
||||
|
||||
// Do the nearness tests here
|
||||
for (label proci = 0; proci < Pstream::nProcs(); ++proci)
|
||||
for (const int proci : Pstream::allProcs())
|
||||
{
|
||||
// Skip own points
|
||||
if (proci >= Pstream::myProcNo())
|
||||
|
||||
@ -130,7 +130,7 @@ void printMeshData(const polyMesh& mesh)
|
||||
label totProcPatches = 0;
|
||||
label maxProcFaces = 0;
|
||||
|
||||
for (label proci = 0; proci < Pstream::nProcs(); proci++)
|
||||
for (const int proci : Pstream::allProcs())
|
||||
{
|
||||
Info<< endl
|
||||
<< "Processor " << proci << nl
|
||||
|
||||
@ -185,7 +185,7 @@ void printMeshData(const polyMesh& mesh)
|
||||
label totProcPatches = 0;
|
||||
label maxProcFaces = 0;
|
||||
|
||||
for (label procI = 0; procI < Pstream::nProcs(); ++procI)
|
||||
for (const int procI : Pstream::allProcs())
|
||||
{
|
||||
Info<< nl
|
||||
<< "Processor " << procI << nl
|
||||
|
||||
@ -7,7 +7,7 @@ const label maxDynListLength
|
||||
viewFactorDict.getOrDefault<label>("maxDynListLength", 100000)
|
||||
);
|
||||
|
||||
for (label proci = 0; proci < Pstream::nProcs(); proci++)
|
||||
for (const int proci : Pstream::allProcs())
|
||||
{
|
||||
// Shoot rays from me to proci. Note that even if processor has
|
||||
// 0 faces we still need to call findLine to keep calls synced.
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -285,7 +286,7 @@ void Foam::ParSortableList<Type>::sort()
|
||||
|
||||
label combinedI = 0;
|
||||
|
||||
for (label proci = 0; proci < Pstream::nProcs(); proci++)
|
||||
for (const int proci : Pstream::allProcs())
|
||||
{
|
||||
if (proci == Pstream::myProcNo())
|
||||
{
|
||||
|
||||
@ -39,7 +39,7 @@ Description
|
||||
\code
|
||||
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
|
||||
|
||||
for (label proci = 0; proci < Pstream::nProcs(); ++proci)
|
||||
for (const int proci : Pstream::allProcs())
|
||||
{
|
||||
if (proci != Pstream::myProcNo())
|
||||
{
|
||||
@ -52,7 +52,7 @@ Description
|
||||
|
||||
pBufs.finishedSends(); // no-op for blocking
|
||||
|
||||
for (label proci = 0; proci < Pstream::nProcs(); ++proci)
|
||||
for (const int proci : Pstream::allProcs())
|
||||
{
|
||||
if (proci != Pstream::myProcNo())
|
||||
{
|
||||
@ -62,7 +62,6 @@ Description
|
||||
}
|
||||
\endcode
|
||||
|
||||
|
||||
SourceFiles
|
||||
PstreamBuffers.C
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ public:
|
||||
static const Enum<commsTypes> commsTypeNames;
|
||||
|
||||
|
||||
// Public classes
|
||||
// Public Classes
|
||||
|
||||
//- Structure for communicating between processors
|
||||
class commsStruct
|
||||
@ -180,7 +180,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
// Private data
|
||||
// Private Data
|
||||
|
||||
//- By default this is not a parallel run
|
||||
static bool parRun_;
|
||||
@ -248,7 +248,7 @@ private:
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
// Protected Data
|
||||
|
||||
//- Communications type of this stream
|
||||
commsTypes commsType_;
|
||||
@ -298,7 +298,7 @@ public:
|
||||
{}
|
||||
|
||||
|
||||
// Member functions
|
||||
// Member Functions
|
||||
|
||||
//- Allocate a new communicator
|
||||
static label allocateCommunicator
|
||||
@ -424,7 +424,7 @@ public:
|
||||
return haveThreads_;
|
||||
}
|
||||
|
||||
//- Number of processes in parallel run
|
||||
//- Number of processes in parallel run, and 1 for serial run
|
||||
static label nProcs(const label communicator = 0)
|
||||
{
|
||||
return procIDs_[communicator].size();
|
||||
@ -471,6 +471,13 @@ public:
|
||||
return nProcs(communicator) - 1;
|
||||
}
|
||||
|
||||
//- Range of process indices for all processes
|
||||
static IntRange<int> allProcs(const label communicator = 0)
|
||||
{
|
||||
// Proc 0 -> nProcs
|
||||
return IntRange<int>(static_cast<int>(nProcs(communicator)));
|
||||
}
|
||||
|
||||
//- Communication schedule for linear all-to-master (proc 0)
|
||||
static const List<commsStruct>& linearCommunication
|
||||
(
|
||||
|
||||
@ -598,12 +598,7 @@ Foam::fileOperations::masterUncollatedFileOperation::read
|
||||
}
|
||||
|
||||
DynamicList<label> validProcs(Pstream::nProcs(comm));
|
||||
for
|
||||
(
|
||||
label proci = 0;
|
||||
proci < Pstream::nProcs(comm);
|
||||
proci++
|
||||
)
|
||||
for (const int proci : Pstream::allProcs(comm))
|
||||
{
|
||||
if (procValid[proci])
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -119,7 +119,7 @@ void Foam::globalIndex::reset
|
||||
|
||||
label offset = 0;
|
||||
offsets_[0] = 0;
|
||||
for (label proci = 0; proci < Pstream::nProcs(comm); ++proci)
|
||||
for (const int proci : Pstream::allProcs(comm))
|
||||
{
|
||||
const label oldOffset = offset;
|
||||
offset += localSizes[proci];
|
||||
|
||||
@ -898,7 +898,7 @@ void Foam::mapDistributeBase::compact(const boolList& elemIsUsed, const int tag)
|
||||
|
||||
List<boolList> recvFields(Pstream::nProcs());
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
const labelList& map = subMap_[domain];
|
||||
|
||||
@ -919,7 +919,7 @@ void Foam::mapDistributeBase::compact(const boolList& elemIsUsed, const int tag)
|
||||
|
||||
List<boolList> sendFields(Pstream::nProcs());
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
const labelList& map = constructMap_[domain];
|
||||
|
||||
@ -976,7 +976,7 @@ void Foam::mapDistributeBase::compact(const boolList& elemIsUsed, const int tag)
|
||||
|
||||
|
||||
// Compact out all submap entries that are referring to unused elements
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
const labelList& map = subMap_[domain];
|
||||
|
||||
@ -1005,7 +1005,7 @@ void Foam::mapDistributeBase::compact(const boolList& elemIsUsed, const int tag)
|
||||
|
||||
label maxConstructIndex = -1;
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
const labelList& map = constructMap_[domain];
|
||||
|
||||
@ -1065,7 +1065,7 @@ void Foam::mapDistributeBase::compact
|
||||
|
||||
List<boolList> recvFields(Pstream::nProcs());
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
const labelList& map = subMap_[domain];
|
||||
|
||||
@ -1086,7 +1086,7 @@ void Foam::mapDistributeBase::compact
|
||||
|
||||
List<boolList> sendFields(Pstream::nProcs());
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
const labelList& map = constructMap_[domain];
|
||||
|
||||
@ -1148,7 +1148,7 @@ void Foam::mapDistributeBase::compact
|
||||
|
||||
boolList sendElemIsUsed(localSize, false);
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
const labelList& map = subMap_[domain];
|
||||
forAll(map, i)
|
||||
@ -1177,7 +1177,7 @@ void Foam::mapDistributeBase::compact
|
||||
|
||||
|
||||
// Compact out all submap entries that are referring to unused elements
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
const labelList& map = subMap_[domain];
|
||||
|
||||
@ -1227,7 +1227,7 @@ void Foam::mapDistributeBase::compact
|
||||
}
|
||||
}
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
const labelList& map = constructMap_[domain];
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2016, 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -168,7 +168,7 @@ void Foam::mapDistributeBase::distribute
|
||||
// received data.
|
||||
|
||||
// Send sub field to neighbour
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
const labelList& map = subMap[domain];
|
||||
|
||||
@ -216,7 +216,7 @@ void Foam::mapDistributeBase::distribute
|
||||
);
|
||||
|
||||
// Receive sub field from neighbour
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
const labelList& map = constructMap[domain];
|
||||
|
||||
@ -398,7 +398,7 @@ void Foam::mapDistributeBase::distribute
|
||||
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking, tag);
|
||||
|
||||
// Stream data into buffer
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
const labelList& map = subMap[domain];
|
||||
|
||||
@ -461,7 +461,7 @@ void Foam::mapDistributeBase::distribute
|
||||
Pstream::waitRequests(nOutstanding);
|
||||
|
||||
// Consume
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
const labelList& map = constructMap[domain];
|
||||
|
||||
@ -490,7 +490,7 @@ void Foam::mapDistributeBase::distribute
|
||||
|
||||
List<List<T>> sendFields(Pstream::nProcs());
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
const labelList& map = subMap[domain];
|
||||
|
||||
@ -524,7 +524,7 @@ void Foam::mapDistributeBase::distribute
|
||||
|
||||
List<List<T>> recvFields(Pstream::nProcs());
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
const labelList& map = constructMap[domain];
|
||||
|
||||
@ -592,7 +592,7 @@ void Foam::mapDistributeBase::distribute
|
||||
|
||||
// Collect neighbour fields
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
const labelList& map = constructMap[domain];
|
||||
|
||||
@ -671,7 +671,7 @@ void Foam::mapDistributeBase::distribute
|
||||
// received data.
|
||||
|
||||
// Send sub field to neighbour
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
const labelList& map = subMap[domain];
|
||||
|
||||
@ -711,7 +711,7 @@ void Foam::mapDistributeBase::distribute
|
||||
flipAndCombine(map, constructHasFlip, subField, cop, negOp, field);
|
||||
|
||||
// Receive sub field from neighbour
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
const labelList& map = constructMap[domain];
|
||||
|
||||
@ -896,7 +896,7 @@ void Foam::mapDistributeBase::distribute
|
||||
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking, tag);
|
||||
|
||||
// Stream data into buffer
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
const labelList& map = subMap[domain];
|
||||
|
||||
@ -962,7 +962,7 @@ void Foam::mapDistributeBase::distribute
|
||||
Pstream::waitRequests(nOutstanding);
|
||||
|
||||
// Consume
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
const labelList& map = constructMap[domain];
|
||||
|
||||
@ -991,7 +991,7 @@ void Foam::mapDistributeBase::distribute
|
||||
|
||||
List<List<T>> sendFields(Pstream::nProcs());
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
const labelList& map = subMap[domain];
|
||||
|
||||
@ -1025,7 +1025,7 @@ void Foam::mapDistributeBase::distribute
|
||||
|
||||
List<List<T>> recvFields(Pstream::nProcs());
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
const labelList& map = constructMap[domain];
|
||||
|
||||
@ -1092,7 +1092,7 @@ void Foam::mapDistributeBase::distribute
|
||||
|
||||
// Collect neighbour fields
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
const labelList& map = constructMap[domain];
|
||||
|
||||
@ -1129,7 +1129,7 @@ void Foam::mapDistributeBase::send(PstreamBuffers& pBufs, const List<T>& field)
|
||||
const
|
||||
{
|
||||
// Stream data into buffer
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
const labelList& map = subMap_[domain];
|
||||
|
||||
@ -1165,7 +1165,7 @@ const
|
||||
// Consume
|
||||
field.setSize(constructSize_);
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
const labelList& map = constructMap_[domain];
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -692,7 +692,7 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::calcOverlappingProcEddies
|
||||
|
||||
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
const labelList& sendElems = map.subMap()[domain];
|
||||
|
||||
@ -710,7 +710,7 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::calcOverlappingProcEddies
|
||||
pBufs.finishedSends();
|
||||
|
||||
// Consume
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
const labelList& recvElems = map.constructMap()[domain];
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2020 DLR
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -162,7 +163,7 @@ void Foam::zoneDistribute::setUpCommforZone
|
||||
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
|
||||
|
||||
// Stream data into buffer
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
if (domain != Pstream::myProcNo())
|
||||
{
|
||||
@ -176,7 +177,7 @@ void Foam::zoneDistribute::setUpCommforZone
|
||||
// wait until everything is written.
|
||||
pBufs.finishedSends();
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
send_[domain].clear();
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019-2020 DLR
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -184,7 +185,7 @@ Foam::Map<Type> Foam::zoneDistribute::getDatafromOtherProc
|
||||
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
|
||||
|
||||
// Stream data into buffer
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
if (domain != Pstream::myProcNo())
|
||||
{
|
||||
@ -200,7 +201,7 @@ Foam::Map<Type> Foam::zoneDistribute::getDatafromOtherProc
|
||||
|
||||
Map<Type> tmpValue;
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
if (domain != Pstream::myProcNo())
|
||||
{
|
||||
|
||||
@ -293,9 +293,9 @@ void Foam::functionObjects::STDMD::calcAp()
|
||||
Log<< tab << "# " << name()
|
||||
<< ": Populating the global Rx #" << endl;
|
||||
label m = 0;
|
||||
for (label i = 0; i < Pstream::nProcs(); ++i)
|
||||
for (const int i : Pstream::allProcs())
|
||||
{
|
||||
label mRows = RxList[i].m();
|
||||
const label mRows = RxList[i].m();
|
||||
|
||||
Rx.subMatrix(m, 0, mRows) = RxList[i];
|
||||
|
||||
|
||||
@ -117,7 +117,7 @@ void Foam::functionObjects::externalCoupled::readColumns
|
||||
|
||||
// Read data from file and send to destination processor
|
||||
|
||||
for (label proci = 0; proci < Pstream::nProcs(); ++proci)
|
||||
for (const int proci : Pstream::allProcs())
|
||||
{
|
||||
// Temporary storage
|
||||
List<scalarField> values(nColumns);
|
||||
@ -188,7 +188,7 @@ void Foam::functionObjects::externalCoupled::readLines
|
||||
|
||||
// Read line from file and send to destination processor
|
||||
|
||||
for (label proci = 0; proci < Pstream::nProcs(); ++proci)
|
||||
for (const int proci : Pstream::allProcs())
|
||||
{
|
||||
// Number of rows to read for processor proci
|
||||
const label procNRows = globalFaces.localSize(proci);
|
||||
@ -314,7 +314,7 @@ void Foam::functionObjects::externalCoupled::writeGeometry
|
||||
allPoints.clear();
|
||||
allFaces.clear();
|
||||
|
||||
for (label proci=0; proci < Pstream::nProcs(); ++proci)
|
||||
for (const int proci : Pstream::allProcs())
|
||||
{
|
||||
allPoints.append(collectedPoints[proci]);
|
||||
allFaces.append(collectedFaces[proci]);
|
||||
|
||||
@ -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.
|
||||
@ -235,7 +235,7 @@ bool Foam::functionObjects::energySpectrum::write()
|
||||
vectorField Uijk(nGlobalCells);
|
||||
vectorField Cijk(nGlobalCells);
|
||||
|
||||
for (label proci = 0; proci < Pstream::nProcs(); ++proci)
|
||||
for (const int proci : Pstream::allProcs())
|
||||
{
|
||||
UIPstream fromProc(proci, pBufs);
|
||||
vectorField Up;
|
||||
|
||||
@ -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.
|
||||
@ -1172,7 +1172,7 @@ void Foam::InteractionLists<ParticleType>::sendReferredData
|
||||
|
||||
prepareParticlesToRefer(cellOccupancy);
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
const labelList& subMap = cellMap().subMap()[domain];
|
||||
|
||||
@ -1211,7 +1211,7 @@ void Foam::InteractionLists<ParticleType>::receiveReferredData
|
||||
|
||||
referredParticles_.setSize(cellMap().constructSize());
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
const labelList& constructMap = cellMap().constructMap()[domain];
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -133,7 +133,7 @@ inline Foam::scalar Foam::SprayCloud<CloudType>::penetration
|
||||
// flatten the mass lists
|
||||
List<scalar> allMass(nParcelSum, Zero);
|
||||
SortableList<scalar> allDist(nParcelSum, Zero);
|
||||
for (label proci = 0; proci < Pstream::nProcs(); proci++)
|
||||
for (const int proci : Pstream::allProcs())
|
||||
{
|
||||
SubList<scalar>
|
||||
(
|
||||
|
||||
@ -2494,7 +2494,7 @@ Foam::meshRefinement::balanceAndRefine
|
||||
// globalIndex globalCells(mesh_.nCells());
|
||||
//
|
||||
// Info<< "** Distribution before balancing/refining:" << endl;
|
||||
// for (label procI = 0; procI < Pstream::nProcs(); procI++)
|
||||
// for (const int procI : Pstream::allProcs())
|
||||
// {
|
||||
// Info<< " " << procI << '\t'
|
||||
// << globalCells.localSize(procI) << endl;
|
||||
@ -2505,7 +2505,7 @@ Foam::meshRefinement::balanceAndRefine
|
||||
// globalIndex globalCells(cellsToRefine.size());
|
||||
//
|
||||
// Info<< "** Cells to be refined:" << endl;
|
||||
// for (label procI = 0; procI < Pstream::nProcs(); procI++)
|
||||
// for (const int procI : Pstream::allProcs())
|
||||
// {
|
||||
// Info<< " " << procI << '\t'
|
||||
// << globalCells.localSize(procI) << endl;
|
||||
@ -2567,7 +2567,7 @@ Foam::meshRefinement::balanceAndRefine
|
||||
// globalIndex globalCells(mesh_.nCells());
|
||||
//
|
||||
// Info<< "** Distribution after balancing:" << endl;
|
||||
// for (label procI = 0; procI < Pstream::nProcs(); procI++)
|
||||
// for (const int procI : Pstream::allProcs())
|
||||
// {
|
||||
// Info<< " " << procI << '\t'
|
||||
// << globalCells.localSize(procI) << endl;
|
||||
@ -2625,7 +2625,7 @@ Foam::meshRefinement::balanceAndRefine
|
||||
// globalIndex globalCells(mesh_.nCells());
|
||||
//
|
||||
// Info<< "** After refinement distribution:" << endl;
|
||||
// for (label procI = 0; procI < Pstream::nProcs(); procI++)
|
||||
// for (const int procI : Pstream::allProcs())
|
||||
// {
|
||||
// Info<< " " << procI << '\t'
|
||||
// << globalCells.localSize(procI) << endl;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -76,7 +76,7 @@ void Foam::advancingFrontAMI::distributePatches
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); ++domain)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
const labelList& sendElems = map.subMap()[domain];
|
||||
|
||||
@ -132,7 +132,7 @@ void Foam::advancingFrontAMI::distributePatches
|
||||
}
|
||||
|
||||
// Consume
|
||||
for (label domain = 0; domain < Pstream::nProcs(); ++domain)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
const labelList& recvElems = map.constructMap()[domain];
|
||||
|
||||
|
||||
@ -712,7 +712,7 @@ bool Foam::vtk::internalMeshWriter::writeProcIDs()
|
||||
}
|
||||
|
||||
// Per-processor ids
|
||||
for (label proci=0; proci < Pstream::nProcs(); ++proci)
|
||||
for (const int proci : Pstream::allProcs())
|
||||
{
|
||||
vtk::write(format(), proci, procMaps.localSize(proci));
|
||||
}
|
||||
|
||||
@ -697,7 +697,7 @@ bool Foam::vtk::patchMeshWriter::writeProcIDs()
|
||||
if (Pstream::master())
|
||||
{
|
||||
// Per-processor ids
|
||||
for (label proci=0; proci < Pstream::nProcs(); ++proci)
|
||||
for (const int proci : Pstream::allProcs())
|
||||
{
|
||||
vtk::write(format(), proci, procSizes.localSize(proci));
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -61,7 +61,7 @@ void Foam::processorLODs::box::writeBoxes
|
||||
);
|
||||
|
||||
label verti = 0;
|
||||
for (label proci = 0; proci < Pstream::nProcs(); ++proci)
|
||||
for (const int proci : Pstream::allProcs())
|
||||
{
|
||||
if (proci == Pstream::myProcNo())
|
||||
{
|
||||
@ -111,7 +111,7 @@ void Foam::processorLODs::box::setRefineFlags
|
||||
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
|
||||
|
||||
// Identify src boxes that can be refined and send to all remote procs
|
||||
for (label proci = 0; proci < Pstream::nProcs(); ++proci)
|
||||
for (const int proci : Pstream::allProcs())
|
||||
{
|
||||
if (proci != Pstream::myProcNo())
|
||||
{
|
||||
@ -124,7 +124,7 @@ void Foam::processorLODs::box::setRefineFlags
|
||||
|
||||
// Test each remote src bb with local tgt objects to identify which remote
|
||||
// src boxes can/should be refined
|
||||
for (label proci = 0; proci < Pstream::nProcs(); ++proci)
|
||||
for (const int proci : Pstream::allProcs())
|
||||
{
|
||||
if (proci == Pstream::myProcNo())
|
||||
{
|
||||
@ -345,7 +345,7 @@ bool Foam::processorLODs::box::doRefineBoxes
|
||||
List<DynamicList<label>> newToOld(Pstream::nProcs());
|
||||
|
||||
|
||||
for (label proci = 0; proci < Pstream::nProcs(); ++proci)
|
||||
for (const int proci : Pstream::allProcs())
|
||||
{
|
||||
if (proci == Pstream::myProcNo())
|
||||
{
|
||||
|
||||
@ -368,7 +368,7 @@ void Foam::cellCellStencils::inverseDistance::markPatchesAsHoles
|
||||
|
||||
// 2. Send over srcMesh bits that overlap tgt and do calculation
|
||||
pBufs.clear();
|
||||
for (label procI = 0; procI < Pstream::nProcs(); procI++)
|
||||
for (const int procI : Pstream::allProcs())
|
||||
{
|
||||
if (procI != Pstream::myProcNo())
|
||||
{
|
||||
@ -385,7 +385,7 @@ void Foam::cellCellStencils::inverseDistance::markPatchesAsHoles
|
||||
}
|
||||
}
|
||||
pBufs.finishedSends();
|
||||
for (label procI = 0; procI < Pstream::nProcs(); procI++)
|
||||
for (const int procI : Pstream::allProcs())
|
||||
{
|
||||
if (procI != Pstream::myProcNo())
|
||||
{
|
||||
@ -537,7 +537,7 @@ void Foam::cellCellStencils::inverseDistance::markDonors
|
||||
DynamicList<label> tgtOverlapProcs(Pstream::nProcs());
|
||||
// (remote) processors where the src overlaps my tgt
|
||||
DynamicList<label> srcOverlapProcs(Pstream::nProcs());
|
||||
for (label procI = 0; procI < Pstream::nProcs(); procI++)
|
||||
for (const int procI : Pstream::allProcs())
|
||||
{
|
||||
if (procI != Pstream::myProcNo())
|
||||
{
|
||||
|
||||
@ -250,7 +250,7 @@ void Foam::cellCellStencils::trackingInverseDistance::markPatchesAsHoles
|
||||
|
||||
// 2. Send over srcMesh bits that overlap tgt and do calculation
|
||||
pBufs.clear();
|
||||
for (label procI = 0; procI < Pstream::nProcs(); procI++)
|
||||
for (const int procI : Pstream::allProcs())
|
||||
{
|
||||
if (procI != Pstream::myProcNo())
|
||||
{
|
||||
@ -267,7 +267,7 @@ void Foam::cellCellStencils::trackingInverseDistance::markPatchesAsHoles
|
||||
}
|
||||
}
|
||||
pBufs.finishedSends();
|
||||
for (label procI = 0; procI < Pstream::nProcs(); procI++)
|
||||
for (const int procI : Pstream::allProcs())
|
||||
{
|
||||
if (procI != Pstream::myProcNo())
|
||||
{
|
||||
@ -373,7 +373,7 @@ void Foam::cellCellStencils::trackingInverseDistance::markDonors
|
||||
DynamicList<label> tgtOverlapProcs(Pstream::nProcs());
|
||||
// (remote) processors where the src overlaps my tgt
|
||||
DynamicList<label> srcOverlapProcs(Pstream::nProcs());
|
||||
for (label procI = 0; procI < Pstream::nProcs(); procI++)
|
||||
for (const int procI : Pstream::allProcs())
|
||||
{
|
||||
if (procI != Pstream::myProcNo())
|
||||
{
|
||||
|
||||
@ -109,7 +109,7 @@ void Foam::ptscotchDecomp::check(const int retVal, const char* str)
|
||||
// globalIndex globalCells(initxadj.size()-1);
|
||||
//
|
||||
// bool hasZeroDomain = false;
|
||||
// for (label proci = 0; proci < Pstream::nProcs(); proci++)
|
||||
// for (const int proci : Pstream::allProcs())
|
||||
// {
|
||||
// if (globalCells.localSize(proci) == 0)
|
||||
// {
|
||||
|
||||
@ -169,7 +169,7 @@ void surfaceNoise::readSurfaceData
|
||||
p *= rhoRef_;
|
||||
|
||||
// Send subset of faces to each processor
|
||||
for (label procI = 0; procI < Pstream::nProcs(); ++procI)
|
||||
for (const int procI : Pstream::allProcs())
|
||||
{
|
||||
label face0 = procFaceOffset[procI];
|
||||
label nLocalFace =
|
||||
|
||||
@ -322,7 +322,7 @@ void Foam::meshToMesh::distributeCells
|
||||
procLocalFaceIDs.setSize(Pstream::nProcs());;
|
||||
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
const labelList& sendElems = map.subMap()[domain];
|
||||
|
||||
@ -501,7 +501,7 @@ void Foam::meshToMesh::distributeCells
|
||||
pBufs.finishedSends();
|
||||
|
||||
// Consume
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
const labelList& recvElems = map.constructMap()[domain];
|
||||
|
||||
|
||||
@ -139,7 +139,7 @@ void Foam::radiation::viewFactor::initialise()
|
||||
DebugInFunction
|
||||
<< "Insert elements in the matrix..." << endl;
|
||||
|
||||
for (label procI = 0; procI < Pstream::nProcs(); procI++)
|
||||
for (const int procI : Pstream::allProcs())
|
||||
{
|
||||
insertMatrixElements
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user