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

@ -45,7 +45,7 @@ void Foam::Function1Types::Sample<Type>::setSampleCell() const
celli_ = mesh.findCell(position_);
if (!returnReduce(celli_ != -1, orOp<bool>()))
if (returnReduceAnd(celli_ < 0))
{
FatalErrorInFunction
<< "Sample cell could not be found at position "

View File

@ -381,9 +381,7 @@ void Foam::meshToMesh::normaliseWeights
scalarListList& wght
) const
{
const label nCell = returnReduce(wght.size(), sumOp<label>());
if (nCell > 0)
if (returnReduceOr(wght.size()))
{
forAll(wght, celli)
{

View File

@ -140,7 +140,7 @@ void Foam::meshToMesh::mapSrcToTgt
if (singleMeshProc_ == -1)
{
if (returnReduce(tgtToSrcCellVec_.size(), sumOp<label>()) == 0)
if (returnReduceAnd(tgtToSrcCellVec_.empty()))
{
// No correction vectors calculated. Fall back to first order.
mapSrcToTgt(srcField, cop, result);
@ -353,7 +353,7 @@ void Foam::meshToMesh::mapTgtToSrc
if (singleMeshProc_ == -1)
{
if (returnReduce(srcToTgtCellVec_.size(), sumOp<label>()) == 0)
if (returnReduceAnd(srcToTgtCellVec_.empty()))
{
// No correction vectors calculated. Fall back to first order.
mapTgtToSrc(tgtField, cop, result);
@ -478,7 +478,7 @@ void Foam::meshToMesh::mapInternalSrcToTgt
const bool secondOrder
) const
{
if (secondOrder && returnReduce(tgtToSrcCellVec_.size(), sumOp<label>()))
if (secondOrder && returnReduceOr(tgtToSrcCellVec_.size()))
{
mapSrcToTgt
(
@ -711,7 +711,7 @@ void Foam::meshToMesh::mapInternalTgtToSrc
const bool secondOrder
) const
{
if (secondOrder && returnReduce(srcToTgtCellVec_.size(), sumOp<label>()))
if (secondOrder && returnReduceOr(srcToTgtCellVec_.size()))
{
mapTgtToSrc
(

View File

@ -497,8 +497,8 @@ bool Foam::shortestPathSet::genSingleLeakPath
<< " Skipped route detection." << endl;
}
}
reduce(targetFound, orOp<bool>());
if (!targetFound)
if (!returnReduceOr(targetFound))
{
//Pout<< "now :"
// << " nLeakCell:"
@ -638,7 +638,7 @@ bool Foam::shortestPathSet::genSingleLeakPath
// Situation 1: we found the destination cell (do nothing),
// frontCellI is -1 on all processors
if (returnReduce(frontCellI == -1, andOp<bool>()))
if (returnReduceAnd(frontCellI == -1))
{
//Pout<< "now :"
// << " nLeakCell:"

View File

@ -562,10 +562,9 @@ bool Foam::sampledSurfaces::performAction(unsigned request)
if
(
returnReduce
returnReduceAnd
(
!ListOps::found(ids, lessOp1<label>(0)),
andOp<bool>()
!ListOps::found(ids, lessOp1<label>(0))
)
)
{

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2019 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -61,11 +61,7 @@ Foam::bitSet Foam::cuttingSurfaceBase::cellSelection
// Zones requested and in use?
const bool hasZones =
returnReduce
(
(-1 != mesh.cellZones().findIndex(zoneNames)),
andOp<bool>()
);
returnReduceAnd(-1 != mesh.cellZones().findIndex(zoneNames));
if (hasZones)
{

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020-2021 OpenCFD Ltd.
Copyright (C) 2020-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -431,7 +431,7 @@ void Foam::distanceSurface::filterRegionProximity
// If filtering with region proximity results in zero faces,
// revert to face-only proximity filter
if (returnReduce(acceptFaces.none(), andOp<bool>()))
if (returnReduceAnd(acceptFaces.none()))
{
acceptFaces.reset();
prune = false;

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2019 OpenFOAM Foundation
Copyright (C) 2019-2021 OpenCFD Ltd.
Copyright (C) 2019-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -1587,7 +1587,7 @@ Foam::isoSurfaceTopo::isoSurfaceTopo
<< " faces on " << nEdgeRemove << " open edges" << endl;
}
if (returnReduce(faceSelection.none(), andOp<bool>()))
if (returnReduceAnd(faceSelection.none()))
{
break;
}