From 1cf850f1644881510ed028436807f9358b10be79 Mon Sep 17 00:00:00 2001
From: mattijs <mattijs>
Date: Thu, 11 Apr 2013 15:16:06 +0100
Subject: [PATCH] ENH: snappyHexMesh: print final mesh check

---
 .../generation/snappyHexMesh/snappyHexMesh.C  | 29 ++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C
index 2406cb667c4..14bf0ee9eb9 100644
--- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C
+++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -47,6 +47,8 @@ Description
 #include "snapParameters.H"
 #include "layerParameters.H"
 #include "vtkSetWriter.H"
+#include "faceSet.H"
+#include "motionSmoother.H"
 
 using namespace Foam;
 
@@ -675,6 +677,31 @@ int main(int argc, char *argv[])
     }
 
 
+    {
+        // Check final mesh
+        Info<< "Checking final mesh ..." << endl;
+        faceSet wrongFaces(mesh, "wrongFaces", mesh.nFaces()/100);
+        motionSmoother::checkMesh(false, mesh, motionDict, wrongFaces);
+        const label nErrors = returnReduce
+        (
+            wrongFaces.size(),
+            sumOp<label>()
+        );
+
+        if (nErrors > 0)
+        {
+            Info<< "Finished meshing with " << nErrors << " illegal faces"
+                << " (concave, zero area or negative cell pyramid volume)"
+                << endl;
+            wrongFaces.write();
+        }
+        else
+        {
+            Info<< "Finished meshing without any errors" << endl;
+        }
+    }
+
+
     Info<< "Finished meshing in = "
         << runTime.elapsedCpuTime() << " s." << endl;
 
-- 
GitLab