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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Fri Oct 25 10:32:20 PDT 2013


6 new commits in yt-3.0:

https://bitbucket.org/yt_analysis/yt-3.0/commits/9885388169e7/
Changeset:   9885388169e7
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-10-24 22:31:25
Summary:     Update load/save octree to work with partially-covered octrees.
Affected #:  3 files

diff -r 9cd06e4233044a84bc4f8c880a4e45417816f316 -r 9885388169e70b8641d0fb347b005d232d8be1ad yt/frontends/stream/data_structures.py
--- a/yt/frontends/stream/data_structures.py
+++ b/yt/frontends/stream/data_structures.py
@@ -1051,7 +1051,8 @@
                       left_edge = self.pf.domain_left_edge,
                       right_edge = self.pf.domain_right_edge,
                       octree = self.pf.octree_mask,
-                      over_refine = self.pf.over_refine_factor)
+                      over_refine = self.pf.over_refine_factor,
+                      partial_coverage = 1)
         self.oct_handler = OctreeContainer.load_octree(header)
 
     def _identify_base_chunk(self, dobj):
@@ -1113,7 +1114,10 @@
     Parameters
     ----------
     octree_mask : np.ndarray[uint8_t]
-        This is a depth-first refinement mask for an Octree.
+        This is a depth-first refinement mask for an Octree.  It should be of
+        size n_octs * 8, where each item is 1 for an oct-cell being refined and
+        0 for it not being refined.  Note that for over_refine_factors != 1,
+        the children count will still be 8, so this is always 8.
     data : dict
         A dictionary of 1D arrays.  Note that these must of the size of the
         number of "False" values in the ``octree_mask``.

diff -r 9cd06e4233044a84bc4f8c880a4e45417816f316 -r 9885388169e70b8641d0fb347b005d232d8be1ad yt/geometry/oct_container.pyx
--- a/yt/geometry/oct_container.pyx
+++ b/yt/geometry/oct_container.pyx
@@ -120,12 +120,15 @@
         cdef np.ndarray[np.uint8_t, ndim=1] ref_mask
         ref_mask = header['octree']
         cdef OctreeContainer obj = cls(header['dims'], header['left_edge'],
-                header['right_edge'], over_refine = header['over_refine'])
+                header['right_edge'], over_refine = header['over_refine'],
+                partial_coverage = header['partial_coverage'])
         # NOTE: We do not allow domain/file indices to be specified.
         cdef SelectorObject selector = selection_routines.AlwaysSelector(None)
         cdef OctVisitorData data
         obj.setup_data(&data, -1)
-        obj.allocate_domains([ref_mask.shape[0]])
+        assert(ref_mask.shape[0] / 8.0 == <int>(ref_mask.shape[0]/8.0))
+        print ref_mask.shape[0], ref_mask.shape[0]/8.0
+        obj.allocate_domains([ref_mask.shape[0] / 8.0])
         cdef int i, j, k, n
         data.global_index = -1
         data.level = 0
@@ -159,6 +162,7 @@
                     data.pos[0] = i
                     data.pos[1] = j
                     data.pos[2] = k
+                    # Always visit covered
                     selector.recursively_visit_octs(
                         obj.root_mesh[i][j][k],
                         pos, dds, 0, oct_visitors.load_octree,
@@ -167,9 +171,10 @@
                 pos[1] += dds[1]
             pos[0] += dds[0]
         obj.nocts = cur.n_assigned
-        if obj.nocts != ref_mask.size:
+        if obj.nocts * 8 != ref_mask.size:
             print "SOMETHING WRONG", ref_mask.size, obj.nocts, obj.oref
-            raise RuntimeError
+            raise KeyError(ref_mask.size, obj.nocts, obj.oref,
+                obj.partial_coverage)
         return obj
 
     cdef void setup_data(self, OctVisitorData *data, int domain_id = -1):
@@ -499,14 +504,16 @@
         header = dict(dims = (self.nn[0], self.nn[1], self.nn[2]),
                       left_edge = (self.DLE[0], self.DLE[1], self.DLE[2]),
                       right_edge = (self.DRE[0], self.DRE[1], self.DRE[2]),
-                      over_refine = self.oref)
+                      over_refine = self.oref,
+                      partial_coverage = self.partial_coverage)
         cdef SelectorObject selector = selection_routines.AlwaysSelector(None)
         # domain_id = -1 here, because we want *every* oct
         cdef OctVisitorData data
         self.setup_data(&data, -1)
         cdef np.ndarray[np.uint8_t, ndim=1] ref_mask
