Compare commits

...

5 Commits

Author SHA1 Message Date
3d17825eed BUG: replced with AMDClang general includes 2022-11-07 17:10:41 +01:00
aa93427c7a Added wmake rules for AMD Clang and Hipcc compiler 2022-11-04 18:56:26 +01:00
d9226575e6 STY: added FOAM namaspace to min and max functions 2022-11-04 18:54:44 +01:00
124702190b ENH: use returnReduceAnd(), returnReduceOr() functions 2022-11-01 19:09:05 +01:00
8071f2f94b ENH: more consistent use of broadcast, combineReduce etc.
- broadcast           : (replaces scatter)
  - combineReduce       == combineGather + broadcast
  - listCombineReduce   == listCombineGather + broadcast
  - mapCombineReduce    == mapCombineGather + broadcast
  - allGatherList       == gatherList + scatterList

  Before settling on a more consistent naming convention,
  some intermediate namings were used in OpenFOAM-v2206:

    - combineReduce       (2206: combineAllGather)
    - listCombineReduce   (2206: listCombineAllGather)
    - mapCombineReduce    (2206: mapCombineAllGather)
2022-11-01 19:09:05 +01:00
336 changed files with 1385 additions and 1311 deletions

View File

@ -36,11 +36,11 @@ Description
if (adjustTimeStep) if (adjustTimeStep)
{ {
scalar maxDeltaTFact = maxCo/(CoNum + StCoNum + SMALL); scalar maxDeltaTFact = maxCo/(CoNum + StCoNum + SMALL);
scalar deltaTFact = min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2); scalar deltaTFact = Foam::min(Foam::min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
runTime.setDeltaT runTime.setDeltaT
( (
min Foam::min
( (
deltaTFact*runTime.deltaTValue(), deltaTFact*runTime.deltaTValue(),
maxDeltaT maxDeltaT

View File

@ -1,5 +1,5 @@
if (adjustTimeStep) if (adjustTimeStep)
{ {
runTime.setDeltaT(min(dtChem, maxDeltaT)); runTime.setDeltaT(Foam::min(dtChem, maxDeltaT));
Info<< "deltaT = " << runTime.deltaT().value() << endl; Info<< "deltaT = " << runTime.deltaT().value() << endl;
} }

View File

@ -54,9 +54,9 @@ if (adjustTimeStep)
runTime.setDeltaT runTime.setDeltaT
( (
min Foam::min
( (
dt0*min(min(TFactorFluid, min(TFactorFilm, TFactorSolid)), 1.2), dt0*Foam::min(Foam::min(TFactorFluid, Foam::min(TFactorFilm, TFactorSolid)), 1.2),
maxDeltaT maxDeltaT
) )
); );

View File

@ -18,13 +18,13 @@
const surfaceScalarField& phi2 = const surfaceScalarField& phi2 =
phaseSystemFluid[regioni].phase2().phiRef(); phaseSystemFluid[regioni].phase2().phiRef();
sumPhi = max sumPhi = Foam::max
( (
sumPhi, sumPhi,
fvc::surfaceSum(mag(phi1))().primitiveField() fvc::surfaceSum(mag(phi1))().primitiveField()
); );
sumPhi = max sumPhi = Foam::max
( (
sumPhi, sumPhi,
fvc::surfaceSum(mag(phi2))().primitiveField() fvc::surfaceSum(mag(phi2))().primitiveField()
@ -43,7 +43,7 @@
/ fluidRegions[regioni].V().field() / fluidRegions[regioni].V().field()
)*runTime.deltaTValue(), )*runTime.deltaTValue(),
CoNum = max(UrCoNum, CoNum); CoNum = Foam::max(UrCoNum, CoNum);
} }
} }

View File

@ -2,7 +2,7 @@
forAll(fluidRegions, regioni) forAll(fluidRegions, regioni)
{ {
CoNum = max CoNum = Foam::max
( (
compressibleCourantNo compressibleCourantNo
( (

View File

@ -47,10 +47,10 @@ if (adjustTimeStep)
runTime.setDeltaT runTime.setDeltaT
( (
min Foam::min
( (
min(maxCo/CoNum, maxDi/DiNum)*runTime.deltaT().value(), Foam::min(maxCo/CoNum, maxDi/DiNum)*runTime.deltaT().value(),
min(runTime.deltaTValue(), maxDeltaT) Foam::min(runTime.deltaTValue(), maxDeltaT)
) )
); );
Info<< "deltaT = " << runTime.deltaT().value() << endl; Info<< "deltaT = " << runTime.deltaT().value() << endl;

View File

@ -49,17 +49,17 @@ if (adjustTimeStep)
scalar maxDeltaTSolid = maxDi/(DiNum + SMALL); scalar maxDeltaTSolid = maxDi/(DiNum + SMALL);
scalar deltaTFluid = scalar deltaTFluid =
min Foam::min
( (
min(maxDeltaTFluid, 1.0 + 0.1*maxDeltaTFluid), Foam::min(maxDeltaTFluid, 1.0 + 0.1*maxDeltaTFluid),
1.2 1.2
); );
runTime.setDeltaT runTime.setDeltaT
( (
min Foam::min
( (
min(deltaTFluid, maxDeltaTSolid)*runTime.deltaT().value(), Foam::min(deltaTFluid, maxDeltaTSolid)*runTime.deltaT().value(),
maxDeltaT maxDeltaT
) )
); );

View File

@ -22,7 +22,7 @@ forAll(solidRegions, i)
tmp<volScalarField> trho = thermo.rho(); tmp<volScalarField> trho = thermo.rho();
const volScalarField& rho = trho(); const volScalarField& rho = trho();
DiNum = max DiNum = Foam::max
( (
solidRegionDiffNo solidRegionDiffNo
( (

View File

@ -17,7 +17,7 @@ scalar DiNum = -GREAT;
tmp<volScalarField> trho = thermo.rho(); tmp<volScalarField> trho = thermo.rho();
const volScalarField& rho = trho(); const volScalarField& rho = trho();
DiNum = max DiNum = Foam::max
( (
solidRegionDiffNo solidRegionDiffNo
( (

View File

@ -36,13 +36,13 @@ Description
if (adjustTimeStep) if (adjustTimeStep)
{ {
const scalar maxDeltaTFact = const scalar maxDeltaTFact =
min(maxCo/(CoNum + SMALL), maxCo/(surfaceFilm.CourantNumber() + SMALL)); Foam::min(maxCo/(CoNum + SMALL), maxCo/(surfaceFilm.CourantNumber() + SMALL));
const scalar deltaTFact = const scalar deltaTFact =
min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2); Foam::min(Foam::min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
runTime.setDeltaT runTime.setDeltaT
( (
min Foam::min
( (
deltaTFact*runTime.deltaTValue(), deltaTFact*runTime.deltaTValue(),
maxDeltaT maxDeltaT

View File

@ -214,7 +214,7 @@
phiCN, phiCN,
alphaPhi10, alphaPhi10,
Sp, Sp,
(Su + divU*min(alpha1(), scalar(1)))(), (Su + divU*Foam::min(alpha1(), scalar(1)))(),
oneField(), oneField(),
zeroField() zeroField()
); );

View File

@ -214,7 +214,7 @@
phiCN, phiCN,
alphaPhi10, alphaPhi10,
Sp, Sp,
(Su + divU*min(alpha1(), scalar(1)))(), (Su + divU*Foam::min(alpha1(), scalar(1)))(),
oneField(), oneField(),
zeroField() zeroField()
); );

View File

@ -36,13 +36,13 @@ Description
if (adjustTimeStep) if (adjustTimeStep)
{ {
scalar maxDeltaTFact = scalar maxDeltaTFact =
min(maxCo/(CoNum + SMALL), maxAlphaCo/(alphaCoNum + SMALL)); Foam::min(maxCo/(CoNum + SMALL), maxAlphaCo/(alphaCoNum + SMALL));
scalar deltaTFact = min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2); scalar deltaTFact = Foam::min(Foam::min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
runTime.setDeltaT runTime.setDeltaT
( (
min Foam::min
( (
deltaTFact*runTime.deltaTValue(), deltaTFact*runTime.deltaTValue(),
maxDeltaT maxDeltaT

View File

@ -36,13 +36,13 @@ Description
if (adjustTimeStep) if (adjustTimeStep)
{ {
scalar maxDeltaTFact = scalar maxDeltaTFact =
min(maxCo/(CoNum + SMALL), maxAcousticCo/(acousticCoNum + SMALL)); Foam::min(maxCo/(CoNum + SMALL), maxAcousticCo/(acousticCoNum + SMALL));
scalar deltaTFact = min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2); scalar deltaTFact = Foam::min(Foam::min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
runTime.setDeltaT runTime.setDeltaT
( (
min Foam::min
( (
deltaTFact*runTime.deltaTValue(), deltaTFact*runTime.deltaTValue(),
maxDeltaT maxDeltaT

View File

@ -37,11 +37,11 @@ if (adjustTimeStep)
if (CoNum > SMALL) if (CoNum > SMALL)
{ {
scalar maxDeltaTFact = scalar maxDeltaTFact =
min(maxCo/(CoNum + SMALL), maxAcousticCo/(acousticCoNum + SMALL)); Foam::min(maxCo/(CoNum + SMALL), maxAcousticCo/(acousticCoNum + SMALL));
runTime.setDeltaT runTime.setDeltaT
( (
min Foam::min
( (
maxDeltaTFact*runTime.deltaTValue(), maxDeltaTFact*runTime.deltaTValue(),
maxDeltaT maxDeltaT

View File

@ -26,12 +26,12 @@ forAll(dgdt, celli)
{ {
if (dgdt[celli] > 0.0) if (dgdt[celli] > 0.0)
{ {
Sp[celli] -= dgdt[celli]/max(1.0 - alpha1[celli], 1e-4); Sp[celli] -= dgdt[celli]/Foam::max(1.0 - alpha1[celli], 1e-4);
Su[celli] += dgdt[celli]/max(1.0 - alpha1[celli], 1e-4); Su[celli] += dgdt[celli]/Foam::max(1.0 - alpha1[celli], 1e-4);
} }
else if (dgdt[celli] < 0.0) else if (dgdt[celli] < 0.0)
{ {
Sp[celli] += dgdt[celli]/max(alpha1[celli], 1e-4); Sp[celli] += dgdt[celli]/Foam::max(alpha1[celli], 1e-4);
} }
} }

View File

@ -1,6 +1,6 @@
// Update alpha1 // Update alpha1
#include "alphaSuSp.H" #include "alphaSuSp.H"
advector.advect(Sp,(Su + divU*min(alpha1(), scalar(1)))()); advector.advect(Sp,(Su + divU*Foam::min(alpha1(), scalar(1)))());
// Update rhoPhi // Update rhoPhi
rhoPhi = advector.getRhoPhi(rho1, rho2); rhoPhi = advector.getRhoPhi(rho1, rho2);
@ -10,6 +10,6 @@ alpha2 = 1.0 - alpha1;
Info<< "Phase-1 volume fraction = " Info<< "Phase-1 volume fraction = "
<< alpha1.weightedAverage(mesh.Vsc()).value() << alpha1.weightedAverage(mesh.Vsc()).value()
<< " Min(" << alpha1.name() << ") = " << min(alpha1).value() << " Min(" << alpha1.name() << ") = " << Foam::min(alpha1).value()
<< " Max(" << alpha1.name() << ") - 1 = " << max(alpha1).value() - 1 << " Max(" << alpha1.name() << ") - 1 = " << Foam::max(alpha1).value() - 1
<< endl; << endl;

View File

@ -26,12 +26,12 @@ forAll(dgdt, celli)
{ {
if (dgdt[celli] > 0.0) if (dgdt[celli] > 0.0)
{ {
Sp[celli] -= dgdt[celli]/max(1.0 - alpha1[celli], 1e-4); Sp[celli] -= dgdt[celli]/Foam::max(1.0 - alpha1[celli], 1e-4);
Su[celli] += dgdt[celli]/max(1.0 - alpha1[celli], 1e-4); Su[celli] += dgdt[celli]/Foam::max(1.0 - alpha1[celli], 1e-4);
} }
else if (dgdt[celli] < 0.0) else if (dgdt[celli] < 0.0)
{ {
Sp[celli] += dgdt[celli]/max(alpha1[celli], 1e-4); Sp[celli] += dgdt[celli]/Foam::max(alpha1[celli], 1e-4);
} }
} }

View File

@ -26,12 +26,12 @@ forAll(dgdt, celli)
{ {
if (dgdt[celli] > 0.0) if (dgdt[celli] > 0.0)
{ {
Sp[celli] -= dgdt[celli]/max(1.0 - alpha1[celli], 1e-4); Sp[celli] -= dgdt[celli]/Foam::max(1.0 - alpha1[celli], 1e-4);
Su[celli] += dgdt[celli]/max(1.0 - alpha1[celli], 1e-4); Su[celli] += dgdt[celli]/Foam::max(1.0 - alpha1[celli], 1e-4);
} }
else if (dgdt[celli] < 0.0) else if (dgdt[celli] < 0.0)
{ {
Sp[celli] += dgdt[celli]/max(alpha1[celli], 1e-4); Sp[celli] += dgdt[celli]/Foam::max(alpha1[celli], 1e-4);
} }
} }

View File

@ -157,12 +157,7 @@ void Foam::radiation::laserDTRM::initialiseReflection()
); );
} }
if (reflections_.size()) reflectionSwitch_ = returnReduceOr(reflections_.size());
{
reflectionSwitch_ = true;
}
reflectionSwitch_ = returnReduce(reflectionSwitch_, orOp<bool>());
} }
} }
@ -299,14 +294,12 @@ void Foam::radiation::laserDTRM::initialise()
DTRMCloud_.addParticle(pPtr); DTRMCloud_.addParticle(pPtr);
} }
if (returnReduce(cellI, maxOp<label>()) == -1) if (nMissed < 10 && returnReduceAnd(cellI < 0))
{ {
if (++nMissed <= 10) ++nMissed;
{ WarningInFunction
WarningInFunction << "Cannot find owner cell for focalPoint at "
<< "Cannot find owner cell for focalPoint at " << p0 << endl;
<< p0 << endl;
}
} }
} }
} }

View File

@ -36,13 +36,13 @@ Description
if (adjustTimeStep) if (adjustTimeStep)
{ {
scalar maxDeltaTFact = scalar maxDeltaTFact =
min Foam::min
( (
maxCo/(CoNum + SMALL), maxCo/(CoNum + SMALL),
min Foam::min
( (
maxAlphaCo/(alphaCoNum + SMALL), maxAlphaCo/(alphaCoNum + SMALL),
min Foam::min
( (
maxAlphaDdt/(ddtAlphaNum + SMALL), maxAlphaDdt/(ddtAlphaNum + SMALL),
maxDi/(DiNum + SMALL) maxDi/(DiNum + SMALL)
@ -50,11 +50,11 @@ if (adjustTimeStep)
) )
); );
scalar deltaTFact = min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2); scalar deltaTFact = Foam::min(Foam::min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
runTime.setDeltaT runTime.setDeltaT
( (
min Foam::min
( (
deltaTFact*runTime.deltaTValue(), deltaTFact*runTime.deltaTValue(),
maxDeltaT maxDeltaT

View File

@ -8,5 +8,5 @@
Info<< "Max Ur Courant Number = " << UrCoNum << endl; Info<< "Max Ur Courant Number = " << UrCoNum << endl;
CoNum = max(CoNum, UrCoNum); CoNum = Foam::max(CoNum, UrCoNum);
} }

View File

@ -8,5 +8,5 @@
Info<< "Max Ur Courant Number = " << UrCoNum << endl; Info<< "Max Ur Courant Number = " << UrCoNum << endl;
CoNum = max(CoNum, UrCoNum); CoNum = Foam::max(CoNum, UrCoNum);
} }

View File

@ -113,7 +113,6 @@ int main(int argc, char *argv[])
label coarseSize = max(addr)+1; label coarseSize = max(addr)+1;
Info<< "Level : " << level << endl Info<< "Level : " << level << endl
<< returnReduce(addr.size(), sumOp<label>()) << endl
<< " current size : " << " current size : "
<< returnReduce(addr.size(), sumOp<label>()) << endl << returnReduce(addr.size(), sumOp<label>()) << endl
<< " agglomerated size : " << " agglomerated size : "

View File

@ -182,7 +182,7 @@ int main(int argc, char *argv[])
// MPI barrier // MPI barrier
bool barrier = true; bool barrier = true;
Pstream::scatter(barrier); Pstream::broadcast(barrier);
} }

View File

@ -138,8 +138,8 @@ int main()
maxFirstEqOp<label>()(maxIndexed, item); maxFirstEqOp<label>()(maxIndexed, item);
} }
Pstream::combineAllGather(minIndexed, minFirstEqOp<label>()); Pstream::combineReduce(minIndexed, minFirstEqOp<label>());
Pstream::combineAllGather(maxIndexed, maxFirstEqOp<label>()); Pstream::combineReduce(maxIndexed, maxFirstEqOp<label>());
Info<< "Min indexed: " << minIndexed << nl Info<< "Min indexed: " << minIndexed << nl
<< "Max indexed: " << maxIndexed << nl; << "Max indexed: " << maxIndexed << nl;
@ -156,8 +156,8 @@ int main()
maxIndexed = maxFirstOp<label>()(maxIndexed, item); maxIndexed = maxFirstOp<label>()(maxIndexed, item);
} }
Pstream::combineAllGather(minIndexed, minFirstEqOp<label>()); Pstream::combineReduce(minIndexed, minFirstEqOp<label>());
Pstream::combineAllGather(maxIndexed, maxFirstEqOp<label>()); Pstream::combineReduce(maxIndexed, maxFirstEqOp<label>());
Info<< "Min indexed: " << minIndexed << nl Info<< "Min indexed: " << minIndexed << nl
<< "Max indexed: " << maxIndexed << nl; << "Max indexed: " << maxIndexed << nl;

View File

@ -60,7 +60,7 @@ int main(int argc, char *argv[])
Info<< "Reading " << file << nl << endl; Info<< "Reading " << file << nl << endl;
decomposedBlockData data decomposedBlockData data
( (
Pstream::worldComm, UPstream::worldComm,
IOobject IOobject
( (
file, file,

View File

@ -204,7 +204,7 @@ int main(int argc, char *argv[])
labelPair inOut; labelPair inOut;
pointField allCcs(globalNumbering.gather(mesh.cellCentres())); pointField allCcs(globalNumbering.gather(mesh.cellCentres()));
inOut[0] = allCcs.size(); inOut[0] = allCcs.size();
Pstream::scatter(allCcs); Pstream::broadcast(allCcs);
inOut[1] = allCcs.size(); inOut[1] = allCcs.size();
Pout<< " " << inOut << endl; Pout<< " " << inOut << endl;

View File

@ -234,11 +234,7 @@ int main(int argc, char *argv[])
Pout<< "hashed: " << hashed << nl; Pout<< "hashed: " << hashed << nl;
Pstream::mapCombineGather Pstream::mapCombineReduce(hashed, plusEqOp<scalarMinMax>());
(
hashed,
plusEqOp<scalarMinMax>()
);
Info<< "reduced: " << hashed << nl; Info<< "reduced: " << hashed << nl;

View File

@ -167,7 +167,7 @@ int main(int argc, char *argv[])
( (
localValue, localValue,
sumOp<scalar>(), sumOp<scalar>(),
Pstream::msgType(), UPstream::msgType(),
comm comm
); );
Pout<< "sum :" << sum << endl; Pout<< "sum :" << sum << endl;

View File

@ -125,13 +125,13 @@ int main(int argc, char *argv[])
scalar data1 = 1.0; scalar data1 = 1.0;
label request1 = -1; label request1 = -1;
{ {
Foam::reduce(data1, sumOp<scalar>(), Pstream::msgType(), request1); Foam::reduce(data1, sumOp<scalar>(), UPstream::msgType(), request1);
} }
scalar data2 = 0.1; scalar data2 = 0.1;
label request2 = -1; label request2 = -1;
{ {
Foam::reduce(data2, sumOp<scalar>(), Pstream::msgType(), request2); Foam::reduce(data2, sumOp<scalar>(), UPstream::msgType(), request2);
} }

View File

@ -585,7 +585,7 @@ void createBaffles
// Wrapper around find patch. Also makes sure same patch in parallel. // Wrapper around find patch. Also makes sure same patch in parallel.
label findPatch(const polyBoundaryMesh& patches, const word& patchName) label findPatch(const polyBoundaryMesh& patches, const word& patchName)
{ {
label patchi = patches.findPatchID(patchName); const label patchi = patches.findPatchID(patchName);
if (patchi == -1) if (patchi == -1)
{ {
@ -597,16 +597,15 @@ label findPatch(const polyBoundaryMesh& patches, const word& patchName)
// Check same patch for all procs // Check same patch for all procs
{ {
label newPatch = patchi; const label newPatchi = returnReduce(patchi, minOp<label>());
reduce(newPatch, minOp<label>());
if (newPatch != patchi) if (newPatchi != patchi)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Patch " << patchName << "Patch " << patchName
<< " should have the same patch index on all processors." << nl << " should have the same patch index on all processors." << nl
<< "On my processor it has index " << patchi << "On my processor it has index " << patchi
<< " ; on some other processor it has index " << newPatch << " ; on some other processor it has index " << newPatchi
<< exit(FatalError); << exit(FatalError);
} }
} }

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -396,12 +397,11 @@ int main(int argc, char *argv[])
meshSearch queryMesh(mesh); meshSearch queryMesh(mesh);
// Check all 'outside' points // Check all 'outside' points
forAll(outsidePts, outsideI) for (const point& outsidePoint : outsidePts)
{ {
const point& outsidePoint = outsidePts[outsideI]; const label celli = queryMesh.findCell(outsidePoint, -1, false);
label celli = queryMesh.findCell(outsidePoint, -1, false); if (returnReduceAnd(celli < 0))
if (returnReduce(celli, maxOp<label>()) == -1)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "outsidePoint " << outsidePoint << "outsidePoint " << outsidePoint

View File

@ -142,26 +142,26 @@ scalar getEdgeStats(const primitiveMesh& mesh, const direction excludeCmpt)
if (mag(eVec & x) > 1-edgeTol) if (mag(eVec & x) > 1-edgeTol)
{ {
minX = min(minX, eMag); minX = Foam::min(minX, eMag);
maxX = max(maxX, eMag); maxX = Foam::max(maxX, eMag);
nX++; nX++;
} }
else if (mag(eVec & y) > 1-edgeTol) else if (mag(eVec & y) > 1-edgeTol)
{ {
minY = min(minY, eMag); minY = Foam::min(minY, eMag);
maxY = max(maxY, eMag); maxY = Foam::max(maxY, eMag);
nY++; nY++;
} }
else if (mag(eVec & z) > 1-edgeTol) else if (mag(eVec & z) > 1-edgeTol)
{ {
minZ = min(minZ, eMag); minZ = Foam::min(minZ, eMag);
maxZ = max(maxZ, eMag); maxZ = Foam::max(maxZ, eMag);
nZ++; nZ++;
} }
else else
{ {
minOther = min(minOther, eMag); minOther = Foam::min(minOther, eMag);
maxOther = max(maxOther, eMag); maxOther = Foam::max(maxOther, eMag);
} }
} }
@ -179,19 +179,19 @@ scalar getEdgeStats(const primitiveMesh& mesh, const direction excludeCmpt)
if (excludeCmpt == 0) if (excludeCmpt == 0)
{ {
return min(minY, min(minZ, minOther)); return Foam::min(minY, Foam::min(minZ, minOther));
} }
else if (excludeCmpt == 1) else if (excludeCmpt == 1)
{ {
return min(minX, min(minZ, minOther)); return Foam::min(minX, Foam::min(minZ, minOther));
} }
else if (excludeCmpt == 2) else if (excludeCmpt == 2)
{ {
return min(minX, min(minY, minOther)); return Foam::min(minX, Foam::min(minY, minOther));
} }
else else
{ {
return min(minX, min(minY, min(minZ, minOther))); return Foam::min(minX, Foam::min(minY, Foam::min(minZ, minOther)));
} }
} }
@ -771,7 +771,7 @@ int main(int argc, char *argv[])
{ {
Info<< "Read existing refinement level from file " Info<< "Read existing refinement level from file "
<< refLevel.objectPath() << nl << refLevel.objectPath() << nl
<< " min level : " << min(refLevel) << nl << " min level : " << Foam::min(refLevel) << nl
<< " max level : " << maxLevel << nl << " max level : " << maxLevel << nl
<< endl; << endl;
} }

View File

@ -271,7 +271,7 @@ int main(int argc, char *argv[])
if (blockPFacePointi != blockPFacePointi2) if (blockPFacePointi != blockPFacePointi2)
{ {
sqrMergeTol = sqrMergeTol =
min Foam::min
( (
sqrMergeTol, sqrMergeTol,
magSqr magSqr
@ -338,16 +338,16 @@ int main(int argc, char *argv[])
blockNFacePoints[blockNFacePointi] blockNFacePoints[blockNFacePointi]
+ blockOffsets[blockNlabel]; + blockOffsets[blockNlabel];
label minPN = min(PpointLabel, NpointLabel); label minPN = Foam::min(PpointLabel, NpointLabel);
if (pointMergeList[PpointLabel] != -1) if (pointMergeList[PpointLabel] != -1)
{ {
minPN = min(minPN, pointMergeList[PpointLabel]); minPN = Foam::min(minPN, pointMergeList[PpointLabel]);
} }
if (pointMergeList[NpointLabel] != -1) if (pointMergeList[NpointLabel] != -1)
{ {
minPN = min(minPN, pointMergeList[NpointLabel]); minPN = Foam::min(minPN, pointMergeList[NpointLabel]);
} }
pointMergeList[PpointLabel] pointMergeList[PpointLabel]
@ -411,7 +411,7 @@ int main(int argc, char *argv[])
pointMergeList[PpointLabel] pointMergeList[PpointLabel]
= pointMergeList[NpointLabel] = pointMergeList[NpointLabel]
= min = Foam::min
( (
pointMergeList[PpointLabel], pointMergeList[PpointLabel],
pointMergeList[NpointLabel] pointMergeList[NpointLabel]
@ -757,7 +757,7 @@ int main(int argc, char *argv[])
); );
// Set the precision of the points data to 10 // Set the precision of the points data to 10
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision())); IOstream::defaultPrecision(Foam::max(10u, IOstream::defaultPrecision()));
Info<< "Writing polyMesh" << endl; Info<< "Writing polyMesh" << endl;
pShapeMesh.removeFiles(); pShapeMesh.removeFiles();

View File

@ -350,7 +350,7 @@ mtype {space}"MTYPE:"{space}
// Find out how many labels are expected. If less or equal to // Find out how many labels are expected. If less or equal to
// seven, read them all and finish with it. If there is more, // seven, read them all and finish with it. If there is more,
// set read of the next line // set read of the next line
label labelsToRead = min(8, nVertices); label labelsToRead = Foam::min(8, nVertices);
label labelI = 0; label labelI = 0;
for (; labelI < labelsToRead; labelI++) for (; labelI < labelsToRead; labelI++)
{ {
@ -387,7 +387,7 @@ mtype {space}"MTYPE:"{space}
labelList& curLabels = cellLabels[curNumberOfCells]; labelList& curLabels = cellLabels[curNumberOfCells];
label labelsToRead = min label labelsToRead = Foam::min
( (
(nCellContinuationLines + 1)*7, (nCellContinuationLines + 1)*7,
curLabels.size() curLabels.size()
@ -869,7 +869,7 @@ int main(int argc, char *argv[])
); );
// Set the precision of the points data to 10 // Set the precision of the points data to 10
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision())); IOstream::defaultPrecision(Foam::max(10u, IOstream::defaultPrecision()));
Info<< "Writing polyMesh" << endl; Info<< "Writing polyMesh" << endl;
pShapeMesh.removeFiles(); pShapeMesh.removeFiles();

View File

@ -269,7 +269,7 @@ void readCells
label maxUnvPoint = 0; label maxUnvPoint = 0;
forAll(unvPointID, pointi) forAll(unvPointID, pointi)
{ {
maxUnvPoint = max(maxUnvPoint, unvPointID[pointi]); maxUnvPoint = Foam::max(maxUnvPoint, unvPointID[pointi]);
} }
labelList unvToFoam(invert(maxUnvPoint+1, unvPointID)); labelList unvToFoam(invert(maxUnvPoint+1, unvPointID));
@ -784,7 +784,7 @@ int main(int argc, char *argv[])
label maxUnvPoint = 0; label maxUnvPoint = 0;
forAll(unvPointID, pointi) forAll(unvPointID, pointi)
{ {
maxUnvPoint = max(maxUnvPoint, unvPointID[pointi]); maxUnvPoint = Foam::max(maxUnvPoint, unvPointID[pointi]);
} }
labelList unvToFoam(invert(maxUnvPoint+1, unvPointID)); labelList unvToFoam(invert(maxUnvPoint+1, unvPointID));
@ -1281,7 +1281,7 @@ int main(int argc, char *argv[])
} }
// Set the precision of the points data to 10 // Set the precision of the points data to 10
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision())); IOstream::defaultPrecision(Foam::max(10u, IOstream::defaultPrecision()));
mesh.write(); mesh.write();

View File

@ -8,10 +8,10 @@
{ {
if (kivaVersion == kiva3v) if (kivaVersion == kiva3v)
{ {
regionIndex = max regionIndex = Foam::max
( (
max(idface[quadFace[0]], idface[quadFace[1]]), Foam::max(idface[quadFace[0]], idface[quadFace[1]]),
max(idface[quadFace[2]], idface[quadFace[3]]) Foam::max(idface[quadFace[2]], idface[quadFace[3]])
); );
if (regionIndex > 0) if (regionIndex > 0)

View File

@ -148,7 +148,7 @@ for (label i=0; i<nPoints; i++)
end = pointMap[end]; end = pointMap[end];
} }
label minLabel = min(start, end); label minLabel = Foam::min(start, end);
pointMap[start] = pointMap[end] = minLabel; pointMap[start] = pointMap[end] = minLabel;
} }
@ -331,7 +331,7 @@ if
{ {
forAll(pf, pfi) forAll(pf, pfi)
{ {
minz = min(minz, points[pf[pfi]].z()); minz = Foam::min(minz, points[pf[pfi]].z());
} }
} }
@ -344,7 +344,7 @@ if
scalar minfz = GREAT; scalar minfz = GREAT;
forAll(pf, pfi) forAll(pf, pfi)
{ {
minfz = min(minfz, points[pf[pfi]].z()); minfz = Foam::min(minfz, points[pf[pfi]].z());
} }
if (minfz > minz) if (minfz > minz)
@ -371,7 +371,7 @@ if
scalar minfz = GREAT; scalar minfz = GREAT;
forAll(pf, pfi) forAll(pf, pfi)
{ {
minfz = min(minfz, points[pf[pfi]].z()); minfz = Foam::min(minfz, points[pf[pfi]].z());
} }
if (minfz < zHeadMin) if (minfz < zHeadMin)
@ -570,7 +570,7 @@ polyMesh pShapeMesh
); );
// Set the precision of the points data to 10 // Set the precision of the points data to 10
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision())); IOstream::defaultPrecision(Foam::max(10u, IOstream::defaultPrecision()));
Info << "Writing polyMesh" << endl; Info << "Writing polyMesh" << endl;
pShapeMesh.removeFiles(); pShapeMesh.removeFiles();

View File

@ -188,7 +188,7 @@ int main(int argc, char *argv[])
} }
maxPatch = max(maxPatch, patchi); maxPatch = Foam::max(maxPatch, patchi);
triFace tri(readLabel(str)-1, readLabel(str)-1, readLabel(str)-1); triFace tri(readLabel(str)-1, readLabel(str)-1, readLabel(str)-1);
@ -319,7 +319,7 @@ int main(int argc, char *argv[])
); );
// Set the precision of the points data to 10 // Set the precision of the points data to 10
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision())); IOstream::defaultPrecision(Foam::max(10u, IOstream::defaultPrecision()));
Info<< "Writing mesh ..." << endl; Info<< "Writing mesh ..." << endl;
mesh.removeFiles(); mesh.removeFiles();

View File

@ -538,8 +538,11 @@ int main(int argc, char *argv[])
// Add any patches. // Add any patches.
label nAdded = nPatches - mesh.boundaryMesh().size(); const label nAdded = returnReduce
reduce(nAdded, sumOp<label>()); (
nPatches - mesh.boundaryMesh().size(),
sumOp<label>()
);
Info<< "Adding overall " << nAdded << " processor patches." << endl; Info<< "Adding overall " << nAdded << " processor patches." << endl;
@ -946,9 +949,8 @@ int main(int argc, char *argv[])
// Put all modifications into meshMod // Put all modifications into meshMod
bool anyChange = collapser.setRefinement(allPointInfo, meshMod); bool anyChange = collapser.setRefinement(allPointInfo, meshMod);
reduce(anyChange, orOp<bool>());
if (anyChange) if (returnReduceOr(anyChange))
{ {
// Construct new mesh from polyTopoChange. // Construct new mesh from polyTopoChange.
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false); autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
@ -1118,8 +1120,7 @@ int main(int argc, char *argv[])
processorMeshes::removeFiles(mesh); processorMeshes::removeFiles(mesh);
// Need writing cellSet // Need writing cellSet
label nAdded = returnReduce(addedCellsSet.size(), sumOp<label>()); if (returnReduceOr(addedCellsSet.size()))
if (nAdded > 0)
{ {
cellSet addedCells(mesh, "addedCells", addedCellsSet); cellSet addedCells(mesh, "addedCells", addedCellsSet);
Info<< "Writing added cells to cellSet " << addedCells.name() Info<< "Writing added cells to cellSet " << addedCells.name()

View File

@ -345,7 +345,7 @@ void deleteEmptyPatches(fvMesh& mesh)
else else
{ {
// Common patch. // Common patch.
if (returnReduce(patches[patchi].empty(), andOp<bool>())) if (returnReduceAnd(patches[patchi].empty()))
{ {
Pout<< "Deleting patch " << patchi Pout<< "Deleting patch " << patchi
<< " name:" << patches[patchi].name() << " name:" << patches[patchi].name()
@ -556,8 +556,8 @@ void calcEdgeMinMaxZone
forAll(eFaces, i) forAll(eFaces, i)
{ {
label zoneI = mappedZoneID[eFaces[i]]; label zoneI = mappedZoneID[eFaces[i]];
minZoneID[edgeI] = min(minZoneID[edgeI], zoneI); minZoneID[edgeI] = Foam::min(minZoneID[edgeI], zoneI);
maxZoneID[edgeI] = max(maxZoneID[edgeI], zoneI); maxZoneID[edgeI] = Foam::max(maxZoneID[edgeI], zoneI);
} }
} }
} }
@ -661,8 +661,8 @@ void countExtrudePatches
} }
// Synchronise decision. Actual numbers are not important, just make // Synchronise decision. Actual numbers are not important, just make
// sure that they're > 0 on all processors. // sure that they're > 0 on all processors.
Pstream::listCombineAllGather(zoneSidePatch, plusEqOp<label>()); Pstream::listCombineReduce(zoneSidePatch, plusEqOp<label>());
Pstream::listCombineAllGather(zoneZonePatch, plusEqOp<label>()); Pstream::listCombineReduce(zoneZonePatch, plusEqOp<label>());
} }
@ -813,8 +813,8 @@ void addCoupledPatches
forAll(eFaces, i) forAll(eFaces, i)
{ {
label proci = procID[eFaces[i]]; label proci = procID[eFaces[i]];
minProcID[edgeI] = min(minProcID[edgeI], proci); minProcID[edgeI] = Foam::min(minProcID[edgeI], proci);
maxProcID[edgeI] = max(maxProcID[edgeI], proci); maxProcID[edgeI] = Foam::max(maxProcID[edgeI], proci);
} }
} }
} }
@ -1291,7 +1291,7 @@ void extrudeGeometricProperties
label celli = regionMesh.faceOwner()[facei]; label celli = regionMesh.faceOwner()[facei];
if (regionMesh.isInternalFace(facei)) if (regionMesh.isInternalFace(facei))
{ {
celli = max(celli, regionMesh.faceNeighbour()[facei]); celli = Foam::max(celli, regionMesh.faceNeighbour()[facei]);
} }
// Calculate layer from cell numbering (see createShellMesh) // Calculate layer from cell numbering (see createShellMesh)
@ -1848,7 +1848,7 @@ int main(int argc, char *argv[])
const primitiveFacePatch extrudePatch(std::move(zoneFaces), mesh.points()); const primitiveFacePatch extrudePatch(std::move(zoneFaces), mesh.points());
Pstream::listCombineAllGather(isInternal, orEqOp<bool>()); Pstream::listCombineReduce(isInternal, orEqOp<bool>());
// Check zone either all internal or all external faces // Check zone either all internal or all external faces
checkZoneInside(mesh, zoneNames, zoneID, extrudeMeshFaces, isInternal); checkZoneInside(mesh, zoneNames, zoneID, extrudeMeshFaces, isInternal);
@ -2192,8 +2192,8 @@ int main(int argc, char *argv[])
if (zone0 != zone1) // || (cos(angle) > blabla)) if (zone0 != zone1) // || (cos(angle) > blabla))
{ {
label minZone = min(zone0,zone1); label minZone = Foam::min(zone0,zone1);
label maxZone = max(zone0,zone1); label maxZone = Foam::max(zone0,zone1);
label index = minZone*zoneNames.size()+maxZone; label index = minZone*zoneNames.size()+maxZone;
ePatches.setSize(eFaces.size()); ePatches.setSize(eFaces.size());
@ -2309,7 +2309,7 @@ int main(int argc, char *argv[])
} }
// Reduce // Reduce
Pstream::mapCombineAllGather(globalSum, plusEqOp<point>()); Pstream::mapCombineReduce(globalSum, plusEqOp<point>());
forAll(localToGlobalRegion, localRegionI) forAll(localToGlobalRegion, localRegionI)
{ {

View File

@ -588,9 +588,8 @@ Foam::label Foam::DistributedDelaunayMesh<Triangulation>::referVertices
reduce(preInsertionSize, sumOp<label>()); reduce(preInsertionSize, sumOp<label>());
reduce(postInsertionSize, sumOp<label>()); reduce(postInsertionSize, sumOp<label>());
label nTotalToInsert = referredVertices.size(); label nTotalToInsert =
returnReduce(referredVertices.size(), sumOp<label>());
reduce(nTotalToInsert, sumOp<label>());
if (preInsertionSize + nTotalToInsert != postInsertionSize) if (preInsertionSize + nTotalToInsert != postInsertionSize)
{ {

View File

@ -217,7 +217,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
); );
} }
if (returnReduce(newCellsToRefine.size(), sumOp<label>()) == 0) if (returnReduceAnd(newCellsToRefine.empty()))
{ {
break; break;
} }
@ -878,7 +878,7 @@ Foam::backgroundMeshDecomposition::distribute
} }
} }
if (returnReduce(cellsToRefine.size(), sumOp<label>()) == 0) if (returnReduceAnd(cellsToRefine.empty()))
{ {
break; break;
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2020-2021 OpenCFD Ltd. Copyright (C) 2020-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -87,23 +87,17 @@ void Foam::conformalVoronoiMesh::cellSizeMeshOverlapsBackground() const
boundBox cellSizeMeshBb = cellSizeMesh.bounds(); boundBox cellSizeMeshBb = cellSizeMesh.bounds();
bool fullyContained = true; bool fullyContained = cellSizeMeshBb.contains(bb);
if (!cellSizeMeshBb.contains(bb)) if (!fullyContained)
{ {
Pout<< "Triangulation not fully contained in cell size mesh." Pout<< "Triangulation not fully contained in cell size mesh." << endl
<< endl; << "Cell Size Mesh Bounds = " << cellSizeMeshBb << endl
<< "foamyHexMesh Bounds = " << bb << endl;
Pout<< "Cell Size Mesh Bounds = " << cellSizeMesh.bounds() << endl;
Pout<< "foamyHexMesh Bounds = " << bb << endl;
fullyContained = false;
} }
reduce(fullyContained, andOp<unsigned int>());
Info<< "Triangulation is " Info<< "Triangulation is "
<< (fullyContained ? "fully" : "not fully") << (returnReduceAnd(fullyContained) ? "fully" : "not fully")
<< " contained in the cell size mesh" << " contained in the cell size mesh"
<< endl; << endl;
} }
@ -115,12 +109,7 @@ void Foam::conformalVoronoiMesh::insertInternalPoints
bool distribute bool distribute
) )
{ {
label nPoints = points.size(); const label nPoints = returnReduce(points.size(), sumOp<label>());
if (Pstream::parRun())
{
reduce(nPoints, sumOp<label>());
}
Info<< " " << nPoints << " points to insert..." << endl; Info<< " " << nPoints << " points to insert..." << endl;
@ -145,16 +134,15 @@ void Foam::conformalVoronoiMesh::insertInternalPoints
map().distribute(points); map().distribute(points);
} }
label nVert = number_of_vertices(); label preReinsertionSize(number_of_vertices());
insert(points.begin(), points.end()); insert(points.begin(), points.end());
label nInserted(number_of_vertices() - nVert); const label nInserted = returnReduce
(
if (Pstream::parRun()) label(number_of_vertices()) - preReinsertionSize,
{ sumOp<label>()
reduce(nInserted, sumOp<label>()); );
}
Info<< " " << nInserted << " points inserted" Info<< " " << nInserted << " points inserted"
<< ", failed to insert " << nPoints - nInserted << ", failed to insert " << nPoints - nInserted

View File

@ -753,7 +753,7 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints
forAll(patches, p) forAll(patches, p)
{ {
label totalPatchSize = patchDicts[p].get<label>("nFaces"); label nPatchFaces = patchDicts[p].get<label>("nFaces");
if if
( (
@ -762,7 +762,7 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints
) )
{ {
// Do not create empty processor patches // Do not create empty processor patches
if (totalPatchSize > 0) if (nPatchFaces)
{ {
patchDicts[p].set("transform", "coincidentFullMatch"); patchDicts[p].set("transform", "coincidentFullMatch");
@ -781,9 +781,8 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints
else else
{ {
// Check that the patch is not empty on every processor // Check that the patch is not empty on every processor
reduce(totalPatchSize, sumOp<label>());
if (totalPatchSize > 0) if (returnReduceOr(nPatchFaces))
{ {
patches[nValidPatches] = polyPatch::New patches[nValidPatches] = polyPatch::New
( (

View File

@ -729,7 +729,7 @@ Foam::label Foam::conformalVoronoiMesh::synchroniseSurfaceTrees
} }
} }
Pstream::listCombineAllGather(hits, plusEqOp<labelHashSet>()); Pstream::listCombineReduce(hits, plusEqOp<labelHashSet>());
forAll(surfaceHits, eI) forAll(surfaceHits, eI)
{ {
@ -816,7 +816,7 @@ Foam::label Foam::conformalVoronoiMesh::synchroniseEdgeTrees
} }
} }
Pstream::listCombineAllGather(hits, plusEqOp<labelHashSet>()); Pstream::listCombineReduce(hits, plusEqOp<labelHashSet>());
forAll(featureEdgeHits, eI) forAll(featureEdgeHits, eI)
{ {

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2017 OpenFOAM Foundation Copyright (C) 2012-2017 OpenFOAM Foundation
Copyright (C) 2015-2018 OpenCFD Ltd. Copyright (C) 2015-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -707,9 +707,7 @@ void Foam::conformalVoronoiMesh::reorderProcessorPatches
Info<< incrIndent << indent << "Faces matched." << endl; Info<< incrIndent << indent << "Faces matched." << endl;
reduce(anyChanged, orOp<bool>()); if (returnReduceOr(anyChanged))
if (anyChanged)
{ {
label nReorderedFaces = 0; label nReorderedFaces = 0;

View File

@ -416,10 +416,12 @@ void extractSurface
// Allocate zone/patch for all patches // Allocate zone/patch for all patches
HashTable<label> compactZoneID(1024); HashTable<label> compactZoneID(1024);
forAllConstIters(patchSize, iter) if (Pstream::master())
{ {
label sz = compactZoneID.size(); forAllConstIters(patchSize, iter)
compactZoneID.insert(iter.key(), sz); {
compactZoneID.insert(iter.key(), compactZoneID.size());
}
} }
Pstream::broadcast(compactZoneID); Pstream::broadcast(compactZoneID);
@ -431,7 +433,7 @@ void extractSurface
label patchi = bMesh.findPatchID(iter.key()); label patchi = bMesh.findPatchID(iter.key());
if (patchi != -1) if (patchi != -1)
{ {
patchToCompactZone[patchi] = iter(); patchToCompactZone[patchi] = iter.val();
} }
} }
@ -663,7 +665,7 @@ void removeZeroSizedPatches(fvMesh& mesh)
if if
( (
isA<coupledPolyPatch>(pp) isA<coupledPolyPatch>(pp)
|| returnReduce(pp.size(), sumOp<label>()) || returnReduceOr(pp.size())
) )
{ {
// Coupled (and unknown size) or uncoupled and used // Coupled (and unknown size) or uncoupled and used
@ -1889,11 +1891,8 @@ int main(int argc, char *argv[])
); );
// Use the maxLocalCells from the refinement parameters // Use the maxLocalCells from the refinement parameters
bool preBalance = returnReduce const bool preBalance =
( returnReduceOr(mesh.nCells() >= refineParams.maxLocalCells());
(mesh.nCells() >= refineParams.maxLocalCells()),
orOp<bool>()
);
if (!overwrite && !debugLevel) if (!overwrite && !debugLevel)

View File

@ -187,7 +187,7 @@ void Foam::checkPatch
{ {
const labelList& mp = pp.meshPoints(); const labelList& mp = pp.meshPoints();
if (returnReduce(mp.size(), sumOp<label>()) > 0) if (returnReduceOr(mp.size()))
{ {
boundBox bb(pp.points(), mp, true); // reduce boundBox bb(pp.points(), mp, true); // reduce
Info<< ' ' << bb; Info<< ' ' << bb;
@ -252,10 +252,10 @@ Foam::label Foam::checkTopology
} }
} }
reduce(nEmpty, sumOp<label>()); reduce(nEmpty, sumOp<label>());
label nTotCells = returnReduce(mesh.cells().size(), sumOp<label>()); const label nCells = returnReduce(mesh.cells().size(), sumOp<label>());
// These are actually warnings, not errors. // These are actually warnings, not errors.
if (nTotCells && (nEmpty % nTotCells)) if (nCells && (nEmpty % nCells))
{ {
Info<< " ***Total number of faces on empty patches" Info<< " ***Total number of faces on empty patches"
<< " is not divisible by the number of cells in the mesh." << " is not divisible by the number of cells in the mesh."
@ -335,7 +335,7 @@ Foam::label Foam::checkTopology
{ {
noFailedChecks++; noFailedChecks++;
label nPoints = returnReduce(points.size(), sumOp<label>()); const label nPoints = returnReduce(points.size(), sumOp<label>());
Info<< " <<Writing " << nPoints Info<< " <<Writing " << nPoints
<< " unused points to set " << points.name() << endl; << " unused points to set " << points.name() << endl;
@ -472,7 +472,7 @@ Foam::label Foam::checkTopology
} }
} }
label nOneCells = returnReduce(oneCells.size(), sumOp<label>()); const label nOneCells = returnReduce(oneCells.size(), sumOp<label>());
if (nOneCells > 0) if (nOneCells > 0)
{ {
@ -488,7 +488,7 @@ Foam::label Foam::checkTopology
} }
} }
label nTwoCells = returnReduce(twoCells.size(), sumOp<label>()); const label nTwoCells = returnReduce(twoCells.size(), sumOp<label>());
if (nTwoCells > 0) if (nTwoCells > 0)
{ {
@ -588,11 +588,7 @@ Foam::label Foam::checkTopology
} }
} }
Pstream::listCombineAllGather Pstream::listCombineReduce(regionDisconnected, andEqOp<bool>());
(
regionDisconnected,
andEqOp<bool>()
);
} }
@ -639,7 +635,7 @@ Foam::label Foam::checkTopology
cellRegions[i].write(); cellRegions[i].write();
} }
label nPoints = returnReduce(points.size(), sumOp<label>()); const label nPoints = returnReduce(points.size(), sumOp<label>());
if (nPoints) if (nPoints)
{ {
Info<< " <<Writing " << nPoints Info<< " <<Writing " << nPoints

View File

@ -27,7 +27,7 @@ void maxFaceToCell
const cell& cFaces = cells[cellI]; const cell& cFaces = cells[cellI];
forAll(cFaces, i) forAll(cFaces, i)
{ {
cellFld[cellI] = max(cellFld[cellI], faceData[cFaces[i]]); cellFld[cellI] = Foam::max(cellFld[cellI], faceData[cFaces[i]]);
} }
} }
@ -57,7 +57,7 @@ void minFaceToCell
const cell& cFaces = cells[cellI]; const cell& cFaces = cells[cellI];
forAll(cFaces, i) forAll(cFaces, i)
{ {
cellFld[cellI] = min(cellFld[cellI], faceData[cFaces[i]]); cellFld[cellI] = Foam::min(cellFld[cellI], faceData[cFaces[i]]);
} }
} }
@ -88,8 +88,8 @@ void minFaceToCell
// Internal faces // Internal faces
forAll(own, facei) forAll(own, facei)
{ {
cellFld[own[facei]] = min(cellFld[own[facei]], faceData[facei]); cellFld[own[facei]] = Foam::min(cellFld[own[facei]], faceData[facei]);
cellFld[nei[facei]] = min(cellFld[nei[facei]], faceData[facei]); cellFld[nei[facei]] = Foam::min(cellFld[nei[facei]], faceData[facei]);
} }
// Patch faces // Patch faces
@ -100,7 +100,7 @@ void minFaceToCell
forAll(fc, i) forAll(fc, i)
{ {
cellFld[fc[i]] = min(cellFld[fc[i]], fvp[i]); cellFld[fc[i]] = Foam::min(cellFld[fc[i]], fvp[i]);
} }
} }
@ -180,7 +180,7 @@ void Foam::writeFields
( (
radToDeg radToDeg
( (
Foam::acos(min(scalar(1), max(scalar(-1), faceOrthogonality))) Foam::acos(Foam::min(scalar(1), Foam::max(scalar(-1), faceOrthogonality)))
) )
); );
@ -540,7 +540,7 @@ void Foam::writeFields
ownCc, ownCc,
fc fc
).quality(); ).quality();
ownVol = min(ownVol, tetQual); ownVol = Foam::min(ownVol, tetQual);
} }
} }
if (mesh.isInternalFace(facei)) if (mesh.isInternalFace(facei))
@ -556,7 +556,7 @@ void Foam::writeFields
fc, fc,
neiCc neiCc
).quality(); ).quality();
neiVol = min(neiVol, tetQual); neiVol = Foam::min(neiVol, tetQual);
} }
} }
} }
@ -608,8 +608,8 @@ void Foam::writeFields
// Internal faces // Internal faces
forAll(own, facei) forAll(own, facei)
{ {
cellFld[own[facei]] = min(cellFld[own[facei]], ownPyrVol[facei]); cellFld[own[facei]] = Foam::min(cellFld[own[facei]], ownPyrVol[facei]);
cellFld[nei[facei]] = min(cellFld[nei[facei]], neiPyrVol[facei]); cellFld[nei[facei]] = Foam::min(cellFld[nei[facei]], neiPyrVol[facei]);
} }
// Patch faces // Patch faces
@ -620,7 +620,7 @@ void Foam::writeFields
forAll(fc, i) forAll(fc, i)
{ {
const label meshFacei = fvp.patch().start(); const label meshFacei = fvp.patch().start();
cellFld[fc[i]] = min(cellFld[fc[i]], ownPyrVol[meshFacei]); cellFld[fc[i]] = Foam::min(cellFld[fc[i]], ownPyrVol[meshFacei]);
} }
} }
@ -631,7 +631,7 @@ void Foam::writeFields
if (writeFaceFields) if (writeFaceFields)
{ {
scalarField minFacePyrVol(neiPyrVol); scalarField minFacePyrVol(neiPyrVol);
minFacePyrVol = min minFacePyrVol = Foam::min
( (
minFacePyrVol, minFacePyrVol,
SubField<scalar>(ownPyrVol, mesh.nInternalFaces()) SubField<scalar>(ownPyrVol, mesh.nInternalFaces())

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2021 OpenCFD Ltd. Copyright (C) 2016-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -138,7 +138,7 @@ void filterPatches(fvMesh& mesh, const wordHashSet& addedPatchNames)
if if
( (
isA<coupledPolyPatch>(pp) isA<coupledPolyPatch>(pp)
|| returnReduce(pp.size(), sumOp<label>()) || returnReduceOr(pp.size())
|| addedPatchNames.found(pp.name()) || addedPatchNames.found(pp.name())
) )
{ {

View File

@ -686,7 +686,7 @@ void syncPoints
//- Note: hasTransformation is only used for warning messages so //- Note: hasTransformation is only used for warning messages so
// reduction not strictly necessary. // reduction not strictly necessary.
//reduce(hasTransformation, orOp<bool>()); //Pstream::reduceOr(hasTransformation);
// Synchronize multiple shared points. // Synchronize multiple shared points.
const globalMeshData& pd = mesh.globalData(); const globalMeshData& pd = mesh.globalData();
@ -714,7 +714,7 @@ void syncPoints
} }
// Combine - globally consistent // Combine - globally consistent
Pstream::listCombineAllGather(sharedPts, cop); Pstream::listCombineReduce(sharedPts, cop);
// Now we will all have the same information. Merge it back with // Now we will all have the same information. Merge it back with
// my local information. // my local information.

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -272,7 +273,7 @@ int main(int argc, char *argv[])
} }
if (returnReduce(changedEdges.size(), sumOp<label>()) == 0) if (returnReduceAnd(changedEdges.empty()))
{ {
break; break;
} }

View File

@ -100,26 +100,26 @@ void printEdgeStats(const polyMesh& mesh)
if (mag(eVec & x) > 1-edgeTol) if (mag(eVec & x) > 1-edgeTol)
{ {
minX = min(minX, eMag); minX = Foam::min(minX, eMag);
maxX = max(maxX, eMag); maxX = Foam::max(maxX, eMag);
nX++; nX++;
} }
else if (mag(eVec & y) > 1-edgeTol) else if (mag(eVec & y) > 1-edgeTol)
{ {
minY = min(minY, eMag); minY = Foam::min(minY, eMag);
maxY = max(maxY, eMag); maxY = Foam::max(maxY, eMag);
nY++; nY++;
} }
else if (mag(eVec & z) > 1-edgeTol) else if (mag(eVec & z) > 1-edgeTol)
{ {
minZ = min(minZ, eMag); minZ = Foam::min(minZ, eMag);
maxZ = max(maxZ, eMag); maxZ = Foam::max(maxZ, eMag);
nZ++; nZ++;
} }
else else
{ {
minOther = min(minOther, eMag); minOther = Foam::min(minOther, eMag);
maxOther = max(maxOther, eMag); maxOther = Foam::max(maxOther, eMag);
} }
} }
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2021 OpenCFD Ltd. Copyright (C) 2016-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -145,10 +145,10 @@ void getBand
// Note: mag not necessary for correct (upper-triangular) ordering. // Note: mag not necessary for correct (upper-triangular) ordering.
label diff = nei-own; label diff = nei-own;
cellBandwidth[nei] = max(cellBandwidth[nei], diff); cellBandwidth[nei] = Foam::max(cellBandwidth[nei], diff);
} }
bandwidth = max(cellBandwidth); bandwidth = Foam::max(cellBandwidth);
// Do not use field algebra because of conversion label to scalar // Do not use field algebra because of conversion label to scalar
profile = 0.0; profile = 0.0;
@ -340,7 +340,7 @@ labelList getRegionFaceOrder
} }
// Do region interfaces // Do region interfaces
label nRegions = max(cellToRegion)+1; label nRegions = Foam::max(cellToRegion)+1;
{ {
// Sort in increasing region // Sort in increasing region
SortableList<label> sortKey(mesh.nFaces(), labelMax); SortableList<label> sortKey(mesh.nFaces(), labelMax);
@ -353,8 +353,8 @@ labelList getRegionFaceOrder
if (ownRegion != neiRegion) if (ownRegion != neiRegion)
{ {
sortKey[facei] = sortKey[facei] =
min(ownRegion, neiRegion)*nRegions Foam::min(ownRegion, neiRegion)*nRegions
+max(ownRegion, neiRegion); +Foam::max(ownRegion, neiRegion);
} }
} }
sortKey.sort(); sortKey.sort();
@ -566,7 +566,7 @@ labelList regionRenumber
labelList cellOrder(cellToRegion.size()); labelList cellOrder(cellToRegion.size());
label nRegions = max(cellToRegion)+1; label nRegions = Foam::max(cellToRegion)+1;
labelListList regionToCells(invertOneToMany(nRegions, cellToRegion)); labelListList regionToCells(invertOneToMany(nRegions, cellToRegion));
@ -1103,9 +1103,7 @@ int main(int argc, char *argv[])
// Update proc maps // Update proc maps
if (cellProcAddressing.headerOk()) if (cellProcAddressing.headerOk())
{ {
bool localOk = (cellProcAddressing.size() == mesh.nCells()); if (returnReduceAnd(cellProcAddressing.size() == mesh.nCells()))
if (returnReduce(localOk, andOp<bool>()))
{ {
Info<< "Renumbering processor cell decomposition map " Info<< "Renumbering processor cell decomposition map "
<< cellProcAddressing.name() << endl; << cellProcAddressing.name() << endl;
@ -1129,9 +1127,7 @@ int main(int argc, char *argv[])
if (faceProcAddressing.headerOk()) if (faceProcAddressing.headerOk())
{ {
bool localOk = (faceProcAddressing.size() == mesh.nFaces()); if (returnReduceAnd(faceProcAddressing.size() == mesh.nFaces()))
if (returnReduce(localOk, andOp<bool>()))
{ {
Info<< "Renumbering processor face decomposition map " Info<< "Renumbering processor face decomposition map "
<< faceProcAddressing.name() << endl; << faceProcAddressing.name() << endl;
@ -1171,9 +1167,7 @@ int main(int argc, char *argv[])
if (pointProcAddressing.headerOk()) if (pointProcAddressing.headerOk())
{ {
bool localOk = (pointProcAddressing.size() == mesh.nPoints()); if (returnReduceAnd(pointProcAddressing.size() == mesh.nPoints()))
if (returnReduce(localOk, andOp<bool>()))
{ {
Info<< "Renumbering processor point decomposition map " Info<< "Renumbering processor point decomposition map "
<< pointProcAddressing.name() << endl; << pointProcAddressing.name() << endl;
@ -1197,12 +1191,13 @@ int main(int argc, char *argv[])
if (boundaryProcAddressing.headerOk()) if (boundaryProcAddressing.headerOk())
{ {
bool localOk = if
( (
boundaryProcAddressing.size() returnReduceAnd
== mesh.boundaryMesh().size() (
); boundaryProcAddressing.size() == mesh.boundaryMesh().size()
if (returnReduce(localOk, andOp<bool>())) )
)
{ {
// No renumbering needed // No renumbering needed
} }

View File

@ -320,10 +320,10 @@ bool doCommand
const globalMeshData& parData = mesh.globalData(); const globalMeshData& parData = mesh.globalData();
label typSize = label typSize =
max Foam::max
( (
parData.nTotalCells(), parData.nTotalCells(),
max Foam::max
( (
parData.nTotalFaces(), parData.nTotalFaces(),
parData.nTotalPoints() parData.nTotalPoints()
@ -375,7 +375,7 @@ bool doCommand
topoSet& currentSet = currentSetPtr(); topoSet& currentSet = currentSetPtr();
// Presize it according to current mesh data. // Presize it according to current mesh data.
currentSet.resize(max(currentSet.size(), typSize)); currentSet.resize(Foam::max(currentSet.size(), typSize));
} }
} }

View File

@ -286,8 +286,8 @@ void addToInterface
{ {
edge interface edge interface
( (
min(ownRegion, neiRegion), Foam::min(ownRegion, neiRegion),
max(ownRegion, neiRegion) Foam::max(ownRegion, neiRegion)
); );
auto iter = regionsToSize.find(interface); auto iter = regionsToSize.find(interface);
@ -544,8 +544,8 @@ void getInterfaceSizes
edge interface edge interface
( (
min(ownRegion, neiRegion), Foam::min(ownRegion, neiRegion),
max(ownRegion, neiRegion) Foam::max(ownRegion, neiRegion)
); );
faceToInterface[facei] = regionsToInterface[interface][zoneID]; faceToInterface[facei] = regionsToInterface[interface][zoneID];
@ -567,8 +567,8 @@ void getInterfaceSizes
edge interface edge interface
( (
min(ownRegion, neiRegion), Foam::min(ownRegion, neiRegion),
max(ownRegion, neiRegion) Foam::max(ownRegion, neiRegion)
); );
faceToInterface[facei] = regionsToInterface[interface][zoneID]; faceToInterface[facei] = regionsToInterface[interface][zoneID];
@ -847,7 +847,7 @@ void createAndWriteRegion
if (!isA<processorPolyPatch>(pp)) if (!isA<processorPolyPatch>(pp))
{ {
if (returnReduce(pp.size(), sumOp<label>()) > 0) if (returnReduceOr(pp.size()))
{ {
oldToNew[patchi] = newI; oldToNew[patchi] = newI;
if (!addedPatches.found(patchi)) if (!addedPatches.found(patchi))
@ -1114,7 +1114,7 @@ label findCorrespondingRegion
} }
} }
Pstream::listCombineAllGather(cellsInZone, plusEqOp<label>()); Pstream::listCombineReduce(cellsInZone, plusEqOp<label>());
// Pick region with largest overlap of zoneI // Pick region with largest overlap of zoneI
label regionI = findMax(cellsInZone); label regionI = findMax(cellsInZone);

View File

@ -345,7 +345,7 @@ void subsetTopoSets
Info<< "Subsetting " << set.type() << " " << set.name() << endl; Info<< "Subsetting " << set.type() << " " << set.name() << endl;
labelHashSet subset(2*min(set.size(), map.size())); labelHashSet subset(2*Foam::min(set.size(), map.size()));
forAll(map, i) forAll(map, i)
{ {

View File

@ -223,7 +223,7 @@ bool writeOptionalMeshObject
// Make sure all know if there is a valid class name // Make sure all know if there is a valid class name
wordList classNames(1, io.headerClassName()); wordList classNames(1, io.headerClassName());
Pstream::combineAllGather(classNames, uniqueEqOp<word>()); Pstream::combineReduce(classNames, uniqueEqOp<word>());
// Check for correct type // Check for correct type
if (classNames[0] == T::typeName) if (classNames[0] == T::typeName)
@ -429,7 +429,7 @@ int main(int argc, char *argv[])
) )
); );
Pstream::combineAllGather(lagrangianDirs, uniqueEqOp<fileName>()); Pstream::combineReduce(lagrangianDirs, uniqueEqOp<fileName>());
if (!lagrangianDirs.empty()) if (!lagrangianDirs.empty())
{ {
@ -466,7 +466,7 @@ int main(int argc, char *argv[])
) )
); );
Pstream::combineAllGather(cloudDirs, uniqueEqOp<fileName>()); Pstream::combineReduce(cloudDirs, uniqueEqOp<fileName>());
forAll(cloudDirs, i) forAll(cloudDirs, i)
{ {
@ -492,7 +492,7 @@ int main(int argc, char *argv[])
); );
// Combine with all other cloud objects // Combine with all other cloud objects
Pstream::combineAllGather(cloudFields, uniqueEqOp<word>()); Pstream::combineReduce(cloudFields, uniqueEqOp<word>());
for (const word& name : cloudFields) for (const word& name : cloudFields)
{ {

View File

@ -252,7 +252,7 @@ autoPtr<mapPolyMesh> mergeSharedPoints
Info<< "mergeSharedPoints : detected " << pointToMaster.size() Info<< "mergeSharedPoints : detected " << pointToMaster.size()
<< " points that are to be merged." << endl; << " points that are to be merged." << endl;
if (returnReduce(pointToMaster.size(), sumOp<label>()) == 0) if (returnReduceAnd(pointToMaster.empty()))
{ {
return nullptr; return nullptr;
} }
@ -977,7 +977,7 @@ int main(int argc, char *argv[])
for for
( (
label addedI=next; label addedI=next;
addedI<min(proci+step, nProcs); addedI<Foam::min(proci+step, nProcs);
addedI++ addedI++
) )
{ {

View File

@ -89,10 +89,11 @@ void Foam::parLagrangianDistributor::findClouds
} }
// Synchronise cloud names // Synchronise cloud names
Pstream::combineGather(cloudNames, ListOps::uniqueEqOp<word>()); Pstream::combineReduce(cloudNames, ListOps::uniqueEqOp<word>());
Pstream::broadcast(cloudNames); Foam::sort(cloudNames); // Consistent order
objectNames.setSize(cloudNames.size()); objectNames.clear();
objectNames.resize(cloudNames.size());
for (const fileName& localCloudName : localCloudDirs) for (const fileName& localCloudName : localCloudDirs)
{ {
@ -124,11 +125,11 @@ void Foam::parLagrangianDistributor::findClouds
} }
} }
// Synchronise objectNames // Synchronise objectNames (per cloud)
forAll(objectNames, i) for (wordList& objNames : objectNames)
{ {
Pstream::combineGather(objectNames[i], ListOps::uniqueEqOp<word>()); Pstream::combineReduce(objNames, ListOps::uniqueEqOp<word>());
Pstream::broadcast(objectNames[i]); Foam::sort(objNames); // Consistent order
} }
} }
@ -291,7 +292,7 @@ Foam::parLagrangianDistributor::distributeLagrangianPositions
nsTransPs[sendProcI] = subMap[sendProcI].size(); nsTransPs[sendProcI] = subMap[sendProcI].size();
} }
// Send sizes across. Note: blocks. // Send sizes across. Note: blocks.
Pstream::combineAllGather(sizes, Pstream::listEq()); Pstream::combineReduce(sizes, Pstream::listEq());
labelListList constructMap(Pstream::nProcs()); labelListList constructMap(Pstream::nProcs());
label constructSize = 0; label constructSize = 0;

View File

@ -51,14 +51,9 @@ Foam::wordList Foam::parLagrangianDistributor::filterObjects
: objects.names<Container>(selectedFields) : objects.names<Container>(selectedFields)
); );
// Parallel synchronise // Parallel synchronise - combine names from all processors
// - Combine names from all processors Pstream::combineReduce(fieldNames, ListOps::uniqueEqOp<word>());
Foam::sort(fieldNames); // Consistent order
Pstream::combineGather(fieldNames, ListOps::uniqueEqOp<word>());
Pstream::broadcast(fieldNames);
// Sort for consistent order on all processors
Foam::sort(fieldNames);
return fieldNames; return fieldNames;
} }
@ -93,11 +88,8 @@ Foam::label Foam::parLagrangianDistributor::distributeFields
if (!nFields) if (!nFields)
{ {
// Performing an all-to-one (reconstruct)? // Performing an all-to-one (reconstruct)?
reconstruct = returnReduce reconstruct =
( returnReduceAnd(!map.constructSize() || Pstream::master());
(!map.constructSize() || Pstream::master()),
andOp<bool>()
);
} }
if (verbose_) if (verbose_)
@ -200,11 +192,8 @@ Foam::label Foam::parLagrangianDistributor::distributeFieldFields
if (!nFields) if (!nFields)
{ {
// Performing an all-to-one (reconstruct)? // Performing an all-to-one (reconstruct)?
reconstruct = returnReduce reconstruct =
( returnReduceAnd(!map.constructSize() || Pstream::master());
(!map.constructSize() || Pstream::master()),
andOp<bool>()
);
} }
if (verbose_) if (verbose_)
@ -349,11 +338,8 @@ Foam::label Foam::parLagrangianDistributor::distributeStoredFields
if (!nFields) if (!nFields)
{ {
// Performing an all-to-one (reconstruct)? // Performing an all-to-one (reconstruct)?
reconstruct = returnReduce reconstruct =
( returnReduceAnd(!map.constructSize() || Pstream::master());
(!map.constructSize() || Pstream::master()),
andOp<bool>()
);
} }
if (verbose_) if (verbose_)

View File

@ -132,7 +132,7 @@ void createTimeDirs(const fileName& path)
//Pstream::parRun(oldParRun); // Restore parallel state //Pstream::parRun(oldParRun); // Restore parallel state
masterTimeDirs = localTimeDirs; masterTimeDirs = localTimeDirs;
} }
Pstream::scatter(masterTimeDirs); Pstream::broadcast(masterTimeDirs);
//DebugVar(masterTimeDirs); //DebugVar(masterTimeDirs);
//DebugVar(localTimeDirs); //DebugVar(localTimeDirs);
@ -334,11 +334,11 @@ void printMeshData(const polyMesh& mesh)
<< nBndFaces-nProcFaces << endl; << nBndFaces-nProcFaces << endl;
} }
maxProcCells = max(maxProcCells, nLocalCells); maxProcCells = Foam::max(maxProcCells, nLocalCells);
totProcFaces += nProcFaces; totProcFaces += nProcFaces;
totProcPatches += nei.size(); totProcPatches += nei.size();
maxProcFaces = max(maxProcFaces, nProcFaces); maxProcFaces = Foam::max(maxProcFaces, nProcFaces);
maxProcPatches = max(maxProcPatches, nei.size()); maxProcPatches = Foam::max(maxProcPatches, nei.size());
} }
// Summary stats // Summary stats
@ -1168,7 +1168,7 @@ int main(int argc, char *argv[])
bool nfs = true; bool nfs = true;
{ {
List<fileName> roots(1, args.rootPath()); List<fileName> roots(1, args.rootPath());
Pstream::combineAllGather(roots, ListOps::uniqueEqOp<fileName>()); Pstream::combineReduce(roots, ListOps::uniqueEqOp<fileName>());
nfs = (roots.size() == 1); nfs = (roots.size() == 1);
} }
@ -1203,7 +1203,7 @@ int main(int argc, char *argv[])
} }
} }
// If master changed to decompose mode make sure all nodes know about it // If master changed to decompose mode make sure all nodes know about it
Pstream::scatter(decompose); Pstream::broadcast(decompose);
// If running distributed we have problem of new processors not finding // If running distributed we have problem of new processors not finding
@ -1288,7 +1288,7 @@ int main(int argc, char *argv[])
// use the times list from the master processor // use the times list from the master processor
// and select a subset based on the command-line options // and select a subset based on the command-line options
instantList timeDirs = timeSelector::select(runTime.times(), args); instantList timeDirs = timeSelector::select(runTime.times(), args);
Pstream::scatter(timeDirs); Pstream::broadcast(timeDirs);
if (timeDirs.empty()) if (timeDirs.empty())
{ {
@ -1547,7 +1547,7 @@ int main(int argc, char *argv[])
if if
( (
!volMeshHaveUndecomposed !volMeshHaveUndecomposed
|| !returnReduce(haveVolAddressing, andOp<bool>()) || !returnReduceAnd(haveVolAddressing)
) )
{ {
Info<< "No undecomposed mesh. Creating from: " Info<< "No undecomposed mesh. Creating from: "
@ -1615,7 +1615,7 @@ int main(int argc, char *argv[])
&& &&
( (
!areaMeshHaveUndecomposed !areaMeshHaveUndecomposed
|| !returnReduce(haveAreaAddressing, andOp<bool>()) || !returnReduceAnd(haveAreaAddressing)
) )
) )
{ {
@ -2067,7 +2067,7 @@ int main(int argc, char *argv[])
args args
)[0].value(); )[0].value();
} }
Pstream::scatter(masterTime); Pstream::broadcast(masterTime);
Info<< "Setting time to that of master or undecomposed case : " Info<< "Setting time to that of master or undecomposed case : "
<< masterTime << endl; << masterTime << endl;
runTime.setTime(masterTime, 0); runTime.setTime(masterTime, 0);

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2021 OpenCFD Ltd. Copyright (C) 2021-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM, distributed under GPL-3.0-or-later. This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -78,6 +78,6 @@ if (timeDirs.size() > 1)
} }
// Ensure consistency // Ensure consistency
reduce(hasMovingMesh, orOp<bool>()); Pstream::reduceOr(hasMovingMesh);
// ************************************************************************* // // ************************************************************************* //

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018-2021 OpenCFD Ltd. Copyright (C) 2018-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM, distributed under GPL-3.0-or-later. This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -38,7 +38,7 @@ if (doLagrangian)
Info<< "Cloud " << cloudName << " ("; Info<< "Cloud " << cloudName << " (";
const bool cloudExists = const bool cloudExists =
returnReduce(currentCloudDirs.found(cloudName), orOp<bool>()); returnReduceOr(currentCloudDirs.found(cloudName));
{ {
autoPtr<ensightFile> os = ensCase.newCloud(cloudName); autoPtr<ensightFile> os = ensCase.newCloud(cloudName);
@ -82,7 +82,7 @@ if (doLagrangian)
const bool oldParRun = Pstream::parRun(false); const bool oldParRun = Pstream::parRun(false);
fieldExists = fieldObject.typeHeaderOk<IOField<scalar>>(false); fieldExists = fieldObject.typeHeaderOk<IOField<scalar>>(false);
Pstream::parRun(oldParRun); // Restore parallel state Pstream::parRun(oldParRun); // Restore parallel state
reduce(fieldExists, orOp<bool>()); Pstream::reduceOr(fieldExists);
} }
bool wrote = false; bool wrote = false;

