STYLE: prefer listReduce() to using listCombineReduce() when possible

- potentially allows access into the builtin MPI operations
This commit is contained in:
Mark Olesen
2025-02-25 19:26:40 +01:00
parent 5d9f8e9a9d
commit 20b2f46315
38 changed files with 97 additions and 98 deletions

View File

@ -222,7 +222,7 @@ bool Foam::functionObjects::Curle::execute()
pDash /= 4*mathematical::pi;
Pstream::listCombineReduce(pDash, plusEqOp<scalar>());
Pstream::listReduce(pDash, sumOp<scalar>());
if (surfaceWriterPtr_)
{

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2024 OpenCFD Ltd.
Copyright (C) 2018-2025 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -88,8 +88,8 @@ bool Foam::functionObjects::columnAverage::columnAverageField
}
// Global sum
Pstream::listCombineReduce(regionField, plusEqOp<Type>());
Pstream::listCombineReduce(regionCount, plusEqOp<label>());
Pstream::listReduce(regionField, sumOp<Type>());
Pstream::listReduce(regionCount, sumOp<label>());
forAll(regionField, regioni)
{

View File

@ -329,7 +329,7 @@ void Foam::functionObjects::extractEulerianParticles::calculateAddressing
// Create map from new regions to slots in particles list
// - filter through new-to-new addressing to identify new particles
Pstream::listCombineReduce(newToNewRegion, maxEqOp<label>());
Pstream::listReduce(newToNewRegion, maxOp<label>());
label nParticle = -1;
labelHashSet newRegions;
@ -348,7 +348,7 @@ void Foam::functionObjects::extractEulerianParticles::calculateAddressing
// Accumulate old region data or create a new particle if there is no
// mapping from the old-to-new region
Pstream::listCombineReduce(oldToNewRegion, maxEqOp<label>());
Pstream::listReduce(oldToNewRegion, maxOp<label>());
List<eulerianParticle> newParticles(newRegionToParticleMap.size());
forAll(oldToNewRegion, oldRegioni)

View File

@ -155,8 +155,8 @@ bool Foam::histogramModels::equalBinWidth::write(const bool log)
dataCount[bini]++;
}
}
Pstream::listCombineGather(dataNormalised, plusEqOp<scalar>());
Pstream::listCombineGather(dataCount, plusEqOp<label>());
Pstream::listGather(dataNormalised, sumOp<scalar>());
Pstream::listGather(dataCount, sumOp<label>());
// Write histogram data

View File

@ -129,8 +129,8 @@ bool Foam::histogramModels::unequalBinWidth::write(const bool log)
}
}
}
Pstream::listCombineGather(dataNormalised, plusEqOp<scalar>());
Pstream::listCombineGather(dataCount, plusEqOp<label>());
Pstream::listGather(dataNormalised, sumOp<scalar>());
Pstream::listGather(dataCount, sumOp<label>());
// Write histogram data

View File

@ -791,7 +791,7 @@ Foam::tmp<Foam::Field<Type>> Foam::functionObjects::propellerInfo::interpolate
}
}
Pstream::listCombineReduce(field, maxEqOp<Type>());
Pstream::listReduce(field, maxOp<Type>());
return tfield;
}