mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: cvMeshSurfaceSimplify: make robust for open surfaces
This commit is contained in:
@ -173,6 +173,8 @@ int main(int argc, char *argv[])
|
||||
surfaces,
|
||||
points,
|
||||
scalarField(points.size(), sqr(GREAT)),
|
||||
searchableSurface::OUTSIDE, // for non-closed surfaces treat as
|
||||
// outside
|
||||
nearestSurfaces,
|
||||
signedDist
|
||||
);
|
||||
|
||||
@ -693,6 +693,7 @@ void Foam::searchableSurfacesQueries::signedDistance
|
||||
const labelList& surfacesToTest,
|
||||
const pointField& samples,
|
||||
const scalarField& nearestDistSqr,
|
||||
const searchableSurface::volumeType illegalHandling,
|
||||
labelList& nearestSurfaces,
|
||||
scalarField& distance
|
||||
)
|
||||
@ -753,9 +754,32 @@ void Foam::searchableSurfacesQueries::signedDistance
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("signedDistance()")
|
||||
<< "getVolumeType failure, neither INSIDE or OUTSIDE"
|
||||
<< exit(FatalError);
|
||||
switch (illegalHandling)
|
||||
{
|
||||
case searchableSurface::OUTSIDE:
|
||||
{
|
||||
distance[pointI] = dist;
|
||||
break;
|
||||
}
|
||||
case searchableSurface::INSIDE:
|
||||
{
|
||||
distance[pointI] = -dist;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
FatalErrorIn("signedDistance()")
|
||||
<< "getVolumeType failure,"
|
||||
<< " neither INSIDE or OUTSIDE."
|
||||
<< " point:" << surfPoints[i]
|
||||
<< " surface:"
|
||||
<< allSurfaces[surfacesToTest[testI]].name()
|
||||
<< " volType:"
|
||||
<< searchableSurface::volumeTypeNames[vT]
|
||||
<< exit(FatalError);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -184,13 +184,18 @@ public:
|
||||
List<pointIndexHit>&
|
||||
);
|
||||
|
||||
//- Find signed distance to nearest surface
|
||||
//- Find signed distance to nearest surface. Outside is positive.
|
||||
// illegalHandling: how to handle non-inside or outside
|
||||
// OUTSIDE : treat as outside
|
||||
// INSIDE : treat as inside
|
||||
// UNKNOWN : throw fatal error
|
||||
static void signedDistance
|
||||
(
|
||||
const PtrList<searchableSurface>& allSurfaces,
|
||||
const labelList& surfacesToTest,
|
||||
const pointField& samples,
|
||||
const scalarField& nearestDistSqr,
|
||||
const searchableSurface::volumeType illegalHandling,
|
||||
labelList& nearestSurfaces,
|
||||
scalarField& distance
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user