From 70801d7f487dbbca04d26386752224dfb39cd75f Mon Sep 17 00:00:00 2001
From: mattijs <mattijs>
Date: Wed, 1 Aug 2018 13:02:07 +0100
Subject: [PATCH] ENH: checkMesh: output mask field. Fixes #958.

---
 .../manipulation/checkMesh/checkGeometry.C    | 70 ++++++++++++++++++-
 1 file changed, 69 insertions(+), 1 deletion(-)

diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C
index a64e84e3bc9..283146e33b3 100644
--- a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C
+++ b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C
@@ -15,7 +15,7 @@
 #include "vtkSurfaceWriter.H"
 #include "writer.H"
 
-#include "cyclicAMIPolyPatch.H"
+#include "cyclicACMIPolyPatch.H"
 #include "Time.H"
 
 // Find wedge with opposite orientation. Note: does not actually check that
@@ -1033,6 +1033,40 @@ Foam::label Foam::checkGeometry
                                 false
                             );
                         }
+
+                        if (isA<cyclicACMIPolyPatch>(pbm[patchi]))
+                        {
+                            const cyclicACMIPolyPatch& pp =
+                                refCast<const cyclicACMIPolyPatch>(pbm[patchi]);
+                            scalarField mergedMask;
+                            globalFaces().gather
+                            (
+                                UPstream::worldComm,
+                                ListOps::create<label>
+                                (
+                                    UPstream::procID(UPstream::worldComm),
+                                    labelOp<int>()  // int -> label
+                                ),
+                                pp.mask(),
+                                mergedMask
+                            );
+                            if (Pstream::master())
+                            {
+                                wr.write
+                                (
+                                    functionObject::outputPrefix,
+                                    "src_" + tmName,
+                                    meshedSurfRef
+                                    (
+                                        mergedPoints,
+                                        mergedFaces
+                                    ),
+                                    "mask",
+                                    mergedMask,
+                                    false
+                                );
+                            }
+                        }
                     }
                     {
                         // Collect geometry
@@ -1087,6 +1121,40 @@ Foam::label Foam::checkGeometry
                                 false
                             );
                         }
+
+                        if (isA<cyclicACMIPolyPatch>(pbm[patchi]))
+                        {
+                            const cyclicACMIPolyPatch& pp =
+                                refCast<const cyclicACMIPolyPatch>(pbm[patchi]);
+                            scalarField mergedMask;
+                            globalFaces().gather
+                            (
+                                UPstream::worldComm,
+                                ListOps::create<label>
+                                (
+                                    UPstream::procID(UPstream::worldComm),
+                                    labelOp<int>()  // int -> label
+                                ),
+                                pp.neighbPatch().mask(),
+                                mergedMask
+                            );
+                            if (Pstream::master())
+                            {
+                                wr.write
+                                (
+                                    functionObject::outputPrefix,
+                                    "tgt_" + tmName,
+                                    meshedSurfRef
+                                    (
+                                        mergedPoints,
+                                        mergedFaces
+                                    ),
+                                    "mask",
+                                    mergedMask,
+                                    false
+                                );
+                            }
+                        }
                     }
                 }
             }
-- 
GitLab