[yt-svn] commit/yt: MatthewTurk: Adding a max_level option to the HomogenizedVolume, which against all odds

Bitbucket commits-noreply at bitbucket.org
Mon Jun 4 19:40:30 PDT 2012


1 new commit in yt:


https://bitbucket.org/yt_analysis/yt/changeset/221d00ce8e79/
changeset:   221d00ce8e79
branch:      yt
user:        MatthewTurk
date:        2012-06-05 04:40:18
summary:     Adding a max_level option to the HomogenizedVolume, which against all odds
remains 'not dead' to this day.
affected #:  1 file

diff -r 2f074d314956f5b004e73dbae6abc3ea1edfd0e1 -r 221d00ce8e795245343f79d602f0217bbd36e0ca yt/visualization/volume_rendering/grid_partitioner.py
--- a/yt/visualization/volume_rendering/grid_partitioner.py
+++ b/yt/visualization/volume_rendering/grid_partitioner.py
@@ -41,7 +41,8 @@
 class HomogenizedVolume(ParallelAnalysisInterface):
     bricks = None
     def __init__(self, fields = "Density", source = None, pf = None,
-                 log_fields = None, no_ghost = False):
+                 log_fields = None, no_ghost = False,
+                 max_level = 48):
         # Typically, initialized as hanging off a hierarchy.  But, not always.
         ParallelAnalysisInterface.__init__(self)
         self.no_ghost = no_ghost
@@ -54,6 +55,7 @@
         else:
             log_fields = [self.pf.field_info[field].take_log
                          for field in self.fields]
+        self.max_level = max_level
         self.log_fields = log_fields
 
     def traverse(self, back_point, front_point, image):
@@ -84,8 +86,13 @@
         PP = ProtoPrism(grid.id, grid.LeftEdge, grid.RightEdge, GF)
 
         pgs = []
+        cm = grid.child_mask.copy()
+        if grid.Level > self.max_level:
+            return pgs
+        elif grid.Level == self.max_level:
+            cm[:] = 1
         for P in PP.sweep(0):
-            sl = P.get_brick(grid.LeftEdge, grid.dds, grid.child_mask)
+            sl = P.get_brick(grid.LeftEdge, grid.dds, cm)
             if len(sl) == 0: continue
             dd = [d[sl[0][0]:sl[0][1]+1,
                     sl[1][0]:sl[1][1]+1,

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