View File

@ -101,7 +101,7 @@ if (timeDirs.size() && doLagrangian)
{ {
for (auto& cloudFields : regionCloudFields) for (auto& cloudFields : regionCloudFields)
{ {
Pstream::mapCombineAllGather Pstream::mapCombineReduce
( (
cloudFields, cloudFields,
HashTableOps::plusEqOp<word>() HashTableOps::plusEqOp<word>()

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018 OpenCFD Ltd. Copyright (C) 2018-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -64,9 +64,7 @@ Foam::label Foam::checkData
} }
} }
reduce(good, andOp<bool>()); if (returnReduceAnd(good))
if (good)
{ {
goodFields.insert(fieldName); goodFields.insert(fieldName);
} }

View File

@ -46,11 +46,9 @@ if (doLagrangian)
if (Pstream::parRun()) if (Pstream::parRun())
{ {
// Synchronise cloud names // Synchronise cloud names
Pstream::combineGather(cloudNames, ListOps::uniqueEqOp<word>()); Pstream::combineReduce(cloudNames, ListOps::uniqueEqOp<word>());
Pstream::broadcast(cloudNames);
} }
// Consistent order Foam::sort(cloudNames); // Consistent order
Foam::sort(cloudNames);
for (const word& cloudName : cloudNames) for (const word& cloudName : cloudNames)
{ {
@ -66,7 +64,7 @@ if (doLagrangian)
isCloud = true; isCloud = true;
} }
if (!returnReduce(isCloud, orOp<bool>())) if (!returnReduceOr(isCloud))
{ {
continue; continue;
} }
@ -78,7 +76,7 @@ if (doLagrangian)
); );
// Are there cloud fields (globally)? // Are there cloud fields (globally)?
if (returnReduce(cloudObjs.empty(), andOp<bool>())) if (returnReduceAnd(cloudObjs.empty()))
{ {
continue; continue;
} }

