mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
Merge branch 'feature-mpi-updates' into 'develop'
More consistent use of combineReduce, simpler and/or reductions See merge request Development/openfoam!566
This commit is contained in:
@ -157,12 +157,7 @@ void Foam::radiation::laserDTRM::initialiseReflection()
|
||||
);
|
||||
}
|
||||
|
||||
if (reflections_.size())
|
||||
{
|
||||
reflectionSwitch_ = true;
|
||||
}
|
||||
|
||||
reflectionSwitch_ = returnReduce(reflectionSwitch_, orOp<bool>());
|
||||
reflectionSwitch_ = returnReduceOr(reflections_.size());
|
||||
}
|
||||
}
|
||||
|
||||
@ -299,14 +294,12 @@ void Foam::radiation::laserDTRM::initialise()
|
||||
DTRMCloud_.addParticle(pPtr);
|
||||
}
|
||||
|
||||
if (returnReduce(cellI, maxOp<label>()) == -1)
|
||||
if (nMissed < 10 && returnReduceAnd(cellI < 0))
|
||||
{
|
||||
if (++nMissed <= 10)
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Cannot find owner cell for focalPoint at "
|
||||
<< p0 << endl;
|
||||
}
|
||||
++nMissed;
|
||||
WarningInFunction
|
||||
<< "Cannot find owner cell for focalPoint at "
|
||||
<< p0 << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -113,7 +113,6 @@ int main(int argc, char *argv[])
|
||||
label coarseSize = max(addr)+1;
|
||||
|
||||
Info<< "Level : " << level << endl
|
||||
<< returnReduce(addr.size(), sumOp<label>()) << endl
|
||||
<< " current size : "
|
||||
<< returnReduce(addr.size(), sumOp<label>()) << endl
|
||||
<< " agglomerated size : "
|
||||
|
||||
@ -182,7 +182,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// MPI barrier
|
||||
bool barrier = true;
|
||||
Pstream::scatter(barrier);
|
||||
Pstream::broadcast(barrier);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -138,8 +138,8 @@ int main()
|
||||
maxFirstEqOp<label>()(maxIndexed, item);
|
||||
}
|
||||
|
||||
Pstream::combineAllGather(minIndexed, minFirstEqOp<label>());
|
||||
Pstream::combineAllGather(maxIndexed, maxFirstEqOp<label>());
|
||||
Pstream::combineReduce(minIndexed, minFirstEqOp<label>());
|
||||
Pstream::combineReduce(maxIndexed, maxFirstEqOp<label>());
|
||||
|
||||
Info<< "Min indexed: " << minIndexed << nl
|
||||
<< "Max indexed: " << maxIndexed << nl;
|
||||
@ -156,8 +156,8 @@ int main()
|
||||
maxIndexed = maxFirstOp<label>()(maxIndexed, item);
|
||||
}
|
||||
|
||||
Pstream::combineAllGather(minIndexed, minFirstEqOp<label>());
|
||||
Pstream::combineAllGather(maxIndexed, maxFirstEqOp<label>());
|
||||
Pstream::combineReduce(minIndexed, minFirstEqOp<label>());
|
||||
Pstream::combineReduce(maxIndexed, maxFirstEqOp<label>());
|
||||
|
||||
Info<< "Min indexed: " << minIndexed << nl
|
||||
<< "Max indexed: " << maxIndexed << nl;
|
||||
|
||||
@ -60,7 +60,7 @@ int main(int argc, char *argv[])
|
||||
Info<< "Reading " << file << nl << endl;
|
||||
decomposedBlockData data
|
||||
(
|
||||
Pstream::worldComm,
|
||||
UPstream::worldComm,
|
||||
IOobject
|
||||
(
|
||||
file,
|
||||
|
||||
@ -204,7 +204,7 @@ int main(int argc, char *argv[])
|
||||
labelPair inOut;
|
||||
pointField allCcs(globalNumbering.gather(mesh.cellCentres()));
|
||||
inOut[0] = allCcs.size();
|
||||
Pstream::scatter(allCcs);
|
||||
Pstream::broadcast(allCcs);
|
||||
inOut[1] = allCcs.size();
|
||||
Pout<< " " << inOut << endl;
|
||||
|
||||
|
||||
@ -234,11 +234,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
Pout<< "hashed: " << hashed << nl;
|
||||
|
||||
Pstream::mapCombineGather
|
||||
(
|
||||
hashed,
|
||||
plusEqOp<scalarMinMax>()
|
||||
);
|
||||
Pstream::mapCombineReduce(hashed, plusEqOp<scalarMinMax>());
|
||||
|
||||
Info<< "reduced: " << hashed << nl;
|
||||
|
||||
|
||||
@ -167,7 +167,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
localValue,
|
||||
sumOp<scalar>(),
|
||||
Pstream::msgType(),
|
||||
UPstream::msgType(),
|
||||
comm
|
||||
);
|
||||
Pout<< "sum :" << sum << endl;
|
||||
|
||||
@ -125,13 +125,13 @@ int main(int argc, char *argv[])
|
||||
scalar data1 = 1.0;
|
||||
label request1 = -1;
|
||||
{
|
||||
Foam::reduce(data1, sumOp<scalar>(), Pstream::msgType(), request1);
|
||||
Foam::reduce(data1, sumOp<scalar>(), UPstream::msgType(), request1);
|
||||
}
|
||||
|
||||
scalar data2 = 0.1;
|
||||
label request2 = -1;
|
||||
{
|
||||
Foam::reduce(data2, sumOp<scalar>(), Pstream::msgType(), request2);
|
||||
Foam::reduce(data2, sumOp<scalar>(), UPstream::msgType(), request2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -585,7 +585,7 @@ void createBaffles
|
||||
// Wrapper around find patch. Also makes sure same patch in parallel.
|
||||
label findPatch(const polyBoundaryMesh& patches, const word& patchName)
|
||||
{
|
||||
label patchi = patches.findPatchID(patchName);
|
||||
const label patchi = patches.findPatchID(patchName);
|
||||
|
||||
if (patchi == -1)
|
||||
{
|
||||
@ -597,16 +597,15 @@ label findPatch(const polyBoundaryMesh& patches, const word& patchName)
|
||||
|
||||
// Check same patch for all procs
|
||||
{
|
||||
label newPatch = patchi;
|
||||
reduce(newPatch, minOp<label>());
|
||||
const label newPatchi = returnReduce(patchi, minOp<label>());
|
||||
|
||||
if (newPatch != patchi)
|
||||
if (newPatchi != patchi)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Patch " << patchName
|
||||
<< " should have the same patch index on all processors." << nl
|
||||
<< "On my processor it has index " << patchi
|
||||
<< " ; on some other processor it has index " << newPatch
|
||||
<< " ; on some other processor it has index " << newPatchi
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -396,12 +397,11 @@ int main(int argc, char *argv[])
|
||||
meshSearch queryMesh(mesh);
|
||||
|
||||
// Check all 'outside' points
|
||||
forAll(outsidePts, outsideI)
|
||||
for (const point& outsidePoint : outsidePts)
|
||||
{
|
||||
const point& outsidePoint = outsidePts[outsideI];
|
||||
const label celli = queryMesh.findCell(outsidePoint, -1, false);
|
||||
|
||||
label celli = queryMesh.findCell(outsidePoint, -1, false);
|
||||
if (returnReduce(celli, maxOp<label>()) == -1)
|
||||
if (returnReduceAnd(celli < 0))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "outsidePoint " << outsidePoint
|
||||
|
||||
@ -538,8 +538,11 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Add any patches.
|
||||
|
||||
label nAdded = nPatches - mesh.boundaryMesh().size();
|
||||
reduce(nAdded, sumOp<label>());
|
||||
const label nAdded = returnReduce
|
||||
(
|
||||
nPatches - mesh.boundaryMesh().size(),
|
||||
sumOp<label>()
|
||||
);
|
||||
|
||||
Info<< "Adding overall " << nAdded << " processor patches." << endl;
|
||||
|
||||
@ -946,9 +949,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Put all modifications into meshMod
|
||||
bool anyChange = collapser.setRefinement(allPointInfo, meshMod);
|
||||
reduce(anyChange, orOp<bool>());
|
||||
|
||||
if (anyChange)
|
||||
if (returnReduceOr(anyChange))
|
||||
{
|
||||
// Construct new mesh from polyTopoChange.
|
||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
||||
@ -1118,8 +1120,7 @@ int main(int argc, char *argv[])
|
||||
processorMeshes::removeFiles(mesh);
|
||||
|
||||
// Need writing cellSet
|
||||
label nAdded = returnReduce(addedCellsSet.size(), sumOp<label>());
|
||||
if (nAdded > 0)
|
||||
if (returnReduceOr(addedCellsSet.size()))
|
||||
{
|
||||
cellSet addedCells(mesh, "addedCells", addedCellsSet);
|
||||
Info<< "Writing added cells to cellSet " << addedCells.name()
|
||||
|
||||
@ -345,7 +345,7 @@ void deleteEmptyPatches(fvMesh& mesh)
|
||||
else
|
||||
{
|
||||
// Common patch.
|
||||
if (returnReduce(patches[patchi].empty(), andOp<bool>()))
|
||||
if (returnReduceAnd(patches[patchi].empty()))
|
||||
{
|
||||
Pout<< "Deleting patch " << patchi
|
||||
<< " name:" << patches[patchi].name()
|
||||
@ -661,8 +661,8 @@ void countExtrudePatches
|
||||
}
|
||||
// Synchronise decision. Actual numbers are not important, just make
|
||||
// sure that they're > 0 on all processors.
|
||||
Pstream::listCombineAllGather(zoneSidePatch, plusEqOp<label>());
|
||||
Pstream::listCombineAllGather(zoneZonePatch, plusEqOp<label>());
|
||||
Pstream::listCombineReduce(zoneSidePatch, plusEqOp<label>());
|
||||
Pstream::listCombineReduce(zoneZonePatch, plusEqOp<label>());
|
||||
}
|
||||
|
||||
|
||||
@ -1848,7 +1848,7 @@ int main(int argc, char *argv[])
|
||||
const primitiveFacePatch extrudePatch(std::move(zoneFaces), mesh.points());
|
||||
|
||||
|
||||
Pstream::listCombineAllGather(isInternal, orEqOp<bool>());
|
||||
Pstream::listCombineReduce(isInternal, orEqOp<bool>());
|
||||
|
||||
// Check zone either all internal or all external faces
|
||||
checkZoneInside(mesh, zoneNames, zoneID, extrudeMeshFaces, isInternal);
|
||||
@ -2309,7 +2309,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
// Reduce
|
||||
Pstream::mapCombineAllGather(globalSum, plusEqOp<point>());
|
||||
Pstream::mapCombineReduce(globalSum, plusEqOp<point>());
|
||||
|
||||
forAll(localToGlobalRegion, localRegionI)
|
||||
{
|
||||
|
||||
@ -588,9 +588,8 @@ Foam::label Foam::DistributedDelaunayMesh<Triangulation>::referVertices
|
||||
reduce(preInsertionSize, sumOp<label>());
|
||||
reduce(postInsertionSize, sumOp<label>());
|
||||
|
||||
label nTotalToInsert = referredVertices.size();
|
||||
|
||||
reduce(nTotalToInsert, sumOp<label>());
|
||||
label nTotalToInsert =
|
||||
returnReduce(referredVertices.size(), sumOp<label>());
|
||||
|
||||
if (preInsertionSize + nTotalToInsert != postInsertionSize)
|
||||
{
|
||||
|
||||
@ -217,7 +217,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
|
||||
);
|
||||
}
|
||||
|
||||
if (returnReduce(newCellsToRefine.size(), sumOp<label>()) == 0)
|
||||
if (returnReduceAnd(newCellsToRefine.empty()))
|
||||
{
|
||||
break;
|
||||
}
|
||||
@ -878,7 +878,7 @@ Foam::backgroundMeshDecomposition::distribute
|
||||
}
|
||||
}
|
||||
|
||||
if (returnReduce(cellsToRefine.size(), sumOp<label>()) == 0)
|
||||
if (returnReduceAnd(cellsToRefine.empty()))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -87,23 +87,17 @@ void Foam::conformalVoronoiMesh::cellSizeMeshOverlapsBackground() const
|
||||
|
||||
boundBox cellSizeMeshBb = cellSizeMesh.bounds();
|
||||
|
||||
bool fullyContained = true;
|
||||
bool fullyContained = cellSizeMeshBb.contains(bb);
|
||||
|
||||
if (!cellSizeMeshBb.contains(bb))
|
||||
if (!fullyContained)
|
||||
{
|
||||
Pout<< "Triangulation not fully contained in cell size mesh."
|
||||
<< endl;
|
||||
|
||||
Pout<< "Cell Size Mesh Bounds = " << cellSizeMesh.bounds() << endl;
|
||||
Pout<< "foamyHexMesh Bounds = " << bb << endl;
|
||||
|
||||
fullyContained = false;
|
||||
Pout<< "Triangulation not fully contained in cell size mesh." << endl
|
||||
<< "Cell Size Mesh Bounds = " << cellSizeMeshBb << endl
|
||||
<< "foamyHexMesh Bounds = " << bb << endl;
|
||||
}
|
||||
|
||||
reduce(fullyContained, andOp<unsigned int>());
|
||||
|
||||
Info<< "Triangulation is "
|
||||
<< (fullyContained ? "fully" : "not fully")
|
||||
<< (returnReduceAnd(fullyContained) ? "fully" : "not fully")
|
||||
<< " contained in the cell size mesh"
|
||||
<< endl;
|
||||
}
|
||||
@ -115,12 +109,7 @@ void Foam::conformalVoronoiMesh::insertInternalPoints
|
||||
bool distribute
|
||||
)
|
||||
{
|
||||
label nPoints = points.size();
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
reduce(nPoints, sumOp<label>());
|
||||
}
|
||||
const label nPoints = returnReduce(points.size(), sumOp<label>());
|
||||
|
||||
Info<< " " << nPoints << " points to insert..." << endl;
|
||||
|
||||
@ -145,16 +134,15 @@ void Foam::conformalVoronoiMesh::insertInternalPoints
|
||||
map().distribute(points);
|
||||
}
|
||||
|
||||
label nVert = number_of_vertices();
|
||||
label preReinsertionSize(number_of_vertices());
|
||||
|
||||
insert(points.begin(), points.end());
|
||||
|
||||
label nInserted(number_of_vertices() - nVert);
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
reduce(nInserted, sumOp<label>());
|
||||
}
|
||||
const label nInserted = returnReduce
|
||||
(
|
||||
label(number_of_vertices()) - preReinsertionSize,
|
||||
sumOp<label>()
|
||||
);
|
||||
|
||||
Info<< " " << nInserted << " points inserted"
|
||||
<< ", failed to insert " << nPoints - nInserted
|
||||
|
||||
@ -753,7 +753,7 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints
|
||||
|
||||
forAll(patches, p)
|
||||
{
|
||||
label totalPatchSize = patchDicts[p].get<label>("nFaces");
|
||||
label nPatchFaces = patchDicts[p].get<label>("nFaces");
|
||||
|
||||
if
|
||||
(
|
||||
@ -762,7 +762,7 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints
|
||||
)
|
||||
{
|
||||
// Do not create empty processor patches
|
||||
if (totalPatchSize > 0)
|
||||
if (nPatchFaces)
|
||||
{
|
||||
patchDicts[p].set("transform", "coincidentFullMatch");
|
||||
|
||||
@ -781,9 +781,8 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints
|
||||
else
|
||||
{
|
||||
// Check that the patch is not empty on every processor
|
||||
reduce(totalPatchSize, sumOp<label>());
|
||||
|
||||
if (totalPatchSize > 0)
|
||||
if (returnReduceOr(nPatchFaces))
|
||||
{
|
||||
patches[nValidPatches] = polyPatch::New
|
||||
(
|
||||
|
||||
@ -729,7 +729,7 @@ Foam::label Foam::conformalVoronoiMesh::synchroniseSurfaceTrees
|
||||
}
|
||||
}
|
||||
|
||||
Pstream::listCombineAllGather(hits, plusEqOp<labelHashSet>());
|
||||
Pstream::listCombineReduce(hits, plusEqOp<labelHashSet>());
|
||||
|
||||
forAll(surfaceHits, eI)
|
||||
{
|
||||
@ -816,7 +816,7 @@ Foam::label Foam::conformalVoronoiMesh::synchroniseEdgeTrees
|
||||
}
|
||||
}
|
||||
|
||||
Pstream::listCombineAllGather(hits, plusEqOp<labelHashSet>());
|
||||
Pstream::listCombineReduce(hits, plusEqOp<labelHashSet>());
|
||||
|
||||
forAll(featureEdgeHits, eI)
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -707,9 +707,7 @@ void Foam::conformalVoronoiMesh::reorderProcessorPatches
|
||||
|
||||
Info<< incrIndent << indent << "Faces matched." << endl;
|
||||
|
||||
reduce(anyChanged, orOp<bool>());
|
||||
|
||||
if (anyChanged)
|
||||
if (returnReduceOr(anyChanged))
|
||||
{
|
||||
label nReorderedFaces = 0;
|
||||
|
||||
|
||||
@ -727,14 +727,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
pointField mergedPoints;
|
||||
faceList mergedFaces;
|
||||
labelList pointMergeMap;
|
||||
PatchTools::gatherAndMerge
|
||||
(
|
||||
tolDim,
|
||||
primitivePatch(SubList<face>(isoFaces), isoPoints),
|
||||
mergedPoints,
|
||||
mergedFaces,
|
||||
pointMergeMap
|
||||
mergedFaces
|
||||
);
|
||||
|
||||
if (Pstream::master())
|
||||
|
||||
@ -416,10 +416,12 @@ void extractSurface
|
||||
|
||||
// Allocate zone/patch for all patches
|
||||
HashTable<label> compactZoneID(1024);
|
||||
forAllConstIters(patchSize, iter)
|
||||
if (Pstream::master())
|
||||
{
|
||||
label sz = compactZoneID.size();
|
||||
compactZoneID.insert(iter.key(), sz);
|
||||
forAllConstIters(patchSize, iter)
|
||||
{
|
||||
compactZoneID.insert(iter.key(), compactZoneID.size());
|
||||
}
|
||||
}
|
||||
Pstream::broadcast(compactZoneID);
|
||||
|
||||
@ -431,7 +433,7 @@ void extractSurface
|
||||
label patchi = bMesh.findPatchID(iter.key());
|
||||
if (patchi != -1)
|
||||
{
|
||||
patchToCompactZone[patchi] = iter();
|
||||
patchToCompactZone[patchi] = iter.val();
|
||||
}
|
||||
}
|
||||
|
||||
@ -663,7 +665,7 @@ void removeZeroSizedPatches(fvMesh& mesh)
|
||||
if
|
||||
(
|
||||
isA<coupledPolyPatch>(pp)
|
||||
|| returnReduce(pp.size(), sumOp<label>())
|
||||
|| returnReduceOr(pp.size())
|
||||
)
|
||||
{
|
||||
// Coupled (and unknown size) or uncoupled and used
|
||||
@ -1889,11 +1891,8 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
// Use the maxLocalCells from the refinement parameters
|
||||
bool preBalance = returnReduce
|
||||
(
|
||||
(mesh.nCells() >= refineParams.maxLocalCells()),
|
||||
orOp<bool>()
|
||||
);
|
||||
const bool preBalance =
|
||||
returnReduceOr(mesh.nCells() >= refineParams.maxLocalCells());
|
||||
|
||||
|
||||
if (!overwrite && !debugLevel)
|
||||
|
||||
@ -187,7 +187,7 @@ void Foam::checkPatch
|
||||
{
|
||||
const labelList& mp = pp.meshPoints();
|
||||
|
||||
if (returnReduce(mp.size(), sumOp<label>()) > 0)
|
||||
if (returnReduceOr(mp.size()))
|
||||
{
|
||||
boundBox bb(pp.points(), mp, true); // reduce
|
||||
Info<< ' ' << bb;
|
||||
@ -252,10 +252,10 @@ Foam::label Foam::checkTopology
|
||||
}
|
||||
}
|
||||
reduce(nEmpty, sumOp<label>());
|
||||
label nTotCells = returnReduce(mesh.cells().size(), sumOp<label>());
|
||||
const label nCells = returnReduce(mesh.cells().size(), sumOp<label>());
|
||||
|
||||
// These are actually warnings, not errors.
|
||||
if (nTotCells && (nEmpty % nTotCells))
|
||||
if (nCells && (nEmpty % nCells))
|
||||
{
|
||||
Info<< " ***Total number of faces on empty patches"
|
||||
<< " is not divisible by the number of cells in the mesh."
|
||||
@ -335,7 +335,7 @@ Foam::label Foam::checkTopology
|
||||
{
|
||||
noFailedChecks++;
|
||||
|
||||
label nPoints = returnReduce(points.size(), sumOp<label>());
|
||||
const label nPoints = returnReduce(points.size(), sumOp<label>());
|
||||
|
||||
Info<< " <<Writing " << nPoints
|
||||
<< " unused points to set " << points.name() << endl;
|
||||
@ -472,7 +472,7 @@ Foam::label Foam::checkTopology
|
||||
}
|
||||
}
|
||||
|
||||
label nOneCells = returnReduce(oneCells.size(), sumOp<label>());
|
||||
const label nOneCells = returnReduce(oneCells.size(), sumOp<label>());
|
||||
|
||||
if (nOneCells > 0)
|
||||
{
|
||||
@ -488,7 +488,7 @@ Foam::label Foam::checkTopology
|
||||
}
|
||||
}
|
||||
|
||||
label nTwoCells = returnReduce(twoCells.size(), sumOp<label>());
|
||||
const label nTwoCells = returnReduce(twoCells.size(), sumOp<label>());
|
||||
|
||||
if (nTwoCells > 0)
|
||||
{
|
||||
@ -588,11 +588,7 @@ Foam::label Foam::checkTopology
|
||||
}
|
||||
}
|
||||
|
||||
Pstream::listCombineAllGather
|
||||
(
|
||||
regionDisconnected,
|
||||
andEqOp<bool>()
|
||||
);
|
||||
Pstream::listCombineReduce(regionDisconnected, andEqOp<bool>());
|
||||
}
|
||||
|
||||
|
||||
@ -639,7 +635,7 @@ Foam::label Foam::checkTopology
|
||||
cellRegions[i].write();
|
||||
}
|
||||
|
||||
label nPoints = returnReduce(points.size(), sumOp<label>());
|
||||
const label nPoints = returnReduce(points.size(), sumOp<label>());
|
||||
if (nPoints)
|
||||
{
|
||||
Info<< " <<Writing " << nPoints
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -138,7 +138,7 @@ void filterPatches(fvMesh& mesh, const wordHashSet& addedPatchNames)
|
||||
if
|
||||
(
|
||||
isA<coupledPolyPatch>(pp)
|
||||
|| returnReduce(pp.size(), sumOp<label>())
|
||||
|| returnReduceOr(pp.size())
|
||||
|| addedPatchNames.found(pp.name())
|
||||
)
|
||||
{
|
||||
|
||||
@ -686,7 +686,7 @@ void syncPoints
|
||||
|
||||
//- Note: hasTransformation is only used for warning messages so
|
||||
// reduction not strictly necessary.
|
||||
//reduce(hasTransformation, orOp<bool>());
|
||||
//Pstream::reduceOr(hasTransformation);
|
||||
|
||||
// Synchronize multiple shared points.
|
||||
const globalMeshData& pd = mesh.globalData();
|
||||
@ -714,7 +714,7 @@ void syncPoints
|
||||
}
|
||||
|
||||
// Combine - globally consistent
|
||||
Pstream::listCombineAllGather(sharedPts, cop);
|
||||
Pstream::listCombineReduce(sharedPts, cop);
|
||||
|
||||
// Now we will all have the same information. Merge it back with
|
||||
// my local information.
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -272,7 +273,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
if (returnReduce(changedEdges.size(), sumOp<label>()) == 0)
|
||||
if (returnReduceAnd(changedEdges.empty()))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -1103,9 +1103,7 @@ int main(int argc, char *argv[])
|
||||
// Update proc maps
|
||||
if (cellProcAddressing.headerOk())
|
||||
{
|
||||
bool localOk = (cellProcAddressing.size() == mesh.nCells());
|
||||
|
||||
if (returnReduce(localOk, andOp<bool>()))
|
||||
if (returnReduceAnd(cellProcAddressing.size() == mesh.nCells()))
|
||||
{
|
||||
Info<< "Renumbering processor cell decomposition map "
|
||||
<< cellProcAddressing.name() << endl;
|
||||
@ -1129,9 +1127,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (faceProcAddressing.headerOk())
|
||||
{
|
||||
bool localOk = (faceProcAddressing.size() == mesh.nFaces());
|
||||
|
||||
if (returnReduce(localOk, andOp<bool>()))
|
||||
if (returnReduceAnd(faceProcAddressing.size() == mesh.nFaces()))
|
||||
{
|
||||
Info<< "Renumbering processor face decomposition map "
|
||||
<< faceProcAddressing.name() << endl;
|
||||
@ -1171,9 +1167,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (pointProcAddressing.headerOk())
|
||||
{
|
||||
bool localOk = (pointProcAddressing.size() == mesh.nPoints());
|
||||
|
||||
if (returnReduce(localOk, andOp<bool>()))
|
||||
if (returnReduceAnd(pointProcAddressing.size() == mesh.nPoints()))
|
||||
{
|
||||
Info<< "Renumbering processor point decomposition map "
|
||||
<< pointProcAddressing.name() << endl;
|
||||
@ -1197,12 +1191,13 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (boundaryProcAddressing.headerOk())
|
||||
{
|
||||
bool localOk =
|
||||
if
|
||||
(
|
||||
boundaryProcAddressing.size()
|
||||
== mesh.boundaryMesh().size()
|
||||
);
|
||||
if (returnReduce(localOk, andOp<bool>()))
|
||||
returnReduceAnd
|
||||
(
|
||||
boundaryProcAddressing.size() == mesh.boundaryMesh().size()
|
||||
)
|
||||
)
|
||||
{
|
||||
// No renumbering needed
|
||||
}
|
||||
|
||||
@ -847,7 +847,7 @@ void createAndWriteRegion
|
||||
|
||||
if (!isA<processorPolyPatch>(pp))
|
||||
{
|
||||
if (returnReduce(pp.size(), sumOp<label>()) > 0)
|
||||
if (returnReduceOr(pp.size()))
|
||||
{
|
||||
oldToNew[patchi] = newI;
|
||||
if (!addedPatches.found(patchi))
|
||||
@ -1114,7 +1114,7 @@ label findCorrespondingRegion
|
||||
}
|
||||
}
|
||||
|
||||
Pstream::listCombineAllGather(cellsInZone, plusEqOp<label>());
|
||||
Pstream::listCombineReduce(cellsInZone, plusEqOp<label>());
|
||||
|
||||
// Pick region with largest overlap of zoneI
|
||||
label regionI = findMax(cellsInZone);
|
||||
|
||||
@ -223,7 +223,7 @@ bool writeOptionalMeshObject
|
||||
|
||||
// Make sure all know if there is a valid class name
|
||||
wordList classNames(1, io.headerClassName());
|
||||
Pstream::combineAllGather(classNames, uniqueEqOp<word>());
|
||||
Pstream::combineReduce(classNames, uniqueEqOp<word>());
|
||||
|
||||
// Check for correct type
|
||||
if (classNames[0] == T::typeName)
|
||||
@ -429,7 +429,7 @@ int main(int argc, char *argv[])
|
||||
)
|
||||
);
|
||||
|
||||
Pstream::combineAllGather(lagrangianDirs, uniqueEqOp<fileName>());
|
||||
Pstream::combineReduce(lagrangianDirs, uniqueEqOp<fileName>());
|
||||
|
||||
if (!lagrangianDirs.empty())
|
||||
{
|
||||
@ -466,7 +466,7 @@ int main(int argc, char *argv[])
|
||||
)
|
||||
);
|
||||
|
||||
Pstream::combineAllGather(cloudDirs, uniqueEqOp<fileName>());
|
||||
Pstream::combineReduce(cloudDirs, uniqueEqOp<fileName>());
|
||||
|
||||
forAll(cloudDirs, i)
|
||||
{
|
||||
@ -492,7 +492,7 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
// Combine with all other cloud objects
|
||||
Pstream::combineAllGather(cloudFields, uniqueEqOp<word>());
|
||||
Pstream::combineReduce(cloudFields, uniqueEqOp<word>());
|
||||
|
||||
for (const word& name : cloudFields)
|
||||
{
|
||||
|
||||
@ -252,7 +252,7 @@ autoPtr<mapPolyMesh> mergeSharedPoints
|
||||
Info<< "mergeSharedPoints : detected " << pointToMaster.size()
|
||||
<< " points that are to be merged." << endl;
|
||||
|
||||
if (returnReduce(pointToMaster.size(), sumOp<label>()) == 0)
|
||||
if (returnReduceAnd(pointToMaster.empty()))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -89,10 +89,11 @@ void Foam::parLagrangianDistributor::findClouds
|
||||
}
|
||||
|
||||
// Synchronise cloud names
|
||||
Pstream::combineGather(cloudNames, ListOps::uniqueEqOp<word>());
|
||||
Pstream::broadcast(cloudNames);
|
||||
Pstream::combineReduce(cloudNames, ListOps::uniqueEqOp<word>());
|
||||
Foam::sort(cloudNames); // Consistent order
|
||||
|
||||
objectNames.setSize(cloudNames.size());
|
||||
objectNames.clear();
|
||||
objectNames.resize(cloudNames.size());
|
||||
|
||||
for (const fileName& localCloudName : localCloudDirs)
|
||||
{
|
||||
@ -124,11 +125,11 @@ void Foam::parLagrangianDistributor::findClouds
|
||||
}
|
||||
}
|
||||
|
||||
// Synchronise objectNames
|
||||
forAll(objectNames, i)
|
||||
// Synchronise objectNames (per cloud)
|
||||
for (wordList& objNames : objectNames)
|
||||
{
|
||||
Pstream::combineGather(objectNames[i], ListOps::uniqueEqOp<word>());
|
||||
Pstream::broadcast(objectNames[i]);
|
||||
Pstream::combineReduce(objNames, ListOps::uniqueEqOp<word>());
|
||||
Foam::sort(objNames); // Consistent order
|
||||
}
|
||||
}
|
||||
|
||||
@ -291,7 +292,7 @@ Foam::parLagrangianDistributor::distributeLagrangianPositions
|
||||
nsTransPs[sendProcI] = subMap[sendProcI].size();
|
||||
}
|
||||
// Send sizes across. Note: blocks.
|
||||
Pstream::combineAllGather(sizes, Pstream::listEq());
|
||||
Pstream::combineReduce(sizes, Pstream::listEq());
|
||||
|
||||
labelListList constructMap(Pstream::nProcs());
|
||||
label constructSize = 0;
|
||||
|
||||
@ -51,14 +51,9 @@ Foam::wordList Foam::parLagrangianDistributor::filterObjects
|
||||
: objects.names<Container>(selectedFields)
|
||||
);
|
||||
|
||||
// Parallel synchronise
|
||||
// - Combine names from all processors
|
||||
|
||||
Pstream::combineGather(fieldNames, ListOps::uniqueEqOp<word>());
|
||||
Pstream::broadcast(fieldNames);
|
||||
|
||||
// Sort for consistent order on all processors
|
||||
Foam::sort(fieldNames);
|
||||
// Parallel synchronise - combine names from all processors
|
||||
Pstream::combineReduce(fieldNames, ListOps::uniqueEqOp<word>());
|
||||
Foam::sort(fieldNames); // Consistent order
|
||||
|
||||
return fieldNames;
|
||||
}
|
||||
@ -93,11 +88,8 @@ Foam::label Foam::parLagrangianDistributor::distributeFields
|
||||
if (!nFields)
|
||||
{
|
||||
// Performing an all-to-one (reconstruct)?
|
||||
reconstruct = returnReduce
|
||||
(
|
||||
(!map.constructSize() || Pstream::master()),
|
||||
andOp<bool>()
|
||||
);
|
||||
reconstruct =
|
||||
returnReduceAnd(!map.constructSize() || Pstream::master());
|
||||
}
|
||||
|
||||
if (verbose_)
|
||||
@ -200,11 +192,8 @@ Foam::label Foam::parLagrangianDistributor::distributeFieldFields
|
||||
if (!nFields)
|
||||
{
|
||||
// Performing an all-to-one (reconstruct)?
|
||||
reconstruct = returnReduce
|
||||
(
|
||||
(!map.constructSize() || Pstream::master()),
|
||||
andOp<bool>()
|
||||
);
|
||||
reconstruct =
|
||||
returnReduceAnd(!map.constructSize() || Pstream::master());
|
||||
}
|
||||
|
||||
if (verbose_)
|
||||
@ -349,11 +338,8 @@ Foam::label Foam::parLagrangianDistributor::distributeStoredFields
|
||||
if (!nFields)
|
||||
{
|
||||
// Performing an all-to-one (reconstruct)?
|
||||
reconstruct = returnReduce
|
||||
(
|
||||
(!map.constructSize() || Pstream::master()),
|
||||
andOp<bool>()
|
||||
);
|
||||
reconstruct =
|
||||
returnReduceAnd(!map.constructSize() || Pstream::master());
|
||||
}
|
||||
|
||||
if (verbose_)
|
||||
|
||||
@ -132,7 +132,7 @@ void createTimeDirs(const fileName& path)
|
||||
//Pstream::parRun(oldParRun); // Restore parallel state
|
||||
masterTimeDirs = localTimeDirs;
|
||||
}
|
||||
Pstream::scatter(masterTimeDirs);
|
||||
Pstream::broadcast(masterTimeDirs);
|
||||
//DebugVar(masterTimeDirs);
|
||||
//DebugVar(localTimeDirs);
|
||||
|
||||
@ -1168,7 +1168,7 @@ int main(int argc, char *argv[])
|
||||
bool nfs = true;
|
||||
{
|
||||
List<fileName> roots(1, args.rootPath());
|
||||
Pstream::combineAllGather(roots, ListOps::uniqueEqOp<fileName>());
|
||||
Pstream::combineReduce(roots, ListOps::uniqueEqOp<fileName>());
|
||||
nfs = (roots.size() == 1);
|
||||
}
|
||||
|
||||
@ -1203,7 +1203,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
// If master changed to decompose mode make sure all nodes know about it
|
||||
Pstream::scatter(decompose);
|
||||
Pstream::broadcast(decompose);
|
||||
|
||||
|
||||
// If running distributed we have problem of new processors not finding
|
||||
@ -1288,7 +1288,7 @@ int main(int argc, char *argv[])
|
||||
// use the times list from the master processor
|
||||
// and select a subset based on the command-line options
|
||||
instantList timeDirs = timeSelector::select(runTime.times(), args);
|
||||
Pstream::scatter(timeDirs);
|
||||
Pstream::broadcast(timeDirs);
|
||||
|
||||
if (timeDirs.empty())
|
||||
{
|
||||
@ -1547,7 +1547,7 @@ int main(int argc, char *argv[])
|
||||
if
|
||||
(
|
||||
!volMeshHaveUndecomposed
|
||||
|| !returnReduce(haveVolAddressing, andOp<bool>())
|
||||
|| !returnReduceAnd(haveVolAddressing)
|
||||
)
|
||||
{
|
||||
Info<< "No undecomposed mesh. Creating from: "
|
||||
@ -1615,7 +1615,7 @@ int main(int argc, char *argv[])
|
||||
&&
|
||||
(
|
||||
!areaMeshHaveUndecomposed
|
||||
|| !returnReduce(haveAreaAddressing, andOp<bool>())
|
||||
|| !returnReduceAnd(haveAreaAddressing)
|
||||
)
|
||||
)
|
||||
{
|
||||
@ -2067,7 +2067,7 @@ int main(int argc, char *argv[])
|
||||
args
|
||||
)[0].value();
|
||||
}
|
||||
Pstream::scatter(masterTime);
|
||||
Pstream::broadcast(masterTime);
|
||||
Info<< "Setting time to that of master or undecomposed case : "
|
||||
<< masterTime << endl;
|
||||
runTime.setTime(masterTime, 0);
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -78,6 +78,6 @@ if (timeDirs.size() > 1)
|
||||
}
|
||||
|
||||
// Ensure consistency
|
||||
reduce(hasMovingMesh, orOp<bool>());
|
||||
Pstream::reduceOr(hasMovingMesh);
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -38,7 +38,7 @@ if (doLagrangian)
|
||||
Info<< "Cloud " << cloudName << " (";
|
||||
|
||||
const bool cloudExists =
|
||||
returnReduce(currentCloudDirs.found(cloudName), orOp<bool>());
|
||||
returnReduceOr(currentCloudDirs.found(cloudName));
|
||||
|
||||
{
|
||||
autoPtr<ensightFile> os = ensCase.newCloud(cloudName);
|
||||
@ -82,7 +82,7 @@ if (doLagrangian)
|
||||
const bool oldParRun = Pstream::parRun(false);
|
||||
fieldExists = fieldObject.typeHeaderOk<IOField<scalar>>(false);
|
||||
Pstream::parRun(oldParRun); // Restore parallel state
|
||||
reduce(fieldExists, orOp<bool>());
|
||||
Pstream::reduceOr(fieldExists);
|
||||
}
|
||||
|
||||
bool wrote = false;
|
||||
|
||||
@ -101,7 +101,7 @@ if (timeDirs.size() && doLagrangian)
|
||||
{
|
||||
for (auto& cloudFields : regionCloudFields)
|
||||
{
|
||||
Pstream::mapCombineAllGather
|
||||
Pstream::mapCombineReduce
|
||||
(
|
||||
cloudFields,
|
||||
HashTableOps::plusEqOp<word>()
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -64,9 +64,7 @@ Foam::label Foam::checkData
|
||||
}
|
||||
}
|
||||
|
||||
reduce(good, andOp<bool>());
|
||||
|
||||
if (good)
|
||||
if (returnReduceAnd(good))
|
||||
{
|
||||
goodFields.insert(fieldName);
|
||||
}
|
||||
|
||||
@ -46,11 +46,9 @@ if (doLagrangian)
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Synchronise cloud names
|
||||
Pstream::combineGather(cloudNames, ListOps::uniqueEqOp<word>());
|
||||
Pstream::broadcast(cloudNames);
|
||||
Pstream::combineReduce(cloudNames, ListOps::uniqueEqOp<word>());
|
||||
}
|
||||
// Consistent order
|
||||
Foam::sort(cloudNames);
|
||||
Foam::sort(cloudNames); // Consistent order
|
||||
|
||||
for (const word& cloudName : cloudNames)
|
||||
{
|
||||
@ -66,7 +64,7 @@ if (doLagrangian)
|
||||
isCloud = true;
|
||||
}
|
||||
|
||||
if (!returnReduce(isCloud, orOp<bool>()))
|
||||
if (!returnReduceOr(isCloud))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -78,7 +76,7 @@ if (doLagrangian)
|
||||
);
|
||||
|
||||
// Are there cloud fields (globally)?
|
||||
if (returnReduce(cloudObjs.empty(), andOp<bool>()))
|
||||
if (returnReduceAnd(cloudObjs.empty()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ int main(int argc, char *argv[])
|
||||
const label maxNProcs = returnReduce(maxIds.size(), maxOp<label>());
|
||||
maxIds.resize(maxNProcs, -1);
|
||||
|
||||
Pstream::listCombineAllGather(maxIds, maxEqOp<label>());
|
||||
Pstream::listCombineReduce(maxIds, maxEqOp<label>());
|
||||
|
||||
// From ids to count
|
||||
const labelList numIds = maxIds + 1;
|
||||
|
||||
@ -77,8 +77,7 @@ Foam::label Foam::particleTracksSampler::setTrackFields
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
Pstream::combineGather(fieldNames, ListOps::uniqueEqOp<word>());
|
||||
Pstream::broadcast(fieldNames);
|
||||
Pstream::combineReduce(fieldNames, ListOps::uniqueEqOp<word>());
|
||||
}
|
||||
|
||||
for (const word& fieldName : fieldNames)
|
||||
|
||||
@ -15,10 +15,5 @@ wordRes acceptFields(propsDict.get<wordRes>("fields"));
|
||||
wordRes excludeFields;
|
||||
propsDict.readIfPresent("exclude", excludeFields);
|
||||
|
||||
const dictionary formatOptions
|
||||
(
|
||||
propsDict.subOrEmptyDict("formatOptions", keyType::LITERAL)
|
||||
);
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -68,7 +69,7 @@ void Foam::channelIndex::walkOppositeFaces
|
||||
blockedFace[facei] = true;
|
||||
}
|
||||
|
||||
while (returnReduce(frontFaces.size(), sumOp<label>()) > 0)
|
||||
while (returnReduceOr(frontFaces.size()))
|
||||
{
|
||||
// Transfer across.
|
||||
boolList isFrontBndFace(nBnd, false);
|
||||
|
||||
@ -40,7 +40,7 @@ Foam::Field<T> Foam::channelIndex::regionSum(const Field<T>& cellField) const
|
||||
}
|
||||
|
||||
// Global sum
|
||||
Pstream::listCombineAllGather(regionField, plusEqOp<T>());
|
||||
Pstream::listCombineReduce(regionField, plusEqOp<T>());
|
||||
|
||||
return regionField;
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -238,7 +238,7 @@ void rewriteBoundary
|
||||
|
||||
patches.reorder(oldToNew);
|
||||
|
||||
if (returnReduce(nOldCyclics, sumOp<label>()) > 0)
|
||||
if (returnReduceOr(nOldCyclics))
|
||||
{
|
||||
if (dryrun)
|
||||
{
|
||||
@ -299,7 +299,7 @@ void rewriteField
|
||||
|
||||
dictionary& boundaryField = fieldDict.subDict("boundaryField");
|
||||
|
||||
label nChanged = 0;
|
||||
bool hasChange = false;
|
||||
|
||||
forAllConstIters(thisNames, iter)
|
||||
{
|
||||
@ -337,13 +337,13 @@ void rewriteField
|
||||
);
|
||||
Info<< " Adding entry " << nbrNames[patchName] << endl;
|
||||
|
||||
nChanged++;
|
||||
hasChange = true;
|
||||
}
|
||||
}
|
||||
|
||||
//Info<< "New boundaryField:" << boundaryField << endl;
|
||||
|
||||
if (returnReduce(nChanged, sumOp<label>()) > 0)
|
||||
if (returnReduceOr(hasChange))
|
||||
{
|
||||
if (dryrun)
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -113,10 +113,9 @@ void mapLagrangian(const meshToMesh& interp)
|
||||
|
||||
if
|
||||
(
|
||||
returnReduce
|
||||
returnReduceOr
|
||||
(
|
||||
(objects.found("coordinates") || objects.found("positions")),
|
||||
orOp<bool>()
|
||||
objects.found("coordinates") || objects.found("positions")
|
||||
)
|
||||
)
|
||||
{
|
||||
|
||||
@ -85,7 +85,7 @@ for (const int proci : Pstream::allProcs())
|
||||
}
|
||||
}
|
||||
|
||||
} while (returnReduce(i < myFc.size(), orOp<bool>()));
|
||||
} while (returnReduceOr(i < myFc.size()));
|
||||
|
||||
List<pointIndexHit> hitInfo(startIndex.size());
|
||||
surfacesMesh.findLine(start, end, hitInfo);
|
||||
@ -176,7 +176,7 @@ for (const int proci : Pstream::allProcs())
|
||||
firstLoop = false;
|
||||
iter ++;
|
||||
|
||||
} while (returnReduce(hitInfo.size(), orOp<bool>()) > 0 && iter < 10);
|
||||
} while (returnReduceOr(hitInfo.size()) && iter < 10);
|
||||
|
||||
startIndex.clear();
|
||||
end.clear();
|
||||
|
||||
@ -531,15 +531,10 @@ int main(int argc, char *argv[])
|
||||
nFineFaces += patches[patchi].size();
|
||||
}
|
||||
|
||||
// total number of coarse faces
|
||||
label totalNCoarseFaces = nCoarseFaces;
|
||||
|
||||
reduce(totalNCoarseFaces, sumOp<label>());
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
Info << "\nTotal number of coarse faces: "<< totalNCoarseFaces << endl;
|
||||
}
|
||||
Info<< "\nTotal number of coarse faces: "
|
||||
<< returnReduce(nCoarseFaces, sumOp<label>())
|
||||
<< endl;
|
||||
|
||||
if (Pstream::master() && debug)
|
||||
{
|
||||
@ -829,15 +824,11 @@ int main(int argc, char *argv[])
|
||||
nCoarseFaces
|
||||
);
|
||||
|
||||
label totalPatches = coarsePatches.size();
|
||||
reduce(totalPatches, maxOp<label>());
|
||||
const label totalPatches =
|
||||
returnReduce(coarsePatches.size(), maxOp<label>());
|
||||
|
||||
// Matrix sum in j(Fij) for each i (if enclosure sum = 1)
|
||||
scalarSquareMatrix sumViewFactorPatch
|
||||
(
|
||||
totalPatches,
|
||||
0.0
|
||||
);
|
||||
scalarSquareMatrix sumViewFactorPatch(totalPatches, Zero);
|
||||
|
||||
scalarList patchArea(totalPatches, Zero);
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -302,17 +302,19 @@ int main(int argc, char *argv[])
|
||||
Pstream::mapCombineGather(patchSize, plusEqOp<label>());
|
||||
Pstream::mapCombineGather(zoneSize, plusEqOp<label>());
|
||||
|
||||
// Allocate compact numbering for all patches/faceZones
|
||||
forAllConstIters(patchSize, iter)
|
||||
if (Pstream::master())
|
||||
{
|
||||
compactZoneID.insert(iter.key(), compactZoneID.size());
|
||||
}
|
||||
// Allocate compact numbering for all patches/faceZones
|
||||
forAllConstIters(patchSize, iter)
|
||||
{
|
||||
compactZoneID.insert(iter.key(), compactZoneID.size());
|
||||
}
|
||||
|
||||
forAllConstIters(zoneSize, iter)
|
||||
{
|
||||
compactZoneID.insert(iter.key(), compactZoneID.size());
|
||||
forAllConstIters(zoneSize, iter)
|
||||
{
|
||||
compactZoneID.insert(iter.key(), compactZoneID.size());
|
||||
}
|
||||
}
|
||||
|
||||
Pstream::broadcast(compactZoneID);
|
||||
|
||||
|
||||
@ -391,13 +393,9 @@ int main(int argc, char *argv[])
|
||||
// Gather all faces
|
||||
List<faceList> gatheredFaces(Pstream::nProcs());
|
||||
gatheredFaces[Pstream::myProcNo()] = allBoundary.localFaces();
|
||||
forAll(gatheredFaces[Pstream::myProcNo()], i)
|
||||
for (face& f : gatheredFaces[Pstream::myProcNo()])
|
||||
{
|
||||
inplaceRenumber
|
||||
(
|
||||
pointToGlobal,
|
||||
gatheredFaces[Pstream::myProcNo()][i]
|
||||
);
|
||||
inplaceRenumber(pointToGlobal, f);
|
||||
}
|
||||
Pstream::gatherList(gatheredFaces);
|
||||
|
||||
|
||||
@ -252,7 +252,7 @@ int main(int argc, char *argv[])
|
||||
dict.add("bounds", bbs);
|
||||
|
||||
// Scatter patch information
|
||||
Pstream::scatter(s.patches());
|
||||
Pstream::broadcast(s.patches());
|
||||
|
||||
// Construct distributedTrisurfaceMesh from components
|
||||
IOobject notReadIO(io);
|
||||
|
||||
@ -202,7 +202,7 @@ void Foam::ParSortableList<Type>::sort()
|
||||
|
||||
getPivots(sortedPivots, pivots);
|
||||
}
|
||||
Pstream::scatter(pivots);
|
||||
Pstream::broadcast(pivots);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
|
||||
@ -90,12 +90,10 @@ void Foam::IOobjectList::syncNames(wordList& objNames)
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Synchronize names
|
||||
Pstream::combineGather(objNames, ListOps::uniqueEqOp<word>());
|
||||
Pstream::broadcast(objNames);
|
||||
Pstream::combineReduce(objNames, ListOps::uniqueEqOp<word>());
|
||||
}
|
||||
|
||||
// Consistent order on all processors
|
||||
Foam::sort(objNames);
|
||||
Foam::sort(objNames); // Consistent order
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -482,7 +482,7 @@ bool Foam::PstreamBuffers::finishedSends
|
||||
}
|
||||
}
|
||||
|
||||
reduce(changed, orOp<bool>());
|
||||
UPstream::reduceOr(changed);
|
||||
|
||||
if (changed)
|
||||
{
|
||||
|
||||
@ -327,7 +327,7 @@ public:
|
||||
// \return True on success
|
||||
static bool write
|
||||
(
|
||||
const commsTypes commsType,
|
||||
const UPstream::commsTypes commsType,
|
||||
const int toProcNo,
|
||||
const char* buf,
|
||||
const std::streamsize bufSize,
|
||||
|
||||
@ -434,7 +434,7 @@ Foam::UPstream::commsTypes Foam::UPstream::defaultCommsType
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
// Register re-reader
|
||||
//- Registered reader for UPstream::defaultCommsType
|
||||
class addcommsTypeToOpt
|
||||
:
|
||||
public ::Foam::simpleRegIOobject
|
||||
|
||||
@ -66,12 +66,12 @@ public:
|
||||
//- Types of communications
|
||||
enum class commsTypes : char
|
||||
{
|
||||
blocking, //!< "blocking"
|
||||
scheduled, //!< "scheduled"
|
||||
nonBlocking //!< "nonBlocking"
|
||||
blocking, //!< "blocking" : (MPI_Bsend, MPI_Recv)
|
||||
scheduled, //!< "scheduled" : (MPI_Send, MPI_Recv)
|
||||
nonBlocking //!< "nonBlocking" : (MPI_Isend, MPI_Irecv)
|
||||
};
|
||||
|
||||
//- Names of the communication types
|
||||
//- Enumerated names for the communication types
|
||||
static const Enum<commsTypes> commsTypeNames;
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -317,7 +317,7 @@ Foam::functionEntries::codeStream::getFunction
|
||||
bool haveLib = lib;
|
||||
if (!doingMasterOnlyReading(topDict))
|
||||
{
|
||||
reduce(haveLib, andOp<bool>());
|
||||
Pstream::reduceAnd(haveLib);
|
||||
}
|
||||
|
||||
if (!haveLib)
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -332,7 +332,8 @@ void Foam::codedBase::createLibrary
|
||||
<< " after waiting: have masterSize:" << masterSize
|
||||
<< " and localSize:" << mySize << endl;
|
||||
}
|
||||
reduce(create, orOp<bool>());
|
||||
|
||||
Pstream::reduceOr(create); // MPI barrier
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1171,7 +1171,7 @@ bool Foam::functionObjectList::read()
|
||||
FatalIOError.throwing(oldThrowingIOerr);
|
||||
|
||||
// Require valid functionObject on all processors
|
||||
if (!returnReduce(bool(objPtr), andOp<bool>()))
|
||||
if (!returnReduceAnd(bool(objPtr)))
|
||||
{
|
||||
objPtr.reset(nullptr);
|
||||
ok = false;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2010-2018 Bernhard Gschaider
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -309,8 +309,7 @@ bool Foam::expressions::exprDriver::isLocalVariable
|
||||
// Do size checking if requested
|
||||
if (good && expectedSize >= 0)
|
||||
{
|
||||
good = (var.size() == expectedSize);
|
||||
reduce(good, andOp<bool>());
|
||||
good = returnReduceAnd(var.size() == expectedSize);
|
||||
|
||||
if (debug && !good)
|
||||
{
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -52,7 +52,7 @@ Foam::expressions::fieldExpr::parseDriver::getField
|
||||
|
||||
const label len = (hasPointData ? this->pointSize() : this->size());
|
||||
|
||||
if (returnReduce((vals.size() == len), andOp<bool>()))
|
||||
if (returnReduceAnd(vals.size() == len))
|
||||
{
|
||||
// Return a copy of the field
|
||||
return tmp<Field<Type>>::New(vals);
|
||||
|
||||
@ -579,7 +579,7 @@ template<class Type> \
|
||||
ReturnType gFunc(const UList<Type>& f, const label comm) \
|
||||
{ \
|
||||
ReturnType res = Func(f); \
|
||||
reduce(res, rFunc##Op<ReturnType>(), Pstream::msgType(), comm); \
|
||||
reduce(res, rFunc##Op<ReturnType>(), UPstream::msgType(), comm); \
|
||||
return res; \
|
||||
} \
|
||||
TMP_UNARY_FUNCTION(ReturnType, gFunc)
|
||||
@ -611,7 +611,7 @@ typename scalarProduct<Type, Type>::type gSumProd
|
||||
typedef typename scalarProduct<Type, Type>::type prodType;
|
||||
|
||||
prodType result = sumProd(f1, f2);
|
||||
reduce(result, sumOp<prodType>(), Pstream::msgType(), comm);
|
||||
reduce(result, sumOp<prodType>(), UPstream::msgType(), comm);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -624,7 +624,7 @@ Type gSumCmptProd
|
||||
)
|
||||
{
|
||||
Type SumProd = sumCmptProd(f1, f2);
|
||||
reduce(SumProd, sumOp<Type>(), Pstream::msgType(), comm);
|
||||
reduce(SumProd, sumOp<Type>(), UPstream::msgType(), comm);
|
||||
return SumProd;
|
||||
}
|
||||
|
||||
@ -637,7 +637,7 @@ Type gAverage
|
||||
{
|
||||
label n = f.size();
|
||||
Type s = sum(f);
|
||||
sumReduce(s, n, Pstream::msgType(), comm);
|
||||
sumReduce(s, n, UPstream::msgType(), comm);
|
||||
|
||||
if (n > 0)
|
||||
{
|
||||
|
||||
@ -172,7 +172,7 @@ Foam::Tuple2<T1,T2> Foam::FieldOps::findMinData
|
||||
result.second() = data[i];
|
||||
}
|
||||
|
||||
Pstream::combineAllGather(result, minFirstEqOp<T1>());
|
||||
Pstream::combineReduce(result, minFirstEqOp<T1>());
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -193,7 +193,7 @@ Foam::Tuple2<T1,T2> Foam::FieldOps::findMaxData
|
||||
result.second() = data[i];
|
||||
}
|
||||
|
||||
Pstream::combineAllGather(result, maxFirstEqOp<T1>());
|
||||
Pstream::combineReduce(result, maxFirstEqOp<T1>());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -1077,18 +1077,16 @@ bool Foam::GeometricField<Type, PatchField, GeoMesh>::needReference() const
|
||||
|
||||
bool needRef = true;
|
||||
|
||||
forAll(boundaryField_, patchi)
|
||||
for (const auto& pf : boundaryField_)
|
||||
{
|
||||
if (boundaryField_[patchi].fixesValue())
|
||||
if (pf.fixesValue())
|
||||
{
|
||||
needRef = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
reduce(needRef, andOp<bool>());
|
||||
|
||||
return needRef;
|
||||
return returnReduceAnd(needRef);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2032,7 +2032,7 @@ Foam::fileOperations::masterUncollatedFileOperation::readStream
|
||||
}
|
||||
// Reduce (not broadcast)
|
||||
// - if we have multiple master files (FUTURE)
|
||||
reduce(bigSize, orOp<bool>()); //, UPstream::msgType(), comm_);
|
||||
Pstream::reduceOr(bigSize); //, comm_);
|
||||
|
||||
const UPstream::commsTypes myCommsType
|
||||
(
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -196,7 +196,7 @@ Foam::procFacesGAMGProcAgglomeration::processorAgglomeration
|
||||
fineToCoarse = labelUIndList(oldToNew, fineToCoarse)();
|
||||
}
|
||||
|
||||
Pstream::scatter(fineToCoarse, Pstream::msgType(), mesh.comm());
|
||||
Pstream::broadcast(fineToCoarse, mesh.comm());
|
||||
UPstream::freeCommunicator(singleCellMeshComm);
|
||||
|
||||
return tfineToCoarse;
|
||||
@ -208,9 +208,9 @@ bool Foam::procFacesGAMGProcAgglomeration::doProcessorAgglomeration
|
||||
const lduMesh& mesh
|
||||
) const
|
||||
{
|
||||
// Check the need for further agglomeration on all processors
|
||||
// Check the need for further agglomeration on any processors
|
||||
bool doAgg = mesh.lduAddr().size() < nAgglomeratingCells_;
|
||||
mesh.reduce(doAgg, orOp<bool>());
|
||||
UPstream::reduceOr(doAgg, mesh.comm());
|
||||
return doAgg;
|
||||
}
|
||||
|
||||
|
||||
@ -1934,7 +1934,7 @@ Foam::pointField Foam::globalMeshData::geometricSharedPoints() const
|
||||
pointField sharedPoints(mesh_.points(), sharedPointLabels());
|
||||
|
||||
// Append from all processors, globally consistent
|
||||
Pstream::combineAllGather(sharedPoints, ListOps::appendEqOp<point>());
|
||||
Pstream::combineReduce(sharedPoints, ListOps::appendEqOp<point>());
|
||||
|
||||
// Merge tolerance
|
||||
scalar tolDim = matchTol_ * mesh_.bounds().mag();
|
||||
@ -2730,7 +2730,7 @@ void Foam::globalMeshData::updateMesh()
|
||||
(
|
||||
mesh_.nFaces(),
|
||||
sumOp<label>(),
|
||||
Pstream::msgType(),
|
||||
UPstream::msgType(),
|
||||
comm
|
||||
);
|
||||
|
||||
@ -2743,7 +2743,7 @@ void Foam::globalMeshData::updateMesh()
|
||||
(
|
||||
mesh_.nCells(),
|
||||
sumOp<label>(),
|
||||
Pstream::msgType(),
|
||||
UPstream::msgType(),
|
||||
comm
|
||||
);
|
||||
|
||||
@ -2756,7 +2756,7 @@ void Foam::globalMeshData::updateMesh()
|
||||
(
|
||||
mesh_.nPoints(),
|
||||
sumOp<label>(),
|
||||
Pstream::msgType(),
|
||||
UPstream::msgType(),
|
||||
comm
|
||||
);
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -276,7 +276,7 @@ bool Foam::globalPoints::mergeInfo
|
||||
// Updates database of current information on meshpoints with nbrInfo. Uses
|
||||
// mergeInfo above. Returns true if data kept for meshPointi changed.
|
||||
|
||||
label infoChanged = false;
|
||||
bool infoChanged = false;
|
||||
|
||||
// Get the index into the procPoints list.
|
||||
const auto iter = meshToProcPoint_.cfind(localPointi);
|
||||
@ -325,7 +325,7 @@ bool Foam::globalPoints::storeInitialInfo
|
||||
// Updates database of current information on meshpoints with nbrInfo. Uses
|
||||
// mergeInfo above. Returns true if data kept for meshPointi changed.
|
||||
|
||||
label infoChanged = false;
|
||||
bool infoChanged = false;
|
||||
|
||||
// Get the index into the procPoints list.
|
||||
const auto iter = meshToProcPoint_.find(localPointi);
|
||||
@ -929,8 +929,7 @@ void Foam::globalPoints::calculateSharedPoints
|
||||
neighbourList = meshToProcPoint_;
|
||||
}
|
||||
|
||||
// Exchange until nothing changes on all processors.
|
||||
bool changed = false;
|
||||
// Exchange until nothing changes on any processors.
|
||||
|
||||
do
|
||||
{
|
||||
@ -959,10 +958,7 @@ void Foam::globalPoints::calculateSharedPoints
|
||||
changedPoints
|
||||
);
|
||||
|
||||
changed = changedPoints.size() > 0;
|
||||
reduce(changed, orOp<bool>());
|
||||
|
||||
} while (changed);
|
||||
} while (returnReduceOr(changedPoints.size()));
|
||||
|
||||
|
||||
//Pout<< "**ALL** connected points:" << endl;
|
||||
|
||||
@ -412,7 +412,7 @@ public:
|
||||
const globalIndex&,
|
||||
labelList& elements,
|
||||
List<Map<label>>& compactMap,
|
||||
const int tag = Pstream::msgType(),
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm
|
||||
);
|
||||
|
||||
@ -426,7 +426,7 @@ public:
|
||||
const globalIndex&,
|
||||
labelListList& cellCells,
|
||||
List<Map<label>>& compactMap,
|
||||
const int tag = Pstream::msgType(),
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm
|
||||
);
|
||||
|
||||
|
||||
@ -1046,9 +1046,7 @@ bool Foam::polyBoundaryMesh::checkParallelSync(const bool report) const
|
||||
}
|
||||
|
||||
// Reduce (not broadcast) to respect local out-of-order errors (first loop)
|
||||
reduce(hasError, orOp<bool>());
|
||||
|
||||
return hasError;
|
||||
return returnReduceOr(hasError);
|
||||
}
|
||||
|
||||
|
||||
@ -1091,7 +1089,7 @@ bool Foam::polyBoundaryMesh::checkDefinition(const bool report) const
|
||||
nextPatchStart += bm[patchi].size();
|
||||
}
|
||||
|
||||
reduce(hasError, orOp<bool>());
|
||||
Pstream::reduceOr(hasError);
|
||||
|
||||
if (debug || report)
|
||||
{
|
||||
|
||||
@ -62,8 +62,8 @@ void Foam::polyMesh::calcDirections() const
|
||||
// Knock out empty and wedge directions. Note:they will be present on all
|
||||
// domains.
|
||||
|
||||
label nEmptyPatches = 0;
|
||||
label nWedgePatches = 0;
|
||||
bool hasEmptyPatches = false;
|
||||
bool hasWedgePatches = false;
|
||||
|
||||
vector emptyDirVec = Zero;
|
||||
vector wedgeDirVec = Zero;
|
||||
@ -79,7 +79,7 @@ void Foam::polyMesh::calcDirections() const
|
||||
|
||||
if (pp.size())
|
||||
{
|
||||
nEmptyPatches++;
|
||||
hasEmptyPatches = true;
|
||||
emptyDirVec += sum(cmptMag(fa));
|
||||
}
|
||||
}
|
||||
@ -93,16 +93,14 @@ void Foam::polyMesh::calcDirections() const
|
||||
|
||||
if (pp.size())
|
||||
{
|
||||
nWedgePatches++;
|
||||
hasWedgePatches = true;
|
||||
wedgeDirVec += cmptMag(wpp.centreNormal());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
reduce(nEmptyPatches, maxOp<label>());
|
||||
reduce(nWedgePatches, maxOp<label>());
|
||||
|
||||
if (nEmptyPatches)
|
||||
if (returnReduceOr(hasEmptyPatches))
|
||||
{
|
||||
reduce(emptyDirVec, sumOp<vector>());
|
||||
|
||||
@ -126,7 +124,7 @@ void Foam::polyMesh::calcDirections() const
|
||||
|
||||
geometricD_ = solutionD_;
|
||||
|
||||
if (nWedgePatches)
|
||||
if (returnReduceOr(hasWedgePatches))
|
||||
{
|
||||
reduce(wedgeDirVec, sumOp<vector>());
|
||||
|
||||
@ -339,21 +337,21 @@ Foam::polyMesh::polyMesh(const IOobject& io, const bool doInit)
|
||||
neighbour_.write();
|
||||
}
|
||||
|
||||
// Warn if global empty mesh
|
||||
if (returnReduce(boundary_.empty(), orOp<bool>()))
|
||||
if (returnReduceOr(boundary_.empty()))
|
||||
{
|
||||
WarningInFunction
|
||||
<< "mesh missing boundary on one or more domains" << endl;
|
||||
<< "Missing mesh boundary on one or more domains" << endl;
|
||||
|
||||
if (returnReduce(nPoints(), sumOp<label>()) == 0)
|
||||
// Warn if global empty mesh
|
||||
if (returnReduceAnd(!nPoints()))
|
||||
{
|
||||
WarningInFunction
|
||||
<< "no points in mesh" << endl;
|
||||
<< "No points in mesh" << endl;
|
||||
}
|
||||
if (returnReduce(nCells(), sumOp<label>()) == 0)
|
||||
if (returnReduceAnd(!nCells()))
|
||||
{
|
||||
WarningInFunction
|
||||
<< "no cells in mesh" << endl;
|
||||
<< "No cells in mesh" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -802,14 +800,10 @@ void Foam::polyMesh::resetPrimitives
|
||||
boundary_.calcGeometry();
|
||||
|
||||
// Warn if global empty mesh
|
||||
if
|
||||
(
|
||||
(returnReduce(nPoints(), sumOp<label>()) == 0)
|
||||
|| (returnReduce(nCells(), sumOp<label>()) == 0)
|
||||
)
|
||||
if (returnReduceAnd(!nPoints()) || returnReduceAnd(!nCells()))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "no points or no cells in mesh" << endl;
|
||||
<< "No points or no cells in mesh" << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016, 2020 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -634,7 +634,6 @@ Foam::polyMesh::polyMesh
|
||||
|
||||
label nAllPatches = boundaryFaces.size();
|
||||
|
||||
|
||||
label nDefaultFaces = nFaces - defaultPatchStart;
|
||||
if (syncPar)
|
||||
{
|
||||
|
||||
@ -776,7 +776,7 @@ Foam::labelList Foam::polyMeshTetDecomposition::adjustTetBasePtIs
|
||||
|
||||
syncTools::syncFaceList(mesh, tetBasePtIs, maxEqOp<label>());
|
||||
|
||||
if (report && returnReduce(nAdapted, sumOp<label>()))
|
||||
if (report && returnReduceOr(nAdapted))
|
||||
{
|
||||
Pout<< "Adapted starting point of triangulation on "
|
||||
<< nAdapted << " faces." << endl;
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2013-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -46,9 +47,9 @@ void Foam::symmetryPlanePolyPatch::calcGeometry(PstreamBuffers&)
|
||||
{
|
||||
if (n_ == vector::rootMax)
|
||||
{
|
||||
if (returnReduce(size(), sumOp<label>()))
|
||||
if (returnReduceOr(size()))
|
||||
{
|
||||
const vectorField& nf(faceNormals());
|
||||
const vectorField& nf = faceNormals();
|
||||
n_ = gAverage(nf);
|
||||
|
||||
if (debug)
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -50,9 +51,9 @@ void Foam::wedgePolyPatch::calcGeometry(PstreamBuffers&)
|
||||
return;
|
||||
}
|
||||
|
||||
if (returnReduce(size(), sumOp<label>()))
|
||||
if (returnReduceOr(size()))
|
||||
{
|
||||
const vectorField& nf(faceNormals());
|
||||
const vectorField& nf = faceNormals();
|
||||
n_ = gAverage(nf);
|
||||
|
||||
if (debug)
|
||||
|
||||
@ -322,7 +322,7 @@ void Foam::syncTools::syncPointMap
|
||||
}
|
||||
|
||||
// Broadcast: send merged values to all
|
||||
Pstream::scatter(sharedPointValues);
|
||||
Pstream::broadcast(sharedPointValues);
|
||||
}
|
||||
|
||||
// Merge sharedPointValues (keyed on sharedPointAddr) into
|
||||
@ -667,7 +667,7 @@ void Foam::syncTools::syncEdgeMap
|
||||
}
|
||||
|
||||
// Broadcast: send merged values to all
|
||||
Pstream::scatter(sharedEdgeValues);
|
||||
Pstream::broadcast(sharedEdgeValues);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -601,7 +601,7 @@ bool Foam::faceZone::checkParallelSync(const bool report) const
|
||||
}
|
||||
}
|
||||
|
||||
return returnReduce(hasError, orOp<bool>());
|
||||
return returnReduceOr(hasError);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -221,9 +221,48 @@ public:
|
||||
//
|
||||
// \param[in] mergeDist Geometric merge tolerance for Foam::mergePoints
|
||||
// \param[in] pp The patch to merge
|
||||
// \param[out] mergedPoints
|
||||
// \param[out] mergedFaces
|
||||
// \param[out] pointMergeMap
|
||||
// \param[out] mergedPoints merged points (master only, empty elsewhere)
|
||||
// \param[out] mergedFaces merged faces (master only, empty elsewhere)
|
||||
// \param[out] pointAddr Points globalIndex gather addressing
|
||||
// (master only, empty elsewhere)
|
||||
// \param[out] faceAddr Faces globalIndex gather addressing
|
||||
// (master only, empty elsewhere)
|
||||
// \param[out] pointMergeMap An old-to-new mapping from original
|
||||
// point index to the index into merged points.
|
||||
// \param[in] useLocal gather/merge patch localFaces/localPoints
|
||||
// instead of faces/points
|
||||
//
|
||||
// \note
|
||||
// - OpenFOAM-v2112 and earlier: geometric merge on all patch points.
|
||||
// - OpenFOAM-v2206 and later: geometric merge on patch boundary points.
|
||||
template<class FaceList, class PointField>
|
||||
static void gatherAndMerge
|
||||
(
|
||||
const scalar mergeDist,
|
||||
const PrimitivePatch<FaceList, PointField>& pp,
|
||||
Field
|
||||
<
|
||||
typename PrimitivePatch<FaceList, PointField>::point_type
|
||||
>& mergedPoints,
|
||||
List
|
||||
<
|
||||
typename PrimitivePatch<FaceList, PointField>::face_type
|
||||
>& mergedFaces,
|
||||
globalIndex& pointAddr,
|
||||
globalIndex& faceAddr,
|
||||
labelList& pointMergeMap = const_cast<labelList&>(labelList::null()),
|
||||
const bool useLocal = false
|
||||
);
|
||||
|
||||
//- Gather points and faces onto master and merge into single patch.
|
||||
// Note: Normally uses faces/points (not localFaces/localPoints)
|
||||
//
|
||||
// \param[in] mergeDist Geometric merge tolerance for Foam::mergePoints
|
||||
// \param[in] pp The patch to merge
|
||||
// \param[out] mergedPoints merged points (master only, empty elsewhere)
|
||||
// \param[out] mergedFaces merged faces (master only, empty elsewhere)
|
||||
// \param[out] pointMergeMap An old-to-new mapping from original
|
||||
// point index to the index into merged points.
|
||||
// \param[in] useLocal gather/merge patch localFaces/localPoints
|
||||
// instead of faces/points
|
||||
//
|
||||
@ -243,19 +282,20 @@ public:
|
||||
<
|
||||
typename PrimitivePatch<FaceList, PointField>::face_type
|
||||
>& mergedFaces,
|
||||
labelList& pointMergeMap,
|
||||
labelList& pointMergeMap = const_cast<labelList&>(labelList::null()),
|
||||
const bool useLocal = false
|
||||
);
|
||||
|
||||
//- Gather (mesh!) points and faces onto master and merge collocated
|
||||
// points into a single patch. Uses coupled point mesh
|
||||
// structure so does not need tolerances.
|
||||
// On master and slave returns:
|
||||
// On master and sub-ranks returns:
|
||||
// - pointToGlobal : for every local point index the global point index
|
||||
// - uniqueMeshPointLabels : my local mesh points
|
||||
// - globalPoints : global numbering for the global points
|
||||
// - globalFaces : global numbering for the faces
|
||||
// On master only:
|
||||
// .
|
||||
// On master only returns:
|
||||
// - mergedFaces : the merged faces
|
||||
// - mergedPoints : the merged points
|
||||
template<class FaceList>
|
||||
|
||||
@ -46,17 +46,19 @@ void Foam::PatchTools::gatherAndMerge
|
||||
<
|
||||
typename PrimitivePatch<FaceList, PointField>::face_type
|
||||
>& mergedFaces,
|
||||
globalIndex& pointAddr,
|
||||
globalIndex& faceAddr,
|
||||
labelList& pointMergeMap,
|
||||
const bool useLocal
|
||||
)
|
||||
{
|
||||
typedef typename PrimitivePatch<FaceList,PointField>::face_type FaceType;
|
||||
typedef typename PrimitivePatch<FaceList, PointField>::face_type FaceType;
|
||||
|
||||
// Faces from all ranks
|
||||
const globalIndex faceAddr(pp.size(), globalIndex::gatherOnly{});
|
||||
faceAddr = globalIndex(pp.size(), globalIndex::gatherOnly{});
|
||||
|
||||
// Points from all ranks
|
||||
const globalIndex pointAddr
|
||||
pointAddr = globalIndex
|
||||
(
|
||||
(useLocal ? pp.localPoints().size() : pp.points().size()),
|
||||
globalIndex::gatherOnly{}
|
||||
@ -152,6 +154,40 @@ void Foam::PatchTools::gatherAndMerge
|
||||
}
|
||||
|
||||
|
||||
template<class FaceList, class PointField>
|
||||
void Foam::PatchTools::gatherAndMerge
|
||||
(
|
||||
const scalar mergeDist,
|
||||
const PrimitivePatch<FaceList, PointField>& pp,
|
||||
Field
|
||||
<
|
||||
typename PrimitivePatch<FaceList, PointField>::point_type
|
||||
>& mergedPoints,
|
||||
List
|
||||
<
|
||||
typename PrimitivePatch<FaceList, PointField>::face_type
|
||||
>& mergedFaces,
|
||||
labelList& pointMergeMap,
|
||||
const bool useLocal
|
||||
)
|
||||
{
|
||||
globalIndex pointAddr;
|
||||
globalIndex faceAddr;
|
||||
|
||||
PatchTools::gatherAndMerge<FaceList, PointField>
|
||||
(
|
||||
mergeDist,
|
||||
pp,
|
||||
mergedPoints,
|
||||
mergedFaces,
|
||||
pointAddr,
|
||||
faceAddr,
|
||||
pointMergeMap,
|
||||
useLocal
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class FaceList>
|
||||
void Foam::PatchTools::gatherAndMerge
|
||||
(
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -425,8 +425,7 @@ bool Foam::primitiveMesh::checkFaceOrthogonality
|
||||
|
||||
if (debug || report)
|
||||
{
|
||||
label neiSize = ortho.size();
|
||||
reduce(neiSize, sumOp<label>());
|
||||
const label neiSize = returnReduce(ortho.size(), sumOp<label>());
|
||||
|
||||
if (neiSize > 0)
|
||||
{
|
||||
@ -929,9 +928,9 @@ bool Foam::primitiveMesh::checkUpperTriangular
|
||||
label internal = nInternalFaces();
|
||||
|
||||
// Has error occurred?
|
||||
bool error = false;
|
||||
// Have multiple faces been detected?
|
||||
label nMultipleCells = false;
|
||||
bool hasError = false;
|
||||
// Multiple faces detected?
|
||||
label nMultipleCells = 0;
|
||||
|
||||
// Loop through faceCells once more and make sure that for internal cell
|
||||
// the first label is smaller
|
||||
@ -939,7 +938,7 @@ bool Foam::primitiveMesh::checkUpperTriangular
|
||||
{
|
||||
if (own[facei] >= nei[facei])
|
||||
{
|
||||
error = true;
|
||||
hasError = true;
|
||||
|
||||
if (setPtr)
|
||||
{
|
||||
@ -1024,7 +1023,7 @@ bool Foam::primitiveMesh::checkUpperTriangular
|
||||
}
|
||||
else if (thisFace < prevFace)
|
||||
{
|
||||
error = true;
|
||||
hasError = true;
|
||||
|
||||
if (setPtr)
|
||||
{
|
||||
@ -1042,7 +1041,7 @@ bool Foam::primitiveMesh::checkUpperTriangular
|
||||
}
|
||||
}
|
||||
|
||||
reduce(error, orOp<bool>());
|
||||
Pstream::reduceOr(hasError);
|
||||
reduce(nMultipleCells, sumOp<label>());
|
||||
|
||||
if ((debug || report) && nMultipleCells > 0)
|
||||
@ -1051,7 +1050,7 @@ bool Foam::primitiveMesh::checkUpperTriangular
|
||||
<< " neighbouring cells with multiple inbetween faces." << endl;
|
||||
}
|
||||
|
||||
if (error)
|
||||
if (hasError)
|
||||
{
|
||||
if (debug || report)
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -69,8 +69,7 @@ bool Foam::primitiveMesh::checkEdgeLength
|
||||
reduce(minLenSqr, minOp<scalar>());
|
||||
reduce(maxLenSqr, maxOp<scalar>());
|
||||
|
||||
label nSmall = smallEdgeSet.size();
|
||||
reduce(nSmall, sumOp<label>());
|
||||
label nSmall = returnReduce(smallEdgeSet.size(), sumOp<label>());
|
||||
|
||||
if (setPtr)
|
||||
{
|
||||
|
||||
@ -108,8 +108,8 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Default construct
|
||||
globalIndex() = default;
|
||||
//- Default construct (empty)
|
||||
globalIndex() noexcept = default;
|
||||
|
||||
//- Copy construct from a list of offsets.
|
||||
//- No communication required
|
||||
@ -184,9 +184,15 @@ public:
|
||||
//- Global max of localSizes
|
||||
inline label maxSize() const;
|
||||
|
||||
|
||||
// Access
|
||||
|
||||
//- Const-access to the offsets
|
||||
inline const labelList& offsets() const noexcept;
|
||||
|
||||
//- Write-access to the offsets, for changing after construction
|
||||
inline labelList& offsets() noexcept;
|
||||
|
||||
|
||||
// Dimensions
|
||||
|
||||
@ -202,8 +208,8 @@ public:
|
||||
|
||||
// Edit
|
||||
|
||||
//- Write-access to the offsets, for changing after construction
|
||||
inline labelList& offsets() noexcept;
|
||||
//- Reset to be empty (no offsets)
|
||||
inline void clear();
|
||||
|
||||
//- Reset from local size, using gather/broadcast
|
||||
//- with default/specified communicator if parallel.
|
||||
|
||||
@ -176,6 +176,12 @@ inline Foam::labelList& Foam::globalIndex::offsets() noexcept
|
||||
}
|
||||
|
||||
|
||||
inline void Foam::globalIndex::clear()
|
||||
{
|
||||
offsets_.clear();
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::labelUList Foam::globalIndex::localStarts() const
|
||||
{
|
||||
const label len = (offsets_.size() - 1);
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -269,7 +269,7 @@ void Foam::globalIndexAndTransform::determineTransforms()
|
||||
}
|
||||
|
||||
transforms_.transfer(localTransforms);
|
||||
Pstream::scatter(transforms_);
|
||||
Pstream::broadcast(transforms_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -143,14 +143,14 @@ Foam::label Foam::Random::position(const label& start, const label& end)
|
||||
template<>
|
||||
Foam::scalar Foam::Random::globalSample01()
|
||||
{
|
||||
scalar value(-GREAT);
|
||||
scalar value(0);
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
value = scalar01();
|
||||
}
|
||||
|
||||
Pstream::scatter(value);
|
||||
Pstream::broadcast(value);
|
||||
|
||||
return value;
|
||||
}
|
||||
@ -159,14 +159,14 @@ Foam::scalar Foam::Random::globalSample01()
|
||||
template<>
|
||||
Foam::label Foam::Random::globalSample01()
|
||||
{
|
||||
label value(labelMin);
|
||||
label value(0);
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
value = round(scalar01());
|
||||
}
|
||||
|
||||
Pstream::scatter(value);
|
||||
Pstream::broadcast(value);
|
||||
|
||||
return value;
|
||||
}
|
||||
@ -175,14 +175,14 @@ Foam::label Foam::Random::globalSample01()
|
||||
template<>
|
||||
Foam::scalar Foam::Random::globalGaussNormal()
|
||||
{
|
||||
scalar value(-GREAT);
|
||||
scalar value(0);
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
value = GaussNormal<scalar>();
|
||||
}
|
||||
|
||||
Pstream::scatter(value);
|
||||
Pstream::broadcast(value);
|
||||
|
||||
return value;
|
||||
}
|
||||
@ -191,14 +191,14 @@ Foam::scalar Foam::Random::globalGaussNormal()
|
||||
template<>
|
||||
Foam::label Foam::Random::globalGaussNormal()
|
||||
{
|
||||
label value(labelMin);
|
||||
label value(0);
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
value = GaussNormal<label>();
|
||||
}
|
||||
|
||||
Pstream::scatter(value);
|
||||
Pstream::broadcast(value);
|
||||
|
||||
return value;
|
||||
}
|
||||
@ -211,14 +211,14 @@ Foam::scalar Foam::Random::globalPosition
|
||||
const scalar& end
|
||||
)
|
||||
{
|
||||
scalar value(-GREAT);
|
||||
scalar value(0);
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
value = position<scalar>(start, end);
|
||||
}
|
||||
|
||||
Pstream::scatter(value);
|
||||
Pstream::broadcast(value);
|
||||
|
||||
return value;
|
||||
}
|
||||
@ -231,14 +231,14 @@ Foam::label Foam::Random::globalPosition
|
||||
const label& end
|
||||
)
|
||||
{
|
||||
label value(labelMin);
|
||||
label value(0);
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
value = position<label>(start, end);
|
||||
}
|
||||
|
||||
Pstream::scatter(value);
|
||||
Pstream::broadcast(value);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -92,14 +92,14 @@ void Foam::Random::shuffle(UList<Type>& values)
|
||||
template<class Type>
|
||||
Type Foam::Random::globalSample01()
|
||||
{
|
||||
Type value = -GREAT*pTraits<Type>::one;
|
||||
Type value(Zero);
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
value = sample01<Type>();
|
||||
}
|
||||
|
||||
Pstream::scatter(value);
|
||||
Pstream::broadcast(value);
|
||||
|
||||
return value;
|
||||
}
|
||||
@ -108,14 +108,14 @@ Type Foam::Random::globalSample01()
|
||||
template<class Type>
|
||||
Type Foam::Random::globalGaussNormal()
|
||||
{
|
||||
Type value = -GREAT*pTraits<Type>::one;
|
||||
Type value(Zero);
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
value = GaussNormal<Type>();
|
||||
}
|
||||
|
||||
Pstream::scatter(value);
|
||||
Pstream::broadcast(value);
|
||||
|
||||
return value;
|
||||
}
|
||||
@ -124,14 +124,14 @@ Type Foam::Random::globalGaussNormal()
|
||||
template<class Type>
|
||||
Type Foam::Random::globalPosition(const Type& start, const Type& end)
|
||||
{
|
||||
Type value = -GREAT*pTraits<Type>::one;
|
||||
Type value(Zero);
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
value = position<Type>(start, end);
|
||||
}
|
||||
|
||||
Pstream::scatter(value);
|
||||
Pstream::broadcast(value);
|
||||
|
||||
return value;
|
||||
}
|
||||
@ -140,14 +140,12 @@ Type Foam::Random::globalPosition(const Type& start, const Type& end)
|
||||
template<class Type>
|
||||
void Foam::Random::globalRandomise01(Type& value)
|
||||
{
|
||||
value = -GREAT*pTraits<Type>::one;
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
value = sample01<Type>();
|
||||
}
|
||||
|
||||
Pstream::scatter(value);
|
||||
Pstream::broadcast(value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ bool Foam::UOPstream::bufferIPCsend()
|
||||
|
||||
bool Foam::UOPstream::write
|
||||
(
|
||||
const commsTypes commsType,
|
||||
const UPstream::commsTypes commsType,
|
||||
const int toProcNo,
|
||||
const char* buf,
|
||||
const std::streamsize bufSize,
|
||||
|
||||
@ -52,7 +52,7 @@ bool Foam::UOPstream::bufferIPCsend()
|
||||
|
||||
bool Foam::UOPstream::write
|
||||
(
|
||||
const commsTypes commsType,
|
||||
const UPstream::commsTypes commsType,
|
||||
const int toProcNo,
|
||||
const char* buf,
|
||||
const std::streamsize bufSize,
|
||||
@ -65,7 +65,7 @@ bool Foam::UOPstream::write
|
||||
Pout<< "UOPstream::write : starting write to:" << toProcNo
|
||||
<< " tag:" << tag
|
||||
<< " comm:" << communicator << " size:" << label(bufSize)
|
||||
<< " commsType:" << UPstream::commsTypeNames[commsType]
|
||||
<< " commType:" << UPstream::commsTypeNames[commsType]
|
||||
<< Foam::endl;
|
||||
}
|
||||
if (UPstream::warnComm != -1 && communicator != UPstream::warnComm)
|
||||
@ -73,7 +73,7 @@ bool Foam::UOPstream::write
|
||||
Pout<< "UOPstream::write : starting write to:" << toProcNo
|
||||
<< " tag:" << tag
|
||||
<< " comm:" << communicator << " size:" << label(bufSize)
|
||||
<< " commsType:" << UPstream::commsTypeNames[commsType]
|
||||
<< " commType:" << UPstream::commsTypeNames[commsType]
|
||||
<< " warnComm:" << UPstream::warnComm
|
||||
<< Foam::endl;
|
||||
error::printStack(Pout);
|
||||
@ -154,7 +154,7 @@ bool Foam::UOPstream::write
|
||||
{
|
||||
Pout<< "UOPstream::write : started write to:" << toProcNo
|
||||
<< " tag:" << tag << " size:" << label(bufSize)
|
||||
<< " commsType:" << UPstream::commsTypeNames[commsType]
|
||||
<< " commType:" << UPstream::commsTypeNames[commsType]
|
||||
<< " request:" << PstreamGlobals::outstandingRequests_.size()
|
||||
<< Foam::endl;
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -155,9 +155,7 @@ bool Foam::dynamicMotionSolverFvMeshAMI::update()
|
||||
changeRequired = pp.changeTopology() || changeRequired;
|
||||
}
|
||||
|
||||
reduce(changeRequired, orOp<bool>());
|
||||
|
||||
if (changeRequired)
|
||||
if (returnReduceOr(changeRequired))
|
||||
{
|
||||
polyTopoChange polyTopo(*this);
|
||||
|
||||
|
||||
@ -155,7 +155,7 @@ void Foam::dynamicRefineFvMesh::calculateProtectedCells
|
||||
}
|
||||
}
|
||||
|
||||
if (!returnReduce(hasExtended, orOp<bool>()))
|
||||
if (!returnReduceOr(hasExtended))
|
||||
{
|
||||
break;
|
||||
}
|
||||
@ -1250,7 +1250,7 @@ bool Foam::dynamicRefineFvMesh::init(const bool doInit)
|
||||
checkEightAnchorPoints(protectedCell_);
|
||||
}
|
||||
|
||||
if (!returnReduce(protectedCell_.any(), orOp<bool>()))
|
||||
if (!returnReduceOr(protectedCell_.any()))
|
||||
{
|
||||
protectedCell_.clear();
|
||||
}
|
||||
@ -1388,12 +1388,7 @@ bool Foam::dynamicRefineFvMesh::updateTopology()
|
||||
)
|
||||
);
|
||||
|
||||
const label nCellsToRefine = returnReduce
|
||||
(
|
||||
cellsToRefine.size(), sumOp<label>()
|
||||
);
|
||||
|
||||
if (nCellsToRefine > 0)
|
||||
if (returnReduceOr(cellsToRefine.size()))
|
||||
{
|
||||
// Refine/update mesh and map fields
|
||||
autoPtr<mapPolyMesh> map = refine(cellsToRefine);
|
||||
@ -1447,13 +1442,7 @@ bool Foam::dynamicRefineFvMesh::updateTopology()
|
||||
)
|
||||
);
|
||||
|
||||
const label nSplitPoints = returnReduce
|
||||
(
|
||||
pointsToUnrefine.size(),
|
||||
sumOp<label>()
|
||||
);
|
||||
|
||||
if (nSplitPoints > 0)
|
||||
if (returnReduceOr(pointsToUnrefine.size()))
|
||||
{
|
||||
// Refine/update mesh
|
||||
unrefine(pointsToUnrefine);
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -311,8 +311,7 @@ void Foam::createShellMesh::calcPointRegions
|
||||
}
|
||||
|
||||
|
||||
label nChangedFaces = returnReduce(changedFaces.size(), sumOp<label>());
|
||||
if (nChangedFaces == 0)
|
||||
if (returnReduceAnd(changedFaces.empty()))
|
||||
{
|
||||
break;
|
||||
}
|
||||
@ -374,8 +373,7 @@ void Foam::createShellMesh::calcPointRegions
|
||||
);
|
||||
|
||||
|
||||
label nChangedEdges = returnReduce(changedEdges.size(), sumOp<label>());
|
||||
if (nChangedEdges == 0)
|
||||
if (returnReduceAnd(changedEdges.empty()))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
@ -228,7 +228,7 @@ void Foam::extrudePatchMesh::extrudeMesh(polyPatchList& regionPatches)
|
||||
}
|
||||
|
||||
// Reduce
|
||||
Pstream::mapCombineAllGather(globalSum, plusEqOp<point>());
|
||||
Pstream::mapCombineReduce(globalSum, plusEqOp<point>());
|
||||
|
||||
forAll(localToGlobalRegion, localRegionI)
|
||||
{
|
||||
|
||||
@ -216,7 +216,7 @@ Foam::wordList Foam::fvMeshDistribute::mergeWordList(const wordList& procNames)
|
||||
}
|
||||
}
|
||||
}
|
||||
Pstream::scatter(mergedNames);
|
||||
Pstream::broadcast(mergedNames);
|
||||
|
||||
return mergedNames;
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -75,11 +75,13 @@ void Foam::layerAdditionRemoval::checkDefinition()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
label nFaces = topoChanger().mesh().faceZones()[faceZoneID_.index()].size();
|
||||
|
||||
reduce(nFaces, sumOp<label>());
|
||||
|
||||
if (nFaces == 0)
|
||||
if
|
||||
(
|
||||
returnReduceAnd
|
||||
(
|
||||
topoChanger().mesh().faceZones()[faceZoneID_.index()].empty()
|
||||
)
|
||||
)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Face extrusion zone contains no faces. "
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -77,14 +77,7 @@ bool Foam::layerAdditionRemoval::validCollapse() const
|
||||
<< nBoundaryHits << endl;
|
||||
}
|
||||
|
||||
if (returnReduce(nBoundaryHits, sumOp<label>()) > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return !returnReduceOr(nBoundaryHits);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -169,10 +169,7 @@ bool Foam::layerAdditionRemoval::setLayerPairing() const
|
||||
}
|
||||
}
|
||||
|
||||
reduce(nPointErrors, sumOp<label>());
|
||||
reduce(nFaceErrors, sumOp<label>());
|
||||
|
||||
if (nPointErrors > 0 || nFaceErrors > 0)
|
||||
if (returnReduceOr(nPointErrors || nFaceErrors))
|
||||
{
|
||||
clearAddressing();
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -534,7 +534,7 @@ void Foam::meshCutter::setRefinement
|
||||
addedPoints_.clear();
|
||||
addedPoints_.resize(cuts.nLoops());
|
||||
|
||||
if (returnReduce(cuts.nLoops(), sumOp<label>()) == 0)
|
||||
if (!returnReduceOr(cuts.nLoops()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -504,11 +504,7 @@ Foam::multiDirRefinement::multiDirRefinement
|
||||
refineHex8(mesh, hexCells, writeMesh);
|
||||
}
|
||||
|
||||
label nRemainingCells = cellLabels_.size();
|
||||
|
||||
reduce(nRemainingCells, sumOp<label>());
|
||||
|
||||
if (nRemainingCells > 0)
|
||||
if (returnReduceOr(cellLabels_.size()))
|
||||
{
|
||||
// Any cells to refine using meshCutter
|
||||
|
||||
@ -547,11 +543,7 @@ Foam::multiDirRefinement::multiDirRefinement
|
||||
refineHex8(mesh, hexCells, writeMesh);
|
||||
}
|
||||
|
||||
label nRemainingCells = cellLabels_.size();
|
||||
|
||||
reduce(nRemainingCells, sumOp<label>());
|
||||
|
||||
if (nRemainingCells > 0)
|
||||
if (returnReduceOr(cellLabels_.size()))
|
||||
{
|
||||
// Any cells to refine using meshCutter
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -108,10 +108,7 @@ Foam::Map<Foam::label> Foam::refinementIterator::setRefinement
|
||||
// Determine cut pattern.
|
||||
cellCuts cuts(mesh_, cellWalker_, currentRefCells);
|
||||
|
||||
label nCuts = cuts.nLoops();
|
||||
reduce(nCuts, sumOp<label>());
|
||||
|
||||
if (nCuts == 0)
|
||||
if (!returnReduceOr(cuts.nLoops()))
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
@ -266,13 +263,12 @@ Foam::Map<Foam::label> Foam::refinementIterator::setRefinement
|
||||
}
|
||||
|
||||
// Stop only if all finished or all can't refine any further.
|
||||
stop = (nRefCells == 0) || (nRefCells == oldRefCells);
|
||||
reduce(stop, andOp<bool>());
|
||||
stop = returnReduceAnd(nRefCells == 0 || nRefCells == oldRefCells);
|
||||
}
|
||||
while (!stop);
|
||||
|
||||
|
||||
if (returnReduce((nRefCells == oldRefCells), andOp<bool>()))
|
||||
if (returnReduceAnd(nRefCells == oldRefCells))
|
||||
{
|
||||
WarningInFunction
|
||||
<< "stopped refining."
|
||||
|
||||
@ -131,7 +131,7 @@ Foam::zoneMotion::zoneMotion
|
||||
|
||||
// No cell points selected (as set or zones) => move all points
|
||||
|
||||
moveAllCells_ = returnReduce(pointIDs_.empty(), andOp<bool>());
|
||||
moveAllCells_ = returnReduceAnd(pointIDs_.empty());
|
||||
|
||||
if (moveAllCells_)
|
||||
{
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -283,7 +284,7 @@ Foam::label Foam::polyMeshFilter::filterFacesLoop(const label nOriginalBadFaces)
|
||||
}
|
||||
}
|
||||
|
||||
reduce(newBadFaces, orOp<bool>());
|
||||
Pstream::reduceOr(newBadFaces);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -2006,7 +2006,7 @@ void Foam::addPatchCellLayer::setRefinement
|
||||
Pout<< "nChanged:" << nChanged << endl;
|
||||
}
|
||||
|
||||
if (returnReduce(nChanged, sumOp<label>()) == 0)
|
||||
if (!returnReduceOr(nChanged))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user