From 116e3eec5a48e18d2232ebe9588cd1fe9cbf0ac0 Mon Sep 17 00:00:00 2001
From: andy <andy>
Date: Wed, 30 Jul 2014 14:55:36 +0100
Subject: [PATCH] ENH: AMI - early exit if no source faces present

---
 .../AMIInterpolation/AMIInterpolation.C               | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C
index 2440c1f8428..ea79e0699cc 100644
--- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C
+++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C
@@ -805,6 +805,17 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
     label srcTotalSize = returnReduce(srcPatch.size(), sumOp<label>());
     label tgtTotalSize = returnReduce(tgtPatch.size(), sumOp<label>());
 
+    if (srcTotalSize == 0)
+    {
+        if (debug)
+        {
+            Info<< "AMI: no source faces present - no addressing constructed"
+                << endl;
+        }
+
+        return;
+    }
+
     Info<< indent
         << "AMI: Creating addressing and weights between "
         << srcTotalSize << " source faces and "
-- 
GitLab