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

View File

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

View File

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

View File

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

View File

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

View File

@ -345,7 +345,7 @@ void deleteEmptyPatches(fvMesh& mesh)
else else
{ {
// Common patch. // Common patch.
if (returnReduce(patches[patchi].empty(), andOp<bool>())) if (returnReduceAnd(patches[patchi].empty()))
{ {
Pout<< "Deleting patch " << patchi Pout<< "Deleting patch " << patchi
<< " name:" << patches[patchi].name() << " name:" << patches[patchi].name()

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -665,7 +665,7 @@ void removeZeroSizedPatches(fvMesh& mesh)
if if
( (
isA<coupledPolyPatch>(pp) isA<coupledPolyPatch>(pp)
|| returnReduce(pp.size(), sumOp<label>()) || returnReduceOr(pp.size())
) )
{ {
// Coupled (and unknown size) or uncoupled and used // Coupled (and unknown size) or uncoupled and used
@ -1891,11 +1891,8 @@ int main(int argc, char *argv[])
); );
// Use the maxLocalCells from the refinement parameters // Use the maxLocalCells from the refinement parameters
bool preBalance = returnReduce const bool preBalance =
( returnReduceOr(mesh.nCells() >= refineParams.maxLocalCells());
(mesh.nCells() >= refineParams.maxLocalCells()),
orOp<bool>()
);
if (!overwrite && !debugLevel) if (!overwrite && !debugLevel)

View File

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

View File

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

View File

@ -686,7 +686,7 @@ void syncPoints
//- Note: hasTransformation is only used for warning messages so //- Note: hasTransformation is only used for warning messages so
// reduction not strictly necessary. // reduction not strictly necessary.
//reduce(hasTransformation, orOp<bool>()); //Pstream::reduceOr(hasTransformation);
// Synchronize multiple shared points. // Synchronize multiple shared points.
const globalMeshData& pd = mesh.globalData(); const globalMeshData& pd = mesh.globalData();

View File

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

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2021 OpenCFD Ltd. Copyright (C) 2016-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -1103,9 +1103,7 @@ int main(int argc, char *argv[])
// Update proc maps // Update proc maps
if (cellProcAddressing.headerOk()) if (cellProcAddressing.headerOk())
{ {
bool localOk = (cellProcAddressing.size() == mesh.nCells()); if (returnReduceAnd(cellProcAddressing.size() == mesh.nCells()))
if (returnReduce(localOk, andOp<bool>()))
{ {
Info<< "Renumbering processor cell decomposition map " Info<< "Renumbering processor cell decomposition map "
<< cellProcAddressing.name() << endl; << cellProcAddressing.name() << endl;
@ -1129,9 +1127,7 @@ int main(int argc, char *argv[])
if (faceProcAddressing.headerOk()) if (faceProcAddressing.headerOk())
{ {
bool localOk = (faceProcAddressing.size() == mesh.nFaces()); if (returnReduceAnd(faceProcAddressing.size() == mesh.nFaces()))
if (returnReduce(localOk, andOp<bool>()))
{ {
Info<< "Renumbering processor face decomposition map " Info<< "Renumbering processor face decomposition map "
<< faceProcAddressing.name() << endl; << faceProcAddressing.name() << endl;
@ -1171,9 +1167,7 @@ int main(int argc, char *argv[])
if (pointProcAddressing.headerOk()) if (pointProcAddressing.headerOk())
{ {
bool localOk = (pointProcAddressing.size() == mesh.nPoints()); if (returnReduceAnd(pointProcAddressing.size() == mesh.nPoints()))
if (returnReduce(localOk, andOp<bool>()))
{ {
Info<< "Renumbering processor point decomposition map " Info<< "Renumbering processor point decomposition map "
<< pointProcAddressing.name() << endl; << pointProcAddressing.name() << endl;
@ -1197,12 +1191,13 @@ int main(int argc, char *argv[])
if (boundaryProcAddressing.headerOk()) if (boundaryProcAddressing.headerOk())
{ {
bool localOk = if
( (
boundaryProcAddressing.size() returnReduceAnd
== mesh.boundaryMesh().size() (
); boundaryProcAddressing.size() == mesh.boundaryMesh().size()
if (returnReduce(localOk, andOp<bool>())) )
)
{ {
// No renumbering needed // No renumbering needed
} }

View File

@ -847,7 +847,7 @@ void createAndWriteRegion
if (!isA<processorPolyPatch>(pp)) if (!isA<processorPolyPatch>(pp))
{ {
if (returnReduce(pp.size(), sumOp<label>()) > 0) if (returnReduceOr(pp.size()))
{ {
oldToNew[patchi] = newI; oldToNew[patchi] = newI;
if (!addedPatches.found(patchi)) if (!addedPatches.found(patchi))

View File

@ -252,7 +252,7 @@ autoPtr<mapPolyMesh> mergeSharedPoints
Info<< "mergeSharedPoints : detected " << pointToMaster.size() Info<< "mergeSharedPoints : detected " << pointToMaster.size()
<< " points that are to be merged." << endl; << " points that are to be merged." << endl;
if (returnReduce(pointToMaster.size(), sumOp<label>()) == 0) if (returnReduceAnd(pointToMaster.empty()))
{ {
return nullptr; return nullptr;
} }

View File

@ -88,11 +88,8 @@ Foam::label Foam::parLagrangianDistributor::distributeFields
if (!nFields) if (!nFields)
{ {
// Performing an all-to-one (reconstruct)? // Performing an all-to-one (reconstruct)?
reconstruct = returnReduce reconstruct =
( returnReduceAnd(!map.constructSize() || Pstream::master());
(!map.constructSize() || Pstream::master()),
andOp<bool>()
);
} }
if (verbose_) if (verbose_)
@ -195,11 +192,8 @@ Foam::label Foam::parLagrangianDistributor::distributeFieldFields
if (!nFields) if (!nFields)
{ {
// Performing an all-to-one (reconstruct)? // Performing an all-to-one (reconstruct)?
reconstruct = returnReduce reconstruct =
( returnReduceAnd(!map.constructSize() || Pstream::master());
(!map.constructSize() || Pstream::master()),
andOp<bool>()
);
} }
if (verbose_) if (verbose_)
@ -344,11 +338,8 @@ Foam::label Foam::parLagrangianDistributor::distributeStoredFields
if (!nFields) if (!nFields)
{ {
// Performing an all-to-one (reconstruct)? // Performing an all-to-one (reconstruct)?
reconstruct = returnReduce reconstruct =
( returnReduceAnd(!map.constructSize() || Pstream::master());
(!map.constructSize() || Pstream::master()),
andOp<bool>()
);
} }
if (verbose_) if (verbose_)

View File

@ -1547,7 +1547,7 @@ int main(int argc, char *argv[])
if if
( (
!volMeshHaveUndecomposed !volMeshHaveUndecomposed
|| !returnReduce(haveVolAddressing, andOp<bool>()) || !returnReduceAnd(haveVolAddressing)
) )
{ {
Info<< "No undecomposed mesh. Creating from: " Info<< "No undecomposed mesh. Creating from: "
@ -1615,7 +1615,7 @@ int main(int argc, char *argv[])
&& &&
( (
!areaMeshHaveUndecomposed !areaMeshHaveUndecomposed
|| !returnReduce(haveAreaAddressing, andOp<bool>()) || !returnReduceAnd(haveAreaAddressing)
) )
) )
{ {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -208,9 +208,9 @@ bool Foam::procFacesGAMGProcAgglomeration::doProcessorAgglomeration
const lduMesh& mesh const lduMesh& mesh
) const ) 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_; bool doAgg = mesh.lduAddr().size() < nAgglomeratingCells_;
mesh.reduce(doAgg, orOp<bool>()); UPstream::reduceOr(doAgg, mesh.comm());
return doAgg; return doAgg;
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -276,7 +276,7 @@ bool Foam::globalPoints::mergeInfo
// Updates database of current information on meshpoints with nbrInfo. Uses // Updates database of current information on meshpoints with nbrInfo. Uses
// mergeInfo above. Returns true if data kept for meshPointi changed. // mergeInfo above. Returns true if data kept for meshPointi changed.
label infoChanged = false; bool infoChanged = false;
// Get the index into the procPoints list. // Get the index into the procPoints list.
const auto iter = meshToProcPoint_.cfind(localPointi); const auto iter = meshToProcPoint_.cfind(localPointi);
@ -325,7 +325,7 @@ bool Foam::globalPoints::storeInitialInfo
// Updates database of current information on meshpoints with nbrInfo. Uses // Updates database of current information on meshpoints with nbrInfo. Uses
// mergeInfo above. Returns true if data kept for meshPointi changed. // mergeInfo above. Returns true if data kept for meshPointi changed.
label infoChanged = false; bool infoChanged = false;
// Get the index into the procPoints list. // Get the index into the procPoints list.
const auto iter = meshToProcPoint_.find(localPointi); const auto iter = meshToProcPoint_.find(localPointi);
@ -929,8 +929,7 @@ void Foam::globalPoints::calculateSharedPoints
neighbourList = meshToProcPoint_; neighbourList = meshToProcPoint_;
} }
// Exchange until nothing changes on all processors. // Exchange until nothing changes on any processors.
bool changed = false;
do do
{ {
@ -959,10 +958,7 @@ void Foam::globalPoints::calculateSharedPoints
changedPoints changedPoints
); );
changed = changedPoints.size() > 0; } while (returnReduceOr(changedPoints.size()));
reduce(changed, orOp<bool>());
} while (changed);
//Pout<< "**ALL** connected points:" << endl; //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 (not broadcast) to respect local out-of-order errors (first loop)
reduce(hasError, orOp<bool>()); return returnReduceOr(hasError);
return hasError;
} }
@ -1091,7 +1089,7 @@ bool Foam::polyBoundaryMesh::checkDefinition(const bool report) const
nextPatchStart += bm[patchi].size(); nextPatchStart += bm[patchi].size();
} }
reduce(hasError, orOp<bool>()); Pstream::reduceOr(hasError);
if (debug || report) 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 // Knock out empty and wedge directions. Note:they will be present on all
// domains. // domains.
label nEmptyPatches = 0; bool hasEmptyPatches = false;
label nWedgePatches = 0; bool hasWedgePatches = false;
vector emptyDirVec = Zero; vector emptyDirVec = Zero;
vector wedgeDirVec = Zero; vector wedgeDirVec = Zero;
@ -79,7 +79,7 @@ void Foam::polyMesh::calcDirections() const
if (pp.size()) if (pp.size())
{ {
nEmptyPatches++; hasEmptyPatches = true;
emptyDirVec += sum(cmptMag(fa)); emptyDirVec += sum(cmptMag(fa));
} }
} }
@ -93,16 +93,14 @@ void Foam::polyMesh::calcDirections() const
if (pp.size()) if (pp.size())
{ {
nWedgePatches++; hasWedgePatches = true;
wedgeDirVec += cmptMag(wpp.centreNormal()); wedgeDirVec += cmptMag(wpp.centreNormal());
} }
} }
} }
reduce(nEmptyPatches, maxOp<label>());
reduce(nWedgePatches, maxOp<label>());
if (nEmptyPatches) if (returnReduceOr(hasEmptyPatches))
{ {
reduce(emptyDirVec, sumOp<vector>()); reduce(emptyDirVec, sumOp<vector>());
@ -126,7 +124,7 @@ void Foam::polyMesh::calcDirections() const
geometricD_ = solutionD_; geometricD_ = solutionD_;
if (nWedgePatches) if (returnReduceOr(hasWedgePatches))
{ {
reduce(wedgeDirVec, sumOp<vector>()); reduce(wedgeDirVec, sumOp<vector>());
@ -339,21 +337,21 @@ Foam::polyMesh::polyMesh(const IOobject& io, const bool doInit)
neighbour_.write(); neighbour_.write();
} }
// Warn if global empty mesh if (returnReduceOr(boundary_.empty()))
if (returnReduce(boundary_.empty(), orOp<bool>()))
{ {
WarningInFunction 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 WarningInFunction
<< "no points in mesh" << endl; << "No points in mesh" << endl;
} }
if (returnReduce(nCells(), sumOp<label>()) == 0) if (returnReduceAnd(!nCells()))
{ {
WarningInFunction WarningInFunction
<< "no cells in mesh" << endl; << "No cells in mesh" << endl;
} }
} }
@ -802,14 +800,10 @@ void Foam::polyMesh::resetPrimitives
boundary_.calcGeometry(); boundary_.calcGeometry();
// Warn if global empty mesh // Warn if global empty mesh
if if (returnReduceAnd(!nPoints()) || returnReduceAnd(!nCells()))
(
(returnReduce(nPoints(), sumOp<label>()) == 0)
|| (returnReduce(nCells(), sumOp<label>()) == 0)
)
{ {
FatalErrorInFunction 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 | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016, 2020 OpenFOAM Foundation Copyright (C) 2011-2016, 2020 OpenFOAM Foundation
Copyright (C) 2018-2021 OpenCFD Ltd. Copyright (C) 2018-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -634,7 +634,6 @@ Foam::polyMesh::polyMesh
label nAllPatches = boundaryFaces.size(); label nAllPatches = boundaryFaces.size();
label nDefaultFaces = nFaces - defaultPatchStart; label nDefaultFaces = nFaces - defaultPatchStart;
if (syncPar) if (syncPar)
{ {

View File

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

View File

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

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -50,9 +51,9 @@ void Foam::wedgePolyPatch::calcGeometry(PstreamBuffers&)
return; return;
} }
if (returnReduce(size(), sumOp<label>())) if (returnReduceOr(size()))
{ {
const vectorField& nf(faceNormals()); const vectorField& nf = faceNormals();
n_ = gAverage(nf); n_ = gAverage(nf);
if (debug) if (debug)

View File

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

View File

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

View File

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

View File

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

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2019-2020 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -155,9 +155,7 @@ bool Foam::dynamicMotionSolverFvMeshAMI::update()
changeRequired = pp.changeTopology() || changeRequired; changeRequired = pp.changeTopology() || changeRequired;
} }
reduce(changeRequired, orOp<bool>()); if (returnReduceOr(changeRequired))
if (changeRequired)
{ {
polyTopoChange polyTopo(*this); polyTopoChange polyTopo(*this);

View File

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

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019-2021 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -311,8 +311,7 @@ void Foam::createShellMesh::calcPointRegions
} }
label nChangedFaces = returnReduce(changedFaces.size(), sumOp<label>()); if (returnReduceAnd(changedFaces.empty()))
if (nChangedFaces == 0)
{ {
break; break;
} }
@ -374,8 +373,7 @@ void Foam::createShellMesh::calcPointRegions
); );
label nChangedEdges = returnReduce(changedEdges.size(), sumOp<label>()); if (returnReduceAnd(changedEdges.empty()))
if (nChangedEdges == 0)
{ {
break; break;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. 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 else
{ {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2017 Wikki Ltd Copyright (C) 2017 Wikki Ltd
Copyright (C) 2021 OpenCFD Ltd. Copyright (C) 2021-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -287,8 +287,8 @@ Foam::faPatchList Foam::faMesh::createPatchList
patchDefsUsed.insert(bestPatchDefi); patchDefsUsed.insert(bestPatchDefi);
} }
// Remove undefPatchIndex if not actually needed // Remove undefPatchIndex if not actually needed anywhere
if (!returnReduce(patchDefsUsed.found(undefPatchIndex), orOp<bool>())) if (!returnReduceOr(patchDefsUsed.found(undefPatchIndex)))
{ {
faPatchDefs.remove(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 // Report directly as Info, not InfoInFunction
// since it can also be an expected result when // 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 // 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 // Use patchEntries, which were read on master and broadcast

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2021 OpenCFD Ltd. Copyright (C) 2021-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. 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()); 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 FatalErrorInFunction
<< "Had " << nBadEdges << "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 FatalErrorInFunction
<< "Had " << nBadEdges << " coupled boundary edges" << "Had " << nBadEdges << " coupled boundary edges"
@ -623,7 +623,7 @@ Foam::faMesh::getBoundaryEdgeConnections() const
} }
// Verbose report of missing edges // 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()); edgeList dumpEdges(patch().edges(), badEdges.sortedToc());

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018-2021 OpenCFD Ltd. Copyright (C) 2018-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -593,11 +593,7 @@ bool Foam::MRFZone::read(const dictionary& dict)
excludedPatchLabels_[i++] = patchi; excludedPatchLabels_[i++] = patchi;
} }
bool cellZoneFound = (cellZoneID_ != -1); if (!returnReduceOr(cellZoneID_ != -1))
reduce(cellZoneFound, orOp<bool>());
if (!cellZoneFound)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "cannot find MRF cellZone " << cellZoneName_ << "cannot find MRF cellZone " << cellZoneName_

View File

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

View File

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

View File

@ -58,7 +58,7 @@ Foam::expressions::patchExpr::parseDriver::getVariableIfAvailable
const label len = (hasPointData ? this->pointSize() : this->size()); const label len = (hasPointData ? this->pointSize() : this->size());
if (returnReduce((vals.size() == len), andOp<bool>())) if (returnReduceAnd(vals.size() == len))
{ {
// Return a copy of the field // Return a copy of the field
return tmp<Field<Type>>::New(vals); return tmp<Field<Type>>::New(vals);

View File

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

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018-2021 OpenCFD Ltd. Copyright (C) 2018-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -161,7 +161,7 @@ Foam::swirlFanVelocityFvPatchField::swirlFanVelocityFvPatchField
dict.getOrDefault dict.getOrDefault
( (
"origin", "origin",
returnReduce(patch().size(), maxOp<label>()) returnReduceOr(patch().size())
? gSum(patch().Cf()*patch().magSf())/gSum(patch().magSf()) ? gSum(patch().Cf()*patch().magSf())/gSum(patch().magSf())
: Zero : Zero
) )

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018-2021 OpenCFD Ltd. Copyright (C) 2018-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -68,7 +68,7 @@ swirlFlowRateInletVelocityFvPatchVectorField
dict.getOrDefault dict.getOrDefault
( (
"origin", "origin",
returnReduce(patch().size(), maxOp<label>()) returnReduceOr(patch().size())
? gSum(patch().Cf()*patch().magSf())/gSum(patch().magSf()) ? gSum(patch().Cf()*patch().magSf())/gSum(patch().magSf())
: Zero : Zero
) )
@ -78,7 +78,7 @@ swirlFlowRateInletVelocityFvPatchVectorField
dict.getOrDefault dict.getOrDefault
( (
"axis", "axis",
returnReduce(patch().size(), maxOp<label>()) returnReduceOr(patch().size())
? -gSum(patch().Sf())/gSum(patch().magSf()) ? -gSum(patch().Sf())/gSum(patch().magSf())
: Zero : Zero
) )

View File

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

View File

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

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2021 OpenCFD Ltd. Copyright (C) 2016-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -200,7 +200,7 @@ bool Foam::fvMeshSubsetProxy::correct(bool verbose)
subsetter_.reset(selectedCells_, exposedPatchId_); 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 // Some processors without patches? - add patches
if (returnReduce(mesh.boundary().empty(), orOp<bool>())) if (returnReduceOr(mesh.boundary().empty()))
{ {
DynamicList<polyPatch*> newPatches(patchEntries.size()); DynamicList<polyPatch*> newPatches(patchEntries.size());

View File

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

View File

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

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2021 OpenCFD Ltd. Copyright (C) 2015-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -60,7 +60,7 @@ inline bool Foam::functionObjects::fieldValues::surfaceFieldValue::canWeight
) const ) const
{ {
// Non-empty on some processor // 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 \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2021 OpenCFD Ltd. Copyright (C) 2021-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -49,7 +49,7 @@ inline bool Foam::functionObjects::fieldValues::volFieldValue::canWeight
) const ) const
{ {
// Non-empty on some processor // 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 \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018-2021 OpenCFD Ltd. Copyright (C) 2018-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -54,7 +54,7 @@ bool Foam::functionObjects::reference::calc()
Log << endl; Log << endl;
return returnReduce(processed, orOp<bool>()); return returnReduceOr(processed);
} }

View File

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

View File

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

View File

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

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2021 OpenCFD Ltd. Copyright (C) 2016-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -157,7 +157,7 @@ bool Foam::functionObjects::dsmcFields::write()
Member##Ptr = obr_.cfindObject<FieldType>(fldName); \ Member##Ptr = obr_.cfindObject<FieldType>(fldName); \
} \ } \
\ \
if (returnReduce(!Member##Ptr, orOp<bool>())) \ if (returnReduceOr(!Member##Ptr)) \
{ \ { \
Log << type() << ' ' << name() << " : no " << Name \ Log << type() << ' ' << name() << " : no " << Name \
<< " field found - not calculating\n"; \ << " field found - not calculating\n"; \

View File

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

View File

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

View File

@ -180,7 +180,7 @@ void Foam::fv::cellSetOption::setCellSelection()
selectedCells.insert(celli); selectedCells.insert(celli);
} }
if (!returnReduce(found, orOp<bool>())) if (!returnReduceOr(found))
{ {
WarningInFunction WarningInFunction
<< "No owner cell found for point " << p << endl; << "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 // We've changed internal values so give
// boundary conditions opportunity to correct // boundary conditions opportunity to correct

View File

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

View File

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