View File

@ -131,7 +131,7 @@ int main(int argc, char *argv[])
args.readIfPresent("format", setFormat); args.readIfPresent("format", setFormat);
args.readIfPresent("stride", sampleFrequency); args.readIfPresent("stride", sampleFrequency);
sampleFrequency = max(1, sampleFrequency); // sanity sampleFrequency = Foam::max(1, sampleFrequency); // sanity
// Setup the writer // Setup the writer
auto writerPtr = auto writerPtr =
@ -179,14 +179,14 @@ int main(int argc, char *argv[])
maxIds.resize(origProc+1, -1); maxIds.resize(origProc+1, -1);
} }
maxIds[origProc] = max(maxIds[origProc], origId); maxIds[origProc] = Foam::max(maxIds[origProc], origId);
} }
} }
const label maxNProcs = returnReduce(maxIds.size(), maxOp<label>()); const label maxNProcs = returnReduce(maxIds.size(), maxOp<label>());
maxIds.resize(maxNProcs, -1); maxIds.resize(maxNProcs, -1);
Pstream::listCombineAllGather(maxIds, maxEqOp<label>()); Pstream::listCombineReduce(maxIds, maxEqOp<label>());
// From ids to count // From ids to count
const labelList numIds = maxIds + 1; const labelList numIds = maxIds + 1;

