mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
@ -1278,6 +1278,45 @@ void Foam::conformalVoronoiMesh::move()
|
|||||||
|
|
||||||
scalar rABMag = mag(rAB);
|
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)
|
forAll(alignmentDirs, aD)
|
||||||
{
|
{
|
||||||
vector& alignmentDir = alignmentDirs[aD];
|
vector& alignmentDir = alignmentDirs[aD];
|
||||||
@ -1354,9 +1393,13 @@ void Foam::conformalVoronoiMesh::move()
|
|||||||
{
|
{
|
||||||
// Point removal
|
// Point removal
|
||||||
|
|
||||||
// Only insert a point at the midpoint of the short edge
|
if (vA->internalPoint() && vB->internalPoint())
|
||||||
// if neither attached point has already been identified
|
{
|
||||||
// to be removed.
|
// Only insert a point at the midpoint of
|
||||||
|
// the short edge if neither attached
|
||||||
|
// point has already been identified to be
|
||||||
|
// removed.
|
||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
pointToBeRetained[vA->index()] == true
|
pointToBeRetained[vA->index()] == true
|
||||||
@ -1368,6 +1411,7 @@ void Foam::conformalVoronoiMesh::move()
|
|||||||
toPoint(0.5*(dVA + dVB))
|
toPoint(0.5*(dVA + dVB))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (vA->internalPoint())
|
if (vA->internalPoint())
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user