surfaceFeatures Class Reference

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

Public Types

enum  edgeStatus { NONE, REGION, EXTERNAL, INTERNAL }
 

Public Member Functions

 ClassName ("surfaceFeatures")
 
 surfaceFeatures (const triSurface &)
 Construct from surface. More...
 
 surfaceFeatures (const triSurface &, const labelList &featurePoints, const labelList &featureEdges, const label externalStart, const label internalStart)
 Construct from components. More...
 
 surfaceFeatures (const triSurface &, 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. More...
 
 surfaceFeatures (const triSurface &, const dictionary &dict)
 Construct from dictionary. More...
 
 surfaceFeatures (const triSurface &, const fileName &fName)
 Construct from file. More...
 
 surfaceFeatures (const triSurface &, const pointField &points, const edgeList &edges, const scalar mergeTol=1e-6, const bool geometricTestOnly=false)
 Construct from pointField and edgeList (edgeMesh) More...
 
 surfaceFeatures (const surfaceFeatures &)
 Copy constructor. More...
 
const triSurfacesurface () const
 
const labelListfeaturePoints () const
 Return feature point list. More...
 
const labelListfeatureEdges () const
 Return feature edge list. More...
 
label externalStart () const
 Start of external edges. More...
 
label internalStart () const
 Start of internal edges. More...
 
label nRegionEdges () const
 Return number of region edges. More...
 
label nExternalEdges () const
 Return number of external edges. More...
 
label nInternalEdges () const
 Return number of internal edges. More...
 
labelList selectFeatureEdges (const bool regionEdges, const bool externalEdges, const bool internalEdges) const
 Helper function: select a subset of featureEdges_. More...
 
void findFeatures (const scalar includedAngle, const bool geometricTestOnly)
 Find feature edges using provided included angle. More...
 
labelList trimFeatures (const scalar minLen, const label minElems, const scalar includedAngle)
 Delete small sets of edges. Edges are stringed up and any. More...
 
List< edgeStatustoStatus () const
 From member feature edges to status per edge. More...
 
void setFromStatus (const List< edgeStatus > &edgeStat, const scalar includedAngle)
 Set from status per edge. More...
 
Map< labelnearestSamples (const labelList &selectedPoints, const pointField &samples, const scalarField &maxDistSqr) const
 Find nearest sample for selected surface points. More...
 
Map< labelnearestSamples (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. More...
 
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. More...
 
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. More...
 
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. More...
 
void nearestFeatEdge (const edgeList &edges, const pointField &points, scalar searchSpanSqr, labelList &edgeLabel) const
 Find nearest feature edge to each surface edge. Uses the. More...
 
void writeDict (Ostream &) const
 Write as dictionary. More...
 
void write (const fileName &fName) const
 Write as dictionary to file. More...
 
void writeObj (const fileName &prefix) const
 Write to separate OBJ files (region, external, internal edges,. More...
 
void operator= (const surfaceFeatures &)
 

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 68 of file surfaceFeatures.H.

Member Enumeration Documentation

◆ edgeStatus

enum edgeStatus
Enumerator
NONE 
REGION 
EXTERNAL 
INTERNAL 

Definition at line 72 of file surfaceFeatures.H.

Constructor & Destructor Documentation

◆ surfaceFeatures() [1/7]

surfaceFeatures ( const triSurface surf)

Construct from surface.

Definition at line 447 of file surfaceFeatures.C.

Referenced by surfaceFeatures::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 459 of file surfaceFeatures.C.

References surfaceFeatures::surfaceFeatures().

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 477 of file surfaceFeatures.C.

References surfaceFeatures::findFeatures(), surfaceFeatures::surfaceFeatures(), and surfaceFeatures::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 501 of file surfaceFeatures.C.

References surfaceFeatures::surfaceFeatures().

Here is the call graph for this function:

◆ surfaceFeatures() [5/7]

surfaceFeatures ( const triSurface surf,
const fileName fName 
)

Construct from file.

Definition at line 515 of file surfaceFeatures.C.

References dictionary::lookup(), and surfaceFeatures::surfaceFeatures().

Here is the call graph for this function:

◆ surfaceFeatures() [6/7]

◆ surfaceFeatures() [7/7]

Copy constructor.

Definition at line 618 of file surfaceFeatures.C.

References surfaceFeatures::selectFeatureEdges().

Here is the call graph for this function:

Member Function Documentation

◆ ClassName()

ClassName ( "surfaceFeatures"  )

◆ surface()

const triSurface& surface ( ) const
inline

Definition at line 227 of file surfaceFeatures.H.

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

Here is the caller graph for this function:

◆ featurePoints()

const labelList& featurePoints ( ) const
inline

Return feature point list.

Definition at line 233 of file surfaceFeatures.H.

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

Here is the caller graph for this function:

◆ featureEdges()

const labelList& featureEdges ( ) const
inline

Return feature edge list.

Definition at line 239 of file surfaceFeatures.H.

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

Here is the caller graph for this function:

◆ externalStart()

label externalStart ( ) const
inline

Start of external edges.

Definition at line 245 of file surfaceFeatures.H.

Referenced by surfaceFeatures::operator=().

Here is the caller graph for this function:

◆ internalStart()

label internalStart ( ) const
inline

Start of internal edges.

Definition at line 251 of file surfaceFeatures.H.

Referenced by surfaceFeatures::operator=().

Here is the caller graph for this function:

◆ nRegionEdges()

label nRegionEdges ( ) const
inline

Return number of region edges.

Definition at line 257 of file surfaceFeatures.H.

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

Here is the caller graph for this function:

◆ nExternalEdges()

label nExternalEdges ( ) const
inline

Return number of external edges.

Definition at line 263 of file surfaceFeatures.H.

Referenced by surfaceFeatures::selectFeatureEdges().

Here is the caller graph for this function:

◆ nInternalEdges()

◆ selectFeatureEdges()

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

◆ findFeatures()

void findFeatures ( const scalar  includedAngle,
const bool  geometricTestOnly 
)

◆ 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 699 of file surfaceFeatures.C.

References PrimitivePatch< FaceList, PointField >::edges(), forAll, PrimitivePatch< FaceList, PointField >::localPoints(), edge::mag(), PrimitivePatch< FaceList, PointField >::nEdges(), surfaceFeatures::NONE, surfaceFeatures::setFromStatus(), List< T >::size(), and surfaceFeatures::toStatus().

Referenced by surfaceFeatures::findFeatures(), surfaceFeatures::nInternalEdges(), and surfaceFeatures::surfaceFeatures().

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

◆ toStatus()

From member feature edges to status per edge.

Definition at line 92 of file surfaceFeatures.C.

References surfaceFeatures::setFromStatus().

Referenced by surfaceFeatures::nInternalEdges(), and surfaceFeatures::trimFeatures().

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

◆ setFromStatus()

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

◆ 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 909 of file surfaceFeatures.C.

References Foam::abort(), indexedOctree< Type >::bb(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, forAll, forAllConstIter(), PointIndexHit< Point >::hit(), PointIndexHit< Point >::index(), PrimitivePatch< FaceList, PointField >::localPoints(), Foam::magSqr(), Foam::Pout, List< T >::size(), and Foam::meshTools::writeOBJ().

Referenced by surfaceFeatures::nInternalEdges(), and surfaceFeatures::writeObj().

Here is the call graph for this function:
Here is the caller 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 993 of file surfaceFeatures.C.

References Foam::e, PrimitivePatch< FaceList, PointField >::edges(), Foam::endl(), Foam::exit(), forAll, forAllConstIter(), edge::line(), PrimitivePatch< FaceList, PointField >::localPoints(), Foam::mag(), Foam::magSqr(), Foam::max(), line< Point, PointRef >::nearestDist(), surfaceFeatures::nearestEdges(), Foam::Pout, s(), List< T >::size(), edge::start(), edge::vec(), 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 1129 of file surfaceFeatures.C.

References edge::centre(), Foam::e, PrimitivePatch< FaceList, PointField >::edges(), Foam::endl(), Foam::exit(), forAll, forAllConstIter(), PrimitivePatch< FaceList, PointField >::localPoints(), Foam::mag(), Foam::magSqr(), Foam::max(), surfaceFeatures::nearestSurfEdge(), Foam::Pout, s(), indexedOctree< Type >::shapes(), List< T >::size(), edge::start(), edge::vec(), and Foam::meshTools::writeOBJ().

Referenced by surfaceFeatures::nearestSamples(), and surfaceFeatures::nInternalEdges().

Here is the call graph for this function:
Here is the caller 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 1280 of file surfaceFeatures.C.

References Foam::e, PrimitivePatch< FaceList, PointField >::edges(), edge::end(), forAll, PointIndexHit< Point >::hit(), PointIndexHit< Point >::index(), boundBox::inflate(), PrimitivePatch< FaceList, PointField >::localPoints(), PointIndexHit< Point >::rawPoint(), List< T >::setSize(), List< T >::size(), and edge::start().

Referenced by surfaceFeatures::nearestEdges(), and surfaceFeatures::nInternalEdges().

Here is the call graph for this function:
Here is the caller 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 1350 of file surfaceFeatures.C.

References line< Point, PointRef >::centre(), Foam::e, PrimitivePatch< FaceList, PointField >::edges(), forAll, PointIndexHit< Point >::hit(), PointIndexHit< Point >::hitPoint(), PointIndexHit< Point >::index(), edge::line(), PrimitivePatch< FaceList, PointField >::localPoints(), surfaceFeatures::nearestFeatEdge(), List< T >::setSize(), and List< T >::size().

Here is the call graph for this function:

◆ nearestFeatEdge()

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

◆ writeDict()

void writeDict ( Ostream writeFile) const

Write as dictionary.

Definition at line 832 of file surfaceFeatures.C.

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

Referenced by surfaceFeatures::nInternalEdges(), and surfaceFeatures::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 845 of file surfaceFeatures.C.

References surfaceFeatures::writeDict().

Referenced by surfaceFeatures::nInternalEdges().

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

◆ writeObj()

void writeObj ( const fileName prefix) const

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

feature points) for visualisation

Definition at line 853 of file surfaceFeatures.C.

References Foam::e, PrimitivePatch< FaceList, PointField >::edges(), Foam::endl(), forAll, PrimitivePatch< FaceList, PointField >::localPoints(), OFstream::name(), surfaceFeatures::nearestSamples(), Foam::Pout, List< T >::size(), and Foam::meshTools::writeOBJ().

Referenced by surfaceFeatures::nInternalEdges().

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

◆ operator=()

void operator= ( const surfaceFeatures rhs)

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