View File

@ -77,8 +77,7 @@ Foam::label Foam::particleTracksSampler::setTrackFields
if (Pstream::parRun()) if (Pstream::parRun())
{ {
Pstream::combineGather(fieldNames, ListOps::uniqueEqOp<word>()); Pstream::combineReduce(fieldNames, ListOps::uniqueEqOp<word>());
Pstream::broadcast(fieldNames);
} }
for (const word& fieldName : fieldNames) for (const word& fieldName : fieldNames)

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -68,7 +69,7 @@ void Foam::channelIndex::walkOppositeFaces
blockedFace[facei] = true; blockedFace[facei] = true;
} }
while (returnReduce(frontFaces.size(), sumOp<label>()) > 0) while (returnReduceOr(frontFaces.size()))
{ {
// Transfer across. // Transfer across.
boolList isFrontBndFace(nBnd, false); boolList isFrontBndFace(nBnd, false);

View File

@ -40,7 +40,7 @@ Foam::Field<T> Foam::channelIndex::regionSum(const Field<T>& cellField) const
} }
// Global sum // Global sum
Pstream::listCombineAllGather(regionField, plusEqOp<T>()); Pstream::listCombineReduce(regionField, plusEqOp<T>());
return regionField; return regionField;
} }

View File

@ -1056,7 +1056,7 @@ void calc_drag_etc
const scalar expon = const scalar expon =
( (
br > 0.0 br > 0.0
? min(max((surr_br / br - 0.25) * 4.0 / 3.0, scalar(0)), scalar(1)) ? Foam::min(Foam::max((surr_br / br - 0.25) * 4.0 / 3.0, scalar(0)), scalar(1))
: 0.0 : 0.0
); );
@ -1114,16 +1114,16 @@ void Foam::PDRarrays::blockageSummary() const
totVolBlock += v_block(ijk) * pdrBlock.V(ijk); totVolBlock += v_block(ijk) * pdrBlock.V(ijk);
totArea += surf(ijk); totArea += surf(ijk);
totCount += max(0, obs_count(ijk)); totCount += Foam::max(0, obs_count(ijk));
totDrag.x() += max(0, drag_s(ijk).xx()); totDrag.x() += Foam::max(0, drag_s(ijk).xx());
totDrag.y() += max(0, drag_s(ijk).yy()); totDrag.y() += Foam::max(0, drag_s(ijk).yy());
totDrag.z() += max(0, drag_s(ijk).zz()); totDrag.z() += Foam::max(0, drag_s(ijk).zz());
for (direction cmpt=0; cmpt < vector::nComponents; ++cmpt) for (direction cmpt=0; cmpt < vector::nComponents; ++cmpt)
{ {
totBlock[cmpt] += max(0, area_block_s(ijk)[cmpt]); totBlock[cmpt] += Foam::max(0, area_block_s(ijk)[cmpt]);
totBlock[cmpt] += max(0, area_block_r(ijk)[cmpt]); totBlock[cmpt] += Foam::max(0, area_block_r(ijk)[cmpt]);
} }
} }
} }

