Go to the documentation of this file.
54 label oCI = pOwner[fI];
56 const point& oCc = pC[oCI];
62 scalar thisBaseMinTetQuality = VGREAT;
64 const point& tetBasePt = pPts[
f[faceBasePtI]];
66 for (
label tetPtI = 1; tetPtI <
f.size() - 1; tetPtI++)
68 label facePtI = (tetPtI + faceBasePtI) %
f.size();
69 label otherFacePtI =
f.fcIndex(facePtI);
74 label ptBI =
f[otherFacePtI];
76 const point& pA = pPts[ptAI];
77 const point& pB = pPts[ptBI];
81 tetQualities[0] = tet.
quality();
86 label ptAI =
f[otherFacePtI];
89 const point& pA = pPts[ptAI];
90 const point& pB = pPts[ptBI];
94 tetQualities[1] = tet.
quality();
97 if (
min(tetQualities) < thisBaseMinTetQuality)
99 thisBaseMinTetQuality =
min(tetQualities);
103 if (thisBaseMinTetQuality > tol)
123 return findSharedBasePoint
127 mesh.cellCentres()[
mesh.faceNeighbour()[fI]],
149 label cI = pOwner[fI];
151 bool own = (pOwner[fI] == cI);
153 const point& cC = pC[cI];
157 scalar thisBaseMinTetQuality = VGREAT;
159 const point& tetBasePt = pPts[
f[faceBasePtI]];
161 for (
label tetPtI = 1; tetPtI <
f.size() - 1; tetPtI++)
163 label facePtI = (tetPtI + faceBasePtI) %
f.size();
164 label otherFacePtI =
f.fcIndex(facePtI);
172 ptBI =
f[otherFacePtI];
176 ptAI =
f[otherFacePtI];
180 const point& pA = pPts[ptAI];
181 const point& pB = pPts[ptBI];
185 scalar tetQuality = tet.
quality();
187 if (tetQuality < thisBaseMinTetQuality)
189 thisBaseMinTetQuality = tetQuality;
193 if (thisBaseMinTetQuality > tol)
220 label nInternalFaces =
mesh.nInternalFaces();
222 for (
label fI = 0; fI < nInternalFaces; fI++)
224 tetBasePtIs[fI] = findSharedBasePoint(
mesh, fI, tol, report);
229 for(
label faceI = nInternalFaces; faceI <
mesh.nFaces(); faceI++)
231 neighbourCellCentres[faceI - nInternalFaces] =
235 syncTools::swapBoundaryFacePositions(
mesh, neighbourCellCentres);
242 mesh.nFaces() - nInternalFaces,
248 label fI = nInternalFaces, bFI = 0;
254 mesh.boundaryMesh().patchID()[bFI];
259 refCast<const coupledPolyPatch>(
patches[patchI]);
263 boundaryFaceTetBasePtIs[bFI] = findSharedBasePoint
267 neighbourCellCentres[bFI],
276 boundaryFaceTetBasePtIs[bFI] = -2;
281 boundaryFaceTetBasePtIs[bFI] = findBasePoint
294 syncTools::syncBoundaryFaceList
297 boundaryFaceTetBasePtIs,
303 label fI = nInternalFaces, bFI = 0;
308 label& bFTetBasePtI = boundaryFaceTetBasePtIs[bFI];
310 if (bFTetBasePtI == -2)
313 <<
"Coupled face base point exchange failure for face "
318 if (bFTetBasePtI < 1)
326 label patchI =
mesh.boundaryMesh().patchID()[bFI];
331 refCast<const coupledPolyPatch>(
patches[patchI]);
357 bFTetBasePtI =
mesh.faces()[fI].size() - bFTetBasePtI;
384 for (
label faceI =
mesh.nInternalFaces(); faceI <
mesh.nFaces(); faceI++)
386 neiCc[faceI -
mesh.nInternalFaces()] = cc[own[faceI]];
389 syncTools::swapBoundaryFacePositions(
mesh, neiCc);
395 label nErrorTets = 0;
399 const face&
f = fcs[faceI];
406 p[
f.nextLabel(fPtI)],
423 if (
mesh.isInternalFace(faceI))
426 const face&
f = fcs[faceI];
433 p[
f.nextLabel(fPtI)],
450 if (findSharedBasePoint(
mesh, faceI, tol, report) == -1)
472 neiCc[faceI -
mesh.nInternalFaces()],
488 if (findBasePoint(
mesh, faceI, tol, report) == -1)
507 Info<<
" ***Error in face tets: "
508 << nErrorTets <<
" faces with low quality or negative volume "
509 <<
"decomposition tets." <<
endl;
533 static label nWarnings = 0;
534 static const label maxWarnings = 100;
541 label nTets =
f.size() - 2;
545 bool own = (pOwner[fI] == cI);
547 label tetBasePtI =
mesh.tetBasePtIs()[fI];
549 if (tetBasePtI == -1)
551 if (nWarnings < maxWarnings)
554 <<
"No base point for face " << fI <<
", " <<
f
555 <<
", produces a valid tet decomposition."
559 if (nWarnings == maxWarnings)
561 Warning<<
"Suppressing any further warnings." <<
endl;
568 for (
label tetPtI = 1; tetPtI <
f.size() - 1; tetPtI++)
572 label facePtI = (tetPtI + tetBasePtI) %
f.size();
573 label otherFacePtI =
f.fcIndex(facePtI);
575 faceTetIs.
cell() = cI;
577 faceTetIs.
face() = fI;
584 faceTetIs.
facePtB() = otherFacePtI;
588 faceTetIs.
facePtA() = otherFacePtI;
592 faceTetIs.
tetPt() = tetPtI;
607 static label nWarnings = 0;
608 static const label maxWarnings = 100;
611 bool own = (
mesh.faceOwner()[fI] == cI);
612 label tetBasePtI =
mesh.tetBasePtIs()[fI];
613 if (tetBasePtI == -1)
615 if (nWarnings < maxWarnings)
618 <<
"No base point for face " << fI <<
", " <<
f
619 <<
", produces a valid tet decomposition."
623 if (nWarnings == maxWarnings)
625 Warning<<
"Suppressing any further warnings." <<
endl;
634 label facePtI = (tetPtI + tetBasePtI) %
f.size();
635 label otherFacePtI =
f.fcIndex(facePtI);
637 faceTetIs.
cell() = cI;
639 faceTetIs.
face() = fI;
646 faceTetIs.
facePtB() = otherFacePtI;
650 faceTetIs.
facePtA() = otherFacePtI;
654 faceTetIs.
tetPt() = tetPtI;
669 const cell& thisCell = pCells[cI];
675 nTets +=
pFaces[thisCell[cFI]].size() - 2;
682 label fI = thisCell[cFI];
684 cellTets.
append(faceTetIndices(
mesh, fI, cI));
701 const cell& thisCell = pCells[cI];
708 label fI = thisCell[cFI];
711 for (
label tetPtI = 1; tetPtI <
f.size() - 1; tetPtI++)
728 tetContainingPt = faceTetIs;
733 if (tetContainingPt.
cell() != -1)
739 return tetContainingPt;
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 from the.
#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.
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 tetPt() const
Return the characterising tetPtI.
Mesh consisting of general polyhedral cells.
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, &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]
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.
label facePtB() const
Return face point B.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
static label findBasePoint(const polyMesh &mesh, label fI, scalar tol, bool report=false)
Find the base point to use for a minimum triangle.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
label face() const
Return the face.
scalar quality() const
Return quality: Ratio of tetrahedron and circum-sphere.
label faceBasePt() const
Return the face base point.
static tetIndices findTet(const polyMesh &mesh, label cI, const point &pt)
Find the tet decomposition of the cell containing the given point.
tetrahedron< point, const point & > tetPointRef
errorManip< error > abort(error &err)
label cell() const
Return the cell.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
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)
static tetIndices triangleTetIndices(const polyMesh &mesh, label fI, label cI, const label tetPtI)
Return the tet decomposition of the given triangle of the given face.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
bool insert(const Key &key)
Insert a new entry.
label facePtA() const
Return face point A.
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 bool checkFaceTets(const polyMesh &mesh, scalar tol=minTetQuality, const bool report=false, labelHashSet *setPtr=NULL)
Check face-decomposition tet volume.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
#define WarningInFunction
Report a warning using Foam::Warning.
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.