BUG: conformalVoronoiMesh. Possibility of two Delaunay vertices being

closer than SMALL when a pointFile is read (and perhaps other
situations).  When this is detected, deleting one or both of the points.

Also adding a check that both Delaunay vertices are internal before
looking at them in pointToBeRetained, otherwise there is a risk of a
seg-fault or undefined behaviour.
This commit is contained in:
graham
2010-02-26 19:11:09 +00:00
parent d739901701
commit fd41ce151f

View File

@ -1278,6 +1278,45 @@ void Foam::conformalVoronoiMesh::move()
scalar rABMag = mag(rAB);
if (rABMag < SMALL)
{
// Removal of close points
if (vA->internalPoint() && vB->internalPoint())
{
// Only insert a point at the midpoint of
// the short edge if neither attached
// point has already been identified to be
// removed.
if
(
pointToBeRetained[vA->index()] == true
&& pointToBeRetained[vB->index()] == true
)
{
pointsToInsert.push_back
(
toPoint(0.5*(dVA + dVB))
);
}
}
if (vA->internalPoint())
{
pointToBeRetained[vA->index()] = false;
}
if (vB->internalPoint())
{
pointToBeRetained[vB->index()] = false;
}
// Do not consider this Delaunay edge any further
continue;
}
forAll(alignmentDirs, aD)
{
vector& alignmentDir = alignmentDirs[aD];
@ -1354,9 +1393,13 @@ void Foam::conformalVoronoiMesh::move()
{
// Point removal
// Only insert a point at the midpoint of the short edge
// if neither attached point has already been identified
// to be removed.
if (vA->internalPoint() && vB->internalPoint())
{
// Only insert a point at the midpoint of
// the short edge if neither attached
// point has already been identified to be
// removed.
if
(
pointToBeRetained[vA->index()] == true
@ -1368,6 +1411,7 @@ void Foam::conformalVoronoiMesh::move()
toPoint(0.5*(dVA + dVB))
);
}
}
if (vA->internalPoint())
{