Go to the documentation of this file.
30 #include "PatchTools.H"
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);
91 label sFPI = featurePoints[i];
93 tmpPts.append(sFeatLocalPts[sFPI]);
95 pointMap[sFPI] = tmpPts.size() - 1;
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()];
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])
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)
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];
372 DynamicList<label> tmpFtPtNorms;
382 if (
findIndex(tmpFtPtNorms, ptEdNorms[
k]) == -1)
384 bool addNormal =
true;
404 tmpFtPtNorms.append(ptEdNorms[
k]);
vectorField pointField
pointField is a vectorField.
const labelListList & normalDirections() const
labelList regionEdges_
Feature edges which are on the boundary between regions.
const labelListList & featurePointNormals() const
Return the indices of the normals that are adjacent to the.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
List< label > labelList
A List of labels.
#define forAll(list, i)
Loop across all elements in list.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
label concaveStart_
Index of the start of the concave feature points.
edgeMesh()
Construct null.
const labelList & regionEdges() const
Return the feature edges which are on the boundary between.
Unit conversion functions.
label mixedStart_
Index of the start of the mixed type feature points.
dimensioned< scalar > mag(const dimensioned< Type > &)
Field< vector > vectorField
Specialisation of Field<T> for vector.
void inplaceRenumber(const labelUList &oldToNew, ListType &)
Inplace renumber the values of a list.
const vectorField & edgeDirections() const
Return the edgeDirection vectors.
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 inplaceReorder(const labelUList &oldToNew, ListType &)
Inplace reorder the elements of a 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.
void append(const T &)
Append an element at the end of the list.
vectorField edgeDirections_
Flat and open edges require the direction of the edge.
void operator=(const edgeMesh &)
const pointField & points() const
Return points.
const Vector< Cmpt > & centre(const Foam::List< Vector< Cmpt > > &) const
Return *this (used for point which is a typedef to Vector<scalar>.
label multipleStart_
Index of the start of the multiply-connected feature edges.
static scalar cosNormalAngleTol_
Angular closeness tolerance for treating normals as the same.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
const labelListList & pointEdges() const
Return edges.
const labelListList & edgeNormals() const
Return the indices of the normals that are adjacent to the.
labelListList edgeNormals_
Indices of the normals that are adjacent to the feature edges.
errorManip< error > abort(error &err)
Vector< scalar > vector
A scalar version of the templated Vector.
vectorField normals_
Normals of the features, to be referred to by index by both feature.
label internalStart_
Index of the start of the internal feature edges.
labelListList normalDirections_
Starting directions for the edges.
void setSize(const label)
Reset size of List.
List< labelList > labelListList
A List of labelList.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual void reset(const Xfer< pointField > &points, const Xfer< edgeList > &edges)
Reset primitive data (points, edges)
Xfer< T > xferMove(T &)
Construct by transferring the contents of the arg.
void sortPointsAndEdges(const Patch &, const labelList &featureEdges, const labelList ®ionFeatureEdges, const labelList &feaurePoints)
static label nEdgeTypes
Number of possible feature edge types (i.e. number of slices)
label k
Boltzmann constant.
pointStatus classifyFeaturePoint(label ptI) const
Classify the type of feature point. Requires valid stored member.
labelListList featurePointEdges_
Indices of feature edges attached to feature points. The edges are.
labelList invert(const label len, const labelUList &)
Invert one-to-one map. Unmapped elements will be -1.
label flatStart_
Index of the start of the flat feature edges.
label nonFeatureStart_
Index of the start of the non-feature points.
void cross(FieldField< Field1, typename crossProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
label openStart_
Index of the start of the open feature edges.
labelListList featurePointNormals_
Indices of the normals that are adjacent to the feature points.