View File

@ -302,7 +302,7 @@ void Foam::PDRutils::circle_overlap
scalar da = ac - 0.5 * (a1 + a2); scalar da = ac - 0.5 * (a1 + a2);
scalar db = bc - 0.5 * (b1 + b2); scalar db = bc - 0.5 * (b1 + b2);
scalar dc = std::hypot(da, db); scalar dc = std::hypot(da, db);
scalar rat1 = min(max((dc / sqrt(area) - 0.3) * 1.4, 0), 1); scalar rat1 = Foam::min(Foam::max((dc / sqrt(area) - 0.3) * 1.4, 0), 1);
scalar drg0 = c_drag(ia,ib).xx(); scalar drg0 = c_drag(ia,ib).xx();
scalar drg1 = c_drag(ia,ib).yy(); scalar drg1 = c_drag(ia,ib).yy();
scalar drg = std::hypot(drg0, drg1); scalar drg = std::hypot(drg0, drg1);
@ -449,8 +449,8 @@ scalar block_overlap
{ {
PDRobstacle over; PDRobstacle over;
over.pt = max(blk1.pt, blk2.pt); over.pt = Foam::max(blk1.pt, blk2.pt);
over.span = min(max1, max2) - over.pt; over.span = Foam::min(max1, max2) - over.pt;
assert(cmptProduct(over.span) > 0.0); assert(cmptProduct(over.span) > 0.0);
@ -603,11 +603,11 @@ scalar block_cylinder_overlap
over.x() = a_centre - 0.5 * a_lblk; over.x() = a_centre - 0.5 * a_lblk;
over.y() = b_centre - 0.5 * b_lblk; over.y() = b_centre - 0.5 * b_lblk;
over.z() = max(blk1.z(), cyl2.z()); over.z() = Foam::max(blk1.z(), cyl2.z());
over.span.x() = a_lblk; over.span.x() = a_lblk;
over.span.y() = b_lblk; over.span.y() = b_lblk;
over.span.z() = min(max1.z(), cyl2.z() + cyl2.len()) - over.z(); over.span.z() = Foam::min(max1.z(), cyl2.z() + cyl2.len()) - over.z();
assert(over.x() > -200.0); assert(over.x() > -200.0);
assert(over.x() < 2000.0); assert(over.x() < 2000.0);
} }
@ -668,11 +668,11 @@ scalar block_cylinder_overlap
over.z() = a_centre - a_lblk * 0.5; over.z() = a_centre - a_lblk * 0.5;
over.x() = b_centre - b_lblk * 0.5; over.x() = b_centre - b_lblk * 0.5;
over.y() = max(blk1.y(), cyl2.y()); over.y() = Foam::max(blk1.y(), cyl2.y());
over.span.z() = a_lblk; over.span.z() = a_lblk;
over.span.x() = b_lblk; over.span.x() = b_lblk;
over.span.y() = min(max1.y(), cyl2.y() + cyl2.len()) - over.y(); over.span.y() = Foam::min(max1.y(), cyl2.y() + cyl2.len()) - over.y();
} }
break; break;
@ -734,11 +734,11 @@ scalar block_cylinder_overlap
over.y() = a_centre - a_lblk * 0.5; over.y() = a_centre - a_lblk * 0.5;
over.z() = b_centre - b_lblk * 0.5; over.z() = b_centre - b_lblk * 0.5;
over.x() = max(blk1.x(), cyl2.x()); over.x() = Foam::max(blk1.x(), cyl2.x());
over.span.y() = a_lblk; over.span.y() = a_lblk;
over.span.z() = b_lblk; over.span.z() = b_lblk;
over.span.x() = min(max1.x(), cyl2.x() + cyl2.len()) - over.x(); over.span.x() = Foam::min(max1.x(), cyl2.x() + cyl2.len()) - over.x();
} }
break; break;
} }

