[Yt-svn] commit/yt: samskillman: Adding a count_cells function to the AMRKDTree. Using it to test some performance.
Bitbucket
commits-noreply at bitbucket.org
Sun Aug 28 16:41:50 PDT 2011
1 new changeset in yt:
http://bitbucket.org/yt_analysis/yt/changeset/9cb628620da6/
changeset: 9cb628620da6
branch: yt
user: samskillman
date: 2011-08-29 01:41:36
summary: Adding a count_cells function to the AMRKDTree. Using it to test some performance.
affected #: 1 file (416 bytes)
--- a/yt/utilities/amr_kdtree/amr_kdtree.py Fri Aug 26 13:57:33 2011 -0600
+++ b/yt/utilities/amr_kdtree/amr_kdtree.py Sun Aug 28 17:41:36 2011 -0600
@@ -789,6 +789,24 @@
v += na.prod(node.r_corner - node.l_corner)
return v
+ def count_cells(self):
+ r"""Calculates the numbers of cells of the kd-Tree
+
+ Parameters
+ ----------
+ None
+
+ Returns
+ ----------
+ Total volume of the tree.
+
+ """
+ c = na.int64(0)
+ for node in self.depth_traverse():
+ if node.grid is not None:
+ c += na.prod(node.ri - node.li).astype('int64')
+ return c
+
def _build(self, grids, parent, l_corner, r_corner):
r"""Builds the AMR kd-Tree
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