openfoam/applications/utilities/mesh/manipulation/checkMesh/checkMeshQuality.C
Mark Olesen 181c974b11 ENH: improved sample surfaces and surface writers (#1206)
- The writers have changed from being a generic state-less set of
  routines to more properly conforming to the normal notion of a writer.
  These changes allow us to combine output fields (eg, in a single
  VTK/vtp file for each timestep).

  Parallel data reduction and any associated bookkeeping is now part
  of the surface writers.
  This improves their re-usability and avoids unnecessary
  and premature data reduction at the sampling stage.

  It is now possible to have different output formats on a per-surface
  basis.

- A new feature of the surface sampling is the ability to "store" the
  sampled surfaces and fields onto a registry for reuse by other
  function objects.

  Additionally, the "store" can be triggered at the execution phase
  as well
2019-02-07 18:11:34 +01:00

42 lines
955 B
C

#include "checkMeshQuality.H"
#include "polyMesh.H"
#include "cellSet.H"
#include "faceSet.H"
#include "motionSmoother.H"
#include "surfaceWriter.H"
#include "checkTools.H"
Foam::label Foam::checkMeshQuality
(
const polyMesh& mesh,
const dictionary& dict,
autoPtr<surfaceWriter>& writer
)
{
label noFailedChecks = 0;
{
faceSet faces(mesh, "meshQualityFaces", mesh.nFaces()/100+1);
motionSmoother::checkMesh(false, mesh, dict, faces);
label nFaces = returnReduce(faces.size(), sumOp<label>());
if (nFaces > 0)
{
noFailedChecks++;
Info<< " <<Writing " << nFaces
<< " faces in error to set " << faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write();
if (writer.valid())
{
mergeAndWrite(*writer, faces);
}
}
}
return noFailedChecks;
}