[yt-svn] commit/yt: MatthewTurk: This should fix the case where you have a grid bumping up against a tile
Bitbucket
commits-noreply at bitbucket.org
Wed Jan 18 08:28:35 PST 2012
1 new commit in yt:
https://bitbucket.org/yt_analysis/yt/changeset/33df4ef9f06c/
changeset: 33df4ef9f06c
branch: yt
user: MatthewTurk
date: 2012-01-18 17:28:27
summary: This should fix the case where you have a grid bumping up against a tile
boundary and seeing > 1 level jump in refinement. For now I am only aware of
this happening in Enzo, and only when the tile is at level 0. This should not
result in substantial performance degradation for situations where this is not
a problem.
affected #: 1 file
diff -r 312dbb4afefe188d7140a75f277d157e20405b5a -r 33df4ef9f06cb84a31535bb15727de575eb9210a yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -3492,8 +3492,19 @@
def _get_list_of_grids(self):
if self._grids is not None: return
+ # Check for ill-behaved AMR schemes (Enzo) where we may have
+ # root-tile-boundary issues. This is specific to the root tiles not
+ # allowing grids to cross them and also allowing > 1 level of
+ # difference between neighboring areas.
+ nz = 0
+ buf = 0.0
+ d1 = ((self.global_startindex.astype("float64") - 1)
+ / (self.pf.refine_by**self.level))
+ if na.any(d1 == na.rint(d1)):
+ nz = 2 * self.pf.refine_by**self.level
+ buf = self._base_dx
cg = self.pf.h.covering_grid(self.level,
- self.left_edge, self.ActiveDimensions)
+ self.left_edge - buf, self.ActiveDimensions + nz)
cg._use_pbar = False
count = cg.ActiveDimensions.prod()
for g in cg._grids:
@@ -3501,15 +3512,16 @@
if count <= 0:
min_level = g.Level
break
- # We reverse the order to ensure that coarse grids are first
- if na.any(self.left_edge < self.pf.domain_left_edge) or \
- na.any(self.right_edge > self.pf.domain_right_edge):
+ # This should not cost substantial additional time.
+ BLE = self.left_edge - buf
+ BRE = self.right_edge + buf
+ if na.any(BLE < self.pf.domain_left_edge) or \
+ na.any(BRE > self.pf.domain_right_edge):
grids,ind = self.pf.hierarchy.get_periodic_box_grids_below_level(
- self.left_edge, self.right_edge, self.level,
- min_level)
+ BLE, BRE, self.level, min_level)
else:
grids,ind = self.pf.hierarchy.get_box_grids_below_level(
- self.left_edge, self.right_edge, self.level,
+ BLE, BRE, self.level,
min(self.level, min_level))
sort_ind = na.argsort(self.pf.h.grid_levels.ravel()[ind])
self._grids = self.pf.hierarchy.grids[ind][(sort_ind,)]
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