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

mturk at wrangler.dreamhost.com mturk at wrangler.dreamhost.com
Thu Oct 23 10:19:16 PDT 2008


Author: mturk
Date: Thu Oct 23 10:19:14 2008
New Revision: 831
URL: http://yt.spacepope.org/changeset/831

Log:
* Refactored existing flat octree
* Added new octree output, ordered by level with output everywhere and a genealogy



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 10:19:14 2008
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.9.8.1.1 on Wed Oct 22 15:05:45 2008 */
+/* Generated by Cython 0.9.8.1.1 on Thu Oct 23 10:12:50 2008 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
@@ -187,16 +187,17 @@
 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_BufPtrStrided3d(buf, i0, s0, i1, s1, i2, s2) ((char*)buf + i0 * s0 + i1 * s1 + i2 * s2)
 #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*/
 
-static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name, int exact); /*proto*/
-
 static INLINE void __Pyx_RaiseArgtupleTooLong(Py_ssize_t num_expected, Py_ssize_t num_found); /*proto*/
+
+static int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); /*proto*/
+
+static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name, int exact); /*proto*/
 #if (PY_MAJOR_VERSION < 3) && !(Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_NEWBUFFER)
 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
 static void __Pyx_ReleaseBuffer(PyObject *obj, Py_buffer *view);
@@ -234,14 +235,14 @@
 
 static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
 
+static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
+
 static int __Pyx_Print(PyObject *, int); /*proto*/
 #if PY_MAJOR_VERSION >= 3
 static PyObject* __pyx_print = 0;
 static PyObject* __pyx_print_kwargs = 0;
 #endif
 
-static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
-
 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
 
 static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, long size);  /*proto*/
@@ -288,12 +289,12 @@
 
 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
 
-/* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":30
+/* "/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 {
@@ -302,12 +303,12 @@
   int refined_pos;
 };
 
-/* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":33
- *     cdef public int output_pos, 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
- *     def __cinit__(self,
+ *     cdef public int level
  */
 
 struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGrid {
@@ -317,10 +318,11 @@
   PyObject *left_edges;
   PyObject *dimensions;
   PyObject *dx;
+  int level;
 };
 
-/* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":47
- *         self.dx = dx
+/* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":53
+ *         self.level = level
  * 
  * cdef class OctreeGridList:             # <<<<<<<<<<<<<<
  *     cdef public object grids
@@ -346,6 +348,8 @@
 
 
 /* Implementation of yt.lagos.DepthFirstOctree */
+static PyObject *__pyx_int_2;
+static PyObject *__pyx_int_1;
 static char __pyx_k___cinit__[] = "__cinit__";
 static PyObject *__pyx_kp___cinit__;
 static char __pyx_k___getitem__[] = "__getitem__";
@@ -354,8 +358,10 @@
 static PyObject *__pyx_kp_numpy;
 static char __pyx_k_np[] = "np";
 static PyObject *__pyx_kp_np;
-static char __pyx_k_RecurseOctree[] = "RecurseOctree";
-static PyObject *__pyx_kp_RecurseOctree;
+static char __pyx_k_17[] = "RecurseOctreeDepthFirst";
+static PyObject *__pyx_kp_17;
+static char __pyx_k_18[] = "RecurseOctreeByLevels";
+static PyObject *__pyx_kp_18;
 static char __pyx_k___getbuffer__[] = "__getbuffer__";
 static PyObject *__pyx_kp___getbuffer__;
 static char __pyx_k_RuntimeError[] = "RuntimeError";
@@ -383,9 +389,50 @@
 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)";
 
-/* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":35
+/* "/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;
+  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
+    __Pyx_RaiseArgtupleTooLong(0, PyTuple_GET_SIZE(__pyx_args));
+    return -1;
+  }
+  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,
@@ -398,6 +445,7 @@
   PyArrayObject *__pyx_v_left_edges = 0;
   PyArrayObject *__pyx_v_dimensions = 0;
   PyArrayObject *__pyx_v_dx = 0;
+  int __pyx_v_level;
   Py_buffer __pyx_bstruct_child_indices;
   Py_ssize_t __pyx_bstride_0_child_indices = 0;
   Py_ssize_t __pyx_bstride_1_child_indices = 0;
@@ -424,46 +472,47 @@
   Py_ssize_t __pyx_bstride_0_dimensions = 0;
   Py_ssize_t __pyx_bshape_0_dimensions = 0;
   int __pyx_r;
-  static char *__pyx_argnames[] = {"child_indices","fields","left_edges","dimensions","dx",0};
-  if (likely(!__pyx_kwds) && likely(PyTuple_GET_SIZE(__pyx_args) == 5)) {
+  static char *__pyx_argnames[] = {"child_indices","fields","left_edges","dimensions","dx","level",0};
+  if (likely(!__pyx_kwds) && likely(PyTuple_GET_SIZE(__pyx_args) == 6)) {
     __pyx_v_child_indices = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
     __pyx_v_fields = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1));
     __pyx_v_left_edges = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2));
     __pyx_v_dimensions = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3));
     __pyx_v_dx = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4));
+    __pyx_v_level = __pyx_PyInt_int(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   }
   else {
-    if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOOOO", __pyx_argnames, &__pyx_v_child_indices, &__pyx_v_fields, &__pyx_v_left_edges, &__pyx_v_dimensions, &__pyx_v_dx))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOOOOi", __pyx_argnames, &__pyx_v_child_indices, &__pyx_v_fields, &__pyx_v_left_edges, &__pyx_v_dimensions, &__pyx_v_dx, &__pyx_v_level))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   }
   goto __pyx_L4;
   __pyx_L3_error:;
   __Pyx_AddTraceback("yt.lagos.DepthFirstOctree.OctreeGrid.__cinit__");
   return -1;
   __pyx_L4:;
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_child_indices), __pyx_ptype_5numpy_ndarray, 1, "child_indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fields), __pyx_ptype_5numpy_ndarray, 1, "fields", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left_edges), __pyx_ptype_5numpy_ndarray, 1, "left_edges", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dimensions), __pyx_ptype_5numpy_ndarray, 1, "dimensions", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dx), __pyx_ptype_5numpy_ndarray, 1, "dx", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_int32_t((PyObject*)__pyx_v_child_indices, &__pyx_bstruct_child_indices, PyBUF_FORMAT| PyBUF_STRIDES, 3) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_child_indices), __pyx_ptype_5numpy_ndarray, 1, "child_indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fields), __pyx_ptype_5numpy_ndarray, 1, "fields", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left_edges), __pyx_ptype_5numpy_ndarray, 1, "left_edges", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dimensions), __pyx_ptype_5numpy_ndarray, 1, "dimensions", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dx), __pyx_ptype_5numpy_ndarray, 1, "dx", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_int32_t((PyObject*)__pyx_v_child_indices, &__pyx_bstruct_child_indices, PyBUF_FORMAT| PyBUF_STRIDES, 3) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __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];
-  if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_float64_t((PyObject*)__pyx_v_fields, &__pyx_bstruct_fields, PyBUF_FORMAT| PyBUF_STRIDES, 4) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_float64_t((PyObject*)__pyx_v_fields, &__pyx_bstruct_fields, PyBUF_FORMAT| PyBUF_STRIDES, 4) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __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];
-  if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_float64_t((PyObject*)__pyx_v_left_edges, &__pyx_bstruct_left_edges, PyBUF_FORMAT| PyBUF_STRIDES, 1) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_float64_t((PyObject*)__pyx_v_left_edges, &__pyx_bstruct_left_edges, PyBUF_FORMAT| PyBUF_STRIDES, 1) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_bstride_0_left_edges = __pyx_bstruct_left_edges.strides[0];
   __pyx_bshape_0_left_edges = __pyx_bstruct_left_edges.shape[0];
-  if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_int32_t((PyObject*)__pyx_v_dimensions, &__pyx_bstruct_dimensions, PyBUF_FORMAT| PyBUF_STRIDES, 1) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_int32_t((PyObject*)__pyx_v_dimensions, &__pyx_bstruct_dimensions, PyBUF_FORMAT| PyBUF_STRIDES, 1) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_bstride_0_dimensions = __pyx_bstruct_dimensions.strides[0];
   __pyx_bshape_0_dimensions = __pyx_bstruct_dimensions.shape[0];
-  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 = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  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];
 
-  /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":41
- *                   np.ndarray[np.int32_t, ndim=1] dimensions,
- *                   np.ndarray[np.float64_t, ndim=1] dx):
+  /* "/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
@@ -472,8 +521,8 @@
   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);
 
-  /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":42
- *                   np.ndarray[np.float64_t, ndim=1] dx):
+  /* "/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
@@ -483,7 +532,7 @@
   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);
 
-  /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":43
+  /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":48
  *         self.child_indices = child_indices
  *         self.fields = fields
  *         self.left_edges = left_edges             # <<<<<<<<<<<<<<
@@ -494,28 +543,37 @@
   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);
 
-  /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":44
+  /* "/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);
 
-  /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":45
+  /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":50
  *         self.left_edges = left_edges
  *         self.dimensions = dimensions
  *         self.dx = dx             # <<<<<<<<<<<<<<
+ *         self.level = level
  * 
- * cdef class OctreeGridList:
  */
   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;
   goto __pyx_L0;
   __pyx_L1_error:;
@@ -540,7 +598,7 @@
   return __pyx_r;
 }
 
