Loading...
Searching...
No Matches
surfaceFeatures Class Reference

Holds feature edges/points of surface. More...

#include <surfaceFeatures.H>

Public Types

enum  edgeStatus { NONE , REGION , EXTERNAL , INTERNAL }
 Edge status. More...

Public Member Functions

 ClassName ("surfaceFeatures")
 surfaceFeatures (const triSurface &surf)
 Construct from surface.
 surfaceFeatures (const triSurface &surf, const labelList &featurePoints, const labelList &featureEdges, const label externalStart, const label internalStart)
 Construct from components.
 surfaceFeatures (const triSurface &surf, const scalar includedAngle, const scalar minLen=0, const label minElems=0, const bool geometricTestOnly=false)
 Construct from surface, angle and min cumulative length and/or.
 surfaceFeatures (const triSurface &surf, const dictionary &dict)
 Construct from dictionary.
 surfaceFeatures (const triSurface &surf, const fileName &fName)
 Construct from file.
 surfaceFeatures (const triSurface &surf, const pointField &points, const edgeList &edges, const scalar mergeTol=1e-6, const bool geometricTestOnly=false)
 Construct from pointField and edgeList (edgeMesh).
 surfaceFeatures (const surfaceFeatures &sf)
 Construct as copy.
const triSurfacesurface () const
const labelListfeaturePoints () const
 Return feature point list.
const labelListfeatureEdges () const
 Return feature edge list.
label externalStart () const
 Start of external edges.
label internalStart () const
 Start of internal edges.
label nRegionEdges () const
 Return number of region edges.
label nExternalEdges () const
 Return number of external edges.
label nInternalEdges () const
 Return number of internal edges.
labelList selectFeatureEdges (const bool regionEdges, const bool externalEdges, const bool internalEdges) const
 Helper function: select a subset of featureEdges_.
void findFeatures (const scalar includedAngle, const bool geometricTestOnly)
 Find feature edges using provided included angle.
labelList trimFeatures (const scalar minLen, const label minElems, const scalar includedAngle)
 Delete small sets of edges. Edges are stringed up and any.
void excludeBox (List< edgeStatus > &edgeStat, const treeBoundBox &bb) const
 Mark edge status inside box as 'NONE'.
void subsetBox (List< edgeStatus > &edgeStat, const treeBoundBox &bb) const
 Mark edge status outside box as 'NONE'.
void deleteBox (List< edgeStatus > &edgeStat, const treeBoundBox &bb, const bool removeInside) const
 Mark edge status as 'NONE' for edges inside/outside box.
void subsetPlane (List< edgeStatus > &edgeStat, const plane &cutPlane) const
 If edge does not intersect the plane, mark as 'NONE'.
void excludeOpen (List< edgeStatus > &edgeStat) const
 Mark edges with a single connected face as 'NONE'.
void excludeNonManifold (List< edgeStatus > &edgeStat) const
 Mark edges with >2 connected faces as 'NONE'.
void checkFlatRegionEdge (List< edgeStatus > &edgeStat, const scalar tol, const scalar includedAngle) const
 Divide into multiple normal bins.
List< edgeStatustoStatus () const
 From member feature edges to status per edge.
void setFromStatus (const List< edgeStatus > &edgeStat, const scalar includedAngle)
 Set from status per edge.
Map< label > nearestSamples (const labelList &selectedPoints, const pointField &samples, const scalarField &maxDistSqr) const
 Find nearest sample for selected surface points.
Map< label > nearestSamples (const labelList &selectedEdges, const pointField &samples, const scalarField &sampleDist, const scalarField &maxDistSqr, const scalar minSampleDist=0.1) const
 Find nearest sample for regularly sampled points along.
Map< pointIndexHitnearestEdges (const labelList &selectedEdges, const edgeList &sampleEdges, const labelList &selectedSampleEdges, const pointField &samplePoints, const scalarField &sampleDist, const scalarField &maxDistSqr, const scalar minSampleDist=0.1) const
 Like nearestSamples but now gets nearest point on.
void nearestSurfEdge (const labelList &selectedEdges, const pointField &samples, scalar searchSpanSqr, labelList &edgeLabel, labelList &edgeEndPoint, pointField &edgePoint) const
 Find nearest surface edge (out of selectedEdges) for.
