Holds feature edges/points of surface. More...
Data Structures | |
class | labelScalar |
Label and scalar; used in path walking. 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 &) | |
Construct as copy. More... | |
const triSurface & | surface () const |
const labelList & | featurePoints () const |
Return feature point list. More... | |
const labelList & | featureEdges () 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< edgeStatus > | toStatus () 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< label > | nearestSamples (const labelList &selectedPoints, const pointField &samples, const scalarField &maxDistSqr) const |
Find nearest sample for selected surface points. More... | |
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. More... | |
Map< 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. 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 &) |
Private Member Functions | |
void | calcFeatPoints (const List< edgeStatus > &edgeStat, const scalar minCos) |
Construct feature points where more than 2 feature edges meet. More... | |
void | classifyFeatureAngles (const labelListList &edgeFaces, List< edgeStatus > &edgeStat, const scalar minCos, const bool geometricTestOnly) const |
Classify the angles of the feature edges. More... | |
label | nextFeatEdge (const List< edgeStatus > &edgeStat, const labelList &featVisited, const label unsetVal, const label prevEdgeI, const label vertI) const |
Choose next unset feature edge. More... | |
labelScalar | walkSegment (const bool mark, const List< edgeStatus > &edgeStat, const label startEdgeI, const label startPointI, const label currentFeatI, labelList &featVisited) |
Walk connected feature edges. Marks edges in featVisited. More... | |
Static Private Member Functions | |
static pointIndexHit | edgeNearest (const point &start, const point &end, const point &sample) |
Return nearest point on edge (start..end). Also classify nearest: More... | |
Private Attributes | |
const triSurface & | surf_ |
Reference to surface. More... | |
labelList | featurePoints_ |
Labels of points that are features. More... | |
labelList | featureEdges_ |
Labels of edges that are features. More... | |
label | externalStart_ |
Start of external edges in featureEdges_. More... | |
label | internalStart_ |
Start of internal edges in featureEdges_. More... | |
Static Private Attributes | |
static const scalar | parallelTolerance = sin(degToRad(1.0)) |
Tolerance for determining whether two vectors are parallel. More... | |
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
Definition at line 68 of file surfaceFeatures.H.
enum edgeStatus |
Enumerator | |
---|---|
NONE | |
REGION | |
EXTERNAL | |
INTERNAL |
Definition at line 72 of file surfaceFeatures.H.
surfaceFeatures | ( | const triSurface & | surf | ) |
Construct from surface.
Definition at line 448 of file surfaceFeatures.C.
surfaceFeatures | ( | const triSurface & | surf, |
const labelList & | featurePoints, | ||
const labelList & | featureEdges, | ||
const label | externalStart, | ||
const label | internalStart | ||
) |
Construct from components.
Definition at line 460 of file surfaceFeatures.C.
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 478 of file surfaceFeatures.C.
surfaceFeatures | ( | const triSurface & | surf, |
const dictionary & | dict | ||
) |
Construct from dictionary.
Definition at line 503 of file surfaceFeatures.C.
surfaceFeatures | ( | const triSurface & | surf, |
const fileName & | fName | ||
) |
Construct from file.
Definition at line 518 of file surfaceFeatures.C.
References dictionary::lookup(), and Foam::readLabel().
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)
Definition at line 541 of file surfaceFeatures.C.
References DynamicList::append(), List::clear(), HashTable::clear(), HashTable::find(), forAll, HashTable::insert(), points, List::size(), HashTable::size(), and Foam::sqr().
surfaceFeatures | ( | const surfaceFeatures & | sf | ) |
Construct as copy.
Definition at line 622 of file surfaceFeatures.C.
|
staticprivate |
Return nearest point on edge (start..end). Also classify nearest:
Get nearest point on edge and classify position on edge.
index=-1: nearest on mid of edge. index=0:nearest on edge.start() index=1: nearest on edge.end().
Definition at line 52 of file surfaceFeatures.C.
References PointHit::hit(), Foam::mag(), and PointHit::rawPoint().
|
private |
Construct feature points where more than 2 feature edges meet.
Definition at line 185 of file surfaceFeatures.C.
References DynamicList::append(), forAll, and Foam::mag().
|
private |
Classify the angles of the feature edges.
Definition at line 242 of file surfaceFeatures.C.
References Vector< Cmpt >::centre(), forAll, Foam::mag(), points, and List::size().
|
private |
Choose next unset feature edge.
Definition at line 305 of file surfaceFeatures.C.
References forAll.
|
private |
Walk connected feature edges. Marks edges in featVisited.
Definition at line 353 of file surfaceFeatures.C.
References Foam::e, Foam::endl(), Foam::findIndex(), Foam::nl, and Foam::Warning.
ClassName | ( | "surfaceFeatures" | ) |
|
inline |
Definition at line 227 of file surfaceFeatures.H.
References surfaceFeatures::surf_.
Referenced by extendedEdgeMesh::extendedEdgeMesh(), and surfaceFeatures::operator=().
|
inline |
Return feature point list.
Definition at line 233 of file surfaceFeatures.H.
References surfaceFeatures::featurePoints_.
Referenced by extendedEdgeMesh::extendedEdgeMesh(), main(), and surfaceFeatures::operator=().
|
inline |
Return feature edge list.
Definition at line 239 of file surfaceFeatures.H.
References surfaceFeatures::featureEdges_.
Referenced by extendedEdgeMesh::extendedEdgeMesh(), main(), and surfaceFeatures::operator=().
|
inline |
Start of external edges.
Definition at line 245 of file surfaceFeatures.H.
References surfaceFeatures::externalStart_.
Referenced by surfaceFeatures::operator=().
|
inline |
Start of internal edges.
Definition at line 251 of file surfaceFeatures.H.
References surfaceFeatures::internalStart_.
Referenced by surfaceFeatures::operator=().
|
inline |
Return number of region edges.
Definition at line 257 of file surfaceFeatures.H.
References surfaceFeatures::externalStart_.
Referenced by extendedEdgeMesh::extendedEdgeMesh(), and main().
|
inline |
Return number of external edges.
Definition at line 263 of file surfaceFeatures.H.
References surfaceFeatures::externalStart_, and surfaceFeatures::internalStart_.
Referenced by main().
|
inline |
Return number of internal edges.
Definition at line 269 of file surfaceFeatures.H.
References surfaceFeatures::featureEdges_, surfaceFeatures::internalStart_, and List::size().
Referenced by main().
Foam::labelList selectFeatureEdges | ( | const bool | regionEdges, |
const bool | externalEdges, | ||
const bool | internalEdges | ||
) | const |
Helper function: select a subset of featureEdges_.
Definition at line 635 of file surfaceFeatures.C.
References DynamicList::append(), DynamicList::setCapacity(), and DynamicList::shrink().
void findFeatures | ( | const scalar | includedAngle, |
const bool | geometricTestOnly | ||
) |
Find feature edges using provided included angle.
Definition at line 678 of file surfaceFeatures.C.
References Foam::cos(), and Foam::degToRad().
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 703 of file surfaceFeatures.C.
References forAll, surfaceFeatures::labelScalar::len_, edge::mag(), surfaceFeatures::labelScalar::n_, and List::size().
Foam::List< Foam::surfaceFeatures::edgeStatus > toStatus | ( | ) | const |
From member feature edges to status per edge.
Definition at line 93 of file surfaceFeatures.C.
References surfaceFeatures::EXTERNAL, surfaceFeatures::externalStart_, surfaceFeatures::featureEdges_, surfaceFeatures::INTERNAL, surfaceFeatures::internalStart_, PrimitivePatch< Face, FaceList, PointField, PointType >::nEdges(), surfaceFeatures::NONE, surfaceFeatures::REGION, List::size(), and surfaceFeatures::surf_.
void setFromStatus | ( | const List< edgeStatus > & | edgeStat, |
const scalar | includedAngle | ||
) |
Set from status per edge.
Definition at line 122 of file surfaceFeatures.C.
References Foam::cos(), Foam::degToRad(), and forAll.
Referenced by main().
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 913 of file surfaceFeatures.C.
References Foam::abort(), indexedOctree::bb(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, indexedOctree::findNearest(), forAll, forAllConstIter(), PointIndexHit< Point >::hit(), PointIndexHit< Point >::index(), Foam::magSqr(), pointLabels(), Foam::Pout, samples(), List::size(), and Foam::meshTools::writeOBJ().
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 997 of file surfaceFeatures.C.
References Foam::e, Foam::endl(), Foam::exit(), indexedOctree::findNearest(), forAll, forAllConstIter(), PointIndexHit< Point >::hit(), PointIndexHit< Point >::hitPoint(), PointIndexHit< Point >::index(), Foam::mag(), Foam::magSqr(), Foam::max(), Foam::Pout, s(), samples(), List::size(), and Foam::meshTools::writeOBJ().
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 1133 of file surfaceFeatures.C.
References edge::centre(), Foam::e, Foam::endl(), Foam::exit(), indexedOctree::findNearest(), forAll, forAllConstIter(), PointIndexHit< Point >::hit(), PointIndexHit< Point >::hitPoint(), PointIndexHit< Point >::index(), Foam::mag(), Foam::magSqr(), Foam::max(), Foam::Pout, s(), indexedOctree::shapes(), List::size(), and Foam::meshTools::writeOBJ().
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:
Definition at line 1284 of file surfaceFeatures.C.
References Foam::e, indexedOctree::findNearest(), forAll, PointIndexHit< Point >::hit(), PointIndexHit< Point >::index(), boundBox::inflate(), PointIndexHit< Point >::rawPoint(), samples(), and List::setSize().
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:
Definition at line 1354 of file surfaceFeatures.C.
References line::centre(), Foam::e, indexedOctree::findNearest(), forAll, PointIndexHit< Point >::hit(), PointIndexHit< Point >::hitPoint(), PointIndexHit< Point >::index(), List::setSize(), and List::size().
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 1420 of file surfaceFeatures.C.
References edge::centre(), indexedOctree::findNearest(), forAll, PointIndexHit< Point >::hit(), Foam::identity(), PointIndexHit< Point >::index(), boundBox::inflate(), Foam::mag(), points, List::size(), edge::start(), and edge::vec().
void writeDict | ( | Ostream & | writeFile | ) | const |
Write as dictionary.
Definition at line 836 of file surfaceFeatures.C.
References dictionary::add(), and dictionary::write().
void write | ( | const fileName & | fName | ) | const |
Write as dictionary to file.
Definition at line 849 of file surfaceFeatures.C.
void writeObj | ( | const fileName & | prefix | ) | const |
Write to separate OBJ files (region, external, internal edges,.
feature points) for visualization
Definition at line 857 of file surfaceFeatures.C.
References Foam::e, Foam::endl(), forAll, OFstream::name(), Foam::Pout, and Foam::meshTools::writeOBJ().
void operator= | ( | const surfaceFeatures & | rhs | ) |
Definition at line 1482 of file surfaceFeatures.C.
References Foam::abort(), surfaceFeatures::externalStart(), Foam::FatalError, FatalErrorInFunction, surfaceFeatures::featureEdges(), surfaceFeatures::featurePoints(), surfaceFeatures::internalStart(), and surfaceFeatures::surface().
Tolerance for determining whether two vectors are parallel.
Definition at line 100 of file surfaceFeatures.H.
|
private |
Reference to surface.
Definition at line 106 of file surfaceFeatures.H.
Referenced by surfaceFeatures::surface(), and surfaceFeatures::toStatus().
|
private |
Labels of points that are features.
Definition at line 109 of file surfaceFeatures.H.
Referenced by surfaceFeatures::featurePoints().
|
private |
Labels of edges that are features.
Definition at line 112 of file surfaceFeatures.H.
Referenced by surfaceFeatures::featureEdges(), surfaceFeatures::nInternalEdges(), and surfaceFeatures::toStatus().
|
private |
Start of external edges in featureEdges_.
Definition at line 115 of file surfaceFeatures.H.
Referenced by surfaceFeatures::externalStart(), surfaceFeatures::nExternalEdges(), surfaceFeatures::nRegionEdges(), and surfaceFeatures::toStatus().
|
private |
Start of internal edges in featureEdges_.
Definition at line 118 of file surfaceFeatures.H.
Referenced by surfaceFeatures::internalStart(), surfaceFeatures::nExternalEdges(), surfaceFeatures::nInternalEdges(), and surfaceFeatures::toStatus().
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.