[Yt-svn] yt-commit r1717 - trunk/yt/lagos
mturk at wrangler.dreamhost.com
mturk at wrangler.dreamhost.com
Thu May 6 20:35:06 PDT 2010
Author: mturk
Date: Thu May 6 20:35:05 2010
New Revision: 1717
URL: http://yt.enzotools.org/changeset/1717
Log:
Fixing Chombo
Modified:
trunk/yt/lagos/BaseGridType.py
trunk/yt/lagos/HierarchyType.py
trunk/yt/lagos/OutputTypes.py
Modified: trunk/yt/lagos/BaseGridType.py
==============================================================================
--- trunk/yt/lagos/BaseGridType.py (original)
+++ trunk/yt/lagos/BaseGridType.py Thu May 6 20:35:05 2010
@@ -662,13 +662,31 @@
class ChomboGrid(AMRGridPatch):
_id_offset = 0
- __slots__ = ["_level_id"]
- def __init__(self, id, hierarchy, level = -1):
+ __slots__ = ["_level_id", "stop_index"]
+ def __init__(self, id, hierarchy, level, start, stop):
AMRGridPatch.__init__(self, id, filename = hierarchy.hierarchy_filename,
hierarchy = hierarchy)
self.Parent = []
self.Children = []
self.Level = level
+ self.start_index = start.copy()#.transpose()
+ self.stop_index = stop.copy()#.transpose()
+ self.ActiveDimensions = stop - start + 1
+
+ def _setup_dx(self):
+ # So first we figure out what the index is. We don't assume
+ # that dx=dy=dz , at least here. We probably do elsewhere.
+ id = self.id - self._id_offset
+ if len(self.Parent) > 0:
+ self.dds = self.Parent[0].dds / self.pf["RefineBy"]
+ else:
+ LE, RE = self.hierarchy.grid_left_edge[id,:], \
+ self.hierarchy.grid_right_edge[id,:]
+ self.dds = na.array((RE-LE)/self.ActiveDimensions)
+ if self.pf["TopGridRank"] < 2: self.dds[1] = 1.0
+ if self.pf["TopGridRank"] < 3: self.dds[2] = 1.0
+ self.data['dx'], self.data['dy'], self.data['dz'] = self.dds
+
class TigerGrid(AMRGridPatch):
_id_offset = 0
Modified: trunk/yt/lagos/HierarchyType.py
==============================================================================
--- trunk/yt/lagos/HierarchyType.py (original)
+++ trunk/yt/lagos/HierarchyType.py Thu May 6 20:35:05 2010
@@ -1285,20 +1285,16 @@
boxes = f[lev]['boxes'].value
dx = f[lev].attrs['dx']
for level_id, box in enumerate(boxes):
- self.grids.append(self.grid(len(self.grids),self,level=level_number))
+ si = na.array([box['lo_%s' % ax] for ax in 'ijk'])
+ ei = na.array([box['hi_%s' % ax] for ax in 'ijk'])
+ pg = self.grid(len(self.grids),self,level=level_number,
+ start = si, stop = ei)
+ self.grids.append(pg)
self.grids[-1]._level_id = level_id
- self.grid_left_edge[i] = dx*na.array([box['lo_i'],
- box['lo_j'],
- box['lo_k']],
- dtype=self.float_type)
- self.grid_right_edge[i] = dx*(na.array([box['hi_i'],
- box['hi_j'],
- box['hi_k']],
- dtype=self.float_type) + 1)
+ self.grid_left_edge[i] = dx*si.astype(self.float_type)
+ self.grid_right_edge[i] = dx*(ei.astype(self.float_type) + 1)
self.grid_particle_count[i] = 0
- self.grid_dimensions[i] = na.array([box['hi_i']-box['lo_i'],
- box['hi_j']-box['lo_j'],
- box['hi_k']-box['lo_k']]) + 1
+ self.grid_dimensions[i] = ei - si + 1
i += 1
self.grids = na.array(self.grids, dtype='object')
Modified: trunk/yt/lagos/OutputTypes.py
==============================================================================
--- trunk/yt/lagos/OutputTypes.py (original)
+++ trunk/yt/lagos/OutputTypes.py Thu May 6 20:35:05 2010
@@ -650,6 +650,11 @@
self.field_info = self._fieldinfo_class()
# hardcoded for now
self.parameters["InitialTime"] = 0.0
+ # These should be explicitly obtained from the file, but for now that
+ # will wait until a reorganization of the source tree and better
+ # generalization.
+ self.parameters["TopGridRank"] = 3
+ self.parameters["RefineBy"] = 2
def _set_units(self):
"""
More information about the yt-svn
mailing list