[yt-svn] commit/yt: MatthewTurk: Account for some really tough round-off cases

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Mon Aug 8 15:17:40 PDT 2016


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/2ecca0373b9b/
Changeset:   2ecca0373b9b
Branch:      yt
User:        MatthewTurk
Date:        2016-08-08 19:52:25+00:00
Summary:     Account for some really tough round-off cases
Affected #:  1 file

diff -r 1a9c9ab1575b1d2fc4ce517acc44074cf333a4c7 -r 2ecca0373b9b24eb84bd4dbd1d5c874ad3a6d0bc yt/utilities/lib/grid_traversal.pyx
--- a/yt/utilities/lib/grid_traversal.pyx
+++ b/yt/utilities/lib/grid_traversal.pyx
@@ -110,6 +110,13 @@
             # We are somewhere in the middle of the face
             temp_x = intersect_t * v_dir[i] + v_pos[i] # current position
             temp_y = ((temp_x - vc.left_edge[i])*vc.idds[i])
+            # There are some really tough cases where we just within a couple
+            # least significant places of the edge, and this helps prevent
+            # killing the calculation through a segfault in those cases.
+            if -1 < temp_y < 0 and step[i] > 0:
+                temp_y = 0.0
+            elif vc.dims[i] - 1 < temp_y < vc.dims[i] and step[i] < 0:
+                temp_y = vc.dims[i] - 1
             cur_ind[i] =  <int> (floor(temp_y))
         if step[i] > 0:
             temp_y = (cur_ind[i] + 1) * vc.dds[i] + vc.left_edge[i]

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