-/* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":49
+/* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":55
  * cdef class OctreeGridList:
  *     cdef public object grids
  *     def __cinit__(self, grids):             # <<<<<<<<<<<<<<
@@ -557,7 +615,7 @@
     __pyx_v_grids = PyTuple_GET_ITEM(__pyx_args, 0);
   }
   else {
-    if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_grids))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_grids))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   }
   goto __pyx_L4;
   __pyx_L3_error:;
@@ -565,7 +623,7 @@
   return -1;
   __pyx_L4:;
 
-  /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":50
+  /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":56
  *     cdef public object grids
  *     def __cinit__(self, grids):
  *         self.grids = grids             # <<<<<<<<<<<<<<
@@ -580,7 +638,7 @@
   return __pyx_r;
 }
 
-/* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":52
+/* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":58
  *         self.grids = grids
  * 
  *     def __getitem__(self, int item):             # <<<<<<<<<<<<<<
@@ -594,7 +652,7 @@
   PyObject *__pyx_r;
   PyObject *__pyx_1 = 0;
   assert(__pyx_arg_item); {
-    __pyx_v_item = __pyx_PyInt_int(__pyx_arg_item); if (unlikely((__pyx_v_item == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_item = __pyx_PyInt_int(__pyx_arg_item); if (unlikely((__pyx_v_item == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   }
   goto __pyx_L4;
   __pyx_L3_error:;
@@ -602,14 +660,14 @@
   return NULL;
   __pyx_L4:;
 
-  /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":53
+  /* "/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 = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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;
   goto __pyx_L0;
@@ -624,27 +682,34 @@
   return __pyx_r;
 }
 
-/* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":56
+/* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":62
  * 
  * @cython.boundscheck(False)
- * def WalkRootgrid(np.ndarray[np.float64_t, ndim=2] output,             # <<<<<<<<<<<<<<
- *                  np.ndarray[np.int32_t, ndim=1] refined,
- *                  OctreeGridList grids, int pi, int s = 0, int r = 0):
+ * 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_WalkRootgrid(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_2yt_5lagos_16DepthFirstOctree_WalkRootgrid[] = "\n    This function only gets called on a 'root grid' -- a base grid\n    of the simulation we are converting.  It will call a recursive walker.\n    ";
-static PyObject *__pyx_pf_2yt_5lagos_16DepthFirstOctree_WalkRootgrid(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+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;
+  int __pyx_v_j_i;
+  int __pyx_v_k_i;
+  int __pyx_v_i_f;
+  int __pyx_v_j_f;
+  int __pyx_v_k_f;
+  struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_position *__pyx_v_curpos = 0;
+  int __pyx_v_gi;
   PyArrayObject *__pyx_v_output = 0;
   PyArrayObject *__pyx_v_refined = 0;
   struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGridList *__pyx_v_grids = 0;
-  int __pyx_v_pi;
-  int __pyx_v_s;
-  int __pyx_v_r;
   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_gi;
+  int __pyx_v_k_off;
+  int __pyx_v_ci;
   int __pyx_v_fi;
   int __pyx_v_child_i;
   int __pyx_v_child_j;
@@ -658,25 +723,25 @@
   PyArrayObject *__pyx_v_dx = 0;
   PyArrayObject *__pyx_v_child_dx;
   PyArrayObject *__pyx_v_child_leftedges;
-  struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_position *__pyx_v_curpos;
-  Py_buffer __pyx_bstruct_leftedges;
-  Py_ssize_t __pyx_bstride_0_leftedges = 0;
-  Py_ssize_t __pyx_bshape_0_leftedges = 0;
+  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_dimensions;
-  Py_ssize_t __pyx_bstride_0_dimensions = 0;
-  Py_ssize_t __pyx_bshape_0_dimensions = 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;
+  Py_buffer __pyx_bstruct_dimensions;
+  Py_ssize_t __pyx_bstride_0_dimensions = 0;
+  Py_ssize_t __pyx_bshape_0_dimensions = 0;
   Py_buffer __pyx_bstruct_child_indices;
   Py_ssize_t __pyx_bstride_0_child_indices = 0;
   Py_ssize_t __pyx_bstride_1_child_indices = 0;
@@ -701,73 +766,61 @@
   PyObject *__pyx_r;
   long __pyx_1;
   PyObject *__pyx_2 = 0;
-  __pyx_t_5numpy_int32_t __pyx_3;
+  PyObject *__pyx_3 = 0;
   PyObject *__pyx_4 = 0;
-  __pyx_t_5numpy_int32_t __pyx_5;
-  __pyx_t_5numpy_int32_t __pyx_6;
-  __pyx_t_5numpy_int32_t __pyx_7;
-  int __pyx_8;
-  npy_intp __pyx_9;
-  __pyx_t_5numpy_float64_t __pyx_10;
+  PyObject *__pyx_5 = 0;
+  int __pyx_6;
+  int __pyx_7;
+  npy_intp __pyx_8;
+  __pyx_t_5numpy_float64_t __pyx_9;
+  PyObject *__pyx_10 = 0;
   PyObject *__pyx_11 = 0;
-  int __pyx_12;
-  PyObject *__pyx_13 = 0;
-  PyObject *__pyx_14 = 0;
-  PyObject *__pyx_15 = 0;
-  PyObject *__pyx_16 = 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;
-  long __pyx_t_6;
-  long __pyx_t_7;
-  long __pyx_t_8;
+  int __pyx_t_6;
+  int __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;
-  int __pyx_t_14;
+  PyArrayObject *__pyx_t_14 = NULL;
   int __pyx_t_15;
-  int __pyx_t_16;
-  int __pyx_t_17;
-  int __pyx_t_18;
-  int __pyx_t_19;
-  PyArrayObject *__pyx_t_20 = NULL;
-  int __pyx_t_21;
-  PyObject *__pyx_t_22 = NULL;
-  PyObject *__pyx_t_23 = NULL;
-  PyObject *__pyx_t_24 = NULL;
-  PyArrayObject *__pyx_t_25 = NULL;
-  long __pyx_t_26;
-  long __pyx_t_27;
-  long __pyx_t_28;
-  long __pyx_t_29;
-  long __pyx_t_30;
-  long __pyx_t_31;
-  static char *__pyx_argnames[] = {"output","refined","grids","pi","s","r",0};
+  PyObject *__pyx_t_16 = NULL;
+  PyObject *__pyx_t_17 = NULL;
+  PyObject *__pyx_t_18 = NULL;
+  PyArrayObject *__pyx_t_19 = NULL;
+  long __pyx_t_20;
+  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;
-  __pyx_v_s = 0;
-  __pyx_v_r = 0;
-  if (likely(!__pyx_kwds) && likely(4 <= PyTuple_GET_SIZE(__pyx_args)) && likely(PyTuple_GET_SIZE(__pyx_args) <= 6)) {
-    __pyx_v_output = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
-    __pyx_v_refined = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1));
-    __pyx_v_grids = ((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGridList *)PyTuple_GET_ITEM(__pyx_args, 2));
-    __pyx_v_pi = __pyx_PyInt_int(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_pi == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    if (PyTuple_GET_SIZE(__pyx_args) > 4) {
-      __pyx_v_s = __pyx_PyInt_int(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_s == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-      if (PyTuple_GET_SIZE(__pyx_args) > 5) {
-        __pyx_v_r = __pyx_PyInt_int(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_r == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-      }
-    }
+  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 = 62; __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 = 62; __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 = 62; __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 = 63; __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 = 63; __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 = 63; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_curpos = ((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_position *)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 = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_output = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 8));
+    __pyx_v_refined = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 9));
+    __pyx_v_grids = ((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGridList *)PyTuple_GET_ITEM(__pyx_args, 10));
   }
   else {
-    if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOOi|ii", __pyx_argnames, &__pyx_v_output, &__pyx_v_refined, &__pyx_v_grids, &__pyx_v_pi, &__pyx_v_s, &__pyx_v_r))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    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_refined, &__pyx_v_grids))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   }
   goto __pyx_L4;
   __pyx_L3_error:;
-  __Pyx_AddTraceback("yt.lagos.DepthFirstOctree.WalkRootgrid");
+  __Pyx_AddTraceback("yt.lagos.DepthFirstOctree.RecurseOctreeDepthFirst");
   return NULL;
   __pyx_L4:;
   __pyx_v_child_grid = ((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGrid *)Py_None); Py_INCREF(Py_None);
@@ -780,42 +833,43 @@
   __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_curpos = ((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_position *)Py_None); Py_INCREF(Py_None);
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_output), __pyx_ptype_5numpy_ndarray, 1, "output", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_refined), __pyx_ptype_5numpy_ndarray, 1, "refined", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __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 = 58; __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 = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_s = Py_None; Py_INCREF(Py_None);
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_curpos), __pyx_ptype_2yt_5lagos_16DepthFirstOctree_position, 1, "curpos", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __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 = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_refined), __pyx_ptype_5numpy_ndarray, 1, "refined", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __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 = 67; __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 = 62; __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_refined, &__pyx_bstruct_refined, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  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];
 
-  /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":66
+  /* "/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[pi-1]             # <<<<<<<<<<<<<<
+ *     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_pi - 1);
-  __pyx_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_grids), __pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __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 = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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;
 
-  /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":67
+  /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":72
  *     cdef OctreeGrid child_grid
- *     cdef OctreeGrid grid = grids[pi-1]
+ *     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 = 67; __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 = 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)) {
     __pyx_v_child_indices = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_bstruct_child_indices.buf = NULL;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __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];
   }
@@ -823,18 +877,18 @@
   Py_INCREF(__pyx_v_grid->child_indices);
   __pyx_v_child_indices = ((PyArrayObject *)__pyx_v_grid->child_indices);
 
-  /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":68
- *     cdef OctreeGrid grid = grids[pi-1]
+  /* "/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 = 68; __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 = 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)) {
     __pyx_v_dimensions = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_bstruct_dimensions.buf = NULL;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __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];
   }
@@ -842,18 +896,18 @@
   Py_INCREF(__pyx_v_grid->dimensions);
   __pyx_v_dimensions = ((PyArrayObject *)__pyx_v_grid->dimensions);
 
-  /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":69
+  /* "/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 = 69; __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 = 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)) {
     __pyx_v_fields = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_bstruct_fields.buf = NULL;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __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];
   }
@@ -861,18 +915,18 @@
   Py_INCREF(__pyx_v_grid->fields);
   __pyx_v_fields = ((PyArrayObject *)__pyx_v_grid->fields);
 
-  /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":70
+  /* "/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 = 70; __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 = 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)) {
     __pyx_v_leftedges = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); __pyx_bstruct_leftedges.buf = NULL;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __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];
   }
@@ -880,18 +934,18 @@
   Py_INCREF(__pyx_v_grid->left_edges);
   __pyx_v_leftedges = ((PyArrayObject *)__pyx_v_grid->left_edges);
 
-  /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":71
+  /* "/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 = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  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 = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__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];
   }
@@ -899,145 +953,138 @@
   Py_INCREF(__pyx_v_grid->dx);
   __pyx_v_dx = ((PyArrayObject *)__pyx_v_grid->dx);
 
-  /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":75
+  /* "/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
- *     cdef position curpos
- *     curpos.output_pos = s             # <<<<<<<<<<<<<<
- *     curpos.refined_pos = r
- *     for k in range(dimensions[2]):
- */
-  __pyx_v_curpos->output_pos = __pyx_v_s;
-
-  /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":76
- *     cdef position curpos
- *     curpos.output_pos = s
- *     curpos.refined_pos = r             # <<<<<<<<<<<<<<
- *     for k in range(dimensions[2]):
- *         print k
- */
-  __pyx_v_curpos->refined_pos = __pyx_v_r;
-
-  /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":77
- *     curpos.output_pos = s
- *     curpos.refined_pos = r
- *     for k in range(dimensions[2]):             # <<<<<<<<<<<<<<
- *         print k
- *         for j in range(dimensions[1]):
- */
-  __pyx_t_6 = 2;
-  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_bshape_0_dimensions;
-  __pyx_3 = *((__pyx_t_5numpy_int32_t *)((__pyx_t_5numpy_int32_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_dimensions.buf, __pyx_t_6, __pyx_bstride_0_dimensions)));
-  for (__pyx_v_k = 0; __pyx_v_k < __pyx_3; __pyx_v_k+=1) {
-
-    /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":78
- *     curpos.refined_pos = r
- *     for k in range(dimensions[2]):
- *         print k             # <<<<<<<<<<<<<<
- *         for j in range(dimensions[1]):
- *             for i in range(dimensions[0]):
- */
-    __pyx_2 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
-    __pyx_2 = 0;
-    if (__Pyx_Print(((PyObject *)__pyx_4), 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0;
-
-    /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":79
- *     for k in range(dimensions[2]):
- *         print k
- *         for j in range(dimensions[1]):             # <<<<<<<<<<<<<<
- *             for i in range(dimensions[0]):
- *                 gi = child_indices[i,j,k]
- */
-    __pyx_t_7 = 1;
-    if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_bshape_0_dimensions;
-    __pyx_5 = *((__pyx_t_5numpy_int32_t *)((__pyx_t_5numpy_int32_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_dimensions.buf, __pyx_t_7, __pyx_bstride_0_dimensions)));
-    for (__pyx_v_j = 0; __pyx_v_j < __pyx_5; __pyx_v_j+=1) {
-
-      /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":80
- *         print k
- *         for j in range(dimensions[1]):
- *             for i in range(dimensions[0]):             # <<<<<<<<<<<<<<
- *                 gi = child_indices[i,j,k]
- *                 if gi == -1:
- */
-      __pyx_t_8 = 0;
-      if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_bshape_0_dimensions;
-      __pyx_6 = *((__pyx_t_5numpy_int32_t *)((__pyx_t_5numpy_int32_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_dimensions.buf, __pyx_t_8, __pyx_bstride_0_dimensions)));
-      for (__pyx_v_i = 0; __pyx_v_i < __pyx_6; __pyx_v_i+=1) {
-
-        /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":81
- *         for j in range(dimensions[1]):
- *             for i in range(dimensions[0]):
- *                 gi = child_indices[i,j,k]             # <<<<<<<<<<<<<<
- *                 if gi == -1:
+ *     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_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):
+ */
+    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_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_t_9 = __pyx_v_i;
-        __pyx_t_10 = __pyx_v_j;
-        __pyx_t_11 = __pyx_v_k;
-        if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_bshape_0_child_indices;
-        if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_bshape_1_child_indices;
-        if (__pyx_t_11 < 0) __pyx_t_11 += __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_9, __pyx_bstride_0_child_indices, __pyx_t_10, __pyx_bstride_1_child_indices, __pyx_t_11, __pyx_bstride_2_child_indices)));
-        __pyx_v_gi = __pyx_7;
-
-        /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":82
- *             for i in range(dimensions[0]):
- *                 gi = child_indices[i,j,k]
- *                 if gi == -1:             # <<<<<<<<<<<<<<
+        __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_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;}
+        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_8 = (__pyx_v_gi == -1);
-        if (__pyx_8) {
+        __pyx_7 = (__pyx_v_ci == -1);
+        if (__pyx_7) {
 
-          /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":83
- *                 gi = child_indices[i,j,k]
- *                 if gi == -1:
+          /* "/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_9 = (__pyx_v_fields->dimensions[0]);
-          for (__pyx_v_fi = 0; __pyx_v_fi < __pyx_9; __pyx_v_fi+=1) {
+          __pyx_8 = (__pyx_v_fields->dimensions[0]);
+          for (__pyx_v_fi = 0; __pyx_v_fi < __pyx_8; __pyx_v_fi+=1) {
 
-            /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":84
- *                 if gi == -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_12 = __pyx_v_fi;
-            __pyx_t_13 = __pyx_v_i;
-            __pyx_t_14 = __pyx_v_j;
-            __pyx_t_15 = __pyx_v_k;
-            if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_bshape_0_fields;
-            if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_bshape_1_fields;
-            if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_2_fields;
-            if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_3_fields;
-            __pyx_10 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided4d(__pyx_bstruct_fields.buf, __pyx_t_12, __pyx_bstride_0_fields, __pyx_t_13, __pyx_bstride_1_fields, __pyx_t_14, __pyx_bstride_2_fields, __pyx_t_15, __pyx_bstride_3_fields)));
-            __pyx_t_16 = __pyx_v_curpos->output_pos;
-            __pyx_t_17 = __pyx_v_fi;
-            if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_bshape_0_output;
-            if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_bshape_1_output;
-            *((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided2d(__pyx_bstruct_output.buf, __pyx_t_16, __pyx_bstride_0_output, __pyx_t_17, __pyx_bstride_1_output)) = __pyx_10;
+            __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;
           }
 
-          /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":85
+          /* "/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_18 = __pyx_v_curpos->refined_pos;
-          if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_bshape_0_refined;
-          *((__pyx_t_5numpy_int32_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_refined.buf, __pyx_t_18, __pyx_bstride_0_refined)) = 0;
+          __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;
 
-          /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":86
+          /* "/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             # <<<<<<<<<<<<<<
@@ -1046,7 +1093,7 @@
  */
           __pyx_v_curpos->output_pos += 1;
 
-          /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":87
+          /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":91
  *                     refined[curpos.refined_pos] = 0
  *                     curpos.output_pos += 1
  *                     curpos.refined_pos += 1             # <<<<<<<<<<<<<<
@@ -1058,262 +1105,285 @@
         }
         /*else*/ {
 
-          /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":89
+          /* "/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[gi-1]
+ *                     child_grid = grids[ci-1]
  */
-          __pyx_t_19 = __pyx_v_curpos->refined_pos;
-          if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_bshape_0_refined;
-          *((__pyx_t_5numpy_int32_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_refined.buf, __pyx_t_19, __pyx_bstride_0_refined)) = 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;
 
-          /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":90
+          /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":94
  *                 else:
  *                     refined[curpos.refined_pos] = 1
  *                     curpos.refined_pos += 1             # <<<<<<<<<<<<<<
- *                     child_grid = grids[gi-1]
+ *                     child_grid = grids[ci-1]
  *                     child_dx = child_grid.dx
  */
           __pyx_v_curpos->refined_pos += 1;
 
-          /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":91
+          /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":95
  *                     refined[curpos.refined_pos] = 1
  *                     curpos.refined_pos += 1
- *                     child_grid = grids[gi-1]             # <<<<<<<<<<<<<<
+ *                     child_grid = grids[ci-1]             # <<<<<<<<<<<<<<
  *                     child_dx = child_grid.dx
  *                     child_leftedges = child_grid.left_edges
  */
-          __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 = 91; __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 = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __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;}
           Py_DECREF(((PyObject *)__pyx_v_child_grid));
-          __pyx_v_child_grid = ((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGrid *)__pyx_2);
-          __pyx_2 = 0;
+          __pyx_v_child_grid = ((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGrid *)__pyx_3);
+          __pyx_3 = 0;
 
-          /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":92
+          /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":96
  *                     curpos.refined_pos += 1
- *                     child_grid = grids[gi-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 = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_t_20 = ((PyArrayObject *)__pyx_v_child_grid->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_21 = __Pyx_GetBuffer_nn___pyx_t_5numpy_float64_t((PyObject*)__pyx_t_20, &__pyx_bstruct_child_dx, PyBUF_FORMAT| PyBUF_STRIDES, 1);
-          if (unlikely(__pyx_t_21 < 0)) 
+          __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_22, &__pyx_t_23, &__pyx_t_24);
+              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_22); Py_XDECREF(__pyx_t_23); Py_XDECREF(__pyx_t_24);
+                  Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
                   __Pyx_RaiseBufferFallbackError();
                 } else {
-                  PyErr_Restore(__pyx_t_22, __pyx_t_23, __pyx_t_24);
+                  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_21 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_t_20 = 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);
 
