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)
{
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
(
min
Foam::min
(
deltaTFact*runTime.deltaTValue(),
maxDeltaT

View File

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

View File

@ -54,9 +54,9 @@ if (adjustTimeStep)
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
)
);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -36,13 +36,13 @@ Description
if (adjustTimeStep)
{
const scalar maxDeltaTFact =
min(maxCo/(CoNum + SMALL), maxCo/(surfaceFilm.CourantNumber() + SMALL));
Foam::min(maxCo/(CoNum + SMALL), maxCo/(surfaceFilm.CourantNumber() + SMALL));
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
(
min
Foam::min
(
deltaTFact*runTime.deltaTValue(),
maxDeltaT

View File

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

View File

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

View File

@ -36,13 +36,13 @@ Description
if (adjustTimeStep)
{
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
(
min
Foam::min
(
deltaTFact*runTime.deltaTValue(),
maxDeltaT

View File

@ -36,13 +36,13 @@ Description
if (adjustTimeStep)
{
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
(
min
Foam::min
(
deltaTFact*runTime.deltaTValue(),
maxDeltaT

View File

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

View File

@ -26,12 +26,12 @@ forAll(dgdt, celli)
{
if (dgdt[celli] > 0.0)
{
Sp[celli] -= dgdt[celli]/max(1.0 - alpha1[celli], 1e-4);
Su[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]/Foam::max(1.0 - alpha1[celli], 1e-4);
}
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
#include "alphaSuSp.H"
advector.advect(Sp,(Su + divU*min(alpha1(), scalar(1)))());
advector.advect(Sp,(Su + divU*Foam::min(alpha1(), scalar(1)))());
// Update rhoPhi
rhoPhi = advector.getRhoPhi(rho1, rho2);
@ -10,6 +10,6 @@ alpha2 = 1.0 - alpha1;
Info<< "Phase-1 volume fraction = "
<< alpha1.weightedAverage(mesh.Vsc()).value()
<< " Min(" << alpha1.name() << ") = " << min(alpha1).value()
<< " Max(" << alpha1.name() << ") - 1 = " << max(alpha1).value() - 1
<< " Min(" << alpha1.name() << ") = " << Foam::min(alpha1).value()
<< " Max(" << alpha1.name() << ") - 1 = " << Foam::max(alpha1).value() - 1
<< endl;

View File

@ -26,12 +26,12 @@ forAll(dgdt, celli)
{
if (dgdt[celli] > 0.0)
{
Sp[celli] -= dgdt[celli]/max(1.0 - alpha1[celli], 1e-4);
Su[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]/Foam::max(1.0 - alpha1[celli], 1e-4);
}
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)
{
Sp[celli] -= dgdt[celli]/max(1.0 - alpha1[celli], 1e-4);
Su[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]/Foam::max(1.0 - alpha1[celli], 1e-4);
}
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_ = true;
}
reflectionSwitch_ = returnReduce(reflectionSwitch_, orOp<bool>());
reflectionSwitch_ = returnReduceOr(reflections_.size());
}
}
@ -299,14 +294,12 @@ void Foam::radiation::laserDTRM::initialise()
DTRMCloud_.addParticle(pPtr);
}
if (returnReduce(cellI, maxOp<label>()) == -1)
if (nMissed < 10 && returnReduceAnd(cellI < 0))
{
if (++nMissed <= 10)
{
WarningInFunction
<< "Cannot find owner cell for focalPoint at "
<< p0 << endl;
}
++nMissed;
WarningInFunction
<< "Cannot find owner cell for focalPoint at "
<< p0 << endl;
}
}
}

View File

@ -36,13 +36,13 @@ Description
if (adjustTimeStep)
{
scalar maxDeltaTFact =
min
Foam::min
(
maxCo/(CoNum + SMALL),
min
Foam::min
(
maxAlphaCo/(alphaCoNum + SMALL),
min
Foam::min
(
maxAlphaDdt/(ddtAlphaNum + 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
(
min
Foam::min
(
deltaTFact*runTime.deltaTValue(),
maxDeltaT

View File

@ -8,5 +8,5 @@
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;
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;
Info<< "Level : " << level << endl
<< returnReduce(addr.size(), sumOp<label>()) << endl
<< " current size : "
<< returnReduce(addr.size(), sumOp<label>()) << endl
<< " agglomerated size : "

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -125,13 +125,13 @@ int main(int argc, char *argv[])
scalar data1 = 1.0;
label request1 = -1;
{
Foam::reduce(data1, sumOp<scalar>(), Pstream::msgType(), request1);
Foam::reduce(data1, sumOp<scalar>(), UPstream::msgType(), request1);
}
scalar data2 = 0.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.
label findPatch(const polyBoundaryMesh& patches, const word& patchName)
{
label patchi = patches.findPatchID(patchName);
const label patchi = patches.findPatchID(patchName);
if (patchi == -1)
{
@ -597,16 +597,15 @@ label findPatch(const polyBoundaryMesh& patches, const word& patchName)
// Check same patch for all procs
{
label newPatch = patchi;
reduce(newPatch, minOp<label>());
const label newPatchi = returnReduce(patchi, minOp<label>());
if (newPatch != patchi)
if (newPatchi != patchi)
{
FatalErrorInFunction
<< "Patch " << patchName
<< " should have the same patch index on all processors." << nl
<< "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);
}
}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -396,12 +397,11 @@ int main(int argc, char *argv[])
meshSearch queryMesh(mesh);
// 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 (returnReduce(celli, maxOp<label>()) == -1)
if (returnReduceAnd(celli < 0))
{
FatalErrorInFunction
<< "outsidePoint " << outsidePoint

View File

@ -142,26 +142,26 @@ scalar getEdgeStats(const primitiveMesh& mesh, const direction excludeCmpt)
if (mag(eVec & x) > 1-edgeTol)
{
minX = min(minX, eMag);
maxX = max(maxX, eMag);
minX = Foam::min(minX, eMag);
maxX = Foam::max(maxX, eMag);
nX++;
}
else if (mag(eVec & y) > 1-edgeTol)
{
minY = min(minY, eMag);
maxY = max(maxY, eMag);
minY = Foam::min(minY, eMag);
maxY = Foam::max(maxY, eMag);
nY++;
}
else if (mag(eVec & z) > 1-edgeTol)
{
minZ = min(minZ, eMag);
maxZ = max(maxZ, eMag);
minZ = Foam::min(minZ, eMag);
maxZ = Foam::max(maxZ, eMag);
nZ++;
}
else
{
minOther = min(minOther, eMag);
maxOther = max(maxOther, eMag);
minOther = Foam::min(minOther, eMag);
maxOther = Foam::max(maxOther, eMag);
}
}
@ -179,19 +179,19 @@ scalar getEdgeStats(const primitiveMesh& mesh, const direction excludeCmpt)
if (excludeCmpt == 0)
{
return min(minY, min(minZ, minOther));
return Foam::min(minY, Foam::min(minZ, minOther));
}
else if (excludeCmpt == 1)
{
return min(minX, min(minZ, minOther));
return Foam::min(minX, Foam::min(minZ, minOther));
}
else if (excludeCmpt == 2)
{
return min(minX, min(minY, minOther));
return Foam::min(minX, Foam::min(minY, minOther));
}
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 "
<< refLevel.objectPath() << nl
<< " min level : " << min(refLevel) << nl
<< " min level : " << Foam::min(refLevel) << nl
<< " max level : " << maxLevel << nl
<< endl;
}

View File

@ -271,7 +271,7 @@ int main(int argc, char *argv[])
if (blockPFacePointi != blockPFacePointi2)
{
sqrMergeTol =
min
Foam::min
(
sqrMergeTol,
magSqr
@ -338,16 +338,16 @@ int main(int argc, char *argv[])
blockNFacePoints[blockNFacePointi]
+ blockOffsets[blockNlabel];
label minPN = min(PpointLabel, NpointLabel);
label minPN = Foam::min(PpointLabel, NpointLabel);
if (pointMergeList[PpointLabel] != -1)
{
minPN = min(minPN, pointMergeList[PpointLabel]);
minPN = Foam::min(minPN, pointMergeList[PpointLabel]);
}
if (pointMergeList[NpointLabel] != -1)
{
minPN = min(minPN, pointMergeList[NpointLabel]);
minPN = Foam::min(minPN, pointMergeList[NpointLabel]);
}
pointMergeList[PpointLabel]
@ -411,7 +411,7 @@ int main(int argc, char *argv[])
pointMergeList[PpointLabel]
= pointMergeList[NpointLabel]
= min
= Foam::min
(
pointMergeList[PpointLabel],
pointMergeList[NpointLabel]
@ -757,7 +757,7 @@ int main(int argc, char *argv[])
);
// 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;
pShapeMesh.removeFiles();

View File

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

View File

@ -269,7 +269,7 @@ void readCells
label maxUnvPoint = 0;
forAll(unvPointID, pointi)
{
maxUnvPoint = max(maxUnvPoint, unvPointID[pointi]);
maxUnvPoint = Foam::max(maxUnvPoint, unvPointID[pointi]);
}
labelList unvToFoam(invert(maxUnvPoint+1, unvPointID));
@ -784,7 +784,7 @@ int main(int argc, char *argv[])
label maxUnvPoint = 0;
forAll(unvPointID, pointi)
{
maxUnvPoint = max(maxUnvPoint, unvPointID[pointi]);
maxUnvPoint = Foam::max(maxUnvPoint, unvPointID[pointi]);
}
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
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));
IOstream::defaultPrecision(Foam::max(10u, IOstream::defaultPrecision()));
mesh.write();

View File

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

View File

@ -148,7 +148,7 @@ for (label i=0; i<nPoints; i++)
end = pointMap[end];
}
label minLabel = min(start, end);
label minLabel = Foam::min(start, end);
pointMap[start] = pointMap[end] = minLabel;
}
@ -331,7 +331,7 @@ if
{
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;
forAll(pf, pfi)
{
minfz = min(minfz, points[pf[pfi]].z());
minfz = Foam::min(minfz, points[pf[pfi]].z());
}
if (minfz > minz)
@ -371,7 +371,7 @@ if
scalar minfz = GREAT;
forAll(pf, pfi)
{
minfz = min(minfz, points[pf[pfi]].z());
minfz = Foam::min(minfz, points[pf[pfi]].z());
}
if (minfz < zHeadMin)
@ -570,7 +570,7 @@ polyMesh pShapeMesh
);
// 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;
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);
@ -319,7 +319,7 @@ int main(int argc, char *argv[])
);
// 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;
mesh.removeFiles();

View File

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

View File

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

View File

@ -588,9 +588,8 @@ Foam::label Foam::DistributedDelaunayMesh<Triangulation>::referVertices
reduce(preInsertionSize, sumOp<label>());
reduce(postInsertionSize, sumOp<label>());
label nTotalToInsert = referredVertices.size();
reduce(nTotalToInsert, sumOp<label>());
label nTotalToInsert =
returnReduce(referredVertices.size(), sumOp<label>());
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;
}
@ -878,7 +878,7 @@ Foam::backgroundMeshDecomposition::distribute
}
}
if (returnReduce(cellsToRefine.size(), sumOp<label>()) == 0)
if (returnReduceAnd(cellsToRefine.empty()))
{
break;
}

View File

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

View File

@ -753,7 +753,7 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints
forAll(patches, p)
{
label totalPatchSize = patchDicts[p].get<label>("nFaces");
label nPatchFaces = patchDicts[p].get<label>("nFaces");
if
(
@ -762,7 +762,7 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints
)
{
// Do not create empty processor patches
if (totalPatchSize > 0)
if (nPatchFaces)
{
patchDicts[p].set("transform", "coincidentFullMatch");
@ -781,9 +781,8 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints
else
{
// Check that the patch is not empty on every processor
reduce(totalPatchSize, sumOp<label>());
if (totalPatchSize > 0)
if (returnReduceOr(nPatchFaces))
{
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)
{
@ -816,7 +816,7 @@ Foam::label Foam::conformalVoronoiMesh::synchroniseEdgeTrees
}
}
Pstream::listCombineAllGather(hits, plusEqOp<labelHashSet>());
Pstream::listCombineReduce(hits, plusEqOp<labelHashSet>());
forAll(featureEdgeHits, eI)
{

View File

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

View File

@ -416,10 +416,12 @@ void extractSurface
// Allocate zone/patch for all patches
HashTable<label> compactZoneID(1024);
forAllConstIters(patchSize, iter)
if (Pstream::master())
{
label sz = compactZoneID.size();
compactZoneID.insert(iter.key(), sz);
forAllConstIters(patchSize, iter)
{
compactZoneID.insert(iter.key(), compactZoneID.size());
}
}
Pstream::broadcast(compactZoneID);
@ -431,7 +433,7 @@ void extractSurface
label patchi = bMesh.findPatchID(iter.key());
if (patchi != -1)
{
patchToCompactZone[patchi] = iter();
patchToCompactZone[patchi] = iter.val();
}
}
@ -663,7 +665,7 @@ void removeZeroSizedPatches(fvMesh& mesh)
if
(
isA<coupledPolyPatch>(pp)
|| returnReduce(pp.size(), sumOp<label>())
|| returnReduceOr(pp.size())
)
{
// 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
bool preBalance = returnReduce
(
(mesh.nCells() >= refineParams.maxLocalCells()),
orOp<bool>()
);
const bool preBalance =
returnReduceOr(mesh.nCells() >= refineParams.maxLocalCells());
if (!overwrite && !debugLevel)

View File

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

View File

@ -27,7 +27,7 @@ void maxFaceToCell
const cell& cFaces = cells[cellI];
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];
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
forAll(own, facei)
{
cellFld[own[facei]] = min(cellFld[own[facei]], faceData[facei]);
cellFld[nei[facei]] = min(cellFld[nei[facei]], faceData[facei]);
cellFld[own[facei]] = Foam::min(cellFld[own[facei]], faceData[facei]);
cellFld[nei[facei]] = Foam::min(cellFld[nei[facei]], faceData[facei]);
}
// Patch faces
@ -100,7 +100,7 @@ void minFaceToCell
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
(
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,
fc
).quality();
ownVol = min(ownVol, tetQual);
ownVol = Foam::min(ownVol, tetQual);
}
}
if (mesh.isInternalFace(facei))
@ -556,7 +556,7 @@ void Foam::writeFields
fc,
neiCc
).quality();
neiVol = min(neiVol, tetQual);
neiVol = Foam::min(neiVol, tetQual);
}
}
}
@ -608,8 +608,8 @@ void Foam::writeFields
// Internal faces
forAll(own, facei)
{
cellFld[own[facei]] = min(cellFld[own[facei]], ownPyrVol[facei]);
cellFld[nei[facei]] = min(cellFld[nei[facei]], neiPyrVol[facei]);
cellFld[own[facei]] = Foam::min(cellFld[own[facei]], ownPyrVol[facei]);
cellFld[nei[facei]] = Foam::min(cellFld[nei[facei]], neiPyrVol[facei]);
}
// Patch faces
@ -620,7 +620,7 @@ void Foam::writeFields
forAll(fc, i)
{
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)
{
scalarField minFacePyrVol(neiPyrVol);
minFacePyrVol = min
minFacePyrVol = Foam::min
(
minFacePyrVol,
SubField<scalar>(ownPyrVol, mesh.nInternalFaces())

View File

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

View File

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

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
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;
}

View File

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

View File

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

View File

@ -320,10 +320,10 @@ bool doCommand
const globalMeshData& parData = mesh.globalData();
label typSize =
max
Foam::max
(
parData.nTotalCells(),
max
Foam::max
(
parData.nTotalFaces(),
parData.nTotalPoints()
@ -375,7 +375,7 @@ bool doCommand
topoSet& currentSet = currentSetPtr();
// 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
(
min(ownRegion, neiRegion),
max(ownRegion, neiRegion)
Foam::min(ownRegion, neiRegion),
Foam::max(ownRegion, neiRegion)
);
auto iter = regionsToSize.find(interface);
@ -544,8 +544,8 @@ void getInterfaceSizes
edge interface
(
min(ownRegion, neiRegion),
max(ownRegion, neiRegion)
Foam::min(ownRegion, neiRegion),
Foam::max(ownRegion, neiRegion)
);
faceToInterface[facei] = regionsToInterface[interface][zoneID];
@ -567,8 +567,8 @@ void getInterfaceSizes
edge interface
(
min(ownRegion, neiRegion),
max(ownRegion, neiRegion)
Foam::min(ownRegion, neiRegion),
Foam::max(ownRegion, neiRegion)
);
faceToInterface[facei] = regionsToInterface[interface][zoneID];
@ -847,7 +847,7 @@ void createAndWriteRegion
if (!isA<processorPolyPatch>(pp))
{
if (returnReduce(pp.size(), sumOp<label>()) > 0)
if (returnReduceOr(pp.size()))
{
oldToNew[patchi] = newI;
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
label regionI = findMax(cellsInZone);

View File

@ -345,7 +345,7 @@ void subsetTopoSets
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)
{

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1056,7 +1056,7 @@ void calc_drag_etc
const scalar expon =
(
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
);
@ -1114,16 +1114,16 @@ void Foam::PDRarrays::blockageSummary() const
totVolBlock += v_block(ijk) * pdrBlock.V(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.y() += max(0, drag_s(ijk).yy());
totDrag.z() += max(0, drag_s(ijk).zz());
totDrag.x() += Foam::max(0, drag_s(ijk).xx());
totDrag.y() += Foam::max(0, drag_s(ijk).yy());
totDrag.z() += Foam::max(0, drag_s(ijk).zz());
for (direction cmpt=0; cmpt < vector::nComponents; ++cmpt)
{
totBlock[cmpt] += max(0, area_block_s(ijk)[cmpt]);
totBlock[cmpt] += max(0, area_block_r(ijk)[cmpt]);
totBlock[cmpt] += Foam::max(0, area_block_s(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 db = bc - 0.5 * (b1 + b2);
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 drg1 = c_drag(ia,ib).yy();
scalar drg = std::hypot(drg0, drg1);
@ -449,8 +449,8 @@ scalar block_overlap
{
PDRobstacle over;
over.pt = max(blk1.pt, blk2.pt);
over.span = min(max1, max2) - over.pt;
over.pt = Foam::max(blk1.pt, blk2.pt);
over.span = Foam::min(max1, max2) - over.pt;
assert(cmptProduct(over.span) > 0.0);
@ -603,11 +603,11 @@ scalar block_cylinder_overlap
over.x() = a_centre - 0.5 * a_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.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() < 2000.0);
}
@ -668,11 +668,11 @@ scalar block_cylinder_overlap
over.z() = a_centre - a_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.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;
@ -734,11 +734,11 @@ scalar block_cylinder_overlap
over.y() = a_centre - a_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.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;
}

View File

@ -71,9 +71,9 @@ int main(int argc, char *argv[])
{
scalar b = j1(swirlProfile*r/cylinderRadius).value();
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;
Umax = max(Umax, mag(U[celli]));
Umax = Foam::max(Umax, mag(U[celli]));
}
}

View File

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

View File

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

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

View File

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

View File

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

View File

@ -290,7 +290,7 @@ int main(int argc, char *argv[])
const IOdictionary dict(dictIO);
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;
Info<< "Hooking distance = " << dist << endl;

View File

@ -275,7 +275,7 @@ label detectIntersectionPoints
// 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
// finding lots of intersections. The fast triangle intersection routine
@ -295,7 +295,7 @@ label detectIntersectionPoints
&& !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);
nHits++;
@ -328,7 +328,7 @@ label detectIntersectionPoints
<< pt
<< 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++;
}
if (isPointOnHitEdge.set(e[1]))
@ -340,7 +340,7 @@ label detectIntersectionPoints
<< pt
<< 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++;
}
}
@ -416,7 +416,7 @@ void minSmooth
const edge& e = edges[edgeI];
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);
@ -427,7 +427,7 @@ void minSmooth
{
if (isAffectedPoint.test(pointI))
{
newFld[pointI] = min
newFld[pointI] = Foam::min
(
fld[pointI],
0.5*fld[pointI] + 0.5*avgFld[pointI]

View File

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

View File

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

View File

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

View File

@ -196,12 +196,12 @@ int main(int argc, char *argv[])
// Number of moles of species for one mole of fuel
scalar o2 = (1.0/equiv)*stoicO2;
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;
// Initial guess for number of moles of product species
// 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 h2oInit = fburnt*stoicH2O;
@ -231,18 +231,18 @@ int main(int argc, char *argv[])
if (j > 0)
{
co = co2*
min
Foam::min
(
CO2BreakUp.Kn(P, equilibriumFlameTemperature, N)
/::sqrt(max(ores, 0.001)),
/::sqrt(Foam::max(ores, 0.001)),
1.0
);
h2 = h2o*
min
Foam::min
(
H2OBreakUp.Kn(P, equilibriumFlameTemperature, N)
/::sqrt(max(ores, 0.001)),
/::sqrt(Foam::max(ores, 0.001)),
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
T* nv = new T[len];
const label overlap = min(this->size_, len);
const label overlap = Foam::min(this->size_, len);
if (overlap)
{

View File

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

View File

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

View File

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

View File

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

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2021 OpenCFD Ltd.
Copyright (C) 2016-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -332,7 +332,8 @@ void Foam::codedBase::createLibrary
<< " after waiting: have masterSize:" << masterSize
<< " 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);
// Require valid functionObject on all processors
if (!returnReduce(bool(objPtr), andOp<bool>()))
if (!returnReduceAnd(bool(objPtr)))
{
objPtr.reset(nullptr);
ok = false;

View File

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

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -52,7 +52,7 @@ Foam::expressions::fieldExpr::parseDriver::getField
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 tmp<Field<Type>>::New(vals);

View File

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

View File

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

View File

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

View File

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

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