[yt-svn] commit/yt: MatthewTurk: Adding an additional check to the Enzo frontend to ensure grids with particles

Bitbucket commits-noreply at bitbucket.org
Tue Jan 3 19:14:27 PST 2012


1 new commit in yt:


https://bitbucket.org/yt_analysis/yt/changeset/74e0a0d08c10/
changeset:   74e0a0d08c10
branch:      yt
user:        MatthewTurk
date:        2012-01-04 04:14:17
summary:     Adding an additional check to the Enzo frontend to ensure grids with particles
are included.
affected #:  1 file

diff -r 75de61bbd2b98c71d1993f6260ef91f4dd16ff74 -r 74e0a0d08c10028a5e1a95864cbfd0459250dc1b yt/frontends/enzo/data_structures.py
--- a/yt/frontends/enzo/data_structures.py
+++ b/yt/frontends/enzo/data_structures.py
@@ -484,6 +484,15 @@
         if self.num_grids > 40:
             starter = na.random.randint(0, 20)
             random_sample = na.mgrid[starter:len(self.grids)-1:20j].astype("int32")
+            # We also add in a bit to make sure that some of the grids have
+            # particles
+            gwp = self.grid_particle_count > 0
+            if na.any(gwp) and not na.any(gwp[(random_sample,)]):
+                # We just add one grid.  This is not terribly efficient.
+                first_grid = na.where(gwp)[0][0]
+                random_sample.resize((21,))
+                random_sample[-1] = first_grid
+                mylog.debug("Added additional grid %s", first_grid)
             mylog.debug("Checking grids: %s", random_sample.tolist())
         else:
             random_sample = na.mgrid[0:max(len(self.grids)-1,1)].astype("int32")

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list