-        ref_mask = np.zeros(self.nocts, dtype="uint8") - 1
+        ref_mask = np.zeros(self.nocts * 8, dtype="uint8") - 1
         data.array = <void *> ref_mask.data
+        # Enforce partial_coverage here
         self.visit_all_octs(selector, oct_visitors.store_octree, &data, 1)
         header['octree'] = ref_mask
         return header

diff -r 9cd06e4233044a84bc4f8c880a4e45417816f316 -r 9885388169e70b8641d0fb347b005d232d8be1ad yt/geometry/oct_visitors.pyx
--- a/yt/geometry/oct_visitors.pyx
+++ b/yt/geometry/oct_visitors.pyx
@@ -176,15 +176,15 @@
     arr[o.domain - 1] += 1
 
 cdef void store_octree(Oct *o, OctVisitorData *data, np.uint8_t selected):
-    cdef np.uint8_t *arr
-    if data.last != o.domain_ind:
-        data.last = o.domain_ind
-        arr = <np.uint8_t *> data.array
-        if o.children == NULL:
-            arr[data.index] = 0
-        if o.children != NULL:
-            arr[data.index] = 1
-        data.index += 1
+    cdef np.uint8_t *arr, res, ii
+    ii = cind(data.ind[2], data.ind[1], data.ind[0])
+    arr = <np.uint8_t *> data.array
+    if o.children == NULL or o.children[ii] == NULL:
+        res = 0
+    else:
+        res = 1
+    arr[data.index] = res
+    data.index += 1
 
 cdef void load_octree(Oct *o, OctVisitorData *data, np.uint8_t selected):
     cdef void **p = <void **> data.array
@@ -192,21 +192,22 @@
     cdef Oct* octs = <Oct*> p[1]
     cdef np.int64_t *nocts = <np.int64_t*> p[2]
     cdef np.int64_t *nfinest = <np.int64_t*> p[3]
-    cdef int i
-   
-    if data.last != o.domain_ind:
-        data.last = o.domain_ind
-        if arr[data.index] == 0:
-            o.children = NULL
-            o.file_ind = nfinest[0]
-            o.domain = 1
-            nfinest[0] += 1
-        if arr[data.index] == 1:
+    cdef int i, ii
+    ii = cind(data.ind[2], data.ind[1], data.ind[0])
+    if arr[data.index] == 0:
+        o.children = NULL
+        o.file_ind = nfinest[0]
+        o.domain = 1
+        nfinest[0] += 1
+    elif arr[data.index] == 1:
+        if o.children == NULL:
             o.children = <Oct **> malloc(sizeof(Oct *) * 8)
             for i in range(8):
-                o.children[i] = &octs[nocts[0]]
-                o.children[i].domain_ind = nocts[0]
-                o.children[i].file_ind = -1
-                o.children[i].domain = -1
-                nocts[0] += 1
-        data.index += 1
+                o.children[i] = NULL
+        o.children[ii] = &octs[nocts[0]]
+        o.children[ii].domain_ind = nocts[0]
+        o.children[ii].file_ind = -1
+        o.children[ii].domain = -1
+        o.children[ii].children = NULL
+        nocts[0] += 1
+    data.index += 1


https://bitbucket.org/yt_analysis/yt-3.0/commits/a0e03a112c73/
Changeset:   a0e03a112c73
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-10-24 22:55:07
Summary:     Attempting to thread partial_coverage through load_octree.
Affected #:  3 files

diff -r 9885388169e70b8641d0fb347b005d232d8be1ad -r a0e03a112c7395da8a123aaff688c135f50c4505 yt/frontends/stream/data_structures.py
--- a/yt/frontends/stream/data_structures.py
+++ b/yt/frontends/stream/data_structures.py
@@ -1052,7 +1052,7 @@
                       right_edge = self.pf.domain_right_edge,
                       octree = self.pf.octree_mask,
                       over_refine = self.pf.over_refine_factor,
-                      partial_coverage = 1)
+                      partial_coverage = self.pf.partial_coverage)
         self.oct_handler = OctreeContainer.load_octree(header)
 
     def _identify_base_chunk(self, dobj):
