From a6d1f47943c56584f66dcbff37af509518f4667a Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 23 Feb 2022 15:31:31 +0100 Subject: [PATCH] ENH: use globalIndex gather for simpler code and less communication - checkTools, PatchTools::gatherAndMerge, SprayCloud penetration --- .../mesh/manipulation/checkMesh/checkTools.C | 59 ++-------- .../PatchTools/PatchToolsGatherAndMerge.C | 73 +++--------- .../clouds/Templates/SprayCloud/SprayCloud.H | 6 +- .../clouds/Templates/SprayCloud/SprayCloudI.H | 109 +++++++----------- 4 files changed, 69 insertions(+), 178 deletions(-) diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkTools.C b/applications/utilities/mesh/manipulation/checkMesh/checkTools.C index a77ca272cd..00c1f4b0f2 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkTools.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkTools.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2015-2017 OpenFOAM Foundation - Copyright (C) 2015-2021 OpenCFD Ltd. + Copyright (C) 2015-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -423,8 +423,8 @@ void Foam::mergeAndWrite { const polyMesh& mesh = refCast(set.db()); - pointField mergedPts; - labelList mergedIDs; + labelField mergedIDs(set.sortedToc()); + pointField mergedPts(mesh.points(), mergedIDs); if (Pstream::parRun()) { @@ -432,55 +432,12 @@ void Foam::mergeAndWrite // (mesh.globalData().mergePoints etc) since this might // hide any synchronisation problem - globalIndex globalNumbering(mesh.nPoints()); + // Renumber local ids -> global ids + globalIndex(mesh.nPoints()).inplaceToGlobal(mergedIDs); - mergedPts.setSize(returnReduce(set.size(), sumOp