-          /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":93
- *                     child_grid = grids[gi-1]
+          /* "/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 = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_t_25 = ((PyArrayObject *)__pyx_v_child_grid->left_edges);
+          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_SafeReleaseBuffer((PyObject*)__pyx_v_child_leftedges, &__pyx_bstruct_child_leftedges);
-          __pyx_t_21 = __Pyx_GetBuffer_nn___pyx_t_5numpy_float64_t((PyObject*)__pyx_t_25, &__pyx_bstruct_child_leftedges, PyBUF_FORMAT| PyBUF_STRIDES, 1);
-          if (unlikely(__pyx_t_21 < 0)) 
+          __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)) 
           {
-              PyErr_Fetch(&__pyx_t_24, &__pyx_t_23, &__pyx_t_22);
+              PyErr_Fetch(&__pyx_t_18, &__pyx_t_17, &__pyx_t_16);
               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_24); Py_XDECREF(__pyx_t_23); Py_XDECREF(__pyx_t_22);
+                  Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_16);
                   __Pyx_RaiseBufferFallbackError();
                 } else {
-                  PyErr_Restore(__pyx_t_24, __pyx_t_23, __pyx_t_22);
+                  PyErr_Restore(__pyx_t_18, __pyx_t_17, __pyx_t_16);
               }
           }
           __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_21 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_t_25 = 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;
           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);
 
-          /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":94
+          /* "/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_26 = 0;
-          if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_bshape_0_leftedges;
-          __pyx_10 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_leftedges.buf, __pyx_t_26, __pyx_bstride_0_leftedges)));
-          __pyx_4 = PyFloat_FromDouble(__pyx_10); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_2 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_11 = PyNumber_Multiply(__pyx_2, ((PyObject *)__pyx_v_dx)); if (unlikely(!__pyx_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_2); __pyx_2 = 0;
-          __pyx_2 = PyNumber_Add(__pyx_4, __pyx_11); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __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_11); __pyx_11 = 0;
-          __pyx_t_27 = 0;
-          if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_bshape_0_child_leftedges;
-          __pyx_10 = *((__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_4 = PyFloat_FromDouble(__pyx_10); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_11 = PyNumber_Subtract(__pyx_2, __pyx_4); if (unlikely(!__pyx_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
           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;}
           Py_DECREF(__pyx_4); __pyx_4 = 0;
-          __pyx_2 = __Pyx_PyNumber_Divide(__pyx_11, ((PyObject *)__pyx_v_child_dx)); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_11); __pyx_11 = 0;
-          __pyx_12 = __pyx_PyInt_int(__pyx_2); if (unlikely((__pyx_12 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __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_12;
+          __pyx_v_child_i = __pyx_6;
 
-          /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":95
+          /* "/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
- *                     RecurseOctree(child_i, child_j, child_k, curpos, gi, pi, output, refined, grids)
+ *                     s = RecurseOctreeDepthFirst(child_i, child_j, child_k, 2, 2, 2,
  */
