[yt-svn] commit/yt: MatthewTurk: Adding a grid_collection_max_level data object. This does not mask child cells
Bitbucket
commits-noreply at bitbucket.org
Fri Jun 1 14:28:26 PDT 2012
1 new commit in yt:
https://bitbucket.org/yt_analysis/yt/changeset/63ff8d95dc50/
changeset: 63ff8d95dc50
branch: yt
user: MatthewTurk
date: 2012-06-01 23:28:10
summary: Adding a grid_collection_max_level data object. This does not mask child cells
at a higher resolution than "max_level," and it takes all grids.
http://paste.yt-project.org/show/2413/
affected #: 1 file
diff -r a437280f3cefff3e7a41198438a5dfb7922f74e5 -r 63ff8d95dc5053e2b4811fea925fff04a5e7eb34 yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -495,7 +495,7 @@
self._sorted = {}
def get_data(self, fields=None, in_grids=False):
- if self._grids == None:
+ if self._grids is None:
self._get_list_of_grids()
points = []
if not fields:
@@ -3292,6 +3292,40 @@
pointI = na.where(k == True)
return pointI
+class AMRMaxLevelCollection(AMR3DData):
+ _type_name = "grid_collection_max_level"
+ _con_args = ("center", "max_level")
+ def __init__(self, center, max_level, fields = None,
+ pf = None, **kwargs):
+ """
+ By selecting an arbitrary *max_level*, we can act on those grids.
+ Child cells are masked when the level of the grid is below the max
+ level.
+ """
+ AMR3DData.__init__(self, center, fields, pf, **kwargs)
+ self.max_level = max_level
+ self._refresh_data()
+
+ def _get_list_of_grids(self):
+ if self._grids is not None: return
+ gi = (self.pf.h.grid_levels <= self.max_level)[:,0]
+ self._grids = self.pf.h.grids[gi]
+
+ def _is_fully_enclosed(self, grid):
+ return True
+
+ @cache_mask
+ def _get_cut_mask(self, grid):
+ return na.ones(grid.ActiveDimensions, dtype='bool')
+
+ def _get_point_indices(self, grid, use_child_mask=True):
+ k = na.ones(grid.ActiveDimensions, dtype='bool')
+ if use_child_mask and grid.Level < self.max_level:
+ k[grid.child_indices] = False
+ pointI = na.where(k == True)
+ return pointI
+
+
class AMRSphereBase(AMR3DData):
"""
A sphere of points
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