checkMeshQuality.C
Go to the documentation of this file.
1 #include "checkMeshQuality.H"
2 #include "polyMesh.H"
3 #include "cellSet.H"
4 #include "faceSet.H"
5 #include "motionSmoother.H"
6 #include "surfaceWriter.H"
7 #include "checkTools.H"
8 
9 Foam::label Foam::checkMeshQuality
10 (
11  const polyMesh& mesh,
12  const dictionary& dict,
13  autoPtr<surfaceWriter>& writer
14 )
15 {
16  label noFailedChecks = 0;
17 
18  {
19  faceSet faces(mesh, "meshQualityFaces", mesh.nFaces()/100+1);
20  motionSmoother::checkMesh(false, mesh, dict, faces);
21 
22  label nFaces = returnReduce(faces.size(), sumOp<label>());
23 
24  if (nFaces > 0)
25  {
26  noFailedChecks++;
27 
28  Info<< " <<Writing " << nFaces
29  << " faces in error to set " << faces.name() << endl;
30  faces.instance() = mesh.pointsInstance();
31  faces.write();
32 
33  if (writer)
34  {
35  mergeAndWrite(*writer, faces);
36  }
37  }
38  }
39 
40  return noFailedChecks;
41 }
dictionary dict
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:487
void mergeAndWrite(const polyMesh &mesh, surfaceWriter &writer, const word &name, const indirectPrimitivePatch &setPatch, const fileName &outputDir)
Generate merged surface on master and write. Needs input patch.
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.
dynamicFvMesh & mesh
vtk::internalMeshWriter writer(topoMesh, topoCells, vtk::formatType::INLINE_ASCII, runTime.path()/"blockTopology")
label checkMeshQuality(const polyMesh &mesh, const dictionary &dict, autoPtr< surfaceWriter > &writer)
messageStream Info
Information stream (stdout output on master, null elsewhere)