42 const labelList& featureEdges,
43 const labelList& regionFeatureEdges,
44 const labelList& featurePoints
47 const pointField& sFeatLocalPts(surf.localPoints());
48 const edgeList& sFeatEds(surf.edges());
50 const vectorField& faceNormals = surf.faceNormals();
59 label nFeatEds = featureEdges.size();
60 label nFeatPts = featurePoints.size();
62 DynamicList<point> tmpPts;
64 DynamicList<vector> norms;
72 forAll(featurePointFeatureEdges, pI)
74 featurePointFeatureEdges[pI] =
pointEdges[featurePoints[pI]];
80 labelList pointMap(sFeatLocalPts.size(), -1);
90 List<edgeStatus> edStatus(nFeatEds,
NONE);
94 label sFPI = featurePoints[i];
96 tmpPts.append(sFeatLocalPts[sFPI]);
98 pointMap[sFPI] = tmpPts.size() - 1;
104 bitSet isRegionFeatureEdge(regionFeatureEdges);
108 label sFEI = featureEdges[i];
112 const edge& fE = sFeatEds[sFEI];
117 if (pointMap[fE.start()] == -1)
119 tmpPts.append(sFeatLocalPts[fE.start()]);
121 pointMap[fE.start()] = tmpPts.size() - 1;
124 eds[i].start() = pointMap[fE.start()];
126 if (pointMap[fE.end()] == -1)
128 tmpPts.append(sFeatLocalPts[fE.end()]);
130 pointMap[fE.end()] = tmpPts.size() - 1;
133 eds[i].end() = pointMap[fE.end()];
136 const labelList& eFaces = edgeFaces[sFEI];
143 label eFI = eFaces[j];
148 norms.append(faceNormals[eFI]);
150 faceMap[eFI] = norms.size() - 1;
157 surf[eFI].centre(surf.points())
158 - sFeatLocalPts[fE.start()];
164 & (fC0tofE0/(
mag(fC0tofE0)+ VSMALL))
174 if (eFaces.size() == 2)
177 surf[eFaces[1]].centre(surf.points())
178 - surf[eFaces[0]].centre(surf.points());
183 if (isRegionFeatureEdge.test(i))
190 DynamicList<label> newFeatureEdges;
192 forAll(featurePointFeatureEdges, pI)
194 const labelList& fpfe = featurePointFeatureEdges[pI];
196 newFeatureEdges.setCapacity(fpfe.size());
200 const label oldEdgeIndex = fpfe[eI];
202 const label newFeatureEdgeIndex = edgeMap[oldEdgeIndex];
204 if (newFeatureEdgeIndex != -1)
206 newFeatureEdges.append(newFeatureEdgeIndex);
210 featurePointFeatureEdges[pI].
transfer(newFeatureEdges);
216 DynamicList<label>& externalEds(allEds[0]);
217 DynamicList<label>& internalEds(allEds[1]);
218 DynamicList<label>& flatEds(allEds[2]);
219 DynamicList<label>& openEds(allEds[3]);
220 DynamicList<label>& multipleEds(allEds[4]);
228 externalEds.append(i);
232 internalEds.append(i);
234 else if (eStat ==
FLAT)
238 else if (eStat ==
OPEN)
244 multipleEds.append(i);
246 else if (eStat ==
NONE)
249 <<
nl <<
"classifyEdge returned NONE on edge "
251 <<
". There is a problem with definition of this edge."
266 accessOp<labelList>()
270 edMap =
invert(edMap.size(), edMap);
279 forAll(featurePointFeatureEdges, pI)
301 List<DynamicList<label>> allPts(3);
303 DynamicList<label>& convexPts(allPts[0]);
304 DynamicList<label>& concavePts(allPts[1]);
305 DynamicList<label>& mixedPts(allPts[2]);
317 concavePts.append(i);
319 else if (ptStatus ==
MIXED)
326 <<
nl <<
"classifyFeaturePoint returned NONFEATURE on point at "
328 <<
". There is a problem with definition of this feature point."
341 accessOp<labelList>()
345 ftPtMap =
invert(ftPtMap.size(), ftPtMap);
354 ptMap[i] = ftPtMap[i];
378 DynamicList<label> tmpFtPtNorms;
388 if (!tmpFtPtNorms.found(ptEdNorms[
k]))
390 bool addNormal =
true;
410 tmpFtPtNorms.append(ptEdNorms[
k]);
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
const Vector< Cmpt > & centre(const Foam::UList< Vector< Cmpt > > &) const noexcept
Return this (for point which is a typedef to Vector<scalar>).
const labelListList & pointEdges() const
Return edges.
edgeMesh()
Default construct.
edgeMesh(const faMesh &mesh)
Construct finite-area edge mesh faMesh reference.
const pointField & points() const noexcept
Return points.
void transfer(edgeMesh &mesh)
Transfer the contents of the argument and annul the argument.
void operator=(const edgeMesh &rhs)
Copy assignment.
labelList regionEdges_
Feature edges which are on the boundary between regions.
const labelListList & normalDirections() const
labelListList edgeNormals_
Indices of the normals that are adjacent to the feature edges.
const vectorField & edgeDirections() const
Return the edgeDirection vectors.
void sortPointsAndEdges(const Patch &, const labelUList &featureEdges, const labelUList ®ionFeatureEdges, const labelUList &feaurePoints)
pointStatus classifyFeaturePoint(label ptI) const
Classify the type of feature point. Requires valid stored member.
label nonFeatureStart_
Index of the start of the non-feature points.
const labelList & regionEdges() const
Return the feature edges which are on the boundary between.
const labelListList & edgeNormals() const
Return the indices of the normals that are adjacent to the.
vectorField edgeDirections_
Flat and open edges require the direction of the edge.
label openStart_
Index of the start of the open feature edges.
labelListList featurePointEdges_
Indices of feature edges attached to feature points. The edges are.
label flatStart_
Index of the start of the flat feature edges.
@ NONFEATURE
Not a feature point.
@ MIXED
A point surrounded by both convex and concave edges.
@ CONCAVE
Fully concave point.
@ CONVEX
Fully convex point (w.r.t normals).
static edgeStatus classifyEdge(const List< vector > &norms, const labelList &edNorms, const vector &fC0tofC1)
Classify the type of feature edge. Requires face centre 0 to face.
@ FLAT
Neither concave or convex, on a flat surface.
@ OPEN
Only connected to a single face.
@ MULTIPLE
Multiply connected (connected to more than two faces).
@ NONE
Unclassified (consistency with surfaceFeatures).
label internalStart_
Index of the start of the internal feature edges.
vectorField normals_
Normals of the features, to be referred to by index by both feature.
static constexpr label nEdgeTypes
Number of possible feature edge types (i.e. number of slices).
label mixedStart_
Index of the start of the mixed type feature points.
labelListList normalDirections_
Starting directions for the edges.
const labelListList & featurePointNormals() const
Return the indices of the normals that are adjacent to the.
label multipleStart_
Index of the start of the multiply-connected feature edges.
labelListList featurePointNormals_
Indices of the normals that are adjacent to the feature points.
static scalar cosNormalAngleTol_
Angular closeness tolerance for treating normals as the same.
label concaveStart_
Index of the start of the concave feature points.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
AccessType combine(const UList< T > &lists, AccessOp aop=accessOp< T >())
Combines sub-lists into a single list.
List< edge > edgeList
List of edge.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
void inplaceRenumber(const labelUList &oldToNew, IntListType &input)
Inplace renumber the values within a list.
List< labelList > labelListList
List of labelList.
List< label > labelList
A List of labels.
void inplaceReorder(const labelUList &oldToNew, ListType &input, const bool prune=false)
Inplace reorder the elements of a list.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
errorManip< error > abort(error &err)
Field< vector > vectorField
Specialisation of Field<T> for vector.
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
labelList invert(const label len, const labelUList &map)
Create an inverse one-to-one mapping.
void cross(FieldField< Field1, typename crossProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
vectorField pointField
pointField is a vectorField.
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.
Unit conversion functions.