[yt-svn] commit/yt-3.0: 2 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Thu Jun 20 16:10:16 PDT 2013


2 new commits in yt-3.0:

https://bitbucket.org/yt_analysis/yt-3.0/commits/8585c00bb2d9/
Changeset:   8585c00bb2d9
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-06-21 00:33:24
Summary:     This small change to how buffers are filled fixes a terrible bug.

The bug is not terrible in that it causes really bad, horrible, incorrect
answers -- no, it's bad in that it took me four days to track it down and it
was relatively simple, but I tore apart most of the code trying to search for
it.  This included looking at i,j,k,n ordering, examining hundreds of thousands
of possibly Oct combinations, and so on.  But the real issue was that during
deposition of a particle field, sometimes we'd simply overrun the precision
that we can rely upon during the traversal not of the *octree*, but of the
*quadtree* that builds our projections.  So rather than adding/subtracting
(where the error built up) I created a new temporary variable, on the stack,
that stores the necessary information to reconstruct the previous state of the
node.

I have to say, this entire process of tracking this bug down was fun in that it
was extremely satisfying, but also a bit of a wild goose change.

Anyway, this is the tiny commit that will be merged in immediately as I prepare
the rest of the new Octree stuff for inclusion.
Affected #:  1 file

diff -r 6f22f08f086adad2954c0efecd766713008bc66e -r 8585c00bb2d9ddebf026fa19cdc65cb35e1b6da2 yt/utilities/lib/QuadTree.pyx
--- a/yt/utilities/lib/QuadTree.pyx
+++ b/yt/utilities/lib/QuadTree.pyx
@@ -342,6 +342,7 @@
 
     @cython.boundscheck(False)
     @cython.wraparound(False)
+    @cython.cdivision(True)
     def get_all(self, int count_only = 0, int style = 1):
         cdef int i, j, vi
         cdef int total = 0
@@ -391,6 +392,7 @@
                 count += self.count(node.children[i][j])
         return count
 
+    @cython.cdivision(True)
     cdef int fill(self, QuadTreeNode *node, 
                         np.int64_t curpos,
                         np.float64_t *px,
@@ -403,6 +405,8 @@
                         np.float64_t wtoadd,
                         np.int64_t level):
         cdef int i, j, n
+        cdef np.float64_t *vorig
+        vorig = <np.float64_t *> alloca(sizeof(np.float64_t) * self.nvals)
         if node.children[0][0] == NULL:
             if self.merged == -1:
                 for i in range(self.nvals):
@@ -422,6 +426,7 @@
         cdef np.int64_t added = 0
         if self.merged == 1:
             for i in range(self.nvals):
+                vorig[i] = vtoadd[i]
                 vtoadd[i] += node.val[i]
             wtoadd += node.weight_val
         elif self.merged == -1:
@@ -437,7 +442,7 @@
                         vtoadd, wtoadd, level + 1)
         if self.merged == 1:
             for i in range(self.nvals):
-                vtoadd[i] -= node.val[i]
+                vtoadd[i] = vorig[i]
             wtoadd -= node.weight_val
         return added
 


https://bitbucket.org/yt_analysis/yt-3.0/commits/0d87f2e70ec6/
Changeset:   0d87f2e70ec6
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-06-21 01:10:10
Summary:     Merged in MatthewTurk/yt-3.0 (pull request #53)

This small change to how buffers are filled fixes a terrible bug.
Affected #:  1 file

diff -r cea962acce9864de0213bbad0b67e03b37fe5ee2 -r 0d87f2e70ec6ddb462527ec5eafb25c41a88d5e9 yt/utilities/lib/QuadTree.pyx
--- a/yt/utilities/lib/QuadTree.pyx
+++ b/yt/utilities/lib/QuadTree.pyx
@@ -342,6 +342,7 @@
 
     @cython.boundscheck(False)
     @cython.wraparound(False)
+    @cython.cdivision(True)
     def get_all(self, int count_only = 0, int style = 1):
         cdef int i, j, vi
         cdef int total = 0
@@ -391,6 +392,7 @@
                 count += self.count(node.children[i][j])
         return count
 
+    @cython.cdivision(True)
     cdef int fill(self, QuadTreeNode *node, 
                         np.int64_t curpos,
                         np.float64_t *px,
@@ -403,6 +405,8 @@
                         np.float64_t wtoadd,
                         np.int64_t level):
         cdef int i, j, n
+        cdef np.float64_t *vorig
+        vorig = <np.float64_t *> alloca(sizeof(np.float64_t) * self.nvals)
         if node.children[0][0] == NULL:
             if self.merged == -1:
                 for i in range(self.nvals):
@@ -422,6 +426,7 @@
         cdef np.int64_t added = 0
         if self.merged == 1:
             for i in range(self.nvals):
+                vorig[i] = vtoadd[i]
                 vtoadd[i] += node.val[i]
             wtoadd += node.weight_val
         elif self.merged == -1:
@@ -437,7 +442,7 @@
                         vtoadd, wtoadd, level + 1)
         if self.merged == 1:
             for i in range(self.nvals):
-                vtoadd[i] -= node.val[i]
+                vtoadd[i] = vorig[i]
             wtoadd -= node.weight_val
         return added

Repository URL: https://bitbucket.org/yt_analysis/yt-3.0/

--

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