From 9298d68ad34d7ba6bea40dbb6890998cf5c188c6 Mon Sep 17 00:00:00 2001
From: mattijs <mattijs>
Date: Mon, 7 Dec 2015 11:00:42 +0000
Subject: [PATCH] BUG: objectRegistry: do not clear event number on dependent
 objects

This was causing same event number on both U and grad(U) which meant
that if one of the processors had different event number the trigger
of gradient caching would not be synchronised. Now instead the overflow
is detected in the regIOobject::upToDate function and handled consistently
(by assuming that the events of object will never differ by more than
labelMax/2)
---
 src/OpenFOAM/db/objectRegistry/objectRegistry.C | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/src/OpenFOAM/db/objectRegistry/objectRegistry.C b/src/OpenFOAM/db/objectRegistry/objectRegistry.C
index f2420e13d1e..80f2266eccd 100644
--- a/src/OpenFOAM/db/objectRegistry/objectRegistry.C
+++ b/src/OpenFOAM/db/objectRegistry/objectRegistry.C
@@ -195,21 +195,9 @@ Foam::label Foam::objectRegistry::getEvent() const
         curEvent = 1;
         event_ = 2;
 
-        for (const_iterator iter = begin(); iter != end(); ++iter)
-        {
-            const regIOobject& io = *iter();
-
-            if (objectRegistry::debug)
-            {
-                Pout<< "objectRegistry::getEvent() : "
-                    << "resetting count on " << iter.key() << endl;
-            }
 
-            if (io.eventNo() != 0)
-            {
-                const_cast<regIOobject&>(io).eventNo() = curEvent;
-            }
-        }
+        // No need to reset dependent objects; overflow is now handled
+        // in regIOobject::upToDate
     }
 
     return curEvent;
-- 
GitLab