mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: sum reduction of nPoints/nFaces/nCells in a single call (globalMeshData)
STYLE: use labelRange instead of identity(...) for communicator
This commit is contained in:
@ -152,7 +152,7 @@ Foam::procFacesGAMGProcAgglomeration::processorAgglomeration
|
||||
UPstream::communicator singleCellMeshComm
|
||||
(
|
||||
mesh.comm(),
|
||||
labelList(Foam::one{}, 0) // only processor 0
|
||||
labelRange(1) // Processor 0 only
|
||||
);
|
||||
|
||||
scalarField faceWeights;
|
||||
@ -197,7 +197,6 @@ Foam::procFacesGAMGProcAgglomeration::processorAgglomeration
|
||||
}
|
||||
|
||||
Pstream::broadcast(fineToCoarse, mesh.comm());
|
||||
singleCellMeshComm.reset();
|
||||
|
||||
return tfineToCoarse;
|
||||
}
|
||||
|
||||
@ -2504,8 +2504,8 @@ Foam::autoPtr<Foam::globalIndex> Foam::globalMeshData::mergePoints
|
||||
const globalIndex globalPPoints(meshPoints.size());
|
||||
|
||||
labelList patchToCoupled(meshPoints.size(), -1);
|
||||
label nCoupled = 0;
|
||||
labelList coupledToGlobalPatch(pointSlavesMap.constructSize(), -1);
|
||||
//label nCoupled = 0;
|
||||
|
||||
// Note: loop over patch since usually smaller
|
||||
forAll(meshPoints, patchPointi)
|
||||
@ -2518,7 +2518,7 @@ Foam::autoPtr<Foam::globalIndex> Foam::globalMeshData::mergePoints
|
||||
{
|
||||
patchToCoupled[patchPointi] = iter();
|
||||
coupledToGlobalPatch[iter()] = globalPPoints.toGlobal(patchPointi);
|
||||
nCoupled++;
|
||||
//++nCoupled;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2718,55 +2718,31 @@ void Foam::globalMeshData::updateMesh()
|
||||
UPstream::communicator dupComm
|
||||
(
|
||||
UPstream::worldComm,
|
||||
identity(UPstream::nProcs(UPstream::worldComm))
|
||||
labelRange(UPstream::nProcs(UPstream::worldComm))
|
||||
);
|
||||
|
||||
const label comm = dupComm.comm();
|
||||
const label oldWarnComm = UPstream::commWarn(comm);
|
||||
|
||||
FixedList<label, 3> totals;
|
||||
|
||||
// Total number of faces.
|
||||
nTotalFaces_ = returnReduce
|
||||
(
|
||||
mesh_.nFaces(),
|
||||
sumOp<label>(),
|
||||
UPstream::msgType(),
|
||||
comm
|
||||
);
|
||||
totals[0] = mesh_.nPoints();
|
||||
totals[1] = mesh_.nFaces();
|
||||
totals[2] = mesh_.nCells();
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "globalMeshData : nTotalFaces:" << nTotalFaces_ << endl;
|
||||
}
|
||||
reduce(totals, sumOp<label>(), UPstream::msgType(), comm);
|
||||
|
||||
nTotalCells_ = returnReduce
|
||||
(
|
||||
mesh_.nCells(),
|
||||
sumOp<label>(),
|
||||
UPstream::msgType(),
|
||||
comm
|
||||
);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "globalMeshData : nTotalCells:" << nTotalCells_ << endl;
|
||||
}
|
||||
|
||||
nTotalPoints_ = returnReduce
|
||||
(
|
||||
mesh_.nPoints(),
|
||||
sumOp<label>(),
|
||||
UPstream::msgType(),
|
||||
comm
|
||||
);
|
||||
nTotalPoints_ = totals[0];
|
||||
nTotalFaces_ = totals[1];
|
||||
nTotalCells_ = totals[2];
|
||||
|
||||
// Restore communicator settings
|
||||
UPstream::commWarn(oldWarnComm);
|
||||
dupComm.reset();
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "globalMeshData : nTotalPoints:" << nTotalPoints_ << endl;
|
||||
Info<< "globalMeshData : Total points/faces/cells : "
|
||||
<< totals << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -348,22 +348,22 @@ public:
|
||||
return mesh_;
|
||||
}
|
||||
|
||||
//- Does the mesh contain processor patches? (also valid when
|
||||
// not running parallel)
|
||||
bool parallel() const
|
||||
//- Does the mesh contain processor patches?
|
||||
//- (also valid when not running parallel)
|
||||
bool parallel() const noexcept
|
||||
{
|
||||
return !processorPatches_.empty();
|
||||
}
|
||||
|
||||
//- Return total number of points in decomposed mesh. Not
|
||||
// compensated for duplicate points!
|
||||
//- Return total number of points in decomposed mesh.
|
||||
//- Not compensated for duplicate points!
|
||||
label nTotalPoints() const noexcept
|
||||
{
|
||||
return nTotalPoints_;
|
||||
}
|
||||
|
||||
//- Return total number of faces in decomposed mesh. Not
|
||||
// compensated for duplicate faces!
|
||||
//- Return total number of faces in decomposed mesh.
|
||||
//- Not compensated for duplicate faces!
|
||||
label nTotalFaces() const noexcept
|
||||
{
|
||||
return nTotalFaces_;
|
||||
|
||||
Reference in New Issue
Block a user