From d5884c8d856ea30cac63ca4a143e6fd808e2bf32 Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@esi-group.com> Date: Fri, 24 Jul 2020 18:16:55 +0200 Subject: [PATCH] STYLE: use HashSet xor instead of two operations (faceZoneSet) STYLE: use global operator instead of HashSet -= operator --- .../mesh/manipulation/checkMesh/checkMesh.C | 5 ++--- src/meshTools/sets/topoSets/faceZoneSet.C | 14 ++++---------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C b/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C index df30a8698e8..836b2515e26 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C @@ -166,8 +166,7 @@ int main(int argc, char *argv[]) if (args.found("writeFields")) { selectedFields = args.getList<word>("writeFields"); - wordHashSet badFields(selectedFields); - badFields -= allFields; + const wordHashSet badFields(selectedFields - allFields); if (!badFields.empty()) { @@ -229,7 +228,7 @@ int main(int argc, char *argv[]) IOobject::MUST_READ, IOobject::NO_WRITE ) - ) + ) ); } diff --git a/src/meshTools/sets/topoSets/faceZoneSet.C b/src/meshTools/sets/topoSets/faceZoneSet.C index 1384884462b..753eae1b693 100644 --- a/src/meshTools/sets/topoSets/faceZoneSet.C +++ b/src/meshTools/sets/topoSets/faceZoneSet.C @@ -320,17 +320,11 @@ void Foam::faceZoneSet::sync(const polyMesh& mesh) { const labelHashSet zoneSet(addressing_); - // Get elements that are in zone but not faceSet - labelHashSet badSet(zoneSet); - badSet -= *this; + // Elements that are in zone but not faceSet, and + // elements that are in faceSet but not in zone + labelHashSet badSet(*this ^ zoneSet); - // Add elements that are in faceSet but not in zone - labelHashSet fSet(*this); - fSet -= zoneSet; - - badSet += fSet; - - label nBad = returnReduce(badSet.size(), sumOp<label>()); + const label nBad = returnReduce(badSet.size(), sumOp<label>()); if (nBad) { -- GitLab