mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Making nearestPointClassify query for triangle.
This is to access the face/edge/point status of the nearest at the same time to ensure a consistent result. Using getVolumeType query in distanceSurface, not simple normal dot-product comparison, fails on edges.
This commit is contained in:
@ -89,20 +89,29 @@ void Foam::distanceSurface::createGeometry()
|
||||
|
||||
if (signed_)
|
||||
{
|
||||
vectorField normal;
|
||||
surfPtr_().getNormal(nearest, normal);
|
||||
List<searchableSurface::volumeType> volType;
|
||||
|
||||
forAll(nearest, i)
|
||||
surfPtr_().getVolumeType(cc, volType);
|
||||
|
||||
forAll(volType, i)
|
||||
{
|
||||
vector d(cc[i]-nearest[i].hitPoint());
|
||||
searchableSurface::volumeType vT = volType[i];
|
||||
|
||||
if ((d&normal[i]) > 0)
|
||||
if (vT == searchableSurface::OUTSIDE)
|
||||
{
|
||||
fld[i] = Foam::mag(d);
|
||||
fld[i] = Foam::mag(cc[i] - nearest[i].hitPoint());
|
||||
}
|
||||
else if (vT == searchableSurface::INSIDE)
|
||||
{
|
||||
fld[i] = -Foam::mag(cc[i] - nearest[i].hitPoint());
|
||||
}
|
||||
else
|
||||
{
|
||||
fld[i] = -Foam::mag(d);
|
||||
FatalErrorIn
|
||||
(
|
||||
"void Foam::distanceSurface::createGeometry()"
|
||||
) << "getVolumeType failure, neither INSIDE or OUTSIDE"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -132,20 +141,30 @@ void Foam::distanceSurface::createGeometry()
|
||||
|
||||
if (signed_)
|
||||
{
|
||||
vectorField normal;
|
||||
surfPtr_().getNormal(nearest, normal);
|
||||
List<searchableSurface::volumeType> volType;
|
||||
|
||||
forAll(nearest, i)
|
||||
surfPtr_().getVolumeType(cc, volType);
|
||||
|
||||
forAll(volType, i)
|
||||
{
|
||||
vector d(cc[i]-nearest[i].hitPoint());
|
||||
searchableSurface::volumeType vT = volType[i];
|
||||
|
||||
if ((d&normal[i]) > 0)
|
||||
if (vT == searchableSurface::OUTSIDE)
|
||||
{
|
||||
fld[i] = Foam::mag(d);
|
||||
fld[i] = Foam::mag(cc[i] - nearest[i].hitPoint());
|
||||
}
|
||||
else if (vT == searchableSurface::INSIDE)
|
||||
{
|
||||
fld[i] = -Foam::mag(cc[i] - nearest[i].hitPoint());
|
||||
}
|
||||
else
|
||||
{
|
||||
fld[i] = -Foam::mag(d);
|
||||
FatalErrorIn
|
||||
(
|
||||
"void Foam::distanceSurface::createGeometry()"
|
||||
) << "getVolumeType failure, "
|
||||
<< "neither INSIDE or OUTSIDE"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -179,20 +198,31 @@ void Foam::distanceSurface::createGeometry()
|
||||
|
||||
if (signed_)
|
||||
{
|
||||
vectorField normal;
|
||||
surfPtr_().getNormal(nearest, normal);
|
||||
List<searchableSurface::volumeType> volType;
|
||||
|
||||
forAll(nearest, i)
|
||||
surfPtr_().getVolumeType(pts, volType);
|
||||
|
||||
forAll(volType, i)
|
||||
{
|
||||
vector d(pts[i]-nearest[i].hitPoint());
|
||||
searchableSurface::volumeType vT = volType[i];
|
||||
|
||||
if ((d&normal[i]) > 0)
|
||||
if (vT == searchableSurface::OUTSIDE)
|
||||
{
|
||||
pointDistance_[i] = Foam::mag(d);
|
||||
pointDistance_[i] =
|
||||
Foam::mag(pts[i] - nearest[i].hitPoint());
|
||||
}
|
||||
else if (vT == searchableSurface::INSIDE)
|
||||
{
|
||||
pointDistance_[i] =
|
||||
-Foam::mag(pts[i] - nearest[i].hitPoint());
|
||||
}
|
||||
else
|
||||
{
|
||||
pointDistance_[i] = -Foam::mag(d);
|
||||
FatalErrorIn
|
||||
(
|
||||
"void Foam::distanceSurface::createGeometry()"
|
||||
) << "getVolumeType failure, neither INSIDE or OUTSIDE"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user