@@ -1102,7 +1102,7 @@
 
 def load_octree(octree_mask, data, sim_unit_to_cm,
                 bbox=None, sim_time=0.0, periodicity=(True, True, True),
-                over_refine_factor = 1):
+                over_refine_factor = 1, partial_coverage = 1):
     r"""Load an octree mask into yt.
 
     Octrees can be saved out by calling save_octree on an OctreeContainer.
@@ -1130,6 +1130,9 @@
     periodicity : tuple of booleans
         Determines whether the data will be treated as periodic along
         each axis
+    partial_coverage : boolean
+        Whether or not an oct can be refined cell-by-cell, or whether all 8 get
+        refined.
 
     """
 
@@ -1176,6 +1179,7 @@
 
     spf = StreamOctreeStaticOutput(handler)
     spf.octree_mask = octree_mask
+    spf.partial_coverage = partial_coverage
     spf.units["cm"] = sim_unit_to_cm
     spf.units['1'] = 1.0
     spf.units["unitary"] = 1.0

diff -r 9885388169e70b8641d0fb347b005d232d8be1ad -r a0e03a112c7395da8a123aaff688c135f50c4505 yt/geometry/oct_container.pyx
--- a/yt/geometry/oct_container.pyx
+++ b/yt/geometry/oct_container.pyx
@@ -127,7 +127,6 @@
         cdef OctVisitorData data
         obj.setup_data(&data, -1)
         assert(ref_mask.shape[0] / 8.0 == <int>(ref_mask.shape[0]/8.0))
-        print ref_mask.shape[0], ref_mask.shape[0]/8.0
         obj.allocate_domains([ref_mask.shape[0] / 8.0])
         cdef int i, j, k, n
         data.global_index = -1

diff -r 9885388169e70b8641d0fb347b005d232d8be1ad -r a0e03a112c7395da8a123aaff688c135f50c4505 yt/geometry/oct_visitors.pyx
--- a/yt/geometry/oct_visitors.pyx
+++ b/yt/geometry/oct_visitors.pyx
@@ -177,7 +177,7 @@
 
 cdef void store_octree(Oct *o, OctVisitorData *data, np.uint8_t selected):
     cdef np.uint8_t *arr, res, ii
-    ii = cind(data.ind[2], data.ind[1], data.ind[0])
+    ii = cind(data.ind[0], data.ind[1], data.ind[2])
     arr = <np.uint8_t *> data.array
     if o.children == NULL or o.children[ii] == NULL:
         res = 0
@@ -193,7 +193,7 @@
     cdef np.int64_t *nocts = <np.int64_t*> p[2]
     cdef np.int64_t *nfinest = <np.int64_t*> p[3]
     cdef int i, ii
-    ii = cind(data.ind[2], data.ind[1], data.ind[0])
+    ii = cind(data.ind[0], data.ind[1], data.ind[2])
     if arr[data.index] == 0:
         o.children = NULL
         o.file_ind = nfinest[0]


https://bitbucket.org/yt_analysis/yt-3.0/commits/210d9fd86ecd/
Changeset:   210d9fd86ecd
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-10-24 23:16:20
Summary:     Fixing remaining issue.  oref==0 does not currently work.
Affected #:  1 file

diff -r a0e03a112c7395da8a123aaff688c135f50c4505 -r 210d9fd86ecd652ed5fd034008ccab1cca0bec36 yt/geometry/oct_visitors.pyx
--- a/yt/geometry/oct_visitors.pyx
+++ b/yt/geometry/oct_visitors.pyx
@@ -195,10 +195,13 @@
     cdef int i, ii
     ii = cind(data.ind[0], data.ind[1], data.ind[2])
     if arr[data.index] == 0:
-        o.children = NULL
-        o.file_ind = nfinest[0]
-        o.domain = 1
-        nfinest[0] += 1
+        # We only want to do this once.  Otherwise we end up with way too many
+        # nfinest for our tastes.
+        if o.file_ind == -1:
+            o.children = NULL
+            o.file_ind = nfinest[0]
+            o.domain = 1
+            nfinest[0] += 1
     elif arr[data.index] == 1:
         if o.children == NULL:
             o.children = <Oct **> malloc(sizeof(Oct *) * 8)


https://bitbucket.org/yt_analysis/yt-3.0/commits/dd2c20258cd1/
Changeset:   dd2c20258cd1
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-10-24 23:29:14
Summary:     By setting oref and nz to 1 and 8 we visit all child *octs*.
Affected #:  1 file

