Logic errors:

Decisions to skip faces with an already indexed point was wrong, the
continue would be operating on the while loop, not the for loop over
the face, adding a bool to be used afterwards.

limitToQuadsOrTris logic would not work when it was false, it would
never operate regardless of the size of the face.
This commit is contained in:
graham
2010-01-10 11:46:30 +00:00
parent d598afbd90
commit 1c267fb809

View File

@ -525,17 +525,27 @@ Foam::label Foam::conformalVoronoiMesh::smoothSurfaceDualFaces
Cell_circulator ccStart = incident_cells(*eit); Cell_circulator ccStart = incident_cells(*eit);
Cell_circulator cc = ccStart; Cell_circulator cc = ccStart;
bool skipFace = false;
do do
{ {
if (dualPtIndexMap.found(cc->cellIndex())) if (dualPtIndexMap.found(cc->cellIndex()))
{ {
// One of the points of this face has already been // One of the points of this face has already been
// collapsed this sweep, leave for next sweep // collapsed this sweep, leave for next sweep
continue;
skipFace = true;
break;
} }
} while (++cc != ccStart); } while (++cc != ccStart);
if (skipFace)
{
continue;
}
if (isBoundaryDualFace(eit)) if (isBoundaryDualFace(eit))
{ {
face dualFace = buildDualFace(eit); face dualFace = buildDualFace(eit);
@ -664,17 +674,27 @@ Foam::label Foam::conformalVoronoiMesh::collapseFaces
Cell_circulator ccStart = incident_cells(*eit); Cell_circulator ccStart = incident_cells(*eit);
Cell_circulator cc = ccStart; Cell_circulator cc = ccStart;
bool skipFace = false;
do do
{ {
if (dualPtIndexMap.found(cc->cellIndex())) if (dualPtIndexMap.found(cc->cellIndex()))
{ {
// One of the points of this face has already been // One of the points of this face has already been
// collapsed this sweep, leave for next sweep // collapsed this sweep, leave for next sweep
continue;
skipFace = true;
break;
} }
} while (++cc != ccStart); } while (++cc != ccStart);
if (skipFace)
{
continue;
}
Cell_handle c = eit->first; Cell_handle c = eit->first;
Vertex_handle vA = c->vertex(eit->second); Vertex_handle vA = c->vertex(eit->second);
Vertex_handle vB = c->vertex(eit->third); Vertex_handle vB = c->vertex(eit->third);
@ -725,7 +745,7 @@ bool Foam::conformalVoronoiMesh::collapseFace
scalar collapseSizeLimitCoeff scalar collapseSizeLimitCoeff
) const ) const
{ {
bool limitToQuadsOrTris = true; bool limitToQuadsOrTris = false;
const vector fC = f.centre(pts); const vector fC = f.centre(pts);
@ -920,7 +940,7 @@ bool Foam::conformalVoronoiMesh::collapseFace
if if
( (
(fA < aspectRatio*sqr(targetFaceSize*collapseSizeLimitCoeff)) (fA < aspectRatio*sqr(targetFaceSize*collapseSizeLimitCoeff))
&& (limitToQuadsOrTris && f.size() <= 4) && (!limitToQuadsOrTris || f.size() <= 4)
) )
{ {
scalar guardFraction = cvMeshControls().edgeCollapseGuardFraction(); scalar guardFraction = cvMeshControls().edgeCollapseGuardFraction();