Go to the documentation of this file.
54 void Foam::topoCellLooper::subsetList
70 lst.setCapacity(freeI);
76 for (label elemI = startI; elemI < freeI; elemI++)
78 lst[newI++] = lst[elemI];
81 if ((freeI - startI) < 0)
87 lst.setCapacity(freeI - startI);
133 void Foam::topoCellLooper::walkFace
135 const cellFeatures& features,
137 const label startEdgeI,
138 const label startVertI,
139 const label nFeaturePts,
159 if (features.isFeatureVertex(facei, vertI))
169 edgeI = getFirstVertEdge(facei, vertI);
179 if (nVisited == nFeaturePts)
184 vertI =
mesh().
edges()[edgeI].otherVertex(vertI);
186 if (features.isFeatureVertex(facei, vertI))
200 const cellFeatures& features,
202 const label startEdgeI,
203 const label startVertI
209 label superVertI = 0;
212 label edgeI = startEdgeI;
214 label vertI = startVertI;
216 superVerts[superVertI++] = vertI;
218 label prevEdgeI = -1;
222 vertI =
mesh().
edges()[edgeI].otherVertex(vertI);
224 superVerts[superVertI++] = vertI;
230 while (!features.isFeaturePoint(prevEdgeI, edgeI));
232 superVerts.setSize(superVertI);
240 Foam::label Foam::topoCellLooper::getAlignedNonFeatureEdge
244 const cellFeatures& features
252 scalar maxCos = -GREAT;
256 label edgeI = cEdges[cEdgeI];
258 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;
411 && (startLoop = loop.find(vertToEVert(vertI))) != -1
415 label firstFree = loop.size();
418 subsetList(startLoop, firstFree, loopWeights);
425 && (startLoop = loop.find(edgeToEVert(edgeI))) != -1
429 label firstFree = loop.size();
432 subsetList(startLoop, firstFree, loopWeights);
447 loop.append(edgeToEVert(edgeI));
448 loopWeights.append(0.5);
456 <<
" to face " << facei <<
" verts:"
460 label nextEdgeI = -1;
461 label nextVertI = -1;
483 loop.append(vertToEVert(vertI));
484 loopWeights.append(-GREAT);
490 labelList nextEdges = getVertEdgesNonFace
497 if (nextEdges.empty())
504 label thisFacei =
pFaces[pFacei];
519 Pout<<
" stepped from non-edge vertex " << vertI
520 <<
" to face " << facei <<
" verts:"
522 <<
" since candidate edges:" << nextEdges <<
endl;
525 label nextEdgeI = -1;
526 label nextVertI = -1;
543 else if (nextEdges.size() == 1)
546 edgeI = nextEdges[0];
550 Pout<<
" stepped from non-edge vertex " << vertI
551 <<
" along edge " << edgeI <<
" verts:"
553 <<
" out of candidate edges:"
554 << nextEdges <<
endl;
557 vertI =
mesh().
edges()[edgeI].otherVertex(vertI);
566 label index = nextEdges.size()/2;
568 edgeI = nextEdges[index];
572 Pout<<
" stepped from non-edge vertex " << vertI
573 <<
" along edge " << edgeI <<
" verts:"
575 <<
" out of candidate edges:" << nextEdges <<
endl;
578 vertI =
mesh().
edges()[edgeI].otherVertex(vertI);
594 if (nextFaces.size() == 1)
597 facei = nextFaces[0];
599 label nextEdgeI = -1;
600 label nextVertI = -1;
617 else if (nextFaces.size() == 2)
630 vertI =
mesh().
edges()[edgeI].otherVertex(vertI);
635 <<
"Choosing from more than "
636 <<
"two candidates:" << nextFaces
637 <<
" when coming from vertex " << vertI <<
" on cell "
645 Pout<<
"Walked to : face:" << facei;
650 Pout<<
" edge:" << edgeI;
706 getAlignedNonFeatureEdge
726 edgeI = getMisAlignedEdge(refDir, celli);
736 label nEstCuts = 2*
mesh().
cells()[celli].size();
753 if (localLoop.size() <=2)
760 loopWeights.transfer(localLoopWeights);
785 const plane& cutPlane,
int debug
Static debugging option.
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
List< label > labelList
A List of labels.
virtual const pointField & points() const
Return raw points.
static const scalar featureCos
Cos of angle for feature recognition (of splitHexes)
const labelListList & pointFaces() const
const cellList & cells() const
Unit conversion functions.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
prefixOSstream Pout
An Ostream wrapper for parallel output to std::cout.
Mesh consisting of general polyhedral cells.
#define forAll(list, i)
Loop across all elements in list.
Geometric class that creates a 3D plane and can return the intersection point between a line and the ...
A cellMatcher for hex cells (cellModel::HEX).
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=cellModel::ref(cellModel::HEX);labelList hexLabels(8);label activeCells=0;labelList pointMap(nPoints);forAll(pointMap, i){ pointMap[i]=i;}for(label i=0;i< nPoints;i++){ if(f[i] > 0.0) { hexLabels[0]=i;hexLabels[1]=i1tab[i];hexLabels[2]=i3tab[i1tab[i]];hexLabels[3]=i3tab[i];hexLabels[4]=i8tab[i];hexLabels[5]=i1tab[i8tab[i]];hexLabels[6]=i3tab[i1tab[i8tab[i]]];hexLabels[7]=i3tab[i8tab[i]];cellShapes[activeCells]=cellShape(hex, hexLabels);edgeList edges=cellShapes[activeCells].edges();forAll(edges, ei) { if(edges[ei].mag(points)< SMALL) { label start=pointMap[edges[ei].start()];while(start !=pointMap[start]) { start=pointMap[start];} label end=pointMap[edges[ei].end()];while(end !=pointMap[end]) { end=pointMap[end];} label minLabel=min(start, end);pointMap[start]=pointMap[end]=minLabel;} } cellZoning[activeCells]=idreg[i];activeCells++;}}cellShapes.setSize(activeCells);cellZoning.setSize(activeCells);forAll(cellShapes, celli){ cellShape &cs=cellShapes[celli];forAll(cs, i) { cs[i]=pointMap[cs[i]];} cs.collapse();}label bcIDs[11]={-1, 0, 2, 4, -1, 5, -1, 6, 7, 8, 9};const label nBCs=12;const word *kivaPatchTypes[nBCs]={ &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &symmetryPolyPatch::typeName, &wedgePolyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &symmetryPolyPatch::typeName, &oldCyclicPolyPatch::typeName};enum patchTypeNames{ PISTON, VALVE, LINER, CYLINDERHEAD, AXIS, WEDGE, INFLOW, OUTFLOW, PRESIN, PRESOUT, SYMMETRYPLANE, CYCLIC};const char *kivaPatchNames[nBCs]={ "piston", "valve", "liner", "cylinderHead", "axis", "wedge", "inflow", "outflow", "presin", "presout", "symmetryPlane", "cyclic"};List< SLList< face > > pFaces[nBCs]
const labelListList & cellEdges() const
const faceList & faces() const
void transfer(List< T > &list)
const labelListList & faceEdges() const
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.
Macros for easy insertion into run-time selection tables.
errorManip< error > abort(error &err)
Vector< scalar > vector
A scalar version of the templated Vector.
constexpr scalar degToRad(const scalar deg) noexcept
Conversion from degrees to radians.
VectorSpace< Form, Cmpt, Ncmpts > normalised(const VectorSpace< Form, Cmpt, Ncmpts > &vs)
const TargetType * isA(const Type &t)
Check if dynamic_cast to TargetType is possible.
const vectorField & cellCentres() const
virtual const faceList & faces() const
Return raw faces.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
const dimensionedScalar e
Elementary charge.
Various functions to operate on Lists.
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.
vector point
Point is a vector.
defineTypeNameAndDebug(combustionModel, 0)
Implementation of cellLooper.
dimensionedScalar cos(const dimensionedScalar &ds)
List< T > subsetList(const UList< T > &input, const UnaryPredicate &pred, const bool invert=false)
Copy a subset of the input list when predicate is true.