43 const pointField& sFeatLocalPts(surf.localPoints());
44 const edgeList& sFeatEds(surf.edges());
46 const vectorField& faceNormals = surf.faceNormals();
55 label nFeatEds = featureEdges.size();
56 label nFeatPts = featurePoints.size();
58 DynamicList<point> tmpPts;
60 DynamicList<vector> norms;
68 forAll(featurePointFeatureEdges, pI)
70 featurePointFeatureEdges[pI] =
pointEdges[featurePoints[pI]];
76 labelList pointMap(sFeatLocalPts.size(), -1);
86 List<edgeStatus> edStatus(nFeatEds,
NONE);
90 label sFPI = featurePoints[i];
92 tmpPts.append(sFeatLocalPts[sFPI]);
94 pointMap[sFPI] = tmpPts.size() - 1;
100 PackedBoolList isRegionFeatureEdge(regionFeatureEdges);
104 label sFEI = featureEdges[i];
108 const edge& fE = sFeatEds[sFEI];
113 if (pointMap[fE.start()] == -1)
115 tmpPts.
append(sFeatLocalPts[fE.start()]);
117 pointMap[fE.start()] = tmpPts.size() - 1;
120 eds[i].start() = pointMap[fE.start()];
122 if (pointMap[fE.end()] == -1)
124 tmpPts.append(sFeatLocalPts[fE.end()]);
126 pointMap[fE.end()] = tmpPts.size() - 1;
129 eds[i].end() = pointMap[fE.end()];
132 const labelList& eFaces = edgeFaces[sFEI];
139 label eFI = eFaces[j];
144 norms.append(faceNormals[eFI]);
146 faceMap[eFI] = norms.size() - 1;
153 surf[eFI].
centre(surf.points())
154 - sFeatLocalPts[fE.start()];
160 & (fC0tofE0/(
mag(fC0tofE0)+ vSmall))
170 if (eFaces.size() == 2)
173 surf[eFaces[1]].centre(surf.points())
174 - surf[eFaces[0]].centre(surf.points());
179 if (isRegionFeatureEdge[i])
186 DynamicList<label> newFeatureEdges;
188 forAll(featurePointFeatureEdges, pI)
190 const labelList& fpfe = featurePointFeatureEdges[pI];
192 newFeatureEdges.setCapacity(fpfe.size());
196 const label oldEdgeIndex = fpfe[eI];
198 const label newFeatureEdgeIndex = edgeMap[oldEdgeIndex];
200 if (newFeatureEdgeIndex != -1)
202 newFeatureEdges.append(newFeatureEdgeIndex);
206 featurePointFeatureEdges[pI].transfer(newFeatureEdges);
212 DynamicList<label>& externalEds(allEds[0]);
213 DynamicList<label>& internalEds(allEds[1]);
214 DynamicList<label>& flatEds(allEds[2]);
215 DynamicList<label>& openEds(allEds[3]);
216 DynamicList<label>& multipleEds(allEds[4]);
224 externalEds.append(i);
228 internalEds.append(i);
230 else if (eStat ==
FLAT)
234 else if (eStat ==
OPEN)
240 multipleEds.append(i);
242 else if (eStat ==
NONE)
245 <<
nl <<
"classifyEdge returned NONE on edge "
247 <<
". There is a problem with definition of this edge."
259 ListListOps::combine<labelList>
262 accessOp<labelList>()
266 edMap =
invert(edMap.size(), edMap);
275 forAll(featurePointFeatureEdges, pI)
297 List<DynamicList<label>> allPts(3);
299 DynamicList<label>& convexPts(allPts[0]);
300 DynamicList<label>& concavePts(allPts[1]);
301 DynamicList<label>& mixedPts(allPts[2]);
313 concavePts.append(i);
315 else if (ptStatus ==
MIXED)
322 <<
nl <<
"classifyFeaturePoint returned NONFEATURE on point at "
324 <<
". There is a problem with definition of this feature point."
334 ListListOps::combine<labelList>
337 accessOp<labelList>()
341 ftPtMap =
invert(ftPtMap.size(), ftPtMap);
350 ptMap[i] = ftPtMap[i];
363 reset(move(pts), move(eds));
371 DynamicList<label> tmpFtPtNorms;
381 if (
findIndex(tmpFtPtNorms, ptEdNorms[
k]) == -1)
383 bool addNormal =
true;
403 tmpFtPtNorms.append(ptEdNorms[
k]);
#define forAll(list, i)
Loop across all elements in list.
void append(const T &)
Append an element at the end of the list.
void setSize(const label)
Reset size of List.
const Vector< Cmpt > & centre(const Foam::List< Vector< Cmpt >> &) const
Return *this (used for point which is a typedef to Vector<scalar>.
void operator=(const edgeMesh &)
const labelListList & pointEdges() const
Return edges.
virtual void reset(pointField &&points, edgeList &&edges)
Reset primitive data (points, edges)
edgeMesh()
Construct null.
const pointField & points() const
Return points.
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.
static label nEdgeTypes
Number of possible feature edge types (i.e. number of slices)
void sortPointsAndEdges(const Patch &, const labelList &featureEdges, const labelList ®ionFeatureEdges, const labelList &feaurePoints)
const vectorField & edgeDirections() const
Return the edgeDirection vectors.
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.
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.
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.
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.
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
labelList invert(const label len, const labelUList &)
Invert one-to-one map. Unmapped elements will be -1.
errorManip< error > abort(error &err)
vectorField pointField
pointField is a vectorField.
Vector< scalar > vector
A scalar version of the templated Vector.
List< labelList > labelListList
A List of labelList.
dimensioned< scalar > mag(const dimensioned< Type > &)
void inplaceRenumber(const labelUList &oldToNew, ListType &)
Inplace renumber the values of a list.
Field< vector > vectorField
Specialisation of Field<T> for vector.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
void cross(FieldField< Field1, typename crossProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
void inplaceReorder(const labelUList &oldToNew, ListType &)
Inplace reorder the elements of a list.