44 const label faceBasePtI
52 const point& tetBasePt = pPts[
f[faceBasePtI]];
54 scalar thisBaseMinTetQuality = vGreat;
56 for (
label tetPtI = 1; tetPtI <
f.size() - 1; tetPtI++)
58 label facePtI = (tetPtI + faceBasePtI) %
f.size();
59 label otherFacePtI =
f.fcIndex(facePtI);
67 ptBI =
f[otherFacePtI];
71 ptAI =
f[otherFacePtI];
75 const point& pA = pPts[ptAI];
76 const point& pB = pPts[ptBI];
80 scalar tetQuality = tet.
quality();
82 if (tetQuality < thisBaseMinTetQuality)
84 thisBaseMinTetQuality = tetQuality;
87 return thisBaseMinTetQuality;
106 label oCI = pOwner[fI];
108 const point& oCc = pC[oCI];
112 scalar minQ = minQuality(mesh, oCc, fI,
true, faceBasePtI);
113 minQ =
min(minQ, minQuality(mesh, nCc, fI,
false, faceBasePtI));
135 return findSharedBasePoint
160 label cI = pOwner[fI];
162 bool own = (pOwner[fI] == cI);
164 const point& cC = pC[cI];
168 scalar quality = minQuality(mesh, cC, fI, own, faceBasePtI);
199 for (
label fI = 0; fI < nInternalFaces; fI++)
201 tetBasePtIs[fI] = findSharedBasePoint(mesh, fI, tol, report);
206 for(
label facei = nInternalFaces; facei < mesh.
nFaces(); facei++)
208 neighbourCellCentres[facei - nInternalFaces] =
219 mesh.
nFaces() - nInternalFaces,
225 label fI = nInternalFaces, bFI = 0;
240 boundaryFaceTetBasePtIs[bFI] = findSharedBasePoint
244 neighbourCellCentres[bFI],
253 boundaryFaceTetBasePtIs[bFI] = -2;
258 boundaryFaceTetBasePtIs[bFI] = findBasePoint
274 boundaryFaceTetBasePtIs,
280 label fI = nInternalFaces, bFI = 0;
285 label& bFTetBasePtI = boundaryFaceTetBasePtIs[bFI];
287 if (bFTetBasePtI == -2)
290 <<
"Coupled face base point exchange failure for face "
295 if (bFTetBasePtI < 1)
334 bFTetBasePtI = mesh.
faces()[fI].
size() - bFTetBasePtI;
372 label nErrorTets = 0;
376 const face&
f = fcs[facei];
383 p[
f.nextLabel(fPtI)],
403 const face&
f = fcs[facei];
410 p[
f.nextLabel(fPtI)],
427 if (findSharedBasePoint(mesh, facei, tol, report) == -1)
466 if (findBasePoint(mesh, facei, tol, report) == -1)
485 Info<<
" ***Error in face tets: "
486 << nErrorTets <<
" faces with low quality or negative volume "
487 <<
"decomposition tets." <<
endl;
519 for (
label tetPtI = 1; tetPtI <
f.
size() - 1; tetPtI ++)
521 faceTets[tetPtI - 1] =
tetIndices(cI, fI, tetPtI);
537 const cell& thisCell = pCells[cI];
543 nTets +=
pFaces[thisCell[cFI]].size() - 2;
550 label fI = thisCell[cFI];
552 cellTets.
append(faceTetIndices(mesh, fI, cI));
569 const cell& thisCell = pCells[cI];
576 label fI = thisCell[cFI];
579 for (
label tetPtI = 1; tetPtI <
f.
size() - 1; tetPtI++)
587 tetContainingPt = faceTetIs;
592 if (tetContainingPt.
cell() != -1)
598 return tetContainingPt;
#define forAll(list, i)
Loop across all elements in list.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
bool insert(const Key &key)
Insert a new entry.
void size(const label)
Override size to be inconsistent with allocated storage.
A List obtained as a section of another List.
A cell is defined as a list of faces with extra functionality.
The coupledPolyPatch is an abstract base class for patches that couple regions of the computational d...
virtual bool owner() const =0
Does this side own the patch ?
A face is a list of labels corresponding to mesh vertices.
const labelList & patchIndices() const
Boundary face patch indices.
static List< tetIndices > cellTetIndices(const polyMesh &mesh, label cI)
Return the tet decomposition of the given cell, see.
static label findSharedBasePoint(const polyMesh &mesh, label fI, const point &nCc, scalar tol, bool report=false)
Find the first suitable base point to use for a minimum.
static labelList findFaceBasePts(const polyMesh &mesh, scalar tol=minTetQuality, bool report=false)
Find a suitable base point for each face for decomposition.
static tetIndices findTet(const polyMesh &mesh, label cI, const point &pt)
Find the tet decomposition of the cell containing the given point.
static const scalar minTetQuality
Minimum tetrahedron quality.
static bool checkFaceTets(const polyMesh &mesh, scalar tol=minTetQuality, const bool report=false, labelHashSet *setPtr=nullptr)
Check face-decomposition tet volume.
static label findBasePoint(const polyMesh &mesh, label fI, scalar tol, bool report=false)
Find the base point to use for a minimum triangle.
static List< tetIndices > faceTetIndices(const polyMesh &mesh, label fI, label cI)
Return the tet decomposition of the given face, with.
static scalar minQuality(const polyMesh &mesh, const point &cC, const label fI, const bool isOwner, const label faceBasePtI)
Given a face and cc and starting index for triangulation determine.
Mesh consisting of general polyhedral cells.
virtual const faceList & faces() const
Return raw faces.
virtual const labelList & faceOwner() const
Return face owner.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
virtual const labelList & faceNeighbour() const
Return face neighbour.
virtual const pointField & points() const
Return raw points.
const vectorField & faceCentres() const
const vectorField & cellCentres() const
label nInternalFaces() const
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
const cellList & cells() const
Storage and named access for the indices of a tet which is part of the decomposition of a cell.
label cell() const
Return the cell.
tetPointRef tet(const polyMesh &mesh) const
Return the geometry corresponding to this tet.
bool inside(const point &pt) const
Return true if point is inside tetrahedron.
scalar quality() const
Return quality: Ratio of tetrahedron and circum-sphere.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const fvPatchList & patches
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
tetrahedron< point, const point & > tetPointRef
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=*(cellModeller::lookup("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, &mergedCyclicPolyPatch::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]