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

mturk at wrangler.dreamhost.com mturk at wrangler.dreamhost.com
Sat Jan 5 14:54:42 PST 2008


Author: mturk
Date: Sat Jan  5 14:54:40 2008
New Revision: 355
URL: http://yt.spacepope.org/changeset/355

Log:
Flushing fields *back* to grids after modification.  Experimental...  for a
project I'm working on today at SuperHappyDevHouse(dot org)



Modified:
   trunk/yt/lagos/BaseDataTypes.py

Modified: trunk/yt/lagos/BaseDataTypes.py
==============================================================================
--- trunk/yt/lagos/BaseDataTypes.py	(original)
+++ trunk/yt/lagos/BaseDataTypes.py	Sat Jan  5 14:54:40 2008
@@ -878,6 +878,17 @@
                 return t[pointI].ravel()
             return grid[field][pointI].ravel()
 
+    def _flush_data_to_grids(self, field, default_val, dtype='float32'):
+        # Kind of a dangerous thing to do
+        i = 0
+        for grid in self._grids:
+            pointI = self._get_point_indices
+            new_field = na.ones(grid.ActiveDimensions, dtype=dtype) * default_val
+            np = pointI[0].ravel().size
+            new_field[pointI] = self[field][i:i+np]
+            grid[field] = new_field.copy()
+            i += np
+
     def _generate_field(self, field):
         if fieldInfo.has_key(field):
             # First we check the validator



More information about the yt-svn mailing list