Bugfixes in cuttingPatchFringe

1. Marking cut hole cells as inside cells,
2. Parallel bugfix when syncing mark-up field across faces: used orOp instead of
   orEqOp for combination.
This commit is contained in:
Vuko Vukcevic 2019-05-27 10:37:49 +02:00
parent 8051a31239
commit f6b3e9932b

View file

@ -253,6 +253,15 @@ void Foam::cuttingPatchFringe::calcAddressing() const
insideMask[myRegionCells[i]] = myRegionInsideMask[i]; insideMask[myRegionCells[i]] = myRegionInsideMask[i];
} }
// Make sure that the cut holes for this region are also properly marked as
// "inside". This may not be the case automatically for e.g. simulations
// with appendages
const labelList& cutRegionHoles = myRegion.cutHoles();
forAll (cutRegionHoles, i)
{
insideMask[cutRegionHoles[i]] = true;
}
// Get necessary mesh data (from polyMesh/primitiveMesh) // Get necessary mesh data (from polyMesh/primitiveMesh)
const cellList& meshCells = mesh.cells(); const cellList& meshCells = mesh.cells();
const unallocLabelList& owner = mesh.faceOwner(); const unallocLabelList& owner = mesh.faceOwner();
@ -273,7 +282,7 @@ void Foam::cuttingPatchFringe::calcAddressing() const
forAll (cFaces, i) forAll (cFaces, i)
{ {
// Set the mark for this global face and break out // Set the mark for this global face
hasUnmarkedCell[cFaces[i]] = true; hasUnmarkedCell[cFaces[i]] = true;
} }
} }
@ -284,8 +293,8 @@ void Foam::cuttingPatchFringe::calcAddressing() const
( (
mesh, mesh,
hasUnmarkedCell, hasUnmarkedCell,
orOp<bool>(), orEqOp<bool>(),
false true
); );
// Mark-up for all inside faces // Mark-up for all inside faces
@ -318,27 +327,20 @@ void Foam::cuttingPatchFringe::calcAddressing() const
acceptors.insert(cellI); acceptors.insert(cellI);
// This cell is no longer "inside cell" // This cell is no longer "inside cell"
insideMask[cellI] = false;; insideMask[cellI] = false;
// Break out since there's nothing to do for this cell
break;
} }
} else
// If this is still inside cell, collect it and mark its faces
if (insideMask[cellI])
{
// Loop through cell faces and mark them
const cell& cFaces = meshCells[cellI];
forAll (cFaces, i)
{ {
insideFaceMask[cFaces[i]] = true; // This is an "inside" face, mark it
insideFaceMask[faceI] = true;
} }
} } // End for all faces
} // End if cell is inside } // End if cell is inside
} // End for all cells } // End for all cells
// Note: insideFaceMask already synced across processors because it relies
// on hasUnmarkedCell list, which has been synced just above
// Hash set containing new acceptors (for successive iterations) // Hash set containing new acceptors (for successive iterations)
labelHashSet newAcceptors(acceptors.size()); labelHashSet newAcceptors(acceptors.size());
@ -382,7 +384,7 @@ void Foam::cuttingPatchFringe::calcAddressing() const
false false
); );
// Loop through all faces and append acceptors // Loop through all internal faces and append acceptors
for (label faceI = 0; faceI < mesh.nInternalFaces(); ++faceI) for (label faceI = 0; faceI < mesh.nInternalFaces(); ++faceI)
{ {
if (propagateFace[faceI]) if (propagateFace[faceI])
@ -450,21 +452,20 @@ void Foam::cuttingPatchFringe::calcAddressing() const
} // End for specified number of layers } // End for specified number of layers
// At this point, we have the final set of acceptors and we marked // At this point, we have the final set of acceptors and we marked
// all cells that should be holes. Collect holes into hash set (could be // all cells that should be holes. Collect them into the list
// optimized by using dynamic lists) dynamicLabelList fringeHoles(myRegionCells.size()/10);
labelHashSet fringeHoles(myRegionCells.size()/10);
forAll (insideMask, cellI) forAll (insideMask, cellI)
{ {
if (insideMask[cellI]) if (insideMask[cellI])
{ {
fringeHoles.insert(cellI); fringeHoles.append(cellI);
} }
} }
// Set acceptors and holes from the data for all regions // Set acceptors and holes from the data for all regions
acceptorsPtr_ = new labelList(acceptors.sortedToc()); acceptorsPtr_ = new labelList(acceptors.sortedToc());
fringeHolesPtr_ = new labelList(fringeHoles.sortedToc()); fringeHolesPtr_ = new labelList(fringeHoles.xfer());
if (debug) if (debug)
{ {