ENH: add fallback behaviour for distanceSurface proximity regions (#1631)

- using the proximityRegions filter when there is no enclosing surface
  to segregate domains causes a surface of zero-faces to be created.

  In most cases, this means that a simpler proximityFaces filter would
  have been more appropriate. To increase overall robustness, revert
  to the simpler proximityFaces filter logic when the proximityRegions
  would otherwise result in zero faces (globally seen).
This commit is contained in:
Mark Olesen
2021-07-29 15:43:05 +02:00
parent 048166c3d8
commit 0c89154729
2 changed files with 23 additions and 0 deletions

View File

@ -279,6 +279,7 @@ Foam::distanceSurface::distanceSurface
|| (distance_ < 0)
|| dict.getOrDefault<bool>("signed", true)
),
isoParams_
(
dict,
@ -374,6 +375,7 @@ Foam::distanceSurface::distanceSurface
|| (distance_ < 0)
|| useSignedDistance
),
isoParams_(params),
topoFilter_(topologyFilterType::NONE),
nearestPoints_(),

View File

@ -429,6 +429,27 @@ void Foam::distanceSurface::filterRegionProximity
}
// If filtering with region proximity results in zero faces,
// revert to face-only proximity filter
if (returnReduce(acceptFaces.none(), andOp<bool>()))
{
acceptFaces.reset();
prune = false;
// Consider the absolute proximity of the face centres
forAll(faceDistance, facei)
{
if (absProximity_ < faceDistance[facei])
{
prune = true;
}
else
{
acceptFaces.set(facei);
}
}
}
if (prune)
{
labelList pointMap, faceMap;