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;
665 Foam::topoCellLooper::topoCellLooper(
const polyMesh&
mesh)
702 cellFeatures superCell(
mesh(), featureCos, celli);
707 getAlignedNonFeatureEdge
727 edgeI = getMisAlignedEdge(refDir, celli);
739 DynamicList<label> localLoop(nEstCuts);
740 DynamicList<scalar> localLoopWeights(nEstCuts);
754 if (localLoop.size() <=2)
761 loopWeights.
transfer(localLoopWeights);
786 const plane& cutPlane,
const labelListList & cellEdges() const
void size(const label n)
Older name for setAddressableSize.
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.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
const labelListList & faceEdges() const
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Unit conversion functions.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const cellList & cells() const
static bool test(const UList< face > &faces)
Test if given list of faces satisfies criteria for HEX. (6 quad)
quaternion normalised(const quaternion &q)
Return the normalised (unit) quaternion of the given quaternion.
Macros for easy insertion into run-time selection tables.
Various functions to operate on Lists.
virtual const pointField & points() const
Return raw points.
#define forAll(list, i)
Loop across all elements in list.
const dimensionedScalar e
Elementary charge.
dimensionedScalar cos(const dimensionedScalar &ds)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
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.
static const scalar featureCos
Cos of angle for feature recognition (of splitHexes)
virtual const faceList & faces() const
Return raw faces.
const vectorField & cellCentres() const
errorManip< error > abort(error &err)
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
int debug
Static debugging option.
defineTypeNameAndDebug(combustionModel, 0)
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]
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
vector point
Point is a vector.
Implementation of cellLooper.
const labelListList & pointFaces() const
List< label > labelList
A List of labels.
constexpr scalar degToRad(const scalar deg) noexcept
Conversion from degrees to radians.
List< bool > boolList
A List of bools.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
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.
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)