[Yt-svn] yt-commit r1525 - trunk/yt/extensions
dcollins at wrangler.dreamhost.com
dcollins at wrangler.dreamhost.com
Fri Nov 13 10:17:26 PST 2009
Author: dcollins
Date: Fri Nov 13 10:17:25 2009
New Revision: 1525
URL: http://yt.enzotools.org/changeset/1525
Log:
Added return_bottom_clumps to clump_tools
Modified:
trunk/yt/extensions/clump_tools.py
Modified: trunk/yt/extensions/clump_tools.py
==============================================================================
--- trunk/yt/extensions/clump_tools.py (original)
+++ trunk/yt/extensions/clump_tools.py Fri Nov 13 10:17:25 2009
@@ -48,6 +48,7 @@
level = depth of hierarchy
number = index of clump in the final array
parentnumber = index of this clumps parent
+
"""
global counter
counter = 0
@@ -58,6 +59,29 @@
recursive_all_clumps(clump,list,level,parentnumber)
return list
+def return_bottom_clumps(clump,dbg=0):
+ """Recursively return clumps at the bottom of the hierarchy.
+ This gives a list of clumps similar to what one would get from a CLUMPFIND routine"""
+ global counter
+ counter = 0
+ list = []
+ level = 0
+ recursive_bottom_clumps(clump,list,dbg,level)
+ return list
+def recursive_bottom_clumps(clump,clump_list, dbg = 0,level=0):
+ """Loops over a list of clumps (clumps) and fills clump_list with the bottom most.
+ Recursive. Prints the level and the number of cores to the screen."""
+
+ global counter
+ if dbg > 0:
+ print tabs(level), "l =",level, "n_core",counter
+
+ if ((clump.children is None) or (len(clump.children) == 0)):
+ counter += 1
+ clump_list.append( clump )
+ else:
+ for child in clump.children:
+ recursive_bottom_clumps(child,clump_list,dbg=dbg,level=level+1)
def clump_list_sort(clump_list):
"""Returns a copy of clump_list, sorted by ascending minimum density.
More information about the yt-svn
mailing list