-          __pyx_t_28 = 1;
-          if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_bshape_0_leftedges;
-          __pyx_10 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_leftedges.buf, __pyx_t_28, __pyx_bstride_0_leftedges)));
-          __pyx_4 = PyFloat_FromDouble(__pyx_10); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_11 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_2 = PyNumber_Multiply(__pyx_11, ((PyObject *)__pyx_v_dx)); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_11); __pyx_11 = 0;
-          __pyx_11 = PyNumber_Add(__pyx_4, __pyx_2); if (unlikely(!__pyx_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __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;}
+          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_2); __pyx_2 = 0;
-          __pyx_t_29 = 1;
-          if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_bshape_0_child_leftedges;
-          __pyx_10 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_child_leftedges.buf, __pyx_t_29, __pyx_bstride_0_child_leftedges)));
-          __pyx_4 = PyFloat_FromDouble(__pyx_10); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_2 = PyNumber_Subtract(__pyx_11, __pyx_4); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_11); __pyx_11 = 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_11 = __Pyx_PyNumber_Divide(__pyx_2, ((PyObject *)__pyx_v_child_dx)); if (unlikely(!__pyx_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_2); __pyx_2 = 0;
-          __pyx_12 = __pyx_PyInt_int(__pyx_11); if (unlikely((__pyx_12 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_11); __pyx_11 = 0;
-          __pyx_v_child_j = __pyx_12;
+          __pyx_v_child_j = __pyx_6;
 
-          /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":96
+          /* "/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             # <<<<<<<<<<<<<<
- *                     RecurseOctree(child_i, child_j, child_k, curpos, gi, pi, output, refined, grids)
- * 
+ *                     s = RecurseOctreeDepthFirst(child_i, child_j, child_k, 2, 2, 2,
+ *                                         curpos, ci, output, refined, grids)
  */
-          __pyx_t_30 = 2;
-          if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_bshape_0_leftedges;
-          __pyx_10 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_leftedges.buf, __pyx_t_30, __pyx_bstride_0_leftedges)));
-          __pyx_4 = PyFloat_FromDouble(__pyx_10); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_2 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_11 = PyNumber_Multiply(__pyx_2, ((PyObject *)__pyx_v_dx)); if (unlikely(!__pyx_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_2); __pyx_2 = 0;
-          __pyx_2 = PyNumber_Add(__pyx_4, __pyx_11); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_4); __pyx_4 = 0;
-          Py_DECREF(__pyx_11); __pyx_11 = 0;
-          __pyx_t_31 = 2;
-          if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_bshape_0_child_leftedges;
-          __pyx_10 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_child_leftedges.buf, __pyx_t_31, __pyx_bstride_0_child_leftedges)));
-          __pyx_4 = PyFloat_FromDouble(__pyx_10); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_11 = PyNumber_Subtract(__pyx_2, __pyx_4); if (unlikely(!__pyx_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __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;}
           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;}
           Py_DECREF(__pyx_4); __pyx_4 = 0;
