53 void Foam::topoCellLooper::subsetList
69 lst.setCapacity(freeI);
75 for (
label elemI = startI; elemI < freeI; elemI++)
77 lst[newI++] = lst[elemI];
80 if ((freeI - startI) < 0)
86 lst.setCapacity(freeI - startI);
132 void Foam::topoCellLooper::walkFace
134 const cellFeatures& features,
136 const label startEdgeI,
137 const label startVertI,
138 const label nFeaturePts,
158 if (features.isFeatureVertex(facei, vertI))
168 edgeI = getFirstVertEdge(facei, vertI);
178 if (nVisited == nFeaturePts)
183 vertI =
mesh().
edges()[edgeI].otherVertex(vertI);
185 if (features.isFeatureVertex(facei, vertI))
199 const cellFeatures& features,
201 const label startEdgeI,
202 const label startVertI
208 label superVertI = 0;
211 label edgeI = startEdgeI;
213 label vertI = startVertI;
215 superVerts[superVertI++] = vertI;
217 label prevEdgeI = -1;
221 vertI =
mesh().
edges()[edgeI].otherVertex(vertI);
223 superVerts[superVertI++] = vertI;
229 while (!features.isFeaturePoint(prevEdgeI, edgeI));
231 superVerts.setSize(superVertI);
239 Foam::label Foam::topoCellLooper::getAlignedNonFeatureEdge
243 const cellFeatures& features
251 scalar maxCos = -great;
255 label edgeI = cEdges[cEdgeI];
257 if (!features.isFeatureEdge(edgeI))
268 scalar cosAngle =
mag(refDir & n);
270 if (cosAngle > maxCos)
286 void Foam::topoCellLooper::walkAcrossFace
288 const cellFeatures& features,
290 const label startEdgeI,
291 const label startVertI,
298 label oppositeVertI = -1;
299 label oppositeEdgeI = -1;
325 label sz = superEdge.size();
333 edgeI = oppositeEdgeI;
337 vertI = superEdge[1];
347 Pout<<
" Don't know what to do. Stepped to non-feature point " 348 <<
"at index " << index <<
" in superEdge:" << superEdge
352 vertI = superEdge[index];
372 void Foam::topoCellLooper::walkSplitHex
375 const cellFeatures& features,
376 const label fromFacei,
377 const label fromEdgeI,
378 const label fromVertI,
380 DynamicList<label>& loop,
381 DynamicList<scalar>& loopWeights
385 label facei = fromFacei;
386 label edgeI = fromEdgeI;
387 label vertI = fromVertI;
393 Pout<<
"Entering walk with : cell:" << celli <<
" face:" << facei;
398 Pout<<
" edge:" << edgeI;
406 label startLoop = -1;
424 label firstFree = loop.size();
426 subsetList(startLoop, firstFree, loop);
427 subsetList(startLoop, firstFree, loopWeights);
447 label firstFree = loop.size();
449 subsetList(startLoop, firstFree, loop);
450 subsetList(startLoop, firstFree, loopWeights);
465 loop.append(edgeToEVert(edgeI));
466 loopWeights.append(0.5);
474 <<
" to face " << facei <<
" verts:" 478 label nextEdgeI = -1;
479 label nextVertI = -1;
501 loop.append(vertToEVert(vertI));
502 loopWeights.append(-great);
508 labelList nextEdges = getVertEdgesNonFace
515 if (nextEdges.empty())
522 label thisFacei = pFaces[pFacei];
537 Pout<<
" stepped from non-edge vertex " << vertI
538 <<
" to face " << facei <<
" verts:" 540 <<
" since candidate edges:" << nextEdges <<
endl;
543 label nextEdgeI = -1;
544 label nextVertI = -1;
561 else if (nextEdges.size() == 1)
564 edgeI = nextEdges[0];
568 Pout<<
" stepped from non-edge vertex " << vertI
569 <<
" along edge " << edgeI <<
" verts:" 571 <<
" out of candidate edges:" 572 << nextEdges <<
endl;
575 vertI =
mesh().
edges()[edgeI].otherVertex(vertI);
584 label index = nextEdges.size()/2;
586 edgeI = nextEdges[index];
590 Pout<<
" stepped from non-edge vertex " << vertI
591 <<
" along edge " << edgeI <<
" verts:" 593 <<
" out of candidate edges:" << nextEdges <<
endl;
596 vertI =
mesh().
edges()[edgeI].otherVertex(vertI);
612 if (nextFaces.size() == 1)
615 facei = nextFaces[0];
617 label nextEdgeI = -1;
618 label nextVertI = -1;
635 else if (nextFaces.size() == 2)
648 vertI =
mesh().
edges()[edgeI].otherVertex(vertI);
653 <<
"Choosing from more than " 654 <<
"two candidates:" << nextFaces
655 <<
" when coming from vertex " << vertI <<
" on cell " 663 Pout<<
"Walked to : face:" << facei;
668 Pout<<
" edge:" << edgeI;
731 getAlignedNonFeatureEdge
778 if (localLoop.
size() <=2)
785 loopWeights.
transfer(localLoopWeights);
810 const plane& cutPlane,
bool isA(const Type &t)
Check if a dynamic_cast to typeid is possible.
const labelListList & cellEdges() const
#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.
virtual bool cut(const vector &refDir, const label celli, const boolList &vertIsCut, const boolList &edgeIsCut, const scalarField &edgeWeight, labelList &loop, scalarField &loopWeights) const
Create cut along circumference of celli. Gets current mesh cuts.
const labelListList & faceEdges() const
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Unit conversion functions.
virtual ~topoCellLooper()
Destructor.
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
topoCellLooper(const polyMesh &mesh)
Construct from components.
A cellMatcher for hex cells.
const cellList & cells() const
Vector< scalar > vector
A scalar version of the templated Vector.
Geometric class that creates a 2D plane and can return the intersection point between a line and the ...
const cellModel & hex_
Reference to hex cell shape.
Macros for easy insertion into run-time selection tables.
scalar degToRad(const scalar deg)
Conversion from degrees to radians.
Various functions to operate on Lists.
virtual const pointField & points() const
Return raw points.
label getMisAlignedEdge(const vector &refDir, const label celli) const
Return edge from cellEdges that is most perpendicular.
dimensionedScalar cos(const dimensionedScalar &ds)
const cellShapeList & cellShapes
static const scalar featureCos
Cos of angle for feature recognition (of splitHexes)
List< label > labelList
A List of labels.
virtual const faceList & faces() const
Return raw faces.
const vectorField & cellCentres() const
const faceList & faces() const
errorManip< error > abort(error &err)
const polyMesh & mesh() const
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
vector point
Point is a vector.
prefixOSstream Pout(cout, "Pout")
Implementation of cellLooper.
const labelListList & pointFaces() const
dimensioned< scalar > mag(const dimensioned< Type > &)
Mesh consisting of general polyhedral cells.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
virtual bool cut(const vector &refDir, const label celli, const boolList &vertIsCut, const boolList &edgeIsCut, const scalarField &edgeWeight, labelList &loop, scalarField &loopWeights) const
Create cut along circumference of celli. Gets current mesh cuts.