Go to the documentation of this file.
47 const label faceBasePtI
55 const point& tetBasePt = pPts[
f[faceBasePtI]];
57 scalar thisBaseMinTetQuality = VGREAT;
59 for (label tetPtI = 1; tetPtI <
f.size() - 1; tetPtI++)
61 label facePtI = (tetPtI + faceBasePtI) %
f.size();
62 label otherFacePtI =
f.fcIndex(facePtI);
70 ptBI =
f[otherFacePtI];
74 ptAI =
f[otherFacePtI];
78 const point& pA = pPts[ptAI];
79 const point& pB = pPts[ptBI];
83 scalar tetQuality = tet.
quality();
85 if (tetQuality < thisBaseMinTetQuality)
87 thisBaseMinTetQuality = tetQuality;
90 return thisBaseMinTetQuality;
109 label oCI = pOwner[fI];
111 const point& oCc = pC[oCI];
115 scalar minQ = minQuality(
mesh, oCc, fI,
true, faceBasePtI);
116 minQ =
min(minQ, minQuality(
mesh, nCc, fI,
false, faceBasePtI));
138 return findSharedBasePoint
142 mesh.cellCentres()[
mesh.faceNeighbour()[fI]],
163 label cI = pOwner[fI];
165 bool own = (pOwner[fI] == cI);
167 const point& cC = pC[cI];
171 scalar quality = minQuality(
mesh, cC, fI, own, faceBasePtI);
200 label nInternalFaces =
mesh.nInternalFaces();
202 for (label fI = 0; fI < nInternalFaces; ++fI)
204 tetBasePtIs[fI] = findSharedBasePoint(
mesh, fI, tol, report);
209 for (label facei = nInternalFaces; facei <
mesh.nFaces(); ++facei)
211 neighbourCellCentres[facei - nInternalFaces] = pC[pOwner[facei]];
214 syncTools::swapBoundaryFacePositions(
mesh, neighbourCellCentres);
221 mesh.nFaces() - nInternalFaces,
227 label fI = nInternalFaces, bFI = 0;
232 label patchi =
mesh.boundaryMesh().patchID()[bFI];
237 refCast<const coupledPolyPatch>(
patches[patchi]);
241 boundaryFaceTetBasePtIs[bFI] = findSharedBasePoint
245 neighbourCellCentres[bFI],
254 boundaryFaceTetBasePtIs[bFI] = -2;
259 boundaryFaceTetBasePtIs[bFI] = findBasePoint
272 syncTools::syncBoundaryFaceList
275 boundaryFaceTetBasePtIs,
281 label fI = nInternalFaces, bFI = 0;
286 label& bFTetBasePtI = boundaryFaceTetBasePtIs[bFI];
288 if (bFTetBasePtI == -2)
291 <<
"Coupled face base point exchange failure for face "
292 << fI <<
" at " <<
mesh.faceCentres()[fI]
296 if (bFTetBasePtI < 1)
304 label patchi =
mesh.boundaryMesh().patchID()[bFI];
309 refCast<const coupledPolyPatch>(
patches[patchi]);
335 bFTetBasePtI =
mesh.faces()[fI].size() - bFTetBasePtI;
362 for (label facei =
mesh.nInternalFaces(); facei <
mesh.nFaces(); ++facei)
364 neiCc[facei -
mesh.nInternalFaces()] = cc[own[facei]];
367 syncTools::swapBoundaryFacePositions(
mesh, neiCc);
373 label nErrorTets = 0;
377 const face&
f = fcs[facei];
384 p[
f.nextLabel(fPtI)],
401 if (
mesh.isInternalFace(facei))
404 const face&
f = fcs[facei];
411 p[
f.nextLabel(fPtI)],
428 if (findSharedBasePoint(
mesh, facei, tol, report) == -1)
440 label patchi =
patches.patchID()[facei -
mesh.nInternalFaces()];
450 neiCc[facei -
mesh.nInternalFaces()],
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;
513 label nTets =
f.size() - 2;
517 for (label tetPti = 1; tetPti <
f.size() - 1; ++tetPti)
519 faceTets[tetPti - 1] =
tetIndices(celli, facei, tetPti);
535 const cell& thisCell = pCells[celli];
539 for (
const label facei : thisCell)
541 nTets +=
pFaces[facei].size() - 2;
546 for (
const label facei : thisCell)
548 cellTets.
append(faceTetIndices(
mesh, facei, celli));
565 const cell& thisCell = pCells[celli];
570 for (
const label facei : thisCell)
574 for (label tetPti = 1; tetPti <
f.size() - 1; ++tetPti)
582 tetContainingPt = faceTetIs;
587 if (tetContainingPt.
cell() != -1)
593 return tetContainingPt;
static bool checkFaceTets(const polyMesh &mesh, scalar tol=minTetQuality, const bool report=false, labelHashSet *setPtr=nullptr)
Check face-decomposition tet volume.
bool inside(const point &pt) const
Return true if point is inside tetrahedron.
static const scalar minTetQuality
Minimum tetrahedron quality.
tetPointRef tet(const polyMesh &mesh) const
Return the geometry corresponding to this tet.
label cell() const
Return the cell.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
static labelList findFaceBasePts(const polyMesh &mesh, scalar tol=minTetQuality, bool report=false)
Find a suitable base point for each face for decomposition.
A List obtained as a section of another List.
Ostream & endl(Ostream &os)
Add newline and flush stream.
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 ?
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Mesh consisting of general polyhedral cells.
tetrahedron< point, const point & > tetPointRef
A tetrahedron using referred points.
#define forAll(list, i)
Loop across all elements in list.
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 label findBasePoint(const polyMesh &mesh, label fI, scalar tol, bool report=false)
Find the base point to use for a minimum triangle.
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]
messageStream Info
Information stream (uses stdout - output is on the master only)
DynamicList< T, SizeMin > & append(const T &val)
Append an element to the end of this list.
scalar quality() const
Return quality: Ratio of tetrahedron and circum-sphere.
reduce(hasMovingMesh, orOp< bool >())
static tetIndices findTet(const polyMesh &mesh, label cI, const point &pt)
Find the tet decomposition of the cell containing the given point.
errorManip< error > abort(error &err)
Storage and named access for the indices of a tet which is part of the decomposition of a cell.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
const polyBoundaryMesh & patches
static List< tetIndices > cellTetIndices(const polyMesh &mesh, label cI)
Return the tet decomposition of the given cell, see.
A face is a list of labels corresponding to mesh vertices.
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.
A cell is defined as a list of faces with extra functionality.
static List< tetIndices > faceTetIndices(const polyMesh &mesh, label fI, label cI)
Return the tet decomposition of the given face, with.