-          __pyx_2 = __Pyx_PyNumber_Divide(__pyx_11, ((PyObject *)__pyx_v_child_dx)); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_11); __pyx_11 = 0;
-          __pyx_12 = __pyx_PyInt_int(__pyx_2); if (unlikely((__pyx_12 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          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_v_child_k = __pyx_12;
+          __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;
 
-          /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":97
+          /* "/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
- *                     RecurseOctree(child_i, child_j, child_k, curpos, gi, pi, output, refined, grids)             # <<<<<<<<<<<<<<
+ *                     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
  * 
- * @cython.boundscheck(False)
  */
-          __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_kp_RecurseOctree); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_11 = PyInt_FromLong(__pyx_v_child_i); if (unlikely(!__pyx_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __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 = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_13 = PyInt_FromLong(__pyx_v_child_k); if (unlikely(!__pyx_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_14 = PyInt_FromLong(__pyx_v_gi); if (unlikely(!__pyx_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_15 = PyInt_FromLong(__pyx_v_pi); if (unlikely(!__pyx_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_16 = PyTuple_New(9); if (unlikely(!__pyx_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          PyTuple_SET_ITEM(__pyx_16, 0, __pyx_11);
-          PyTuple_SET_ITEM(__pyx_16, 1, __pyx_2);
-          PyTuple_SET_ITEM(__pyx_16, 2, __pyx_13);
+          __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);
+          PyTuple_SET_ITEM(__pyx_11, 1, __pyx_2);
+          PyTuple_SET_ITEM(__pyx_11, 2, __pyx_3);
+          Py_INCREF(__pyx_int_2);
+          PyTuple_SET_ITEM(__pyx_11, 3, __pyx_int_2);
+          Py_INCREF(__pyx_int_2);
+          PyTuple_SET_ITEM(__pyx_11, 4, __pyx_int_2);
+          Py_INCREF(__pyx_int_2);
+          PyTuple_SET_ITEM(__pyx_11, 5, __pyx_int_2);
           Py_INCREF(((PyObject *)__pyx_v_curpos));
-          PyTuple_SET_ITEM(__pyx_16, 3, ((PyObject *)__pyx_v_curpos));
-          PyTuple_SET_ITEM(__pyx_16, 4, __pyx_14);
-          PyTuple_SET_ITEM(__pyx_16, 5, __pyx_15);
+          PyTuple_SET_ITEM(__pyx_11, 6, ((PyObject *)__pyx_v_curpos));
+          PyTuple_SET_ITEM(__pyx_11, 7, __pyx_10);
           Py_INCREF(((PyObject *)__pyx_v_output));
-          PyTuple_SET_ITEM(__pyx_16, 6, ((PyObject *)__pyx_v_output));
+          PyTuple_SET_ITEM(__pyx_11, 8, ((PyObject *)__pyx_v_output));
           Py_INCREF(((PyObject *)__pyx_v_refined));
-          PyTuple_SET_ITEM(__pyx_16, 7, ((PyObject *)__pyx_v_refined));
+          PyTuple_SET_ITEM(__pyx_11, 9, ((PyObject *)__pyx_v_refined));
           Py_INCREF(((PyObject *)__pyx_v_grids));
-          PyTuple_SET_ITEM(__pyx_16, 8, ((PyObject *)__pyx_v_grids));
-          __pyx_11 = 0;
+          PyTuple_SET_ITEM(__pyx_11, 10, ((PyObject *)__pyx_v_grids));
+          __pyx_5 = 0;
           __pyx_2 = 0;
-          __pyx_13 = 0;
-          __pyx_14 = 0;
-          __pyx_15 = 0;
-          __pyx_11 = PyObject_Call(__pyx_4, ((PyObject *)__pyx_16), NULL); if (unlikely(!__pyx_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __pyx_3 = 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;
-          Py_DECREF(((PyObject *)__pyx_16)); __pyx_16 = 0;
-          Py_DECREF(__pyx_11); __pyx_11 = 0;
+          Py_DECREF(((PyObject *)__pyx_11)); __pyx_11 = 0;
+          Py_DECREF(__pyx_v_s);
+          __pyx_v_s = __pyx_5;
+          __pyx_5 = 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;
+
   __pyx_r = Py_None; Py_INCREF(Py_None);
   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_10);
   Py_XDECREF(__pyx_11);
-  Py_XDECREF(__pyx_13);
-  Py_XDECREF(__pyx_14);
-  Py_XDECREF(__pyx_15);
-  Py_XDECREF(__pyx_16);
   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
     PyErr_Fetch(&__pyx_type, &__pyx_value, &__pyx_tb);
-    __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_leftedges, &__pyx_bstruct_leftedges);
     __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_dimensions, &__pyx_bstruct_dimensions);
     __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_fields, &__pyx_bstruct_fields);
     __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_output, &__pyx_bstruct_output);
   PyErr_Restore(__pyx_type, __pyx_value, __pyx_tb);}
-  __Pyx_AddTraceback("yt.lagos.DepthFirstOctree.WalkRootgrid");
+  __Pyx_AddTraceback("yt.lagos.DepthFirstOctree.RecurseOctreeDepthFirst");
   __pyx_r = NULL;
   goto __pyx_L2;
   __pyx_L0:;
-  __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_leftedges, &__pyx_bstruct_leftedges);
   __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_dimensions, &__pyx_bstruct_dimensions);
   __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_fields, &__pyx_bstruct_fields);
   __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_output, &__pyx_bstruct_output);
@@ -1327,28 +1397,30 @@
   Py_XDECREF(__pyx_v_dx);
   Py_DECREF(__pyx_v_child_dx);
   Py_DECREF(__pyx_v_child_leftedges);
-  Py_DECREF(__pyx_v_curpos);
+  Py_DECREF(__pyx_v_s);
   return __pyx_r;
 }
 
-/* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":100
+/* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":106
  * 
  * @cython.boundscheck(False)
- * def RecurseOctree(int i_i, int j_i, int k_i,             # <<<<<<<<<<<<<<
- *                   position curpos, int gi, int pi,
- *                   np.ndarray[np.float64_t, ndim=2] output,
+ * 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_RecurseOctree(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyObject *__pyx_pf_2yt_5lagos_16DepthFirstOctree_RecurseOctree(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+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;
   int __pyx_v_j_i;
   int __pyx_v_k_i;
-  struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_position *__pyx_v_curpos = 0;
+  int __pyx_v_i_f;
+  int __pyx_v_j_f;
+  int __pyx_v_k_f;
+  PyArrayObject *__pyx_v_curpos = 0;
   int __pyx_v_gi;
-  int __pyx_v_pi;
   PyArrayObject *__pyx_v_output = 0;
-  PyArrayObject *__pyx_v_refined = 0;
+  PyArrayObject *__pyx_v_genealogy = 0;
   struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGridList *__pyx_v_grids = 0;
   int __pyx_v_i;
   int __pyx_v_i_off;
@@ -1358,11 +1430,12 @@
   int __pyx_v_k_off;
   int __pyx_v_ci;
   int __pyx_v_fi;
-  PyObject *__pyx_v_child_i;
-  PyObject *__pyx_v_child_j;
-  PyObject *__pyx_v_child_k;
+  int __pyx_v_child_i;
+  int __pyx_v_child_j;
+  int __pyx_v_child_k;
   struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGrid *__pyx_v_child_grid;
   struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGrid *__pyx_v_grid = 0;
+  int __pyx_v_level;
   PyArrayObject *__pyx_v_child_indices = 0;
   PyArrayObject *__pyx_v_dimensions = 0;
   PyArrayObject *__pyx_v_fields = 0;
@@ -1377,9 +1450,9 @@
   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_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;
@@ -1396,6 +1469,11 @@
   Py_ssize_t __pyx_bshape_0_child_indices = 0;
   Py_ssize_t __pyx_bshape_1_child_indices = 0;
   Py_ssize_t __pyx_bshape_2_child_indices = 0;
+  Py_buffer __pyx_bstruct_genealogy;
+  Py_ssize_t __pyx_bstride_0_genealogy = 0;
+  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_fields;
   Py_ssize_t __pyx_bstride_0_fields = 0;
   Py_ssize_t __pyx_bstride_1_fields = 0;
@@ -1413,62 +1491,74 @@
   PyObject *__pyx_r;
   long __pyx_1;
   PyObject *__pyx_2 = 0;
-  PyObject *__pyx_3 = 0;
+  int __pyx_3;
   PyObject *__pyx_4 = 0;
-  PyObject *__pyx_5 = 0;
-  int __pyx_6;
-  int __pyx_7;
-  npy_intp __pyx_8;
-  __pyx_t_5numpy_float64_t __pyx_9;
+  __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;
+  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;
-  int __pyx_t_7;
-  int __pyx_t_8;
+  __pyx_t_5numpy_int32_t __pyx_t_7;
+  long __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;
+  __pyx_t_5numpy_int32_t __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;
-  long __pyx_t_21;
+  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;
-  static char *__pyx_argnames[] = {"i_i","j_i","k_i","curpos","gi","pi","output","refined","grids",0};
+  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;
+  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};
   __pyx_self = __pyx_self;
-  if (likely(!__pyx_kwds) && likely(PyTuple_GET_SIZE(__pyx_args) == 9)) {
-    __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 = 100; __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 = 100; __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 = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    __pyx_v_curpos = ((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_position *)PyTuple_GET_ITEM(__pyx_args, 3));
-    __pyx_v_gi = __pyx_PyInt_int(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_gi == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    __pyx_v_pi = __pyx_PyInt_int(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_pi == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    __pyx_v_output = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 6));
-    __pyx_v_refined = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 7));
-    __pyx_v_grids = ((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGridList *)PyTuple_GET_ITEM(__pyx_args, 8));
+  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;}
+    __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_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));
   }
   else {
-    if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "iiiOiiOOO", __pyx_argnames, &__pyx_v_i_i, &__pyx_v_j_i, &__pyx_v_k_i, &__pyx_v_curpos, &__pyx_v_gi, &__pyx_v_pi, &__pyx_v_output, &__pyx_v_refined, &__pyx_v_grids))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    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;}
   }
   goto __pyx_L4;
   __pyx_L3_error:;
-  __Pyx_AddTraceback("yt.lagos.DepthFirstOctree.RecurseOctree");
+  __Pyx_AddTraceback("yt.lagos.DepthFirstOctree.RecurseOctreeByLevels");
   return NULL;
   __pyx_L4:;
-  __pyx_v_child_i = Py_None; Py_INCREF(Py_None);
-  __pyx_v_child_j = Py_None; Py_INCREF(Py_None);
-  __pyx_v_child_k = Py_None; Py_INCREF(Py_None);
   __pyx_v_child_grid = ((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGrid *)Py_None); Py_INCREF(Py_None);
   __pyx_bstruct_child_indices.buf = NULL;
   __pyx_bstruct_dimensions.buf = NULL;
@@ -1480,42 +1570,54 @@
   __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_2yt_5lagos_16DepthFirstOctree_position, 1, "curpos", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __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 = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_refined), __pyx_ptype_5numpy_ndarray, 1, "refined", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __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 = 104; __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 = 100; __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 = 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;}
+  __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;}
   __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_refined, &__pyx_bstruct_refined, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __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];
+  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;}
+  __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];
 
-  /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":108
- *     cdef child_i, child_j, child_k
+  /* "/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
- *     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 = 108; __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 = 108; __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 = 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_v_grid = ((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGrid *)__pyx_2);
   __pyx_2 = 0;
 
-  /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":109
- *     cdef OctreeGrid child_grid
+  /* "/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 = 109; __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 = 118; __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 = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __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];
   }
@@ -1523,18 +1625,18 @@
   Py_INCREF(__pyx_v_grid->child_indices);
   __pyx_v_child_indices = ((PyArrayObject *)__pyx_v_grid->child_indices);
 
-  /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":110
- *     cdef OctreeGrid grid = grids[gi-1]
+  /* "/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 = 110; __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 = 119; __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 = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __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];
   }
@@ -1542,18 +1644,18 @@
   Py_INCREF(__pyx_v_grid->dimensions);
   __pyx_v_dimensions = ((PyArrayObject *)__pyx_v_grid->dimensions);
 
-  /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":111
+  /* "/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 = 111; __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 = 120; __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 = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __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];
   }
@@ -1561,18 +1663,18 @@
   Py_INCREF(__pyx_v_grid->fields);
   __pyx_v_fields = ((PyArrayObject *)__pyx_v_grid->fields);
 
-  /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":112
+  /* "/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 = 112; __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 = 121; __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 = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __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];
   }
@@ -1580,18 +1682,18 @@
   Py_INCREF(__pyx_v_grid->left_edges);
   __pyx_v_leftedges = ((PyArrayObject *)__pyx_v_grid->left_edges);
 
-  /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":113
+  /* "/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 = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  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 = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__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];
   }
@@ -1599,384 +1701,448 @@
   Py_INCREF(__pyx_v_grid->dx);
   __pyx_v_dx = ((PyArrayObject *)__pyx_v_grid->dx);
 
-  /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":117
+  /* "/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
- *     # Not sure how to get around this
- *     for k_off in range(2):             # <<<<<<<<<<<<<<
+ *     for k_off in range(i_f):             # <<<<<<<<<<<<<<
  *         k = k_off + k_i
- *         for j_off in range(2):
+ *         if i_f > 2: print k
  */
-  for (__pyx_v_k_off = 0; __pyx_v_k_off < 2; __pyx_v_k_off+=1) {
+  for (__pyx_v_k_off = 0; __pyx_v_k_off < __pyx_v_i_f; __pyx_v_k_off+=1) {
 
-    /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":118
- *     # Not sure how to get around this
- *     for k_off in range(2):
+    /* "/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             # <<<<<<<<<<<<<<
- *         for j_off in range(2):
- *             j = j_off + j_i
+ *         if i_f > 2: print k
+ *         for j_off in range(j_f):
  */
     __pyx_v_k = (__pyx_v_k_off + __pyx_v_k_i);
 
-    /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":119
- *     for k_off in range(2):
+    /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":127
+ *     for k_off in range(i_f):
  *         k = k_off + k_i
- *         for j_off in range(2):             # <<<<<<<<<<<<<<
+ *         if i_f > 2: print k             # <<<<<<<<<<<<<<
+ *         for j_off in range(j_f):
  *             j = j_off + j_i
- *             for i_off in range(2):
  */
-    for (__pyx_v_j_off = 0; __pyx_v_j_off < 2; __pyx_v_j_off+=1) {
+    __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_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;
+      goto __pyx_L7;
+    }
+    __pyx_L7:;
 
-      /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":120
+    /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":128
  *         k = k_off + k_i
- *         for j_off in range(2):
+ *         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(2):
- *                 i = i_off + i_i
+ *             for i_off in range(k_f):
+ *                 genealogy[curpos[level], 2] = level
  */
       __pyx_v_j = (__pyx_v_j_off + __pyx_v_j_i);
 
-      /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":121
- *         for j_off in range(2):
+      /* "/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(2):             # <<<<<<<<<<<<<<
+ *             for i_off in range(k_f):             # <<<<<<<<<<<<<<
+ *                 genealogy[curpos[level], 2] = level
  *                 i = i_off + i_i
- *                 ci = grid.child_indices[i,j,k]
  */
-      for (__pyx_v_i_off = 0; __pyx_v_i_off < 2; __pyx_v_i_off+=1) {
+      for (__pyx_v_i_off = 0; __pyx_v_i_off < __pyx_v_k_f; __pyx_v_i_off+=1) {
 
-        /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":122
+        /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":131
  *             j = j_off + j_i
- *             for i_off in range(2):
+ *             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             # <<<<<<<<<<<<<<
- *                 ci = grid.child_indices[i,j,k]
- *                 if ci == -1:
+ *                 # always output data
+ *                 for fi in range(fields.shape[0]):
  */
         __pyx_v_i = (__pyx_v_i_off + __pyx_v_i_i);
 
-        /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":123
- *             for i_off in range(2):
- *                 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 = 123; __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 = 123; __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 = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        __pyx_5 = PyTuple_New(3); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __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_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 = 123; __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 = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-        Py_DECREF(__pyx_2); __pyx_2 = 0;
-        __pyx_v_ci = __pyx_6;
-
-        /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":124
+        /* "/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]
- *                 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) {
+        __pyx_6 = (__pyx_v_fields->dimensions[0]);
+        for (__pyx_v_fi = 0; __pyx_v_fi < __pyx_6; __pyx_v_fi+=1) {
 
-          /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":125
+          /* "/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:
- *                     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) {
-
-            /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":126
- *                 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;
-          }
-
-          /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":127
- *                     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;
-
-          /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":128
- *                         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_v_curpos->output_pos += 1;
-
-          /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":129
- *                     refined[curpos.refined_pos] = 0
- *                     curpos.output_pos += 1
- *                     curpos.refined_pos += 1             # <<<<<<<<<<<<<<
- *                 else:
- *                     refined[curpos.refined_pos] = 1
+ *                 if ci > -1:
  */
-          __pyx_v_curpos->refined_pos += 1;
-          goto __pyx_L11;
-        }
-        /*else*/ {
-
-          /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":131
- *                     curpos.refined_pos += 1
- *                 else:
- *                     refined[curpos.refined_pos] = 1             # <<<<<<<<<<<<<<
- *                     curpos.refined_pos += 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_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;
+        __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;
 
-          /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":132
- *                 else:
- *                     refined[curpos.refined_pos] = 1
- *                     curpos.refined_pos += 1             # <<<<<<<<<<<<<<
+        /* "/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_v_curpos->refined_pos += 1;
+        __pyx_3 = (__pyx_v_ci > -1);
+        if (__pyx_3) {
 
-          /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":133
- *                     refined[curpos.refined_pos] = 1
- *                     curpos.refined_pos += 1
+          /* "/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_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 = 133; __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 = 133; __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 = 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;}
           Py_DECREF(((PyObject *)__pyx_v_child_grid));
-          __pyx_v_child_grid = ((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGrid *)__pyx_3);
-          __pyx_3 = 0;
+          __pyx_v_child_grid = ((struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGrid *)__pyx_4);
+          __pyx_4 = 0;
 
-          /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":134
- *                     curpos.refined_pos += 1
+          /* "/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 = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_t_14 = ((PyArrayObject *)__pyx_v_child_grid->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_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)) 
+          __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_16, &__pyx_t_17, &__pyx_t_18);
+              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_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
+                  Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20);
                   __Pyx_RaiseBufferFallbackError();
                 } else {
-                  PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
+                  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_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_t_14 = 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);
 
-          /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":135
+          /* "/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 = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_t_19 = ((PyArrayObject *)__pyx_v_child_grid->left_edges);
+          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_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_21, &__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_20, &__pyx_t_19, &__pyx_t_18);
               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_20); Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_18);
                   __Pyx_RaiseBufferFallbackError();
                 } else {
-                  PyErr_Restore(__pyx_t_18, __pyx_t_17, __pyx_t_16);
+                  PyErr_Restore(__pyx_t_20, __pyx_t_19, __pyx_t_18);
               }
           }
           __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 = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_t_19 = 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;
           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);
 
-          /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":136
+          /* "/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_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 = 136; __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 = 136; __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 = 136; __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 = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_4); __pyx_4 = 0;
+          __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_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 = 136; __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 = 136; __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 = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __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_v_child_i);
-          __pyx_v_child_i = __pyx_2;
-          __pyx_2 = 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;
 
-          /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":137
+          /* "/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
- *                     s = RecurseOctree(child_i, child_j, child_k, curpos, ci, gi, output, refined, grids)
+ *                     # set current child id to id of next cell to examine
  */
-          __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 = 137; __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 = 137; __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 = 137; __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 = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_3); __pyx_3 = 0;
+          __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;
-          __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 = 137; __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 = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          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_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 = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_3); __pyx_3 = 0;
-          Py_DECREF(__pyx_v_child_j);
-          __pyx_v_child_j = __pyx_4;
-          __pyx_4 = 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;
 
-          /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":138
+          /* "/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             # <<<<<<<<<<<<<<
- *                     s = RecurseOctree(child_i, child_j, child_k, curpos, ci, gi, output, refined, grids)
- *     return s
+ *                     # set current child id to id of next cell to examine
+ *                     genealogy[curpos[level],0] = curpos[level+1]
  */
-          __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 = 138; __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 = 138; __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 = 138; __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 = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __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_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 = 138; __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 = 138; __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 = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+          __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;
-          Py_DECREF(__pyx_v_child_k);
-          __pyx_v_child_k = __pyx_3;
-          __pyx_3 = 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;
 
-          /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":139
- *                     child_j = ((leftedges[1] + j * dx) - child_leftedges[1])/child_dx
+          /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":145
  *                     child_k = ((leftedges[2] + k * dx) - child_leftedges[2])/child_dx
- *                     s = RecurseOctree(child_i, child_j, child_k, curpos, ci, gi, output, refined, grids)             # <<<<<<<<<<<<<<
+ *                     # 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;
+          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_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_4 = __Pyx_GetName(__pyx_m, __pyx_kp_RecurseOctree); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_5 = PyInt_FromLong(__pyx_v_ci); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_2 = PyInt_FromLong(__pyx_v_gi); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          __pyx_3 = PyTuple_New(9); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_INCREF(__pyx_v_child_i);
-          PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_child_i);
-          Py_INCREF(__pyx_v_child_j);
-          PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_child_j);
-          Py_INCREF(__pyx_v_child_k);
-          PyTuple_SET_ITEM(__pyx_3, 2, __pyx_v_child_k);
+          __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);
+          Py_INCREF(__pyx_int_2);
+          PyTuple_SET_ITEM(__pyx_13, 3, __pyx_int_2);
+          Py_INCREF(__pyx_int_2);
+          PyTuple_SET_ITEM(__pyx_13, 4, __pyx_int_2);
+          Py_INCREF(__pyx_int_2);
+          PyTuple_SET_ITEM(__pyx_13, 5, __pyx_int_2);
           Py_INCREF(((PyObject *)__pyx_v_curpos));
-          PyTuple_SET_ITEM(__pyx_3, 3, ((PyObject *)__pyx_v_curpos));
-          PyTuple_SET_ITEM(__pyx_3, 4, __pyx_5);
-          PyTuple_SET_ITEM(__pyx_3, 5, __pyx_2);
+          PyTuple_SET_ITEM(__pyx_13, 6, ((PyObject *)__pyx_v_curpos));
+          PyTuple_SET_ITEM(__pyx_13, 7, __pyx_12);
           Py_INCREF(((PyObject *)__pyx_v_output));
-          PyTuple_SET_ITEM(__pyx_3, 6, ((PyObject *)__pyx_v_output));
-          Py_INCREF(((PyObject *)__pyx_v_refined));
-          PyTuple_SET_ITEM(__pyx_3, 7, ((PyObject *)__pyx_v_refined));
+          PyTuple_SET_ITEM(__pyx_13, 8, ((PyObject *)__pyx_v_output));
+          Py_INCREF(((PyObject *)__pyx_v_genealogy));
+          PyTuple_SET_ITEM(__pyx_13, 9, ((PyObject *)__pyx_v_genealogy));
           Py_INCREF(((PyObject *)__pyx_v_grids));
-          PyTuple_SET_ITEM(__pyx_3, 8, ((PyObject *)__pyx_v_grids));
-          __pyx_5 = 0;
-          __pyx_2 = 0;
-          __pyx_5 = PyObject_Call(__pyx_4, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-          Py_DECREF(__pyx_4); __pyx_4 = 0;
-          Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
+          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;
           Py_DECREF(__pyx_v_s);
-          __pyx_v_s = __pyx_5;
-          __pyx_5 = 0;
+          __pyx_v_s = __pyx_4;
+          __pyx_4 = 0;
+          goto __pyx_L14;
         }
-        __pyx_L11:;
+        __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;
       }
     }
   }
 
