ENH: use returnReduceAnd(), returnReduceOr() functions

DOC: document which MPI send/recv are associated with commType
This commit is contained in:
Mark Olesen
2022-08-24 12:00:44 +02:00
committed by Andrew Heather
parent 473e14418a
commit 70208a7399
172 changed files with 574 additions and 840 deletions

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,10 +294,9 @@ void Foam::radiation::laserDTRM::initialise()
DTRMCloud_.addParticle(pPtr);
}
if (returnReduce(cellI, maxOp<label>()) == -1)
{
if (++nMissed <= 10)
if (nMissed < 10 && returnReduceAnd(cellI < 0))
{
++nMissed;
WarningInFunction
<< "Cannot find owner cell for focalPoint at "
<< p0 << endl;
@ -310,7 +304,6 @@ void Foam::radiation::laserDTRM::initialise()
}
}
}
}
else
{
FatalErrorInFunction

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

@ -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

@ -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()

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

@ -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

@ -665,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
@ -1891,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)
{
@ -635,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

@ -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();

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

@ -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.
@ -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

@ -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))

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;
}

View File

@ -88,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_)
@ -195,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_)
@ -344,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

@ -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)
)
)
{

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

@ -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

@ -64,7 +64,7 @@ if (doLagrangian)
isCloud = true;
}
if (!returnReduce(isCloud, orOp<bool>()))
if (!returnReduceOr(isCloud))
{
continue;
}
@ -76,7 +76,7 @@ if (doLagrangian)
);
// Are there cloud fields (globally)?
if (returnReduce(cloudObjs.empty(), andOp<bool>()))
if (returnReduceAnd(cloudObjs.empty()))
{
continue;
}

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

@ -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

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

View File

@ -327,7 +327,7 @@ public:
// \return True on success
static bool write
(
const commsTypes commsType,
const UPstream::commsTypes commsType,
const int toProcNo,
const char* buf,
const std::streamsize bufSize,

View File

@ -434,7 +434,7 @@ Foam::UPstream::commsTypes Foam::UPstream::defaultCommsType
namespace Foam
{
// Register re-reader
//- Registered reader for UPstream::defaultCommsType
class addcommsTypeToOpt
:
public ::Foam::simpleRegIOobject

View File

@ -66,12 +66,12 @@ public:
//- Types of communications
enum class commsTypes : char
{
blocking, //!< "blocking"
scheduled, //!< "scheduled"
nonBlocking //!< "nonBlocking"
blocking, //!< "blocking" : (MPI_Bsend, MPI_Recv)
scheduled, //!< "scheduled" : (MPI_Send, MPI_Recv)
nonBlocking //!< "nonBlocking" : (MPI_Isend, MPI_Irecv)
};
//- Names of the communication types
//- Enumerated names for the communication types
static const Enum<commsTypes> commsTypeNames;

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

@ -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
(

View File

@ -208,9 +208,9 @@ bool Foam::procFacesGAMGProcAgglomeration::doProcessorAgglomeration
const lduMesh& mesh
) const
{
// Check the need for further agglomeration on all processors
// Check the need for further agglomeration on any processors
bool doAgg = mesh.lduAddr().size() < nAgglomeratingCells_;
mesh.reduce(doAgg, orOp<bool>());
UPstream::reduceOr(doAgg, mesh.comm());
return doAgg;
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -276,7 +276,7 @@ bool Foam::globalPoints::mergeInfo
// Updates database of current information on meshpoints with nbrInfo. Uses
// mergeInfo above. Returns true if data kept for meshPointi changed.
label infoChanged = false;
bool infoChanged = false;
// Get the index into the procPoints list.
const auto iter = meshToProcPoint_.cfind(localPointi);
@ -325,7 +325,7 @@ bool Foam::globalPoints::storeInitialInfo
// Updates database of current information on meshpoints with nbrInfo. Uses
// mergeInfo above. Returns true if data kept for meshPointi changed.
label infoChanged = false;
bool infoChanged = false;
// Get the index into the procPoints list.
const auto iter = meshToProcPoint_.find(localPointi);
@ -929,8 +929,7 @@ void Foam::globalPoints::calculateSharedPoints
neighbourList = meshToProcPoint_;
}
// Exchange until nothing changes on all processors.
bool changed = false;
// Exchange until nothing changes on any processors.
do
{
@ -959,10 +958,7 @@ void Foam::globalPoints::calculateSharedPoints
changedPoints
);
changed = changedPoints.size() > 0;
reduce(changed, orOp<bool>());
} while (changed);
} while (returnReduceOr(changedPoints.size()));
//Pout<< "**ALL** connected points:" << endl;

View File