View File

@ -71,9 +71,9 @@ int main(int argc, char *argv[])
{ {
scalar b = j1(swirlProfile*r/cylinderRadius).value(); scalar b = j1(swirlProfile*r/cylinderRadius).value();
scalar vEff = omega*b; scalar vEff = omega*b;
r = max(r, SMALL); r = Foam::max(r, SMALL);
U[celli] = ((vEff/r)*(c & yT))*xT + (-(vEff/r)*(c & xT))*yT; U[celli] = ((vEff/r)*(c & yT))*xT + (-(vEff/r)*(c & xT))*yT;
Umax = max(Umax, mag(U[celli])); Umax = Foam::max(Umax, mag(U[celli]));
} }
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019-2021 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -238,7 +238,7 @@ void rewriteBoundary
patches.reorder(oldToNew); patches.reorder(oldToNew);
if (returnReduce(nOldCyclics, sumOp<label>()) > 0) if (returnReduceOr(nOldCyclics))
{ {
if (dryrun) if (dryrun)
{ {
@ -299,7 +299,7 @@ void rewriteField
dictionary& boundaryField = fieldDict.subDict("boundaryField"); dictionary& boundaryField = fieldDict.subDict("boundaryField");
label nChanged = 0; bool hasChange = false;
forAllConstIters(thisNames, iter) forAllConstIters(thisNames, iter)
{ {
@ -337,13 +337,13 @@ void rewriteField
); );
Info<< " Adding entry " << nbrNames[patchName] << endl; Info<< " Adding entry " << nbrNames[patchName] << endl;
nChanged++; hasChange = true;
} }
} }
//Info<< "New boundaryField:" << boundaryField << endl; //Info<< "New boundaryField:" << boundaryField << endl;
if (returnReduce(nChanged, sumOp<label>()) > 0) if (returnReduceOr(hasChange))
{ {
if (dryrun) if (dryrun)
{ {

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018-2019 OpenCFD Ltd. Copyright (C) 2018-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -113,10 +113,9 @@ void mapLagrangian(const meshToMesh& interp)
if if
( (
returnReduce returnReduceOr
( (
(objects.found("coordinates") || objects.found("positions")), objects.found("coordinates") || objects.found("positions")
orOp<bool>()
) )
) )
{ {

View File

@ -85,7 +85,7 @@ for (const int proci : Pstream::allProcs())
} }
} }
} while (returnReduce(i < myFc.size(), orOp<bool>())); } while (returnReduceOr(i < myFc.size()));
List<pointIndexHit> hitInfo(startIndex.size()); List<pointIndexHit> hitInfo(startIndex.size());
surfacesMesh.findLine(start, end, hitInfo); surfacesMesh.findLine(start, end, hitInfo);
@ -176,7 +176,7 @@ for (const int proci : Pstream::allProcs())
firstLoop = false; firstLoop = false;
iter ++; iter ++;
} while (returnReduce(hitInfo.size(), orOp<bool>()) > 0 && iter < 10); } while (returnReduceOr(hitInfo.size()) && iter < 10);
startIndex.clear(); startIndex.clear();
end.clear(); end.clear();

