surfaceFeatureExtract: Moved feature edge editing functions to the surfaceFeatures class
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -30,10 +30,8 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
defineTypeNameAndDebug(closedTriSurfaceMesh, 0);
|
||||
addToRunTimeSelectionTable(searchableSurface, closedTriSurfaceMesh, dict);
|
||||
|
||||
defineTypeNameAndDebug(closedTriSurfaceMesh, 0);
|
||||
addToRunTimeSelectionTable(searchableSurface, closedTriSurfaceMesh, dict);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -316,12 +316,16 @@ public:
|
||||
// indices) get the specified field. Misses do not get set.
|
||||
virtual void getField(const List<pointIndexHit>&, labelList&) const;
|
||||
|
||||
//- Return a pair of triSurfaceScalarFields representing the
|
||||
// internal and external closeness of regions of the surface
|
||||
Pair<tmp<triSurfaceScalarField>> extractCloseness
|
||||
(
|
||||
const scalar internalAngleTolerance = 80,
|
||||
const scalar externalAngleTolerance = 10
|
||||
) const;
|
||||
|
||||
//- Return a pair of triSurfaceScalarPointFields representing the
|
||||
// internal and external closeness of regions of the surface
|
||||
Pair<tmp<triSurfacePointScalarField>> extractPointCloseness
|
||||
(
|
||||
const scalar internalAngleTolerance = 80,
|
||||
|
||||
@ -1501,6 +1501,56 @@ void Foam::surfaceFeatures::operator=(const surfaceFeatures& rhs)
|
||||
|
||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::selectBox
|
||||
(
|
||||
const triSurface& surf,
|
||||
const boundBox& bb,
|
||||
const bool inside,
|
||||
List<surfaceFeatures::edgeStatus>& edgeStat
|
||||
)
|
||||
{
|
||||
forAll(edgeStat, edgei)
|
||||
{
|
||||
const point eMid = surf.edges()[edgei].centre(surf.localPoints());
|
||||
|
||||
if (!inside ? bb.contains(eMid) : !bb.contains(eMid))
|
||||
{
|
||||
edgeStat[edgei] = surfaceFeatures::NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::selectCutEdges
|
||||
(
|
||||
const triSurface& surf,
|
||||
const plane& cutPlane,
|
||||
List<surfaceFeatures::edgeStatus>& edgeStat
|
||||
)
|
||||
{
|
||||
const pointField& points = surf.points();
|
||||
const labelList& meshPoints = surf.meshPoints();
|
||||
|
||||
forAll(edgeStat, edgei)
|
||||
{
|
||||
const edge& e = surf.edges()[edgei];
|
||||
const point& p0 = points[meshPoints[e.start()]];
|
||||
const point& p1 = points[meshPoints[e.end()]];
|
||||
const linePointRef line(p0, p1);
|
||||
|
||||
// If edge does not intersect the plane, delete.
|
||||
const scalar intersect = cutPlane.lineIntersect(line);
|
||||
|
||||
const point featPoint = intersect*(p1 - p0) + p0;
|
||||
|
||||
if (!line.insideBoundBox(featPoint))
|
||||
{
|
||||
edgeStat[edgei] = surfaceFeatures::NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::surfaceFeatures::edgeStatus Foam::checkNonManifoldEdge
|
||||
(
|
||||
const triSurface& surf,
|
||||
@ -1662,4 +1712,35 @@ Foam::surfaceFeatures::edgeStatus Foam::checkNonManifoldEdge
|
||||
}
|
||||
|
||||
|
||||
void Foam::selectManifoldEdges
|
||||
(
|
||||
const triSurface& surf,
|
||||
const scalar tol,
|
||||
const scalar includedAngle,
|
||||
List<surfaceFeatures::edgeStatus>& edgeStat
|
||||
)
|
||||
{
|
||||
forAll(edgeStat, edgei)
|
||||
{
|
||||
const labelList& eFaces = surf.edgeFaces()[edgei];
|
||||
|
||||
if
|
||||
(
|
||||
eFaces.size() > 2
|
||||
&& edgeStat[edgei] == surfaceFeatures::REGION
|
||||
&& (eFaces.size() % 2) == 0
|
||||
)
|
||||
{
|
||||
edgeStat[edgei] = checkNonManifoldEdge
|
||||
(
|
||||
surf,
|
||||
tol,
|
||||
includedAngle,
|
||||
edgei
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -51,6 +51,8 @@ SourceFiles
|
||||
#include "pointIndexHit.H"
|
||||
#include "edgeList.H"
|
||||
#include "typeInfo.H"
|
||||
#include "boundBox.H"
|
||||
#include "plane.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -419,6 +421,23 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//- Select edges inside or outside bounding box
|
||||
void selectBox
|
||||
(
|
||||
const triSurface& surf,
|
||||
const boundBox& bb,
|
||||
const bool removeInside,
|
||||
List<surfaceFeatures::edgeStatus>& edgeStat
|
||||
);
|
||||
|
||||
//- Select edges that are intersected by the given plane
|
||||
void selectCutEdges
|
||||
(
|
||||
const triSurface& surf,
|
||||
const plane& cutPlane,
|
||||
List<surfaceFeatures::edgeStatus>& edgeStat
|
||||
);
|
||||
|
||||
//- Divide into multiple normal bins
|
||||
// - return REGION if != 2 normals
|
||||
// - return REGION if 2 normals that make feature angle
|
||||
@ -431,6 +450,15 @@ surfaceFeatures::edgeStatus checkNonManifoldEdge
|
||||
const label edgei
|
||||
);
|
||||
|
||||
//- Select manifold edges
|
||||
void selectManifoldEdges
|
||||
(
|
||||
const triSurface& surf,
|
||||
const scalar tol,
|
||||
const scalar includedAngle,
|
||||
List<surfaceFeatures::edgeStatus>& edgeStat
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
Reference in New Issue
Block a user