76void Foam::polyMeshGeometry::updateFaceCentresAndAreas
79 const labelList& changedFaces
84 for (
const label facei : changedFaces)
86 const face&
f = fcs[facei];
94 faceCentres_[facei] = tri.centre();
95 faceAreas_[facei] = tri.areaNormal();
112 solveVector n = (nextPoint - thisPoint)^(fCentre - thisPoint);
113 solveScalar a =
mag(
n);
120 if (sumA < ROOTVSMALL)
122 faceCentres_[facei] = fCentre;
123 faceAreas_[facei] =
Zero;
127 faceCentres_[facei] = (1.0/3.0)*sumAc/sumA;
128 faceAreas_[facei] = 0.5*sumN;
135void Foam::polyMeshGeometry::updateCellCentresAndVols
150 for (
const label celli : changedCells)
158 for (
const label facei : cFaces)
160 const point& fc = faceCentres_[facei];
164 cEst /= cFaces.size();
168 for (
const label facei : cFaces)
171 scalar pyr3Vol = faceAreas_[facei] & (faceCentres_[facei] - cEst);
173 if (own[facei] != celli)
179 cellVolumes_[celli] += pyr3Vol;
182 const vector pCtr = (3.0/4.0)*faceCentres_[facei] + (1.0/4.0)*cEst;
185 cellCentres_[celli] += pyr3Vol*pCtr;
190 if (
mag(cellVolumes_[celli]) > VSMALL)
192 point cc = cellCentres_[celli] / cellVolumes_[celli];
199 cellCentres_[celli] = cc;
203 cellCentres_[celli] = cEst;
208 cellCentres_[celli] = cEst;
211 cellVolumes_[celli] *= (1.0/3.0);
227 for (
const label facei : changedFaces)
229 affectedCells.insert(own[facei]);
233 affectedCells.insert(nei[facei]);
236 return affectedCells.toc();
240Foam::scalar Foam::polyMeshGeometry::checkNonOrtho
244 const scalar severeNonorthogonalityThreshold,
249 label& severeNonOrth,
254 scalar dDotS = (d &
s)/(
mag(d)*
mag(
s) + VSMALL);
256 if (dDotS < severeNonorthogonalityThreshold)
270 Pout<<
"Severe non-orthogonality for face " << facei
286 <<
"Severe non-orthogonality detected for face "
300 setPtr->insert(facei);
308bool Foam::polyMeshGeometry::checkFaceTet
312 const scalar minTetQuality,
333 if (tetQual < minTetQuality)
337 Pout<<
"bool polyMeshGeometry::checkFaceTets("
338 <<
"const bool, const scalar, const pointField&"
339 <<
", const pointField&"
340 <<
", const labelList&, labelHashSet*) : "
342 <<
" has a triangle that points the wrong way." <<
nl
343 <<
"Tet quality: " << tetQual
349 setPtr->insert(facei);
373 faceAreas_ = mesh_.faceAreas();
374 faceCentres_ = mesh_.faceCentres();
375 cellCentres_ = mesh_.cellCentres();
376 cellVolumes_ = mesh_.cellVolumes();
387 updateFaceCentresAndAreas(
p, changedFaces);
389 updateCellCentresAndVols(
affectedCells(mesh_, changedFaces), changedFaces);
396 const scalar orthWarn,
413 const scalar severeNonorthogonalityThreshold =
::cos(
degToRad(orthWarn));
418 for (label facei =
mesh.nInternalFaces(); facei <
mesh.nFaces(); ++facei)
420 neiCc[facei-
mesh.nInternalFaces()] = cellCentres[own[facei]];
425 scalar minDDotS = GREAT;
430 label severeNonOrth = 0;
432 label errorNonOrth = 0;
434 for (
const label facei : checkFaces)
436 const point& ownCc = cellCentres[own[facei]];
438 if (
mesh.isInternalFace(facei))
440 scalar dDotS = checkNonOrtho
444 severeNonorthogonalityThreshold,
447 cellCentres[nei[facei]] - ownCc,
454 if (dDotS < minDDotS)
468 scalar dDotS = checkNonOrtho
472 severeNonorthogonalityThreshold,
482 if (dDotS < minDDotS)
495 const label face0 = baffle.first();
496 const label face1 = baffle.second();
498 const point& ownCc = cellCentres[own[face0]];
500 scalar dDotS = checkNonOrtho
504 severeNonorthogonalityThreshold,
507 cellCentres[own[face1]] - ownCc,
514 if (dDotS < minDDotS)
532 if (report && minDDotS < severeNonorthogonalityThreshold)
534 Info<<
"Number of non-orthogonality errors: " << errorNonOrth
535 <<
". Number of severely non-orthogonal faces: "
536 << severeNonOrth <<
"." <<
endl;
544 Info<<
"Mesh non-orthogonality Max: "
551 if (errorNonOrth > 0)
556 <<
"Error in non-orthogonality detected" <<
endl;
574 const scalar minPyrVol,
575 const polyMesh&
mesh,
579 const List<labelPair>& baffles,
589 label nErrorPyrs = 0;
591 for (
const label facei : checkFaces)
597 cellCentres[own[facei]]
600 if (pyrVol > -minPyrVol)
606 Pout<<
"bool polyMeshGeometry::checkFacePyramids("
607 <<
"const bool, const scalar, const pointField&"
608 <<
", const labelList&, labelHashSet*): "
609 <<
"face " << facei <<
" points the wrong way. " <<
endl
610 <<
"Pyramid volume: " << -pyrVol
611 <<
" Face " <<
f[facei] <<
" area: " <<
f[facei].mag(
p)
612 <<
" Owner cell: " << own[facei] <<
endl
613 <<
"Owner cell vertex labels: "
614 <<
mesh.cells()[own[facei]].labels(
f)
619 setPtr->insert(facei);
629 if (pyrVol < minPyrVol)
635 Pout<<
"bool polyMeshGeometry::checkFacePyramids("
636 <<
"const bool, const scalar, const pointField&"
637 <<
", const labelList&, labelHashSet*): "
638 <<
"face " << facei <<
" points the wrong way. " <<
endl
639 <<
"Pyramid volume: " << -pyrVol
640 <<
" Face " <<
f[facei] <<
" area: " <<
f[facei].mag(
p)
641 <<
" Neighbour cell: " << nei[facei] <<
endl
642 <<
"Neighbour cell vertex labels: "
648 setPtr->insert(facei);
656 const label face0 = baffle.first();
657 const label face1 = baffle.second();
659 const point& ownCc = cellCentres[own[face0]];
668 if (pyrVolOwn > -minPyrVol)
674 Pout<<
"bool polyMeshGeometry::checkFacePyramids("
675 <<
"const bool, const scalar, const pointField&"
676 <<
", const labelList&, labelHashSet*): "
677 <<
"face " << face0 <<
" points the wrong way. " <<
endl
678 <<
"Pyramid volume: " << -pyrVolOwn
679 <<
" Face " <<
f[face0] <<
" area: " <<
f[face0].mag(
p)
680 <<
" Owner cell: " << own[face0] <<
endl
681 <<
"Owner cell vertex labels: "
687 setPtr->insert(face0);
695 if (pyrVolNbr < minPyrVol)
701 Pout<<
"bool polyMeshGeometry::checkFacePyramids("
702 <<
"const bool, const scalar, const pointField&"
703 <<
", const labelList&, labelHashSet*): "
704 <<
"face " << face0 <<
" points the wrong way. " <<
endl
705 <<
"Pyramid volume: " << -pyrVolNbr
706 <<
" Face " <<
f[face0] <<
" area: " <<
f[face0].mag(
p)
707 <<
" Neighbour cell: " << own[face1] <<
endl
708 <<
"Neighbour cell vertex labels: "
714 setPtr->insert(face0);
726 <<
"Error in face pyramids: faces pointing the wrong way."
745 const scalar minTetQuality,
746 const polyMesh&
mesh,
751 const List<labelPair>& baffles,
759 const polyBoundaryMesh&
patches =
mesh.boundaryMesh();
764 for (label facei =
mesh.nInternalFaces(); facei <
mesh.nFaces(); ++facei)
766 neiCc[facei -
mesh.nInternalFaces()] = cellCentres[own[facei]];
771 label nErrorTets = 0;
773 for (
const label facei : checkFaces)
777 bool tetError = checkFaceTet
784 cellCentres[own[facei]],
797 bool tetError = checkFaceTet
805 cellCentres[nei[facei]],
828 setPtr->insert(facei);
853 setPtr->insert(facei);
873 setPtr->insert(facei);
882 const label face0 = baffle.first();
883 const label face1 = baffle.second();
885 bool tetError = checkFaceTet
892 cellCentres[own[face0]],
903 tetError = checkFaceTet
911 cellCentres[own[face1]],
926 cellCentres[own[face1]],
935 setPtr->insert(face0);
947 <<
"Error in face decomposition: negative tets."
966 const scalar internalSkew,
967 const scalar boundarySkew,
968 const polyMesh&
mesh,
974 const List<labelPair>& baffles,
984 const polyBoundaryMesh&
patches =
mesh.boundaryMesh();
994 for (
const label facei : checkFaces)
996 if (
mesh.isInternalFace(facei))
1006 cellCentres[own[facei]],
1007 cellCentres[nei[facei]]
1013 if (skewness > internalSkew)
1019 Pout<<
"Severe skewness for face " << facei
1020 <<
" skewness = " << skewness <<
endl;
1024 setPtr->insert(facei);
1028 maxSkew =
max(maxSkew, skewness);
1040 cellCentres[own[facei]],
1047 if (skewness > internalSkew)
1053 Pout<<
"Severe skewness for coupled face " << facei
1054 <<
" skewness = " << skewness <<
endl;
1058 setPtr->insert(facei);
1062 maxSkew =
max(maxSkew, skewness);
1074 cellCentres[own[facei]]
1081 if (skewness > boundarySkew)
1087 Pout<<
"Severe skewness for boundary face " << facei
1088 <<
" skewness = " << skewness <<
endl;
1092 setPtr->insert(facei);
1096 maxSkew =
max(maxSkew, skewness);
1102 const label face0 = baffle.first();
1103 const label face1 = baffle.second();
1105 const point& ownCc = cellCentres[own[face0]];
1106 const point& neiCc = cellCentres[own[face1]];
1123 if (skewness > internalSkew)
1129 Pout<<
"Severe skewness for face " << face0
1130 <<
" skewness = " << skewness <<
endl;
1134 setPtr->insert(face0);
1138 maxSkew =
max(maxSkew, skewness);
1151 <<
" percent.\nThis may impair the quality of the result." <<
nl
1152 << nWarnSkew <<
" highly skew faces detected."
1161 Info<<
"Max skewness = " << 100*maxSkew
1162 <<
" percent. Face skewness OK.\n" <<
endl;
1172 const scalar warnWeight,
1173 const polyMesh&
mesh,
1178 const List<labelPair>& baffles,
1186 const polyBoundaryMesh&
patches =
mesh.boundaryMesh();
1191 for (label facei =
mesh.nInternalFaces(); facei <
mesh.nFaces(); ++facei)
1193 neiCc[facei-
mesh.nInternalFaces()] = cellCentres[own[facei]];
1198 scalar minWeight = GREAT;
1200 label nWarnWeight = 0;
1202 for (
const label facei : checkFaces)
1204 const point& fc = faceCentres[facei];
1205 const vector&
fa = faceAreas[facei];
1207 scalar dOwn =
mag(
fa & (fc-cellCentres[own[facei]]));
1211 scalar dNei =
mag(
fa & (cellCentres[nei[facei]]-fc));
1212 scalar weight =
min(dNei,dOwn)/(dNei+dOwn+VSMALL);
1214 if (weight < warnWeight)
1220 Pout<<
"Small weighting factor for face " << facei
1221 <<
" weight = " << weight <<
endl;
1225 setPtr->insert(facei);
1229 minWeight =
min(minWeight, weight);
1238 scalar weight =
min(dNei,dOwn)/(dNei+dOwn+VSMALL);
1240 if (weight < warnWeight)
1246 Pout<<
"Small weighting factor for face " << facei
1247 <<
" weight = " << weight <<
endl;
1251 setPtr->insert(facei);
1255 minWeight =
min(minWeight, weight);
1262 const label face0 = baffle.first();
1263 const label face1 = baffle.second();
1265 const point& ownCc = cellCentres[own[face0]];
1266 const point& fc = faceCentres[face0];
1267 const vector&
fa = faceAreas[face0];
1269 scalar dOwn =
mag(
fa & (fc-ownCc));
1270 scalar dNei =
mag(
fa & (cellCentres[own[face1]]-fc));
1271 scalar weight =
min(dNei,dOwn)/(dNei+dOwn+VSMALL);
1273 if (weight < warnWeight)
1279 Pout<<
"Small weighting factor for face " << face0
1280 <<
" weight = " << weight <<
endl;
1284 setPtr->insert(face0);
1288 minWeight =
min(minWeight, weight);
1294 if (minWeight < warnWeight)
1299 << minWeight <<
'.' <<
nl
1300 << nWarnWeight <<
" faces with small weights detected."
1309 Info<<
"Min weight = " << minWeight
1320 const scalar warnRatio,
1321 const polyMesh&
mesh,
1324 const List<labelPair>& baffles,
1332 const polyBoundaryMesh&
patches =
mesh.boundaryMesh();
1337 for (label facei =
mesh.nInternalFaces(); facei <
mesh.nFaces(); ++facei)
1339 neiVols[facei-
mesh.nInternalFaces()] = cellVolumes[own[facei]];
1344 scalar minRatio = GREAT;
1346 label nWarnRatio = 0;
1348 for (
const label facei : checkFaces)
1350 scalar ownVol =
mag(cellVolumes[own[facei]]);
1352 scalar neiVol = -GREAT;
1356 neiVol =
mag(cellVolumes[nei[facei]]);
1370 scalar ratio =
min(ownVol, neiVol) / (
max(ownVol, neiVol) + VSMALL);
1372 if (ratio < warnRatio)
1378 Pout<<
"Small ratio for face " << facei
1379 <<
" ratio = " << ratio <<
endl;
1383 setPtr->insert(facei);
1387 minRatio =
min(minRatio, ratio);
1393 const label face0 = baffle.first();
1394 const label face1 = baffle.second();
1396 scalar ownVol =
mag(cellVolumes[own[face0]]);
1398 scalar neiVol =
mag(cellVolumes[own[face1]]);
1402 scalar ratio =
min(ownVol, neiVol) / (
max(ownVol, neiVol) + VSMALL);
1404 if (ratio < warnRatio)
1410 Pout<<
"Small ratio for face " << face0
1411 <<
" ratio = " << ratio <<
endl;
1415 setPtr->insert(face0);
1419 minRatio =
min(minRatio, ratio);
1426 if (minRatio < warnRatio)
1431 << minRatio <<
'.' <<
nl
1432 << nWarnRatio <<
" faces with small ratios detected."
1441 Info<<
"Min ratio = " << minRatio
1442 <<
". Ratios OK.\n" <<
endl;
1456 const scalar maxDeg,
1464 if (maxDeg < -SMALL || maxDeg > 180+SMALL)
1467 <<
"maxDeg should be [0..180] but is now " << maxDeg
1475 scalar maxEdgeSin = 0.0;
1479 label errorFacei = -1;
1481 for (
const label facei : checkFaces)
1483 const face&
f = fcs[facei];
1489 scalar magEPrev =
mag(ePrev);
1490 ePrev /= magEPrev + VSMALL;
1495 vector e10(
p[
f.nextLabel(fp0)] -
p[
f.thisLabel(fp0)]);
1496 scalar magE10 =
mag(e10);
1497 e10 /= magE10 + VSMALL;
1499 if (magEPrev > SMALL && magE10 > SMALL)
1501 vector edgeNormal = ePrev ^ e10;
1502 scalar magEdgeNormal =
mag(edgeNormal);
1504 if (magEdgeNormal < maxSin)
1511 edgeNormal /= magEdgeNormal;
1513 if ((edgeNormal & faceNormal) < SMALL)
1515 if (facei != errorFacei)
1522 maxEdgeSin =
max(maxEdgeSin, magEdgeNormal);
1542 if (maxEdgeSin > SMALL)
1544 scalar maxConcaveDegr =
1547 Info<<
"There are " << nConcave
1548 <<
" faces with concave angles between consecutive"
1549 <<
" edges. Max concave angle = " << maxConcaveDegr
1550 <<
" degrees.\n" <<
endl;
1554 Info<<
"All angles in faces are convex or less than " << maxDeg
1555 <<
" degrees concave.\n" <<
endl;
1564 << nConcave <<
" face points with severe concave angle (> "
1565 << maxDeg <<
" deg) found.\n"
1581 const scalar minTwist,
1591 if (minTwist < -1-SMALL || minTwist > 1+SMALL)
1594 <<
"minTwist should be [-1..1] but is now " << minTwist
1605 const polyBoundaryMesh&
patches =
mesh.boundaryMesh();
1610 for (label facei =
mesh.nInternalFaces(); facei <
mesh.nFaces(); ++facei)
1612 neiCc[facei-
mesh.nInternalFaces()] = cellCentres[own[facei]];
1616 for (
const label facei : checkFaces)
1618 const face&
f = fcs[facei];
1629 cellCentres[nei[facei]]
1630 - cellCentres[own[facei]]
1639 - cellCentres[own[facei]]
1648 - cellCentres[own[facei]]
1654 const point& fc = faceCentres[facei];
1663 p[
f.nextLabel(fpI)],
1668 scalar magTri =
mag(triArea);
1670 if (magTri > VSMALL && ((nf & triArea/magTri) < minTwist))
1692 Info<<
"There are " << nWarped
1693 <<
" faces with cosine of the angle"
1694 <<
" between triangle normal and face normal less than "
1695 << minTwist <<
nl <<
endl;
1699 Info<<
"All faces are flat in that the cosine of the angle"
1700 <<
" between triangle normal and face normal less than "
1701 << minTwist <<
nl <<
endl;
1710 << nWarped <<
" faces with severe warpage "
1711 <<
"(cosine of the angle between triangle normal and "
1712 <<
"face normal < " << minTwist <<
") found.\n"
1727 const scalar minTwist,
1728 const polyMesh&
mesh,
1736 if (minTwist < -1-SMALL || minTwist > 1+SMALL)
1739 <<
"minTwist should be [-1..1] but is now " << minTwist
1747 for (
const label facei : checkFaces)
1749 const face&
f = fcs[facei];
1753 const point& fc = faceCentres[facei];
1768 scalar magTri =
mag(prevN);
1770 if (magTri > VSMALL)
1795 scalar magTri =
mag(triN);
1797 if (magTri > VSMALL)
1801 if ((prevN & triN) < minTwist)
1807 setPtr->insert(facei);
1815 else if (minTwist > 0)
1821 setPtr->insert(facei);
1827 while (fp != startFp);
1839 Info<<
"There are " << nWarped
1840 <<
" faces with cosine of the angle"
1841 <<
" between consecutive triangle normals less than "
1842 << minTwist <<
nl <<
endl;
1846 Info<<
"All faces are flat in that the cosine of the angle"
1847 <<
" between consecutive triangle normals is less than "
1848 << minTwist <<
nl <<
endl;
1857 << nWarped <<
" faces with severe warpage "
1858 <<
"(cosine of the angle between consecutive triangle normals"
1859 <<
" < " << minTwist <<
") found.\n"
1873 const scalar minFlatness,
1874 const polyMesh&
mesh,
1882 if (minFlatness < -SMALL || minFlatness > 1+SMALL)
1885 <<
"minFlatness should be [0..1] but is now " << minFlatness
1893 for (
const label facei : checkFaces)
1895 const face&
f = fcs[facei];
1899 const point& fc = faceCentres[facei];
1902 scalar sumArea = 0.0;
1914 if (sumArea/
mag(faceAreas[facei]) < minFlatness)
1919 setPtr->insert(facei);
1931 Info<<
"There are " << nWarped
1932 <<
" faces with area of individual triangles"
1933 <<
" compared to overall area less than "
1934 << minFlatness <<
nl <<
endl;
1938 Info<<
"All faces are flat in that the area of individual triangles"
1939 <<
" compared to overall area is less than "
1940 << minFlatness <<
nl <<
endl;
1949 << nWarped <<
" non-flat faces "
1950 <<
"(area of individual triangles"
1951 <<
" compared to overall area"
1952 <<
" < " << minFlatness <<
") found.\n"
1966 const scalar minArea,
1967 const polyMesh&
mesh,
1973 label nZeroArea = 0;
1975 for (
const label facei : checkFaces)
1977 if (
mag(faceAreas[facei]) < minArea)
1982 setPtr->insert(facei);
1994 Info<<
"There are " << nZeroArea
1995 <<
" faces with area < " << minArea <<
'.' <<
nl <<
endl;
1999 Info<<
"All faces have area > " << minArea <<
'.' <<
nl <<
endl;
2008 << nZeroArea <<
" faces with area < " << minArea
2023 const scalar warnDet,
2024 const polyMesh&
mesh,
2033 scalar minDet = GREAT;
2034 scalar sumDet = 0.0;
2038 for (
const label celli : affectedCells)
2040 const cell& cFaces =
cells[celli];
2043 scalar magAreaSum = 0;
2045 for (
const label facei : cFaces)
2047 scalar magArea =
mag(faceAreas[facei]);
2049 magAreaSum += magArea;
2050 areaSum += faceAreas[facei]*(faceAreas[facei]/(magArea+VSMALL));
2053 scalar scaledDet =
det(areaSum/(magAreaSum+VSMALL))/0.037037037037037;
2055 minDet =
min(minDet, scaledDet);
2056 sumDet += scaledDet;
2059 if (scaledDet < warnDet)
2064 setPtr->insert(cFaces);
2078 Info<<
"Cell determinant (1 = uniform cube) : average = "
2079 << sumDet / nSumDet <<
" min = " << minDet <<
endl;
2084 Info<<
"There are " << nWarnDet
2085 <<
" cells with determinant < " << warnDet <<
'.' <<
nl
2090 Info<<
"All faces have determinant > " << warnDet <<
'.' <<
nl
2100 << nWarnDet <<
" cells with determinant < " << warnDet
2115 const scalar minEdgeLength,
2116 const polyMesh&
mesh,
2121 const scalar reportLenSqr(
Foam::sqr(minEdgeLength));
2126 scalar minLenSqr =
sqr(GREAT);
2127 scalar maxLenSqr = -
sqr(GREAT);
2131 for (
const label facei : checkFaces)
2133 const face&
f = faces[facei];
2137 label fp1 =
f.fcIndex(fp);
2141 if (setPtr && magSqrE < reportLenSqr)
2143 if (setPtr->insert(
f[fp]) || setPtr->insert(
f[fp1]))
2149 minLenSqr =
min(minLenSqr, magSqrE);
2150 maxLenSqr =
max(maxLenSqr, magSqrE);
2163 Info<<
" *Edges too small, min/max edge length = "
2164 <<
sqrt(minLenSqr) <<
" " <<
sqrt(maxLenSqr)
2165 <<
", number too small: " << nSmall <<
endl;
2173 Info<<
" Min/max edge length = "
2184 const scalar orthWarn,
2186 const List<labelPair>& baffles,
2190 return checkFaceDotProduct
2207 const scalar minPyrVol,
2214 return checkFacePyramids
2231 const scalar minTetQuality,
2238 return checkFaceTets
2282 const scalar warnWeight,
2306 const scalar warnRatio,
2312 return checkVolRatio
2328 const scalar maxDeg,
2334 return checkFaceAngles
2350 const scalar minTwist,
2356 return checkFaceTwist
2374 const scalar minTwist,
2380 return checkTriangleTwist
2397 const scalar minFlatness,
2403 return checkFaceFlatness
2420 const scalar minArea,
2425 return checkFaceArea
2440 const scalar warnDet,
2446 return checkCellDeterminant
2462 const scalar minEdgeLength,
2467 return checkEdgeLength
constexpr scalar pi(M_PI)
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A List with indirect addressing. Like IndirectList but does not store addressing.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void size(const label n)
Older name for setAddressableSize.
label fcIndex(const label i) const noexcept
The forward circular index. The next index in the list which returns to the first at the end of the l...
A bounding box defined in terms of min/max extrema points.
A cell is defined as a list of faces with extra functionality.
A face is a list of labels corresponding to mesh vertices.
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
label whichPatch(const label meshFacei) const
Return patch index for a given mesh face index. Uses binary search.
Updateable mesh geometry and checking routines.
static bool checkFacePyramids(const bool report, const scalar minPyrVol, const polyMesh &, const vectorField &cellCentres, const pointField &p, const labelList &checkFaces, const List< labelPair > &baffles, labelHashSet *)
See primitiveMesh.
const scalarField & cellVolumes() const
static bool checkTriangleTwist(const bool report, const scalar minTwist, const polyMesh &, const vectorField &faceAreas, const vectorField &faceCentres, const pointField &p, const labelList &checkFaces, labelHashSet *setPtr)
Consecutive triangle (from face-centre decomposition) normals.
static bool checkFaceTwist(const bool report, const scalar minTwist, const polyMesh &, const vectorField &cellCentres, const vectorField &faceAreas, const vectorField &faceCentres, const pointField &p, const labelList &checkFaces, labelHashSet *setPtr)
Triangle (from face-centre decomposition) normal v.s.
polyMeshGeometry(const polyMesh &)
Construct from mesh.
static bool checkFaceSkewness(const bool report, const scalar internalSkew, const scalar boundarySkew, const polyMesh &mesh, const pointField &points, const vectorField &cellCentres, const vectorField &faceCentres, const vectorField &faceAreas, const labelList &checkFaces, const List< labelPair > &baffles, labelHashSet *setPtr)
See primitiveMesh.
const vectorField & faceAreas() const
const polyMesh & mesh() const
void correct()
Take over properties from mesh.
static bool checkFaceArea(const bool report, const scalar minArea, const polyMesh &, const vectorField &faceAreas, const labelList &checkFaces, labelHashSet *setPtr)
Small faces.
static bool checkFaceDotProduct(const bool report, const scalar orthWarn, const polyMesh &, const vectorField &cellCentres, const vectorField &faceAreas, const labelList &checkFaces, const List< labelPair > &baffles, labelHashSet *setPtr)
See primitiveMesh.
static bool checkFaceAngles(const bool report, const scalar maxDeg, const polyMesh &mesh, const vectorField &faceAreas, const pointField &p, const labelList &checkFaces, labelHashSet *setPtr)
See primitiveMesh.
static bool checkFaceWeights(const bool report, const scalar warnWeight, const polyMesh &mesh, const vectorField &cellCentres, const vectorField &faceCentres, const vectorField &faceAreas, const labelList &checkFaces, const List< labelPair > &baffles, labelHashSet *setPtr)
Interpolation weights (0.5 for regular mesh).
const vectorField & faceCentres() const
static bool checkVolRatio(const bool report, const scalar warnRatio, const polyMesh &mesh, const scalarField &cellVolumes, const labelList &checkFaces, const List< labelPair > &baffles, labelHashSet *setPtr)
Cell volume ratio of neighbouring cells (1 for regular mesh).
static bool checkEdgeLength(const bool report, const scalar minEdgeLength, const polyMesh &mesh, const labelList &checkFaces, labelHashSet *pointSetPtr)
Small edges. Optionally collects points of small edges.
static bool checkFaceTets(const bool report, const scalar minPyrVol, const polyMesh &, const vectorField &cellCentres, const vectorField &faceCentres, const pointField &p, const labelList &checkFaces, const List< labelPair > &baffles, labelHashSet *)
See primitiveMesh.
static bool checkFaceFlatness(const bool report, const scalar minFlatness, const polyMesh &, const vectorField &faceAreas, const vectorField &faceCentres, const pointField &p, const labelList &checkFaces, labelHashSet *setPtr)
Area of faces v.s. sum of triangle areas.
const vectorField & cellCentres() const
static bool checkCellDeterminant(const bool report, const scalar minDet, const polyMesh &, const vectorField &faceAreas, const labelList &checkFaces, const labelList &affectedCells, labelHashSet *setPtr)
Area of internal faces v.s. boundary faces.
static labelList affectedCells(const polyMesh &, const labelList &changedFaces)
Helper function: get affected cells from faces.
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.
Mesh consisting of general polyhedral cells.
virtual const faceList & faces() const
Return raw faces.
virtual const labelList & faceOwner() const
Return face owner.
virtual const labelList & faceNeighbour() const
Return face neighbour.
bool isInternalFace(const label faceIndex) const noexcept
Return true if given face label is internal to the mesh.
label nInternalFaces() const noexcept
Number of internal faces.
const cellList & cells() const
scalar mag(const UList< point > &points) const
Return scalar magnitude - returns volume of pyramid.
Tensor of scalars, i.e. Tensor<scalar>.
scalar quality() const
Return quality: Ratio of tetrahedron and circum-sphere volume, scaled so that a regular tetrahedron h...
static vector areaNormal(const point &p0, const point &p1, const point &p2)
vector areaNormal() const
scalar mag() const
The magnitude of the triangle area.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const polyBoundaryMesh & patches
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
#define WarningInFunction
Report a warning using Foam::Warning.
#define SeriousErrorInFunction
Report an error message using Foam::SeriousError.
const dimensionedScalar c
Speed of light in a vacuum.
Namespace for finite-area.
dimensionedScalar det(const dimensionedSphericalTensor &dt)
Pair< label > labelPair
A pair of labels.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
dimensionedScalar asin(const dimensionedScalar &ds)
List< label > labelList
A List of labels.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
quaternion normalised(const quaternion &q)
Return the normalised (unit) quaternion of the given quaternion.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
static Foam::doubleVector pointsAverage(const UList< point > &points, const labelUList &pointLabels)
dimensionedScalar sin(const dimensionedScalar &ds)
messageStream Info
Information stream (stdout output on master, null elsewhere).
List< face > faceList
List of faces.
tetrahedron< point, const point & > tetPointRef
A tetrahedron using referred points.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
constexpr scalar degToRad() noexcept
Multiplication factor for degrees to radians conversion.
dimensionedScalar sqrt(const dimensionedScalar &ds)
List< cell > cellList
List of cell.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
constexpr scalar radToDeg() noexcept
Multiplication factor for radians to degrees conversion.
Vector< double > doubleVector
void reduce(T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce).
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
pyramid< point, const point &, const face & > pyramidPointFaceRef
A pyramid using referred point and face.
errorManip< error > abort(error &err)
Field< vector > vectorField
Specialisation of Field<T> for vector.
vector point
Point is a vector.
static constexpr const zero Zero
Global zero (0).
triangle< point, const point & > triPointRef
A triangle using referred points.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
vectorField pointField
pointField is a vectorField.
UList< label > labelUList
A UList of labels.
Vector< solveScalar > solveVector
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
dimensionedScalar cos(const dimensionedScalar &ds)
dimensionedScalar acos(const dimensionedScalar &ds)
constexpr char nl
The newline '\n' character (0x0a).
labelList pointLabels(nPoints, -1)
#define forAll(list, i)
Loop across all elements in list.
Unit conversion functions.