[yt-svn] commit/yt: samskillman: Fixing grid left and right edge calculations so that they stick to the right boundaries. It may be SLOW, but it's a quick fix during the workshop.
Bitbucket
commits-noreply at bitbucket.org
Thu Jan 26 09:45:58 PST 2012
1 new commit in yt:
https://bitbucket.org/yt_analysis/yt/changeset/b0d44092a4ce/
changeset: b0d44092a4ce
branch: yt
user: samskillman
date: 2012-01-26 18:44:19
summary: Fixing grid left and right edge calculations so that they stick to the right boundaries. It may be SLOW, but it's a quick fix during the workshop.
affected #: 1 file
diff -r 26414b24d95594d0040dcedcc5bc5a473a699e24 -r b0d44092a4ce4684e35d5d56182a2f03348a1888 yt/frontends/flash/data_structures.py
--- a/yt/frontends/flash/data_structures.py
+++ b/yt/frontends/flash/data_structures.py
@@ -131,11 +131,20 @@
self.grids = na.empty(self.num_grids, dtype='object')
for i in xrange(self.num_grids):
self.grids[i] = self.grid(i+1, self, self.grid_levels[i,0])
- dx = ((self.parameter_file.domain_right_edge -
- self.parameter_file.domain_left_edge)/
- self.parameter_file.refine_by**(self.grid_levels.max())).astype('float64')
- self.grid_left_edge = na.rint(self.grid_left_edge/dx)*dx
- self.grid_right_edge = na.rint(self.grid_right_edge/dx)*dx
+
+
+ # This is a possibly slow and verbose fix, and should be re-examined!
+ rdx = (self.parameter_file.domain_right_edge -
+ self.parameter_file.domain_left_edge)/self.parameter_file.domain_dimensions
+ nlevels = self.grid_levels.max()
+ dxs = na.zeros((nlevels+1,3),dtype='float64')
+ for i in range(nlevels+1):
+ dxs[i] = rdx/self.parameter_file.refine_by**i
+
+ for i in xrange(self.num_grids):
+ dx = dxs[self.grid_levels[i],:]
+ self.grid_left_edge[i] = na.rint(self.grid_left_edge[i]/dx)*dx
+ self.grid_right_edge[i] = na.rint(self.grid_right_edge[i]/dx)*dx
def _populate_grid_objects(self):
# We only handle 3D data, so offset is 7 (nfaces+1)
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
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