Go to the documentation of this file.
55 void Foam::topoCellLooper::subsetList
71 lst.setCapacity(freeI);
77 for (label elemI = startI; elemI < freeI; elemI++)
79 lst[newI++] = lst[elemI];
82 if ((freeI - startI) < 0)
88 lst.setCapacity(freeI - startI);
134 void Foam::topoCellLooper::walkFace
136 const cellFeatures& features,
138 const label startEdgeI,
139 const label startVertI,
140 const label nFeaturePts,
160 if (features.isFeatureVertex(facei, vertI))
170 edgeI = getFirstVertEdge(facei, vertI);
180 if (nVisited == nFeaturePts)
185 vertI =
mesh().
edges()[edgeI].otherVertex(vertI);
187 if (features.isFeatureVertex(facei, vertI))
201 const cellFeatures& features,
203 const label startEdgeI,
204 const label startVertI
210 label superVertI = 0;
213 label edgeI = startEdgeI;
215 label vertI = startVertI;
217 superVerts[superVertI++] = vertI;
219 label prevEdgeI = -1;
223 vertI =
mesh().
edges()[edgeI].otherVertex(vertI);
225 superVerts[superVertI++] = vertI;
231 while (!features.isFeaturePoint(prevEdgeI, edgeI));
233 superVerts.setSize(superVertI);
241 Foam::label Foam::topoCellLooper::getAlignedNonFeatureEdge
245 const cellFeatures& features
253 scalar maxCos = -GREAT;
257 label edgeI = cEdges[cEdgeI];
259 if (!features.isFeatureEdge(edgeI))
269 scalar cosAngle =
mag(refDir &
n);
271 if (cosAngle > maxCos)
287 void Foam::topoCellLooper::walkAcrossFace
289 const cellFeatures& features,
291 const label startEdgeI,
292 const label startVertI,
299 label oppositeVertI = -1;
300 label oppositeEdgeI = -1;
326 label sz = superEdge.size();
334 edgeI = oppositeEdgeI;
338 vertI = superEdge[1];
348 Pout<<
" Don't know what to do. Stepped to non-feature point "
349 <<
"at index " << index <<
" in superEdge:" << superEdge
353 vertI = superEdge[index];
373 void Foam::topoCellLooper::walkSplitHex
376 const cellFeatures& features,
377 const label fromFacei,
378 const label fromEdgeI,
379 const label fromVertI,
381 DynamicList<label>& loop,
382 DynamicList<scalar>& loopWeights
386 label facei = fromFacei;
387 label edgeI = fromEdgeI;
388 label vertI = fromVertI;
394 Pout<<
"Entering walk with : cell:" << celli <<
" face:" << facei;
399 Pout<<
" edge:" << edgeI;
407 label startLoop = -1;
412 && (startLoop = loop.find(vertToEVert(vertI))) != -1
416 label firstFree = loop.size();
419 subsetList(startLoop, firstFree, loopWeights);
426 && (startLoop = loop.find(edgeToEVert(edgeI))) != -1
430 label firstFree = loop.size();
433 subsetList(startLoop, firstFree, loopWeights);
448 loop.append(edgeToEVert(edgeI));
449 loopWeights.append(0.5);
457 <<
" to face " << facei <<
" verts:"
461 label nextEdgeI = -1;
462 label nextVertI = -1;
484 loop.append(vertToEVert(vertI));
485 loopWeights.append(-GREAT);
491 labelList nextEdges = getVertEdgesNonFace
498 if (nextEdges.empty())
505 label thisFacei =
pFaces[pFacei];
520 Pout<<
" stepped from non-edge vertex " << vertI
521 <<
" to face " << facei <<
" verts:"
523 <<
" since candidate edges:" << nextEdges <<
endl;
526 label nextEdgeI = -1;
527 label nextVertI = -1;
544 else if (nextEdges.size() == 1)
547 edgeI = nextEdges[0];
551 Pout<<
" stepped from non-edge vertex " << vertI
552 <<
" along edge " << edgeI <<
" verts:"
554 <<
" out of candidate edges:"
555 << nextEdges <<
endl;
558 vertI =
mesh().
edges()[edgeI].otherVertex(vertI);
567 label index = nextEdges.size()/2;
569 edgeI = nextEdges[index];
573 Pout<<
" stepped from non-edge vertex " << vertI
574 <<
" along edge " << edgeI <<
" verts:"
576 <<
" out of candidate edges:" << nextEdges <<
endl;
579 vertI =
mesh().
edges()[edgeI].otherVertex(vertI);
595 if (nextFaces.size() == 1)
598 facei = nextFaces[0];
600 label nextEdgeI = -1;
601 label nextVertI = -1;
618 else if (nextFaces.size() == 2)
631 vertI =
mesh().
edges()[edgeI].otherVertex(vertI);
636 <<
"Choosing from more than "
637 <<
"two candidates:" << nextFaces
638 <<
" when coming from vertex " << vertI <<
" on cell "
646 Pout<<
"Walked to : face:" << facei;
651 Pout<<
" edge:" << edgeI;
707 getAlignedNonFeatureEdge
727 edgeI = getMisAlignedEdge(refDir, celli);
737 label nEstCuts = 2*
mesh().
cells()[celli].size();
754 if (localLoop.size() <=2)
761 loopWeights.transfer(localLoopWeights);
786 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
static bool test(const UList< face > &faces)
Unit conversion functions.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
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 ...
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 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.
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].reset(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]
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.