@ -1046,9 +1046,7 @@ bool Foam::polyBoundaryMesh::checkParallelSync(const bool report) const
}
// Reduce (not broadcast) to respect local out-of-order errors (first loop)
reduce(hasError, orOp<bool>());
return hasError;
return returnReduceOr(hasError);
}
@ -1091,7 +1089,7 @@ bool Foam::polyBoundaryMesh::checkDefinition(const bool report) const
nextPatchStart += bm[patchi].size();
}
reduce(hasError, orOp<bool>());
Pstream::reduceOr(hasError);
if (debug || report)
{

View File

@ -62,8 +62,8 @@ void Foam::polyMesh::calcDirections() const
// Knock out empty and wedge directions. Note:they will be present on all
// domains.
label nEmptyPatches = 0;
label nWedgePatches = 0;
bool hasEmptyPatches = false;
bool hasWedgePatches = false;
vector emptyDirVec = Zero;
vector wedgeDirVec = Zero;
@ -79,7 +79,7 @@ void Foam::polyMesh::calcDirections() const
if (pp.size())
{
nEmptyPatches++;
hasEmptyPatches = true;
emptyDirVec += sum(cmptMag(fa));
}
}
@ -93,16 +93,14 @@ void Foam::polyMesh::calcDirections() const
if (pp.size())
{
nWedgePatches++;
hasWedgePatches = true;
wedgeDirVec += cmptMag(wpp.centreNormal());
}
}
}
reduce(nEmptyPatches, maxOp<label>());
reduce(nWedgePatches, maxOp<label>());
if (nEmptyPatches)
if (returnReduceOr(hasEmptyPatches))
{
reduce(emptyDirVec, sumOp<vector>());
@ -126,7 +124,7 @@ void Foam::polyMesh::calcDirections() const
geometricD_ = solutionD_;
if (nWedgePatches)
if (returnReduceOr(hasWedgePatches))
{
reduce(wedgeDirVec, sumOp<vector>());
@ -339,21 +337,21 @@ Foam::polyMesh::polyMesh(const IOobject& io, const bool doInit)
neighbour_.write();
}
// Warn if global empty mesh
if (returnReduce(boundary_.empty(), orOp<bool>()))
if (returnReduceOr(boundary_.empty()))
{
WarningInFunction
<< "mesh missing boundary on one or more domains" << endl;
<< "Missing mesh boundary on one or more domains" << endl;
if (returnReduce(nPoints(), sumOp<label>()) == 0)
// Warn if global empty mesh
if (returnReduceAnd(!nPoints()))
{
WarningInFunction
<< "no points in mesh" << endl;
<< "No points in mesh" << endl;
}
if (returnReduce(nCells(), sumOp<label>()) == 0)
if (returnReduceAnd(!nCells()))
{
WarningInFunction
<< "no cells in mesh" << endl;
<< "No cells in mesh" << endl;
}
}
@ -802,14 +800,10 @@ void Foam::polyMesh::resetPrimitives
boundary_.calcGeometry();
// Warn if global empty mesh
if
(
(returnReduce(nPoints(), sumOp<label>()) == 0)
|| (returnReduce(nCells(), sumOp<label>()) == 0)
)
if (returnReduceAnd(!nPoints()) || returnReduceAnd(!nCells()))
{
FatalErrorInFunction
<< "no points or no cells in mesh" << endl;
<< "No points or no cells in mesh" << endl;
}
}
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016, 2020 OpenFOAM Foundation
Copyright (C) 2018-2021 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -634,7 +634,6 @@ Foam::polyMesh::polyMesh
label nAllPatches = boundaryFaces.size();
label nDefaultFaces = nFaces - defaultPatchStart;
if (syncPar)
{

View File

@ -776,7 +776,7 @@ Foam::labelList Foam::polyMeshTetDecomposition::adjustTetBasePtIs
syncTools::syncFaceList(mesh, tetBasePtIs, maxEqOp<label>());
if (report && returnReduce(nAdapted, sumOp<label>()))
if (report && returnReduceOr(nAdapted))
{
Pout<< "Adapted starting point of triangulation on "
<< nAdapted << " faces." << endl;

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013-2015 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -46,9 +47,9 @@ void Foam::symmetryPlanePolyPatch::calcGeometry(PstreamBuffers&)
{
if (n_ == vector::rootMax)
{
if (returnReduce(size(), sumOp<label>()))
if (returnReduceOr(size()))
{
const vectorField& nf(faceNormals());
const vectorField& nf = faceNormals();
n_ = gAverage(nf);
if (debug)

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.
@ -50,9 +51,9 @@ void Foam::wedgePolyPatch::calcGeometry(PstreamBuffers&)
return;
}
if (returnReduce(size(), sumOp<label>()))
if (returnReduceOr(size()))
{
const vectorField& nf(faceNormals());
const vectorField& nf = faceNormals();
n_ = gAverage(nf);
if (debug)

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.
@ -601,7 +601,7 @@ bool Foam::faceZone::checkParallelSync(const bool report) const
}
}
return returnReduce(hasError, orOp<bool>());
return returnReduceOr(hasError);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -425,8 +425,7 @@ bool Foam::primitiveMesh::checkFaceOrthogonality
if (debug || report)
{
label neiSize = ortho.size();
reduce(neiSize, sumOp<label>());
const label neiSize = returnReduce(ortho.size(), sumOp<label>());
if (neiSize > 0)
{
@ -929,9 +928,9 @@ bool Foam::primitiveMesh::checkUpperTriangular
label internal = nInternalFaces();
// Has error occurred?
bool error = false;
// Have multiple faces been detected?
label nMultipleCells = false;
bool hasError = false;
// Multiple faces detected?
label nMultipleCells = 0;
// Loop through faceCells once more and make sure that for internal cell
// the first label is smaller
@ -939,7 +938,7 @@ bool Foam::primitiveMesh::checkUpperTriangular
{
if (own[facei] >= nei[facei])
{
error = true;
hasError = true;
if (setPtr)
{
@ -1024,7 +1023,7 @@ bool Foam::primitiveMesh::checkUpperTriangular
}
else if (thisFace < prevFace)
{
error = true;
hasError = true;
if (setPtr)
{
@ -1042,7 +1041,7 @@ bool Foam::primitiveMesh::checkUpperTriangular
}
}
reduce(error, orOp<bool>());
Pstream::reduceOr(hasError);
reduce(nMultipleCells, sumOp<label>());
if ((debug || report) && nMultipleCells > 0)
@ -1051,7 +1050,7 @@ bool Foam::primitiveMesh::checkUpperTriangular
<< " neighbouring cells with multiple inbetween faces." << endl;
}
if (error)
if (hasError)
{
if (debug || report)
{

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -69,8 +69,7 @@ bool Foam::primitiveMesh::checkEdgeLength
reduce(minLenSqr, minOp<scalar>());
reduce(maxLenSqr, maxOp<scalar>());
label nSmall = smallEdgeSet.size();
reduce(nSmall, sumOp<label>());
label nSmall = returnReduce(smallEdgeSet.size(), sumOp<label>());
if (setPtr)
{

View File

@ -41,7 +41,7 @@ bool Foam::UOPstream::bufferIPCsend()
bool Foam::UOPstream::write
(
const commsTypes commsType,
const UPstream::commsTypes commsType,
const int toProcNo,
const char* buf,
const std::streamsize bufSize,

View File

@ -52,7 +52,7 @@ bool Foam::UOPstream::bufferIPCsend()
bool Foam::UOPstream::write
(
const commsTypes commsType,
const UPstream::commsTypes commsType,
const int toProcNo,
const char* buf,
const std::streamsize bufSize,
@ -65,7 +65,7 @@ bool Foam::UOPstream::write
Pout<< "UOPstream::write : starting write to:" << toProcNo
<< " tag:" << tag
<< " comm:" << communicator << " size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType]
<< " commType:" << UPstream::commsTypeNames[commsType]
<< Foam::endl;
}
if (UPstream::warnComm != -1 && communicator != UPstream::warnComm)
@ -73,7 +73,7 @@ bool Foam::UOPstream::write
Pout<< "UOPstream::write : starting write to:" << toProcNo
<< " tag:" << tag
<< " comm:" << communicator << " size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType]
<< " commType:" << UPstream::commsTypeNames[commsType]
<< " warnComm:" << UPstream::warnComm
<< Foam::endl;
error::printStack(Pout);
@ -154,7 +154,7 @@ bool Foam::UOPstream::write
{
Pout<< "UOPstream::write : started write to:" << toProcNo
<< " tag:" << tag << " size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType]
<< " commType:" << UPstream::commsTypeNames[commsType]
<< " request:" << PstreamGlobals::outstandingRequests_.size()
<< Foam::endl;
}

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.
@ -155,9 +155,7 @@ bool Foam::dynamicMotionSolverFvMeshAMI::update()
changeRequired = pp.changeTopology() || changeRequired;
}
reduce(changeRequired, orOp<bool>());
if (changeRequired)
if (returnReduceOr(changeRequired))
{
polyTopoChange polyTopo(*this);

View File

@ -155,7 +155,7 @@ void Foam::dynamicRefineFvMesh::calculateProtectedCells
}
}
if (!returnReduce(hasExtended, orOp<bool>()))
if (!returnReduceOr(hasExtended))
{
break;
}
@ -1250,7 +1250,7 @@ bool Foam::dynamicRefineFvMesh::init(const bool doInit)
checkEightAnchorPoints(protectedCell_);
}
if (!returnReduce(protectedCell_.any(), orOp<bool>()))
if (!returnReduceOr(protectedCell_.any()))
{
protectedCell_.clear();
}
@ -1388,12 +1388,7 @@ bool Foam::dynamicRefineFvMesh::updateTopology()
)
);
const label nCellsToRefine = returnReduce
(
cellsToRefine.size(), sumOp<label>()
);
if (nCellsToRefine > 0)
if (returnReduceOr(cellsToRefine.size()))
{
// Refine/update mesh and map fields
autoPtr<mapPolyMesh> map = refine(cellsToRefine);
@ -1447,13 +1442,7 @@ bool Foam::dynamicRefineFvMesh::updateTopology()
)
);
const label nSplitPoints = returnReduce
(
pointsToUnrefine.size(),
sumOp<label>()
);
if (nSplitPoints > 0)
if (returnReduceOr(pointsToUnrefine.size()))
{
// Refine/update mesh
unrefine(pointsToUnrefine);

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.
@ -311,8 +311,7 @@ void Foam::createShellMesh::calcPointRegions
}
label nChangedFaces = returnReduce(changedFaces.size(), sumOp<label>());
if (nChangedFaces == 0)
if (returnReduceAnd(changedFaces.empty()))
{
break;
}
@ -374,8 +373,7 @@ void Foam::createShellMesh::calcPointRegions
);
label nChangedEdges = returnReduce(changedEdges.size(), sumOp<label>());
if (nChangedEdges == 0)
if (returnReduceAnd(changedEdges.empty()))
{
break;
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
Copyright (C) 2020-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -75,11 +75,13 @@ void Foam::layerAdditionRemoval::checkDefinition()
<< abort(FatalError);
}
label nFaces = topoChanger().mesh().faceZones()[faceZoneID_.index()].size();
reduce(nFaces, sumOp<label>());
if (nFaces == 0)
if
(
returnReduceAnd
(
topoChanger().mesh().faceZones()[faceZoneID_.index()].empty()
)
)
{
FatalErrorInFunction
<< "Face extrusion zone contains no faces. "

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2019 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -77,14 +77,7 @@ bool Foam::layerAdditionRemoval::validCollapse() const
<< nBoundaryHits << endl;
}
if (returnReduce(nBoundaryHits, sumOp<label>()) > 0)
{
return false;
}
else
{
return true;
}
return !returnReduceOr(nBoundaryHits);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
Copyright (C) 2020-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -169,10 +169,7 @@ bool Foam::layerAdditionRemoval::setLayerPairing() const
}
}
reduce(nPointErrors, sumOp<label>());
reduce(nFaceErrors, sumOp<label>());
if (nPointErrors > 0 || nFaceErrors > 0)
if (returnReduceOr(nPointErrors || nFaceErrors))
{
clearAddressing();

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -534,7 +534,7 @@ void Foam::meshCutter::setRefinement
addedPoints_.clear();
addedPoints_.resize(cuts.nLoops());
if (returnReduce(cuts.nLoops(), sumOp<label>()) == 0)
if (!returnReduceOr(cuts.nLoops()))
{
return;
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2015-2020 OpenCFD Ltd.
Copyright (C) 2015-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -504,11 +504,7 @@ Foam::multiDirRefinement::multiDirRefinement
refineHex8(mesh, hexCells, writeMesh);
}
label nRemainingCells = cellLabels_.size();
reduce(nRemainingCells, sumOp<label>());
if (nRemainingCells > 0)
if (returnReduceOr(cellLabels_.size()))
{
// Any cells to refine using meshCutter
@ -547,11 +543,7 @@ Foam::multiDirRefinement::multiDirRefinement
refineHex8(mesh, hexCells, writeMesh);
}
label nRemainingCells = cellLabels_.size();
reduce(nRemainingCells, sumOp<label>());
if (nRemainingCells > 0)
if (returnReduceOr(cellLabels_.size()))
{
// Any cells to refine using meshCutter

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -108,10 +108,7 @@ Foam::Map<Foam::label> Foam::refinementIterator::setRefinement
// Determine cut pattern.
cellCuts cuts(mesh_, cellWalker_, currentRefCells);
label nCuts = cuts.nLoops();
reduce(nCuts, sumOp<label>());
if (nCuts == 0)
if (!returnReduceOr(cuts.nLoops()))
{
if (debug)
{
@ -266,13 +263,12 @@ Foam::Map<Foam::label> Foam::refinementIterator::setRefinement
}
// Stop only if all finished or all can't refine any further.
stop = (nRefCells == 0) || (nRefCells == oldRefCells);
reduce(stop, andOp<bool>());
stop = returnReduceAnd(nRefCells == 0 || nRefCells == oldRefCells);
}
while (!stop);
if (returnReduce((nRefCells == oldRefCells), andOp<bool>()))
if (returnReduceAnd(nRefCells == oldRefCells))
{
WarningInFunction
<< "stopped refining."

View File

@ -131,7 +131,7 @@ Foam::zoneMotion::zoneMotion
// No cell points selected (as set or zones) => move all points
moveAllCells_ = returnReduce(pointIDs_.empty(), andOp<bool>());
moveAllCells_ = returnReduceAnd(pointIDs_.empty());
if (moveAllCells_)
{

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -283,7 +284,7 @@ Foam::label Foam::polyMeshFilter::filterFacesLoop(const label nOriginalBadFaces)
}
}
reduce(newBadFaces, orOp<bool>());
Pstream::reduceOr(newBadFaces);
}
else
{

View File

@ -2006,7 +2006,7 @@ void Foam::addPatchCellLayer::setRefinement
Pout<< "nChanged:" << nChanged << endl;
}
if (returnReduce(nChanged, sumOp<label>()) == 0)
if (!returnReduceOr(nChanged))
{
break;
}

View File

@ -4991,7 +4991,7 @@ void Foam::hexRef8::checkRefinementLevels
// }
// }
//
// if (returnReduce(nHanging, sumOp<label>()) > 0)
// if (returnReduceOr(nHanging))
// {
// FatalErrorInFunction
// << "Detected a point used by two edges only (hanging point)"

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015-2017 OpenFOAM Foundation
Copyright (C) 2017-2021 OpenCFD Ltd.
Copyright (C) 2017-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -45,7 +45,7 @@ Foam::hexRef8Data::hexRef8Data(const IOobject& io)
IOobject rio(io, "cellLevel");
// haveFile
if (returnReduce(rio.typeHeaderOk<Type>(true), orOp<bool>()))
if (returnReduceOr(rio.typeHeaderOk<Type>(true)))
{
Info<< "Reading hexRef8 data : " << rio.name() << endl;
cellLevelPtr_.reset(new Type(rio));
@ -56,7 +56,7 @@ Foam::hexRef8Data::hexRef8Data(const IOobject& io)
IOobject rio(io, "pointLevel");
// haveFile
if (returnReduce(rio.typeHeaderOk<Type>(true), orOp<bool>()))
if (returnReduceOr(rio.typeHeaderOk<Type>(true)))
{
Info<< "Reading hexRef8 data : " << rio.name() << endl;
pointLevelPtr_.reset(new Type(rio));
@ -67,7 +67,7 @@ Foam::hexRef8Data::hexRef8Data(const IOobject& io)
IOobject rio(io, "level0Edge");
// haveFile
if (returnReduce(rio.typeHeaderOk<Type>(true), orOp<bool>()))
if (returnReduceOr(rio.typeHeaderOk<Type>(true)))
{
Info<< "Reading hexRef8 data : " << rio.name() << endl;
level0EdgePtr_.reset(new Type(rio));
@ -78,7 +78,7 @@ Foam::hexRef8Data::hexRef8Data(const IOobject& io)
IOobject rio(io, "refinementHistory");
// haveFile
if (returnReduce(rio.typeHeaderOk<Type>(true), orOp<bool>()))
if (returnReduceOr(rio.typeHeaderOk<Type>(true)))
{
Info<< "Reading hexRef8 data : " << rio.name() << endl;
refHistoryPtr_.reset(new Type(rio));
@ -237,7 +237,7 @@ void Foam::hexRef8Data::sync(const IOobject& io)
{
const polyMesh& mesh = dynamic_cast<const polyMesh&>(io.db());
bool hasCellLevel = returnReduce(bool(cellLevelPtr_), orOp<bool>());
bool hasCellLevel = returnReduceOr(bool(cellLevelPtr_));
if (hasCellLevel && !cellLevelPtr_)
{
IOobject rio(io, "cellLevel");
@ -248,7 +248,7 @@ void Foam::hexRef8Data::sync(const IOobject& io)
);
}
bool hasPointLevel = returnReduce(bool(pointLevelPtr_), orOp<bool>());
bool hasPointLevel = returnReduceOr(bool(pointLevelPtr_));
if (hasPointLevel && !pointLevelPtr_)
{
IOobject rio(io, "pointLevel");
@ -259,7 +259,7 @@ void Foam::hexRef8Data::sync(const IOobject& io)
);
}
bool hasLevel0Edge = returnReduce(bool(level0EdgePtr_), orOp<bool>());
bool hasLevel0Edge = returnReduceOr(bool(level0EdgePtr_));
if (hasLevel0Edge)
{
// Get master length
@ -280,7 +280,7 @@ void Foam::hexRef8Data::sync(const IOobject& io)
}
}
bool hasHistory = returnReduce(bool(refHistoryPtr_), orOp<bool>());
bool hasHistory = returnReduceOr(bool(refHistoryPtr_));
if (hasHistory && !refHistoryPtr_)
{
IOobject rio(io, "refinementHistory");

View File

@ -490,8 +490,8 @@ void Foam::refinementHistory::add
if (refinementHistory::debug)
{
reduce(nUnblocked, sumOp<label>());
Info<< type() << " : unblocked " << nUnblocked << " faces" << endl;
Info<< type() << " : unblocked "
<< returnReduce(nUnblocked, sumOp<label>()) << " faces" << endl;
}
syncTools::syncFaceList(mesh, blockedFace, andEqOp<bool>());
@ -550,9 +550,8 @@ void Foam::refinementHistory::apply
if (refinementHistory::debug)
{
reduce(nChanged, sumOp<label>());
Info<< type() << " : changed decomposition on " << nChanged
<< " cells" << endl;
Info<< type() << " : changed decomposition on "
<< returnReduce(nChanged, sumOp<label>()) << " cells" << endl;
}
}
@ -572,7 +571,7 @@ Foam::refinementHistory::refinementHistory(const IOobject& io)
// When running in redistributePar + READ_IF_PRESENT it can happen
// that some processors do have refinementHistory and some don't so
// test for active has to be outside of above condition.
active_ = (returnReduce(visibleCells_.size(), sumOp<label>()) > 0);
active_ = returnReduceOr(visibleCells_.size());
if (debug)
{
@ -645,7 +644,7 @@ Foam::refinementHistory::refinementHistory
}
}
active_ = (returnReduce(visibleCells_.size(), sumOp<label>()) > 0);
active_ = returnReduceOr(visibleCells_.size());
// Check indices.
@ -843,7 +842,7 @@ Foam::refinementHistory::refinementHistory(const IOobject& io, Istream& is)
freeSplitCells_(),
visibleCells_(is)
{
active_ = (returnReduce(visibleCells_.size(), sumOp<label>()) > 0);
active_ = returnReduceOr(visibleCells_.size());
// Check indices.
checkIndices();
@ -1673,7 +1672,7 @@ bool Foam::refinementHistory::read()
bool ok = readData(readStream(typeName));
close();
active_ = (returnReduce(visibleCells_.size(), sumOp<label>()) > 0);
active_ = returnReduceOr(visibleCells_.size());
return ok;
}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -72,25 +73,21 @@ Foam::engineMesh::engineMesh(const IOobject& io)
}
}
reduce(foundPiston, orOp<bool>());
reduce(foundLiner, orOp<bool>());
reduce(foundCylinderHead, orOp<bool>());
if (!foundPiston)
if (!returnReduceOr(foundPiston))
{
FatalErrorInFunction
<< "cannot find piston patch"
<< exit(FatalError);
}
if (!foundLiner)
if (!returnReduceOr(foundLiner))
{
FatalErrorInFunction
<< "cannot find liner patch"
<< exit(FatalError);
}
if (!foundCylinderHead)
if (!returnReduceOr(foundCylinderHead))
{
FatalErrorInFunction
<< "cannot find cylinderHead patch"

View File

@ -724,9 +724,7 @@ bool Foam::faBoundaryMesh::checkParallelSync(const bool report) const
}
// Reduce (not broadcast) to respect local out-of-order errors (first loop)
reduce(hasError, orOp<bool>());
return hasError;
return returnReduceOr(hasError);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 Wikki Ltd
Copyright (C) 2021 OpenCFD Ltd.
Copyright (C) 2021-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -287,8 +287,8 @@ Foam::faPatchList Foam::faMesh::createPatchList
patchDefsUsed.insert(bestPatchDefi);
}
// Remove undefPatchIndex if not actually needed
if (!returnReduce(patchDefsUsed.found(undefPatchIndex), orOp<bool>()))
// Remove undefPatchIndex if not actually needed anywhere
if (!returnReduceOr(patchDefsUsed.found(undefPatchIndex)))
{
faPatchDefs.remove(undefPatchIndex);
}
@ -330,7 +330,7 @@ Foam::faPatchList Foam::faMesh::createPatchList
}
}
if ((nBadEdges = returnReduce(badEdges.size(), sumOp<label>())) > 0)
if ((nBadEdges = returnReduce(badEdges.size(), sumOp<label>())) != 0)
{
// Report directly as Info, not InfoInFunction
// since it can also be an expected result when

View File

@ -187,7 +187,7 @@ Foam::autoPtr<Foam::faMesh> Foam::faMeshTools::newMesh
// Some processors without patches? - add patches
if (returnReduce(mesh.boundary().empty(), orOp<bool>()))
if (returnReduceOr(mesh.boundary().empty()))
{
// Use patchEntries, which were read on master and broadcast

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.
@ -165,7 +165,7 @@ Foam::faMesh::getBoundaryEdgeConnections() const
}
}
if ((nBadEdges = returnReduce(badEdges.size(), sumOp<label>())) > 0)
if ((nBadEdges = returnReduce(badEdges.size(), sumOp<label>())) != 0)
{
edgeList dumpEdges(patch().edges(), badEdges.sortedToc());
@ -263,7 +263,7 @@ Foam::faMesh::getBoundaryEdgeConnections() const
}
}
if ((nBadEdges = returnReduce(badEdges.size(), sumOp<label>())) > 0)
if ((nBadEdges = returnReduce(badEdges.size(), sumOp<label>())) != 0)
{
FatalErrorInFunction
<< "Had " << nBadEdges
@ -502,7 +502,7 @@ Foam::faMesh::getBoundaryEdgeConnections() const
}
}
if ((nBadEdges = returnReduce(badEdges.size(), sumOp<label>())) > 0)
if ((nBadEdges = returnReduce(badEdges.size(), sumOp<label>())) != 0)
{
FatalErrorInFunction
<< "Had " << nBadEdges << " coupled boundary edges"
@ -623,7 +623,7 @@ Foam::faMesh::getBoundaryEdgeConnections() const
}
// Verbose report of missing edges
if ((nBadEdges = returnReduce(badEdges.size(), sumOp<label>())) > 0)
if ((nBadEdges = returnReduce(badEdges.size(), sumOp<label>())) != 0)
{
edgeList dumpEdges(patch().edges(), badEdges.sortedToc());

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.
@ -593,11 +593,7 @@ bool Foam::MRFZone::read(const dictionary& dict)
excludedPatchLabels_[i++] = patchi;
}
bool cellZoneFound = (cellZoneID_ != -1);
reduce(cellZoneFound, orOp<bool>());
if (!cellZoneFound)
if (!returnReduceOr(cellZoneID_ != -1))
{
FatalErrorInFunction
<< "cannot find MRF cellZone " << cellZoneName_

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2017 OpenFOAM Foundation
Copyright (C) 2016-2021 OpenCFD Ltd.
Copyright (C) 2016-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -109,10 +109,7 @@ Foam::porosityModel::porosityModel
Info<< " creating porous zone: " << zoneName_ << endl;
bool foundZone = !cellZoneIDs_.empty();
reduce(foundZone, orOp<bool>());
if (!foundZone && Pstream::master())
if (returnReduceAnd(cellZoneIDs_.empty()) && Pstream::master())
{
FatalErrorInFunction
<< "Cannot find porous cellZone " << zoneName_ << endl

View File

@ -58,8 +58,7 @@ bool Foam::expressions::fvExprDriver::isGlobalVariable
// Do size checking if requested
if (good && expectedSize >= 0)
{
good = (result.size() == expectedSize);
reduce(good, andOp<bool>());
good = returnReduceAnd(result.size() == expectedSize);
if (debug && !good)
{
@ -103,7 +102,7 @@ Foam::expressions::fvExprDriver::getVariable
if
(
expectedSize < 0
|| returnReduce((vals.size() == expectedSize), andOp<bool>())
|| returnReduceAnd(vals.size() == expectedSize)
)
{
// Return a copy of the field
@ -318,7 +317,7 @@ Foam::tmp<GeomField> Foam::expressions::fvExprDriver::getOrReadFieldImpl
Pout<< "sizes: " << vals.size() << ' ' << fld.size() << endl;
}
if (returnReduce((vals.size() == fld.size()), andOp<bool>()))
if (returnReduceAnd(vals.size() == fld.size()))
{
fld.primitiveFieldRef() = vals;
}

View File

@ -58,7 +58,7 @@ Foam::expressions::patchExpr::parseDriver::getVariableIfAvailable
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

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2020 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -278,7 +278,7 @@ Foam::PatchFunction1Types::Sampled<Type>::value
// Enforce average. Either by scaling (if scaling factor > 0.5) or by
// offsetting.
if (setAverage_ && returnReduce(newValues.size(), sumOp<label>()))
if (setAverage_ && returnReduceOr(newValues.size()))
{
Type averagePsi;
if (this->faceValues())

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.
@ -161,7 +161,7 @@ Foam::swirlFanVelocityFvPatchField::swirlFanVelocityFvPatchField
dict.getOrDefault
(
"origin",
returnReduce(patch().size(), maxOp<label>())
returnReduceOr(patch().size())
? gSum(patch().Cf()*patch().magSf())/gSum(patch().magSf())
: Zero
)

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.
@ -68,7 +68,7 @@ swirlFlowRateInletVelocityFvPatchVectorField
dict.getOrDefault
(
"origin",
returnReduce(patch().size(), maxOp<label>())
returnReduceOr(patch().size())
? gSum(patch().Cf()*patch().magSf())/gSum(patch().magSf())
: Zero
)
@ -78,7 +78,7 @@ swirlFlowRateInletVelocityFvPatchVectorField
dict.getOrDefault
(
"axis",
returnReduce(patch().size(), maxOp<label>())
returnReduceOr(patch().size())
? -gSum(patch().Sf())/gSum(patch().magSf())
: Zero
)

View File

@ -190,8 +190,10 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::initialisePatch()
patchBounds_.inflate(0.1);
// Determine if all eddies spawned from a single processor
singleProc_ = patch.size() == returnReduce(patch.size(), sumOp<label>());
reduce(singleProc_, orOp<bool>());
singleProc_ = returnReduceOr
(
patch.size() == returnReduce(patch.size(), sumOp<label>())
);
}
@ -1031,8 +1033,8 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::updateCoeffs()
{
Info<< "Magnitude of bulk velocity: " << UBulk << endl;
label n = eddies_.size();
Info<< "Number of eddies: " << returnReduce(n, sumOp<label>())
Info<< "Number of eddies: "
<< returnReduce(eddies_.size(), sumOp<label>())
<< endl;
Info<< "Patch:" << patch().patch().name()

View File

@ -81,7 +81,7 @@ void Foam::solidBodyFvGeometryScheme::setMeshMotionData()
<< endl;
// Quick return if no points have moved
if (returnReduce(changedPoints.none(), andOp<label>()))
if (returnReduceAnd(changedPoints.none()))
{
return;
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2021 OpenCFD Ltd.
Copyright (C) 2016-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -200,7 +200,7 @@ bool Foam::fvMeshSubsetProxy::correct(bool verbose)
subsetter_.reset(selectedCells_, exposedPatchId_);
}
return returnReduce(changed, orOp<bool>());
return returnReduceOr(changed);
}

View File

@ -597,7 +597,7 @@ Foam::fvMeshTools::newMesh
// Some processors without patches? - add patches
if (returnReduce(mesh.boundary().empty(), orOp<bool>()))
if (returnReduceOr(mesh.boundary().empty()))
{
DynamicList<polyPatch*> newPatches(patchEntries.size());

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
Copyright (C) 2020-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -58,8 +58,7 @@ bool Foam::volPointInterpolation::hasSeparated(const pointMesh& pMesh)
}
}
reduce(hasSpecial, orOp<bool>());
return hasSpecial;
return returnReduceOr(hasSpecial);
}

View File

@ -156,7 +156,7 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::setFaceZoneFaces()
// Could also check this
#if 0
if (!returnReduce(bool(numFaces), orOp<bool>()))
if (!returnReduceOr(numFaces))
{
WarningInFunction
<< type() << ' ' << name() << ": "
@ -314,7 +314,7 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::setPatchFaces()
// Could also check this
#if 0
if (!returnReduce(bool(numFaces), orOp<bool>()))
if (!returnReduceOr(numFaces))
{
WarningInFunction
<< type() << ' ' << name() << ": "
@ -807,7 +807,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::weightingFactor
// scalar * unit-normal
// Can skip this check - already used canWeight()
/// if (returnReduce(weightField.empty(), andOp<bool>()))
/// if (returnReduceAnd(weightField.empty()))
/// {
/// // No weight field - revert to unweighted form?
/// return tmp<scalarField>::New(Sf.size(), scalar(1));
@ -835,7 +835,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::areaWeightingFactor
// scalar * Area
// Can skip this check - already used canWeight()
/// if (returnReduce(weightField.empty(), andOp<bool>()))
/// if (returnReduceAnd(weightField.empty()))
/// {
/// // No weight field - revert to unweighted form
/// return mag(Sf);
@ -862,7 +862,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::weightingFactor
// vector (dot) unit-normal
// Can skip this check - already used canWeight()
/// if (returnReduce(weightField.empty(), andOp<bool>()))
/// if (returnReduceAnd(weightField.empty()))
/// {
/// // No weight field - revert to unweighted form
/// return tmp<scalarField>::New(Sf.size(), scalar(1));
@ -903,7 +903,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::areaWeightingFactor
// vector (dot) Area
// Can skip this check - already used canWeight()
/// if (returnReduce(weightField.empty(), andOp<bool>()))
/// if (returnReduceAnd(weightField.empty()))
/// {
/// // No weight field - revert to unweighted form
/// return mag(Sf);
@ -1297,7 +1297,7 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::write()
// Process the fields
if (returnReduce(!vectorWeights.empty(), orOp<bool>()))
if (returnReduceOr(!vectorWeights.empty()))
{
if (scalarWeights.size())
{

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2021 OpenCFD Ltd.
Copyright (C) 2015-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -60,7 +60,7 @@ inline bool Foam::functionObjects::fieldValues::surfaceFieldValue::canWeight
) const
{
// Non-empty on some processor
return returnReduce(!fld.empty(), orOp<bool>());
return returnReduceOr(!fld.empty());
}

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.
@ -49,7 +49,7 @@ inline bool Foam::functionObjects::fieldValues::volFieldValue::canWeight
) const
{
// Non-empty on some processor
return returnReduce(!fld.empty(), orOp<bool>());
return returnReduceOr(!fld.empty());
}

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.
@ -54,7 +54,7 @@ bool Foam::functionObjects::reference::calc()
Log << endl;
return returnReduce(processed, orOp<bool>());
return returnReduceOr(processed);
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016 OpenCFD Ltd.
Copyright (C) 2016-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -70,7 +70,7 @@ int Foam::functionObjects::zeroGradient::apply
const VolFieldType& input = lookupObject<VolFieldType>(inputName);
if (!returnReduce(accept(input), orOp<bool>()))
if (!returnReduceOr(accept(input)))
{
state = -1;
return state;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2020 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -82,7 +82,7 @@ bool Foam::functionObjects::dataCloud::writeCloud
}
applyFilter_ = calculateFilter(obrTmp, log);
reduce(applyFilter_, orOp<bool>());
Pstream::reduceOr(applyFilter_);
// Number of parcels (locally)

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2020 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -188,7 +188,7 @@ bool Foam::functionObjects::dataCloud::writeField
const List<Type>* fldPtr = obrTmp.findObject<IOField<Type>>(fieldName_);
const List<Type>& values = (fldPtr ? *fldPtr : List<Type>());
if (!returnReduce((fldPtr != nullptr), orOp<bool>()))
if (!returnReduceOr(fldPtr != nullptr))
{
return false;
}

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.
@ -157,7 +157,7 @@ bool Foam::functionObjects::dsmcFields::write()
Member##Ptr = obr_.cfindObject<FieldType>(fldName); \
} \
\
if (returnReduce(!Member##Ptr, orOp<bool>())) \
if (returnReduceOr(!Member##Ptr)) \
{ \
Log << type() << ' ' << name() << " : no " << Name \
<< " field found - not calculating\n"; \

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2020 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -131,7 +131,7 @@ bool Foam::functionObjects::vtkCloud::writeCloud
}
applyFilter_ = calculateFilter(obrTmp, log);
reduce(applyFilter_, orOp<bool>());
Pstream::reduceOr(applyFilter_);
// Number of parcels (locally)

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2020 OpenCFD Ltd.
Copyright (C) 2016-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -57,7 +57,7 @@ bool Foam::pairPatchAgglomeration::continueAgglomerating
return
(
returnReduce(nLocal > nFacesInCoarsestLevel_, orOp<bool>())
returnReduceOr(nLocal > nFacesInCoarsestLevel_)
|| nGlobal > nGlobalFacesInCoarsestLevel_
)
&& nGlobal != nGlobalOld;

View File

@ -180,7 +180,7 @@ void Foam::fv::cellSetOption::setCellSelection()
selectedCells.insert(celli);
}
if (!returnReduce(found, orOp<bool>()))
if (!returnReduceOr(found))
{
WarningInFunction
<< "No owner cell found for point " << p << endl;

View File

@ -212,7 +212,7 @@ void Foam::fv::limitTemperature::correct(volScalarField& he)
}
if (returnReduce(changedValues, orOp<bool>()))
if (returnReduceOr(changedValues))
{
// We've changed internal values so give
// boundary conditions opportunity to correct

View File

@ -130,7 +130,7 @@ void Foam::fv::actuationDiskSource::setMonitorCells(const dictionary& dict)
selectedCells.insert(celli);
}
if (!returnReduce(found, orOp<bool>()))
if (!returnReduceOr(found))
{
WarningInFunction
<< "No owner cell found for point "

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -406,10 +407,8 @@ void Foam::FreeStream<CloudType>::inflow()
}
}
reduce(particlesInserted, sumOp<label>());
Info<< " Particles inserted = "
<< particlesInserted << endl;
<< returnReduce(particlesInserted, sumOp<label>()) << endl;
}

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