[yt-svn] commit/yt-3.0: MatthewTurk: FLASH IO now works, but needs more testing. Initial speed improvements look to

Bitbucket commits-noreply at bitbucket.org
Thu Aug 9 11:37:00 PDT 2012


1 new commit in yt-3.0:


https://bitbucket.org/yt_analysis/yt-3.0/changeset/665f55c8d8b2/
changeset:   665f55c8d8b2
branch:      yt-3.0
user:        MatthewTurk
date:        2012-08-09 20:36:52
summary:     FLASH IO now works, but needs more testing.  Initial speed improvements look to
be about 3x.
affected #:  2 files

diff -r 62853de8e84a872c38256c1c777b2e3378e61ec0 -r 665f55c8d8b270a9b2cc2e9d4e8671a3d3a8b944 yt/frontends/flash/data_structures.py
--- a/yt/frontends/flash/data_structures.py
+++ b/yt/frontends/flash/data_structures.py
@@ -57,6 +57,10 @@
     def __repr__(self):
         return "FLASHGrid_%04i (%s)" % (self.id, self.ActiveDimensions)
 
+    @property
+    def filename(self):
+        return None
+
 class FLASHHierarchy(GridGeometryHandler):
 
     grid = FLASHGrid
@@ -182,7 +186,7 @@
         self.max_level = self.grid_levels.max()
 
     def _setup_derived_fields(self):
-        AMRHierarchy._setup_derived_fields(self)
+        super(FLASHHierarchy, self)._setup_derived_fields()
         [self.parameter_file.conversion_factors[field] 
          for field in self.field_list]
         for field in self.field_list:


diff -r 62853de8e84a872c38256c1c777b2e3378e61ec0 -r 665f55c8d8b270a9b2cc2e9d4e8671a3d3a8b944 yt/frontends/flash/io.py
--- a/yt/frontends/flash/io.py
+++ b/yt/frontends/flash/io.py
@@ -28,6 +28,7 @@
 
 from yt.utilities.io_handler import \
     BaseIOHandler
+from yt.utilities.logger import ytLogger as mylog
 
 class IOHandlerFLASH(BaseIOHandler):
     _particle_reader = False
@@ -87,3 +88,26 @@
         tr = f["/%s" % field][grid.id - grid._id_offset].transpose()[sl]
         return tr.astype("float64")
 
+    def _read_fluid_selection(self, chunks, selector, fields, size):
+        if any((ftype != "gas" for ftype, fname in fields)):
+            raise NotImplementedError
+        f = self._handle
+        rv = {}
+        for field in fields:
+            ftype, fname = field
+            rv[field] = na.empty(size, dtype=f["/%s" % fname].dtype)
+        ng = sum(len(c.objs) for c in chunks)
+        mylog.debug("Reading %s cells of %s fields in %s blocks",
+                    size, [f2 for f1, f2 in fields], ng)
+        for field in fields:
+            ftype, fname = field
+            ds = f["/%s" % fname]
+            ind = 0
+            for chunk in chunks:
+                for g in chunk.objs:
+                    mask = g.select(selector) # caches
+                    if mask is None: continue
+                    data = ds[g.id - g._id_offset,:,:,:].transpose()[mask]
+                    rv[field][ind:ind+data.size] = data
+                    ind += data.size
+        return rv

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

--

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