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.
This commit is contained in:
mattijs
2015-12-09 17:05:30 +00:00
parent 4fef499298
commit e2cefb1a10

View File

@ -860,16 +860,62 @@ Foam::labelList Foam::dynamicRefineFvMesh::selectUnrefinePoints
// All points that can be unrefined // All points that can be unrefined
const labelList splitPoints(meshCutter_.getSplitPoints()); 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<unsigned int>(),
0U
);
if (debug)
{
Info<< "From "
<< returnReduce(protectedCell_.count(), sumOp<label>())
<< " protected cells found "
<< returnReduce(protectedPoint.count(), sumOp<label>())
<< " protected points." << endl;
}
}
DynamicList<label> newSplitPoints(splitPoints.size()); DynamicList<label> newSplitPoints(splitPoints.size());
forAll(splitPoints, i) forAll(splitPoints, i)
{ {
label pointI = splitPoints[i]; label pointI = splitPoints[i];
if (pFld[pointI] < unrefineLevel) if (!protectedPoint[pointI] && pFld[pointI] < unrefineLevel)
{ {
// Check that all cells are not marked // Check that all cells are not marked
const labelList& pCells = pointCells()[pointI]; const labelList& pCells = pointCells[pointI];
bool hasMarked = false; bool hasMarked = false;