[yt-svn] commit/yt: MatthewTurk: Merged in MatthewTurk/yt/yt-3.0 (pull request #941)

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Tue Jun 10 12:08:12 PDT 2014


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/4212f2e4935a/
Changeset:   4212f2e4935a
Branch:      yt-3.0
User:        MatthewTurk
Date:        2014-06-10 21:08:03
Summary:     Merged in MatthewTurk/yt/yt-3.0 (pull request #941)

Make save_octree operate on leaf nodes
Affected #:  2 files

diff -r a83501174991ae2fae2b7a4aa4f9234296976cf3 -r 4212f2e4935a998a06fceea23f1382976ef2748a yt/geometry/oct_container.pyx
--- a/yt/geometry/oct_container.pyx
+++ b/yt/geometry/oct_container.pyx
@@ -122,6 +122,8 @@
         cdef int i, j, k, n
         data.global_index = -1
         data.level = 0
+        data.oref = 0
+        data.nz = 1
         assert(ref_mask.shape[0] / float(data.nz) ==
             <int>(ref_mask.shape[0]/float(data.nz)))
         obj.allocate_domains([ref_mask.shape[0] / data.nz])
@@ -496,7 +498,7 @@
             coords[:,i] += self.DLE[i]
         return coords
 
-    def save_octree(self, always_descend = False):
+    def save_octree(self):
         # Get the header
         header = dict(dims = (self.nn[0], self.nn[1], self.nn[2]),
                       left_edge = (self.DLE[0], self.DLE[1], self.DLE[2]),
@@ -507,13 +509,12 @@
         # domain_id = -1 here, because we want *every* oct
         cdef OctVisitorData data
         self.setup_data(&data, -1)
-        data.oref = 1
+        data.oref = 0
+        data.nz = 1
         cdef np.ndarray[np.uint8_t, ndim=1] ref_mask
         ref_mask = np.zeros(self.nocts * data.nz, dtype="uint8") - 1
-        cdef void *p[2]
-        cdef np.uint8_t ad = int(always_descend)
-        p[0] = <void *> &ad
-        p[1] = ref_mask.data
+        cdef void *p[1]
+        p[0] = ref_mask.data
         data.array = p
         # Enforce partial_coverage here
         self.visit_all_octs(selector, oct_visitors.store_octree, &data, 1)

diff -r a83501174991ae2fae2b7a4aa4f9234296976cf3 -r 4212f2e4935a998a06fceea23f1382976ef2748a yt/geometry/oct_visitors.pyx
--- a/yt/geometry/oct_visitors.pyx
+++ b/yt/geometry/oct_visitors.pyx
@@ -179,12 +179,8 @@
     cdef np.uint8_t *arr, res, ii, *always_descend
     ii = cind(data.ind[0], data.ind[1], data.ind[2])
     cdef void **p = <void **> data.array
-    always_descend = <np.uint8_t *> p[0]
-    arr = <np.uint8_t *> p[1]
-    if always_descend[0] == 1 and data.last == o.domain_ind:
-        return
-    data.last = o.domain_ind
-    if o.children == NULL or o.children[ii] == NULL:
+    arr = <np.uint8_t *> p[0]
+    if o.children == NULL:
         # Not refined.
         res = 0
     else:
@@ -216,7 +212,7 @@
             o.children = <Oct **> malloc(sizeof(Oct *) * 8)
             for i in range(8):
                 o.children[i] = NULL
-        for i in range(arr[data.index]):
+        for i in range(8):
             o.children[ii + i] = &octs[nocts[0]]
             o.children[ii + i].domain_ind = nocts[0]
             o.children[ii + i].file_ind = -1

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