From e2cefb1a10d97f07ccbc57aa853122dc5dcb0aea Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 9 Dec 2015 17:05:30 +0000 Subject: [PATCH] BUG: dynamic refinement: unrefinement was not looking at protectedCell cells that are protected should neither be refined nor unrefined. Fixed the logic: if any of the cells to-be-merged (=unrefined) is protected do not unrefine. --- .../dynamicRefineFvMesh/dynamicRefineFvMesh.C | 50 ++++++++++++++++++- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C index d7daba5486..a3f38112c8 100644 --- a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C +++ b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C @@ -860,16 +860,62 @@ Foam::labelList Foam::dynamicRefineFvMesh::selectUnrefinePoints // All points that can be unrefined const labelList splitPoints(meshCutter_.getSplitPoints()); + + const labelListList& pointCells = this->pointCells(); + + // If we have any protected cells make sure they also are not being + // unrefined + + PackedBoolList protectedPoint(nPoints()); + + if (protectedCell_.size()) + { + // Get all points on a protected cell + forAll(pointCells, pointI) + { + const labelList& pCells = pointCells[pointI]; + + forAll(pCells, pCellI) + { + label cellI = pCells[pCellI]; + + if (protectedCell_[cellI]) + { + protectedPoint[pointI] = true; + break; + } + } + } + + syncTools::syncPointList + ( + *this, + protectedPoint, + orEqOp(), + 0U + ); + + if (debug) + { + Info<< "From " + << returnReduce(protectedCell_.count(), sumOp