diff -r 210d9fd86ecd652ed5fd034008ccab1cca0bec36 -r dd2c20258cd1f2a55d587349f666ef499ace72aa yt/geometry/oct_container.pyx
--- a/yt/geometry/oct_container.pyx
+++ b/yt/geometry/oct_container.pyx
@@ -131,6 +131,9 @@
         cdef int i, j, k, n
         data.global_index = -1
         data.level = 0
+        # This is not something I terribly like, but it needs to be done.
+        data.oref = 1
+        data.nz = 8
         cdef np.float64_t pos[3], dds[3]
         # This dds is the oct-width
         for i in range(3):
@@ -509,6 +512,8 @@
         # domain_id = -1 here, because we want *every* oct
         cdef OctVisitorData data
         self.setup_data(&data, -1)
+        data.oref = 1
+        data.nz = 8
         cdef np.ndarray[np.uint8_t, ndim=1] ref_mask
         ref_mask = np.zeros(self.nocts * 8, dtype="uint8") - 1
         data.array = <void *> ref_mask.data


https://bitbucket.org/yt_analysis/yt-3.0/commits/a95df1ddb227/
Changeset:   a95df1ddb227
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-10-24 23:47:54
Summary:     This fixes a number of issues with oref == 0.

Among other things, particle deposition for oref == 0 now works correctly.
Affected #:  1 file

diff -r dd2c20258cd1f2a55d587349f666ef499ace72aa -r a95df1ddb227309f6d75bcd817be28d377119cbe yt/geometry/oct_container.pyx
--- a/yt/geometry/oct_container.pyx
+++ b/yt/geometry/oct_container.pyx
@@ -308,8 +308,9 @@
             else:
                 next = NULL
         if oinfo == NULL: return cur
+        cdef int ncells = (1 << self.oref)
         cdef np.float64_t factor = 1.0 / (1 << (self.oref-1))
-        if self.oref == 0: factor = 1.0
+        if self.oref == 0: factor = 2.0
         for i in range(3):
             # This will happen *after* we quit out, so we need to back out the
             # last change to cp
@@ -319,13 +320,11 @@
                 cp[i] += dds[i]/2.0
             # We don't normally need to change dds[i] as it has been halved
             # from the oct width, thus making it already the cell width.
-            # But, for some cases where the oref != 1, this needs to be
-            # changed.
+            # But, since not everything has the cell width equal to have the
+            # width of the oct, we need to apply "factor".
             oinfo.dds[i] = dds[i] * factor # Cell width
-            oinfo.left_edge[i] = cp[i] - dds[i] # Center minus dds
             oinfo.ipos[i] = ipos[i]
-        if self.oref == 0:
-            oinfo.dds[i] = dds[i] # Same here as elsewhere
+            oinfo.left_edge[i] = oinfo.ipos[i] * (oinfo.dds[i] * ncells) + self.DLE[i]
         oinfo.level = level
         return cur
 


https://bitbucket.org/yt_analysis/yt-3.0/commits/9bc960be45cb/
Changeset:   9bc960be45cb
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-10-25 19:32:15
Summary:     Merged in MatthewTurk/yt-3.0 (pull request #124)

Fixes for loading and saving of octrees and oref == 0
Affected #:  3 files

diff -r d9d68aac9f0c49a052b6d8285ae4b4cebe37c882 -r 9bc960be45cb0664d924523552460752a67c5325 yt/frontends/stream/data_structures.py
--- a/yt/frontends/stream/data_structures.py
+++ b/yt/frontends/stream/data_structures.py
@@ -1051,7 +1051,8 @@
                       left_edge = self.pf.domain_left_edge,
                       right_edge = self.pf.domain_right_edge,
                       octree = self.pf.octree_mask,
-                      over_refine = self.pf.over_refine_factor)
+                      over_refine = self.pf.over_refine_factor,
+                      partial_coverage = self.pf.partial_coverage)
         self.oct_handler = OctreeContainer.load_octree(header)
 
     def _identify_base_chunk(self, dobj):
