From 11fa53fb6627d5c1dce3fd07e464308c429367ac Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Fri, 8 Feb 2019 15:16:20 +0000 Subject: [PATCH] blockMeshMerge: Minor update for consistency with the "fast" algorithm --- etc/controlDict | 1 + src/mesh/blockMesh/blockMesh/blockMeshMerge.C | 28 +++++++------------ 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/etc/controlDict b/etc/controlDict index b056a79b4b..bdd473deb3 100644 --- a/etc/controlDict +++ b/etc/controlDict @@ -345,6 +345,7 @@ DebugSwitches blended 0; blobsSheetAtomization 0; blobsSwirlInjector 0; + blockMesh 0; booleanSurface 0; boundaryCutter 0; boundaryMesh 0; diff --git a/src/mesh/blockMesh/blockMesh/blockMeshMerge.C b/src/mesh/blockMesh/blockMesh/blockMeshMerge.C index 77da869940..7a081a6068 100644 --- a/src/mesh/blockMesh/blockMesh/blockMeshMerge.C +++ b/src/mesh/blockMesh/blockMesh/blockMeshMerge.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -56,9 +56,7 @@ void Foam::blockMesh::calcMergeInfo() } // set unused to -1 - mergeList_.setSize(nPoints_); - mergeList_ = -1; - + mergeList_.setSize(nPoints_, -1); const pointField& blockPoints = topology().points(); const cellList& blockCells = topology().cells(); @@ -548,35 +546,29 @@ void Foam::blockMesh::calcMergeInfo() } - // Sort merge list to return new point label (in new shorter list) - // given old point label - label newPointLabel = 0; + // Sort merge list and count number of unique points + label nUniqPoints = 0; - forAll(mergeList_, pointLabel) + forAll(mergeList_, pointi) { - if (mergeList_[pointLabel] > pointLabel) + if (mergeList_[pointi] > pointi) { FatalErrorInFunction << "Merge list contains point index out of range" << exit(FatalError); } - if - ( - mergeList_[pointLabel] == -1 - || mergeList_[pointLabel] == pointLabel - ) + if (mergeList_[pointi] == -1 || mergeList_[pointi] == pointi) { - mergeList_[pointLabel] = newPointLabel; - newPointLabel++; + mergeList_[pointi] = nUniqPoints++; } else { - mergeList_[pointLabel] = mergeList_[mergeList_[pointLabel]]; + mergeList_[pointi] = mergeList_[mergeList_[pointi]]; } } - nPoints_ = newPointLabel; + nPoints_ = nUniqPoints; }