View File

@ -531,15 +531,10 @@ int main(int argc, char *argv[])
nFineFaces += patches[patchi].size(); nFineFaces += patches[patchi].size();
} }
// total number of coarse faces
label totalNCoarseFaces = nCoarseFaces;
reduce(totalNCoarseFaces, sumOp<label>()); Info<< "\nTotal number of coarse faces: "
<< returnReduce(nCoarseFaces, sumOp<label>())
if (Pstream::master()) << endl;
{
Info << "\nTotal number of coarse faces: "<< totalNCoarseFaces << endl;
}
if (Pstream::master() && debug) if (Pstream::master() && debug)
{ {
@ -829,15 +824,11 @@ int main(int argc, char *argv[])
nCoarseFaces nCoarseFaces
); );
label totalPatches = coarsePatches.size(); const label totalPatches =
reduce(totalPatches, maxOp<label>()); returnReduce(coarsePatches.size(), maxOp<label>());
// Matrix sum in j(Fij) for each i (if enclosure sum = 1) // Matrix sum in j(Fij) for each i (if enclosure sum = 1)
scalarSquareMatrix sumViewFactorPatch scalarSquareMatrix sumViewFactorPatch(totalPatches, Zero);
(
totalPatches,
0.0
);
scalarList patchArea(totalPatches, Zero); scalarList patchArea(totalPatches, Zero);

View File

