From 674990765ac5dee40a7877cedb7bdd5a8c29a73b Mon Sep 17 00:00:00 2001 From: mattijs <mattijs> Date: Thu, 11 Oct 2012 11:04:24 +0100 Subject: [PATCH] ENH: surfaceFeatureExtract: new syntax for non-manifold edges --- .../surfaceFeatureExtract.C | 28 +++++++++-- .../surfaceFeatureExtractDict | 10 +++- .../system/surfaceFeatureExtractDict | 48 +++++++++++++++++++ 3 files changed, 79 insertions(+), 7 deletions(-) create mode 100644 tutorials/incompressible/simpleFoam/motorBike/system/surfaceFeatureExtractDict diff --git a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C index 3a9d667650c..d06e5d03cb8 100644 --- a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C +++ b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C @@ -721,16 +721,34 @@ int main(int argc, char *argv[]) deleteBox(surf, bb, true, edgeStat); } - const Switch manifoldEdges = - subsetDict.lookupOrDefault<Switch>("manifoldEdges", "no"); + const Switch nonManifoldEdges = + subsetDict.lookupOrDefault<Switch>("nonManifoldEdges", "yes"); - if (manifoldEdges) + if (!nonManifoldEdges) { - Info<< "Removing all non-manifold edges" << endl; + Info<< "Removing all non-manifold edges" + << " (edges with > 2 connected faces)" << endl; forAll(edgeStat, edgeI) { - if (surf.edgeFaces()[edgeI].size() != 2) + if (surf.edgeFaces()[edgeI].size() > 2) + { + edgeStat[edgeI] = surfaceFeatures::NONE; + } + } + } + + const Switch openEdges = + subsetDict.lookupOrDefault<Switch>("openEdges", "yes"); + + if (!openEdges) + { + Info<< "Removing all open edges" + << " (edges with 1 connected face)" << endl; + + forAll(edgeStat, edgeI) + { + if (surf.edgeFaces()[edgeI].size() == 1) { edgeStat[edgeI] = surfaceFeatures::NONE; } diff --git a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtractDict b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtractDict index 934d5869a92..6c1eab66e9c 100644 --- a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtractDict +++ b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtractDict @@ -59,15 +59,21 @@ surface2.nas { // Use a plane to select feature edges // (normal)(basePoint) + // Keep only edges that intersect the plane will be included plane (1 0 0)(0 0 0); // Select feature edges using a box // (minPt)(maxPt) + // Keep edges inside the box: insideBox (0 0 0)(1 1 1); + // Keep edges outside the box: outsideBox (0 0 0)(1 1 1); - // Remove any non-manifold (open or > 2 connected faces) edges - manifoldEdges no; + // Keep nonManifold edges (edges with >2 connected faces) + nonManifoldEdges yes; + + // Keep open edges (edges with 1 connected face) + openEdges yes; } addFeatures diff --git a/tutorials/incompressible/simpleFoam/motorBike/system/surfaceFeatureExtractDict b/tutorials/incompressible/simpleFoam/motorBike/system/surfaceFeatureExtractDict new file mode 100644 index 00000000000..fa00f860016 --- /dev/null +++ b/tutorials/incompressible/simpleFoam/motorBike/system/surfaceFeatureExtractDict @@ -0,0 +1,48 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object surfaceFeatureExtractDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +motorBike.obj +{ + // How to obtain raw features (extractFromFile || extractFromSurface) + extractionMethod extractFromSurface; + + extractFromSurfaceCoeffs + { + // Mark edges whose adjacent surface normals are at an angle less + // than includedAngle as features + // - 0 : selects no edges + // - 180: selects all edges + includedAngle 150; + } + + subsetFeatures + { + // Keep nonManifold edges (edges with >2 connected faces) + nonManifoldEdges no; + + // Keep open edges (edges with 1 connected face) + openEdges yes; + } + + + // Write options + + // Write features to obj format for postprocessing + writeObj yes; +} + + +// ************************************************************************* // -- GitLab