-  /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":140
- *                     child_k = ((leftedges[2] + k * dx) - child_leftedges[2])/child_dx
- *                     s = RecurseOctree(child_i, child_j, child_k, curpos, ci, gi, output, refined, grids)
+  /* "/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;
@@ -1986,38 +2152,39 @@
   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_8);
+  Py_XDECREF(__pyx_9);
+  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_refined, &__pyx_bstruct_refined);
+    __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_fields, &__pyx_bstruct_fields);
     __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_output, &__pyx_bstruct_output);
   PyErr_Restore(__pyx_type, __pyx_value, __pyx_tb);}
-  __Pyx_AddTraceback("yt.lagos.DepthFirstOctree.RecurseOctree");
+  __Pyx_AddTraceback("yt.lagos.DepthFirstOctree.RecurseOctreeByLevels");
   __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_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_fields, &__pyx_bstruct_fields);
   __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_output, &__pyx_bstruct_output);
   __pyx_L2:;
-  Py_DECREF(__pyx_v_child_i);
-  Py_DECREF(__pyx_v_child_j);
-  Py_DECREF(__pyx_v_child_k);
   Py_DECREF(__pyx_v_child_grid);
   Py_XDECREF(__pyx_v_grid);
   Py_XDECREF(__pyx_v_child_indices);
@@ -2031,7 +2198,7 @@
   return __pyx_r;
 }
 
-/* "/u/ki/mturk/ki12/x86_64_local/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-linux-x86_64.egg/Cython/Includes/numpy.pxd":36
+/* "/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):             # <<<<<<<<<<<<<<
@@ -2048,7 +2215,7 @@
   PyObject *__pyx_2 = 0;
   PyObject *__pyx_3 = 0;
 
-  /* "/u/ki/mturk/ki12/x86_64_local/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-linux-x86_64.egg/Cython/Includes/numpy.pxd":42
+  /* "/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):             # <<<<<<<<<<<<<<
@@ -2058,7 +2225,7 @@
   __pyx_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
   if (__pyx_1) {
 
-    /* "/u/ki/mturk/ki12/x86_64_local/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-linux-x86_64.egg/Cython/Includes/numpy.pxd":43
+    /* "/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")             # <<<<<<<<<<<<<<
@@ -2077,7 +2244,7 @@
   }
   __pyx_L5:;
 
-  /* "/u/ki/mturk/ki12/x86_64_local/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-linux-x86_64.egg/Cython/Includes/numpy.pxd":45
+  /* "/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)             # <<<<<<<<<<<<<<
@@ -2086,7 +2253,7 @@
  */
   __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self));
 
-  /* "/u/ki/mturk/ki12/x86_64_local/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-linux-x86_64.egg/Cython/Includes/numpy.pxd":46
+  /* "/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)             # <<<<<<<<<<<<<<
@@ -2095,7 +2262,7 @@
  */
   __pyx_v_info->ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self));
 
-  /* "/u/ki/mturk/ki12/x86_64_local/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-linux-x86_64.egg/Cython/Includes/numpy.pxd":47
+  /* "/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)             # <<<<<<<<<<<<<<
@@ -2104,7 +2271,7 @@
  */
   __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self)));
 
-  /* "/u/ki/mturk/ki12/x86_64_local/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-linux-x86_64.egg/Cython/Includes/numpy.pxd":48
+  /* "/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)             # <<<<<<<<<<<<<<
@@ -2113,7 +2280,7 @@
  */
   __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self)));
 
-  /* "/u/ki/mturk/ki12/x86_64_local/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-linux-x86_64.egg/Cython/Includes/numpy.pxd":49
+  /* "/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             # <<<<<<<<<<<<<<
@@ -2122,7 +2289,7 @@
  */
   __pyx_v_info->suboffsets = NULL;
 
-  /* "/u/ki/mturk/ki12/x86_64_local/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-linux-x86_64.egg/Cython/Includes/numpy.pxd":50
+  /* "/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)             # <<<<<<<<<<<<<<
@@ -2131,7 +2298,7 @@
  */
   __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self));
 
-  /* "/u/ki/mturk/ki12/x86_64_local/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-linux-x86_64.egg/Cython/Includes/numpy.pxd":51
+  /* "/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)             # <<<<<<<<<<<<<<
@@ -2140,7 +2307,7 @@
  */
   __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self)));
 
-  /* "/u/ki/mturk/ki12/x86_64_local/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-linux-x86_64.egg/Cython/Includes/numpy.pxd":55
+  /* "/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)             # <<<<<<<<<<<<<<
@@ -2149,7 +2316,7 @@
  */
   __pyx_v_t = PyArray_TYPE(((PyArrayObject *)__pyx_v_self));
 
-  /* "/u/ki/mturk/ki12/x86_64_local/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-linux-x86_64.egg/Cython/Includes/numpy.pxd":56
+  /* "/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             # <<<<<<<<<<<<<<
@@ -2158,7 +2325,7 @@
  */
   __pyx_v_f = NULL;
 
