mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: surfaceFeatureExtract: Provide -plane argument for creating 2D edge meshes
This commit is contained in:
@ -44,6 +44,7 @@ Description
|
||||
#include "indexedOctree.H"
|
||||
#include "treeDataEdge.H"
|
||||
#include "unitConversion.H"
|
||||
#include "plane.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
@ -94,6 +95,35 @@ void deleteBox
|
||||
}
|
||||
|
||||
|
||||
// Deletes all edges inside/outside bounding box from set.
|
||||
void deleteEdges
|
||||
(
|
||||
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.
|
||||
scalar intersect = cutPlane.lineIntersect(line);
|
||||
|
||||
if (mag(intersect) > line.mag())
|
||||
{
|
||||
edgeStat[edgeI] = surfaceFeatures::NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void drawHitProblem
|
||||
(
|
||||
label fI,
|
||||
@ -270,6 +300,12 @@ int main(int argc, char *argv[])
|
||||
"manifoldEdgesOnly",
|
||||
"remove any non-manifold (open or more than two connected faces) edges"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"plane",
|
||||
"(nx ny nz)(z0 y0 z0)",
|
||||
"used to create feature edges for 2D meshing"
|
||||
);
|
||||
|
||||
# ifdef ENABLE_CURVATURE
|
||||
argList::addBoolOption
|
||||
@ -454,6 +490,21 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if (args.optionFound("plane"))
|
||||
{
|
||||
plane cutPlane(args.optionLookup("plane")());
|
||||
|
||||
deleteEdges
|
||||
(
|
||||
surf,
|
||||
cutPlane,
|
||||
edgeStat
|
||||
);
|
||||
|
||||
Info<< "Only edges that intersect the plane with normal "
|
||||
<< cutPlane.normal() << " and base point " << cutPlane.refPoint()
|
||||
<< " will be included as feature edges."<< endl;
|
||||
}
|
||||
|
||||
surfaceFeatures newSet(surf);
|
||||
newSet.setFromStatus(edgeStat);
|
||||
@ -475,7 +526,6 @@ int main(int argc, char *argv[])
|
||||
<< endl;
|
||||
|
||||
// Extracting and writing a extendedFeatureEdgeMesh
|
||||
|
||||
extendedFeatureEdgeMesh feMesh
|
||||
(
|
||||
newSet,
|
||||
|
||||
Reference in New Issue
Block a user