@@ -1101,7 +1102,7 @@
 
 def load_octree(octree_mask, data, sim_unit_to_cm,
                 bbox=None, sim_time=0.0, periodicity=(True, True, True),
-                over_refine_factor = 1):
+                over_refine_factor = 1, partial_coverage = 1):
     r"""Load an octree mask into yt.
 
     Octrees can be saved out by calling save_octree on an OctreeContainer.
@@ -1113,7 +1114,10 @@
     Parameters
     ----------
     octree_mask : np.ndarray[uint8_t]
-        This is a depth-first refinement mask for an Octree.
+        This is a depth-first refinement mask for an Octree.  It should be of
+        size n_octs * 8, where each item is 1 for an oct-cell being refined and
+        0 for it not being refined.  Note that for over_refine_factors != 1,
+        the children count will still be 8, so this is always 8.
     data : dict
         A dictionary of 1D arrays.  Note that these must of the size of the
         number of "False" values in the ``octree_mask``.
@@ -1126,6 +1130,9 @@
     periodicity : tuple of booleans
         Determines whether the data will be treated as periodic along
         each axis
+    partial_coverage : boolean
+        Whether or not an oct can be refined cell-by-cell, or whether all 8 get
+        refined.
 
     """
 
@@ -1172,6 +1179,7 @@
 
     spf = StreamOctreeStaticOutput(handler)
     spf.octree_mask = octree_mask
+    spf.partial_coverage = partial_coverage
     spf.units["cm"] = sim_unit_to_cm
     spf.units['1'] = 1.0
     spf.units["unitary"] = 1.0

diff -r d9d68aac9f0c49a052b6d8285ae4b4cebe37c882 -r 9bc960be45cb0664d924523552460752a67c5325 yt/geometry/oct_container.pyx
--- a/yt/geometry/oct_container.pyx
+++ b/yt/geometry/oct_container.pyx
@@ -120,15 +120,20 @@
         cdef np.ndarray[np.uint8_t, ndim=1] ref_mask
         ref_mask = header['octree']
         cdef OctreeContainer obj = cls(header['dims'], header['left_edge'],
-                header['right_edge'], over_refine = header['over_refine'])
+                header['right_edge'], over_refine = header['over_refine'],
+                partial_coverage = header['partial_coverage'])
         # NOTE: We do not allow domain/file indices to be specified.
         cdef SelectorObject selector = selection_routines.AlwaysSelector(None)
         cdef OctVisitorData data
         obj.setup_data(&data, -1)
-        obj.allocate_domains([ref_mask.shape[0]])
+        assert(ref_mask.shape[0] / 8.0 == <int>(ref_mask.shape[0]/8.0))
+        obj.allocate_domains([ref_mask.shape[0] / 8.0])
         cdef int i, j, k, n
         data.global_index = -1
         data.level = 0
+        # This is not something I terribly like, but it needs to be done.
+        data.oref = 1
+        data.nz = 8
         cdef np.float64_t pos[3], dds[3]
         # This dds is the oct-width
         for i in range(3):
@@ -159,6 +164,7 @@
                     data.pos[0] = i
                     data.pos[1] = j
                     data.pos[2] = k
+                    # Always visit covered
                     selector.recursively_visit_octs(
                         obj.root_mesh[i][j][k],
                         pos, dds, 0, oct_visitors.load_octree,
@@ -167,9 +173,10 @@
                 pos[1] += dds[1]
             pos[0] += dds[0]
         obj.nocts = cur.n_assigned
-        if obj.nocts != ref_mask.size:
+        if obj.nocts * 8 != ref_mask.size:
             print "SOMETHING WRONG", ref_mask.size, obj.nocts, obj.oref
-            raise RuntimeError
+            raise KeyError(ref_mask.size, obj.nocts, obj.oref,
+                obj.partial_coverage)
         return obj
 
     cdef void setup_data(self, OctVisitorData *data, int domain_id = -1):
@@ -301,8 +308,9 @@
             else:
                 next = NULL
         if oinfo == NULL: return cur
+        cdef int ncells = (1 << self.oref)
         cdef np.float64_t factor = 1.0 / (1 << (self.oref-1))
-        if self.oref == 0: factor = 1.0
+        if self.oref == 0: factor = 2.0
         for i in range(3):
             # This will happen *after* we quit out, so we need to back out the
             # last change to cp
@@ -312,13 +320,11 @@
                 cp[i] += dds[i]/2.0
             # We don't normally need to change dds[i] as it has been halved
             # from the oct width, thus making it already the cell width.
-            # But, for some cases where the oref != 1, this needs to be
-            # changed.
+            # But, since not everything has the cell width equal to have the
+            # width of the oct, we need to apply "factor".
             oinfo.dds[i] = dds[i] * factor # Cell width
-            oinfo.left_edge[i] = cp[i] - dds[i] # Center minus dds
             oinfo.ipos[i] = ipos[i]
-        if self.oref == 0:
-            oinfo.dds[i] = dds[i] # Same here as elsewhere
+            oinfo.left_edge[i] = oinfo.ipos[i] * (oinfo.dds[i] * ncells) + self.DLE[i]
         oinfo.level = level
         return cur
 
@@ -499,14 +505,18 @@
         header = dict(dims = (self.nn[0], self.nn[1], self.nn[2]),
                       left_edge = (self.DLE[0], self.DLE[1], self.DLE[2]),
                       right_edge = (self.DRE[0], self.DRE[1], self.DRE[2]),
-                      over_refine = self.oref)
+                      over_refine = self.oref,
+                      partial_coverage = self.partial_coverage)
         cdef SelectorObject selector = selection_routines.AlwaysSelector(None)
         # domain_id = -1 here, because we want *every* oct
         cdef OctVisitorData data
         self.setup_data(&data, -1)
+        data.oref = 1
+        data.nz = 8
         cdef np.ndarray[np.uint8_t, ndim=1] ref_mask
-        ref_mask = np.zeros(self.nocts, dtype="uint8") - 1
+        ref_mask = np.zeros(self.nocts * 8, dtype="uint8") - 1
         data.array = <void *> ref_mask.data
+        # Enforce partial_coverage here
         self.visit_all_octs(selector, oct_visitors.store_octree, &data, 1)
         header['octree'] = ref_mask
         return header

diff -r d9d68aac9f0c49a052b6d8285ae4b4cebe37c882 -r 9bc960be45cb0664d924523552460752a67c5325 yt/geometry/oct_visitors.pyx
--- a/yt/geometry/oct_visitors.pyx
+++ b/yt/geometry/oct_visitors.pyx
@@ -176,15 +176,15 @@
     arr[o.domain - 1] += 1
 
 cdef void store_octree(Oct *o, OctVisitorData *data, np.uint8_t selected):
-    cdef np.uint8_t *arr
-    if data.last != o.domain_ind:
-        data.last = o.domain_ind
-        arr = <np.uint8_t *> data.array
-        if o.children == NULL:
-            arr[data.index] = 0
-        if o.children != NULL:
-            arr[data.index] = 1
-        data.index += 1
+    cdef np.uint8_t *arr, res, ii
+    ii = cind(data.ind[0], data.ind[1], data.ind[2])
+    arr = <np.uint8_t *> data.array
+    if o.children == NULL or o.children[ii] == NULL:
+        res = 0
+    else:
+        res = 1
+    arr[data.index] = res
+    data.index += 1
 
 cdef void load_octree(Oct *o, OctVisitorData *data, np.uint8_t selected):
     cdef void **p = <void **> data.array
@@ -192,21 +192,25 @@
     cdef Oct* octs = <Oct*> p[1]
     cdef np.int64_t *nocts = <np.int64_t*> p[2]
     cdef np.int64_t *nfinest = <np.int64_t*> p[3]
-    cdef int i
-   
-    if data.last != o.domain_ind:
-        data.last = o.domain_ind
-        if arr[data.index] == 0:
+    cdef int i, ii
+    ii = cind(data.ind[0], data.ind[1], data.ind[2])
+    if arr[data.index] == 0:
+        # We only want to do this once.  Otherwise we end up with way too many
+        # nfinest for our tastes.
+        if o.file_ind == -1:
             o.children = NULL
             o.file_ind = nfinest[0]
             o.domain = 1
             nfinest[0] += 1
-        if arr[data.index] == 1:
+    elif arr[data.index] == 1:
+        if o.children == NULL:
             o.children = <Oct **> malloc(sizeof(Oct *) * 8)
             for i in range(8):
-                o.children[i] = &octs[nocts[0]]
-                o.children[i].domain_ind = nocts[0]
-                o.children[i].file_ind = -1
-                o.children[i].domain = -1
-                nocts[0] += 1
-        data.index += 1
+                o.children[i] = NULL
+        o.children[ii] = &octs[nocts[0]]
+        o.children[ii].domain_ind = nocts[0]
+        o.children[ii].file_ind = -1
+        o.children[ii].domain = -1
+        o.children[ii].children = NULL
+        nocts[0] += 1
+    data.index += 1

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