44 const pointField& sFeatLocalPts(surf.localPoints());
45 const edgeList& sFeatEds(surf.edges());
46 const labelListList edgeFaces = PatchTools::sortedEdgeFaces(surf);
47 const vectorField& faceNormals = surf.faceNormals();
48 const labelListList pointEdges = PatchTools::sortedPointEdges(surf);
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;
99 nonFeatureStart_ = tmpPts.
size();
105 label sFEI = featureEdges[i];
109 const edge& fE = sFeatEds[sFEI];
111 edgeDirections[i] = fE.
vec(sFeatLocalPts);
114 if (pointMap[fE.
start()] == -1)
118 pointMap[fE.
start()] = tmpPts.
size() - 1;
121 eds[i].start() = pointMap[fE.
start()];
123 if (pointMap[fE.
end()] == -1)
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]);
150 edgeNormals[i][j] =
faceMap[eFI];
152 const vector cross = (faceNormals[eFI] ^ edgeDirections[i]);
154 surf[eFI].
centre(surf.points())
155 - sFeatLocalPts[fE.
start()];
157 normalDirections[i][j] =
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());
178 edStatus[i] = classifyEdge(norms, edgeNormals[i], fC0tofC1);
180 if (isRegionFeatureEdge[i])
189 forAll(featurePointFeatureEdges, pI)
191 const labelList& fpfe = featurePointFeatureEdges[pI];
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);
223 if (eStat == EXTERNAL)
227 else if (eStat == INTERNAL)
231 else if (eStat == FLAT)
235 else if (eStat == OPEN)
239 else if (eStat == MULTIPLE)
243 else if (eStat == NONE)
246 <<
nl <<
"classifyEdge returned NONE on edge " 248 <<
". There is a problem with definition of this edge." 253 internalStart_ = externalEds.
size();
254 flatStart_ = internalStart_ + internalEds.
size();
255 openStart_ = flatStart_ + flatEds.
size();
256 multipleStart_ = openStart_ + openEds.
size();
260 ListListOps::combine<labelList>
276 forAll(featurePointFeatureEdges, pI)
284 edgeMesh::operator=(
edgeMesh(pts, eds));
287 edgeDirections_ = edgeDirections/(
mag(edgeDirections) + vSmall);
288 edgeNormals_ = edgeNormals;
289 normalDirections_ = normalDirections;
290 regionEdges_ = regionEdges;
304 for (
label i = 0; i < nonFeatureStart_; i++)
308 if (ptStatus == CONVEX)
312 else if (ptStatus == CONCAVE)
316 else if (ptStatus == MIXED)
320 else if (ptStatus == NONFEATURE)
323 <<
nl <<
"classifyFeaturePoint returned NONFEATURE on point at " 325 <<
". There is a problem with definition of this feature point." 330 concaveStart_ = convexPts.
size();
331 mixedStart_ = concaveStart_ + concavePts.
size();
335 ListListOps::combine<labelList>
351 ptMap[i] = ftPtMap[i];
364 reset(move(pts), move(eds));
370 for (
label i = 0; i < nonFeatureStart_; i++)
374 const labelList& ptEds = edgeMesh::pointEdges()[i];
378 const labelList& ptEdNorms(edgeNormals[ptEds[j]]);
382 if (
findIndex(tmpFtPtNorms, ptEdNorms[
k]) == -1)
384 bool addNormal =
true;
391 (normals_[ptEdNorms[k]] & normals_[tmpFtPtNorms[q]])
404 tmpFtPtNorms.
append(ptEdNorms[k]);
410 featurePointNormals[i] = tmpFtPtNorms;
413 featurePointNormals_ = featurePointNormals;
414 featurePointEdges_ = featurePointFeatureEdges;
void inplaceReorder(const labelUList &oldToNew, ListType &)
Inplace reorder the elements of a list.
#define forAll(list, i)
Loop across all elements in list.
void inplaceRenumber(const labelUList &oldToNew, ListType &)
Inplace renumber the values of a list.
#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.
void size(const label)
Override size to be inconsistent with allocated storage.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
volVectorField vectorField(fieldObject, mesh)
void cross(FieldField< Field1, typename crossProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
label k
Boltzmann constant.
iterator end()
Return an iterator to end traversing the UList.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
const Vector< Cmpt > & centre(const Foam::List< Vector< Cmpt >> &) const
Return *this (used for point which is a typedef to Vector<scalar>.
labelList invert(const label len, const labelUList &)
Invert one-to-one map. Unmapped elements will be -1.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
void setCapacity(const label)
Alter the size of the underlying storage.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
errorManip< error > abort(error &err)
vector vec(const pointField &) const
Return the vector (end - start)
Points connected by edges.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
void setSize(const label)
Reset size of List.
label end() const
Return end vertex label.
dimensioned< scalar > mag(const dimensioned< Type > &)
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
label start() const
Return start vertex label.