From 40287383270a34466ebbd83f4483f7eb2f28e329 Mon Sep 17 00:00:00 2001 From: Mattijs Janssens Date: Mon, 17 May 2021 16:21:18 +0000 Subject: [PATCH] ENH: redistributePar - detect if reconstruct is required (#2092) --- .../redistributePar/redistributePar.C | 38 +++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/applications/utilities/parallelProcessing/redistributePar/redistributePar.C b/applications/utilities/parallelProcessing/redistributePar/redistributePar.C index 7180ede66b..4c538f8389 100644 --- a/applications/utilities/parallelProcessing/redistributePar/redistributePar.C +++ b/applications/utilities/parallelProcessing/redistributePar/redistributePar.C @@ -2639,7 +2639,39 @@ int main(int argc, char *argv[]) haveAddressing = true; } - if (!returnReduce(haveAddressing, andOp())) + + // Additionally check for master faces being readable. Could + // do even more checks, e.g. global number of cells same + // as cellProcAddressing + bool haveUndecomposedMesh = false; + if (Pstream::master()) + { + Info<< "Checking " << baseRunTime.caseName() + << " for undecomposed mesh" << endl; + + const bool oldParRun = Pstream::parRun(false); + faceCompactIOList facesIO + ( + IOobject + ( + "faces", + facesInstance, + meshSubDir, + baseRunTime, + IOobject::NO_READ + ) + ); + haveUndecomposedMesh = facesIO.headerOk(); + Pstream::parRun(oldParRun); + } + Pstream::scatter(haveUndecomposedMesh); + + + if + ( + !haveUndecomposedMesh + || !returnReduce(haveAddressing, andOp()) + ) { Info<< "loading mesh from " << facesInstance << endl; autoPtr meshPtr = loadOrCreateMesh @@ -2662,8 +2694,8 @@ int main(int argc, char *argv[]) // Determine decomposition // ~~~~~~~~~~~~~~~~~~~~~~~ - Info<< "Reconstructing mesh for time " << facesInstance - << endl; + Info<< "Reconstructing mesh for time " + << facesInstance << endl; label nDestProcs = 1; labelList finalDecomp = labelList(mesh.nCells(), Zero);