From a71172b693f54936fbd8c08d0e18502482f99b23 Mon Sep 17 00:00:00 2001
From: mattijs <mattijs>
Date: Fri, 11 Dec 2015 11:37:49 +0000
Subject: [PATCH] ENH: cyclicPeriodic: add some printing

---
 .../cyclicPeriodicAMIPolyPatch.C              | 30 ++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/src/meshTools/AMIInterpolation/patches/cyclicPeriodicAMI/cyclicPeriodicAMIPolyPatch/cyclicPeriodicAMIPolyPatch.C b/src/meshTools/AMIInterpolation/patches/cyclicPeriodicAMI/cyclicPeriodicAMIPolyPatch/cyclicPeriodicAMIPolyPatch.C
index 8e683b11692..15a23a608c1 100644
--- a/src/meshTools/AMIInterpolation/patches/cyclicPeriodicAMI/cyclicPeriodicAMIPolyPatch/cyclicPeriodicAMIPolyPatch.C
+++ b/src/meshTools/AMIInterpolation/patches/cyclicPeriodicAMI/cyclicPeriodicAMIPolyPatch/cyclicPeriodicAMIPolyPatch.C
@@ -535,8 +535,36 @@ void Foam::cyclicPeriodicAMIPolyPatch::resetAMI
                 << endl;
         }
 
-        // Normalise the weights
+        // Normalise the weights. Disable printing since weights are
+        // still areas.
         AMIPtr_->normaliseWeights(true, false);
+
+        // Print some statistics
+        const label nFace = returnReduce(size(), sumOp<label>());
+
+        if (nFace)
+        {
+            scalarField srcWghtSum(size(), 0);
+            scalarField tgtWghtSum(size(), 0);
+            forAll(*this, faceI)
+            {
+                srcWghtSum[faceI] = sum(AMIPtr_->srcWeights()[faceI]);
+                tgtWghtSum[faceI] = sum(AMIPtr_->tgtWeights()[faceI]);
+            }
+
+            Info<< indent
+                << "AMI: Patch " << name()
+                << " sum(weights) min/max/average = "
+                << gMin(srcWghtSum) << ", "
+                << gMax(srcWghtSum) << ", "
+                << gAverage(srcWghtSum) << endl;
+            Info<< indent
+                << "AMI: Patch " << neighbPatch().name()
+                << " sum(weights) min/max/average = "
+                << gMin(tgtWghtSum) << ", "
+                << gMax(tgtWghtSum) << ", "
+                << gAverage(tgtWghtSum) << endl;
+        }
     }
 }
 
-- 
GitLab