ENH: shm: Parallel consistent extrusion. Fixes #759.

This commit is contained in:
mattijs
2018-03-08 15:07:24 +00:00
parent cb03d0bcf4
commit 3269ba0df9

View File

@ -572,8 +572,26 @@ void Foam::snappyLayerDriver::handleNonManifolds
pointSet nonManifoldPoints(mesh, "nonManifoldPoints", pp.nPoints()); pointSet nonManifoldPoints(mesh, "nonManifoldPoints", pp.nPoints());
// 1. Local check // 1. Local check. Note that we do not check for e.g. two patch faces
checkManifold(pp, nonManifoldPoints); // being connected via a point since their connection might be ok
// through a coupled patch. The ultimate is to do a proper point-face
// walk which is done when actually duplicating the points. Here we just
// do the obvious problems.
{
// Check for edge-faces (surface pinched at edge)
const labelListList& edgeFaces = pp.edgeFaces();
forAll(edgeFaces, edgei)
{
const labelList& eFaces = edgeFaces[edgei];
if (eFaces.size() > 2)
{
const edge& e = pp.edges()[edgei];
nonManifoldPoints.insert(pp.meshPoints()[e[0]]);
nonManifoldPoints.insert(pp.meshPoints()[e[1]]);
}
}
}
// 2. Remote check for boundary edges on coupled boundaries // 2. Remote check for boundary edges on coupled boundaries
forAll(edgeGlobalFaces, edgei) forAll(edgeGlobalFaces, edgei)
@ -3336,7 +3354,9 @@ void Foam::snappyLayerDriver::addLayers
{ {
// Check outside of baffles for non-manifoldness // Check outside of baffles for non-manifoldness
PackedBoolList duplicatePoint(mesh.nPoints());
// Points that are candidates for duplication
labelList candidatePoints;
{ {
// Do full analysis to see if we need to extrude points // Do full analysis to see if we need to extrude points
// so have to duplicate them // so have to duplicate them
@ -3380,34 +3400,51 @@ void Foam::snappyLayerDriver::addLayers
extrudeStatus extrudeStatus
); );
// Do duplication only if all patch points decide to extrude. Ignore
// contribution from non-patch points. Note that we need to
// apply this to all mesh points
labelList minPatchState(mesh.nPoints(), labelMax);
forAll(extrudeStatus, patchPointi) forAll(extrudeStatus, patchPointi)
{ {
if (extrudeStatus[patchPointi] != NOEXTRUDE) label pointi = pp().meshPoints()[patchPointi];
{ minPatchState[pointi] = extrudeStatus[patchPointi];
duplicatePoint[pp().meshPoints()[patchPointi]] = 1;
}
}
} }
// Duplicate points only if all points agree
syncTools::syncPointList syncTools::syncPointList
( (
mesh, mesh,
duplicatePoint, minPatchState,
andEqOp<unsigned int>(), // combine op minEqOp<label>(), // combine op
0u // null value labelMax // null value
); );
label n = duplicatePoint.count();
labelList candidatePoints(n); // So now minPatchState:
n = 0; // - labelMax on non-patch points
forAll(duplicatePoint, pointi) // - NOEXTRUDE if any patch point was not extruded
// - EXTRUDE or EXTRUDEREMOVE if all patch points are extruded/
// extrudeRemove.
label n = 0;
forAll(minPatchState, pointi)
{ {
if (duplicatePoint[pointi]) label state = minPatchState[pointi];
if (state == EXTRUDE || state == EXTRUDEREMOVE)
{
n++;
}
}
candidatePoints.setSize(n);
n = 0;
forAll(minPatchState, pointi)
{
label state = minPatchState[pointi];
if (state == EXTRUDE || state == EXTRUDEREMOVE)
{ {
candidatePoints[n++] = pointi; candidatePoints[n++] = pointi;
} }
} }
}
// Not duplicate points on either side of baffles that don't get any // Not duplicate points on either side of baffles that don't get any
// layers // layers