[Yt-svn] yt: Adding reflect_across_boundaries to HomogenizedVolume and us...

hg at spacepope.org hg at spacepope.org
Wed Jul 28 20:38:44 PDT 2010


hg Repository: yt
details:   yt/rev/c9dea0de23c6
changeset: 1893:c9dea0de23c6
user:      Matthew Turk <matthewturk at gmail.com>
date:
Wed Jul 28 20:38:40 2010 -0700
description:
Adding reflect_across_boundaries to HomogenizedVolume and using a different
check for FLASH data

diffstat:

 yt/extensions/volume_rendering/grid_partitioner.py |  17 +++++++++++++++++
 yt/lagos/OutputTypes.py                            |   2 +-
 2 files changed, 18 insertions(+), 1 deletions(-)

diffs (39 lines):

diff -r ac2ed81a8084 -r c9dea0de23c6 yt/extensions/volume_rendering/grid_partitioner.py
--- a/yt/extensions/volume_rendering/grid_partitioner.py	Wed Jul 28 19:40:30 2010 -0700
+++ b/yt/extensions/volume_rendering/grid_partitioner.py	Wed Jul 28 20:38:40 2010 -0700
@@ -125,6 +125,23 @@
         self.brick_dimensions -= 1
         self.bricks = na.array(bricks, dtype='object')
 
+    def reflect_across_boundaries(self):
+        mylog.warning("Note that this doesn't fix ghost zones, so there may be artifacts at domain boundaries!")
+        nb = []
+        # Simplest, clearest iteration ...
+        for i in [-1, 1]:
+            for j in [-1, 1]:
+                for k in [-1, 1]:
+                    for b in self.bricks:
+                        BB = na.array([b.LeftEdge * [i,j,k], b.RightEdge * [i,j,k]])
+                        LE, RE = na.min(BB, axis=0), na.max(BB, axis=0)
+                        nb.append(
+                            PartitionedGrid(b.parent_grid_id, len(b.my_data), 
+                                [md[::i,::j,::k].copy("C") for md in b.my_data],
+                                LE, RE, na.array(b.my_data[0].shape) - 1))
+        # Replace old bricks
+        self.initialize_bricks(nb)
+
     def store_bricks(self, fn):
         import h5py, cPickle
         f = h5py.File(fn, "w")
diff -r ac2ed81a8084 -r c9dea0de23c6 yt/lagos/OutputTypes.py
--- a/yt/lagos/OutputTypes.py	Wed Jul 28 19:40:30 2010 -0700
+++ b/yt/lagos/OutputTypes.py	Wed Jul 28 20:38:40 2010 -0700
@@ -866,7 +866,7 @@
     def _is_valid(self, *args, **kwargs):
         try:
             fileh = h5py.File(args[0],'r')
-            if "real runtime parameters" in fileh["/"].keys():
+            if "bounding box" in fileh["/"].keys():
                 return True
         except:
             pass



More information about the yt-svn mailing list