[Yt-svn] yt-commit r801 - trunk/yt/lagos

mturk at wrangler.dreamhost.com mturk at wrangler.dreamhost.com
Thu Sep 25 08:35:51 PDT 2008


Author: mturk
Date: Thu Sep 25 08:35:50 2008
New Revision: 801
URL: http://yt.spacepope.org/changeset/801

Log:
Initial add of simple in-memory data queue



Modified:
   trunk/yt/lagos/DataReadingFuncs.py

Modified: trunk/yt/lagos/DataReadingFuncs.py
==============================================================================
--- trunk/yt/lagos/DataReadingFuncs.py	(original)
+++ trunk/yt/lagos/DataReadingFuncs.py	Thu Sep 25 08:35:50 2008
@@ -203,3 +203,21 @@
             mylog.debug("Read %s items from %s", len(data), os.path.basename(file))
             for gid in data: self.queue[gid].update(data[gid])
         mylog.debug("Finished read of %s", sets)
+
+class DataQueueInMemory(BaseDataQueue):
+    def __init__(self, grids_in_memory, ghost_zones=2):
+        self.grids_in_memory = grids_in_memory
+        self.my_slice = (slice(ghost_zones,-ghost_zones),
+                      slice(ghost_zones,-ghost_zones),
+                      slice(ghost_zones,-ghost_zones))
+        BaseDataQueue.__init__(self)
+
+    def _read_set(self, grid, field):
+        if grid.id not in self.grids_in_memory: raise KeyError
+        return self.grids_in_memory[grid.id][field][self.my_slice]
+
+    def modify(self, field):
+        return field.swapaxes(0,2)
+
+    def preload(self, grids, sets):
+        pass



More information about the yt-svn mailing list