[Yt-svn] yt-commit r1261 - trunk/yt/lagos/hop

sskory at wrangler.dreamhost.com sskory at wrangler.dreamhost.com
Mon Apr 20 08:50:36 PDT 2009


Author: sskory
Date: Mon Apr 20 08:50:35 2009
New Revision: 1261
URL: http://yt.spacepope.org/changeset/1261

Log:
Haloes should have the same ID regardless of number of threads for the same threshold with this addition.

Modified:
   trunk/yt/lagos/hop/SS_HopOutput.py

Modified: trunk/yt/lagos/hop/SS_HopOutput.py
==============================================================================
--- trunk/yt/lagos/hop/SS_HopOutput.py	(original)
+++ trunk/yt/lagos/hop/SS_HopOutput.py	Mon Apr 20 08:50:35 2009
@@ -336,7 +336,13 @@
                 halo._distributed = self._distributed
                 halo._owner = proc
                 id += 1
-        self._groups.sort(key = lambda h: -1 * h.get_size())
+        def haloCmp(h1,h2):
+            c = cmp(h1.get_size(),h2.get_size())
+            if c != 0:
+                return -1 * c
+            if c == 0:
+                return cmp(h1.center_of_mass()[0],h2.center_of_mass()[0])
+        self._groups.sort(haloCmp)
         sorted_max_dens = {}
         for i, halo in enumerate(self._groups):
             if halo.id in self._max_dens:



More information about the yt-svn mailing list