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

mturk at wrangler.dreamhost.com mturk at wrangler.dreamhost.com
Sun Dec 28 11:10:10 PST 2008


Author: mturk
Date: Sun Dec 28 11:10:09 2008
New Revision: 1057
URL: http://yt.spacepope.org/changeset/1057

Log:
Change the way we iterate, so that any procs with no halos don't get confused



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	Sun Dec 28 11:10:09 2008
@@ -283,7 +283,6 @@
                 # self.hop_list
                 # We need to mock up the HopList thingie, so we need to set:
                 #     self._max_dens
-                #     
                 max_dens[hi] = self._max_dens[halo.id]
                 groups.append(HopGroup(self, hi))
                 groups[-1].indices = halo.indices
@@ -319,14 +318,13 @@
         # MJT: Sorting doesn't work yet.  They need to be sorted.
         #haloes.sort(lambda x, y: cmp(len(x.indices),len(y.indices)))
         # Unfortunately, we can't sort *just yet*.
-        proc = last = 0
-        for i, halo in enumerate(self._groups):
-            if i - last >= halo_info[proc]:
-                proc += 1
-                last = i
-            halo._distributed = True
-            halo._owner = proc
-            halo.id = i
+        id = 0
+        for proc in sorted(halo_info.keys()):
+            for halo in self._groups[id:id+halo_info[proc]]:
+                halo.id = id
+                halo._distributed = True
+                halo._owner = proc
+                id += 1
         self._groups.sort(key = lambda h: -1 * h.get_size())
         sorted_max_dens = {}
         for i, halo in enumerate(self._groups):



More information about the yt-svn mailing list