From 441820ecd180348d83053d9d5dfb1b20909bbb2a Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 23 Feb 2011 13:51:49 +0000 Subject: [PATCH] BUG: dynamicRefineFvMesh : handle cells < hex (from combining patch faces) --- .../dynamicRefineFvMesh/dynamicRefineFvMesh.C | 69 ++++++++++++---------- 1 file changed, 38 insertions(+), 31 deletions(-) diff --git a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C index 49995eb7..dd5de074 100644 --- a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C +++ b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C @@ -885,32 +885,26 @@ dynamicRefineFvMesh::dynamicRefineFvMesh(const IOobject& io) // Count number of points <= cellLevel // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - labelList nAnchors(nCells(), 0); - label nProtected = 0; - forAll(pointCells(), pointI) + forAll(cellLevel, cellI) { - const labelList& pCells = pointCells()[pointI]; + const labelList& cPoints = cellPoints(cellI); - forAll(pCells, i) + label nAnchors = 0; + forAll(cPoints, cPointI) { - label cellI = pCells[i]; - - if (protectedCell_.get(cellI) == 0) + label pointI = cPoints[cPointI]; + if (pointLevel[pointI] <= cellLevel[cellI]) { - if (pointLevel[pointI] <= cellLevel[cellI]) - { - nAnchors[cellI]++; - - if (nAnchors[cellI] > 8) - { - protectedCell_.set(cellI, 1); - nProtected++; - } - } + nAnchors++; } } + if (nAnchors != 8) + { + protectedCell_.set(cellI, 1); + nProtected++; + } } @@ -952,14 +946,13 @@ dynamicRefineFvMesh::dynamicRefineFvMesh(const IOobject& io) if (pointLevel[f[fp]] <= faceLevel) { nAnchors++; - - if (nAnchors > 4) - { - protectedFace[faceI] = true; - break; - } } } + + if (nAnchors != 4) + { + protectedFace[faceI] = true; + } } syncTools::syncFaceList @@ -974,23 +967,37 @@ dynamicRefineFvMesh::dynamicRefineFvMesh(const IOobject& io) { if (protectedFace[faceI]) { - protectedCell_.set(faceOwner()[faceI], 1); - nProtected++; - protectedCell_.set(faceNeighbour()[faceI], 1); - nProtected++; + if (protectedCell_.set(faceOwner()[faceI], 1)) + { + nProtected++; + } + if (protectedCell_.set(faceNeighbour()[faceI], 1)) + { + nProtected++; + } } } for (label faceI = nInternalFaces(); faceI < nFaces(); faceI++) { if (protectedFace[faceI]) { - protectedCell_.set(faceOwner()[faceI], 1); - nProtected++; + if (protectedCell_.set(faceOwner()[faceI], 1)) + { + nProtected++; + } } } } - if (returnReduce(nProtected, sumOp