Bugfix in calculation of getFaceAnchor

Reverting to the old formulation modified for polyhedral cells
This commit is contained in:
Vuko Vukcevic 2017-11-20 14:30:13 +01:00 committed by Vuko Vukcevic
parent f3edd35f23
commit 91a892854e

View file

@ -756,47 +756,31 @@ Foam::label Foam::polyRef::findLevel
} }
// Get cell level such that the face has the most points that are <= level (at // Get least cell level such that the face has at least three points smaller
// least three points) // than the level
Foam::label Foam::polyRef::getAnchorLevel(const label faceI) const Foam::label Foam::polyRef::getAnchorLevel(const label faceI) const
{ {
const face& f = mesh_.faces()[faceI]; const face& f = mesh_.faces()[faceI];
// Get number of points in this face if (f.size() <= 3)
const label nPoints = f.size();
// Get unique levels that can be found in this face
labelHashSet uniqueLevels(nPoints);
forAll(f, fp)
{ {
uniqueLevels.insert(pointLevel_[f[fp]]); return pointLevel_[f[findMaxLevel(f)]];
} }
else
// Get sorted levels (in increasing order)
const labelList allLevels = uniqueLevels.sortedToc();
// Count number of points per level
labelList nPointsPerLevel(allLevels.size(), 0);
// Loop through all points
forAll(f, fp)
{ {
const label curPointLevel = pointLevel_[f[fp]]; label ownLevel = cellLevel_[mesh_.faceOwner()[faceI]];
// Loop through all levels if (countAnchors(f, ownLevel) >= 3)
forAll(allLevels, levelI)
{ {
// Get current level return ownLevel;
const label curLevel = allLevels[levelI]; }
else if (countAnchors(f, ownLevel + 1) >= 3)
if (curPointLevel == curLevel) {
{ return ownLevel + 1;
// Note: storing nPoints per level based on list index, not }
// actual level else
++nPointsPerLevel[levelI]; {
return -1;
break;
}
} }
} }
} }
@ -1220,7 +1204,8 @@ void Foam::polyRef::createInternalFaces
const labelList& fEdges = mesh_.faceEdges()[faceI]; const labelList& fEdges = mesh_.faceEdges()[faceI];
// We are on the cellI side of face f. The face will have 1 or n // We are on the cellI side of face f. The face will have 1 or n
// cLevel points // cLevel points (where n is the number of points/edges of a face)
// and lots of higher numbered ones.
label faceMidPointI = -1; label faceMidPointI = -1;