@ -889,7 +889,7 @@ int main(int argc, char *argv[])
writeParts writeParts
( (
surf, surf,
min(outputThreshold, numZones), Foam::min(outputThreshold, numZones),
faceZone, faceZone,
surfFilePath, surfFilePath,
surfFileStem surfFileStem
@ -955,7 +955,7 @@ int main(int argc, char *argv[])
writeParts writeParts
( (
surf, surf,
min(outputThreshold, numNormalZones), Foam::min(outputThreshold, numNormalZones),
normalZone, normalZone,
surfFilePath, surfFilePath,
surfFileStem + "_normal" surfFileStem + "_normal"

View File

@ -290,7 +290,7 @@ int main(int argc, char *argv[])
const IOdictionary dict(dictIO); const IOdictionary dict(dictIO);
const scalar dist(args.get<scalar>(1)); const scalar dist(args.get<scalar>(1));
const scalar matchTolerance(max(1e-6*dist, SMALL)); const scalar matchTolerance(Foam::max(1e-6*dist, SMALL));
const label maxIters = 100; const label maxIters = 100;
Info<< "Hooking distance = " << dist << endl; Info<< "Hooking distance = " << dist << endl;

View File

@ -275,7 +275,7 @@ label detectIntersectionPoints
// 1. Extrusion offset vectors intersecting new surface location // 1. Extrusion offset vectors intersecting new surface location
{ {
scalar tol = max(tolerance, 10*s.tolerance()); scalar tol = Foam::max(tolerance, 10*s.tolerance());
// Collect all the edge vectors. Slightly shorten the edges to prevent // Collect all the edge vectors. Slightly shorten the edges to prevent
// finding lots of intersections. The fast triangle intersection routine // finding lots of intersections. The fast triangle intersection routine
@ -295,7 +295,7 @@ label detectIntersectionPoints
&& !localFaces[hits[pointI].index()].found(pointI) && !localFaces[hits[pointI].index()].found(pointI)
) )
{ {
scale[pointI] = max(0.0, scale[pointI]-0.2); scale[pointI] = Foam::max(0.0, scale[pointI]-0.2);
isPointOnHitEdge.set(pointI); isPointOnHitEdge.set(pointI);
nHits++; nHits++;
@ -328,7 +328,7 @@ label detectIntersectionPoints
<< pt << pt
<< endl; << endl;
scale[e[0]] = max(0.0, scale[e[0]]-0.2); scale[e[0]] = Foam::max(0.0, scale[e[0]]-0.2);
nHits++; nHits++;
} }
if (isPointOnHitEdge.set(e[1])) if (isPointOnHitEdge.set(e[1]))
@ -340,7 +340,7 @@ label detectIntersectionPoints
<< pt << pt
<< endl; << endl;
scale[e[1]] = max(0.0, scale[e[1]]-0.2); scale[e[1]] = Foam::max(0.0, scale[e[1]]-0.2);
nHits++; nHits++;
} }
} }
@ -416,7 +416,7 @@ void minSmooth
const edge& e = edges[edgeI]; const edge& e = edges[edgeI];
scalar w = mag(points[mp[e[0]]]-points[mp[e[1]]]); scalar w = mag(points[mp[e[0]]]-points[mp[e[1]]]);
edgeWeights[edgeI] = 1.0/(max(w, SMALL)); edgeWeights[edgeI] = 1.0/(Foam::max(w, SMALL));
} }
tmp<scalarField> tavgFld = avg(s, fld, edgeWeights); tmp<scalarField> tavgFld = avg(s, fld, edgeWeights);
@ -427,7 +427,7 @@ void minSmooth
{ {
if (isAffectedPoint.test(pointI)) if (isAffectedPoint.test(pointI))
{ {
newFld[pointI] = min newFld[pointI] = Foam::min
( (
fld[pointI], fld[pointI],
0.5*fld[pointI] + 0.5*avgFld[pointI] 0.5*fld[pointI] + 0.5*avgFld[pointI]

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2021 OpenCFD Ltd. Copyright (C) 2017-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -302,17 +302,19 @@ int main(int argc, char *argv[])
Pstream::mapCombineGather(patchSize, plusEqOp<label>()); Pstream::mapCombineGather(patchSize, plusEqOp<label>());
Pstream::mapCombineGather(zoneSize, plusEqOp<label>()); Pstream::mapCombineGather(zoneSize, plusEqOp<label>());
// Allocate compact numbering for all patches/faceZones if (Pstream::master())
forAllConstIters(patchSize, iter)
{ {
compactZoneID.insert(iter.key(), compactZoneID.size()); // Allocate compact numbering for all patches/faceZones
} forAllConstIters(patchSize, iter)
{
compactZoneID.insert(iter.key(), compactZoneID.size());
}
forAllConstIters(zoneSize, iter) forAllConstIters(zoneSize, iter)
{ {
compactZoneID.insert(iter.key(), compactZoneID.size()); compactZoneID.insert(iter.key(), compactZoneID.size());
}
} }
Pstream::broadcast(compactZoneID); Pstream::broadcast(compactZoneID);
@ -391,13 +393,9 @@ int main(int argc, char *argv[])
// Gather all faces // Gather all faces
List<faceList> gatheredFaces(Pstream::nProcs()); List<faceList> gatheredFaces(Pstream::nProcs());
gatheredFaces[Pstream::myProcNo()] = allBoundary.localFaces(); gatheredFaces[Pstream::myProcNo()] = allBoundary.localFaces();
forAll(gatheredFaces[Pstream::myProcNo()], i) for (face& f : gatheredFaces[Pstream::myProcNo()])
{ {
inplaceRenumber inplaceRenumber(pointToGlobal, f);
(
pointToGlobal,
gatheredFaces[Pstream::myProcNo()][i]
);
} }
Pstream::gatherList(gatheredFaces); Pstream::gatherList(gatheredFaces);

View File

@ -252,7 +252,7 @@ int main(int argc, char *argv[])
dict.add("bounds", bbs); dict.add("bounds", bbs);
// Scatter patch information // Scatter patch information
Pstream::scatter(s.patches()); Pstream::broadcast(s.patches());
// Construct distributedTrisurfaceMesh from components // Construct distributedTrisurfaceMesh from components
IOobject notReadIO(io); IOobject notReadIO(io);

View File

@ -180,8 +180,8 @@ int main(int argc, char *argv[])
scalar o2 = (1.0/equiv)*stoicO2; scalar o2 = (1.0/equiv)*stoicO2;
scalar n2 = (0.79/0.21)*o2; scalar n2 = (0.79/0.21)*o2;
scalar fres = max(1.0 - 1.0/equiv, 0.0); scalar fres = Foam::max(1.0 - 1.0/equiv, 0.0);
scalar ores = max(1.0/equiv - 1.0, 0.0); scalar ores = Foam::max(1.0/equiv - 1.0, 0.0);
scalar fburnt = 1.0 - fres; scalar fburnt = 1.0 - fres;
thermo reactants thermo reactants

View File

@ -196,12 +196,12 @@ int main(int argc, char *argv[])
// Number of moles of species for one mole of fuel // Number of moles of species for one mole of fuel
scalar o2 = (1.0/equiv)*stoicO2; scalar o2 = (1.0/equiv)*stoicO2;
scalar n2 = (0.79/0.21)*o2; scalar n2 = (0.79/0.21)*o2;
scalar fres = max(1.0 - 1.0/equiv, 0.0); scalar fres = Foam::max(1.0 - 1.0/equiv, 0.0);
scalar fburnt = 1.0 - fres; scalar fburnt = 1.0 - fres;
// Initial guess for number of moles of product species // Initial guess for number of moles of product species
// ignoring product dissociation // ignoring product dissociation
scalar oresInit = max(1.0/equiv - 1.0, 0.0)*stoicO2; scalar oresInit = Foam::max(1.0/equiv - 1.0, 0.0)*stoicO2;
scalar co2Init = fburnt*stoicCO2; scalar co2Init = fburnt*stoicCO2;
scalar h2oInit = fburnt*stoicH2O; scalar h2oInit = fburnt*stoicH2O;
@ -231,18 +231,18 @@ int main(int argc, char *argv[])
if (j > 0) if (j > 0)
{ {
co = co2* co = co2*
min Foam::min
( (
CO2BreakUp.Kn(P, equilibriumFlameTemperature, N) CO2BreakUp.Kn(P, equilibriumFlameTemperature, N)
/::sqrt(max(ores, 0.001)), /::sqrt(Foam::max(ores, 0.001)),
1.0 1.0
); );
h2 = h2o* h2 = h2o*
min Foam::min
( (
H2OBreakUp.Kn(P, equilibriumFlameTemperature, N) H2OBreakUp.Kn(P, equilibriumFlameTemperature, N)
/::sqrt(max(ores, 0.001)), /::sqrt(Foam::max(ores, 0.001)),
1.0 1.0
); );

View File

@ -49,7 +49,7 @@ void Foam::List<T>::doResize(const label len)
// With sign-check to avoid spurious -Walloc-size-larger-than // With sign-check to avoid spurious -Walloc-size-larger-than
T* nv = new T[len]; T* nv = new T[len];
const label overlap = min(this->size_, len); const label overlap = Foam::min(this->size_, len);
if (overlap) if (overlap)
{ {

View File

@ -202,7 +202,7 @@ void Foam::ParSortableList<Type>::sort()
getPivots(sortedPivots, pivots); getPivots(sortedPivots, pivots);
} }
Pstream::scatter(pivots); Pstream::broadcast(pivots);
if (debug) if (debug)
{ {

View File

@ -90,12 +90,10 @@ void Foam::IOobjectList::syncNames(wordList& objNames)
if (Pstream::parRun()) if (Pstream::parRun())
{ {
// Synchronize names // Synchronize names
Pstream::combineGather(objNames, ListOps::uniqueEqOp<word>()); Pstream::combineReduce(objNames, ListOps::uniqueEqOp<word>());
Pstream::broadcast(objNames);
} }
// Consistent order on all processors Foam::sort(objNames); // Consistent order
Foam::sort(objNames);
} }

View File

@ -482,7 +482,7 @@ bool Foam::PstreamBuffers::finishedSends
} }
} }
reduce(changed, orOp<bool>()); UPstream::reduceOr(changed);
if (changed) if (changed)
{ {

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018-2021 OpenCFD Ltd. Copyright (C) 2018-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -317,7 +317,7 @@ Foam::functionEntries::codeStream::getFunction
bool haveLib = lib; bool haveLib = lib;
if (!doingMasterOnlyReading(topDict)) if (!doingMasterOnlyReading(topDict))
{ {
reduce(haveLib, andOp<bool>()); Pstream::reduceAnd(haveLib);
} }
if (!haveLib) if (!haveLib)

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2021 OpenCFD Ltd. Copyright (C) 2016-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -332,7 +332,8 @@ void Foam::codedBase::createLibrary
<< " after waiting: have masterSize:" << masterSize << " after waiting: have masterSize:" << masterSize
<< " and localSize:" << mySize << endl; << " and localSize:" << mySize << endl;
} }
reduce(create, orOp<bool>());
Pstream::reduceOr(create); // MPI barrier
} }

View File

@ -1171,7 +1171,7 @@ bool Foam::functionObjectList::read()
FatalIOError.throwing(oldThrowingIOerr); FatalIOError.throwing(oldThrowingIOerr);
// Require valid functionObject on all processors // Require valid functionObject on all processors
if (!returnReduce(bool(objPtr), andOp<bool>())) if (!returnReduceAnd(bool(objPtr)))
{ {
objPtr.reset(nullptr); objPtr.reset(nullptr);
ok = false; ok = false;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2010-2018 Bernhard Gschaider Copyright (C) 2010-2018 Bernhard Gschaider
Copyright (C) 2019-2021 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -309,8 +309,7 @@ bool Foam::expressions::exprDriver::isLocalVariable
// Do size checking if requested // Do size checking if requested
if (good && expectedSize >= 0) if (good && expectedSize >= 0)
{ {
good = (var.size() == expectedSize); good = returnReduceAnd(var.size() == expectedSize);
reduce(good, andOp<bool>());
if (debug && !good) if (debug && !good)
{ {

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2019-2020 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -52,7 +52,7 @@ Foam::expressions::fieldExpr::parseDriver::getField
const label len = (hasPointData ? this->pointSize() : this->size()); const label len = (hasPointData ? this->pointSize() : this->size());
if (returnReduce((vals.size() == len), andOp<bool>())) if (returnReduceAnd(vals.size() == len))
{ {
// Return a copy of the field // Return a copy of the field
return tmp<Field<Type>>::New(vals); return tmp<Field<Type>>::New(vals);

View File

@ -579,7 +579,7 @@ template<class Type> \
ReturnType gFunc(const UList<Type>& f, const label comm) \ ReturnType gFunc(const UList<Type>& f, const label comm) \
{ \ { \
ReturnType res = Func(f); \ ReturnType res = Func(f); \
reduce(res, rFunc##Op<ReturnType>(), Pstream::msgType(), comm); \ reduce(res, rFunc##Op<ReturnType>(), UPstream::msgType(), comm); \
return res; \ return res; \
} \ } \
TMP_UNARY_FUNCTION(ReturnType, gFunc) TMP_UNARY_FUNCTION(ReturnType, gFunc)
@ -611,7 +611,7 @@ typename scalarProduct<Type, Type>::type gSumProd
typedef typename scalarProduct<Type, Type>::type prodType; typedef typename scalarProduct<Type, Type>::type prodType;
prodType result = sumProd(f1, f2); prodType result = sumProd(f1, f2);
reduce(result, sumOp<prodType>(), Pstream::msgType(), comm); reduce(result, sumOp<prodType>(), UPstream::msgType(), comm);
return result; return result;
} }
@ -624,7 +624,7 @@ Type gSumCmptProd
) )
{ {
Type SumProd = sumCmptProd(f1, f2); Type SumProd = sumCmptProd(f1, f2);
reduce(SumProd, sumOp<Type>(), Pstream::msgType(), comm); reduce(SumProd, sumOp<Type>(), UPstream::msgType(), comm);
return SumProd; return SumProd;
} }
@ -637,7 +637,7 @@ Type gAverage
{ {
label n = f.size(); label n = f.size();
Type s = sum(f); Type s = sum(f);
sumReduce(s, n, Pstream::msgType(), comm); sumReduce(s, n, UPstream::msgType(), comm);
if (n > 0) if (n > 0)
{ {

View File

@ -172,7 +172,7 @@ Foam::Tuple2<T1,T2> Foam::FieldOps::findMinData
result.second() = data[i]; result.second() = data[i];
} }
Pstream::combineAllGather(result, minFirstEqOp<T1>()); Pstream::combineReduce(result, minFirstEqOp<T1>());
return result; return result;
} }
@ -193,7 +193,7 @@ Foam::Tuple2<T1,T2> Foam::FieldOps::findMaxData
result.second() = data[i]; result.second() = data[i];
} }
Pstream::combineAllGather(result, maxFirstEqOp<T1>()); Pstream::combineReduce(result, maxFirstEqOp<T1>());
return result; return result;
} }

View File

@ -1077,18 +1077,16 @@ bool Foam::GeometricField<Type, PatchField, GeoMesh>::needReference() const
bool needRef = true; bool needRef = true;
forAll(boundaryField_, patchi) for (const auto& pf : boundaryField_)
{ {
if (boundaryField_[patchi].fixesValue()) if (pf.fixesValue())
{ {
needRef = false; needRef = false;
break; break;
} }
} }
reduce(needRef, andOp<bool>()); return returnReduceAnd(needRef);
return needRef;
} }

View File

@ -2032,7 +2032,7 @@ Foam::fileOperations::masterUncollatedFileOperation::readStream
} }
// Reduce (not broadcast) // Reduce (not broadcast)
// - if we have multiple master files (FUTURE) // - if we have multiple master files (FUTURE)
reduce(bigSize, orOp<bool>()); //, UPstream::msgType(), comm_); Pstream::reduceOr(bigSize); //, comm_);
const UPstream::commsTypes myCommsType const UPstream::commsTypes myCommsType
( (

Some files were not shown because too many files have changed in this diff Show More