From bfb3b85e73d00f1a49b95c3d0694e69beb6097a3 Mon Sep 17 00:00:00 2001
From: Christoph Rettinger <christoph.rettinger@fau.de>
Date: Wed, 21 Mar 2018 15:53:28 +0100
Subject: [PATCH] Added check to AMR in coupling for improved performance

---
 .../SettlingSphereMEMDynamicRefinement.cpp            | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMDynamicRefinement.cpp b/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMDynamicRefinement.cpp
index 44b17eb70..0e44a2e57 100644
--- a/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMDynamicRefinement.cpp
+++ b/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMDynamicRefinement.cpp
@@ -869,9 +869,18 @@ int main( int argc, char **argv )
       {
          auto & forest = blocks->getBlockForest();
          pe::createWithNeighborhood(forest, bodyStorageID, *peInfoCollection);
-         pe::clearSynchronization( blockforest, bodyStorageID);
 
+         uint_t stampBefore = blocks->getBlockForest().getModificationStamp();
          blocks->refresh();
+         uint_t stampAfter = blocks->getBlockForest().getModificationStamp();
+
+         if(stampBefore == stampAfter)
+         {
+            // nothing has changed
+            continue;
+         }
+
+         pe::clearSynchronization( blockforest, bodyStorageID);
 
          for( uint_t syncStep = 0; syncStep < uint_c(diameter / real_c(minBlockSizeInCells)) + 1; ++syncStep)
             syncCall();
-- 
GitLab