void nearestSurfEdge (const labelList &selectedEdges, const edgeList &sampleEdges, const labelList &selectedSampleEdges, const pointField &samplePoints, const vector &searchSpan, labelList &edgeLabel, pointField &pointOnEdge, pointField &pointOnFeature) const
 Find nearest surface edge (out of selectedEdges) for each.
void nearestFeatEdge (const edgeList &edges, const pointField &points, scalar searchSpanSqr, labelList &edgeLabel) const
 Find nearest feature edge to each surface edge. Uses the.
void writeDict (Ostream &os) const
 Write as dictionary.
void write (const fileName &fName) const
 Write as dictionary to file.
void writeObj (const fileName &prefix) const
 Write to separate OBJ files (region, external, internal edges,.
void writeStats (Ostream &os) const
 Write some information.
void operator= (const surfaceFeatures &rhs)

Detailed Description

Holds feature edges/points of surface.

Feature edges are stored in one list and sorted: 0 .. externalStart_-1 : region edges externalStart_ .. internalStart_-1 : external edges internalStart_ .. size-1 : internal edges

NOTE: angle is included angle, not feature angle and is in degrees. The included angle is the smallest angle between two planes. For coplanar faces it is 180, for straight angles it is 90. To pick up straight edges only use included angle of 91 degrees

Source files

Definition at line 69 of file surfaceFeatures.H.

Member Enumeration Documentation

◆ edgeStatus

enum edgeStatus

Edge status.

Enumerator
NONE 

Not a classified feature edge.

REGION 
EXTERNAL 

"Convex" edge

INTERNAL 

"Concave" edge

Definition at line 76 of file surfaceFeatures.H.

Constructor & Destructor Documentation

◆ surfaceFeatures() [1/7]

surfaceFeatures ( const triSurface & surf)

Construct from surface.

Definition at line 890 of file surfaceFeatures.C.

Referenced by ClassName(), operator=(), and surfaceFeatures().

Here is the caller graph for this function:

◆ surfaceFeatures() [2/7]

surfaceFeatures ( const triSurface & surf,
const labelList & featurePoints,
const labelList & featureEdges,
const label externalStart,
const label internalStart )

Construct from components.

Definition at line 901 of file surfaceFeatures.C.

References externalStart(), featureEdges(), featurePoints(), and internalStart().

Here is the call graph for this function:

◆ surfaceFeatures() [3/7]

surfaceFeatures ( const triSurface & surf,
const scalar includedAngle,
const scalar minLen = 0,
const label minElems = 0,
const bool geometricTestOnly = false )

Construct from surface, angle and min cumulative length and/or.

number of elements. If geometric test only is true, then region information is ignored and features are only assigned based on the geometric criteria

Definition at line 919 of file surfaceFeatures.C.

References findFeatures(), and trimFeatures().

Here is the call graph for this function:

◆ surfaceFeatures() [4/7]

surfaceFeatures ( const triSurface & surf,
const dictionary & dict )

Construct from dictionary.

Definition at line 943 of file surfaceFeatures.C.

◆ surfaceFeatures() [5/7]

surfaceFeatures ( const triSurface & surf,
const fileName & fName )

Construct from file.

Definition at line 957 of file surfaceFeatures.C.

References dictionary::readEntry().

Here is the call graph for this function:

◆ surfaceFeatures() [6/7]

surfaceFeatures ( const triSurface & surf,
const pointField & points,
const edgeList & edges,
const scalar mergeTol = 1e-6,
const bool geometricTestOnly = false )

◆ surfaceFeatures() [7/7]

surfaceFeatures ( const surfaceFeatures & sf)

Construct as copy.

Definition at line 1061 of file surfaceFeatures.C.

References externalStart(), featureEdges(), featurePoints(), internalStart(), surface(), and surfaceFeatures().

Here is the call graph for this function:

Member Function Documentation

◆ ClassName()

ClassName ( "surfaceFeatures" )

References dict, e, externalStart(), featureEdges(), featurePoints(), internalStart(), points, and surfaceFeatures().

Here is the call graph for this function:

◆ surface()

const triSurface & surface ( ) const
inline

Definition at line 294 of file surfaceFeatures.H.

Referenced by extendedEdgeMesh::extendedEdgeMesh(), and surfaceFeatures().

Here is the caller graph for this function:

◆ featurePoints()

const labelList & featurePoints ( ) const
inline

Return feature point list.

Definition at line 302 of file surfaceFeatures.H.

Referenced by ClassName(), extendedEdgeMesh::extendedEdgeMesh(), surfaceFeatures(), surfaceFeatures(), and writeStats().

Here is the caller graph for this function:

◆ featureEdges()

const labelList & featureEdges ( ) const
inline

Return feature edge list.

Definition at line 310 of file surfaceFeatures.H.

Referenced by ClassName(), extendedEdgeMesh::extendedEdgeMesh(), surfaceFeatures(), surfaceFeatures(), and writeStats().

Here is the caller graph for this function:

◆ externalStart()

label externalStart ( ) const
inline

Start of external edges.

Definition at line 318 of file surfaceFeatures.H.

Referenced by ClassName(), surfaceFeatures(), and surfaceFeatures().

Here is the caller graph for this function:

◆ internalStart()

label internalStart ( ) const
inline

Start of internal edges.

Definition at line 326 of file surfaceFeatures.H.

Referenced by ClassName(), surfaceFeatures(), and surfaceFeatures().

Here is the caller graph for this function:

◆ nRegionEdges()

label nRegionEdges ( ) const
inline

Return number of region edges.

Definition at line 334 of file surfaceFeatures.H.

Referenced by extendedEdgeMesh::extendedEdgeMesh(), selectFeatureEdges(), and writeStats().

Here is the caller graph for this function:

◆ nExternalEdges()

label nExternalEdges ( ) const
inline

Return number of external edges.

Definition at line 342 of file surfaceFeatures.H.

Referenced by selectFeatureEdges(), and writeStats().

Here is the caller graph for this function:

◆ nInternalEdges()

label nInternalEdges ( ) const
inline

Return number of internal edges.

Definition at line 350 of file surfaceFeatures.H.

Referenced by selectFeatureEdges(), and writeStats().

Here is the caller graph for this function:

◆ selectFeatureEdges()

Foam::labelList selectFeatureEdges ( const bool regionEdges,
const bool externalEdges,
const bool internalEdges ) const

Helper function: select a subset of featureEdges_.

Definition at line 1073 of file surfaceFeatures.C.

References DynamicList< T, SizeMin >::append(), nExternalEdges(), nInternalEdges(), nRegionEdges(), and DynamicList< T, SizeMin >::reserve_exact().

Here is the call graph for this function:

◆ findFeatures()

void findFeatures ( const scalar includedAngle,
const bool geometricTestOnly )

Find feature edges using provided included angle.

Definition at line 1121 of file surfaceFeatures.C.

References Foam::cos(), Foam::degToRad(), NONE, and setFromStatus().

Referenced by surfaceFeatures().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ trimFeatures()

Foam::labelList trimFeatures ( const scalar minLen,
const label minElems,
const scalar includedAngle )

Delete small sets of edges. Edges are stringed up and any.

string of length < minLen (or nElems < minElems) is deleted.

Definition at line 1146 of file surfaceFeatures.C.

References forAll, edge::mag(), NONE, setFromStatus(), UList< T >::size(), and toStatus().

Referenced by surfaceFeatures().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ excludeBox()

void excludeBox ( List< edgeStatus > & edgeStat,
const treeBoundBox & bb ) const

Mark edge status inside box as 'NONE'.

Definition at line 1280 of file surfaceFeatures.C.

References deleteBox().

Here is the call graph for this function:

◆ subsetBox()

void subsetBox ( List< edgeStatus > & edgeStat,
const treeBoundBox & bb ) const

Mark edge status outside box as 'NONE'.

Definition at line 1290 of file surfaceFeatures.C.

References deleteBox().

Here is the call graph for this function:

◆ deleteBox()

void deleteBox ( List< edgeStatus > & edgeStat,
const treeBoundBox & bb,
const bool removeInside ) const

Mark edge status as 'NONE' for edges inside/outside box.

Definition at line 1300 of file surfaceFeatures.C.

References treeBoundBox::contains(), forAll, and NONE.

Referenced by excludeBox(), and subsetBox().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ subsetPlane()

void subsetPlane ( List< edgeStatus > & edgeStat,
const plane & cutPlane ) const

If edge does not intersect the plane, mark as 'NONE'.

Definition at line 1322 of file surfaceFeatures.C.

References e, forAll, plane::lineIntersect(), NONE, p0, and pts.

Here is the call graph for this function:

◆ excludeOpen()

void excludeOpen ( List< edgeStatus > & edgeStat) const

Mark edges with a single connected face as 'NONE'.

Definition at line 1353 of file surfaceFeatures.C.

References forAll, and NONE.

◆ excludeNonManifold()

void excludeNonManifold ( List< edgeStatus > & edgeStat) const

Mark edges with >2 connected faces as 'NONE'.

Definition at line 1368 of file surfaceFeatures.C.

References forAll, and NONE.

◆ checkFlatRegionEdge()

void checkFlatRegionEdge ( List< edgeStatus > & edgeStat,
const scalar tol,
const scalar includedAngle ) const

Divide into multiple normal bins.

  • set REGION if != 2 normals
  • set REGION if 2 normals that make feature angle
  • otherwise set NONE and set normals,bins
  • return REGION if != 2 normals
  • return REGION if 2 normals that make feature angle
  • otherwise return NONE and set normals,bins

Definition at line 1390 of file surfaceFeatures.C.

References forAll, REGION, and UList< T >::size().

Here is the call graph for this function:

◆ toStatus()

From member feature edges to status per edge.

Definition at line 108 of file surfaceFeatures.C.

References EXTERNAL, INTERNAL, NONE, and REGION.

Referenced by trimFeatures().

Here is the caller graph for this function:

◆ setFromStatus()

void setFromStatus ( const List< edgeStatus > & edgeStat,
const scalar includedAngle )

Set from status per edge.

Definition at line 136 of file surfaceFeatures.C.

References Foam::cos(), Foam::degToRad(), EXTERNAL, forAll, INTERNAL, REGION, and List< T >::setSize().

Referenced by findFeatures(), surfaceFeatures(), and trimFeatures().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nearestSamples() [1/2]

Foam::Map< Foam::label > nearestSamples ( const labelList & selectedPoints,
const pointField & samples,
const scalarField & maxDistSqr ) const

Find nearest sample for selected surface points.

(usually the set of featurePoints). Return map from index in samples to surface point. Do not include points that are further than maxDist away (separate maxDist for every sample). Supply maxDistSqr.

Definition at line 1504 of file surfaceFeatures.C.

References Foam::abort(), indexedOctree< Type >::bb(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, forAll, forAllConstIters, PointIndexHit< PointType >::hit(), PointIndexHit< PointType >::index(), HashTable< T, Key, Hash >::insert(), pointLabels(), Foam::Pout, samples(), indexedOctree< Type >::shapes(), and Foam::meshTools::writeOBJ().

Here is the call graph for this function:

◆ nearestSamples() [2/2]

Foam::Map< Foam::label > nearestSamples ( const labelList & selectedEdges,
const pointField & samples,
const scalarField & sampleDist,
const scalarField & maxDistSqr,
const scalar minSampleDist = 0.1 ) const

Find nearest sample for regularly sampled points along.

the selected (surface) edges. Return map from sample to edge. maxDistSqr is distance squared below which gets snapped. Edge gets sampled at points sampleDist[sampleI] apart. (with a maximum of 10 samples per edge)

Definition at line 1586 of file surfaceFeatures.C.

References Vector< Cmpt >::distSqr(), e, Foam::endl(), Foam::exit(), forAll, forAllConstIters, PointIndexHit< PointType >::hit(), PointIndexHit< PointType >::index(), HashTable< T, Key, Hash >::insert(), Foam::mag(), Foam::max(), PointIndexHit< PointType >::point(), Foam::Pout, s(), samples(), UList< T >::size(), and Foam::meshTools::writeOBJ().

Here is the call graph for this function:

◆ nearestEdges()

Foam::Map< Foam::pointIndexHit > nearestEdges ( const labelList & selectedEdges,
const edgeList & sampleEdges,
const labelList & selectedSampleEdges,
const pointField & samplePoints,
const scalarField & sampleDist,
const scalarField & maxDistSqr,
const scalar minSampleDist = 0.1 ) const

Like nearestSamples but now gets nearest point on.

sample-edge instead of nearest sample-point itself. Return map from sample edge to feature edge.

Definition at line 1722 of file surfaceFeatures.C.

References edge::centre(), Vector< Cmpt >::distSqr(), e, Foam::endl(), Foam::exit(), forAll, forAllConstIters, PointIndexHit< PointType >::hit(), PointIndexHit< PointType >::index(), HashTable< T, Key, Hash >::insert(), Foam::mag(), Foam::max(), PointIndexHit< PointType >::point(), Foam::Pout, s(), indexedOctree< Type >::shapes(), UList< T >::size(), and Foam::meshTools::writeOBJ().

Here is the call graph for this function:

◆ nearestSurfEdge() [1/2]

void nearestSurfEdge ( const labelList & selectedEdges,
const pointField & samples,
scalar searchSpanSqr,
labelList & edgeLabel,
labelList & edgeEndPoint,
pointField & edgePoint ) const

Find nearest surface edge (out of selectedEdges) for.

each sample point. Sets:

  • edgeLabel : label of surface edge.
  • edgePoint : exact position of nearest point on edge.
  • edgeEndPoint : -1, 0, 1 depending on whether edgePoint is on inside/start/end of edge

Definition at line 1872 of file surfaceFeatures.C.

References forAll, PointIndexHit< PointType >::hit(), PointIndexHit< PointType >::index(), boundBox::inflate(), PointIndexHit< PointType >::point(), samples(), List< T >::setSize(), and indexedOctree< Type >::shapes().

Here is the call graph for this function:

◆ nearestSurfEdge() [2/2]

void nearestSurfEdge ( const labelList & selectedEdges,
const edgeList & sampleEdges,
const labelList & selectedSampleEdges,
const pointField & samplePoints,
const vector & searchSpan,
labelList & edgeLabel,
pointField & pointOnEdge,
pointField & pointOnFeature ) const

Find nearest surface edge (out of selectedEdges) for each.

sample edge. Sets:

  • edgeLabel : label of surface edge.
  • pointOnEdge : exact position of nearest point on edge.
  • pointOnFeature : exact position on sample edge.

Definition at line 1938 of file surfaceFeatures.C.

References line< Point, PointRef >::centre(), e, forAll, PointIndexHit< PointType >::hit(), PointIndexHit< PointType >::index(), PointIndexHit< PointType >::point(), List< T >::setSize(), indexedOctree< Type >::shapes(), and UList< T >::size().

Here is the call graph for this function:

◆ nearestFeatEdge()

void nearestFeatEdge ( const edgeList & edges,
const pointField & points,
scalar searchSpanSqr,
labelList & edgeLabel ) const

Find nearest feature edge to each surface edge. Uses the.

mid-point of the surface edges.

Definition at line 2003 of file surfaceFeatures.C.

References forAll, PointIndexHit< PointType >::hit(), PointIndexHit< PointType >::index(), boundBox::inflate(), Foam::mag(), points, and indexedOctree< Type >::shapes().

Referenced by surfaceFeatures().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeDict()

void writeDict ( Ostream & os) const

Write as dictionary.

Definition at line 1420 of file surfaceFeatures.C.

References dictionary::add(), os(), and dictionary::write().

Referenced by write().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write()

void write ( const fileName & fName) const

Write as dictionary to file.

Definition at line 1432 of file surfaceFeatures.C.

References os(), and writeDict().

Here is the call graph for this function:

◆ writeObj()

void writeObj ( const fileName & prefix) const

Write to separate OBJ files (region, external, internal edges,.

feature points) for visualization

Definition at line 1439 of file surfaceFeatures.C.

References e, Foam::endl(), OFstream::name(), Foam::Pout, and Foam::meshTools::writeOBJ().

Here is the call graph for this function:

◆ writeStats()

void writeStats ( Ostream & os) const

Write some information.

Definition at line 1491 of file surfaceFeatures.C.

References Foam::endl(), featureEdges(), featurePoints(), nExternalEdges(), nInternalEdges(), Foam::nl, nRegionEdges(), and os().

Here is the call graph for this function:

◆ operator=()

void operator= ( const surfaceFeatures & rhs)

Definition at line 2061 of file surfaceFeatures.C.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, Foam::rhs(), and surfaceFeatures().

Here is the call graph for this function:

The documentation for this class was generated from the following files: