[Yt-svn] yt-commit r832 - trunk/yt/lagos

mturk at wrangler.dreamhost.com mturk at wrangler.dreamhost.com
Thu Oct 23 13:25:45 PDT 2008


Author: mturk
Date: Thu Oct 23 13:25:44 2008
New Revision: 832
URL: http://yt.spacepope.org/changeset/832

Log:
Bug fix for octrees, along with speedups, and some changes to the calling of
the by-level octree



Modified:
   trunk/yt/lagos/DepthFirstOctree.c
   trunk/yt/lagos/DepthFirstOctree.pyx
   trunk/yt/lagos/HierarchyType.py

Modified: trunk/yt/lagos/DepthFirstOctree.c
==============================================================================
--- trunk/yt/lagos/DepthFirstOctree.c	(original)
+++ trunk/yt/lagos/DepthFirstOctree.c	Thu Oct 23 13:25:44 2008
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.9.8.1.1 on Thu Oct 23 10:12:50 2008 */
+/* Generated by Cython 0.9.8.1.1 on Thu Oct 23 12:37:16 2008 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
@@ -187,11 +187,12 @@
 static const char* __Pyx_BufferTypestringCheck_item_nn___pyx_t_5numpy_float64_t(const char* ts); /*proto*/
 
 static int __Pyx_GetBuffer_nn___pyx_t_5numpy_float64_t(PyObject* obj, Py_buffer* buf, int flags, int nd); /*proto*/
+#define __Pyx_BufPtrStrided1d(buf, i0, s0) ((char*)buf + i0 * s0)
 #define __Pyx_BufPtrStrided4d(buf, i0, s0, i1, s1, i2, s2, i3, s3) ((char*)buf + i0 * s0 + i1 * s1 + i2 * s2 + i3 * s3)
 #define __Pyx_BufPtrStrided2d(buf, i0, s0, i1, s1) ((char*)buf + i0 * s0 + i1 * s1)
-#define __Pyx_BufPtrStrided1d(buf, i0, s0) ((char*)buf + i0 * s0)
 
 static void __Pyx_RaiseBufferFallbackError(void); /*proto*/
+#define __Pyx_BufPtrStrided3d(buf, i0, s0, i1, s1, i2, s2) ((char*)buf + i0 * s0 + i1 * s1 + i2 * s2)
 
 static INLINE void __Pyx_RaiseArgtupleTooLong(Py_ssize_t num_expected, Py_ssize_t num_found); /*proto*/
 
@@ -289,28 +290,12 @@
 
 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
 
-/* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":30
- * cimport cython
- * 
- * cdef class position:             # <<<<<<<<<<<<<<
- *     cdef public int output_pos, refined_pos
- *     def __cinit__(self):
- */
-
 struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_position {
   PyObject_HEAD
   int output_pos;
   int refined_pos;
 };
 
-/* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":36
- *         self.refined_pos = 0
- * 
- * cdef class OctreeGrid:             # <<<<<<<<<<<<<<
- *     cdef public object child_indices, fields, left_edges, dimensions, dx
- *     cdef public int level
- */
-
 struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGrid {
   PyObject_HEAD
   PyObject *child_indices;
@@ -321,14 +306,6 @@
   int level;
 };
 
-/* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":53
- *         self.level = level
- * 
- * cdef class OctreeGridList:             # <<<<<<<<<<<<<<
- *     cdef public object grids
- *     def __cinit__(self, grids):
- */
-
 struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGridList {
   PyObject_HEAD
   PyObject *grids;
@@ -389,14 +366,6 @@
 static char __pyx_k_15[] = "O";
 static char __pyx_k_16[] = "only objects, int and float dtypes supported for ndarray buffer access so far (dtype is %d)";
 
-/* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":32
- * cdef class position:
- *     cdef public int output_pos, refined_pos
- *     def __cinit__(self):             # <<<<<<<<<<<<<<
- *         self.output_pos = 0
- *         self.refined_pos = 0
- */
-
 static int __pyx_pf_2yt_5lagos_16DepthFirstOctree_8position___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static int __pyx_pf_2yt_5lagos_16DepthFirstOctree_8position___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   int __pyx_r;
@@ -407,37 +376,13 @@
   if (unlikely(__pyx_kwds)) {
     if (unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
   }
-
-  /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":33
- *     cdef public int output_pos, refined_pos
- *     def __cinit__(self):
- *         self.output_pos = 0             # <<<<<<<<<<<<<<
- *         self.refined_pos = 0
- * 
- */
   ((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_position *)__pyx_v_self)->output_pos = 0;
-
-  /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":34
- *     def __cinit__(self):
- *         self.output_pos = 0
- *         self.refined_pos = 0             # <<<<<<<<<<<<<<
- * 
- * cdef class OctreeGrid:
- */
   ((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_position *)__pyx_v_self)->refined_pos = 0;
 
   __pyx_r = 0;
   return __pyx_r;
 }
 
-/* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":39
- *     cdef public object child_indices, fields, left_edges, dimensions, dx
- *     cdef public int level
- *     def __cinit__(self,             # <<<<<<<<<<<<<<
- *                   np.ndarray[np.int32_t, ndim=3] child_indices,
- *                   np.ndarray[np.float64_t, ndim=4] fields,
- */
-
 static int __pyx_pf_2yt_5lagos_16DepthFirstOctree_10OctreeGrid___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static int __pyx_pf_2yt_5lagos_16DepthFirstOctree_10OctreeGrid___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyArrayObject *__pyx_v_child_indices = 0;
@@ -509,69 +454,21 @@
   if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_float64_t((PyObject*)__pyx_v_dx, &__pyx_bstruct_dx, PyBUF_FORMAT| PyBUF_STRIDES, 1) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_bstride_0_dx = __pyx_bstruct_dx.strides[0];
   __pyx_bshape_0_dx = __pyx_bstruct_dx.shape[0];
-
-  /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":46
- *                   np.ndarray[np.float64_t, ndim=1] dx,
- *                   int level):
- *         self.child_indices = child_indices             # <<<<<<<<<<<<<<
- *         self.fields = fields
- *         self.left_edges = left_edges
- */
   Py_INCREF(((PyObject *)__pyx_v_child_indices));
   Py_DECREF(((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGrid *)__pyx_v_self)->child_indices);
   ((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGrid *)__pyx_v_self)->child_indices = ((PyObject *)__pyx_v_child_indices);
-
-  /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":47
- *                   int level):
- *         self.child_indices = child_indices
- *         self.fields = fields             # <<<<<<<<<<<<<<
- *         self.left_edges = left_edges
- *         self.dimensions = dimensions
- */
   Py_INCREF(((PyObject *)__pyx_v_fields));
   Py_DECREF(((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGrid *)__pyx_v_self)->fields);
   ((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGrid *)__pyx_v_self)->fields = ((PyObject *)__pyx_v_fields);
-
-  /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":48
- *         self.child_indices = child_indices
- *         self.fields = fields
- *         self.left_edges = left_edges             # <<<<<<<<<<<<<<
- *         self.dimensions = dimensions
- *         self.dx = dx
- */
   Py_INCREF(((PyObject *)__pyx_v_left_edges));
   Py_DECREF(((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGrid *)__pyx_v_self)->left_edges);
   ((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGrid *)__pyx_v_self)->left_edges = ((PyObject *)__pyx_v_left_edges);
-
-  /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":49
- *         self.fields = fields
- *         self.left_edges = left_edges
- *         self.dimensions = dimensions             # <<<<<<<<<<<<<<
- *         self.dx = dx
- *         self.level = level
- */
   Py_INCREF(((PyObject *)__pyx_v_dimensions));
   Py_DECREF(((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGrid *)__pyx_v_self)->dimensions);
   ((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGrid *)__pyx_v_self)->dimensions = ((PyObject *)__pyx_v_dimensions);
-
-  /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":50
- *         self.left_edges = left_edges
- *         self.dimensions = dimensions
- *         self.dx = dx             # <<<<<<<<<<<<<<
- *         self.level = level
- * 
- */
   Py_INCREF(((PyObject *)__pyx_v_dx));
   Py_DECREF(((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGrid *)__pyx_v_self)->dx);
   ((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGrid *)__pyx_v_self)->dx = ((PyObject *)__pyx_v_dx);
-
-  /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":51
- *         self.dimensions = dimensions
- *         self.dx = dx
- *         self.level = level             # <<<<<<<<<<<<<<
- * 
- * cdef class OctreeGridList:
- */
   ((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGrid *)__pyx_v_self)->level = __pyx_v_level;
 
   __pyx_r = 0;
@@ -598,14 +495,6 @@
   return __pyx_r;
 }
 
-/* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":55
- * cdef class OctreeGridList:
- *     cdef public object grids
- *     def __cinit__(self, grids):             # <<<<<<<<<<<<<<
- *         self.grids = grids
- * 
- */
-
 static int __pyx_pf_2yt_5lagos_16DepthFirstOctree_14OctreeGridList___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static int __pyx_pf_2yt_5lagos_16DepthFirstOctree_14OctreeGridList___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_grids = 0;
@@ -622,14 +511,6 @@
   __Pyx_AddTraceback("yt.lagos.DepthFirstOctree.OctreeGridList.__cinit__");
   return -1;
   __pyx_L4:;
-
-  /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":56
- *     cdef public object grids
- *     def __cinit__(self, grids):
- *         self.grids = grids             # <<<<<<<<<<<<<<
- * 
- *     def __getitem__(self, int item):
- */
   Py_INCREF(__pyx_v_grids);
   Py_DECREF(((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGridList *)__pyx_v_self)->grids);
   ((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGridList *)__pyx_v_self)->grids = __pyx_v_grids;
@@ -638,14 +519,6 @@
   return __pyx_r;
 }
 
-/* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":58
- *         self.grids = grids
- * 
- *     def __getitem__(self, int item):             # <<<<<<<<<<<<<<
- *         return self.grids[item]
- * 
- */
-
 static PyObject *__pyx_pf_2yt_5lagos_16DepthFirstOctree_14OctreeGridList___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_item); /*proto*/
 static PyObject *__pyx_pf_2yt_5lagos_16DepthFirstOctree_14OctreeGridList___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_item) {
   int __pyx_v_item;
@@ -659,14 +532,6 @@
   __Pyx_AddTraceback("yt.lagos.DepthFirstOctree.OctreeGridList.__getitem__");
   return NULL;
   __pyx_L4:;
-
-  /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":59
- * 
- *     def __getitem__(self, int item):
- *         return self.grids[item]             # <<<<<<<<<<<<<<
- * 
- * @cython.boundscheck(False)
- */
   __pyx_1 = __Pyx_GetItemInt(((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGridList *)__pyx_v_self)->grids, __pyx_v_item, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_r = __pyx_1;
   __pyx_1 = 0;
@@ -682,14 +547,6 @@
   return __pyx_r;
 }
 
-/* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":62
- * 
- * @cython.boundscheck(False)
- * def RecurseOctreeDepthFirst(int i_i, int j_i, int k_i,             # <<<<<<<<<<<<<<
- *                             int i_f, int j_f, int k_f,
- *                             position curpos, int gi,
- */
-
 static PyObject *__pyx_pf_2yt_5lagos_16DepthFirstOctree_RecurseOctreeDepthFirst(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static PyObject *__pyx_pf_2yt_5lagos_16DepthFirstOctree_RecurseOctreeDepthFirst(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   int __pyx_v_i_i;
@@ -720,22 +577,19 @@
   PyArrayObject *__pyx_v_dimensions = 0;
   PyArrayObject *__pyx_v_fields = 0;
   PyArrayObject *__pyx_v_leftedges = 0;
-  PyArrayObject *__pyx_v_dx = 0;
-  PyArrayObject *__pyx_v_child_dx;
+  __pyx_t_5numpy_float64_t __pyx_v_dx;
+  __pyx_t_5numpy_float64_t __pyx_v_child_dx;
   PyArrayObject *__pyx_v_child_leftedges;
+  __pyx_t_5numpy_float64_t __pyx_v_cx;
+  __pyx_t_5numpy_float64_t __pyx_v_cy;
+  __pyx_t_5numpy_float64_t __pyx_v_cz;
   PyObject *__pyx_v_s;
-  Py_buffer __pyx_bstruct_dx;
-  Py_ssize_t __pyx_bstride_0_dx = 0;
-  Py_ssize_t __pyx_bshape_0_dx = 0;
   Py_buffer __pyx_bstruct_leftedges;
   Py_ssize_t __pyx_bstride_0_leftedges = 0;
   Py_ssize_t __pyx_bshape_0_leftedges = 0;
   Py_buffer __pyx_bstruct_refined;
   Py_ssize_t __pyx_bstride_0_refined = 0;
   Py_ssize_t __pyx_bshape_0_refined = 0;
-  Py_buffer __pyx_bstruct_child_dx;
-  Py_ssize_t __pyx_bstride_0_child_dx = 0;
-  Py_ssize_t __pyx_bshape_0_child_dx = 0;
   Py_buffer __pyx_bstruct_child_leftedges;
   Py_ssize_t __pyx_bstride_0_child_leftedges = 0;
   Py_ssize_t __pyx_bshape_0_child_leftedges = 0;
@@ -766,40 +620,38 @@
   PyObject *__pyx_r;
   long __pyx_1;
   PyObject *__pyx_2 = 0;
-  PyObject *__pyx_3 = 0;
+  __pyx_t_5numpy_float64_t __pyx_3;
   PyObject *__pyx_4 = 0;
   PyObject *__pyx_5 = 0;
-  int __pyx_6;
+  PyObject *__pyx_6 = 0;
   int __pyx_7;
-  npy_intp __pyx_8;
-  __pyx_t_5numpy_float64_t __pyx_9;
+  int __pyx_8;
+  npy_intp __pyx_9;
   PyObject *__pyx_10 = 0;
   PyObject *__pyx_11 = 0;
   PyArrayObject *__pyx_t_1 = NULL;
   PyArrayObject *__pyx_t_2 = NULL;
   PyArrayObject *__pyx_t_3 = NULL;
   PyArrayObject *__pyx_t_4 = NULL;
-  PyArrayObject *__pyx_t_5 = NULL;
-  int __pyx_t_6;
-  int __pyx_t_7;
+  long __pyx_t_5;
+  long __pyx_t_6;
+  long __pyx_t_7;
   int __pyx_t_8;
   int __pyx_t_9;
   int __pyx_t_10;
   int __pyx_t_11;
   int __pyx_t_12;
   int __pyx_t_13;
-  PyArrayObject *__pyx_t_14 = NULL;
+  int __pyx_t_14;
   int __pyx_t_15;
-  PyObject *__pyx_t_16 = NULL;
-  PyObject *__pyx_t_17 = NULL;
+  PyArrayObject *__pyx_t_16 = NULL;
+  int __pyx_t_17;
   PyObject *__pyx_t_18 = NULL;
-  PyArrayObject *__pyx_t_19 = NULL;
-  long __pyx_t_20;
+  PyObject *__pyx_t_19 = NULL;
+  PyObject *__pyx_t_20 = NULL;
   long __pyx_t_21;
   long __pyx_t_22;
   long __pyx_t_23;
-  long __pyx_t_24;
-  long __pyx_t_25;
   static char *__pyx_argnames[] = {"i_i","j_i","k_i","i_f","j_f","k_f","curpos","gi","output","refined","grids",0};
   __pyx_self = __pyx_self;
   if (likely(!__pyx_kwds) && likely(PyTuple_GET_SIZE(__pyx_args) == 11)) {
@@ -828,9 +680,6 @@
   __pyx_bstruct_dimensions.buf = NULL;
   __pyx_bstruct_fields.buf = NULL;
   __pyx_bstruct_leftedges.buf = NULL;
-  __pyx_bstruct_dx.buf = NULL;
-  __pyx_v_child_dx = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
-  __pyx_bstruct_child_dx.buf = NULL;
   __pyx_v_child_leftedges = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
   __pyx_bstruct_child_leftedges.buf = NULL;
   __pyx_v_s = Py_None; Py_INCREF(Py_None);
@@ -844,27 +693,11 @@
   if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_int32_t((PyObject*)__pyx_v_refined, &__pyx_bstruct_refined, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_bstride_0_refined = __pyx_bstruct_refined.strides[0];
   __pyx_bshape_0_refined = __pyx_bstruct_refined.shape[0];
-
-  /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":71
- *     cdef int child_i, child_j, child_k
- *     cdef OctreeGrid child_grid
- *     cdef OctreeGrid grid = grids[gi-1]             # <<<<<<<<<<<<<<
- *     cdef np.ndarray[np.int32_t, ndim=3] child_indices = grid.child_indices
- *     cdef np.ndarray[np.int32_t, ndim=1] dimensions = grid.dimensions
- */
   __pyx_1 = (__pyx_v_gi - 1);
   __pyx_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_grids), __pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (!(__Pyx_TypeTest(__pyx_2, __pyx_ptype_2yt_5lagos_16DepthFirstOctree_OctreeGrid))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_grid = ((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGrid *)__pyx_2);
   __pyx_2 = 0;
-
-  /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":72
- *     cdef OctreeGrid child_grid
- *     cdef OctreeGrid grid = grids[gi-1]
- *     cdef np.ndarray[np.int32_t, ndim=3] child_indices = grid.child_indices             # <<<<<<<<<<<<<<
- *     cdef np.ndarray[np.int32_t, ndim=1] dimensions = grid.dimensions
- *     cdef np.ndarray[np.float64_t, ndim=4] fields = grid.fields
- */
   if (!(__Pyx_TypeTest(__pyx_v_grid->child_indices, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_1 = ((PyArrayObject *)__pyx_v_grid->child_indices);
   if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_int32_t((PyObject*)__pyx_t_1, &__pyx_bstruct_child_indices, PyBUF_FORMAT| PyBUF_STRIDES, 3) == -1)) {
@@ -876,14 +709,6 @@
   __pyx_t_1 = 0;
   Py_INCREF(__pyx_v_grid->child_indices);
   __pyx_v_child_indices = ((PyArrayObject *)__pyx_v_grid->child_indices);
-
-  /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":73
- *     cdef OctreeGrid grid = grids[gi-1]
- *     cdef np.ndarray[np.int32_t, ndim=3] child_indices = grid.child_indices
- *     cdef np.ndarray[np.int32_t, ndim=1] dimensions = grid.dimensions             # <<<<<<<<<<<<<<
- *     cdef np.ndarray[np.float64_t, ndim=4] fields = grid.fields
- *     cdef np.ndarray[np.float64_t, ndim=1] leftedges = grid.left_edges
- */
   if (!(__Pyx_TypeTest(__pyx_v_grid->dimensions, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_2 = ((PyArrayObject *)__pyx_v_grid->dimensions);
   if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_int32_t((PyObject*)__pyx_t_2, &__pyx_bstruct_dimensions, PyBUF_FORMAT| PyBUF_STRIDES, 1) == -1)) {
@@ -895,14 +720,6 @@
   __pyx_t_2 = 0;
   Py_INCREF(__pyx_v_grid->dimensions);
   __pyx_v_dimensions = ((PyArrayObject *)__pyx_v_grid->dimensions);
-
-  /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":74
- *     cdef np.ndarray[np.int32_t, ndim=3] child_indices = grid.child_indices
- *     cdef np.ndarray[np.int32_t, ndim=1] dimensions = grid.dimensions
- *     cdef np.ndarray[np.float64_t, ndim=4] fields = grid.fields             # <<<<<<<<<<<<<<
- *     cdef np.ndarray[np.float64_t, ndim=1] leftedges = grid.left_edges
- *     cdef np.ndarray[np.float64_t, ndim=1] dx = grid.dx
- */
   if (!(__Pyx_TypeTest(__pyx_v_grid->fields, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_3 = ((PyArrayObject *)__pyx_v_grid->fields);
   if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_float64_t((PyObject*)__pyx_t_3, &__pyx_bstruct_fields, PyBUF_FORMAT| PyBUF_STRIDES, 4) == -1)) {
@@ -914,14 +731,6 @@
   __pyx_t_3 = 0;
   Py_INCREF(__pyx_v_grid->fields);
   __pyx_v_fields = ((PyArrayObject *)__pyx_v_grid->fields);
-
-  /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":75
- *     cdef np.ndarray[np.int32_t, ndim=1] dimensions = grid.dimensions
- *     cdef np.ndarray[np.float64_t, ndim=4] fields = grid.fields
- *     cdef np.ndarray[np.float64_t, ndim=1] leftedges = grid.left_edges             # <<<<<<<<<<<<<<
- *     cdef np.ndarray[np.float64_t, ndim=1] dx = grid.dx
- *     cdef np.ndarray[np.float64_t, ndim=1] child_dx
- */
   if (!(__Pyx_TypeTest(__pyx_v_grid->left_edges, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_4 = ((PyArrayObject *)__pyx_v_grid->left_edges);
   if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_float64_t((PyObject*)__pyx_t_4, &__pyx_bstruct_leftedges, PyBUF_FORMAT| PyBUF_STRIDES, 1) == -1)) {
@@ -933,384 +742,162 @@
   __pyx_t_4 = 0;
   Py_INCREF(__pyx_v_grid->left_edges);
   __pyx_v_leftedges = ((PyArrayObject *)__pyx_v_grid->left_edges);
-
-  /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":76
- *     cdef np.ndarray[np.float64_t, ndim=4] fields = grid.fields
- *     cdef np.ndarray[np.float64_t, ndim=1] leftedges = grid.left_edges
- *     cdef np.ndarray[np.float64_t, ndim=1] dx = grid.dx             # <<<<<<<<<<<<<<
- *     cdef np.ndarray[np.float64_t, ndim=1] child_dx
- *     cdef np.ndarray[np.float64_t, ndim=1] child_leftedges
- */
-  if (!(__Pyx_TypeTest(__pyx_v_grid->dx, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_5 = ((PyArrayObject *)__pyx_v_grid->dx);
-  if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_float64_t((PyObject*)__pyx_t_5, &__pyx_bstruct_dx, PyBUF_FORMAT| PyBUF_STRIDES, 1) == -1)) {
-    __pyx_v_dx = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_bstruct_dx.buf = NULL;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  } else {__pyx_bstride_0_dx = __pyx_bstruct_dx.strides[0];
-    __pyx_bshape_0_dx = __pyx_bstruct_dx.shape[0];
-  }
-  __pyx_t_5 = 0;
-  Py_INCREF(__pyx_v_grid->dx);
-  __pyx_v_dx = ((PyArrayObject *)__pyx_v_grid->dx);
-
-  /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":79
- *     cdef np.ndarray[np.float64_t, ndim=1] child_dx
- *     cdef np.ndarray[np.float64_t, ndim=1] child_leftedges
- *     for k_off in range(i_f):             # <<<<<<<<<<<<<<
- *         k = k_off + k_i
- *         for j_off in range(j_f):
- */
-  for (__pyx_v_k_off = 0; __pyx_v_k_off < __pyx_v_i_f; __pyx_v_k_off+=1) {
-
-    /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":80
- *     cdef np.ndarray[np.float64_t, ndim=1] child_leftedges
- *     for k_off in range(i_f):
- *         k = k_off + k_i             # <<<<<<<<<<<<<<
- *         for j_off in range(j_f):
- *             j = j_off + j_i
- */
+  __pyx_2 = __Pyx_GetItemInt(__pyx_v_grid->dx, 0, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_3 = __pyx_PyFloat_AsDouble(__pyx_2); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_v_dx = __pyx_3;
+  for (__pyx_v_k_off = 0; __pyx_v_k_off < __pyx_v_k_f; __pyx_v_k_off+=1) {
     __pyx_v_k = (__pyx_v_k_off + __pyx_v_k_i);
-
-    /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":81
- *     for k_off in range(i_f):
- *         k = k_off + k_i
- *         for j_off in range(j_f):             # <<<<<<<<<<<<<<
- *             j = j_off + j_i
- *             for i_off in range(k_f):
- */
+    __pyx_t_5 = 2;
+    if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_bshape_0_leftedges;
+    __pyx_3 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_leftedges.buf, __pyx_t_5, __pyx_bstride_0_leftedges)));
+    __pyx_v_cz = (__pyx_3 + (__pyx_v_k * __pyx_v_dx));
     for (__pyx_v_j_off = 0; __pyx_v_j_off < __pyx_v_j_f; __pyx_v_j_off+=1) {
-
-      /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":82
- *         k = k_off + k_i
- *         for j_off in range(j_f):
- *             j = j_off + j_i             # <<<<<<<<<<<<<<
- *             for i_off in range(k_f):
- *                 i = i_off + i_i
- */
       __pyx_v_j = (__pyx_v_j_off + __pyx_v_j_i);
-
-      /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":83
- *         for j_off in range(j_f):
- *             j = j_off + j_i
- *             for i_off in range(k_f):             # <<<<<<<<<<<<<<
- *                 i = i_off + i_i
- *                 ci = grid.child_indices[i,j,k]
- */
-      for (__pyx_v_i_off = 0; __pyx_v_i_off < __pyx_v_k_f; __pyx_v_i_off+=1) {
-
-        /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":84
- *             j = j_off + j_i
- *             for i_off in range(k_f):
- *                 i = i_off + i_i             # <<<<<<<<<<<<<<
- *                 ci = grid.child_indices[i,j,k]
- *                 if ci == -1:
- */
+      __pyx_t_6 = 1;
+      if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_bshape_0_leftedges;
+      __pyx_3 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_leftedges.buf, __pyx_t_6, __pyx_bstride_0_leftedges)));
+      __pyx_v_cy = (__pyx_3 + (__pyx_v_j * __pyx_v_dx));
+      for (__pyx_v_i_off = 0; __pyx_v_i_off < __pyx_v_i_f; __pyx_v_i_off+=1) {
         __pyx_v_i = (__pyx_v_i_off + __pyx_v_i_i);
-
-        /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":85
- *             for i_off in range(k_f):
- *                 i = i_off + i_i
- *                 ci = grid.child_indices[i,j,k]             # <<<<<<<<<<<<<<
- *                 if ci == -1:
- *                     for fi in range(fields.shape[0]):
- */
-        __pyx_2 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_3 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_4 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_5 = PyTuple_New(3); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        PyTuple_SET_ITEM(__pyx_5, 0, __pyx_2);
-        PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
-        PyTuple_SET_ITEM(__pyx_5, 2, __pyx_4);
+        __pyx_t_7 = 0;
+        if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_bshape_0_leftedges;
+        __pyx_3 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_leftedges.buf, __pyx_t_7, __pyx_bstride_0_leftedges)));
+        __pyx_v_cx = (__pyx_3 + (__pyx_v_i * __pyx_v_dx));
+        __pyx_2 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_4 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_5 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_6 = PyTuple_New(3); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        PyTuple_SET_ITEM(__pyx_6, 0, __pyx_2);
+        PyTuple_SET_ITEM(__pyx_6, 1, __pyx_4);
+        PyTuple_SET_ITEM(__pyx_6, 2, __pyx_5);
         __pyx_2 = 0;
-        __pyx_3 = 0;
         __pyx_4 = 0;
-        __pyx_2 = PyObject_GetItem(__pyx_v_grid->child_indices, ((PyObject *)__pyx_5)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        Py_DECREF(((PyObject *)__pyx_5)); __pyx_5 = 0;
-        __pyx_6 = __pyx_PyInt_int(__pyx_2); if (unlikely((__pyx_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_5 = 0;
+        __pyx_2 = PyObject_GetItem(__pyx_v_grid->child_indices, ((PyObject *)__pyx_6)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        Py_DECREF(((PyObject *)__pyx_6)); __pyx_6 = 0;
+        __pyx_7 = __pyx_PyInt_int(__pyx_2); if (unlikely((__pyx_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         Py_DECREF(__pyx_2); __pyx_2 = 0;
-        __pyx_v_ci = __pyx_6;
-
-        /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":86
- *                 i = i_off + i_i
- *                 ci = grid.child_indices[i,j,k]
- *                 if ci == -1:             # <<<<<<<<<<<<<<
- *                     for fi in range(fields.shape[0]):
- *                         output[curpos.output_pos,fi] = fields[fi,i,j,k]
- */
-        __pyx_7 = (__pyx_v_ci == -1);
-        if (__pyx_7) {
-
-          /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":87
- *                 ci = grid.child_indices[i,j,k]
- *                 if ci == -1:
- *                     for fi in range(fields.shape[0]):             # <<<<<<<<<<<<<<
- *                         output[curpos.output_pos,fi] = fields[fi,i,j,k]
- *                     refined[curpos.refined_pos] = 0
- */
-          __pyx_8 = (__pyx_v_fields->dimensions[0]);
-          for (__pyx_v_fi = 0; __pyx_v_fi < __pyx_8; __pyx_v_fi+=1) {
-
-            /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":88
- *                 if ci == -1:
- *                     for fi in range(fields.shape[0]):
- *                         output[curpos.output_pos,fi] = fields[fi,i,j,k]             # <<<<<<<<<<<<<<
- *                     refined[curpos.refined_pos] = 0
- *                     curpos.output_pos += 1
- */
-            __pyx_t_6 = __pyx_v_fi;
-            __pyx_t_7 = __pyx_v_i;
-            __pyx_t_8 = __pyx_v_j;
-            __pyx_t_9 = __pyx_v_k;
-            if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_bshape_0_fields;
-            if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_bshape_1_fields;
-            if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_bshape_2_fields;
-            if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_bshape_3_fields;
-            __pyx_9 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided4d(__pyx_bstruct_fields.buf, __pyx_t_6, __pyx_bstride_0_fields, __pyx_t_7, __pyx_bstride_1_fields, __pyx_t_8, __pyx_bstride_2_fields, __pyx_t_9, __pyx_bstride_3_fields)));
-            __pyx_t_10 = __pyx_v_curpos->output_pos;
-            __pyx_t_11 = __pyx_v_fi;
-            if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_bshape_0_output;
-            if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_bshape_1_output;
-            *((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided2d(__pyx_bstruct_output.buf, __pyx_t_10, __pyx_bstride_0_output, __pyx_t_11, __pyx_bstride_1_output)) = __pyx_9;
+        __pyx_v_ci = __pyx_7;
+        __pyx_8 = (__pyx_v_ci == -1);
+        if (__pyx_8) {
+          __pyx_9 = (__pyx_v_fields->dimensions[0]);
+          for (__pyx_v_fi = 0; __pyx_v_fi < __pyx_9; __pyx_v_fi+=1) {
+            __pyx_t_8 = __pyx_v_fi;
+            __pyx_t_9 = __pyx_v_i;
+            __pyx_t_10 = __pyx_v_j;
+            __pyx_t_11 = __pyx_v_k;
+            if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_bshape_0_fields;
+            if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_bshape_1_fields;
+            if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_bshape_2_fields;
+            if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_bshape_3_fields;
+            __pyx_3 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided4d(__pyx_bstruct_fields.buf, __pyx_t_8, __pyx_bstride_0_fields, __pyx_t_9, __pyx_bstride_1_fields, __pyx_t_10, __pyx_bstride_2_fields, __pyx_t_11, __pyx_bstride_3_fields)));
+            __pyx_t_12 = __pyx_v_curpos->output_pos;
+            __pyx_t_13 = __pyx_v_fi;
+            if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_bshape_0_output;
+            if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_bshape_1_output;
+            *((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided2d(__pyx_bstruct_output.buf, __pyx_t_12, __pyx_bstride_0_output, __pyx_t_13, __pyx_bstride_1_output)) = __pyx_3;
           }
-
-          /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":89
- *                     for fi in range(fields.shape[0]):
- *                         output[curpos.output_pos,fi] = fields[fi,i,j,k]
- *                     refined[curpos.refined_pos] = 0             # <<<<<<<<<<<<<<
- *                     curpos.output_pos += 1
- *                     curpos.refined_pos += 1
- */
-          __pyx_t_12 = __pyx_v_curpos->refined_pos;
-          if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_bshape_0_refined;
-          *((__pyx_t_5numpy_int32_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_refined.buf, __pyx_t_12, __pyx_bstride_0_refined)) = 0;
-
-          /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":90
- *                         output[curpos.output_pos,fi] = fields[fi,i,j,k]
- *                     refined[curpos.refined_pos] = 0
- *                     curpos.output_pos += 1             # <<<<<<<<<<<<<<
- *                     curpos.refined_pos += 1
- *                 else:
- */
+          __pyx_t_14 = __pyx_v_curpos->refined_pos;
+          if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_0_refined;
+          *((__pyx_t_5numpy_int32_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_refined.buf, __pyx_t_14, __pyx_bstride_0_refined)) = 0;
           __pyx_v_curpos->output_pos += 1;
-
-          /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":91
- *                     refined[curpos.refined_pos] = 0
- *                     curpos.output_pos += 1
- *                     curpos.refined_pos += 1             # <<<<<<<<<<<<<<
- *                 else:
- *                     refined[curpos.refined_pos] = 1
- */
           __pyx_v_curpos->refined_pos += 1;
           goto __pyx_L11;
         }
         /*else*/ {
-
-          /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":93
- *                     curpos.refined_pos += 1
- *                 else:
- *                     refined[curpos.refined_pos] = 1             # <<<<<<<<<<<<<<
- *                     curpos.refined_pos += 1
- *                     child_grid = grids[ci-1]
- */
-          __pyx_t_13 = __pyx_v_curpos->refined_pos;
-          if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_bshape_0_refined;
-          *((__pyx_t_5numpy_int32_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_refined.buf, __pyx_t_13, __pyx_bstride_0_refined)) = 1;
-
-          /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":94
- *                 else:
- *                     refined[curpos.refined_pos] = 1
- *                     curpos.refined_pos += 1             # <<<<<<<<<<<<<<
- *                     child_grid = grids[ci-1]
- *                     child_dx = child_grid.dx
- */
+          __pyx_t_15 = __pyx_v_curpos->refined_pos;
+          if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_0_refined;
+          *((__pyx_t_5numpy_int32_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_refined.buf, __pyx_t_15, __pyx_bstride_0_refined)) = 1;
           __pyx_v_curpos->refined_pos += 1;
-
-          /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":95
- *                     refined[curpos.refined_pos] = 1
- *                     curpos.refined_pos += 1
- *                     child_grid = grids[ci-1]             # <<<<<<<<<<<<<<
- *                     child_dx = child_grid.dx
- *                     child_leftedges = child_grid.left_edges
- */
           __pyx_1 = (__pyx_v_ci - 1);
-          __pyx_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_grids), __pyx_1, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          if (!(__Pyx_TypeTest(__pyx_3, __pyx_ptype_2yt_5lagos_16DepthFirstOctree_OctreeGrid))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_4 = __Pyx_GetItemInt(((PyObject *)__pyx_v_grids), __pyx_1, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          if (!(__Pyx_TypeTest(__pyx_4, __pyx_ptype_2yt_5lagos_16DepthFirstOctree_OctreeGrid))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           Py_DECREF(((PyObject *)__pyx_v_child_grid));
-          __pyx_v_child_grid = ((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGrid *)__pyx_3);
-          __pyx_3 = 0;
-
-          /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":96
- *                     curpos.refined_pos += 1
- *                     child_grid = grids[ci-1]
- *                     child_dx = child_grid.dx             # <<<<<<<<<<<<<<
- *                     child_leftedges = child_grid.left_edges
- *                     child_i = ((leftedges[0] + i * dx) - child_leftedges[0])/child_dx
- */
-          if (!(__Pyx_TypeTest(__pyx_v_child_grid->dx, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_t_14 = ((PyArrayObject *)__pyx_v_child_grid->dx);
-          __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_child_dx, &__pyx_bstruct_child_dx);
-          __pyx_t_15 = __Pyx_GetBuffer_nn___pyx_t_5numpy_float64_t((PyObject*)__pyx_t_14, &__pyx_bstruct_child_dx, PyBUF_FORMAT| PyBUF_STRIDES, 1);
-          if (unlikely(__pyx_t_15 < 0)) 
-          {
-              PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
-              if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_float64_t((PyObject*)__pyx_v_child_dx, &__pyx_bstruct_child_dx, PyBUF_FORMAT| PyBUF_STRIDES, 1) == -1)) {
-                  Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
-                  __Pyx_RaiseBufferFallbackError();
-                } else {
-                  PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
-              }
-          }
-          __pyx_bstride_0_child_dx = __pyx_bstruct_child_dx.strides[0];
-          __pyx_bshape_0_child_dx = __pyx_bstruct_child_dx.shape[0];
-          if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_t_14 = 0;
-          Py_INCREF(__pyx_v_child_grid->dx);
-          Py_DECREF(((PyObject *)__pyx_v_child_dx));
-          __pyx_v_child_dx = ((PyArrayObject *)__pyx_v_child_grid->dx);
-
-          /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":97
- *                     child_grid = grids[ci-1]
- *                     child_dx = child_grid.dx
- *                     child_leftedges = child_grid.left_edges             # <<<<<<<<<<<<<<
- *                     child_i = ((leftedges[0] + i * dx) - child_leftedges[0])/child_dx
- *                     child_j = ((leftedges[1] + j * dx) - child_leftedges[1])/child_dx
- */
-          if (!(__Pyx_TypeTest(__pyx_v_child_grid->left_edges, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_t_19 = ((PyArrayObject *)__pyx_v_child_grid->left_edges);
+          __pyx_v_child_grid = ((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGrid *)__pyx_4);
+          __pyx_4 = 0;
+          __pyx_5 = __Pyx_GetItemInt(__pyx_v_child_grid->dx, 0, 0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_3 = __pyx_PyFloat_AsDouble(__pyx_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          Py_DECREF(__pyx_5); __pyx_5 = 0;
+          __pyx_v_child_dx = __pyx_3;
+          if (!(__Pyx_TypeTest(__pyx_v_child_grid->left_edges, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_16 = ((PyArrayObject *)__pyx_v_child_grid->left_edges);
           __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_child_leftedges, &__pyx_bstruct_child_leftedges);
-          __pyx_t_15 = __Pyx_GetBuffer_nn___pyx_t_5numpy_float64_t((PyObject*)__pyx_t_19, &__pyx_bstruct_child_leftedges, PyBUF_FORMAT| PyBUF_STRIDES, 1);
-          if (unlikely(__pyx_t_15 < 0)) 
+          __pyx_t_17 = __Pyx_GetBuffer_nn___pyx_t_5numpy_float64_t((PyObject*)__pyx_t_16, &__pyx_bstruct_child_leftedges, PyBUF_FORMAT| PyBUF_STRIDES, 1);
+          if (unlikely(__pyx_t_17 < 0)) 
           {
-              PyErr_Fetch(&__pyx_t_18, &__pyx_t_17, &__pyx_t_16);
+              PyErr_Fetch(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20);
               if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_float64_t((PyObject*)__pyx_v_child_leftedges, &__pyx_bstruct_child_leftedges, PyBUF_FORMAT| PyBUF_STRIDES, 1) == -1)) {
-                  Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_16);
+                  Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20);
                   __Pyx_RaiseBufferFallbackError();
                 } else {
-                  PyErr_Restore(__pyx_t_18, __pyx_t_17, __pyx_t_16);
+                  PyErr_Restore(__pyx_t_18, __pyx_t_19, __pyx_t_20);
               }
           }
           __pyx_bstride_0_child_leftedges = __pyx_bstruct_child_leftedges.strides[0];
           __pyx_bshape_0_child_leftedges = __pyx_bstruct_child_leftedges.shape[0];
-          if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_t_19 = 0;
+          if (unlikely(__pyx_t_17 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_16 = 0;
           Py_INCREF(__pyx_v_child_grid->left_edges);
           Py_DECREF(((PyObject *)__pyx_v_child_leftedges));
           __pyx_v_child_leftedges = ((PyArrayObject *)__pyx_v_child_grid->left_edges);
-
-          /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":98
- *                     child_dx = child_grid.dx
- *                     child_leftedges = child_grid.left_edges
- *                     child_i = ((leftedges[0] + i * dx) - child_leftedges[0])/child_dx             # <<<<<<<<<<<<<<
- *                     child_j = ((leftedges[1] + j * dx) - child_leftedges[1])/child_dx
- *                     child_k = ((leftedges[2] + k * dx) - child_leftedges[2])/child_dx
- */
-          __pyx_t_20 = 0;
-          if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_bshape_0_leftedges;
-          __pyx_9 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_leftedges.buf, __pyx_t_20, __pyx_bstride_0_leftedges)));
-          __pyx_4 = PyFloat_FromDouble(__pyx_9); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_5 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_2 = PyNumber_Multiply(__pyx_5, ((PyObject *)__pyx_v_dx)); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_5); __pyx_5 = 0;
-          __pyx_3 = PyNumber_Add(__pyx_4, __pyx_2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_4); __pyx_4 = 0;
-          Py_DECREF(__pyx_2); __pyx_2 = 0;
           __pyx_t_21 = 0;
           if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_bshape_0_child_leftedges;
-          __pyx_9 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_child_leftedges.buf, __pyx_t_21, __pyx_bstride_0_child_leftedges)));
-          __pyx_5 = PyFloat_FromDouble(__pyx_9); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_4 = PyNumber_Subtract(__pyx_3, __pyx_5); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_3); __pyx_3 = 0;
-          Py_DECREF(__pyx_5); __pyx_5 = 0;
-          __pyx_2 = __Pyx_PyNumber_Divide(__pyx_4, ((PyObject *)__pyx_v_child_dx)); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_3 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_child_leftedges.buf, __pyx_t_21, __pyx_bstride_0_child_leftedges)));
+          __pyx_6 = PyFloat_FromDouble((__pyx_v_cx - __pyx_3)); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          PyTuple_SET_ITEM(__pyx_2, 0, __pyx_6);
+          __pyx_6 = 0;
+          __pyx_4 = PyObject_Call(((PyObject*)&PyInt_Type), ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
+          __pyx_5 = PyFloat_FromDouble(__pyx_v_child_dx); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_6 = __Pyx_PyNumber_Divide(__pyx_4, __pyx_5); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           Py_DECREF(__pyx_4); __pyx_4 = 0;
-          __pyx_6 = __pyx_PyInt_int(__pyx_2); if (unlikely((__pyx_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_2); __pyx_2 = 0;
-          __pyx_v_child_i = __pyx_6;
-
-          /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":99
- *                     child_leftedges = child_grid.left_edges
- *                     child_i = ((leftedges[0] + i * dx) - child_leftedges[0])/child_dx
- *                     child_j = ((leftedges[1] + j * dx) - child_leftedges[1])/child_dx             # <<<<<<<<<<<<<<
- *                     child_k = ((leftedges[2] + k * dx) - child_leftedges[2])/child_dx
- *                     s = RecurseOctreeDepthFirst(child_i, child_j, child_k, 2, 2, 2,
- */
+          Py_DECREF(__pyx_5); __pyx_5 = 0;
+          __pyx_7 = __pyx_PyInt_int(__pyx_6); if (unlikely((__pyx_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          Py_DECREF(__pyx_6); __pyx_6 = 0;
+          __pyx_v_child_i = __pyx_7;
           __pyx_t_22 = 1;
-          if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_bshape_0_leftedges;
-          __pyx_9 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_leftedges.buf, __pyx_t_22, __pyx_bstride_0_leftedges)));
-          __pyx_3 = PyFloat_FromDouble(__pyx_9); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_5 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_4 = PyNumber_Multiply(__pyx_5, ((PyObject *)__pyx_v_dx)); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_bshape_0_child_leftedges;
+          __pyx_3 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_child_leftedges.buf, __pyx_t_22, __pyx_bstride_0_child_leftedges)));
+          __pyx_2 = PyFloat_FromDouble((__pyx_v_cy - __pyx_3)); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
+          __pyx_2 = 0;
+          __pyx_5 = PyObject_Call(((PyObject*)&PyInt_Type), ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0;
+          __pyx_6 = PyFloat_FromDouble(__pyx_v_child_dx); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_2 = __Pyx_PyNumber_Divide(__pyx_5, __pyx_6); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           Py_DECREF(__pyx_5); __pyx_5 = 0;
-          __pyx_2 = PyNumber_Add(__pyx_3, __pyx_4); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_3); __pyx_3 = 0;
-          Py_DECREF(__pyx_4); __pyx_4 = 0;
-          __pyx_t_23 = 1;
-          if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_bshape_0_child_leftedges;
-          __pyx_9 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_child_leftedges.buf, __pyx_t_23, __pyx_bstride_0_child_leftedges)));
-          __pyx_5 = PyFloat_FromDouble(__pyx_9); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_3 = PyNumber_Subtract(__pyx_2, __pyx_5); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          Py_DECREF(__pyx_6); __pyx_6 = 0;
+          __pyx_7 = __pyx_PyInt_int(__pyx_2); if (unlikely((__pyx_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           Py_DECREF(__pyx_2); __pyx_2 = 0;
-          Py_DECREF(__pyx_5); __pyx_5 = 0;
-          __pyx_4 = __Pyx_PyNumber_Divide(__pyx_3, ((PyObject *)__pyx_v_child_dx)); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_3); __pyx_3 = 0;
-          __pyx_6 = __pyx_PyInt_int(__pyx_4); if (unlikely((__pyx_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_4); __pyx_4 = 0;
-          __pyx_v_child_j = __pyx_6;
-
-          /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":100
- *                     child_i = ((leftedges[0] + i * dx) - child_leftedges[0])/child_dx
- *                     child_j = ((leftedges[1] + j * dx) - child_leftedges[1])/child_dx
- *                     child_k = ((leftedges[2] + k * dx) - child_leftedges[2])/child_dx             # <<<<<<<<<<<<<<
- *                     s = RecurseOctreeDepthFirst(child_i, child_j, child_k, 2, 2, 2,
- *                                         curpos, ci, output, refined, grids)
- */
-          __pyx_t_24 = 2;
-          if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_bshape_0_leftedges;
-          __pyx_9 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_leftedges.buf, __pyx_t_24, __pyx_bstride_0_leftedges)));
-          __pyx_2 = PyFloat_FromDouble(__pyx_9); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_5 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_3 = PyNumber_Multiply(__pyx_5, ((PyObject *)__pyx_v_dx)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_5); __pyx_5 = 0;
-          __pyx_4 = PyNumber_Add(__pyx_2, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_v_child_j = __pyx_7;
+          __pyx_t_23 = 2;
+          if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_bshape_0_child_leftedges;
+          __pyx_3 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_child_leftedges.buf, __pyx_t_23, __pyx_bstride_0_child_leftedges)));
+          __pyx_4 = PyFloat_FromDouble((__pyx_v_cz - __pyx_3)); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_5 = PyTuple_New(1); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          PyTuple_SET_ITEM(__pyx_5, 0, __pyx_4);
+          __pyx_4 = 0;
+          __pyx_6 = PyObject_Call(((PyObject*)&PyInt_Type), ((PyObject *)__pyx_5), NULL); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          Py_DECREF(((PyObject *)__pyx_5)); __pyx_5 = 0;
+          __pyx_2 = PyFloat_FromDouble(__pyx_v_child_dx); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_4 = __Pyx_PyNumber_Divide(__pyx_6, __pyx_2); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          Py_DECREF(__pyx_6); __pyx_6 = 0;
           Py_DECREF(__pyx_2); __pyx_2 = 0;
-          Py_DECREF(__pyx_3); __pyx_3 = 0;
-          __pyx_t_25 = 2;
-          if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_bshape_0_child_leftedges;
-          __pyx_9 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_child_leftedges.buf, __pyx_t_25, __pyx_bstride_0_child_leftedges)));
-          __pyx_5 = PyFloat_FromDouble(__pyx_9); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_2 = PyNumber_Subtract(__pyx_4, __pyx_5); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_7 = __pyx_PyInt_int(__pyx_4); if (unlikely((__pyx_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           Py_DECREF(__pyx_4); __pyx_4 = 0;
-          Py_DECREF(__pyx_5); __pyx_5 = 0;
-          __pyx_3 = __Pyx_PyNumber_Divide(__pyx_2, ((PyObject *)__pyx_v_child_dx)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_2); __pyx_2 = 0;
-          __pyx_6 = __pyx_PyInt_int(__pyx_3); if (unlikely((__pyx_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_3); __pyx_3 = 0;
-          __pyx_v_child_k = __pyx_6;
-
-          /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":101
- *                     child_j = ((leftedges[1] + j * dx) - child_leftedges[1])/child_dx
- *                     child_k = ((leftedges[2] + k * dx) - child_leftedges[2])/child_dx
- *                     s = RecurseOctreeDepthFirst(child_i, child_j, child_k, 2, 2, 2,             # <<<<<<<<<<<<<<
- *                                         curpos, ci, output, refined, grids)
- *     return s
- */
-          __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_kp_17); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_5 = PyInt_FromLong(__pyx_v_child_i); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_2 = PyInt_FromLong(__pyx_v_child_j); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_3 = PyInt_FromLong(__pyx_v_child_k); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-          /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":102
- *                     child_k = ((leftedges[2] + k * dx) - child_leftedges[2])/child_dx
- *                     s = RecurseOctreeDepthFirst(child_i, child_j, child_k, 2, 2, 2,
- *                                         curpos, ci, output, refined, grids)             # <<<<<<<<<<<<<<
- *     return s
- * 
- */
-          __pyx_10 = PyInt_FromLong(__pyx_v_ci); if (unlikely(!__pyx_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_11 = PyTuple_New(11); if (unlikely(!__pyx_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          PyTuple_SET_ITEM(__pyx_11, 0, __pyx_5);
+          __pyx_v_child_k = __pyx_7;
+          __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_kp_17); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_6 = PyInt_FromLong(__pyx_v_child_i); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_2 = PyInt_FromLong(__pyx_v_child_j); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_4 = PyInt_FromLong(__pyx_v_child_k); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_10 = PyInt_FromLong(__pyx_v_ci); if (unlikely(!__pyx_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_11 = PyTuple_New(11); if (unlikely(!__pyx_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          PyTuple_SET_ITEM(__pyx_11, 0, __pyx_6);
           PyTuple_SET_ITEM(__pyx_11, 1, __pyx_2);
-          PyTuple_SET_ITEM(__pyx_11, 2, __pyx_3);
+          PyTuple_SET_ITEM(__pyx_11, 2, __pyx_4);
           Py_INCREF(__pyx_int_2);
           PyTuple_SET_ITEM(__pyx_11, 3, __pyx_int_2);
           Py_INCREF(__pyx_int_2);
@@ -1326,29 +913,21 @@
           PyTuple_SET_ITEM(__pyx_11, 9, ((PyObject *)__pyx_v_refined));
           Py_INCREF(((PyObject *)__pyx_v_grids));
           PyTuple_SET_ITEM(__pyx_11, 10, ((PyObject *)__pyx_v_grids));
-          __pyx_5 = 0;
+          __pyx_6 = 0;
           __pyx_2 = 0;
-          __pyx_3 = 0;
+          __pyx_4 = 0;
           __pyx_10 = 0;
-          __pyx_5 = PyObject_Call(__pyx_4, ((PyObject *)__pyx_11), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_4); __pyx_4 = 0;
+          __pyx_6 = PyObject_Call(__pyx_5, ((PyObject *)__pyx_11), NULL); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          Py_DECREF(__pyx_5); __pyx_5 = 0;
           Py_DECREF(((PyObject *)__pyx_11)); __pyx_11 = 0;
           Py_DECREF(__pyx_v_s);
-          __pyx_v_s = __pyx_5;
-          __pyx_5 = 0;
+          __pyx_v_s = __pyx_6;
+          __pyx_6 = 0;
         }
         __pyx_L11:;
       }
     }
   }
-
-  /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":103
- *                     s = RecurseOctreeDepthFirst(child_i, child_j, child_k, 2, 2, 2,
- *                                         curpos, ci, output, refined, grids)
- *     return s             # <<<<<<<<<<<<<<
- * 
- * @cython.boundscheck(False)
- */
   Py_INCREF(__pyx_v_s);
   __pyx_r = __pyx_v_s;
   goto __pyx_L0;
@@ -1357,17 +936,15 @@
   goto __pyx_L0;
   __pyx_L1_error:;
   Py_XDECREF(__pyx_2);
-  Py_XDECREF(__pyx_3);
   Py_XDECREF(__pyx_4);
   Py_XDECREF(__pyx_5);
+  Py_XDECREF(__pyx_6);
   Py_XDECREF(__pyx_10);
   Py_XDECREF(__pyx_11);
   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
     PyErr_Fetch(&__pyx_type, &__pyx_value, &__pyx_tb);
-    __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_dx, &__pyx_bstruct_dx);
     __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_leftedges, &__pyx_bstruct_leftedges);
     __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_refined, &__pyx_bstruct_refined);
-    __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_child_dx, &__pyx_bstruct_child_dx);
     __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_child_leftedges, &__pyx_bstruct_child_leftedges);
     __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_dimensions, &__pyx_bstruct_dimensions);
     __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_child_indices, &__pyx_bstruct_child_indices);
@@ -1378,10 +955,8 @@
   __pyx_r = NULL;
   goto __pyx_L2;
   __pyx_L0:;
-  __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_dx, &__pyx_bstruct_dx);
   __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_leftedges, &__pyx_bstruct_leftedges);
   __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_refined, &__pyx_bstruct_refined);
-  __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_child_dx, &__pyx_bstruct_child_dx);
   __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_child_leftedges, &__pyx_bstruct_child_leftedges);
   __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_dimensions, &__pyx_bstruct_dimensions);
   __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_child_indices, &__pyx_bstruct_child_indices);
@@ -1394,21 +969,11 @@
   Py_XDECREF(__pyx_v_dimensions);
   Py_XDECREF(__pyx_v_fields);
   Py_XDECREF(__pyx_v_leftedges);
-  Py_XDECREF(__pyx_v_dx);
-  Py_DECREF(__pyx_v_child_dx);
   Py_DECREF(__pyx_v_child_leftedges);
   Py_DECREF(__pyx_v_s);
   return __pyx_r;
 }
 
-/* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":106
- * 
- * @cython.boundscheck(False)
- * def RecurseOctreeByLevels(int i_i, int j_i, int k_i,             # <<<<<<<<<<<<<<
- *                           int i_f, int j_f, int k_f,
- *                           np.ndarray[np.int32_t, ndim=1] curpos,
- */
-
 static PyObject *__pyx_pf_2yt_5lagos_16DepthFirstOctree_RecurseOctreeByLevels(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static PyObject *__pyx_pf_2yt_5lagos_16DepthFirstOctree_RecurseOctreeByLevels(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   int __pyx_v_i_i;
@@ -1421,15 +986,16 @@
   int __pyx_v_gi;
   PyArrayObject *__pyx_v_output = 0;
   PyArrayObject *__pyx_v_genealogy = 0;
+  PyArrayObject *__pyx_v_corners = 0;
   struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGridList *__pyx_v_grids = 0;
-  int __pyx_v_i;
-  int __pyx_v_i_off;
-  int __pyx_v_j;
-  int __pyx_v_j_off;
-  int __pyx_v_k;
-  int __pyx_v_k_off;
-  int __pyx_v_ci;
-  int __pyx_v_fi;
+  __pyx_t_5numpy_int32_t __pyx_v_i;
+  __pyx_t_5numpy_int32_t __pyx_v_i_off;
+  __pyx_t_5numpy_int32_t __pyx_v_j;
+  __pyx_t_5numpy_int32_t __pyx_v_j_off;
+  __pyx_t_5numpy_int32_t __pyx_v_k;
+  __pyx_t_5numpy_int32_t __pyx_v_k_off;
+  __pyx_t_5numpy_int32_t __pyx_v_ci;
+  __pyx_t_5numpy_int32_t __pyx_v_fi;
   int __pyx_v_child_i;
   int __pyx_v_child_j;
   int __pyx_v_child_k;
@@ -1440,22 +1006,20 @@
   PyArrayObject *__pyx_v_dimensions = 0;
   PyArrayObject *__pyx_v_fields = 0;
   PyArrayObject *__pyx_v_leftedges = 0;
-  PyArrayObject *__pyx_v_dx = 0;
-  PyArrayObject *__pyx_v_child_dx;
+  __pyx_t_5numpy_float64_t __pyx_v_dx;
+  __pyx_t_5numpy_float64_t __pyx_v_child_dx;
   PyArrayObject *__pyx_v_child_leftedges;
+  __pyx_t_5numpy_float64_t __pyx_v_cx;
+  __pyx_t_5numpy_float64_t __pyx_v_cy;
+  __pyx_t_5numpy_float64_t __pyx_v_cz;
+  int __pyx_v_cp;
   PyObject *__pyx_v_s;
-  Py_buffer __pyx_bstruct_dx;
-  Py_ssize_t __pyx_bstride_0_dx = 0;
-  Py_ssize_t __pyx_bshape_0_dx = 0;
   Py_buffer __pyx_bstruct_leftedges;
   Py_ssize_t __pyx_bstride_0_leftedges = 0;
   Py_ssize_t __pyx_bshape_0_leftedges = 0;
   Py_buffer __pyx_bstruct_curpos;
   Py_ssize_t __pyx_bstride_0_curpos = 0;
   Py_ssize_t __pyx_bshape_0_curpos = 0;
-  Py_buffer __pyx_bstruct_child_dx;
-  Py_ssize_t __pyx_bstride_0_child_dx = 0;
-  Py_ssize_t __pyx_bshape_0_child_dx = 0;
   Py_buffer __pyx_bstruct_child_leftedges;
   Py_ssize_t __pyx_bstride_0_child_leftedges = 0;
   Py_ssize_t __pyx_bshape_0_child_leftedges = 0;
@@ -1474,6 +1038,11 @@
   Py_ssize_t __pyx_bstride_1_genealogy = 0;
   Py_ssize_t __pyx_bshape_0_genealogy = 0;
   Py_ssize_t __pyx_bshape_1_genealogy = 0;
+  Py_buffer __pyx_bstruct_corners;
+  Py_ssize_t __pyx_bstride_0_corners = 0;
+  Py_ssize_t __pyx_bstride_1_corners = 0;
+  Py_ssize_t __pyx_bshape_0_corners = 0;
+  Py_ssize_t __pyx_bshape_1_corners = 0;
   Py_buffer __pyx_bstruct_fields;
   Py_ssize_t __pyx_bstride_0_fields = 0;
   Py_ssize_t __pyx_bstride_1_fields = 0;
@@ -1491,68 +1060,73 @@
   PyObject *__pyx_r;
   long __pyx_1;
   PyObject *__pyx_2 = 0;
-  int __pyx_3;
-  PyObject *__pyx_4 = 0;
-  __pyx_t_5numpy_int32_t __pyx_5;
-  npy_intp __pyx_6;
-  __pyx_t_5numpy_float64_t __pyx_7;
-  PyObject *__pyx_8 = 0;
-  PyObject *__pyx_9 = 0;
-  int __pyx_10;
-  __pyx_t_5numpy_int32_t __pyx_11;
+  __pyx_t_5numpy_float64_t __pyx_3;
+  int __pyx_4;
+  PyObject *__pyx_5 = 0;
+  PyObject *__pyx_6 = 0;
+  __pyx_t_5numpy_int32_t __pyx_7;
+  npy_intp __pyx_8;
+  int __pyx_9;
+  PyObject *__pyx_10 = 0;
+  PyObject *__pyx_11 = 0;
   PyObject *__pyx_12 = 0;
-  PyObject *__pyx_13 = 0;
   PyArrayObject *__pyx_t_1 = NULL;
   PyArrayObject *__pyx_t_2 = NULL;
   PyArrayObject *__pyx_t_3 = NULL;
   PyArrayObject *__pyx_t_4 = NULL;
-  PyArrayObject *__pyx_t_5 = NULL;
-  int __pyx_t_6;
-  __pyx_t_5numpy_int32_t __pyx_t_7;
+  long __pyx_t_5;
+  long __pyx_t_6;
+  int __pyx_t_7;
   long __pyx_t_8;
   int __pyx_t_9;
-  int __pyx_t_10;
+  long __pyx_t_10;
   int __pyx_t_11;
-  int __pyx_t_12;
+  long __pyx_t_12;
   int __pyx_t_13;
-  __pyx_t_5numpy_int32_t __pyx_t_14;
+  long __pyx_t_14;
   int __pyx_t_15;
-  PyArrayObject *__pyx_t_16 = NULL;
-  int __pyx_t_17;
-  PyObject *__pyx_t_18 = NULL;
-  PyObject *__pyx_t_19 = NULL;
-  PyObject *__pyx_t_20 = NULL;
-  PyArrayObject *__pyx_t_21 = NULL;
-  long __pyx_t_22;
-  long __pyx_t_23;
-  long __pyx_t_24;
-  long __pyx_t_25;
-  long __pyx_t_26;
-  long __pyx_t_27;
-  long __pyx_t_28;
-  __pyx_t_5numpy_int32_t __pyx_t_29;
-  long __pyx_t_30;
-  int __pyx_t_31;
+  __pyx_t_5numpy_int32_t __pyx_t_16;
+  long __pyx_t_17;
+  __pyx_t_5numpy_int32_t __pyx_t_18;
+  __pyx_t_5numpy_int32_t __pyx_t_19;
+  __pyx_t_5numpy_int32_t __pyx_t_20;
+  __pyx_t_5numpy_int32_t __pyx_t_21;
+  int __pyx_t_22;
+  __pyx_t_5numpy_int32_t __pyx_t_23;
+  __pyx_t_5numpy_int32_t __pyx_t_24;
+  __pyx_t_5numpy_int32_t __pyx_t_25;
+  __pyx_t_5numpy_int32_t __pyx_t_26;
+  PyArrayObject *__pyx_t_27 = NULL;
+  int __pyx_t_28;
+  PyObject *__pyx_t_29 = NULL;
+  PyObject *__pyx_t_30 = NULL;
+  PyObject *__pyx_t_31 = NULL;
   long __pyx_t_32;
   long __pyx_t_33;
-  int __pyx_t_34;
-  static char *__pyx_argnames[] = {"i_i","j_i","k_i","i_f","j_f","k_f","curpos","gi","output","genealogy","grids",0};
+  long __pyx_t_34;
+  long __pyx_t_35;
+  long __pyx_t_36;
+  long __pyx_t_37;
+  long __pyx_t_38;
+  int __pyx_t_39;
+  static char *__pyx_argnames[] = {"i_i","j_i","k_i","i_f","j_f","k_f","curpos","gi","output","genealogy","corners","grids",0};
   __pyx_self = __pyx_self;
-  if (likely(!__pyx_kwds) && likely(PyTuple_GET_SIZE(__pyx_args) == 11)) {
-    __pyx_v_i_i = __pyx_PyInt_int(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_i_i == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    __pyx_v_j_i = __pyx_PyInt_int(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_j_i == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    __pyx_v_k_i = __pyx_PyInt_int(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_k_i == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    __pyx_v_i_f = __pyx_PyInt_int(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_i_f == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    __pyx_v_j_f = __pyx_PyInt_int(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_j_f == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    __pyx_v_k_f = __pyx_PyInt_int(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_k_f == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  if (likely(!__pyx_kwds) && likely(PyTuple_GET_SIZE(__pyx_args) == 12)) {
+    __pyx_v_i_i = __pyx_PyInt_int(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_i_i == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_j_i = __pyx_PyInt_int(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_j_i == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_k_i = __pyx_PyInt_int(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_k_i == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_i_f = __pyx_PyInt_int(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_i_f == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_j_f = __pyx_PyInt_int(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_j_f == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_k_f = __pyx_PyInt_int(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_k_f == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     __pyx_v_curpos = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 6));
-    __pyx_v_gi = __pyx_PyInt_int(PyTuple_GET_ITEM(__pyx_args, 7)); if (unlikely((__pyx_v_gi == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_gi = __pyx_PyInt_int(PyTuple_GET_ITEM(__pyx_args, 7)); if (unlikely((__pyx_v_gi == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     __pyx_v_output = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 8));
     __pyx_v_genealogy = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 9));
-    __pyx_v_grids = ((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGridList *)PyTuple_GET_ITEM(__pyx_args, 10));
+    __pyx_v_corners = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 10));
+    __pyx_v_grids = ((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGridList *)PyTuple_GET_ITEM(__pyx_args, 11));
   }
   else {
-    if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "iiiiiiOiOOO", __pyx_argnames, &__pyx_v_i_i, &__pyx_v_j_i, &__pyx_v_k_i, &__pyx_v_i_f, &__pyx_v_j_f, &__pyx_v_k_f, &__pyx_v_curpos, &__pyx_v_gi, &__pyx_v_output, &__pyx_v_genealogy, &__pyx_v_grids))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "iiiiiiOiOOOO", __pyx_argnames, &__pyx_v_i_i, &__pyx_v_j_i, &__pyx_v_k_i, &__pyx_v_i_f, &__pyx_v_j_f, &__pyx_v_k_f, &__pyx_v_curpos, &__pyx_v_gi, &__pyx_v_output, &__pyx_v_genealogy, &__pyx_v_corners, &__pyx_v_grids))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   }
   goto __pyx_L4;
   __pyx_L3_error:;
@@ -1564,586 +1138,306 @@
   __pyx_bstruct_dimensions.buf = NULL;
   __pyx_bstruct_fields.buf = NULL;
   __pyx_bstruct_leftedges.buf = NULL;
-  __pyx_bstruct_dx.buf = NULL;
-  __pyx_v_child_dx = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
-  __pyx_bstruct_child_dx.buf = NULL;
   __pyx_v_child_leftedges = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
   __pyx_bstruct_child_leftedges.buf = NULL;
   __pyx_v_s = Py_None; Py_INCREF(Py_None);
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_curpos), __pyx_ptype_5numpy_ndarray, 1, "curpos", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_output), __pyx_ptype_5numpy_ndarray, 1, "output", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_genealogy), __pyx_ptype_5numpy_ndarray, 1, "genealogy", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grids), __pyx_ptype_2yt_5lagos_16DepthFirstOctree_OctreeGridList, 1, "grids", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_int32_t((PyObject*)__pyx_v_curpos, &__pyx_bstruct_curpos, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_curpos), __pyx_ptype_5numpy_ndarray, 1, "curpos", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_output), __pyx_ptype_5numpy_ndarray, 1, "output", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_genealogy), __pyx_ptype_5numpy_ndarray, 1, "genealogy", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_corners), __pyx_ptype_5numpy_ndarray, 1, "corners", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grids), __pyx_ptype_2yt_5lagos_16DepthFirstOctree_OctreeGridList, 1, "grids", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_int32_t((PyObject*)__pyx_v_curpos, &__pyx_bstruct_curpos, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_bstride_0_curpos = __pyx_bstruct_curpos.strides[0];
   __pyx_bshape_0_curpos = __pyx_bstruct_curpos.shape[0];
-  if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_float64_t((PyObject*)__pyx_v_output, &__pyx_bstruct_output, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_float64_t((PyObject*)__pyx_v_output, &__pyx_bstruct_output, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_bstride_0_output = __pyx_bstruct_output.strides[0]; __pyx_bstride_1_output = __pyx_bstruct_output.strides[1];
   __pyx_bshape_0_output = __pyx_bstruct_output.shape[0]; __pyx_bshape_1_output = __pyx_bstruct_output.shape[1];
-  if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_int32_t((PyObject*)__pyx_v_genealogy, &__pyx_bstruct_genealogy, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_int32_t((PyObject*)__pyx_v_genealogy, &__pyx_bstruct_genealogy, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_bstride_0_genealogy = __pyx_bstruct_genealogy.strides[0]; __pyx_bstride_1_genealogy = __pyx_bstruct_genealogy.strides[1];
   __pyx_bshape_0_genealogy = __pyx_bstruct_genealogy.shape[0]; __pyx_bshape_1_genealogy = __pyx_bstruct_genealogy.shape[1];
-
-  /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":116
- *     cdef int child_i, child_j, child_k
- *     cdef OctreeGrid child_grid
- *     cdef OctreeGrid grid = grids[gi-1]             # <<<<<<<<<<<<<<
- *     cdef int level = grid.level
- *     cdef np.ndarray[np.int32_t, ndim=3] child_indices = grid.child_indices
- */
+  if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_float64_t((PyObject*)__pyx_v_corners, &__pyx_bstruct_corners, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_bstride_0_corners = __pyx_bstruct_corners.strides[0]; __pyx_bstride_1_corners = __pyx_bstruct_corners.strides[1];
+  __pyx_bshape_0_corners = __pyx_bstruct_corners.shape[0]; __pyx_bshape_1_corners = __pyx_bstruct_corners.shape[1];
   __pyx_1 = (__pyx_v_gi - 1);
-  __pyx_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_grids), __pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (!(__Pyx_TypeTest(__pyx_2, __pyx_ptype_2yt_5lagos_16DepthFirstOctree_OctreeGrid))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_grids), __pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (!(__Pyx_TypeTest(__pyx_2, __pyx_ptype_2yt_5lagos_16DepthFirstOctree_OctreeGrid))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_grid = ((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGrid *)__pyx_2);
   __pyx_2 = 0;
-
-  /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":117
- *     cdef OctreeGrid child_grid
- *     cdef OctreeGrid grid = grids[gi-1]
- *     cdef int level = grid.level             # <<<<<<<<<<<<<<
- *     cdef np.ndarray[np.int32_t, ndim=3] child_indices = grid.child_indices
- *     cdef np.ndarray[np.int32_t, ndim=1] dimensions = grid.dimensions
- */
   __pyx_v_level = __pyx_v_grid->level;
-
-  /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":118
- *     cdef OctreeGrid grid = grids[gi-1]
- *     cdef int level = grid.level
- *     cdef np.ndarray[np.int32_t, ndim=3] child_indices = grid.child_indices             # <<<<<<<<<<<<<<
- *     cdef np.ndarray[np.int32_t, ndim=1] dimensions = grid.dimensions
- *     cdef np.ndarray[np.float64_t, ndim=4] fields = grid.fields
- */
-  if (!(__Pyx_TypeTest(__pyx_v_grid->child_indices, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (!(__Pyx_TypeTest(__pyx_v_grid->child_indices, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_1 = ((PyArrayObject *)__pyx_v_grid->child_indices);
   if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_int32_t((PyObject*)__pyx_t_1, &__pyx_bstruct_child_indices, PyBUF_FORMAT| PyBUF_STRIDES, 3) == -1)) {
     __pyx_v_child_indices = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_bstruct_child_indices.buf = NULL;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   } else {__pyx_bstride_0_child_indices = __pyx_bstruct_child_indices.strides[0]; __pyx_bstride_1_child_indices = __pyx_bstruct_child_indices.strides[1]; __pyx_bstride_2_child_indices = __pyx_bstruct_child_indices.strides[2];
     __pyx_bshape_0_child_indices = __pyx_bstruct_child_indices.shape[0]; __pyx_bshape_1_child_indices = __pyx_bstruct_child_indices.shape[1]; __pyx_bshape_2_child_indices = __pyx_bstruct_child_indices.shape[2];
   }
   __pyx_t_1 = 0;
   Py_INCREF(__pyx_v_grid->child_indices);
   __pyx_v_child_indices = ((PyArrayObject *)__pyx_v_grid->child_indices);
-
-  /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":119
- *     cdef int level = grid.level
- *     cdef np.ndarray[np.int32_t, ndim=3] child_indices = grid.child_indices
- *     cdef np.ndarray[np.int32_t, ndim=1] dimensions = grid.dimensions             # <<<<<<<<<<<<<<
- *     cdef np.ndarray[np.float64_t, ndim=4] fields = grid.fields
- *     cdef np.ndarray[np.float64_t, ndim=1] leftedges = grid.left_edges
- */
-  if (!(__Pyx_TypeTest(__pyx_v_grid->dimensions, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (!(__Pyx_TypeTest(__pyx_v_grid->dimensions, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_2 = ((PyArrayObject *)__pyx_v_grid->dimensions);
   if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_int32_t((PyObject*)__pyx_t_2, &__pyx_bstruct_dimensions, PyBUF_FORMAT| PyBUF_STRIDES, 1) == -1)) {
     __pyx_v_dimensions = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_bstruct_dimensions.buf = NULL;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   } else {__pyx_bstride_0_dimensions = __pyx_bstruct_dimensions.strides[0];
     __pyx_bshape_0_dimensions = __pyx_bstruct_dimensions.shape[0];
   }
   __pyx_t_2 = 0;
   Py_INCREF(__pyx_v_grid->dimensions);
   __pyx_v_dimensions = ((PyArrayObject *)__pyx_v_grid->dimensions);
-
-  /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":120
- *     cdef np.ndarray[np.int32_t, ndim=3] child_indices = grid.child_indices
- *     cdef np.ndarray[np.int32_t, ndim=1] dimensions = grid.dimensions
- *     cdef np.ndarray[np.float64_t, ndim=4] fields = grid.fields             # <<<<<<<<<<<<<<
- *     cdef np.ndarray[np.float64_t, ndim=1] leftedges = grid.left_edges
- *     cdef np.ndarray[np.float64_t, ndim=1] dx = grid.dx
- */
-  if (!(__Pyx_TypeTest(__pyx_v_grid->fields, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (!(__Pyx_TypeTest(__pyx_v_grid->fields, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_3 = ((PyArrayObject *)__pyx_v_grid->fields);
   if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_float64_t((PyObject*)__pyx_t_3, &__pyx_bstruct_fields, PyBUF_FORMAT| PyBUF_STRIDES, 4) == -1)) {
     __pyx_v_fields = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_bstruct_fields.buf = NULL;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   } else {__pyx_bstride_0_fields = __pyx_bstruct_fields.strides[0]; __pyx_bstride_1_fields = __pyx_bstruct_fields.strides[1]; __pyx_bstride_2_fields = __pyx_bstruct_fields.strides[2]; __pyx_bstride_3_fields = __pyx_bstruct_fields.strides[3];
     __pyx_bshape_0_fields = __pyx_bstruct_fields.shape[0]; __pyx_bshape_1_fields = __pyx_bstruct_fields.shape[1]; __pyx_bshape_2_fields = __pyx_bstruct_fields.shape[2]; __pyx_bshape_3_fields = __pyx_bstruct_fields.shape[3];
   }
   __pyx_t_3 = 0;
   Py_INCREF(__pyx_v_grid->fields);
   __pyx_v_fields = ((PyArrayObject *)__pyx_v_grid->fields);
-
-  /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":121
- *     cdef np.ndarray[np.int32_t, ndim=1] dimensions = grid.dimensions
- *     cdef np.ndarray[np.float64_t, ndim=4] fields = grid.fields
- *     cdef np.ndarray[np.float64_t, ndim=1] leftedges = grid.left_edges             # <<<<<<<<<<<<<<
- *     cdef np.ndarray[np.float64_t, ndim=1] dx = grid.dx
- *     cdef np.ndarray[np.float64_t, ndim=1] child_dx
- */
-  if (!(__Pyx_TypeTest(__pyx_v_grid->left_edges, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (!(__Pyx_TypeTest(__pyx_v_grid->left_edges, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_t_4 = ((PyArrayObject *)__pyx_v_grid->left_edges);
   if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_float64_t((PyObject*)__pyx_t_4, &__pyx_bstruct_leftedges, PyBUF_FORMAT| PyBUF_STRIDES, 1) == -1)) {
     __pyx_v_leftedges = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_bstruct_leftedges.buf = NULL;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   } else {__pyx_bstride_0_leftedges = __pyx_bstruct_leftedges.strides[0];
     __pyx_bshape_0_leftedges = __pyx_bstruct_leftedges.shape[0];
   }
   __pyx_t_4 = 0;
   Py_INCREF(__pyx_v_grid->left_edges);
   __pyx_v_leftedges = ((PyArrayObject *)__pyx_v_grid->left_edges);
-
-  /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":122
- *     cdef np.ndarray[np.float64_t, ndim=4] fields = grid.fields
- *     cdef np.ndarray[np.float64_t, ndim=1] leftedges = grid.left_edges
- *     cdef np.ndarray[np.float64_t, ndim=1] dx = grid.dx             # <<<<<<<<<<<<<<
- *     cdef np.ndarray[np.float64_t, ndim=1] child_dx
- *     cdef np.ndarray[np.float64_t, ndim=1] child_leftedges
- */
-  if (!(__Pyx_TypeTest(__pyx_v_grid->dx, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_5 = ((PyArrayObject *)__pyx_v_grid->dx);
-  if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_float64_t((PyObject*)__pyx_t_5, &__pyx_bstruct_dx, PyBUF_FORMAT| PyBUF_STRIDES, 1) == -1)) {
-    __pyx_v_dx = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_bstruct_dx.buf = NULL;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  } else {__pyx_bstride_0_dx = __pyx_bstruct_dx.strides[0];
-    __pyx_bshape_0_dx = __pyx_bstruct_dx.shape[0];
-  }
-  __pyx_t_5 = 0;
-  Py_INCREF(__pyx_v_grid->dx);
-  __pyx_v_dx = ((PyArrayObject *)__pyx_v_grid->dx);
-
-  /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":125
- *     cdef np.ndarray[np.float64_t, ndim=1] child_dx
- *     cdef np.ndarray[np.float64_t, ndim=1] child_leftedges
- *     for k_off in range(i_f):             # <<<<<<<<<<<<<<
- *         k = k_off + k_i
- *         if i_f > 2: print k
- */
-  for (__pyx_v_k_off = 0; __pyx_v_k_off < __pyx_v_i_f; __pyx_v_k_off+=1) {
-
-    /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":126
- *     cdef np.ndarray[np.float64_t, ndim=1] child_leftedges
- *     for k_off in range(i_f):
- *         k = k_off + k_i             # <<<<<<<<<<<<<<
- *         if i_f > 2: print k
- *         for j_off in range(j_f):
- */
+  __pyx_2 = __Pyx_GetItemInt(__pyx_v_grid->dx, 0, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_3 = __pyx_PyFloat_AsDouble(__pyx_2); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_v_dx = __pyx_3;
+  for (__pyx_v_k_off = 0; __pyx_v_k_off < __pyx_v_k_f; __pyx_v_k_off+=1) {
     __pyx_v_k = (__pyx_v_k_off + __pyx_v_k_i);
-
-    /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":127
- *     for k_off in range(i_f):
- *         k = k_off + k_i
- *         if i_f > 2: print k             # <<<<<<<<<<<<<<
- *         for j_off in range(j_f):
- *             j = j_off + j_i
- */
-    __pyx_3 = (__pyx_v_i_f > 2);
-    if (__pyx_3) {
-      __pyx_2 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
+    __pyx_t_5 = 2;
+    if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_bshape_0_leftedges;
+    __pyx_3 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_leftedges.buf, __pyx_t_5, __pyx_bstride_0_leftedges)));
+    __pyx_v_cz = (__pyx_3 + (__pyx_v_k * __pyx_v_dx));
+    __pyx_4 = (__pyx_v_i_f > 2);
+    if (__pyx_4) {
+      __pyx_2 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_5 = PyFloat_FromDouble(__pyx_v_cz); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_6 = PyTuple_New(2); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      PyTuple_SET_ITEM(__pyx_6, 0, __pyx_2);
+      PyTuple_SET_ITEM(__pyx_6, 1, __pyx_5);
       __pyx_2 = 0;
-      if (__Pyx_Print(((PyObject *)__pyx_4), 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-      Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0;
+      __pyx_5 = 0;
+      if (__Pyx_Print(((PyObject *)__pyx_6), 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      Py_DECREF(((PyObject *)__pyx_6)); __pyx_6 = 0;
       goto __pyx_L7;
     }
     __pyx_L7:;
-
-    /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":128
- *         k = k_off + k_i
- *         if i_f > 2: print k
- *         for j_off in range(j_f):             # <<<<<<<<<<<<<<
- *             j = j_off + j_i
- *             for i_off in range(k_f):
- */
     for (__pyx_v_j_off = 0; __pyx_v_j_off < __pyx_v_j_f; __pyx_v_j_off+=1) {
-
-      /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":129
- *         if i_f > 2: print k
- *         for j_off in range(j_f):
- *             j = j_off + j_i             # <<<<<<<<<<<<<<
- *             for i_off in range(k_f):
- *                 genealogy[curpos[level], 2] = level
- */
       __pyx_v_j = (__pyx_v_j_off + __pyx_v_j_i);
-
-      /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":130
- *         for j_off in range(j_f):
- *             j = j_off + j_i
- *             for i_off in range(k_f):             # <<<<<<<<<<<<<<
- *                 genealogy[curpos[level], 2] = level
- *                 i = i_off + i_i
- */
-      for (__pyx_v_i_off = 0; __pyx_v_i_off < __pyx_v_k_f; __pyx_v_i_off+=1) {
-
-        /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":131
- *             j = j_off + j_i
- *             for i_off in range(k_f):
- *                 genealogy[curpos[level], 2] = level             # <<<<<<<<<<<<<<
- *                 i = i_off + i_i
- *                 # always output data
- */
-        __pyx_t_6 = __pyx_v_level;
-        if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_bshape_0_curpos;
-        __pyx_5 = *((__pyx_t_5numpy_int32_t *)((__pyx_t_5numpy_int32_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_curpos.buf, __pyx_t_6, __pyx_bstride_0_curpos)));
-        __pyx_t_7 = __pyx_5;
-        __pyx_t_8 = 2;
-        if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_bshape_0_genealogy;
-        if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_bshape_1_genealogy;
-        *((__pyx_t_5numpy_int32_t *)__Pyx_BufPtrStrided2d(__pyx_bstruct_genealogy.buf, __pyx_t_7, __pyx_bstride_0_genealogy, __pyx_t_8, __pyx_bstride_1_genealogy)) = __pyx_v_level;
-
-        /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":132
- *             for i_off in range(k_f):
- *                 genealogy[curpos[level], 2] = level
- *                 i = i_off + i_i             # <<<<<<<<<<<<<<
- *                 # always output data
- *                 for fi in range(fields.shape[0]):
- */
+      __pyx_t_6 = 1;
+      if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_bshape_0_leftedges;
+      __pyx_3 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_leftedges.buf, __pyx_t_6, __pyx_bstride_0_leftedges)));
+      __pyx_v_cy = (__pyx_3 + (__pyx_v_j * __pyx_v_dx));
+      for (__pyx_v_i_off = 0; __pyx_v_i_off < __pyx_v_i_f; __pyx_v_i_off+=1) {
         __pyx_v_i = (__pyx_v_i_off + __pyx_v_i_i);
-
-        /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":134
- *                 i = i_off + i_i
- *                 # always output data
- *                 for fi in range(fields.shape[0]):             # <<<<<<<<<<<<<<
- *                     output[curpos[level],fi] = fields[fi,i,j,k]
- *                 ci = grid.child_indices[i,j,k]
- */
-        __pyx_6 = (__pyx_v_fields->dimensions[0]);
-        for (__pyx_v_fi = 0; __pyx_v_fi < __pyx_6; __pyx_v_fi+=1) {
-
-          /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":135
- *                 # always output data
- *                 for fi in range(fields.shape[0]):
- *                     output[curpos[level],fi] = fields[fi,i,j,k]             # <<<<<<<<<<<<<<
- *                 ci = grid.child_indices[i,j,k]
- *                 if ci > -1:
- */
-          __pyx_t_9 = __pyx_v_fi;
-          __pyx_t_10 = __pyx_v_i;
-          __pyx_t_11 = __pyx_v_j;
-          __pyx_t_12 = __pyx_v_k;
-          if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_bshape_0_fields;
-          if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_bshape_1_fields;
-          if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_bshape_2_fields;
-          if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_bshape_3_fields;
-          __pyx_7 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided4d(__pyx_bstruct_fields.buf, __pyx_t_9, __pyx_bstride_0_fields, __pyx_t_10, __pyx_bstride_1_fields, __pyx_t_11, __pyx_bstride_2_fields, __pyx_t_12, __pyx_bstride_3_fields)));
-          __pyx_t_13 = __pyx_v_level;
-          if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_bshape_0_curpos;
-          __pyx_5 = *((__pyx_t_5numpy_int32_t *)((__pyx_t_5numpy_int32_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_curpos.buf, __pyx_t_13, __pyx_bstride_0_curpos)));
-          __pyx_t_14 = __pyx_5;
-          __pyx_t_15 = __pyx_v_fi;
-          if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_0_output;
-          if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_1_output;
-          *((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided2d(__pyx_bstruct_output.buf, __pyx_t_14, __pyx_bstride_0_output, __pyx_t_15, __pyx_bstride_1_output)) = __pyx_7;
-        }
-
-        /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":136
- *                 for fi in range(fields.shape[0]):
- *                     output[curpos[level],fi] = fields[fi,i,j,k]
- *                 ci = grid.child_indices[i,j,k]             # <<<<<<<<<<<<<<
- *                 if ci > -1:
- *                     child_grid = grids[ci-1]
- */
-        __pyx_2 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_4 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_8 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_9 = PyTuple_New(3); if (unlikely(!__pyx_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        PyTuple_SET_ITEM(__pyx_9, 0, __pyx_2);
-        PyTuple_SET_ITEM(__pyx_9, 1, __pyx_4);
-        PyTuple_SET_ITEM(__pyx_9, 2, __pyx_8);
-        __pyx_2 = 0;
-        __pyx_4 = 0;
-        __pyx_8 = 0;
-        __pyx_2 = PyObject_GetItem(__pyx_v_grid->child_indices, ((PyObject *)__pyx_9)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        Py_DECREF(((PyObject *)__pyx_9)); __pyx_9 = 0;
-        __pyx_10 = __pyx_PyInt_int(__pyx_2); if (unlikely((__pyx_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        Py_DECREF(__pyx_2); __pyx_2 = 0;
-        __pyx_v_ci = __pyx_10;
-
-        /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":137
- *                     output[curpos[level],fi] = fields[fi,i,j,k]
- *                 ci = grid.child_indices[i,j,k]
- *                 if ci > -1:             # <<<<<<<<<<<<<<
- *                     child_grid = grids[ci-1]
- *                     child_dx = child_grid.dx
- */
-        __pyx_3 = (__pyx_v_ci > -1);
-        if (__pyx_3) {
-
-          /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":138
- *                 ci = grid.child_indices[i,j,k]
- *                 if ci > -1:
- *                     child_grid = grids[ci-1]             # <<<<<<<<<<<<<<
- *                     child_dx = child_grid.dx
- *                     child_leftedges = child_grid.left_edges
- */
+        __pyx_t_7 = __pyx_v_level;
+        if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_bshape_0_curpos;
+        __pyx_7 = *((__pyx_t_5numpy_int32_t *)((__pyx_t_5numpy_int32_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_curpos.buf, __pyx_t_7, __pyx_bstride_0_curpos)));
+        __pyx_v_cp = __pyx_7;
+        __pyx_t_8 = 0;
+        if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_bshape_0_leftedges;
+        __pyx_3 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_leftedges.buf, __pyx_t_8, __pyx_bstride_0_leftedges)));
+        __pyx_v_cx = (__pyx_3 + (__pyx_v_i * __pyx_v_dx));
+        __pyx_t_9 = __pyx_v_cp;
+        __pyx_t_10 = 0;
+        if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_bshape_0_corners;
+        if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_bshape_1_corners;
+        *((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided2d(__pyx_bstruct_corners.buf, __pyx_t_9, __pyx_bstride_0_corners, __pyx_t_10, __pyx_bstride_1_corners)) = __pyx_v_cx;
+        __pyx_t_11 = __pyx_v_cp;
+        __pyx_t_12 = 1;
+        if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_bshape_0_corners;
+        if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_bshape_1_corners;
+        *((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided2d(__pyx_bstruct_corners.buf, __pyx_t_11, __pyx_bstride_0_corners, __pyx_t_12, __pyx_bstride_1_corners)) = __pyx_v_cy;
+        __pyx_t_13 = __pyx_v_cp;
+        __pyx_t_14 = 2;
+        if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_bshape_0_corners;
+        if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_1_corners;
+        *((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided2d(__pyx_bstruct_corners.buf, __pyx_t_13, __pyx_bstride_0_corners, __pyx_t_14, __pyx_bstride_1_corners)) = __pyx_v_cz;
+        __pyx_t_15 = __pyx_v_level;
+        if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_0_curpos;
+        __pyx_7 = *((__pyx_t_5numpy_int32_t *)((__pyx_t_5numpy_int32_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_curpos.buf, __pyx_t_15, __pyx_bstride_0_curpos)));
+        __pyx_t_16 = __pyx_7;
+        __pyx_t_17 = 2;
+        if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_bshape_0_genealogy;
+        if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_bshape_1_genealogy;
+        *((__pyx_t_5numpy_int32_t *)__Pyx_BufPtrStrided2d(__pyx_bstruct_genealogy.buf, __pyx_t_16, __pyx_bstride_0_genealogy, __pyx_t_17, __pyx_bstride_1_genealogy)) = __pyx_v_level;
+        __pyx_8 = (__pyx_v_fields->dimensions[0]);
+        for (__pyx_v_fi = 0; __pyx_v_fi < __pyx_8; __pyx_v_fi+=1) {
+          __pyx_t_18 = __pyx_v_fi;
+          __pyx_t_19 = __pyx_v_i;
+          __pyx_t_20 = __pyx_v_j;
+          __pyx_t_21 = __pyx_v_k;
+          if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_bshape_0_fields;
+          if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_bshape_1_fields;
+          if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_bshape_2_fields;
+          if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_bshape_3_fields;
+          __pyx_3 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided4d(__pyx_bstruct_fields.buf, __pyx_t_18, __pyx_bstride_0_fields, __pyx_t_19, __pyx_bstride_1_fields, __pyx_t_20, __pyx_bstride_2_fields, __pyx_t_21, __pyx_bstride_3_fields)));
+          __pyx_t_22 = __pyx_v_cp;
+          __pyx_t_23 = __pyx_v_fi;
+          if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_bshape_0_output;
+          if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_bshape_1_output;
+          *((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided2d(__pyx_bstruct_output.buf, __pyx_t_22, __pyx_bstride_0_output, __pyx_t_23, __pyx_bstride_1_output)) = __pyx_3;
+        }
+        __pyx_t_24 = __pyx_v_i;
+        __pyx_t_25 = __pyx_v_j;
+        __pyx_t_26 = __pyx_v_k;
+        if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_bshape_0_child_indices;
+        if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_bshape_1_child_indices;
+        if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_bshape_2_child_indices;
+        __pyx_7 = *((__pyx_t_5numpy_int32_t *)((__pyx_t_5numpy_int32_t *)__Pyx_BufPtrStrided3d(__pyx_bstruct_child_indices.buf, __pyx_t_24, __pyx_bstride_0_child_indices, __pyx_t_25, __pyx_bstride_1_child_indices, __pyx_t_26, __pyx_bstride_2_child_indices)));
+        __pyx_v_ci = __pyx_7;
+        __pyx_4 = (__pyx_v_ci > -1);
+        if (__pyx_4) {
           __pyx_1 = (__pyx_v_ci - 1);
-          __pyx_4 = __Pyx_GetItemInt(((PyObject *)__pyx_v_grids), __pyx_1, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          if (!(__Pyx_TypeTest(__pyx_4, __pyx_ptype_2yt_5lagos_16DepthFirstOctree_OctreeGrid))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_grids), __pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          if (!(__Pyx_TypeTest(__pyx_2, __pyx_ptype_2yt_5lagos_16DepthFirstOctree_OctreeGrid))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           Py_DECREF(((PyObject *)__pyx_v_child_grid));
-          __pyx_v_child_grid = ((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGrid *)__pyx_4);
-          __pyx_4 = 0;
-
-          /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":139
- *                 if ci > -1:
- *                     child_grid = grids[ci-1]
- *                     child_dx = child_grid.dx             # <<<<<<<<<<<<<<
- *                     child_leftedges = child_grid.left_edges
- *                     child_i = ((leftedges[0] + i * dx) - child_leftedges[0])/child_dx
- */
-          if (!(__Pyx_TypeTest(__pyx_v_child_grid->dx, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_t_16 = ((PyArrayObject *)__pyx_v_child_grid->dx);
-          __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_child_dx, &__pyx_bstruct_child_dx);
-          __pyx_t_17 = __Pyx_GetBuffer_nn___pyx_t_5numpy_float64_t((PyObject*)__pyx_t_16, &__pyx_bstruct_child_dx, PyBUF_FORMAT| PyBUF_STRIDES, 1);
-          if (unlikely(__pyx_t_17 < 0)) 
-          {
-              PyErr_Fetch(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20);
-              if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_float64_t((PyObject*)__pyx_v_child_dx, &__pyx_bstruct_child_dx, PyBUF_FORMAT| PyBUF_STRIDES, 1) == -1)) {
-                  Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20);
-                  __Pyx_RaiseBufferFallbackError();
-                } else {
-                  PyErr_Restore(__pyx_t_18, __pyx_t_19, __pyx_t_20);
-              }
-          }
-          __pyx_bstride_0_child_dx = __pyx_bstruct_child_dx.strides[0];
-          __pyx_bshape_0_child_dx = __pyx_bstruct_child_dx.shape[0];
-          if (unlikely(__pyx_t_17 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_t_16 = 0;
-          Py_INCREF(__pyx_v_child_grid->dx);
-          Py_DECREF(((PyObject *)__pyx_v_child_dx));
-          __pyx_v_child_dx = ((PyArrayObject *)__pyx_v_child_grid->dx);
-
-          /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":140
- *                     child_grid = grids[ci-1]
- *                     child_dx = child_grid.dx
- *                     child_leftedges = child_grid.left_edges             # <<<<<<<<<<<<<<
- *                     child_i = ((leftedges[0] + i * dx) - child_leftedges[0])/child_dx
- *                     child_j = ((leftedges[1] + j * dx) - child_leftedges[1])/child_dx
- */
-          if (!(__Pyx_TypeTest(__pyx_v_child_grid->left_edges, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_t_21 = ((PyArrayObject *)__pyx_v_child_grid->left_edges);
+          __pyx_v_child_grid = ((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGrid *)__pyx_2);
+          __pyx_2 = 0;
+          __pyx_5 = __Pyx_GetItemInt(__pyx_v_child_grid->dx, 0, 0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_3 = __pyx_PyFloat_AsDouble(__pyx_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          Py_DECREF(__pyx_5); __pyx_5 = 0;
+          __pyx_v_child_dx = __pyx_3;
+          if (!(__Pyx_TypeTest(__pyx_v_child_grid->left_edges, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_27 = ((PyArrayObject *)__pyx_v_child_grid->left_edges);
           __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_child_leftedges, &__pyx_bstruct_child_leftedges);
-          __pyx_t_17 = __Pyx_GetBuffer_nn___pyx_t_5numpy_float64_t((PyObject*)__pyx_t_21, &__pyx_bstruct_child_leftedges, PyBUF_FORMAT| PyBUF_STRIDES, 1);
-          if (unlikely(__pyx_t_17 < 0)) 
+          __pyx_t_28 = __Pyx_GetBuffer_nn___pyx_t_5numpy_float64_t((PyObject*)__pyx_t_27, &__pyx_bstruct_child_leftedges, PyBUF_FORMAT| PyBUF_STRIDES, 1);
+          if (unlikely(__pyx_t_28 < 0)) 
           {
-              PyErr_Fetch(&__pyx_t_20, &__pyx_t_19, &__pyx_t_18);
+              PyErr_Fetch(&__pyx_t_29, &__pyx_t_30, &__pyx_t_31);
               if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_float64_t((PyObject*)__pyx_v_child_leftedges, &__pyx_bstruct_child_leftedges, PyBUF_FORMAT| PyBUF_STRIDES, 1) == -1)) {
-                  Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_18);
+                  Py_XDECREF(__pyx_t_29); Py_XDECREF(__pyx_t_30); Py_XDECREF(__pyx_t_31);
                   __Pyx_RaiseBufferFallbackError();
                 } else {
-                  PyErr_Restore(__pyx_t_20, __pyx_t_19, __pyx_t_18);
+                  PyErr_Restore(__pyx_t_29, __pyx_t_30, __pyx_t_31);
               }
           }
           __pyx_bstride_0_child_leftedges = __pyx_bstruct_child_leftedges.strides[0];
           __pyx_bshape_0_child_leftedges = __pyx_bstruct_child_leftedges.shape[0];
-          if (unlikely(__pyx_t_17 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_t_21 = 0;
+          if (unlikely(__pyx_t_28 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_27 = 0;
           Py_INCREF(__pyx_v_child_grid->left_edges);
           Py_DECREF(((PyObject *)__pyx_v_child_leftedges));
           __pyx_v_child_leftedges = ((PyArrayObject *)__pyx_v_child_grid->left_edges);
-
-          /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":141
- *                     child_dx = child_grid.dx
- *                     child_leftedges = child_grid.left_edges
- *                     child_i = ((leftedges[0] + i * dx) - child_leftedges[0])/child_dx             # <<<<<<<<<<<<<<
- *                     child_j = ((leftedges[1] + j * dx) - child_leftedges[1])/child_dx
- *                     child_k = ((leftedges[2] + k * dx) - child_leftedges[2])/child_dx
- */
-          __pyx_t_22 = 0;
-          if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_bshape_0_leftedges;
-          __pyx_7 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_leftedges.buf, __pyx_t_22, __pyx_bstride_0_leftedges)));
-          __pyx_8 = PyFloat_FromDouble(__pyx_7); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_9 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_2 = PyNumber_Multiply(__pyx_9, ((PyObject *)__pyx_v_dx)); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_9); __pyx_9 = 0;
-          __pyx_4 = PyNumber_Add(__pyx_8, __pyx_2); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_8); __pyx_8 = 0;
-          Py_DECREF(__pyx_2); __pyx_2 = 0;
-          __pyx_t_23 = 0;
-          if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_bshape_0_child_leftedges;
-          __pyx_7 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_child_leftedges.buf, __pyx_t_23, __pyx_bstride_0_child_leftedges)));
-          __pyx_9 = PyFloat_FromDouble(__pyx_7); if (unlikely(!__pyx_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_8 = PyNumber_Subtract(__pyx_4, __pyx_9); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_4); __pyx_4 = 0;
-          Py_DECREF(__pyx_9); __pyx_9 = 0;
-          __pyx_2 = __Pyx_PyNumber_Divide(__pyx_8, ((PyObject *)__pyx_v_child_dx)); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_8); __pyx_8 = 0;
-          __pyx_10 = __pyx_PyInt_int(__pyx_2); if (unlikely((__pyx_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_2); __pyx_2 = 0;
-          __pyx_v_child_i = __pyx_10;
-
-          /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":142
- *                     child_leftedges = child_grid.left_edges
- *                     child_i = ((leftedges[0] + i * dx) - child_leftedges[0])/child_dx
- *                     child_j = ((leftedges[1] + j * dx) - child_leftedges[1])/child_dx             # <<<<<<<<<<<<<<
- *                     child_k = ((leftedges[2] + k * dx) - child_leftedges[2])/child_dx
- *                     # set current child id to id of next cell to examine
- */
-          __pyx_t_24 = 1;
-          if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_bshape_0_leftedges;
-          __pyx_7 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_leftedges.buf, __pyx_t_24, __pyx_bstride_0_leftedges)));
-          __pyx_4 = PyFloat_FromDouble(__pyx_7); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_9 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_8 = PyNumber_Multiply(__pyx_9, ((PyObject *)__pyx_v_dx)); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_9); __pyx_9 = 0;
-          __pyx_2 = PyNumber_Add(__pyx_4, __pyx_8); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_4); __pyx_4 = 0;
-          Py_DECREF(__pyx_8); __pyx_8 = 0;
-          __pyx_t_25 = 1;
-          if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_bshape_0_child_leftedges;
-          __pyx_7 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_child_leftedges.buf, __pyx_t_25, __pyx_bstride_0_child_leftedges)));
-          __pyx_9 = PyFloat_FromDouble(__pyx_7); if (unlikely(!__pyx_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_4 = PyNumber_Subtract(__pyx_2, __pyx_9); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_2); __pyx_2 = 0;
-          Py_DECREF(__pyx_9); __pyx_9 = 0;
-          __pyx_8 = __Pyx_PyNumber_Divide(__pyx_4, ((PyObject *)__pyx_v_child_dx)); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_4); __pyx_4 = 0;
-          __pyx_10 = __pyx_PyInt_int(__pyx_8); if (unlikely((__pyx_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_8); __pyx_8 = 0;
-          __pyx_v_child_j = __pyx_10;
-
-          /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":143
- *                     child_i = ((leftedges[0] + i * dx) - child_leftedges[0])/child_dx
- *                     child_j = ((leftedges[1] + j * dx) - child_leftedges[1])/child_dx
- *                     child_k = ((leftedges[2] + k * dx) - child_leftedges[2])/child_dx             # <<<<<<<<<<<<<<
- *                     # set current child id to id of next cell to examine
- *                     genealogy[curpos[level],0] = curpos[level+1]
- */
-          __pyx_t_26 = 2;
-          if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_bshape_0_leftedges;
-          __pyx_7 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_leftedges.buf, __pyx_t_26, __pyx_bstride_0_leftedges)));
-          __pyx_2 = PyFloat_FromDouble(__pyx_7); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_9 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_4 = PyNumber_Multiply(__pyx_9, ((PyObject *)__pyx_v_dx)); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_9); __pyx_9 = 0;
-          __pyx_8 = PyNumber_Add(__pyx_2, __pyx_4); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_2); __pyx_2 = 0;
-          Py_DECREF(__pyx_4); __pyx_4 = 0;
-          __pyx_t_27 = 2;
-          if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_bshape_0_child_leftedges;
-          __pyx_7 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_child_leftedges.buf, __pyx_t_27, __pyx_bstride_0_child_leftedges)));
-          __pyx_9 = PyFloat_FromDouble(__pyx_7); if (unlikely(!__pyx_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_2 = PyNumber_Subtract(__pyx_8, __pyx_9); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_8); __pyx_8 = 0;
-          Py_DECREF(__pyx_9); __pyx_9 = 0;
-          __pyx_4 = __Pyx_PyNumber_Divide(__pyx_2, ((PyObject *)__pyx_v_child_dx)); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_2); __pyx_2 = 0;
-          __pyx_10 = __pyx_PyInt_int(__pyx_4); if (unlikely((__pyx_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_4); __pyx_4 = 0;
-          __pyx_v_child_k = __pyx_10;
-
-          /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":145
- *                     child_k = ((leftedges[2] + k * dx) - child_leftedges[2])/child_dx
- *                     # set current child id to id of next cell to examine
- *                     genealogy[curpos[level],0] = curpos[level+1]             # <<<<<<<<<<<<<<
- *                     # set next parent id to id of current cell
- *                     genealogy[curpos[level+1]:curpos[level+1]+8,1] = curpos[level]
- */
-          __pyx_t_28 = (__pyx_v_level + 1);
-          if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_bshape_0_curpos;
-          __pyx_5 = *((__pyx_t_5numpy_int32_t *)((__pyx_t_5numpy_int32_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_curpos.buf, __pyx_t_28, __pyx_bstride_0_curpos)));
-          __pyx_t_17 = __pyx_v_level;
-          if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_bshape_0_curpos;
-          __pyx_11 = *((__pyx_t_5numpy_int32_t *)((__pyx_t_5numpy_int32_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_curpos.buf, __pyx_t_17, __pyx_bstride_0_curpos)));
-          __pyx_t_29 = __pyx_11;
-          __pyx_t_30 = 0;
-          if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_bshape_0_genealogy;
-          if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_bshape_1_genealogy;
-          *((__pyx_t_5numpy_int32_t *)__Pyx_BufPtrStrided2d(__pyx_bstruct_genealogy.buf, __pyx_t_29, __pyx_bstride_0_genealogy, __pyx_t_30, __pyx_bstride_1_genealogy)) = __pyx_5;
-
-          /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":147
- *                     genealogy[curpos[level],0] = curpos[level+1]
- *                     # set next parent id to id of current cell
- *                     genealogy[curpos[level+1]:curpos[level+1]+8,1] = curpos[level]             # <<<<<<<<<<<<<<
- *                     s = RecurseOctreeByLevels(child_i, child_j, child_k, 2, 2, 2,
- *                                               curpos, ci, output, genealogy, grids)
- */
-          __pyx_t_31 = __pyx_v_level;
-          if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_bshape_0_curpos;
-          __pyx_5 = *((__pyx_t_5numpy_int32_t *)((__pyx_t_5numpy_int32_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_curpos.buf, __pyx_t_31, __pyx_bstride_0_curpos)));
-          __pyx_8 = PyInt_FromLong(__pyx_5); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_t_32 = (__pyx_v_level + 1);
-          if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_bshape_0_curpos;
-          __pyx_11 = *((__pyx_t_5numpy_int32_t *)((__pyx_t_5numpy_int32_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_curpos.buf, __pyx_t_32, __pyx_bstride_0_curpos)));
-          __pyx_9 = PyInt_FromLong(__pyx_11); if (unlikely(!__pyx_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_t_33 = (__pyx_v_level + 1);
-          if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_bshape_0_curpos;
-          __pyx_5 = *((__pyx_t_5numpy_int32_t *)((__pyx_t_5numpy_int32_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_curpos.buf, __pyx_t_33, __pyx_bstride_0_curpos)));
-          __pyx_2 = PyInt_FromLong((__pyx_5 + 8)); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_4 = PySlice_New(__pyx_9, __pyx_2, Py_None); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_9); __pyx_9 = 0;
+          __pyx_t_32 = 0;
+          if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_bshape_0_child_leftedges;
+          __pyx_3 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_child_leftedges.buf, __pyx_t_32, __pyx_bstride_0_child_leftedges)));
+          __pyx_6 = PyFloat_FromDouble(((__pyx_v_cx - __pyx_3) / __pyx_v_child_dx)); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          PyTuple_SET_ITEM(__pyx_2, 0, __pyx_6);
+          __pyx_6 = 0;
+          __pyx_5 = PyObject_Call(((PyObject*)&PyInt_Type), ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
+          __pyx_9 = __pyx_PyInt_int(__pyx_5); if (unlikely((__pyx_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          Py_DECREF(__pyx_5); __pyx_5 = 0;
+          __pyx_v_child_i = __pyx_9;
+          __pyx_t_33 = 1;
+          if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_bshape_0_child_leftedges;
+          __pyx_3 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_child_leftedges.buf, __pyx_t_33, __pyx_bstride_0_child_leftedges)));
+          __pyx_6 = PyFloat_FromDouble(((__pyx_v_cy - __pyx_3) / __pyx_v_child_dx)); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          PyTuple_SET_ITEM(__pyx_2, 0, __pyx_6);
+          __pyx_6 = 0;
+          __pyx_5 = PyObject_Call(((PyObject*)&PyInt_Type), ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
+          __pyx_9 = __pyx_PyInt_int(__pyx_5); if (unlikely((__pyx_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          Py_DECREF(__pyx_5); __pyx_5 = 0;
+          __pyx_v_child_j = __pyx_9;
+          __pyx_t_34 = 2;
+          if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_bshape_0_child_leftedges;
+          __pyx_3 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_child_leftedges.buf, __pyx_t_34, __pyx_bstride_0_child_leftedges)));
+          __pyx_6 = PyFloat_FromDouble(((__pyx_v_cz - __pyx_3) / __pyx_v_child_dx)); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          PyTuple_SET_ITEM(__pyx_2, 0, __pyx_6);
+          __pyx_6 = 0;
+          __pyx_5 = PyObject_Call(((PyObject*)&PyInt_Type), ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
+          __pyx_9 = __pyx_PyInt_int(__pyx_5); if (unlikely((__pyx_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          Py_DECREF(__pyx_5); __pyx_5 = 0;
+          __pyx_v_child_k = __pyx_9;
+          __pyx_t_35 = (__pyx_v_level + 1);
+          if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_bshape_0_curpos;
+          __pyx_7 = *((__pyx_t_5numpy_int32_t *)((__pyx_t_5numpy_int32_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_curpos.buf, __pyx_t_35, __pyx_bstride_0_curpos)));
+          __pyx_t_28 = __pyx_v_cp;
+          __pyx_t_36 = 0;
+          if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_bshape_0_genealogy;
+          if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_bshape_1_genealogy;
+          *((__pyx_t_5numpy_int32_t *)__Pyx_BufPtrStrided2d(__pyx_bstruct_genealogy.buf, __pyx_t_28, __pyx_bstride_0_genealogy, __pyx_t_36, __pyx_bstride_1_genealogy)) = __pyx_7;
+          __pyx_6 = PyInt_FromLong(__pyx_v_cp); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_37 = (__pyx_v_level + 1);
+          if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_bshape_0_curpos;
+          __pyx_7 = *((__pyx_t_5numpy_int32_t *)((__pyx_t_5numpy_int32_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_curpos.buf, __pyx_t_37, __pyx_bstride_0_curpos)));
+          __pyx_2 = PyInt_FromLong(__pyx_7); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_t_38 = (__pyx_v_level + 1);
+          if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_bshape_0_curpos;
+          __pyx_7 = *((__pyx_t_5numpy_int32_t *)((__pyx_t_5numpy_int32_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_curpos.buf, __pyx_t_38, __pyx_bstride_0_curpos)));
+          __pyx_5 = PyInt_FromLong((__pyx_7 + 8)); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_10 = PySlice_New(__pyx_2, __pyx_5, Py_None); if (unlikely(!__pyx_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           Py_DECREF(__pyx_2); __pyx_2 = 0;
-          __pyx_9 = PyTuple_New(2); if (unlikely(!__pyx_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          PyTuple_SET_ITEM(__pyx_9, 0, __pyx_4);
+          Py_DECREF(__pyx_5); __pyx_5 = 0;
+          __pyx_2 = PyTuple_New(2); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          PyTuple_SET_ITEM(__pyx_2, 0, __pyx_10);
           Py_INCREF(__pyx_int_1);
-          PyTuple_SET_ITEM(__pyx_9, 1, __pyx_int_1);
-          __pyx_4 = 0;
-          if (PyObject_SetItem(((PyObject *)__pyx_v_genealogy), ((PyObject *)__pyx_9), __pyx_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(((PyObject *)__pyx_9)); __pyx_9 = 0;
-          Py_DECREF(__pyx_8); __pyx_8 = 0;
-
-          /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":148
- *                     # set next parent id to id of current cell
- *                     genealogy[curpos[level+1]:curpos[level+1]+8,1] = curpos[level]
- *                     s = RecurseOctreeByLevels(child_i, child_j, child_k, 2, 2, 2,             # <<<<<<<<<<<<<<
- *                                               curpos, ci, output, genealogy, grids)
- *                 curpos[level] += 1
- */
-          __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_18); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_4 = PyInt_FromLong(__pyx_v_child_i); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_8 = PyInt_FromLong(__pyx_v_child_j); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_9 = PyInt_FromLong(__pyx_v_child_k); if (unlikely(!__pyx_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-          /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":149
- *                     genealogy[curpos[level+1]:curpos[level+1]+8,1] = curpos[level]
- *                     s = RecurseOctreeByLevels(child_i, child_j, child_k, 2, 2, 2,
- *                                               curpos, ci, output, genealogy, grids)             # <<<<<<<<<<<<<<
- *                 curpos[level] += 1
- *     return s
- */
-          __pyx_12 = PyInt_FromLong(__pyx_v_ci); if (unlikely(!__pyx_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_13 = PyTuple_New(11); if (unlikely(!__pyx_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          PyTuple_SET_ITEM(__pyx_13, 0, __pyx_4);
-          PyTuple_SET_ITEM(__pyx_13, 1, __pyx_8);
-          PyTuple_SET_ITEM(__pyx_13, 2, __pyx_9);
+          PyTuple_SET_ITEM(__pyx_2, 1, __pyx_int_1);
+          __pyx_10 = 0;
+          if (PyObject_SetItem(((PyObject *)__pyx_v_genealogy), ((PyObject *)__pyx_2), __pyx_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
+          Py_DECREF(__pyx_6); __pyx_6 = 0;
+          __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_kp_18); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_10 = PyInt_FromLong(__pyx_v_child_i); if (unlikely(!__pyx_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_6 = PyInt_FromLong(__pyx_v_child_j); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_2 = PyInt_FromLong(__pyx_v_child_k); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_11 = PyInt_FromLong(__pyx_v_ci); if (unlikely(!__pyx_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_12 = PyTuple_New(12); if (unlikely(!__pyx_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          PyTuple_SET_ITEM(__pyx_12, 0, __pyx_10);
+          PyTuple_SET_ITEM(__pyx_12, 1, __pyx_6);
+          PyTuple_SET_ITEM(__pyx_12, 2, __pyx_2);
           Py_INCREF(__pyx_int_2);
-          PyTuple_SET_ITEM(__pyx_13, 3, __pyx_int_2);
+          PyTuple_SET_ITEM(__pyx_12, 3, __pyx_int_2);
           Py_INCREF(__pyx_int_2);
-          PyTuple_SET_ITEM(__pyx_13, 4, __pyx_int_2);
+          PyTuple_SET_ITEM(__pyx_12, 4, __pyx_int_2);
           Py_INCREF(__pyx_int_2);
-          PyTuple_SET_ITEM(__pyx_13, 5, __pyx_int_2);
+          PyTuple_SET_ITEM(__pyx_12, 5, __pyx_int_2);
           Py_INCREF(((PyObject *)__pyx_v_curpos));
-          PyTuple_SET_ITEM(__pyx_13, 6, ((PyObject *)__pyx_v_curpos));
-          PyTuple_SET_ITEM(__pyx_13, 7, __pyx_12);
+          PyTuple_SET_ITEM(__pyx_12, 6, ((PyObject *)__pyx_v_curpos));
+          PyTuple_SET_ITEM(__pyx_12, 7, __pyx_11);
           Py_INCREF(((PyObject *)__pyx_v_output));
-          PyTuple_SET_ITEM(__pyx_13, 8, ((PyObject *)__pyx_v_output));
+          PyTuple_SET_ITEM(__pyx_12, 8, ((PyObject *)__pyx_v_output));
           Py_INCREF(((PyObject *)__pyx_v_genealogy));
-          PyTuple_SET_ITEM(__pyx_13, 9, ((PyObject *)__pyx_v_genealogy));
+          PyTuple_SET_ITEM(__pyx_12, 9, ((PyObject *)__pyx_v_genealogy));
+          Py_INCREF(((PyObject *)__pyx_v_corners));
+          PyTuple_SET_ITEM(__pyx_12, 10, ((PyObject *)__pyx_v_corners));
           Py_INCREF(((PyObject *)__pyx_v_grids));
-          PyTuple_SET_ITEM(__pyx_13, 10, ((PyObject *)__pyx_v_grids));
-          __pyx_4 = 0;
-          __pyx_8 = 0;
-          __pyx_9 = 0;
-          __pyx_12 = 0;
-          __pyx_4 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_13), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_2); __pyx_2 = 0;
-          Py_DECREF(((PyObject *)__pyx_13)); __pyx_13 = 0;
+          PyTuple_SET_ITEM(__pyx_12, 11, ((PyObject *)__pyx_v_grids));
+          __pyx_10 = 0;
+          __pyx_6 = 0;
+          __pyx_2 = 0;
+          __pyx_11 = 0;
+          __pyx_10 = PyObject_Call(__pyx_5, ((PyObject *)__pyx_12), NULL); if (unlikely(!__pyx_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          Py_DECREF(__pyx_5); __pyx_5 = 0;
+          Py_DECREF(((PyObject *)__pyx_12)); __pyx_12 = 0;
           Py_DECREF(__pyx_v_s);
-          __pyx_v_s = __pyx_4;
-          __pyx_4 = 0;
+          __pyx_v_s = __pyx_10;
+          __pyx_10 = 0;
           goto __pyx_L14;
         }
         __pyx_L14:;
-
-        /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":150
- *                     s = RecurseOctreeByLevels(child_i, child_j, child_k, 2, 2, 2,
- *                                               curpos, ci, output, genealogy, grids)
- *                 curpos[level] += 1             # <<<<<<<<<<<<<<
- *     return s
- * 
- */
-        __pyx_t_34 = __pyx_v_level;
-        if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_bshape_0_curpos;
-        *((__pyx_t_5numpy_int32_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_curpos.buf, __pyx_t_34, __pyx_bstride_0_curpos)) += 1;
+        __pyx_t_39 = __pyx_v_level;
+        if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_bshape_0_curpos;
+        *((__pyx_t_5numpy_int32_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_curpos.buf, __pyx_t_39, __pyx_bstride_0_curpos)) += 1;
       }
     }
   }
-
-  /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":151
- *                                               curpos, ci, output, genealogy, grids)
- *                 curpos[level] += 1
- *     return s             # <<<<<<<<<<<<<<
- * 
- */
   Py_INCREF(__pyx_v_s);
   __pyx_r = __pyx_v_s;
   goto __pyx_L0;
@@ -2152,21 +1446,20 @@
   goto __pyx_L0;
   __pyx_L1_error:;
   Py_XDECREF(__pyx_2);
-  Py_XDECREF(__pyx_4);
-  Py_XDECREF(__pyx_8);
-  Py_XDECREF(__pyx_9);
+  Py_XDECREF(__pyx_5);
+  Py_XDECREF(__pyx_6);
+  Py_XDECREF(__pyx_10);
+  Py_XDECREF(__pyx_11);
   Py_XDECREF(__pyx_12);
-  Py_XDECREF(__pyx_13);
   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
     PyErr_Fetch(&__pyx_type, &__pyx_value, &__pyx_tb);
-    __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_dx, &__pyx_bstruct_dx);
     __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_leftedges, &__pyx_bstruct_leftedges);
     __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_curpos, &__pyx_bstruct_curpos);
-    __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_child_dx, &__pyx_bstruct_child_dx);
     __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_child_leftedges, &__pyx_bstruct_child_leftedges);
     __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_dimensions, &__pyx_bstruct_dimensions);
     __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_child_indices, &__pyx_bstruct_child_indices);
     __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_genealogy, &__pyx_bstruct_genealogy);
+    __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_corners, &__pyx_bstruct_corners);
     __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_fields, &__pyx_bstruct_fields);
     __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_output, &__pyx_bstruct_output);
   PyErr_Restore(__pyx_type, __pyx_value, __pyx_tb);}
@@ -2174,14 +1467,13 @@
   __pyx_r = NULL;
   goto __pyx_L2;
   __pyx_L0:;
-  __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_dx, &__pyx_bstruct_dx);
   __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_leftedges, &__pyx_bstruct_leftedges);
   __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_curpos, &__pyx_bstruct_curpos);
-  __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_child_dx, &__pyx_bstruct_child_dx);
   __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_child_leftedges, &__pyx_bstruct_child_leftedges);
   __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_dimensions, &__pyx_bstruct_dimensions);
   __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_child_indices, &__pyx_bstruct_child_indices);
   __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_genealogy, &__pyx_bstruct_genealogy);
+  __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_corners, &__pyx_bstruct_corners);
   __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_fields, &__pyx_bstruct_fields);
   __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_output, &__pyx_bstruct_output);
   __pyx_L2:;
@@ -2191,21 +1483,11 @@
   Py_XDECREF(__pyx_v_dimensions);
   Py_XDECREF(__pyx_v_fields);
   Py_XDECREF(__pyx_v_leftedges);
-  Py_XDECREF(__pyx_v_dx);
-  Py_DECREF(__pyx_v_child_dx);
   Py_DECREF(__pyx_v_child_leftedges);
   Py_DECREF(__pyx_v_s);
   return __pyx_r;
 }
 
-/* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":36
- *         # experimental exception made for __getbuffer__ and __releasebuffer__
- *         # -- the details of this may change.
- *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
- *             # This implementation of getbuffer is geared towards Cython
- *             # requirements, and does not yet fullfill the PEP (specifically,
- */
-
 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
   int __pyx_v_t;
@@ -2214,24 +1496,8 @@
   int __pyx_1;
   PyObject *__pyx_2 = 0;
   PyObject *__pyx_3 = 0;
-
-  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":42
- *             # so the flags are not even checked).
- * 
- *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
- *                 raise RuntimeError("Py_intptr_t and Py_ssize_t differs in size, numpy.pxd does not support this")
- * 
- */
   __pyx_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
   if (__pyx_1) {
-
-    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":43
- * 
- *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
- *                 raise RuntimeError("Py_intptr_t and Py_ssize_t differs in size, numpy.pxd does not support this")             # <<<<<<<<<<<<<<
- * 
- *             info.buf = PyArray_DATA(self)
- */
     __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     Py_INCREF(__pyx_kp_1);
     PyTuple_SET_ITEM(__pyx_2, 0, __pyx_kp_1);
@@ -2243,261 +1509,61 @@
     goto __pyx_L5;
   }
   __pyx_L5:;
-
-  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":45
- *                 raise RuntimeError("Py_intptr_t and Py_ssize_t differs in size, numpy.pxd does not support this")
- * 
- *             info.buf = PyArray_DATA(self)             # <<<<<<<<<<<<<<
- *             info.ndim = PyArray_NDIM(self)
- *             info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
- */
   __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self));
-
-  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":46
- * 
- *             info.buf = PyArray_DATA(self)
- *             info.ndim = PyArray_NDIM(self)             # <<<<<<<<<<<<<<
- *             info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
- *             info.shape = <Py_ssize_t*>PyArray_DIMS(self)
- */
   __pyx_v_info->ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self));
-
-  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":47
- *             info.buf = PyArray_DATA(self)
- *             info.ndim = PyArray_NDIM(self)
- *             info.strides = <Py_ssize_t*>PyArray_STRIDES(self)             # <<<<<<<<<<<<<<
- *             info.shape = <Py_ssize_t*>PyArray_DIMS(self)
- *             info.suboffsets = NULL
- */
   __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self)));
-
-  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":48
- *             info.ndim = PyArray_NDIM(self)
- *             info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
- *             info.shape = <Py_ssize_t*>PyArray_DIMS(self)             # <<<<<<<<<<<<<<
- *             info.suboffsets = NULL
- *             info.itemsize = PyArray_ITEMSIZE(self)
- */
   __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self)));
-
-  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":49
- *             info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
- *             info.shape = <Py_ssize_t*>PyArray_DIMS(self)
- *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
- *             info.itemsize = PyArray_ITEMSIZE(self)
- *             info.readonly = not PyArray_ISWRITEABLE(self)
- */
   __pyx_v_info->suboffsets = NULL;
-
-  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":50
- *             info.shape = <Py_ssize_t*>PyArray_DIMS(self)
- *             info.suboffsets = NULL
- *             info.itemsize = PyArray_ITEMSIZE(self)             # <<<<<<<<<<<<<<
- *             info.readonly = not PyArray_ISWRITEABLE(self)
- * 
- */
   __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self));
-
-  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":51
- *             info.suboffsets = NULL
- *             info.itemsize = PyArray_ITEMSIZE(self)
- *             info.readonly = not PyArray_ISWRITEABLE(self)             # <<<<<<<<<<<<<<
- * 
- *             # Formats that are not tested and working in Cython are not
- */
   __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self)));
-
-  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":55
- *             # Formats that are not tested and working in Cython are not
- *             # made available from this pxd file yet.
- *             cdef int t = PyArray_TYPE(self)             # <<<<<<<<<<<<<<
- *             cdef char* f = NULL
- *             if   t == NPY_BYTE:       f = "b"
- */
   __pyx_v_t = PyArray_TYPE(((PyArrayObject *)__pyx_v_self));
-
-  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":56
- *             # made available from this pxd file yet.
- *             cdef int t = PyArray_TYPE(self)
- *             cdef char* f = NULL             # <<<<<<<<<<<<<<
- *             if   t == NPY_BYTE:       f = "b"
- *             elif t == NPY_UBYTE:      f = "B"
- */
   __pyx_v_f = NULL;
-
-  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":57
- *             cdef int t = PyArray_TYPE(self)
- *             cdef char* f = NULL
- *             if   t == NPY_BYTE:       f = "b"             # <<<<<<<<<<<<<<
- *             elif t == NPY_UBYTE:      f = "B"
- *             elif t == NPY_SHORT:      f = "h"
- */
   switch (__pyx_v_t) {
     case NPY_BYTE:
     __pyx_v_f = __pyx_k_2;
     break;
     case NPY_UBYTE:
-
-    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":58
- *             cdef char* f = NULL
- *             if   t == NPY_BYTE:       f = "b"
- *             elif t == NPY_UBYTE:      f = "B"             # <<<<<<<<<<<<<<
- *             elif t == NPY_SHORT:      f = "h"
- *             elif t == NPY_USHORT:     f = "H"
- */
     __pyx_v_f = __pyx_k_3;
     break;
     case NPY_SHORT:
-
-    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":59
- *             if   t == NPY_BYTE:       f = "b"
- *             elif t == NPY_UBYTE:      f = "B"
- *             elif t == NPY_SHORT:      f = "h"             # <<<<<<<<<<<<<<
- *             elif t == NPY_USHORT:     f = "H"
- *             elif t == NPY_INT:        f = "i"
- */
     __pyx_v_f = __pyx_k_4;
     break;
     case NPY_USHORT:
-
-    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":60
- *             elif t == NPY_UBYTE:      f = "B"
- *             elif t == NPY_SHORT:      f = "h"
- *             elif t == NPY_USHORT:     f = "H"             # <<<<<<<<<<<<<<
- *             elif t == NPY_INT:        f = "i"
- *             elif t == NPY_UINT:       f = "I"
- */
     __pyx_v_f = __pyx_k_5;
     break;
     case NPY_INT:
-
-    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":61
- *             elif t == NPY_SHORT:      f = "h"
- *             elif t == NPY_USHORT:     f = "H"
- *             elif t == NPY_INT:        f = "i"             # <<<<<<<<<<<<<<
- *             elif t == NPY_UINT:       f = "I"
- *             elif t == NPY_LONG:       f = "l"
- */
     __pyx_v_f = __pyx_k_6;
     break;
     case NPY_UINT:
-
-    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":62
- *             elif t == NPY_USHORT:     f = "H"
- *             elif t == NPY_INT:        f = "i"
- *             elif t == NPY_UINT:       f = "I"             # <<<<<<<<<<<<<<
- *             elif t == NPY_LONG:       f = "l"
- *             elif t == NPY_ULONG:      f = "L"
- */
     __pyx_v_f = __pyx_k_7;
     break;
     case NPY_LONG:
-
-    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":63
- *             elif t == NPY_INT:        f = "i"
- *             elif t == NPY_UINT:       f = "I"
- *             elif t == NPY_LONG:       f = "l"             # <<<<<<<<<<<<<<
- *             elif t == NPY_ULONG:      f = "L"
- *             elif t == NPY_LONGLONG:   f = "q"
- */
     __pyx_v_f = __pyx_k_8;
     break;
     case NPY_ULONG:
-
-    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":64
- *             elif t == NPY_UINT:       f = "I"
- *             elif t == NPY_LONG:       f = "l"
- *             elif t == NPY_ULONG:      f = "L"             # <<<<<<<<<<<<<<
- *             elif t == NPY_LONGLONG:   f = "q"
- *             elif t == NPY_ULONGLONG:  f = "Q"
- */
     __pyx_v_f = __pyx_k_9;
     break;
     case NPY_LONGLONG:
-
-    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":65
- *             elif t == NPY_LONG:       f = "l"
- *             elif t == NPY_ULONG:      f = "L"
- *             elif t == NPY_LONGLONG:   f = "q"             # <<<<<<<<<<<<<<
- *             elif t == NPY_ULONGLONG:  f = "Q"
- *             elif t == NPY_FLOAT:      f = "f"
- */
     __pyx_v_f = __pyx_k_10;
     break;
     case NPY_ULONGLONG:
-
-    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":66
- *             elif t == NPY_ULONG:      f = "L"
- *             elif t == NPY_LONGLONG:   f = "q"
- *             elif t == NPY_ULONGLONG:  f = "Q"             # <<<<<<<<<<<<<<
- *             elif t == NPY_FLOAT:      f = "f"
- *             elif t == NPY_DOUBLE:     f = "d"
- */
     __pyx_v_f = __pyx_k_11;
     break;
     case NPY_FLOAT:
-
-    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":67
- *             elif t == NPY_LONGLONG:   f = "q"
- *             elif t == NPY_ULONGLONG:  f = "Q"
- *             elif t == NPY_FLOAT:      f = "f"             # <<<<<<<<<<<<<<
- *             elif t == NPY_DOUBLE:     f = "d"
- *             elif t == NPY_LONGDOUBLE: f = "g"
- */
     __pyx_v_f = __pyx_k_12;
     break;
     case NPY_DOUBLE:
-
-    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":68
- *             elif t == NPY_ULONGLONG:  f = "Q"
- *             elif t == NPY_FLOAT:      f = "f"
- *             elif t == NPY_DOUBLE:     f = "d"             # <<<<<<<<<<<<<<
- *             elif t == NPY_LONGDOUBLE: f = "g"
- *             elif t == NPY_OBJECT:     f = "O"
- */
     __pyx_v_f = __pyx_k_13;
     break;
     case NPY_LONGDOUBLE:
-
-    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":69
- *             elif t == NPY_FLOAT:      f = "f"
- *             elif t == NPY_DOUBLE:     f = "d"
- *             elif t == NPY_LONGDOUBLE: f = "g"             # <<<<<<<<<<<<<<
- *             elif t == NPY_OBJECT:     f = "O"
- * 
- */
     __pyx_v_f = __pyx_k_14;
     break;
     case NPY_OBJECT:
-
-    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":70
- *             elif t == NPY_DOUBLE:     f = "d"
- *             elif t == NPY_LONGDOUBLE: f = "g"
- *             elif t == NPY_OBJECT:     f = "O"             # <<<<<<<<<<<<<<
- * 
- *             if f == NULL:
- */
     __pyx_v_f = __pyx_k_15;
     break;
   }
-
-  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":72
- *             elif t == NPY_OBJECT:     f = "O"
- * 
- *             if f == NULL:             # <<<<<<<<<<<<<<
- *                 raise ValueError("only objects, int and float dtypes supported for ndarray buffer access so far (dtype is %d)" % t)
- *             info.format = f
- */
   __pyx_1 = (__pyx_v_f == NULL);
   if (__pyx_1) {
-
-    /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":73
- * 
- *             if f == NULL:
- *                 raise ValueError("only objects, int and float dtypes supported for ndarray buffer access so far (dtype is %d)" % t)             # <<<<<<<<<<<<<<
- *             info.format = f
- * 
- */
     __pyx_2 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __pyx_3 = PyNumber_Remainder(__pyx_kp_16, __pyx_2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     Py_DECREF(__pyx_2); __pyx_2 = 0;
@@ -2512,14 +1578,6 @@
     goto __pyx_L6;
   }
   __pyx_L6:;
-
-  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":74
- *             if f == NULL:
- *                 raise ValueError("only objects, int and float dtypes supported for ndarray buffer access so far (dtype is %d)" % t)
- *             info.format = f             # <<<<<<<<<<<<<<
- * 
- * 
- */
   __pyx_v_info->format = __pyx_v_f;
 
   __pyx_r = 0;
@@ -3216,25 +2274,9 @@
   __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject)); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   /*--- Function import code ---*/
   /*--- Execution code ---*/
-
-  /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":26
- * """
- * 
- * import numpy as np             # <<<<<<<<<<<<<<
- * cimport numpy as np
- * cimport cython
- */
   __pyx_1 = __Pyx_Import(__pyx_kp_numpy, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (PyObject_SetAttr(__pyx_m, __pyx_kp_np, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
-
-  /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":36
- *         # experimental exception made for __getbuffer__ and __releasebuffer__
- *         # -- the details of this may change.
- *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
- *             # This implementation of getbuffer is geared towards Cython
- *             # requirements, and does not yet fullfill the PEP (specifically,
- */
   #if PY_MAJOR_VERSION < 3
   return;
   #else

Modified: trunk/yt/lagos/DepthFirstOctree.pyx
==============================================================================
--- trunk/yt/lagos/DepthFirstOctree.pyx	(original)
+++ trunk/yt/lagos/DepthFirstOctree.pyx	Thu Oct 23 13:25:44 2008
@@ -73,15 +73,19 @@
     cdef np.ndarray[np.int32_t, ndim=1] dimensions = grid.dimensions
     cdef np.ndarray[np.float64_t, ndim=4] fields = grid.fields
     cdef np.ndarray[np.float64_t, ndim=1] leftedges = grid.left_edges
-    cdef np.ndarray[np.float64_t, ndim=1] dx = grid.dx
-    cdef np.ndarray[np.float64_t, ndim=1] child_dx
+    cdef np.float64_t dx = grid.dx[0]
+    cdef np.float64_t child_dx
     cdef np.ndarray[np.float64_t, ndim=1] child_leftedges
-    for k_off in range(i_f):
+    cdef np.float64_t cx, cy, cz
+    for k_off in range(k_f):
         k = k_off + k_i
+        cz = (leftedges[2] + k*dx)
         for j_off in range(j_f):
             j = j_off + j_i
-            for i_off in range(k_f):
+            cy = (leftedges[1] + j*dx)
+            for i_off in range(i_f):
                 i = i_off + i_i
+                cx = (leftedges[0] + i*dx)
                 ci = grid.child_indices[i,j,k]
                 if ci == -1:
                     for fi in range(fields.shape[0]):
@@ -93,11 +97,11 @@
                     refined[curpos.refined_pos] = 1
                     curpos.refined_pos += 1
                     child_grid = grids[ci-1]
-                    child_dx = child_grid.dx
+                    child_dx = child_grid.dx[0]
                     child_leftedges = child_grid.left_edges
-                    child_i = ((leftedges[0] + i * dx) - child_leftedges[0])/child_dx
-                    child_j = ((leftedges[1] + j * dx) - child_leftedges[1])/child_dx
-                    child_k = ((leftedges[2] + k * dx) - child_leftedges[2])/child_dx
+                    child_i = int(cx - child_leftedges[0])/child_dx
+                    child_j = int(cy - child_leftedges[1])/child_dx
+                    child_k = int(cz - child_leftedges[2])/child_dx
                     s = RecurseOctreeDepthFirst(child_i, child_j, child_k, 2, 2, 2,
                                         curpos, ci, output, refined, grids)
     return s
@@ -109,8 +113,9 @@
                           int gi, 
                           np.ndarray[np.float64_t, ndim=2] output,
                           np.ndarray[np.int32_t, ndim=2] genealogy,
+                          np.ndarray[np.float64_t, ndim=2] corners,
                           OctreeGridList grids):
-    cdef int i, i_off, j, j_off, k, k_off, ci, fi
+    cdef np.int32_t i, i_off, j, j_off, k, k_off, ci, fi
     cdef int child_i, child_j, child_k
     cdef OctreeGrid child_grid
     cdef OctreeGrid grid = grids[gi-1]
@@ -119,34 +124,44 @@
     cdef np.ndarray[np.int32_t, ndim=1] dimensions = grid.dimensions
     cdef np.ndarray[np.float64_t, ndim=4] fields = grid.fields
     cdef np.ndarray[np.float64_t, ndim=1] leftedges = grid.left_edges
-    cdef np.ndarray[np.float64_t, ndim=1] dx = grid.dx
-    cdef np.ndarray[np.float64_t, ndim=1] child_dx
+    cdef np.float64_t dx = grid.dx[0]
+    cdef np.float64_t child_dx
     cdef np.ndarray[np.float64_t, ndim=1] child_leftedges
-    for k_off in range(i_f):
+    cdef np.float64_t cx, cy, cz
+    cdef int cp
+    for k_off in range(k_f):
         k = k_off + k_i
-        if i_f > 2: print k
+        cz = (leftedges[2] + k*dx)
+        if i_f > 2: print k, cz
         for j_off in range(j_f):
             j = j_off + j_i
-            for i_off in range(k_f):
-                genealogy[curpos[level], 2] = level
+            cy = (leftedges[1] + j*dx)
+            for i_off in range(i_f):
                 i = i_off + i_i
+                cp = curpos[level]
+                cx = (leftedges[0] + i*dx)
+                corners[cp, 0] = cx 
+                corners[cp, 1] = cy 
+                corners[cp, 2] = cz
+                genealogy[curpos[level], 2] = level
                 # always output data
                 for fi in range(fields.shape[0]):
-                    output[curpos[level],fi] = fields[fi,i,j,k]
-                ci = grid.child_indices[i,j,k]
+                    output[cp,fi] = fields[fi,i,j,k]
+                ci = child_indices[i,j,k]
                 if ci > -1:
                     child_grid = grids[ci-1]
-                    child_dx = child_grid.dx
+                    child_dx = child_grid.dx[0]
                     child_leftedges = child_grid.left_edges
-                    child_i = ((leftedges[0] + i * dx) - child_leftedges[0])/child_dx
-                    child_j = ((leftedges[1] + j * dx) - child_leftedges[1])/child_dx
-                    child_k = ((leftedges[2] + k * dx) - child_leftedges[2])/child_dx
+                    child_i = int((cx-child_leftedges[0])/child_dx)
+                    child_j = int((cy-child_leftedges[1])/child_dx)
+                    child_k = int((cz-child_leftedges[2])/child_dx)
                     # set current child id to id of next cell to examine
-                    genealogy[curpos[level],0] = curpos[level+1] 
+                    genealogy[cp, 0] = curpos[level+1] 
                     # set next parent id to id of current cell
-                    genealogy[curpos[level+1]:curpos[level+1]+8,1] = curpos[level]
+                    genealogy[curpos[level+1]:curpos[level+1]+8, 1] = cp
                     s = RecurseOctreeByLevels(child_i, child_j, child_k, 2, 2, 2,
-                                              curpos, ci, output, genealogy, grids)
+                                              curpos, ci, output, genealogy,
+                                              corners, grids)
                 curpos[level] += 1
     return s
 

Modified: trunk/yt/lagos/HierarchyType.py
==============================================================================
--- trunk/yt/lagos/HierarchyType.py	(original)
+++ trunk/yt/lagos/HierarchyType.py	Thu Oct 23 13:25:44 2008
@@ -499,12 +499,13 @@
 
     def _generate_levels_octree(self, fields):
         import DepthFirstOctree as dfo
-        fields = ensure_list(fields)
+        fields = ensure_list(fields) + ["Ones", "Ones"]
         ogl, levels_finest, levels_all = self.__initialize_octree_list(fields)
         o_length = na.sum(levels_finest.values())
         r_length = na.sum(levels_all.values())
         output = na.zeros((r_length,len(fields)), dtype='float64')
         genealogy = na.zeros((r_length, 3), dtype='int32') - 1 # init to -1
+        corners = na.zeros((r_length, 3), dtype='float64')
         position = na.add.accumulate(
                     na.array([0] + [levels_all[v] for v in
                         sorted(levels_all)[:-1]], dtype='int32'))
@@ -514,8 +515,8 @@
                 ogl[0].dimensions[1],
                 ogl[0].dimensions[2],
                 position, 1,
-                output, genealogy, ogl)
-        return output, genealogy, (o_length, r_length)
+                output, genealogy, corners, ogl)
+        return output, genealogy, levels_all, levels_finest, pp, corners
 
 class EnzoHierarchy(AMRHierarchy):
     eiTopGrid = None



More information about the yt-svn mailing list