-  /* "/u/ki/mturk/ki12/x86_64_local/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-linux-x86_64.egg/Cython/Includes/numpy.pxd":57
+  /* "/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"             # <<<<<<<<<<<<<<
@@ -2171,7 +2338,7 @@
     break;
     case NPY_UBYTE:
 
-    /* "/u/ki/mturk/ki12/x86_64_local/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-linux-x86_64.egg/Cython/Includes/numpy.pxd":58
+    /* "/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"             # <<<<<<<<<<<<<<
@@ -2182,7 +2349,7 @@
     break;
     case NPY_SHORT:
 
-    /* "/u/ki/mturk/ki12/x86_64_local/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-linux-x86_64.egg/Cython/Includes/numpy.pxd":59
+    /* "/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"             # <<<<<<<<<<<<<<
@@ -2193,7 +2360,7 @@
     break;
     case NPY_USHORT:
 
-    /* "/u/ki/mturk/ki12/x86_64_local/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-linux-x86_64.egg/Cython/Includes/numpy.pxd":60
+    /* "/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"             # <<<<<<<<<<<<<<
@@ -2204,7 +2371,7 @@
     break;
     case NPY_INT:
 
-    /* "/u/ki/mturk/ki12/x86_64_local/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-linux-x86_64.egg/Cython/Includes/numpy.pxd":61
+    /* "/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"             # <<<<<<<<<<<<<<
@@ -2215,7 +2382,7 @@
     break;
     case NPY_UINT:
 
-    /* "/u/ki/mturk/ki12/x86_64_local/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-linux-x86_64.egg/Cython/Includes/numpy.pxd":62
+    /* "/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"             # <<<<<<<<<<<<<<
@@ -2226,7 +2393,7 @@
     break;
     case NPY_LONG:
 
-    /* "/u/ki/mturk/ki12/x86_64_local/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-linux-x86_64.egg/Cython/Includes/numpy.pxd":63
+    /* "/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"             # <<<<<<<<<<<<<<
@@ -2237,7 +2404,7 @@
     break;
     case NPY_ULONG:
 
-    /* "/u/ki/mturk/ki12/x86_64_local/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-linux-x86_64.egg/Cython/Includes/numpy.pxd":64
+    /* "/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"             # <<<<<<<<<<<<<<
@@ -2248,7 +2415,7 @@
     break;
     case NPY_LONGLONG:
 
-    /* "/u/ki/mturk/ki12/x86_64_local/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-linux-x86_64.egg/Cython/Includes/numpy.pxd":65
+    /* "/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"             # <<<<<<<<<<<<<<
@@ -2259,7 +2426,7 @@
     break;
     case NPY_ULONGLONG:
 
-    /* "/u/ki/mturk/ki12/x86_64_local/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-linux-x86_64.egg/Cython/Includes/numpy.pxd":66
+    /* "/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"             # <<<<<<<<<<<<<<
@@ -2270,7 +2437,7 @@
     break;
     case NPY_FLOAT:
 
-    /* "/u/ki/mturk/ki12/x86_64_local/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-linux-x86_64.egg/Cython/Includes/numpy.pxd":67
+    /* "/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"             # <<<<<<<<<<<<<<
@@ -2281,7 +2448,7 @@
     break;
     case NPY_DOUBLE:
 
-    /* "/u/ki/mturk/ki12/x86_64_local/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-linux-x86_64.egg/Cython/Includes/numpy.pxd":68
+    /* "/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"             # <<<<<<<<<<<<<<
@@ -2292,7 +2459,7 @@
     break;
     case NPY_LONGDOUBLE:
 
-    /* "/u/ki/mturk/ki12/x86_64_local/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-linux-x86_64.egg/Cython/Includes/numpy.pxd":69
+    /* "/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"             # <<<<<<<<<<<<<<
@@ -2303,7 +2470,7 @@
     break;
     case NPY_OBJECT:
 
-    /* "/u/ki/mturk/ki12/x86_64_local/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-linux-x86_64.egg/Cython/Includes/numpy.pxd":70
+    /* "/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"             # <<<<<<<<<<<<<<
@@ -2314,7 +2481,7 @@
     break;
   }
 
-  /* "/u/ki/mturk/ki12/x86_64_local/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-linux-x86_64.egg/Cython/Includes/numpy.pxd":72
+  /* "/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:             # <<<<<<<<<<<<<<
@@ -2324,7 +2491,7 @@
   __pyx_1 = (__pyx_v_f == NULL);
   if (__pyx_1) {
 
-    /* "/u/ki/mturk/ki12/x86_64_local/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-linux-x86_64.egg/Cython/Includes/numpy.pxd":73
+    /* "/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)             # <<<<<<<<<<<<<<
@@ -2346,7 +2513,7 @@
   }
   __pyx_L6:;
 
-  /* "/u/ki/mturk/ki12/x86_64_local/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-linux-x86_64.egg/Cython/Includes/numpy.pxd":74
+  /* "/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             # <<<<<<<<<<<<<<
@@ -2369,6 +2536,9 @@
 static PyObject *__pyx_tp_new_2yt_5lagos_16DepthFirstOctree_position(PyTypeObject *t, PyObject *a, PyObject *k) {
   PyObject *o = (*t->tp_alloc)(t, 0);
   if (!o) return 0;
+  if (__pyx_pf_2yt_5lagos_16DepthFirstOctree_8position___cinit__(o, __pyx_empty_tuple, NULL) < 0) {
+    Py_DECREF(o); o = 0;
+  }
   return o;
 }
 
@@ -2606,6 +2776,7 @@
   {"left_edges", T_OBJECT, offsetof(struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGrid, left_edges), 0, 0},
   {"dimensions", T_OBJECT, offsetof(struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGrid, dimensions), 0, 0},
   {"dx", T_OBJECT, offsetof(struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGrid, dx), 0, 0},
+  {"level", T_INT, offsetof(struct __pyx_obj_2yt_5lagos_16DepthFirstOctree_OctreeGrid, level), 0, 0},
   {0, 0, 0, 0, 0}
 };
 
@@ -2947,8 +3118,8 @@
 };
 
 static struct PyMethodDef __pyx_methods[] = {
-  {"WalkRootgrid", (PyCFunction)__pyx_pf_2yt_5lagos_16DepthFirstOctree_WalkRootgrid, METH_VARARGS|METH_KEYWORDS, __pyx_doc_2yt_5lagos_16DepthFirstOctree_WalkRootgrid},
-  {"RecurseOctree", (PyCFunction)__pyx_pf_2yt_5lagos_16DepthFirstOctree_RecurseOctree, METH_VARARGS|METH_KEYWORDS, 0},
+  {"RecurseOctreeDepthFirst", (PyCFunction)__pyx_pf_2yt_5lagos_16DepthFirstOctree_RecurseOctreeDepthFirst, METH_VARARGS|METH_KEYWORDS, 0},
+  {"RecurseOctreeByLevels", (PyCFunction)__pyx_pf_2yt_5lagos_16DepthFirstOctree_RecurseOctreeByLevels, METH_VARARGS|METH_KEYWORDS, 0},
   {0, 0, 0, 0}
 };
 
@@ -2973,7 +3144,8 @@
   {&__pyx_kp___getitem__, __pyx_k___getitem__, sizeof(__pyx_k___getitem__), 0, 1, 1},
   {&__pyx_kp_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 1, 1, 1},
   {&__pyx_kp_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 1, 1},
-  {&__pyx_kp_RecurseOctree, __pyx_k_RecurseOctree, sizeof(__pyx_k_RecurseOctree), 0, 1, 1},
+  {&__pyx_kp_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 1, 1},
+  {&__pyx_kp_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 1, 1},
   {&__pyx_kp___getbuffer__, __pyx_k___getbuffer__, sizeof(__pyx_k___getbuffer__), 0, 1, 1},
   {&__pyx_kp_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 1, 1, 1},
   {&__pyx_kp_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 1, 1, 1},
@@ -2990,6 +3162,8 @@
 }
 
 static int __Pyx_InitGlobals(void) {
+  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
   return 0;
   __pyx_L1_error:;
@@ -3032,18 +3206,18 @@
   if (PyType_Ready(&__pyx_type_2yt_5lagos_16DepthFirstOctree_position) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   if (PyObject_SetAttrString(__pyx_m, "position", (PyObject *)&__pyx_type_2yt_5lagos_16DepthFirstOctree_position) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_ptype_2yt_5lagos_16DepthFirstOctree_position = &__pyx_type_2yt_5lagos_16DepthFirstOctree_position;
-  if (PyType_Ready(&__pyx_type_2yt_5lagos_16DepthFirstOctree_OctreeGrid) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyObject_SetAttrString(__pyx_m, "OctreeGrid", (PyObject *)&__pyx_type_2yt_5lagos_16DepthFirstOctree_OctreeGrid) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyType_Ready(&__pyx_type_2yt_5lagos_16DepthFirstOctree_OctreeGrid) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetAttrString(__pyx_m, "OctreeGrid", (PyObject *)&__pyx_type_2yt_5lagos_16DepthFirstOctree_OctreeGrid) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_ptype_2yt_5lagos_16DepthFirstOctree_OctreeGrid = &__pyx_type_2yt_5lagos_16DepthFirstOctree_OctreeGrid;
-  if (PyType_Ready(&__pyx_type_2yt_5lagos_16DepthFirstOctree_OctreeGridList) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyObject_SetAttrString(__pyx_m, "OctreeGridList", (PyObject *)&__pyx_type_2yt_5lagos_16DepthFirstOctree_OctreeGridList) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyType_Ready(&__pyx_type_2yt_5lagos_16DepthFirstOctree_OctreeGridList) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetAttrString(__pyx_m, "OctreeGridList", (PyObject *)&__pyx_type_2yt_5lagos_16DepthFirstOctree_OctreeGridList) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_ptype_2yt_5lagos_16DepthFirstOctree_OctreeGridList = &__pyx_type_2yt_5lagos_16DepthFirstOctree_OctreeGridList;
   /*--- Type import code ---*/
   __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 ---*/
 
