From 141403ed9829a0a485afaeafab83628c5cf94d26 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Tue, 23 Nov 2021 10:22:47 +0100
Subject: [PATCH] BUG: compare of two zero-sized faces was returning false

---
 src/OpenFOAM/meshes/meshShapes/face/face.C | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/OpenFOAM/meshes/meshShapes/face/face.C b/src/OpenFOAM/meshes/meshShapes/face/face.C
index 6a258b4f4fd..314a325ada4 100644
--- a/src/OpenFOAM/meshes/meshShapes/face/face.C
+++ b/src/OpenFOAM/meshes/meshShapes/face/face.C
@@ -287,14 +287,19 @@ int Foam::face::compare(const face& a, const face& b)
     const label sizeA = a.size();
     const label sizeB = b.size();
 
-    // Trivial reject: faces are different size
-    if (sizeA != sizeB || sizeA == 0)
+    if (sizeA != sizeB)
     {
+        // Trivial reject: faces have different sizes
         return 0;
     }
+    else if (sizeA == 0)
+    {
+        // Both faces with zero vertices. Always identical
+        return 1;
+    }
     else if (sizeA == 1)
     {
-        // Trivial: face with a single vertex
+        // Both faces with a single vertex. Simple check
         return (a[0] == b[0] ? 1 : 0);
     }
 
-- 
GitLab