39 bool Foam::cellFeatures::faceAlignedEdge(
const label facei,
const label edgeI)
42 const edge& e = mesh_.
edges()[edgeI];
44 const face& f = mesh_.
faces()[facei];
48 if (f[fp] == e.start())
50 label fp1 = f.fcIndex(fp);
52 return f[fp1] == e.end();
57 <<
"Can not find edge " << mesh_.
edges()[edgeI]
68 const Map<label>& toSuperFace,
69 const label superFacei,
70 const label thisEdgeI,
78 label edgeI = pEdges[pEdgeI];
80 if ((edgeI != thisEdgeI) && featureEdge_.
found(edgeI))
88 label facei = eFaces[eFacei];
93 && (toSuperFace[facei] == superFacei)
103 <<
"Can not find edge in " << featureEdge_ <<
" connected to edge " 104 << thisEdgeI <<
" at vertex " << thisVertI <<
endl 105 <<
"This might mean that the externalEdges do not form a closed loop" 113 bool Foam::cellFeatures::isCellFeatureEdge
133 scalar cosAngle = n0 & n1;
136 const edge& e = mesh_.
edges()[edgeI];
138 const face& f0 = mesh_.
faces()[face0];
141 label face0End = f0.fcIndex(face0Start);
143 const face& f1 = mesh_.
faces()[face1];
146 label face1End = f1.fcIndex(face1Start);
151 (f0[face0End] == e.end())
152 && (f1[face1End] != e.end())
155 (f0[face0End] != e.end())
156 && (f1[face1End] == e.end())
163 cosAngle = -cosAngle;
166 if (cosAngle < minCos)
179 void Foam::cellFeatures::walkSuperFace
182 const label superFacei,
183 Map<label>& toSuperFace
186 if (!toSuperFace.found(facei))
188 toSuperFace.insert(facei, superFacei);
194 label edgeI = fEdges[fEdgeI];
196 if (!featureEdge_.
found(edgeI))
219 void Foam::cellFeatures::calcSuperFaces()
const 228 Map<label> toSuperFace(10*cFaces.size());
230 label superFacei = 0;
234 label facei = cFaces[cFacei];
236 if (!toSuperFace.found(facei))
250 faceMap_.setSize(superFacei);
254 label facei = cFaces[cFacei];
256 faceMap_[toSuperFace[facei]].append(facei);
261 faceMap_[superI].shrink();
267 facesPtr_ =
new faceList(superFacei);
273 label facei = cFaces[cFacei];
275 label superFacei = toSuperFace[facei];
277 if (faces[superFacei].empty())
282 label startEdgeI = -1;
288 label edgeI = fEdges[fEdgeI];
290 if (featureEdge_.
found(edgeI))
299 if (startEdgeI != -1)
303 DynamicList<label> superFace(10*mesh_.
faces()[facei].
size());
305 const edge& e = mesh_.
edges()[startEdgeI];
309 bool flipOrientation =
311 ^ (faceAlignedEdge(facei, startEdgeI));
313 label startVertI = -1;
317 startVertI = e.end();
321 startVertI = e.start();
324 label edgeI = startEdgeI;
326 label vertI = e.otherVertex(startVertI);
330 label newEdgeI = nextEdge
341 superFace.append(vertI);
346 if (vertI == startVertI)
351 vertI = mesh_.
edges()[edgeI].otherVertex(vertI);
355 if (superFace.size() <= 2)
358 <<
" Can not collapse faces " << faceMap_[superFacei]
359 <<
" into one big face on cell " << celli_ <<
endl 360 <<
"Try decreasing minCos:" << minCos_ <<
endl;
364 faces[superFacei].transfer(superFace);
393 label edgeI = cEdges[cEdgeI];
395 if (isCellFeatureEdge(minCos_, edgeI))
397 featureEdge_.
insert(edgeI);
420 || (edge0 >= mesh_.
nEdges())
422 || (edge1 >= mesh_.
nEdges())
426 <<
"Illegal edge labels : edge0:" << edge0 <<
" edge1:" << edge1
449 cosAngle = e0Vec & e1Vec;
458 cosAngle = - e0Vec & e1Vec;
465 <<
"Edges do not share common vertex. e0:" << e0
469 if (cosAngle < minCos_)
487 || (facei >= mesh_.
nFaces())
493 <<
"Illegal face " << facei <<
" or vertex " << vertI
504 label edgeI = pEdges[pEdgeI];
525 <<
"Did not find two edges sharing vertex " << vertI
526 <<
" on face " << facei <<
" vertices:" << mesh_.
faces()[facei]
const labelListList & cellEdges() const
#define forAll(list, i)
Loop across all elements in list.
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const labelListList & faceEdges() const
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const labelListList & pointEdges() const
Cell-face mesh analysis engine.
bool isFeatureVertex(const label facei, const label vertI) const
Is vertexI on facei used by two edges that form feature.
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual const pointField & points() const =0
Return mesh points.
const cellList & cells() const
Vector< scalar > vector
A scalar version of the templated Vector.
bool insert(const Key &key)
Insert a new entry.
Various functions to operate on Lists.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
bool found(const Key &) const
Return true if hashedEntry is found in table.
~cellFeatures()
Destructor.
List< label > labelList
A List of labels.
errorManip< error > abort(error &err)
bool isFeaturePoint(const label edge0, const label edge1) const
Are two edges connected at feature point?
vector vec(const pointField &) const
Return the vector (end - start)
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
cellFeatures(const primitiveMesh &, const scalar minCos, const label celli)
Construct from cell in mesh.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
Template functions to aid in the implementation of demand driven data.
#define WarningInFunction
Report a warning using Foam::Warning.
label end() const
Return end vertex label.
const vectorField & faceAreas() const
virtual const faceList & faces() const =0
Return faces.
virtual const labelList & faceOwner() const =0
Face face-owner addressing.
dimensioned< scalar > mag(const dimensioned< Type > &)
void deleteDemandDrivenData(DataPtr &dataPtr)
const labelListList & edgeFaces() const
label start() const
Return start vertex label.