-  /* "/afs/slac.stanford.edu/u/ki/mturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":26
+  /* "/Users/matthewturk/Development/yt/trunk/yt/lagos/DepthFirstOctree.pyx":26
  * """
  * 
  * import numpy as np             # <<<<<<<<<<<<<<
@@ -3054,7 +3228,7 @@
   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;
 
-  /* "/u/ki/mturk/ki12/x86_64_local/lib/python2.5/site-packages/Cython-0.9.8.1.1-py2.5-linux-x86_64.egg/Cython/Includes/numpy.pxd":36
+  /* "/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):             # <<<<<<<<<<<<<<
@@ -3243,6 +3417,51 @@
 }
 
 
+static INLINE void __Pyx_RaiseArgtupleTooLong(
+    Py_ssize_t num_expected,
+    Py_ssize_t num_found)
+{
+    const char* error_message =
+    #if PY_VERSION_HEX < 0x02050000
+        "function takes at most %d positional arguments (%d given)";
+    #else
+        "function takes at most %zd positional arguments (%zd given)";
+    #endif
+    PyErr_Format(PyExc_TypeError, error_message, num_expected, num_found);
+}
+
+static int __Pyx_CheckKeywordStrings(
+    PyObject *kwdict,
+    const char* function_name,
+    int kw_allowed)
+{
+    PyObject* key = 0;
+    Py_ssize_t pos = 0;
+    while (PyDict_Next(kwdict, &pos, &key, 0)) {
+        #if PY_MAJOR_VERSION < 3
+        if (unlikely(!PyString_Check(key))) {
+        #else
+        if (unlikely(!PyUnicode_Check(key))) {
+        #endif
+            PyErr_Format(PyExc_TypeError,
+                         "%s() keywords must be strings", function_name);
+            return 0;
+        }
+    }
+    if (unlikely(!kw_allowed) && unlikely(key)) {
+        PyErr_Format(PyExc_TypeError,
+        #if PY_MAJOR_VERSION < 3
+                     "'%s' is an invalid keyword argument for this function",
+                     PyString_AsString(key));
+        #else
+                     "'%U' is an invalid keyword argument for this function",
+                     key);
+        #endif
+        return 0;
+    }
+    return 1;
+}
+
 static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name, int exact) {
     if (!type) {
         PyErr_Format(PyExc_SystemError, "Missing type object");
@@ -3261,19 +3480,6 @@
     return 0;
 }
 
-static INLINE void __Pyx_RaiseArgtupleTooLong(
-    Py_ssize_t num_expected,
-    Py_ssize_t num_found)
-{
-    const char* error_message =
-    #if PY_VERSION_HEX < 0x02050000
-        "function takes at most %d positional arguments (%d given)";
-    #else
-        "function takes at most %zd positional arguments (%zd given)";
-    #endif
-    PyErr_Format(PyExc_TypeError, error_message, num_expected, num_found);
-}
-
 #if (PY_MAJOR_VERSION < 3) && !(Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_NEWBUFFER)
 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
   if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pf_5numpy_7ndarray___getbuffer__(obj, view, flags);
@@ -3335,6 +3541,14 @@
     return 0;
 }
 
+static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
+    PyObject *result;
+    result = PyObject_GetAttr(dict, name);
+    if (!result)
+        PyErr_SetObject(PyExc_NameError, name);
+    return result;
+}
+
 #if PY_MAJOR_VERSION < 3
 static PyObject *__Pyx_GetStdout(void) {
     PyObject *f = PySys_GetObject("stdout");
@@ -3410,14 +3624,6 @@
 }
 #endif
 
-static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
-    PyObject *result;
-    result = PyObject_GetAttr(dict, name);
-    if (!result)
-        PyErr_SetObject(PyExc_NameError, name);
-    return result;
-}
-
 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
     Py_XINCREF(type);
     Py_XINCREF(value);

Modified: trunk/yt/lagos/DepthFirstOctree.pyx
==============================================================================
--- trunk/yt/lagos/DepthFirstOctree.pyx	(original)
+++ trunk/yt/lagos/DepthFirstOctree.pyx	Thu Oct 23 10:19:14 2008
@@ -29,20 +29,26 @@
 
 cdef class position:
     cdef public int output_pos, refined_pos
+    def __cinit__(self):
+        self.output_pos = 0
+        self.refined_pos = 0
 
 cdef class OctreeGrid:
     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,
                   np.ndarray[np.float64_t, ndim=1] left_edges,
                   np.ndarray[np.int32_t, ndim=1] dimensions,
-                  np.ndarray[np.float64_t, ndim=1] dx):
+                  np.ndarray[np.float64_t, ndim=1] dx,
+                  int level):
         self.child_indices = child_indices
         self.fields = fields
         self.left_edges = left_edges
         self.dimensions = dimensions
         self.dx = dx
+        self.level = level
 
 cdef class OctreeGridList:
     cdef public object grids
@@ -53,17 +59,16 @@
         return self.grids[item]
 
 @cython.boundscheck(False)
-def WalkRootgrid(np.ndarray[np.float64_t, ndim=2] output,
-                 np.ndarray[np.int32_t, ndim=1] refined,
-                 OctreeGridList grids, int pi, int s = 0, int r = 0):
-    """
-    This function only gets called on a 'root grid' -- a base grid
-    of the simulation we are converting.  It will call a recursive walker.
-    """
-    cdef int i, j, k, gi, fi
+def RecurseOctreeDepthFirst(int i_i, int j_i, int k_i,
+                            int i_f, int j_f, int k_f,
+                            position curpos, int gi, 
+                            np.ndarray[np.float64_t, ndim=2] output,
+                            np.ndarray[np.int32_t, ndim=1] refined,
+                            OctreeGridList grids):
+    cdef int 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[pi-1]
+    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
@@ -71,15 +76,14 @@
     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
-    cdef position curpos
-    curpos.output_pos = s
-    curpos.refined_pos = r
-    for k in range(dimensions[2]):
-        print k
-        for j in range(dimensions[1]):
-            for i in range(dimensions[0]):
-                gi = child_indices[i,j,k]
-                if gi == -1:
+    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):
+                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]
                     refined[curpos.refined_pos] = 0
@@ -88,24 +92,29 @@
                 else:
                     refined[curpos.refined_pos] = 1
                     curpos.refined_pos += 1
-                    child_grid = grids[gi-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
                     child_j = ((leftedges[1] + j * dx) - child_leftedges[1])/child_dx
                     child_k = ((leftedges[2] + k * dx) - child_leftedges[2])/child_dx
-                    RecurseOctree(child_i, child_j, child_k, curpos, gi, pi, output, refined, grids)
+                    s = RecurseOctreeDepthFirst(child_i, child_j, child_k, 2, 2, 2,
+                                        curpos, ci, output, refined, grids)
+    return s
 
 @cython.boundscheck(False)
-def RecurseOctree(int i_i, int j_i, int k_i,
-                  position curpos, int gi, int pi,
-                  np.ndarray[np.float64_t, ndim=2] output,
-                  np.ndarray[np.int32_t, ndim=1] refined,
-                  OctreeGridList grids):
+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,
+                          int gi, 
+                          np.ndarray[np.float64_t, ndim=2] output,
+                          np.ndarray[np.int32_t, ndim=2] genealogy,
+                          OctreeGridList grids):
     cdef int i, i_off, j, j_off, k, k_off, ci, fi
-    cdef child_i, child_j, child_k
+    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
     cdef np.ndarray[np.int32_t, ndim=1] dimensions = grid.dimensions
     cdef np.ndarray[np.float64_t, ndim=4] fields = grid.fields
@@ -113,28 +122,31 @@
     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
-    # Not sure how to get around this
-    for k_off in range(2):
+    for k_off in range(i_f):
         k = k_off + k_i
-        for j_off in range(2):
+        if i_f > 2: print k
+        for j_off in range(j_f):
             j = j_off + j_i
-            for i_off in range(2):
+            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]):
+                    output[curpos[level],fi] = fields[fi,i,j,k]
                 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
-                    curpos.output_pos += 1
-                    curpos.refined_pos += 1
-                else:
-                    refined[curpos.refined_pos] = 1
-                    curpos.refined_pos += 1
+                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
                     child_j = ((leftedges[1] + j * dx) - child_leftedges[1])/child_dx
                     child_k = ((leftedges[2] + k * dx) - child_leftedges[2])/child_dx
-                    s = RecurseOctree(child_i, child_j, child_k, curpos, ci, gi, output, refined, grids)
+                    # 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]
+                    s = RecurseOctreeByLevels(child_i, child_j, child_k, 2, 2, 2,
+                                              curpos, ci, output, genealogy, 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 10:19:14 2008
@@ -455,17 +455,11 @@
         indices = na.where(self.gridLevels[:,0] == level)[0]
         return indices
 
-    def _generate_flat_octree(self, fields):
-        """
-        Generates two arrays, one of the actual values in a depth-first flat
-        octree array, and the other of the values describing the refinement.
-        This allows for export to a code that understands this.  *field* is the
-        field used in the data array.
-        """
+    def __initialize_octree_list(self, fields):
         import DepthFirstOctree as dfo
-        fields = ensure_list(fields)
         o_length = r_length = 0
         grids = []
+        levels_finest, levels_all = defaultdict(lambda: 0), defaultdict(lambda: 0)
         for g in self.grids:
             ff = na.array([g[f] for f in fields])
             grids.append(dfo.OctreeGrid(
@@ -473,16 +467,56 @@
                             ff.astype("float64"),
                             g.LeftEdge.astype('float64'),
                             g.ActiveDimensions.astype('int32'),
-                            na.ones(1,dtype='float64') * g.dx))
-            o_length += g.child_mask.ravel().sum()
-            r_length += g.ActiveDimensions.prod()
+                            na.ones(1,dtype='float64') * g.dx, g.Level))
+            levels_all[g.Level] += g.ActiveDimensions.prod()
+            levels_finest[g.Level] += g.child_mask.ravel().sum()
             g.clear_data()
+        ogl = dfo.OctreeGridList(grids)
+        return ogl, levels_finest, levels_all
+
+    def _generate_flat_octree(self, fields):
+        """
+        Generates two arrays, one of the actual values in a depth-first flat
+        octree array, and the other of the values describing the refinement.
+        This allows for export to a code that understands this.  *field* is the
+        field used in the data array.
+        """
+        import DepthFirstOctree as dfo
+        fields = ensure_list(fields)
+        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((o_length,len(fields)), dtype='float64')
         refined = na.zeros(r_length, dtype='int32')
-        ogl = dfo.OctreeGridList(grids)
-        dfo.WalkRootgrid(output, refined, ogl, 1, 0)
+        position = dfo.position()
+        dfo.RecurseOctreeDepthFirst(0, 0, 0,
+                ogl[0].dimensions[0],
+                ogl[0].dimensions[1],
+                ogl[0].dimensions[2],
+                position, 1,
+                output, refined, ogl)
         return output, refined
 
+    def _generate_levels_octree(self, fields):
+        import DepthFirstOctree as dfo
+        fields = ensure_list(fields)
+        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
+        position = na.add.accumulate(
+                    na.array([0] + [levels_all[v] for v in
+                        sorted(levels_all)[:-1]], dtype='int32'))
+        pp = position.copy()
+        dfo.RecurseOctreeByLevels(0, 0, 0,
+                ogl[0].dimensions[0],
+                ogl[0].dimensions[1],
+                ogl[0].dimensions[2],
+                position, 1,
+                output, genealogy, ogl)
+        return output, genealogy, (o_length, r_length)
+
 class EnzoHierarchy(AMRHierarchy):
     eiTopGrid = None
     _strip_path = False



More information about the yt-svn mailing list