70 const scalar maxNonOrtho
78 const scalar minTetQuality
82 const scalar maxConcave
90 const scalar maxIntSkew
97 const scalar maxBounSkew
104 const scalar minWeight
108 const scalar minVolRatio
112 const scalar minTwist
116 const scalar minTriangleTwist
120 const scalar minFaceFlatness
131 const scalar minEdgeLength
145 if (errorMsg.size() || IOerrorMsg.size())
154 <<
"Missing/incorrect required dictionary entries:" <<
nl 156 << IOerrorMsg.c_str() <<
nl 157 << errorMsg.c_str() <<
nl 168 label nWrongFaces = 0;
170 Info<<
"Checking faces in error :" <<
endl;
173 if (maxNonOrtho < 180.0-SMALL)
189 Info<<
" non-orthogonality > " 190 <<
setw(3) << maxNonOrtho
192 << nNewWrongFaces-nWrongFaces <<
endl;
194 nWrongFaces = nNewWrongFaces;
213 Info<<
" faces with face pyramid volume < " 214 <<
setw(5) << minVol <<
" : " 215 << nNewWrongFaces-nWrongFaces <<
endl;
217 nWrongFaces = nNewWrongFaces;
220 if (minTetQuality > -GREAT)
237 Info<<
" faces with face-decomposition tet quality < " 238 <<
setw(5) << minTetQuality <<
" : " 239 << nNewWrongFaces-nWrongFaces <<
endl;
241 nWrongFaces = nNewWrongFaces;
244 if (maxConcave < 180.0-SMALL)
259 Info<<
" faces with concavity > " 260 <<
setw(3) << maxConcave
262 << nNewWrongFaces-nWrongFaces <<
endl;
264 nWrongFaces = nNewWrongFaces;
267 if (minArea > -SMALL)
281 Info<<
" faces with area < " 282 <<
setw(5) << minArea
284 << nNewWrongFaces-nWrongFaces <<
endl;
286 nWrongFaces = nNewWrongFaces;
289 if (maxIntSkew > 0 || maxBounSkew > 0)
308 Info<<
" faces with skewness > " 309 <<
setw(3) << maxIntSkew
310 <<
" (internal) or " <<
setw(3) << maxBounSkew
311 <<
" (boundary) : " << nNewWrongFaces-nWrongFaces <<
endl;
313 nWrongFaces = nNewWrongFaces;
316 if (minWeight >= 0 && minWeight < 1)
333 Info<<
" faces with interpolation weights (0..1) < " 334 <<
setw(5) << minWeight
336 << nNewWrongFaces-nWrongFaces <<
endl;
338 nWrongFaces = nNewWrongFaces;
341 if (minVolRatio >= 0)
356 Info<<
" faces with volume ratio of neighbour cells < " 357 <<
setw(5) << minVolRatio
359 << nNewWrongFaces-nWrongFaces <<
endl;
361 nWrongFaces = nNewWrongFaces;
383 Info<<
" faces with face twist < " 384 <<
setw(5) << minTwist
386 << nNewWrongFaces-nWrongFaces <<
endl;
388 nWrongFaces = nNewWrongFaces;
391 if (minTriangleTwist > -1)
409 Info<<
" faces with triangle twist < " 410 <<
setw(5) << minTriangleTwist
412 << nNewWrongFaces-nWrongFaces <<
endl;
414 nWrongFaces = nNewWrongFaces;
417 if (minFaceFlatness > -SMALL)
433 Info<<
" faces with flatness < " 434 <<
setw(5) << minFaceFlatness
436 << nNewWrongFaces-nWrongFaces <<
endl;
438 nWrongFaces = nNewWrongFaces;
456 Info<<
" faces on cells with determinant < " 457 <<
setw(5) << minDet <<
" : " 458 << nNewWrongFaces-nWrongFaces <<
endl;
460 nWrongFaces = nNewWrongFaces;
463 if (minEdgeLength >= 0)
477 label nNewWrongFaces = 0;
478 for (
const label pointi : edgePoints)
480 const auto&
pFaces = pointFaces[pointi];
481 for (
const label facei :
pFaces)
483 if (wrongFaces.
insert(facei))
490 Info<<
" faces with edge length < " 491 <<
setw(5) << minEdgeLength <<
" : " 499 return nWrongFaces > 0;
562 const scalar maxNonOrtho
570 const scalar minTetQuality
574 const scalar maxConcave
582 const scalar maxIntSkew
587 "maxInternalSkewness",
592 const scalar maxBounSkew
597 "maxBoundarySkewness",
602 const scalar minWeight
606 const scalar minVolRatio
610 const scalar minTwist
614 const scalar minTriangleTwist
618 scalar minFaceFlatness = -1.0;
629 const scalar minEdgeLength
642 if (errorMsg.size() || IOerrorMsg.size())
650 <<
"Missing/incorrect required dictionary entries:" <<
nl 652 << IOerrorMsg.c_str() <<
nl 653 << errorMsg.c_str() <<
nl 664 label nWrongFaces = 0;
666 Info<<
"Checking faces in error :" <<
endl;
669 if (maxNonOrtho < 180.0-SMALL)
682 Info<<
" non-orthogonality > " 683 <<
setw(3) << maxNonOrtho
685 << nNewWrongFaces-nWrongFaces <<
endl;
687 nWrongFaces = nNewWrongFaces;
704 Info<<
" faces with face pyramid volume < " 705 <<
setw(5) << minVol <<
" : " 706 << nNewWrongFaces-nWrongFaces <<
endl;
708 nWrongFaces = nNewWrongFaces;
711 if (minTetQuality > -GREAT)
725 Info<<
" faces with face-decomposition tet quality < " 726 <<
setw(5) << minTetQuality <<
" : " 727 << nNewWrongFaces-nWrongFaces <<
endl;
729 nWrongFaces = nNewWrongFaces;
732 if (maxConcave < 180.0-SMALL)
745 Info<<
" faces with concavity > " 746 <<
setw(3) << maxConcave
748 << nNewWrongFaces-nWrongFaces <<
endl;
750 nWrongFaces = nNewWrongFaces;
753 if (minArea > -SMALL)
765 Info<<
" faces with area < " 766 <<
setw(5) << minArea
768 << nNewWrongFaces-nWrongFaces <<
endl;
770 nWrongFaces = nNewWrongFaces;
773 if (maxIntSkew > 0 || maxBounSkew > 0)
792 Info<<
" faces with skewness > " 793 <<
setw(3) << maxIntSkew
794 <<
" (internal) or " <<
setw(3) << maxBounSkew
795 <<
" (boundary) : " << nNewWrongFaces-nWrongFaces <<
endl;
797 nWrongFaces = nNewWrongFaces;
800 if (minWeight >= 0 && minWeight < 1)
813 Info<<
" faces with interpolation weights (0..1) < " 814 <<
setw(5) << minWeight
816 << nNewWrongFaces-nWrongFaces <<
endl;
818 nWrongFaces = nNewWrongFaces;
821 if (minVolRatio >= 0)
834 Info<<
" faces with volume ratio of neighbour cells < " 835 <<
setw(5) << minVolRatio
837 << nNewWrongFaces-nWrongFaces <<
endl;
839 nWrongFaces = nNewWrongFaces;
857 Info<<
" faces with face twist < " 858 <<
setw(5) << minTwist
860 << nNewWrongFaces-nWrongFaces <<
endl;
862 nWrongFaces = nNewWrongFaces;
865 if (minTriangleTwist > -1)
880 Info<<
" faces with triangle twist < " 881 <<
setw(5) << minTriangleTwist
883 << nNewWrongFaces-nWrongFaces <<
endl;
885 nWrongFaces = nNewWrongFaces;
888 if (minFaceFlatness > -SMALL)
901 Info<<
" faces with flatness < " 902 <<
setw(5) << minFaceFlatness
904 << nNewWrongFaces-nWrongFaces <<
endl;
906 nWrongFaces = nNewWrongFaces;
922 Info<<
" faces on cells with determinant < " 923 <<
setw(5) << minDet <<
" : " 924 << nNewWrongFaces-nWrongFaces <<
endl;
926 nWrongFaces = nNewWrongFaces;
929 if (minEdgeLength >= 0)
947 label nNewWrongFaces = 0;
948 for (
const label pointi : edgePoints)
950 const auto&
pFaces = pointFaces[pointi];
951 for (
const label facei :
pFaces)
953 if (wrongFaces.
insert(facei))
960 Info<<
" faces with edge length < " 961 <<
setw(5) << minEdgeLength <<
" : " 969 return nWrongFaces > 0;
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.
static bool checkMesh(const bool report, const polyMesh &mesh, const dictionary &dict, labelHashSet &wrongFaces, const bool dryRun=false)
Check mesh with mesh settings in dict. Collects incorrect faces.
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.
prefixOSstream Perr
OSstream wrapped stderr (std::cerr) with parallel prefix.
const polyMesh & mesh() const
Reference to mesh.
void clear() const
Clear any accumulated error messages.
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.
const vectorField & faceAreas() const
label nPoints() const noexcept
Number of mesh points.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
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.
const vectorField & cellCentres() const
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
label nFaces() const noexcept
Number of mesh faces.
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
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 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.
virtual const pointField & points() const
Return raw points.
label size() const noexcept
The number of elements in table.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
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.
string message() const
The accumulated error message.
Updateable mesh geometry and checking routines.
const vectorField & cellCentres() const
Istream and Ostream manipulators taking arguments.
static bool checkFaceArea(const bool report, const scalar minArea, const polyMesh &, const vectorField &faceAreas, const labelList &checkFaces, labelHashSet *setPtr)
Small faces.
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry if present, and assign to T val. FatalIOError if it is found and the number of tokens i...
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 vectorField & faceCentres() const
const vectorField & faceCentres() const
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 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.
const vectorField & faceAreas() const
static labelList affectedCells(const polyMesh &, const labelList &changedFaces)
Helper function: get affected cells from faces.
messageStream Info
Information stream (stdout output on master, null elsewhere)
const labelListList & pointFaces() const
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)
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
Mesh consisting of general polyhedral cells.
Omanip< int > setw(const int i)
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.
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T, or return the given default value. FatalIOError if it is found and the number of...
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.
const polyMesh & mesh() const
const scalarField & cellVolumes() const
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...