44 const pointField& sFeatLocalPts(surf.localPoints());
45 const edgeList& sFeatEds(surf.edges());
47 const vectorField& faceNormals = surf.faceNormals();
56 label nFeatEds = featureEdges.size();
57 label nFeatPts = featurePoints.size();
59 DynamicList<point> tmpPts;
61 DynamicList<vector> norms;
69 forAll(featurePointFeatureEdges, pI)
71 featurePointFeatureEdges[pI] = pointEdges[featurePoints[pI]];
77 labelList pointMap(sFeatLocalPts.size(), -1);
87 List<edgeStatus> edStatus(nFeatEds,
NONE);
91 label sFPI = featurePoints[i];
93 tmpPts.append(sFeatLocalPts[sFPI]);
95 pointMap[sFPI] = tmpPts.size() - 1;
99 nonFeatureStart_ = tmpPts.size();
101 PackedBoolList isRegionFeatureEdge(regionFeatureEdges);
105 label sFEI = featureEdges[i];
109 const edge& fE = sFeatEds[sFEI];
114 if (pointMap[fE.start()] == -1)
116 tmpPts.
append(sFeatLocalPts[fE.start()]);
118 pointMap[fE.start()] = tmpPts.size() - 1;
121 eds[i].start() = pointMap[fE.start()];
123 if (pointMap[fE.end()] == -1)
125 tmpPts.append(sFeatLocalPts[fE.end()]);
127 pointMap[fE.end()] = tmpPts.size() - 1;
130 eds[i].end() = pointMap[fE.end()];
133 const labelList& eFaces = edgeFaces[sFEI];
140 label eFI = eFaces[j];
145 norms.append(faceNormals[eFI]);
147 faceMap[eFI] = norms.size() - 1;
154 surf[eFI].
centre(surf.points())
155 - sFeatLocalPts[fE.start()];
160 (cross/(
mag(cross) + vSmall))
161 & (fC0tofE0/(
mag(fC0tofE0)+ vSmall))
171 if (eFaces.size() == 2)
174 surf[eFaces[1]].centre(surf.points())
175 - surf[eFaces[0]].centre(surf.points());
180 if (isRegionFeatureEdge[i])
182 regionEdges.append(i);
187 DynamicList<label> newFeatureEdges;
189 forAll(featurePointFeatureEdges, pI)
191 const labelList& fpfe = featurePointFeatureEdges[pI];
193 newFeatureEdges.setCapacity(fpfe.size());
197 const label oldEdgeIndex = fpfe[eI];
199 const label newFeatureEdgeIndex = edgeMap[oldEdgeIndex];
201 if (newFeatureEdgeIndex != -1)
203 newFeatureEdges.append(newFeatureEdgeIndex);
207 featurePointFeatureEdges[pI].transfer(newFeatureEdges);
213 DynamicList<label>& externalEds(allEds[0]);
214 DynamicList<label>& internalEds(allEds[1]);
215 DynamicList<label>& flatEds(allEds[2]);
216 DynamicList<label>& openEds(allEds[3]);
217 DynamicList<label>& multipleEds(allEds[4]);
225 externalEds.append(i);
229 internalEds.append(i);
231 else if (eStat ==
FLAT)
235 else if (eStat ==
OPEN)
241 multipleEds.append(i);
243 else if (eStat ==
NONE)
246 <<
nl <<
"classifyEdge returned NONE on edge " 248 <<
". There is a problem with definition of this edge." 260 ListListOps::combine<labelList>
263 accessOp<labelList>()
267 edMap =
invert(edMap.size(), edMap);
276 forAll(featurePointFeatureEdges, pI)
298 List<DynamicList<label>> allPts(3);
300 DynamicList<label>& convexPts(allPts[0]);
301 DynamicList<label>& concavePts(allPts[1]);
302 DynamicList<label>& mixedPts(allPts[2]);
314 concavePts.append(i);
316 else if (ptStatus ==
MIXED)
323 <<
nl <<
"classifyFeaturePoint returned NONFEATURE on point at " 325 <<
". There is a problem with definition of this feature point." 335 ListListOps::combine<labelList>
338 accessOp<labelList>()
342 ftPtMap =
invert(ftPtMap.size(), ftPtMap);
351 ptMap[i] = ftPtMap[i];
364 reset(move(pts), move(eds));
372 DynamicList<label> tmpFtPtNorms;
382 if (
findIndex(tmpFtPtNorms, ptEdNorms[k]) == -1)
384 bool addNormal =
true;
404 tmpFtPtNorms.append(ptEdNorms[k]);
List< labelList > labelListList
A List of labelList.
const labelListList & featurePointNormals() const
Return the indices of the normals that are adjacent to the.
void inplaceReorder(const labelUList &oldToNew, ListType &)
Inplace reorder the elements of a list.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
vectorField normals_
Normals of the features, to be referred to by index by both feature.
void inplaceRenumber(const labelUList &oldToNew, ListType &)
Inplace renumber the values of a list.
const labelListList & edgeNormals() const
Return the indices of the normals that are adjacent to the.
const labelListList & normalDirections() const
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void sortPointsAndEdges(const Patch &, const labelList &featureEdges, const labelList ®ionFeatureEdges, const labelList &feaurePoints)
Unit conversion functions.
label mixedStart_
Index of the start of the mixed type feature points.
label openStart_
Index of the start of the open feature edges.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
label concaveStart_
Index of the start of the concave feature points.
Vector< scalar > vector
A scalar version of the templated Vector.
const labelList & regionEdges() const
Return the feature edges which are on the boundary between.
void operator=(const edgeMesh &)
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
edgeMesh()
Construct null.
const Vector< Cmpt > & centre(const Foam::List< Vector< Cmpt >> &) const
Return *this (used for point which is a typedef to Vector<scalar>.
label internalStart_
Index of the start of the internal feature edges.
labelListList normalDirections_
Starting directions for the edges.
const labelListList & pointEdges() const
Return edges.
vectorField pointField
pointField is a vectorField.
labelList invert(const label len, const labelUList &)
Invert one-to-one map. Unmapped elements will be -1.
labelList regionEdges_
Feature edges which are on the boundary between regions.
static label nEdgeTypes
Number of possible feature edge types (i.e. number of slices)
label flatStart_
Index of the start of the flat feature edges.
void append(const T &)
Append an element at the end of the list.
List< label > labelList
A List of labels.
errorManip< error > abort(error &err)
static scalar cosNormalAngleTol_
Angular closeness tolerance for treating normals as the same.
const pointField & points() const
Return points.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
virtual void reset(pointField &&points, edgeList &&edges)
Reset primitive data (points, edges)
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.
void setSize(const label)
Reset size of List.
const vectorField & edgeDirections() const
Return the edgeDirection vectors.
label multipleStart_
Index of the start of the multiply-connected feature edges.
labelListList featurePointEdges_
Indices of feature edges attached to feature points. The edges are.
dimensioned< scalar > mag(const dimensioned< Type > &)
Field< vector > vectorField
Specialisation of Field<T> for vector.
labelListList featurePointNormals_
Indices of the normals that are adjacent to the feature points.
labelListList edgeNormals_
Indices of the normals that are adjacent to the feature edges.
label nonFeatureStart_
Index of the start of the non-feature points.
vectorField edgeDirections_
Flat and open edges require the direction of the edge.
pointStatus classifyFeaturePoint(label ptI) const
Classify the type of feature point. Requires valid stored member.