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 
10 (
11  const polyMesh& mesh,
12  const dictionary& dict,
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  if (writer.valid())
33  {
34  mergeAndWrite(writer(), faces);
35  }
36  }
37  }
38 
39  return noFailedChecks;
40 }
Foam::polyMeshGenChecks::checkMesh
bool checkMesh(const polyMeshGen &mesh, const bool report)
Check mesh for correctness. Returns false for no error.
Definition: polyMeshGenChecks.C:104
checkTools.H
Foam::returnReduce
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Definition: PstreamReduceOps.H:86
motionSmoother.H
Foam::regIOobject::write
virtual bool write() const
Write using setting from DB.
Definition: regIOobjectWrite.C:126
Foam::faceSet
A list of face labels.
Definition: faceSet.H:48
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
surfaceWriter.H
Foam::IOobject::instance
const fileName & instance() const
Definition: IOobject.H:350
polyMesh.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::checkMeshQuality
label checkMeshQuality(const polyMesh &, const dictionary &, const autoPtr< surfaceWriter > &)
Definition: checkMeshQuality.C:10
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::Info
messageStream Info
faceSet.H
checkMeshQuality.H
Foam::IOobject::name
const word & name() const
Return name.
Definition: IOobject.H:273
Foam::mergeAndWrite
void mergeAndWrite(const surfaceWriter &, const faceSet &)
Write vtk representation of (assembled) faceSet to vtk file in.
Definition: checkTools.C:205
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::HashTable::size
label size() const
Return number of elements in table.
Definition: HashTableI.H:65
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam::writer
Base class for graphics format writing. Entry points are.
Definition: writer.H:78
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::sumOp
Definition: ops.H:162
cellSet.H