[Yt-svn] yt: Slight modification to the directional padding calculation m...

hg at spacepope.org hg at spacepope.org
Thu Jun 3 11:06:32 PDT 2010


hg Repository: yt
details:   yt/rev/5f2eeda09fa5
changeset: 1720:5f2eeda09fa5
user:      Stephen Skory <stephenskory at yahoo.com>
date:
Thu Jun 03 11:06:11 2010 -0700
description:
Slight modification to the directional padding calculation method
for Parallel HOP.

diffstat:

 yt/lagos/HaloFinding.py |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (32 lines):

diff -r 8eb6996dd5f1 -r 5f2eeda09fa5 yt/lagos/HaloFinding.py
--- a/yt/lagos/HaloFinding.py	Tue Jun 01 09:51:42 2010 -0700
+++ b/yt/lagos/HaloFinding.py	Thu Jun 03 11:06:11 2010 -0700
@@ -1156,7 +1156,8 @@
         # Adaptive subregions by bisection.
         ds_names = ["particle_position_x","particle_position_y","particle_position_z"]
         if ytcfg.getboolean("yt","inline") == False and \
-           resize and self._mpi_get_size() != 1:
+            resize and self._mpi_get_size() != 1:
+            random.seed(self._mpi_get_rank())
             cut_list = self._partition_hierarchy_3d_bisection_list()
             root_points = self._subsample_points()
             self.bucket_bounds = []
@@ -1193,6 +1194,8 @@
         # Another approach to padding, perhaps more accurate.
         elif fancy_padding and self._distributed:
             LE_padding, RE_padding = na.empty(3,dtype='float64'), na.empty(3,dtype='float64')
+            avg_spacing = (float(vol) / data.size)**(1./3.)
+            base_padding = (self.num_neighbors)**(1./3.) * self.safety * avg_spacing
             for dim in xrange(3):
                 if ytcfg.getboolean("yt","inline") == False:
                     data = self._data_source[ds_names[dim]]
@@ -1202,7 +1205,8 @@
                 width = self._data_source.right_edge[dim] - self._data_source.left_edge[dim]
                 area = (self._data_source.right_edge[(dim+1)%3] - self._data_source.left_edge[(dim+1)%3]) * \
                     (self._data_source.right_edge[(dim+2)%3] - self._data_source.left_edge[(dim+2)%3])
-                bin_width = float(width)/float(num_bins)
+                bin_width = base_padding
+                num_bins = int(math.ceil(width / bin_width))
                 bins = na.arange(num_bins+1, dtype='float64') * bin_width + self._data_source.left_edge[dim]
                 counts, bins = na.histogram(data, bins, new=True)
                 # left side.



More information about the yt-svn mailing list