# HG changeset patch # User Matthew Turk # Date 1282839881 21600 # Branch yt2-reorganization # Node ID c6b41bae4551bcbca86efa061d317ca63baea751 # Parent 87b5d03be7855cb99e3919d1de934110b0e49fc9 Moving lots more around, adding setup.py files diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 check_for_setup.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/check_for_setup.py Thu Aug 26 10:24:41 2010 -0600 @@ -0,0 +1,4 @@ +import os + +for dirpath, dirnames, filenames in os.walk("yt"): + if "setup.py" not in filenames: print dirpath diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/_amr_utils/CICDeposit.pyx --- a/yt/_amr_utils/CICDeposit.pyx Wed Aug 25 18:03:39 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -""" -Simle integrators for the radiative transfer equation - -Author: Britton Smith -Affiliation: CASA/University of Colorado -Homepage: http://yt.enzotools.org/ -License: - Copyright (C) 2008 Matthew Turk. All Rights Reserved. - - This file is part of yt. - - yt is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -""" - -@cython.boundscheck(False) -@cython.wraparound(False) -def CICDeposit_3(np.ndarray[np.float64_t, ndim=1] posx, - np.ndarray[np.float64_t, ndim=1] posy, - np.ndarray[np.float64_t, ndim=1] posz, - np.ndarray[np.float32_t, ndim=1] mass, - np.int64_t npositions, - np.ndarray[np.float32_t, ndim=3] field, - np.ndarray[np.float64_t, ndim=1] leftEdge, - np.ndarray[np.int32_t, ndim=1] gridDimension, - np.float64_t cellSize): - - cdef int i1, j1, k1, n - cdef double xpos, ypos, zpos - cdef double fact, edge0, edge1, edge2 - cdef double le0, le1, le2 - cdef float dx, dy, dz, dx2, dy2, dz2 - - edge0 = ( gridDimension[0]) - 0.5001 - edge1 = ( gridDimension[1]) - 0.5001 - edge2 = ( gridDimension[2]) - 0.5001 - fact = 1.0 / cellSize - - le0 = leftEdge[0] - le1 = leftEdge[1] - le2 = leftEdge[2] - - for n in range(npositions): - - # Compute the position of the central cell - xpos = fmin(fmax((posx[n] - le0)*fact, 0.5001), edge0) - ypos = fmin(fmax((posy[n] - le1)*fact, 0.5001), edge1) - zpos = fmin(fmax((posz[n] - le2)*fact, 0.5001), edge2) - - i1 = (xpos + 0.5) - j1 = (ypos + 0.5) - k1 = (zpos + 0.5) - - # Compute the weights - dx = ( i1) + 0.5 - xpos - dy = ( j1) + 0.5 - ypos - dz = ( k1) + 0.5 - zpos - dx2 = 1.0 - dx - dy2 = 1.0 - dy - dz2 = 1.0 - dz - - # Interpolate from field into sumfield - field[i1-1,j1-1,k1-1] += mass[n] * dx * dy * dz - field[i1 ,j1-1,k1-1] += mass[n] * dx2 * dy * dz - field[i1-1,j1 ,k1-1] += mass[n] * dx * dy2 * dz - field[i1 ,j1 ,k1-1] += mass[n] * dx2 * dy2 * dz - field[i1-1,j1-1,k1 ] += mass[n] * dx * dy * dz2 - field[i1 ,j1-1,k1 ] += mass[n] * dx2 * dy * dz2 - field[i1-1,j1 ,k1 ] += mass[n] * dx * dy2 * dz2 - field[i1 ,j1 ,k1 ] += mass[n] * dx2 * dy2 * dz2 diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/_amr_utils/ContourFinding.pyx --- a/yt/_amr_utils/ContourFinding.pyx Wed Aug 25 18:03:39 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,176 +0,0 @@ -""" -A two-pass contour finding algorithm - -Author: Matthew Turk -Affiliation: KIPAC/SLAC/Stanford -Homepage: http://yt.enzotools.org/ -License: - Copyright (C) 2010 Matthew Turk. All Rights Reserved. - - This file is part of yt. - - yt is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -""" - -import numpy as np -cimport numpy as np -cimport cython - -cdef extern from "math.h": - double fabs(double x) - -cdef inline np.int64_t i64max(np.int64_t i0, np.int64_t i1): - if i0 > i1: return i0 - return i1 - -cdef inline np.int64_t i64min(np.int64_t i0, np.int64_t i1): - if i0 < i1: return i0 - return i1 - -@cython.boundscheck(False) -def construct_boundary_relationships( - np.ndarray[dtype=np.int64_t, ndim=3] contour_ids): - # We only look at the boundary and one cell in - cdef int i, j, nx, ny, nz, offset_i, offset_j, oi, oj - cdef np.int64_t c1, c2 - tree = [] - nx = contour_ids.shape[0] - ny = contour_ids.shape[1] - nz = contour_ids.shape[2] - # First x-pass - for i in range(ny): - for j in range(nz): - for offset_i in range(3): - oi = offset_i - 1 - if i == 0 and oi == -1: continue - if i == ny - 1 and oj == 1: continue - for offset_j in range(3): - oj = offset_j - 1 - if j == 0 and oj == -1: continue - if j == nz - 1 and oj == 1: continue - c1 = contour_ids[0, i, j] - c2 = contour_ids[1, i + oi, j + oj] - if c1 > -1 and c2 > -1: - tree.append((i64max(c1,c2), i64min(c1,c2))) - c1 = contour_ids[nx-1, i, j] - c2 = contour_ids[nx-2, i + oi, j + oj] - if c1 > -1 and c2 > -1: - tree.append((i64max(c1,c2), i64min(c1,c2))) - # Now y-pass - for i in range(nx): - for j in range(nz): - for offset_i in range(3): - oi = offset_i - 1 - if i == 0 and oi == -1: continue - if i == nx - 1 and oj == 1: continue - for offset_j in range(3): - oj = offset_j - 1 - if j == 0 and oj == -1: continue - if j == nz - 1 and oj == 1: continue - c1 = contour_ids[i, 0, j] - c2 = contour_ids[i + oi, 1, j + oj] - if c1 > -1 and c2 > -1: - tree.append((i64max(c1,c2), i64min(c1,c2))) - c1 = contour_ids[i, ny-1, j] - c2 = contour_ids[i + oi, ny-2, j + oj] - if c1 > -1 and c2 > -1: - tree.append((i64max(c1,c2), i64min(c1,c2))) - for i in range(nx): - for j in range(ny): - for offset_i in range(3): - oi = offset_i - 1 - if i == 0 and oi == -1: continue - if i == nx - 1 and oj == 1: continue - for offset_j in range(3): - oj = offset_j - 1 - if j == 0 and oj == -1: continue - if j == ny - 1 and oj == 1: continue - c1 = contour_ids[i, j, 0] - c2 = contour_ids[i + oi, j + oj, 1] - if c1 > -1 and c2 > -1: - tree.append((i64max(c1,c2), i64min(c1,c2))) - c1 = contour_ids[i, j, nz-1] - c2 = contour_ids[i + oi, j + oj, nz-2] - if c1 > -1 and c2 > -1: - tree.append((i64max(c1,c2), i64min(c1,c2))) - return tree - -cdef inline int are_neighbors( - np.float64_t x1, np.float64_t y1, np.float64_t z1, - np.float64_t dx1, np.float64_t dy1, np.float64_t dz1, - np.float64_t x2, np.float64_t y2, np.float64_t z2, - np.float64_t dx2, np.float64_t dy2, np.float64_t dz2, - ): - # We assume an epsilon of 1e-15 - if fabs(x1-x2) > 0.5*(dx1+dx2): return 0 - if fabs(y1-y2) > 0.5*(dy1+dy2): return 0 - if fabs(z1-z2) > 0.5*(dz1+dz2): return 0 - return 1 - -@cython.boundscheck(False) -@cython.wraparound(False) -def identify_field_neighbors( - np.ndarray[dtype=np.float64_t, ndim=1] field, - np.ndarray[dtype=np.float64_t, ndim=1] x, - np.ndarray[dtype=np.float64_t, ndim=1] y, - np.ndarray[dtype=np.float64_t, ndim=1] z, - np.ndarray[dtype=np.float64_t, ndim=1] dx, - np.ndarray[dtype=np.float64_t, ndim=1] dy, - np.ndarray[dtype=np.float64_t, ndim=1] dz, - ): - # We assume this field is pre-jittered; it has no identical values. - cdef int outer, inner, N, added - cdef np.float64_t x1, y1, z1, dx1, dy1, dz1 - N = field.shape[0] - #cdef np.ndarray[dtype=np.object_t] joins - joins = [[] for outer in range(N)] - #joins = np.empty(N, dtype='object') - for outer in range(N): - if (outer % 10000) == 0: print outer, N - x1 = x[outer] - y1 = y[outer] - z1 = z[outer] - dx1 = dx[outer] - dy1 = dy[outer] - dz1 = dz[outer] - this_joins = joins[outer] - added = 0 - # Go in reverse order - for inner in range(outer, 0, -1): - if not are_neighbors(x1, y1, z1, dx1, dy1, dz1, - x[inner], y[inner], z[inner], - dx[inner], dy[inner], dz[inner]): - continue - # Hot dog, we have a weiner! - this_joins.append(inner) - added += 1 - if added == 26: break - return joins - -@cython.boundscheck(False) -@cython.wraparound(False) -def extract_identified_contours(int max_ind, joins): - cdef int i - contours = [] - for i in range(max_ind + 1): # +1 to get to the max_ind itself - contours.append(set([i])) - if len(joins[i]) == 0: - continue - proto_contour = [i] - for j in joins[i]: - proto_contour += contours[j] - proto_contour = set(proto_contour) - for j in proto_contour: - contours[j] = proto_contour - return contours diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/_amr_utils/DepthFirstOctree.pyx --- a/yt/_amr_utils/DepthFirstOctree.pyx Wed Aug 25 18:03:39 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,167 +0,0 @@ -""" -This is a recursive function to return a depth-first octree - -Author: Matthew Turk -Affiliation: KIPAC/SLAC/Stanford -Homepage: http://yt.enzotools.org/ -License: - Copyright (C) 2008 Matthew Turk. All Rights Reserved. - - This file is part of yt. - - yt is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -""" - -import numpy as np -cimport numpy as np -cimport cython - -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, - 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 - def __cinit__(self, grids): - self.grids = grids - - def __getitem__(self, int item): - return self.grids[item] - -@cython.boundscheck(False) -def RecurseOctreeDepthFirst(int i_i, int j_i, int k_i, - int i_f, int j_f, int k_f, - position curpos, int gi, - 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[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 - cdef np.float64_t dx = grid.dx[0] - cdef np.float64_t child_dx - cdef np.ndarray[np.float64_t, ndim=1] child_leftedges - cdef np.float64_t cx, cy, cz - for i_off in range(i_f): - i = i_off + i_i - cx = (leftedges[0] + i*dx) - for j_off in range(j_f): - j = j_off + j_i - cy = (leftedges[1] + j*dx) - for k_off in range(k_f): - k = k_off + k_i - cz = (leftedges[2] + k*dx) - 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 - child_grid = grids[ci-1] - child_dx = child_grid.dx[0] - child_leftedges = child_grid.left_edges - child_i = int((cx - child_leftedges[0])/child_dx) - child_j = int((cy - child_leftedges[1])/child_dx) - child_k = int((cz - child_leftedges[2])/child_dx) - s = RecurseOctreeDepthFirst(child_i, child_j, child_k, 2, 2, 2, - curpos, ci, output, refined, grids) - return s - -@cython.boundscheck(False) -def RecurseOctreeByLevels(int i_i, int j_i, int k_i, - int i_f, int j_f, int k_f, - np.ndarray[np.int32_t, ndim=1] curpos, - int gi, - np.ndarray[np.float64_t, ndim=2] output, - np.ndarray[np.int32_t, ndim=2] genealogy, - np.ndarray[np.float64_t, ndim=2] corners, - OctreeGridList grids): - cdef np.int32_t i, i_off, j, j_off, k, k_off, ci, fi - cdef int child_i, child_j, child_k - cdef OctreeGrid child_grid - cdef OctreeGrid grid = grids[gi-1] - 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 - cdef np.float64_t dx = grid.dx[0] - cdef np.float64_t child_dx - cdef np.ndarray[np.float64_t, ndim=1] child_leftedges - cdef np.float64_t cx, cy, cz - cdef int cp - for i_off in range(i_f): - i = i_off + i_i - cx = (leftedges[0] + i*dx) - if i_f > 2: print k, cz - for j_off in range(j_f): - j = j_off + j_i - cy = (leftedges[1] + j*dx) - for k_off in range(k_f): - k = k_off + k_i - cz = (leftedges[2] + k*dx) - cp = curpos[level] - corners[cp, 0] = cx - corners[cp, 1] = cy - corners[cp, 2] = cz - genealogy[curpos[level], 2] = level - # always output data - for fi in range(fields.shape[0]): - output[cp,fi] = fields[fi,i,j,k] - ci = child_indices[i,j,k] - if ci > -1: - child_grid = grids[ci-1] - child_dx = child_grid.dx[0] - child_leftedges = child_grid.left_edges - child_i = int((cx-child_leftedges[0])/child_dx) - child_j = int((cy-child_leftedges[1])/child_dx) - child_k = int((cz-child_leftedges[2])/child_dx) - # set current child id to id of next cell to examine - genealogy[cp, 0] = curpos[level+1] - # set next parent id to id of current cell - genealogy[curpos[level+1]:curpos[level+1]+8, 1] = cp - s = RecurseOctreeByLevels(child_i, child_j, child_k, 2, 2, 2, - curpos, ci, output, genealogy, - corners, grids) - curpos[level] += 1 - return s - diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/_amr_utils/FixedInterpolator.c --- a/yt/_amr_utils/FixedInterpolator.c Wed Aug 25 18:03:39 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,130 +0,0 @@ -/************************************************************************ -* Copyright (C) 2009 Matthew Turk. All Rights Reserved. -* -* This file is part of yt. -* -* yt is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -************************************************************************/ - - -// -// A small, tiny, itty bitty module for computation-intensive interpolation -// that I can't seem to make fast in Cython -// - -#include "FixedInterpolator.h" - -#define VINDEX(A,B,C) data[((((A)+ci[0])*(ds[1]+1)+((B)+ci[1]))*(ds[2]+1)+ci[2]+(C))] -// (((C*ds[1])+B)*ds[0]+A) -#define OINDEX(A,B,C) data[(A)*(ds[1]+1)*(ds[2]+1)+(B)*ds[2]+(B)+(C)] - -npy_float64 fast_interpolate(int ds[3], int ci[3], npy_float64 dp[3], - npy_float64 *data) -{ - int i; - npy_float64 dv, dm[3]; - for(i=0;i<3;i++)dm[i] = (1.0 - dp[i]); - dv = 0.0; - dv += VINDEX(0,0,0) * (dm[0]*dm[1]*dm[2]); - dv += VINDEX(0,0,1) * (dm[0]*dm[1]*dp[2]); - dv += VINDEX(0,1,0) * (dm[0]*dp[1]*dm[2]); - dv += VINDEX(0,1,1) * (dm[0]*dp[1]*dp[2]); - dv += VINDEX(1,0,0) * (dp[0]*dm[1]*dm[2]); - dv += VINDEX(1,0,1) * (dp[0]*dm[1]*dp[2]); - dv += VINDEX(1,1,0) * (dp[0]*dp[1]*dm[2]); - dv += VINDEX(1,1,1) * (dp[0]*dp[1]*dp[2]); - /*assert(dv < -20);*/ - return dv; -} - -npy_float64 offset_interpolate(int ds[3], npy_float64 dp[3], npy_float64 *data) -{ - int i; - npy_float64 dv, vz[4]; - - dv = 1.0 - dp[2]; - vz[0] = dv*OINDEX(0,0,0) + dp[2]*OINDEX(0,0,1); - vz[1] = dv*OINDEX(0,1,0) + dp[2]*OINDEX(0,1,1); - vz[2] = dv*OINDEX(1,0,0) + dp[2]*OINDEX(1,0,1); - vz[3] = dv*OINDEX(1,1,0) + dp[2]*OINDEX(1,1,1); - - dv = 1.0 - dp[1]; - vz[0] = dv*vz[0] + dp[1]*vz[1]; - vz[1] = dv*vz[2] + dp[1]*vz[3]; - - dv = 1.0 - dp[0]; - vz[0] = dv*vz[0] + dp[0]*vz[1]; - - return vz[0]; -} - -npy_float64 trilinear_interpolate(int ds[3], int ci[3], npy_float64 dp[3], - npy_float64 *data) -{ - /* dims is one less than the dimensions of the array */ - int i; - npy_float64 dm[3], vz[4]; - //dp is the distance to the plane. dm is val, dp = 1-val - for(i=0;i<3;i++)dm[i] = (1.0 - dp[i]); - - //First interpolate in z - vz[0] = dm[2]*VINDEX(0,0,0) + dp[2]*VINDEX(0,0,1); - vz[1] = dm[2]*VINDEX(0,1,0) + dp[2]*VINDEX(0,1,1); - vz[2] = dm[2]*VINDEX(1,0,0) + dp[2]*VINDEX(1,0,1); - vz[3] = dm[2]*VINDEX(1,1,0) + dp[2]*VINDEX(1,1,1); - - //Then in y - vz[0] = dm[1]*vz[0] + dp[1]*vz[1]; - vz[1] = dm[1]*vz[2] + dp[1]*vz[3]; - - //Then in x - vz[0] = dm[0]*vz[0] + dp[0]*vz[1]; - /*assert(dv < -20);*/ - return vz[0]; -} - -npy_float64 eval_gradient(int *ds, int *ci, npy_float64 *dp, - npy_float64 *data, npy_float64 *grad) -{ - // We just take some small value - - int i; - npy_float64 denom, plus, minus, backup, normval; - - normval = 0.0; - for (i = 0; i < 3; i++) { - backup = dp[i]; - grad[i] = 0.0; - if (dp[i] >= 0.95) {plus = dp[i]; minus = dp[i] - 0.05;} - else if (dp[i] <= 0.05) {plus = dp[i] + 0.05; minus = 0.0;} - else {plus = dp[i] + 0.05; minus = dp[i] - 0.05;} - //fprintf(stderr, "DIM: %d %0.3lf %0.3lf\n", i, plus, minus); - denom = plus - minus; - dp[i] = plus; - grad[i] += trilinear_interpolate(ds, ci, dp, data) / denom; - dp[i] = minus; - grad[i] -= trilinear_interpolate(ds, ci, dp, data) / denom; - dp[i] = backup; - normval += grad[i]*grad[i]; - } - if (normval != 0.0){ - normval = sqrt(normval); - for (i = 0; i < 3; i++) grad[i] /= -normval; - //fprintf(stderr, "Normval: %0.3lf %0.3lf %0.3lf %0.3lf\n", - // normval, grad[0], grad[1], grad[2]); - }else{ - grad[0]=grad[1]=grad[2]=0.0; - } -} diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/_amr_utils/FixedInterpolator.h --- a/yt/_amr_utils/FixedInterpolator.h Wed Aug 25 18:03:39 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/************************************************************************ -* Copyright (C) 2009 Matthew Turk. All Rights Reserved. -* -* This file is part of yt. -* -* yt is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -************************************************************************/ - - -// -// A small, tiny, itty bitty module for computation-intensive interpolation -// that I can't seem to make fast in Cython -// - -#include "Python.h" - -#include -#include -#include -#include - -#include "numpy/ndarrayobject.h" - -npy_float64 fast_interpolate(int ds[3], int ci[3], npy_float64 dp[3], - npy_float64 *data); - -npy_float64 offset_interpolate(int ds[3], npy_float64 dp[3], npy_float64 *data); - -npy_float64 trilinear_interpolate(int ds[3], int ci[3], npy_float64 dp[3], - npy_float64 *data); - -npy_float64 eval_gradient(int ds[3], int ci[3], npy_float64 dp[3], - npy_float64 *data, npy_float64 *grad); diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/_amr_utils/Interpolators.pyx --- a/yt/_amr_utils/Interpolators.pyx Wed Aug 25 18:03:39 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,116 +0,0 @@ -""" -Simple interpolators - -Author: Matthew Turk -Affiliation: KIPAC/SLAC/Stanford -Homepage: http://yt.enzotools.org/ -License: - Copyright (C) 2008 Matthew Turk. All Rights Reserved. - - This file is part of yt. - - yt is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -""" - -import numpy as np -cimport numpy as np -cimport cython - -@cython.boundscheck(False) -def UnilinearlyInterpolate(np.ndarray[np.float64_t, ndim=1] table, - np.ndarray[np.float64_t, ndim=1] x_vals, - np.ndarray[np.float64_t, ndim=1] x_bins, - np.ndarray[np.int32_t, ndim=1] x_is, - np.ndarray[np.float64_t, ndim=1] output): - cdef double x, xp, xm - cdef int i, x_i, y_i - for i in range(x_vals.shape[0]): - x_i = x_is[i] - x = x_vals[i] - dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) - xp = (x - x_bins[x_i]) * dx_inv - xm = (x_bins[x_i+1] - x) * dx_inv - output[i] = table[x_i ] * (xm) \ - + table[x_i+1] * (xp) - -@cython.boundscheck(False) -def BilinearlyInterpolate(np.ndarray[np.float64_t, ndim=2] table, - np.ndarray[np.float64_t, ndim=1] x_vals, - np.ndarray[np.float64_t, ndim=1] y_vals, - np.ndarray[np.float64_t, ndim=1] x_bins, - np.ndarray[np.float64_t, ndim=1] y_bins, - np.ndarray[np.int32_t, ndim=1] x_is, - np.ndarray[np.int32_t, ndim=1] y_is, - np.ndarray[np.float64_t, ndim=1] output): - cdef double x, xp, xm - cdef double y, yp, ym - cdef double dx_inv, dy_inv - cdef int i, x_i, y_i - for i in range(x_vals.shape[0]): - x_i = x_is[i] - y_i = y_is[i] - x = x_vals[i] - y = y_vals[i] - dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) - dy_inv = 1.0 / (y_bins[y_i+1] - y_bins[y_i]) - xp = (x - x_bins[x_i]) * dx_inv - yp = (y - y_bins[y_i]) * dy_inv - xm = (x_bins[x_i+1] - x) * dx_inv - ym = (y_bins[y_i+1] - y) * dy_inv - output[i] = table[x_i , y_i ] * (xm*ym) \ - + table[x_i+1, y_i ] * (xp*ym) \ - + table[x_i , y_i+1] * (xm*yp) \ - + table[x_i+1, y_i+1] * (xp*yp) - -@cython.boundscheck(False) -def TrilinearlyInterpolate(np.ndarray[np.float64_t, ndim=3] table, - np.ndarray[np.float64_t, ndim=1] x_vals, - np.ndarray[np.float64_t, ndim=1] y_vals, - np.ndarray[np.float64_t, ndim=1] z_vals, - np.ndarray[np.float64_t, ndim=1] x_bins, - np.ndarray[np.float64_t, ndim=1] y_bins, - np.ndarray[np.float64_t, ndim=1] z_bins, - np.ndarray[np.int_t, ndim=1] x_is, - np.ndarray[np.int_t, ndim=1] y_is, - np.ndarray[np.int_t, ndim=1] z_is, - np.ndarray[np.float64_t, ndim=1] output): - cdef double x, xp, xm - cdef double y, yp, ym - cdef double z, zp, zm - cdef double dx_inv, dy_inv, dz_inv - cdef int i, x_i, y_i, z_i - for i in range(x_vals.shape[0]): - x_i = x_is[i] - y_i = y_is[i] - z_i = z_is[i] - x = x_vals[i] - y = y_vals[i] - z = z_vals[i] - dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) - dy_inv = 1.0 / (y_bins[y_i+1] - y_bins[y_i]) - dz_inv = 1.0 / (z_bins[z_i+1] - z_bins[z_i]) - xp = (x - x_bins[x_i]) * dx_inv - yp = (y - y_bins[y_i]) * dy_inv - zp = (z - z_bins[z_i]) * dz_inv - xm = (x_bins[x_i+1] - x) * dx_inv - ym = (y_bins[y_i+1] - y) * dy_inv - zm = (z_bins[z_i+1] - z) * dz_inv - output[i] = table[x_i ,y_i ,z_i ] * (xm*ym*zm) \ - + table[x_i+1,y_i ,z_i ] * (xp*ym*zm) \ - + table[x_i ,y_i+1,z_i ] * (xm*yp*zm) \ - + table[x_i ,y_i ,z_i+1] * (xm*ym*zp) \ - + table[x_i+1,y_i ,z_i+1] * (xp*ym*zp) \ - + table[x_i ,y_i+1,z_i+1] * (xm*yp*zp) \ - + table[x_i+1,y_i+1,z_i ] * (xp*yp*zm) \ - + table[x_i+1,y_i+1,z_i+1] * (xp*yp*zp) diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/_amr_utils/Octree.pyx --- a/yt/_amr_utils/Octree.pyx Wed Aug 25 18:03:39 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,280 +0,0 @@ -""" -A refine-by-two AMR-specific octree - -Author: Matthew Turk -Affiliation: UCSD -Homepage: http://yt.enzotools.org/ -License: - Copyright (C) 2010 Matthew Turk. All Rights Reserved. - - This file is part of yt. - - yt is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -""" - - -import numpy as np -cimport numpy as np -# Double up here for def'd functions -cimport numpy as cnp -cimport cython - -from stdlib cimport malloc, free, abs - -cdef extern from "stdlib.h": - # NOTE that size_t might not be int - void *alloca(int) - -cdef struct OctreeNode: - np.float64_t *val - np.float64_t weight_val - np.int64_t pos[3] - int level - int nvals - OctreeNode *children[2][2][2] - -cdef void OTN_add_value(OctreeNode *self, - np.float64_t *val, np.float64_t weight_val): - cdef int i - for i in range(self.nvals): - self.val[i] += val[i] - self.weight_val += weight_val - -cdef void OTN_refine(OctreeNode *self): - cdef int i, j, i1, j1 - cdef np.int64_t npos[3] - cdef OctreeNode *node - for i in range(2): - npos[0] = self.pos[0] * 2 + i - for j in range(2): - npos[1] = self.pos[1] * 2 + j - # We have to be careful with allocation... - for k in range(2): - npos[2] = self.pos[2] * 2 + k - self.children[i][j][k] = OTN_initialize( - npos, - self.nvals, self.val, self.weight_val, - self.level + 1) - for i in range(self.nvals): self.val[i] = 0.0 - self.weight_val = 0.0 - -cdef OctreeNode *OTN_initialize(np.int64_t pos[3], int nvals, - np.float64_t *val, np.float64_t weight_val, - int level): - cdef OctreeNode *node - cdef int i, j - node = malloc(sizeof(OctreeNode)) - node.pos[0] = pos[0] - node.pos[1] = pos[1] - node.pos[2] = pos[2] - node.nvals = nvals - node.val = malloc( - nvals * sizeof(np.float64_t)) - for i in range(nvals): - node.val[i] = val[i] - node.weight_val = weight_val - for i in range(2): - for j in range(2): - for k in range(2): - node.children[i][j][k] = NULL - node.level = level - return node - -cdef void OTN_free(OctreeNode *node): - cdef int i, j - for i in range(2): - for j in range(2): - for k in range(2): - if node.children[i][j][k] == NULL: continue - OTN_free(node.children[i][j][k]) - free(node.val) - free(node) - -cdef class Octree: - cdef int nvals - cdef np.int64_t po2[80] - cdef OctreeNode ****root_nodes - cdef np.int64_t top_grid_dims[3] - - def __cinit__(self, np.ndarray[np.int64_t, ndim=1] top_grid_dims, - int nvals): - cdef int i, j - cdef OctreeNode *node - cdef np.int64_t pos[3] - cdef np.float64_t *vals = alloca( - sizeof(np.float64_t)*nvals) - cdef np.float64_t weight_val = 0.0 - self.nvals = nvals - for i in range(nvals): vals[i] = 0.0 - - self.top_grid_dims[0] = top_grid_dims[0] - self.top_grid_dims[1] = top_grid_dims[1] - self.top_grid_dims[2] = top_grid_dims[2] - - # This wouldn't be necessary if we did bitshifting... - for i in range(80): - self.po2[i] = 2**i - # Cython doesn't seem to like sizeof(OctreeNode ***) - self.root_nodes = \ - malloc(sizeof(void*) * top_grid_dims[0]) - - # We initialize our root values to 0.0. - for i in range(top_grid_dims[0]): - pos[0] = i - self.root_nodes[i] = \ - malloc(sizeof(OctreeNode **) * top_grid_dims[1]) - for j in range(top_grid_dims[1]): - pos[1] = j - self.root_nodes[i][j] = \ - malloc(sizeof(OctreeNode *) * top_grid_dims[1]) - for k in range(top_grid_dims[2]): - pos[2] = k - self.root_nodes[i][j][k] = OTN_initialize( - pos, nvals, vals, weight_val, 0) - - cdef void add_to_position(self, - int level, np.int64_t pos[3], - np.float64_t *val, - np.float64_t weight_val): - cdef int i, j - cdef OctreeNode *node - node = self.find_on_root_level(pos, level) - cdef np.int64_t fac - for L in range(level): - if node.children[0][0][0] == NULL: - OTN_refine(node) - # Maybe we should use bitwise operators? - fac = self.po2[level - L - 1] - i = (pos[0] >= fac*(2*node.pos[0]+1)) - j = (pos[1] >= fac*(2*node.pos[1]+1)) - k = (pos[2] >= fac*(2*node.pos[2]+1)) - node = node.children[i][j][k] - OTN_add_value(node, val, weight_val) - - cdef OctreeNode *find_on_root_level(self, np.int64_t pos[3], int level): - # We need this because the root level won't just have four children - # So we find on the root level, then we traverse the tree. - cdef np.int64_t i, j - i = (pos[0] / self.po2[level]) - j = (pos[1] / self.po2[level]) - k = (pos[2] / self.po2[level]) - return self.root_nodes[i][j][k] - - - @cython.boundscheck(False) - @cython.wraparound(False) - def add_array_to_tree(self, int level, - np.ndarray[np.int64_t, ndim=1] pxs, - np.ndarray[np.int64_t, ndim=1] pys, - np.ndarray[np.int64_t, ndim=1] pzs, - np.ndarray[np.float64_t, ndim=2] pvals, - np.ndarray[np.float64_t, ndim=1] pweight_vals): - cdef int np = pxs.shape[0] - cdef int p - cdef cnp.float64_t *vals - cdef cnp.float64_t *data = pvals.data - cdef cnp.int64_t pos[3] - for p in range(np): - vals = data + self.nvals*p - pos[0] = pxs[p] - pos[1] = pys[p] - pos[2] = pzs[p] - self.add_to_position(level, pos, vals, pweight_vals[p]) - - def add_grid_to_tree(self, int level, - np.ndarray[np.int64_t, ndim=1] start_index, - np.ndarray[np.float64_t, ndim=2] pvals, - np.ndarray[np.float64_t, ndim=2] wvals, - np.ndarray[np.int32_t, ndim=2] cm): - pass - - @cython.boundscheck(False) - @cython.wraparound(False) - def get_all_from_level(self, int level, int count_only = 0): - cdef int i, j - cdef int total = 0 - vals = [] - for i in range(self.top_grid_dims[0]): - for j in range(self.top_grid_dims[1]): - for k in range(self.top_grid_dims[2]): - total += self.count_at_level(self.root_nodes[i][j][k], level) - if count_only: return total - # Allocate our array - cdef np.ndarray[np.int64_t, ndim=2] npos - cdef np.ndarray[np.float64_t, ndim=2] nvals - cdef np.ndarray[np.float64_t, ndim=1] nwvals - npos = np.zeros( (total, 2), dtype='int64') - nvals = np.zeros( (total, self.nvals), dtype='float64') - nwvals = np.zeros( total, dtype='float64') - cdef np.int64_t curpos = 0 - cdef np.int64_t *pdata = npos.data - cdef np.float64_t *vdata = nvals.data - cdef np.float64_t *wdata = nwvals.data - for i in range(self.top_grid_dims[0]): - for j in range(self.top_grid_dims[1]): - for k in range(self.top_grid_dims[2]): - curpos += self.fill_from_level(self.root_nodes[i][j][k], - level, curpos, pdata, vdata, wdata) - return npos, nvals, nwvals - - cdef int count_at_level(self, OctreeNode *node, int level): - cdef int i, j - # We only really return a non-zero, calculated value if we are at the - # level in question. - if node.level == level: - # We return 1 if there are no finer points at this level and zero - # if there are - return (node.children[0][0][0] == NULL) - if node.children[0][0][0] == NULL: return 0 - cdef int count = 0 - for i in range(2): - for j in range(2): - for k in range(2): - count += self.count_at_level(node.children[i][j][k], level) - return count - - cdef int fill_from_level(self, OctreeNode *node, int level, - np.int64_t curpos, - np.int64_t *pdata, - np.float64_t *vdata, - np.float64_t *wdata): - cdef int i, j - if node.level == level: - if node.children[0][0][0] != NULL: return 0 - for i in range(self.nvals): - vdata[self.nvals * curpos + i] = node.val[i] - wdata[curpos] = node.weight_val - pdata[curpos * 3] = node.pos[0] - pdata[curpos * 3 + 1] = node.pos[1] - pdata[curpos * 3 + 2] = node.pos[2] - return 1 - if node.children[0][0] == NULL: return 0 - cdef np.int64_t added = 0 - for i in range(2): - for j in range(2): - for k in range(2): - added += self.fill_from_level(node.children[i][j][k], - level, curpos + added, pdata, vdata, wdata) - return added - - def __dealloc__(self): - cdef int i, j - for i in range(self.top_grid_dims[0]): - for j in range(self.top_grid_dims[1]): - for k in range(self.top_grid_dims[2]): - OTN_free(self.root_nodes[i][j][k]) - free(self.root_nodes[i][j]) - free(self.root_nodes[i]) - free(self.root_nodes) - diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/_amr_utils/PointsInVolume.pyx --- a/yt/_amr_utils/PointsInVolume.pyx Wed Aug 25 18:03:39 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,217 +0,0 @@ -""" -Checks for points contained in a volume - -Author: John Wise -Affiliation: Princeton -Homepage: http://yt.enzotools.org/ -License: - Copyright (C) 2009 John. All Rights Reserved. - - This file is part of yt. - - yt is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -""" - - -import numpy as np -cimport numpy as np -cimport cython - -cdef extern from "math.h": - double fabs(double x) - -@cython.wraparound(False) -@cython.boundscheck(False) -def planar_points_in_volume( - np.ndarray[np.float64_t, ndim=2] points, - np.ndarray[np.int8_t, ndim=1] pmask, # pixel mask - np.ndarray[np.float64_t, ndim=1] left_edge, - np.ndarray[np.float64_t, ndim=1] right_edge, - np.ndarray[np.int32_t, ndim=3] mask, - float dx): - cdef np.ndarray[np.int8_t, ndim=1] \ - valid = np.zeros(points.shape[0], dtype='int8') - cdef int i, dim, count - cdef int ex - cdef double dx_inv - cdef unsigned int idx[3] - count = 0 - dx_inv = 1.0 / dx - for i in xrange(points.shape[0]): - if pmask[i] == 0: - continue - ex = 1 - for dim in xrange(3): - if points[i,dim] < left_edge[dim] or points[i,dim] > right_edge[dim]: - valid[i] = ex = 0 - break - if ex == 1: - for dim in xrange(3): - idx[dim] = \ - ((points[i,dim] - left_edge[dim]) * dx_inv) - if mask[idx[0], idx[1], idx[2]] == 1: - valid[i] = 1 - count += 1 - - cdef np.ndarray[np.int32_t, ndim=1] result = np.empty(count, dtype='int32') - count = 0 - for i in xrange(points.shape[0]): - if valid[i] == 1 and pmask[i] == 1: - result[count] = i - count += 1 - - return result - -cdef inline void set_rotated_pos( - np.float64_t cp[3], np.float64_t rdds[3][3], - np.float64_t rorigin[3], int i, int j, int k): - cdef int oi - for oi in range(3): - cp[oi] = rdds[0][oi] * (0.5 + i) \ - + rdds[1][oi] * (0.5 + j) \ - + rdds[2][oi] * (0.5 + k) \ - + rorigin[oi] - -#@cython.wraparound(False) -#@cython.boundscheck(False) -def grid_points_in_volume( - np.ndarray[np.float64_t, ndim=1] box_lengths, - np.ndarray[np.float64_t, ndim=1] box_origin, - np.ndarray[np.float64_t, ndim=2] rot_mat, - np.ndarray[np.float64_t, ndim=1] grid_left_edge, - np.ndarray[np.float64_t, ndim=1] grid_right_edge, - np.ndarray[np.float64_t, ndim=1] dds, - np.ndarray[np.int32_t, ndim=3] mask, - int break_first): - cdef int n[3], i, j, k, ax - cdef np.float64_t rds[3][3], cur_pos[3], rorigin[3] - for i in range(3): - rorigin[i] = 0.0 - for i in range(3): - n[i] = mask.shape[i] - for j in range(3): - # Set up our transposed dx, which has a component in every - # direction - rds[i][j] = dds[i] * rot_mat[j,i] - # In our rotated coordinate system, the box origin is 0,0,0 - # so we subtract the box_origin from the grid_origin and rotate - # that - rorigin[j] += (grid_left_edge[i] - box_origin[i]) * rot_mat[j,i] - - for i in range(n[0]): - for j in range(n[1]): - for k in range(n[2]): - set_rotated_pos(cur_pos, rds, rorigin, i, j, k) - if (cur_pos[0] > box_lengths[0]): continue - if (cur_pos[1] > box_lengths[1]): continue - if (cur_pos[2] > box_lengths[2]): continue - if (cur_pos[0] < 0.0): continue - if (cur_pos[1] < 0.0): continue - if (cur_pos[2] < 0.0): continue - if break_first: - if mask[i,j,k]: return 1 - else: - mask[i,j,k] = 1 - return 0 - -cdef void normalize_vector(np.float64_t vec[3]): - cdef int i - cdef np.float64_t norm = 0.0 - for i in range(3): - norm += vec[i]*vec[i] - norm = norm**0.5 - for i in range(3): - vec[i] /= norm - -cdef void get_cross_product(np.float64_t v1[3], - np.float64_t v2[3], - np.float64_t cp[3]): - cp[0] = v1[1]*v2[2] - v1[2]*v2[1] - cp[1] = v1[3]*v2[0] - v1[0]*v2[3] - cp[2] = v1[0]*v2[1] - v1[1]*v2[0] - #print cp[0], cp[1], cp[2] - -cdef int check_projected_overlap( - np.float64_t sep_ax[3], np.float64_t sep_vec[3], int gi, - np.float64_t b_vec[3][3], np.float64_t g_vec[3][3]): - cdef int g_ax, b_ax - cdef np.float64_t tba, tga, ba, ga, sep_dot - ba = ga = sep_dot = 0.0 - for g_ax in range(3): - # We need the grid vectors, which we'll precompute here - tba = tga = 0.0 - for b_ax in range(3): - tba += b_vec[g_ax][b_ax] * sep_vec[b_ax] - tga += g_vec[g_ax][b_ax] * sep_vec[b_ax] - ba += fabs(tba) - ga += fabs(tga) - sep_dot += sep_vec[g_ax] * sep_ax[g_ax] - #print sep_vec[0], sep_vec[1], sep_vec[2], - #print sep_ax[0], sep_ax[1], sep_ax[2] - return (fabs(sep_dot) > ba+ga) - # Now we do - -@cython.wraparound(False) -@cython.boundscheck(False) -def find_grids_in_inclined_box( - np.ndarray[np.float64_t, ndim=2] box_vectors, - np.ndarray[np.float64_t, ndim=1] box_center, - np.ndarray[np.float64_t, ndim=2] grid_left_edges, - np.ndarray[np.float64_t, ndim=2] grid_right_edges): - - # http://www.gamasutra.com/view/feature/3383/simple_intersection_tests_for_games.php?page=5 - cdef int n = grid_right_edges.shape[0] - cdef int g_ax, b_ax, gi - cdef np.float64_t b_vec[3][3], g_vec[3][3], a_vec[3][3], sep_ax[15][3] - cdef np.float64_t sep_vec[3], norm - cdef np.ndarray[np.int32_t, ndim=1] good = np.zeros(n, dtype='int32') - cdef np.ndarray[np.float64_t, ndim=2] grid_centers - # Fill in our axis unit vectors - for b_ax in range(3): - for g_ax in range(3): - a_vec[b_ax][g_ax] = (b_ax == g_ax) - grid_centers = (grid_right_edges + grid_left_edges)/2.0 - - # Now we pre-compute our candidate separating axes, because the unit - # vectors for all the grids are identical - for b_ax in range(3): - # We have 6 principal axes we already know, which are the grid (domain) - # principal axes and the box axes - sep_ax[b_ax][0] = sep_ax[b_ax][1] = sep_ax[b_ax][2] = 0.0 - sep_ax[b_ax][b_ax] = 1.0 # delta_ijk, for grid axes - for g_ax in range(3): - b_vec[b_ax][g_ax] = 0.5*box_vectors[b_ax,g_ax] - sep_ax[b_ax + 3][g_ax] = b_vec[b_ax][g_ax] # box axes - normalize_vector(sep_ax[b_ax + 3]) - for g_ax in range(3): - get_cross_product(b_vec[b_ax], a_vec[g_ax], sep_ax[b_ax*3 + g_ax + 6]) - normalize_vector(sep_ax[b_ax*3 + g_ax + 6]) - - for gi in range(n): - for g_ax in range(3): - # Calculate the separation vector - sep_vec[g_ax] = grid_centers[gi, g_ax] - box_center[g_ax] - # Calculate the grid axis lengths - g_vec[g_ax][0] = g_vec[g_ax][1] = g_vec[g_ax][2] = 0.0 - g_vec[g_ax][g_ax] = 0.5 * (grid_right_edges[gi, g_ax] - - grid_left_edges[gi, g_ax]) - for b_ax in range(15): - #print b_ax, - if check_projected_overlap( - sep_ax[b_ax], sep_vec, gi, - b_vec, g_vec): - good[gi] = 1 - break - return good - diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/_amr_utils/QuadTree.pyx --- a/yt/_amr_utils/QuadTree.pyx Wed Aug 25 18:03:39 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,257 +0,0 @@ -""" -A refine-by-two AMR-specific quadtree - -Author: Matthew Turk -Affiliation: UCSD -Homepage: http://yt.enzotools.org/ -License: - Copyright (C) 2010 Matthew Turk. All Rights Reserved. - - This file is part of yt. - - yt is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -""" - - -import numpy as np -cimport numpy as np -# Double up here for def'd functions -cimport numpy as cnp -cimport cython - -from stdlib cimport malloc, free, abs - -cdef extern from "stdlib.h": - # NOTE that size_t might not be int - void *alloca(int) - -cdef struct QuadTreeNode: - np.float64_t *val - np.float64_t weight_val - np.int64_t pos[2] - int level - int nvals - QuadTreeNode *children[2][2] - -cdef void QTN_add_value(QuadTreeNode *self, - np.float64_t *val, np.float64_t weight_val): - cdef int i - for i in range(self.nvals): - self.val[i] += val[i] - self.weight_val += weight_val - -cdef void QTN_refine(QuadTreeNode *self): - cdef int i, j, i1, j1 - cdef np.int64_t npos[2] - cdef QuadTreeNode *node - for i in range(2): - npos[0] = self.pos[0] * 2 + i - for j in range(2): - npos[1] = self.pos[1] * 2 + j - # We have to be careful with allocation... - self.children[i][j] = QTN_initialize( - npos, - self.nvals, self.val, self.weight_val, - self.level + 1) - for i in range(self.nvals): self.val[i] = 0.0 - self.weight_val = 0.0 - -cdef QuadTreeNode *QTN_initialize(np.int64_t pos[2], int nvals, - np.float64_t *val, np.float64_t weight_val, - int level): - cdef QuadTreeNode *node - cdef int i, j - node = malloc(sizeof(QuadTreeNode)) - node.pos[0] = pos[0] - node.pos[1] = pos[1] - node.nvals = nvals - node.val = malloc( - nvals * sizeof(np.float64_t)) - for i in range(nvals): - node.val[i] = val[i] - node.weight_val = weight_val - for i in range(2): - for j in range(2): - node.children[i][j] = NULL - node.level = level - return node - -cdef void QTN_free(QuadTreeNode *node): - cdef int i, j - for i in range(2): - for j in range(2): - if node.children[i][j] == NULL: continue - QTN_free(node.children[i][j]) - free(node.val) - free(node) - -cdef class QuadTree: - cdef int nvals - cdef np.int64_t po2[80] - cdef QuadTreeNode ***root_nodes - cdef np.int64_t top_grid_dims[2] - - def __cinit__(self, np.ndarray[np.int64_t, ndim=1] top_grid_dims, - int nvals): - cdef int i, j - cdef QuadTreeNode *node - cdef np.int64_t pos[2] - cdef np.float64_t *vals = alloca( - sizeof(np.float64_t)*nvals) - cdef np.float64_t weight_val = 0.0 - self.nvals = nvals - for i in range(nvals): vals[i] = 0.0 - - self.top_grid_dims[0] = top_grid_dims[0] - self.top_grid_dims[1] = top_grid_dims[1] - - # This wouldn't be necessary if we did bitshifting... - for i in range(80): - self.po2[i] = 2**i - self.root_nodes = \ - malloc(sizeof(QuadTreeNode **) * top_grid_dims[0]) - - # We initialize our root values to 0.0. - for i in range(top_grid_dims[0]): - pos[0] = i - self.root_nodes[i] = \ - malloc(sizeof(QuadTreeNode *) * top_grid_dims[1]) - for j in range(top_grid_dims[1]): - pos[1] = j - self.root_nodes[i][j] = QTN_initialize( - pos, nvals, vals, weight_val, 0) - - cdef void add_to_position(self, - int level, np.int64_t pos[2], - np.float64_t *val, - np.float64_t weight_val): - cdef int i, j - cdef QuadTreeNode *node - node = self.find_on_root_level(pos, level) - cdef np.int64_t fac - for L in range(level): - if node.children[0][0] == NULL: - QTN_refine(node) - # Maybe we should use bitwise operators? - fac = self.po2[level - L - 1] - i = (pos[0] >= fac*(2*node.pos[0]+1)) - j = (pos[1] >= fac*(2*node.pos[1]+1)) - node = node.children[i][j] - QTN_add_value(node, val, weight_val) - - cdef QuadTreeNode *find_on_root_level(self, np.int64_t pos[2], int level): - # We need this because the root level won't just have four children - # So we find on the root level, then we traverse the tree. - cdef np.int64_t i, j - i = (pos[0] / self.po2[level]) - j = (pos[1] / self.po2[level]) - return self.root_nodes[i][j] - - - @cython.boundscheck(False) - @cython.wraparound(False) - def add_array_to_tree(self, int level, - np.ndarray[np.int64_t, ndim=1] pxs, - np.ndarray[np.int64_t, ndim=1] pys, - np.ndarray[np.float64_t, ndim=2] pvals, - np.ndarray[np.float64_t, ndim=1] pweight_vals): - cdef int np = pxs.shape[0] - cdef int p - cdef cnp.float64_t *vals - cdef cnp.float64_t *data = pvals.data - cdef cnp.int64_t pos[2] - for p in range(np): - vals = data + self.nvals*p - pos[0] = pxs[p] - pos[1] = pys[p] - self.add_to_position(level, pos, vals, pweight_vals[p]) - - def add_grid_to_tree(self, int level, - np.ndarray[np.int64_t, ndim=1] start_index, - np.ndarray[np.float64_t, ndim=2] pvals, - np.ndarray[np.float64_t, ndim=2] wvals, - np.ndarray[np.int32_t, ndim=2] cm): - pass - - @cython.boundscheck(False) - @cython.wraparound(False) - def get_all_from_level(self, int level, int count_only = 0): - cdef int i, j - cdef int total = 0 - vals = [] - for i in range(self.top_grid_dims[0]): - for j in range(self.top_grid_dims[1]): - total += self.count_at_level(self.root_nodes[i][j], level) - if count_only: return total - # Allocate our array - cdef np.ndarray[np.int64_t, ndim=2] npos - cdef np.ndarray[np.float64_t, ndim=2] nvals - cdef np.ndarray[np.float64_t, ndim=1] nwvals - npos = np.zeros( (total, 2), dtype='int64') - nvals = np.zeros( (total, self.nvals), dtype='float64') - nwvals = np.zeros( total, dtype='float64') - cdef np.int64_t curpos = 0 - cdef np.int64_t *pdata = npos.data - cdef np.float64_t *vdata = nvals.data - cdef np.float64_t *wdata = nwvals.data - for i in range(self.top_grid_dims[0]): - for j in range(self.top_grid_dims[1]): - curpos += self.fill_from_level(self.root_nodes[i][j], - level, curpos, pdata, vdata, wdata) - return npos, nvals, nwvals - - cdef int count_at_level(self, QuadTreeNode *node, int level): - cdef int i, j - # We only really return a non-zero, calculated value if we are at the - # level in question. - if node.level == level: - # We return 1 if there are no finer points at this level and zero - # if there are - return (node.children[0][0] == NULL) - if node.children[0][0] == NULL: return 0 - cdef int count = 0 - for i in range(2): - for j in range(2): - count += self.count_at_level(node.children[i][j], level) - return count - - cdef int fill_from_level(self, QuadTreeNode *node, int level, - np.int64_t curpos, - np.int64_t *pdata, - np.float64_t *vdata, - np.float64_t *wdata): - cdef int i, j - if node.level == level: - if node.children[0][0] != NULL: return 0 - for i in range(self.nvals): - vdata[self.nvals * curpos + i] = node.val[i] - wdata[curpos] = node.weight_val - pdata[curpos * 2] = node.pos[0] - pdata[curpos * 2 + 1] = node.pos[1] - return 1 - if node.children[0][0] == NULL: return 0 - cdef np.int64_t added = 0 - for i in range(2): - for j in range(2): - added += self.fill_from_level(node.children[i][j], - level, curpos + added, pdata, vdata, wdata) - return added - - def __dealloc__(self): - cdef int i, j - for i in range(self.top_grid_dims[0]): - for j in range(self.top_grid_dims[1]): - QTN_free(self.root_nodes[i][j]) - free(self.root_nodes[i]) - free(self.root_nodes) diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/_amr_utils/RayIntegrators.pyx --- a/yt/_amr_utils/RayIntegrators.pyx Wed Aug 25 18:03:39 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,374 +0,0 @@ -""" -Simle integrators for the radiative transfer equation - -Author: Matthew Turk -Affiliation: KIPAC/SLAC/Stanford -Homepage: http://yt.enzotools.org/ -License: - Copyright (C) 2008 Matthew Turk. All Rights Reserved. - - This file is part of yt. - - yt is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -""" - -import numpy as np -cimport numpy as np -cimport cython -from stdlib cimport malloc, free, abs - -cdef extern from "math.h": - double exp(double x) - float expf(float x) - -@cython.boundscheck(False) -def Transfer3D(np.ndarray[np.float64_t, ndim=3] i_s, - np.ndarray[np.float64_t, ndim=4] o_s, - np.ndarray[np.float64_t, ndim=4] e, - np.ndarray[np.float64_t, ndim=4] a, - int imin, int imax, int jmin, int jmax, - int kmin, int kmax, int istride, int jstride, - np.float64_t dx): - """ - This function accepts an incoming slab (*i_s*), a buffer - for an outgoing set of values at every point in the grid (*o_s*), - an emission array (*e*), an absorption array (*a*), and dimensions of - the grid (*imin*, *imax*, *jmin*, *jmax*, *kmin*, *kmax*) as well - as strides in the *i* and *j* directions, and a *dx* of the grid being - integrated. - """ - cdef int i, ii - cdef int j, jj - cdef int k, kk - cdef int n, nn - nn = o_s.shape[3] # This might be slow - cdef np.float64_t *temp = malloc(sizeof(np.float64_t) * nn) - for i in range((imax-imin)*istride): - ii = i + imin*istride - for j in range((jmax-jmin)*jstride): - jj = j + jmin*jstride - # Not sure about the ordering of the loops here - for n in range(nn): - temp[n] = i_s[ii,jj,n] - for k in range(kmax-kmin): - kk = k + kmin#*kstride, which doesn't make any sense - for n in range(nn): - o_s[i,j,k,n] = temp[n] + dx*(e[i,j,k,n] - temp[n]*a[i,j,k,n]) - temp[n] = o_s[i,j,k,n] - for n in range(nn): - i_s[ii,jj,n] = temp[n] - free(temp) - -@cython.boundscheck(False) -def TransferShells(np.ndarray[np.float64_t, ndim=3] i_s, - np.ndarray[np.float64_t, ndim=3] data, - np.ndarray[np.float64_t, ndim=2] shells): - """ - This function accepts an incoming slab (*i_s*), a buffer of *data*, - and a list of shells specified as [ (value, tolerance, r, g, b), ... ]. - """ - cdef int i, ii - cdef int j, jj - cdef int k, kk - cdef int n, nn - cdef np.float64_t dist - ii = data.shape[0] - jj = data.shape[1] - kk = data.shape[2] - nn = shells.shape[0] - cdef float rgba[4] - cdef float alpha - for i in range(ii): - for j in range(jj): - # Not sure about the ordering of the loops here - for k in range(kk): - for n in range(nn): - dist = shells[n, 0] - data[i,j,k] - if dist < 0: dist *= -1.0 - if dist < shells[n,1]: - dist = exp(-dist/8.0) - rgba[0] = shells[n,2] - rgba[1] = shells[n,3] - rgba[2] = shells[n,4] - rgba[3] = shells[n,5] - alpha = i_s[i,j,3] - dist *= dist # This might improve appearance - i_s[i,j,0] += (1.0 - alpha)*rgba[0]*dist*rgba[3] - i_s[i,j,1] += (1.0 - alpha)*rgba[1]*dist*rgba[3] - i_s[i,j,2] += (1.0 - alpha)*rgba[2]*dist*rgba[3] - i_s[i,j,3] += (1.0 - alpha)*rgba[3]*dist*rgba[3] - break - -@cython.boundscheck(False) -def Transfer1D(float i_s, - np.ndarray[np.float_t, ndim=1] o_s, - np.ndarray[np.float_t, ndim=1] e, - np.ndarray[np.float_t, ndim=1] a, - np.ndarray[np.float_t, ndim=1] dx, - int imin, int imax): - cdef int i - for i in range(imin, imax): - o_s[i] = i_s + dx[i]*(e[i] - i_s*a[i]) - i_s = o_s[i] - return i_s - -@cython.wraparound(False) -@cython.boundscheck(False) -def VoxelTraversal(np.ndarray[np.int_t, ndim=3] grid_mask, - np.ndarray[np.float64_t, ndim=3] grid_t, - np.ndarray[np.float64_t, ndim=3] grid_dt, - np.ndarray[np.float64_t, ndim=1] left_edge, - np.ndarray[np.float64_t, ndim=1] right_edge, - np.ndarray[np.float64_t, ndim=1] dx, - np.ndarray[np.float64_t, ndim=1] u, - np.ndarray[np.float64_t, ndim=1] v): - # We're roughly following Amanatides & Woo - # Find the first place the ray hits the grid on its path - # Do left edge then right edge in each dim - cdef int i, x, y - cdef np.float64_t tl, tr, intersect_t, enter_t, exit_t, dt_tolerance - cdef np.ndarray[np.int64_t, ndim=1] step = np.empty((3,), dtype=np.int64) - cdef np.ndarray[np.int64_t, ndim=1] cur_ind = np.empty((3,), dtype=np.int64) - cdef np.ndarray[np.float64_t, ndim=1] tdelta = np.empty((3,), dtype=np.float64) - cdef np.ndarray[np.float64_t, ndim=1] tmax = np.empty((3,), dtype=np.float64) - cdef np.ndarray[np.float64_t, ndim=1] intersect = np.empty((3,), dtype=np.float64) - intersect_t = 1 - dt_tolerance = 1e-6 - # recall p = v * t + u - # where p is position, v is our vector, u is the start point - for i in range(3): - # As long as we're iterating, set some other stuff, too - if(v[i] < 0): step[i] = -1 - else: step[i] = 1 - x = (i+1)%3 - y = (i+2)%3 - tl = (left_edge[i] - u[i])/v[i] - tr = (right_edge[i] - u[i])/v[i] - if (left_edge[x] <= (u[x] + tl*v[x]) <= right_edge[x]) and \ - (left_edge[y] <= (u[y] + tl*v[y]) <= right_edge[y]) and \ - (0.0 <= tl < intersect_t): - intersect_t = tl - if (left_edge[x] <= (u[x] + tr*v[x]) <= right_edge[x]) and \ - (left_edge[y] <= (u[y] + tr*v[y]) <= right_edge[y]) and \ - (0.0 <= tr < intersect_t): - intersect_t = tr - # if fully enclosed - if (left_edge[0] <= u[0] <= right_edge[0]) and \ - (left_edge[1] <= u[1] <= right_edge[1]) and \ - (left_edge[2] <= u[2] <= right_edge[2]): - intersect_t = 0.0 - if not (0 <= intersect_t <= 1): return - # Now get the indices of the intersection - intersect = u + intersect_t * v - for i in range(3): - cur_ind[i] = np.floor((intersect[i] + 1e-8*dx[i] - left_edge[i])/dx[i]) - tmax[i] = (((cur_ind[i]+step[i])*dx[i])+left_edge[i]-u[i])/v[i] - if cur_ind[i] == grid_mask.shape[i] and step[i] < 0: - cur_ind[i] = grid_mask.shape[i] - 1 - if step[i] > 0: tmax[i] = (((cur_ind[i]+1)*dx[i])+left_edge[i]-u[i])/v[i] - if step[i] < 0: tmax[i] = (((cur_ind[i]+0)*dx[i])+left_edge[i]-u[i])/v[i] - tdelta[i] = (dx[i]/v[i]) - if tdelta[i] < 0: tdelta[i] *= -1 - # The variable intersect contains the point we first pierce the grid - enter_t = intersect_t - while 1: - if (not (0 <= cur_ind[0] < grid_mask.shape[0])) or \ - (not (0 <= cur_ind[1] < grid_mask.shape[1])) or \ - (not (0 <= cur_ind[2] < grid_mask.shape[2])): - break - # Note that we are calculating t on the fly, but we get *negative* t - # values from what they should be. - # If we've reached t = 1, we are done. - grid_mask[cur_ind[0], cur_ind[1], cur_ind[2]] = 1 - if (tmax[0] > 1.0) and (tmax[1] > 1.0) and (tmax[2] > 1.0): - grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = 1.0 - enter_t - break - if tmax[0] < tmax[1]: - if tmax[0] < tmax[2]: - grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t - grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[0] - enter_t - enter_t = tmax[0] - tmax[0] += tdelta[0] - cur_ind[0] += step[0] - else: - grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t - grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[2] - enter_t - enter_t = tmax[2] - tmax[2] += tdelta[2] - cur_ind[2] += step[2] - else: - if tmax[1] < tmax[2]: - grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t - grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[1] - enter_t - enter_t = tmax[1] - tmax[1] += tdelta[1] - cur_ind[1] += step[1] - else: - grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t - grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[2] - enter_t - enter_t = tmax[2] - tmax[2] += tdelta[2] - cur_ind[2] += step[2] - return - -@cython.wraparound(False) -@cython.boundscheck(False) -def PlaneVoxelIntegration(np.ndarray[np.float64_t, ndim=1] left_edge, - np.ndarray[np.float64_t, ndim=1] right_edge, - np.ndarray[np.float64_t, ndim=1] dx, - np.ndarray[np.float64_t, ndim=2] ug, - np.ndarray[np.float64_t, ndim=1] v, - np.ndarray[np.float64_t, ndim=2] image, - np.ndarray[np.float64_t, ndim=3] data, - np.ndarray[np.float64_t, ndim=2] shells): - # We're roughly following Amanatides & Woo on a ray-by-ray basis - # Note that for now it's just shells, but this can and should be - # generalized to transfer functions - cdef int i, x, y, vi - intersect_t = 1 - dt_tolerance = 1e-6 - cdef int nv = ug.shape[0] - cdef int nshells = shells.shape[0] - cdef np.ndarray[np.float64_t, ndim=1] u = np.empty((3,), dtype=np.float64) - # Copy things into temporary location for passing between functions - for vi in range(nv): - for i in range(3): u[i] = ug[vi, i] - integrate_ray(u, v, left_edge, right_edge, dx, - nshells, vi, data, shells, image) - -@cython.wraparound(False) -@cython.boundscheck(False) -def integrate_ray(np.ndarray[np.float64_t, ndim=1] u, - np.ndarray[np.float64_t, ndim=1] v, - np.ndarray[np.float64_t, ndim=1] left_edge, - np.ndarray[np.float64_t, ndim=1] right_edge, - np.ndarray[np.float64_t, ndim=1] dx, - int nshells, int ind, - np.ndarray[np.float64_t, ndim=3] data, - np.ndarray[np.float64_t, ndim=2] shells, - np.ndarray[np.float64_t, ndim=2] image): - cdef int step[3], x, y, i, n - cdef np.float64_t intersect_t = 1 - cdef np.float64_t dt_tolerance = 1e-6 - cdef np.float64_t tl, tr, enter_t, exit_t - cdef np.int64_t cur_ind[3] - cdef np.float64_t tdelta[3] - cdef np.float64_t tmax[3] - cdef np.float64_t intersect[3] - cdef np.float64_t dt, dv - cdef np.float64_t dist, alpha - cdef np.float64_t one = 1.0 - cdef int dims[3] - cdef np.float64_t rgba[4], temp_x, temp_y - for i in range(3): - # As long as we're iterating, set some other stuff, too - dims[i] = data.shape[i] - if(v[i] < 0): step[i] = -1 - else: step[i] = 1 - x = (i+1)%3 - y = (i+2)%3 - tl = (left_edge[i] - u[i])/v[i] - tr = (right_edge[i] - u[i])/v[i] - temp_x = (u[x] + tl*v[x]) - temp_y = (u[y] + tl*v[y]) - if (left_edge[x] <= temp_x) and (temp_x <= right_edge[x]) and \ - (left_edge[y] <= temp_y) and (temp_y <= right_edge[y]) and \ - (0.0 <= tl) and (tl < intersect_t): - intersect_t = tl - temp_x = (u[x] + tr*v[x]) - temp_y = (u[y] + tr*v[y]) - if (left_edge[x] <= temp_x) and (temp_x <= right_edge[x]) and \ - (left_edge[y] <= temp_y) and (temp_y <= right_edge[y]) and \ - (0.0 <= tr) and (tr < intersect_t): - intersect_t = tr - # if fully enclosed - if (left_edge[0] <= u[0] <= right_edge[0]) and \ - (left_edge[1] <= u[1] <= right_edge[1]) and \ - (left_edge[2] <= u[2] <= right_edge[2]): - intersect_t = 0.0 - if not (0 <= intersect_t <= 1): - #print "Returning: intersect_t ==", intersect_t - return - # Now get the indices of the intersection - for i in range(3): intersect[i] = u[i] + intersect_t * v[i] - cdef int ncells = 0 - for i in range(3): - cur_ind[i] = np.floor((intersect[i] + 1e-8*dx[i] - left_edge[i])/dx[i]) - tmax[i] = (((cur_ind[i]+step[i])*dx[i])+left_edge[i]-u[i])/v[i] - if cur_ind[i] == dims[i] and step[i] < 0: - cur_ind[i] = dims[i] - 1 - if step[i] > 0: tmax[i] = (((cur_ind[i]+1)*dx[i])+left_edge[i]-u[i])/v[i] - if step[i] < 0: tmax[i] = (((cur_ind[i]+0)*dx[i])+left_edge[i]-u[i])/v[i] - tdelta[i] = (dx[i]/v[i]) - if tdelta[i] < 0: tdelta[i] *= -1 - # The variable intersect contains the point we first pierce the grid - enter_t = intersect_t - if (not (0 <= cur_ind[0] < dims[0])) or \ - (not (0 <= cur_ind[1] < dims[1])) or \ - (not (0 <= cur_ind[2] < dims[2])): - #print "Returning: cur_ind", cur_ind[0], cur_ind[1], cur_ind[2] - #print " dims: ", dims[0], dims[1], dims[2] - #print " intersect:", intersect[0], intersect[1], intersect[2] - #print " intersect:", intersect_t - #print " u :", u[0], u[1], u[2] - # - return - #print cur_ind[0], dims[0], cur_ind[1], dims[1], cur_ind[2], dims[2] - dv = data[cur_ind[0], cur_ind[1], cur_ind[2]] - #dt = 1e300 - while 1: - if image[ind,3] >= 1.0: break - if (not (0 <= cur_ind[0] < dims[0])) or \ - (not (0 <= cur_ind[1] < dims[1])) or \ - (not (0 <= cur_ind[2] < dims[2])): - break - # Do our transfer here - for n in range(nshells): - dist = shells[n, 0] - dv - if dist < shells[n,1]: - dist = exp(-dist/8.0) - alpha = (1.0 - shells[n,5])*shells[n,5]#*dt - image[ind,0] += alpha*shells[n,2]*dist - image[ind,1] += alpha*shells[n,3]*dist - image[ind,2] += alpha*shells[n,4]*dist - image[ind,3] += alpha*shells[n,5]*dist - #image[ind,i] += rgba[i]*dist*rgba[3]/dt - #print rgba[i], image[ind,i], dist, dt - break - if (tmax[0] > 1.0) and (tmax[1] > 1.0) and (tmax[2] > 1.0): - dt = 1.0 - enter_t - break - if tmax[0] < tmax[1]: - if tmax[0] < tmax[2]: - dt = tmax[0] - enter_t - enter_t = tmax[0] - tmax[0] += tdelta[0] - cur_ind[0] += step[0] - else: - dt = tmax[2] - enter_t - enter_t = tmax[2] - tmax[2] += tdelta[2] - cur_ind[2] += step[2] - else: - if tmax[1] < tmax[2]: - dt = tmax[1] - enter_t - enter_t = tmax[1] - tmax[1] += tdelta[1] - cur_ind[1] += step[1] - else: - dt = tmax[2] - enter_t - enter_t = tmax[2] - tmax[2] += tdelta[2] - cur_ind[2] += step[2] - dv = data[cur_ind[0], cur_ind[1], cur_ind[2]] diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/_amr_utils/VolumeIntegrator.pyx --- a/yt/_amr_utils/VolumeIntegrator.pyx Wed Aug 25 18:03:39 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,656 +0,0 @@ -""" -Simple integrators for the radiative transfer equation - -Author: Matthew Turk -Affiliation: KIPAC/SLAC/Stanford -Homepage: http://yt.enzotools.org/ -License: - Copyright (C) 2009 Matthew Turk. All Rights Reserved. - - This file is part of yt. - - yt is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -""" - -import numpy as np -cimport numpy as np -cimport cython -from stdlib cimport malloc, free, abs - -cdef inline int imax(int i0, int i1): - if i0 > i1: return i0 - return i1 - -cdef inline np.float64_t fmax(np.float64_t f0, np.float64_t f1): - if f0 > f1: return f0 - return f1 - -cdef inline int imin(int i0, int i1): - if i0 < i1: return i0 - return i1 - -cdef inline np.float64_t fmin(np.float64_t f0, np.float64_t f1): - if f0 < f1: return f0 - return f1 - -cdef inline int iclip(int i, int a, int b): - if i < a: return a - if i > b: return b - return i - -cdef inline np.float64_t fclip(np.float64_t f, - np.float64_t a, np.float64_t b): - return fmin(fmax(f, a), b) - -cdef extern from "math.h": - double exp(double x) - float expf(float x) - double floor(double x) - double ceil(double x) - double fmod(double x, double y) - double log2(double x) - long int lrint(double x) - -cdef extern from "FixedInterpolator.h": - np.float64_t fast_interpolate(int ds[3], int ci[3], np.float64_t dp[3], - np.float64_t *data) - np.float64_t offset_interpolate(int ds[3], np.float64_t dp[3], np.float64_t *data) - np.float64_t trilinear_interpolate(int ds[3], int ci[3], np.float64_t dp[3], - np.float64_t *data) - np.float64_t eval_gradient(int *ds, int *ci, np.float64_t *dp, - np.float64_t *data, np.float64_t *grad) - -cdef class VectorPlane - -cdef struct FieldInterpolationTable: - # Note that we make an assumption about retaining a reference to values - # externally. - np.float64_t *values - np.float64_t bounds[2] - np.float64_t dbin - np.float64_t idbin - int field_id - int weight_field_id - int weight_table_id - int nbins - int pass_through - -cdef void FIT_initialize_table(FieldInterpolationTable *fit, int nbins, - np.float64_t *values, np.float64_t bounds1, np.float64_t bounds2, - int field_id, int weight_field_id = -1, int weight_table_id = -1, - int pass_through = 0): - fit.bounds[0] = bounds1; fit.bounds[1] = bounds2 - fit.nbins = nbins - fit.dbin = (fit.bounds[1] - fit.bounds[0])/fit.nbins - fit.idbin = 1.0/fit.dbin - # Better not pull this out from under us, yo - fit.values = values - fit.field_id = field_id - fit.weight_field_id = weight_field_id - fit.weight_table_id = weight_table_id - fit.pass_through = pass_through - -cdef np.float64_t FIT_get_value(FieldInterpolationTable *fit, - np.float64_t *dvs): - cdef np.float64_t bv, dy, dd, tf - cdef int bin_id - if fit.pass_through == 1: return dvs[fit.field_id] - if dvs[fit.field_id] > fit.bounds[1] or dvs[fit.field_id] < fit.bounds[0]: return 0.0 - bin_id = ((dvs[fit.field_id] - fit.bounds[0]) * fit.idbin) - dd = dvs[fit.field_id] - (fit.bounds[0] + bin_id * fit.dbin) # x - x0 - bv = fit.values[bin_id] - dy = fit.values[bin_id + 1] - bv - if fit.weight_field_id != -1: - return dvs[fit.weight_field_id] * (bv + dd*dy*fit.idbin) - return (bv + dd*dy*fit.idbin) - -cdef class TransferFunctionProxy: - cdef int n_fields - cdef int n_field_tables - cdef public int ns - - # These are the field tables and their affiliated storage. - # We have one field_id for every table. Note that a single field can - # correspond to multiple tables, and each field table will only have - # interpolate called once. - cdef FieldInterpolationTable field_tables[6] - cdef np.float64_t istorage[6] - - # Here are the field tables that correspond to each of the six channels. - # We have three emission channels, three absorption channels. - cdef int field_table_ids[6] - - # We store a reference to the transfer function object and to the field - # interpolation tables - cdef public object tf_obj - cdef public object my_field_tables - - def __cinit__(self, tf_obj): - # We have N fields. We have 6 channels. We have M field tables. - # The idea is that we can have multiple channels corresponding to the - # same field table. So, we create storage for the outputs from all the - # field tables. We need to know which field value to pass in to the - # field table, and we need to know which table to use for each of the - # six channels. - cdef int i - cdef np.ndarray[np.float64_t, ndim=1] temp - cdef FieldInterpolationTable fit - - self.tf_obj = tf_obj - - self.n_field_tables = tf_obj.n_field_tables - for i in range(6): self.istorage[i] = 0.0 - - self.my_field_tables = [] - for i in range(self.n_field_tables): - temp = tf_obj.tables[i].y - FIT_initialize_table(&self.field_tables[i], - temp.shape[0], - temp.data, - tf_obj.tables[i].x_bounds[0], - tf_obj.tables[i].x_bounds[1], - tf_obj.field_ids[i], tf_obj.weight_field_ids[i], - tf_obj.weight_table_ids[i], - tf_obj.tables[i].pass_through) - self.my_field_tables.append((tf_obj.tables[i], - tf_obj.tables[i].y)) - self.field_tables[i].field_id = tf_obj.field_ids[i] - self.field_tables[i].weight_field_id = tf_obj.weight_field_ids[i] - print "Field table", i, "corresponds to", - print self.field_tables[i].field_id, - print "(Weighted with ", self.field_tables[i].weight_field_id, - print ")" - - for i in range(6): - self.field_table_ids[i] = tf_obj.field_table_ids[i] - print "Channel", i, "corresponds to", self.field_table_ids[i] - - @cython.boundscheck(False) - @cython.wraparound(False) - cdef void eval_transfer(self, np.float64_t dt, np.float64_t *dvs, - np.float64_t *rgba, np.float64_t *grad): - cdef int i, fid, use - cdef np.float64_t ta, tf, trgba[6], dot_prod - # NOTE: We now disable this. I have left it to ease the process of - # potentially, one day, re-including it. - #use = 0 - #for i in range(self.n_field_tables): - # fid = self.field_tables[i].field_id - # if (dvs[fid] >= self.field_tables[i].bounds[0]) and \ - # (dvs[fid] <= self.field_tables[i].bounds[1]): - # use = 1 - # break - for i in range(self.n_field_tables): - self.istorage[i] = FIT_get_value(&self.field_tables[i], dvs) - # We have to do this after the interpolation - for i in range(self.n_field_tables): - fid = self.field_tables[i].weight_table_id - if fid != -1: self.istorage[i] *= self.istorage[fid] - for i in range(6): - trgba[i] = self.istorage[self.field_table_ids[i]] - #print i, trgba[i], - #print - # A few words on opacity. We're going to be integrating equation 1.23 - # from Rybicki & Lightman. dI_\nu / ds = -\alpha_\nu I_\nu + j_\nu - # \alpha_nu = \kappa \rho , but we leave that up to the input - # transfer function. - # SOoooooOOOooo, the upshot is that we are doing a rectangular - # integration here: - # I_{i+1} = ds * C_i + (1.0 - ds*alpha_i) * I_i - for i in range(3): - # This is the new way: alpha corresponds to opacity of a given - # slice. Previously it was ill-defined, but represented some - # measure of emissivity. - ta = fmax((1.0 - dt*trgba[i+3]), 0.0) - rgba[i ] = dt*trgba[i ] + ta * rgba[i ] - #rgba[i+3] = dt*trgba[i+3] + ta * rgba[i+3] - # This is the old way: - #rgba[i ] += trgba[i] * (1.0 - rgba[i+3])*dt*trgba[i+3] - #rgba[i+3] += trgba[i] * (1.0 - rgba[i+3])*dt*trgba[i+3] - -cdef class VectorPlane: - cdef public object avp_pos, avp_dir, acenter, aimage - cdef np.float64_t *vp_pos, *vp_dir, *center, *image, - cdef np.float64_t pdx, pdy, bounds[4] - cdef int nv[2] - cdef int vp_strides[3] - cdef int im_strides[3] - cdef int vd_strides[3] - cdef public object ax_vec, ay_vec - cdef np.float64_t *x_vec, *y_vec - - def __cinit__(self, - np.ndarray[np.float64_t, ndim=3] vp_pos, - np.ndarray vp_dir, - np.ndarray[np.float64_t, ndim=1] center, - bounds, - np.ndarray[np.float64_t, ndim=3] image, - np.ndarray[np.float64_t, ndim=1] x_vec, - np.ndarray[np.float64_t, ndim=1] y_vec): - cdef int i, j - self.avp_pos = vp_pos - self.avp_dir = vp_dir - self.acenter = center - self.aimage = image - self.ax_vec = x_vec - self.ay_vec = y_vec - self.vp_pos = vp_pos.data - self.vp_dir = vp_dir.data - self.center = center.data - self.image = image.data - self.x_vec = x_vec.data - self.y_vec = y_vec.data - self.nv[0] = vp_pos.shape[0] - self.nv[1] = vp_pos.shape[1] - for i in range(4): self.bounds[i] = bounds[i] - self.pdx = (self.bounds[1] - self.bounds[0])/self.nv[0] - self.pdy = (self.bounds[3] - self.bounds[2])/self.nv[1] - for i in range(3): - self.vp_strides[i] = vp_pos.strides[i] / 8 - self.im_strides[i] = image.strides[i] / 8 - if vp_dir.ndim > 1: - for i in range(3): - self.vd_strides[i] = vp_dir.strides[i] / 8 - else: - self.vd_strides[0] = self.vd_strides[1] = self.vd_strides[2] = -1 - - @cython.boundscheck(False) - @cython.wraparound(False) - cdef void get_start_stop(self, np.float64_t *ex, int *rv): - # Extrema need to be re-centered - cdef np.float64_t cx, cy - cdef int i - cx = cy = 0.0 - for i in range(3): - cx += self.center[i] * self.x_vec[i] - cy += self.center[i] * self.y_vec[i] - rv[0] = lrint((ex[0] - cx - self.bounds[0])/self.pdx) - rv[1] = rv[0] + lrint((ex[1] - ex[0])/self.pdx) - rv[2] = lrint((ex[2] - cy - self.bounds[2])/self.pdy) - rv[3] = rv[2] + lrint((ex[3] - ex[2])/self.pdy) - - cdef inline void copy_into(self, np.float64_t *fv, np.float64_t *tv, - int i, int j, int nk, int strides[3]): - # We know the first two dimensions of our from-vector, and our - # to-vector is flat and 'ni' long - cdef int k - cdef int offset = strides[0] * i + strides[1] * j - for k in range(nk): - tv[k] = fv[offset + k] - - cdef inline void copy_back(self, np.float64_t *fv, np.float64_t *tv, - int i, int j, int nk, int strides[3]): - cdef int k - cdef int offset = strides[0] * i + strides[1] * j - for k in range(nk): - tv[offset + k] = fv[k] - -cdef class PartitionedGrid: - cdef public object my_data - cdef public object LeftEdge - cdef public object RightEdge - cdef np.float64_t *data[6] - cdef np.float64_t dvs[6] - cdef np.float64_t left_edge[3] - cdef np.float64_t right_edge[3] - cdef np.float64_t dds[3] - cdef np.float64_t idds[3] - cdef int dims[3] - cdef public int parent_grid_id - cdef public int n_fields - - @cython.boundscheck(False) - @cython.wraparound(False) - def __cinit__(self, - int parent_grid_id, int n_fields, data, - np.ndarray[np.float64_t, ndim=1] left_edge, - np.ndarray[np.float64_t, ndim=1] right_edge, - np.ndarray[np.int64_t, ndim=1] dims): - # The data is likely brought in via a slice, so we copy it - cdef int i, j, k, size - cdef np.ndarray[np.float64_t, ndim=3] tdata - self.parent_grid_id = parent_grid_id - self.LeftEdge = left_edge - self.RightEdge = right_edge - for i in range(3): - self.left_edge[i] = left_edge[i] - self.right_edge[i] = right_edge[i] - self.dims[i] = dims[i] - self.dds[i] = (self.right_edge[i] - self.left_edge[i])/dims[i] - self.idds[i] = 1.0/self.dds[i] - self.my_data = data - self.n_fields = n_fields - for i in range(n_fields): - tdata = data[i] - self.data[i] = tdata.data - - @cython.boundscheck(False) - @cython.wraparound(False) - def cast_plane(self, TransferFunctionProxy tf, VectorPlane vp): - # This routine will iterate over all of the vectors and cast each in - # turn. Might benefit from a more sophisticated intersection check, - # like http://courses.csusm.edu/cs697exz/ray_box.htm - cdef int vi, vj, hit, i, ni, nj, nn - cdef int iter[4] - cdef np.float64_t v_pos[3], v_dir[3], rgba[6], extrema[4] - hit = 0 - self.calculate_extent(vp, extrema) - vp.get_start_stop(extrema, iter) - iter[0] = iclip(iter[0], 0, vp.nv[0]) - iter[1] = iclip(iter[1], 0, vp.nv[0]) - iter[2] = iclip(iter[2], 0, vp.nv[1]) - iter[3] = iclip(iter[3], 0, vp.nv[1]) - if vp.vd_strides[0] == -1: - for vi in range(iter[0], iter[1]): - for vj in range(iter[2], iter[3]): - vp.copy_into(vp.vp_pos, v_pos, vi, vj, 3, vp.vp_strides) - vp.copy_into(vp.image, rgba, vi, vj, 3, vp.im_strides) - self.integrate_ray(v_pos, vp.vp_dir, rgba, tf) - vp.copy_back(rgba, vp.image, vi, vj, 3, vp.im_strides) - else: - # If we do not have an orthographic projection, we have to cast all - # our rays (until we can get an extrema calculation...) - for vi in range(vp.nv[0]): - for vj in range(vp.nv[1]): - vp.copy_into(vp.vp_pos, v_pos, vi, vj, 3, vp.vp_strides) - vp.copy_into(vp.image, rgba, vi, vj, 3, vp.im_strides) - vp.copy_into(vp.vp_dir, v_dir, vi, vj, 3, vp.vd_strides) - self.integrate_ray(v_pos, v_dir, rgba, tf) - vp.copy_back(rgba, vp.image, vi, vj, 3, vp.im_strides) - return hit - - @cython.boundscheck(False) - @cython.wraparound(False) - cdef void calculate_extent(self, VectorPlane vp, - np.float64_t extrema[4]): - # We do this for all eight corners - cdef np.float64_t *edges[2], temp - edges[0] = self.left_edge - edges[1] = self.right_edge - extrema[0] = extrema[2] = 1e300; extrema[1] = extrema[3] = -1e300 - cdef int i, j, k - for i in range(2): - for j in range(2): - for k in range(2): - # This should rotate it into the vector plane - temp = edges[i][0] * vp.x_vec[0] - temp += edges[j][1] * vp.x_vec[1] - temp += edges[k][2] * vp.x_vec[2] - if temp < extrema[0]: extrema[0] = temp - if temp > extrema[1]: extrema[1] = temp - temp = edges[i][0] * vp.y_vec[0] - temp += edges[j][1] * vp.y_vec[1] - temp += edges[k][2] * vp.y_vec[2] - if temp < extrema[2]: extrema[2] = temp - if temp > extrema[3]: extrema[3] = temp - #print extrema[0], extrema[1], extrema[2], extrema[3] - - @cython.boundscheck(False) - @cython.wraparound(False) - cdef int integrate_ray(self, np.float64_t v_pos[3], - np.float64_t v_dir[3], - np.float64_t rgba[4], - TransferFunctionProxy tf): - cdef int cur_ind[3], step[3], x, y, i, n, flat_ind, hit, direction - cdef np.float64_t intersect_t = 1.0 - cdef np.float64_t iv_dir[3] - cdef np.float64_t intersect[3], tmax[3], tdelta[3] - cdef np.float64_t enter_t, dist, alpha, dt, exit_t - cdef np.float64_t tr, tl, temp_x, temp_y, dv - for i in range(3): - if (v_dir[i] < 0): - step[i] = -1 - elif (v_dir[i] == 0): - step[i] = 1 - tmax[i] = 1e60 - iv_dir[i] = 1e60 - tdelta[i] = 1e-60 - continue - else: - step[i] = 1 - x = (i+1) % 3 - y = (i+2) % 3 - iv_dir[i] = 1.0/v_dir[i] - tl = (self.left_edge[i] - v_pos[i])*iv_dir[i] - temp_x = (v_pos[x] + tl*v_dir[x]) - temp_y = (v_pos[y] + tl*v_dir[y]) - if self.left_edge[x] <= temp_x and temp_x <= self.right_edge[x] and \ - self.left_edge[y] <= temp_y and temp_y <= self.right_edge[y] and \ - 0.0 <= tl and tl < intersect_t: - direction = i - intersect_t = tl - tr = (self.right_edge[i] - v_pos[i])*iv_dir[i] - temp_x = (v_pos[x] + tr*v_dir[x]) - temp_y = (v_pos[y] + tr*v_dir[y]) - if self.left_edge[x] <= temp_x and temp_x <= self.right_edge[x] and \ - self.left_edge[y] <= temp_y and temp_y <= self.right_edge[y] and \ - 0.0 <= tr and tr < intersect_t: - direction = i - intersect_t = tr - if self.left_edge[0] <= v_pos[0] and v_pos[0] <= self.right_edge[0] and \ - self.left_edge[1] <= v_pos[1] and v_pos[1] <= self.right_edge[1] and \ - self.left_edge[2] <= v_pos[2] and v_pos[2] <= self.right_edge[2]: - intersect_t = 0.0 - if not ((0.0 <= intersect_t) and (intersect_t < 1.0)): return 0 - for i in range(3): - intersect[i] = v_pos[i] + intersect_t * v_dir[i] - cur_ind[i] = floor((intersect[i] + - step[i]*1e-8*self.dds[i] - - self.left_edge[i])*self.idds[i]) - tmax[i] = (((cur_ind[i]+step[i])*self.dds[i])+ - self.left_edge[i]-v_pos[i])*iv_dir[i] - # This deals with the asymmetry in having our indices refer to the - # left edge of a cell, but the right edge of the brick being one - # extra zone out. - if cur_ind[i] == self.dims[i] and step[i] < 0: - cur_ind[i] = self.dims[i] - 1 - if cur_ind[i] < 0 or cur_ind[i] >= self.dims[i]: return 0 - if step[i] > 0: - tmax[i] = (((cur_ind[i]+1)*self.dds[i]) - +self.left_edge[i]-v_pos[i])*iv_dir[i] - if step[i] < 0: - tmax[i] = (((cur_ind[i]+0)*self.dds[i]) - +self.left_edge[i]-v_pos[i])*iv_dir[i] - tdelta[i] = (self.dds[i]*iv_dir[i]) - if tdelta[i] < 0: tdelta[i] *= -1 - # We have to jumpstart our calculation - enter_t = intersect_t - while 1: - # dims here is one less than the dimensions of the data, - # but we are tracing on the grid, not on the data... - if (not (0 <= cur_ind[0] < self.dims[0])) or \ - (not (0 <= cur_ind[1] < self.dims[1])) or \ - (not (0 <= cur_ind[2] < self.dims[2])): - break - hit += 1 - if tmax[0] < tmax[1]: - if tmax[0] < tmax[2]: - exit_t = fmin(tmax[0], 1.0) - self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, - rgba, tf) - cur_ind[0] += step[0] - enter_t = tmax[0] - tmax[0] += tdelta[0] - else: - exit_t = fmin(tmax[2], 1.0) - self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, - rgba, tf) - cur_ind[2] += step[2] - enter_t = tmax[2] - tmax[2] += tdelta[2] - else: - if tmax[1] < tmax[2]: - exit_t = fmin(tmax[1], 1.0) - self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, - rgba, tf) - cur_ind[1] += step[1] - enter_t = tmax[1] - tmax[1] += tdelta[1] - else: - exit_t = fmin(tmax[2], 1.0) - self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, - rgba, tf) - cur_ind[2] += step[2] - enter_t = tmax[2] - tmax[2] += tdelta[2] - if enter_t > 1.0: break - return hit - - @cython.boundscheck(False) - @cython.wraparound(False) - cdef void sample_values(self, - np.float64_t v_pos[3], - np.float64_t v_dir[3], - np.float64_t enter_t, - np.float64_t exit_t, - int ci[3], - np.float64_t *rgba, - TransferFunctionProxy tf): - cdef np.float64_t cp[3], dp[3], temp, dt, t, dv - cdef np.float64_t grad[3], ds[3] - grad[0] = grad[1] = grad[2] = 0.0 - cdef int dti, i - dt = (exit_t - enter_t) / tf.ns # 4 samples should be dt=0.25 - cdef int offset = ci[0] * (self.dims[1] + 1) * (self.dims[2] + 1) \ - + ci[1] * (self.dims[2] + 1) + ci[2] - for i in range(3): - # temp is the left edge of the current cell - temp = ci[i] * self.dds[i] + self.left_edge[i] - # this gets us dp as the current first sample position - dp[i] = (enter_t + 0.5 * dt) * v_dir[i] + v_pos[i] - temp - dp[i] *= self.idds[i] - ds[i] = v_dir[i] * self.idds[i] * dt - for dti in range(tf.ns): - for i in range(self.n_fields): - self.dvs[i] = offset_interpolate(self.dims, dp, self.data[i] + offset) - #if (dv < tf.x_bounds[0]) or (dv > tf.x_bounds[1]): - # continue - for i in range(3): - dp[i] += ds[i] - tf.eval_transfer(dt, self.dvs, rgba, grad) - -cdef class GridFace: - cdef int direction - cdef public np.float64_t coord - cdef np.float64_t left_edge[3] - cdef np.float64_t right_edge[3] - - @cython.boundscheck(False) - @cython.wraparound(False) - def __init__(self, grid, int direction, int left): - self.direction = direction - if left == 1: - self.coord = grid.LeftEdge[direction] - else: - self.coord = grid.RightEdge[direction] - cdef int i - for i in range(3): - self.left_edge[i] = grid.LeftEdge[i] - self.right_edge[i] = grid.RightEdge[i] - self.left_edge[direction] = self.right_edge[direction] = self.coord - - @cython.boundscheck(False) - @cython.wraparound(False) - cdef int proj_overlap(self, np.float64_t *left_edge, np.float64_t *right_edge): - cdef int xax, yax - xax = (self.direction + 1) % 3 - yax = (self.direction + 2) % 3 - if left_edge[xax] >= self.right_edge[xax]: return 0 - if right_edge[xax] <= self.left_edge[xax]: return 0 - if left_edge[yax] >= self.right_edge[yax]: return 0 - if right_edge[yax] <= self.left_edge[yax]: return 0 - return 1 - -cdef class ProtoPrism: - cdef np.float64_t left_edge[3] - cdef np.float64_t right_edge[3] - cdef public object LeftEdge - cdef public object RightEdge - cdef public object subgrid_faces - cdef public int parent_grid_id - def __cinit__(self, int parent_grid_id, - np.ndarray[np.float64_t, ndim=1] left_edge, - np.ndarray[np.float64_t, ndim=1] right_edge, - subgrid_faces): - self.parent_grid_id = parent_grid_id - cdef int i - self.LeftEdge = left_edge - self.RightEdge = right_edge - for i in range(3): - self.left_edge[i] = left_edge[i] - self.right_edge[i] = right_edge[i] - self.subgrid_faces = subgrid_faces - - @cython.boundscheck(False) - @cython.wraparound(False) - def sweep(self, int direction = 0, int stack = 0): - cdef int i - cdef GridFace face - cdef np.float64_t proto_split[3] - for i in range(3): proto_split[i] = self.right_edge[i] - for face in self.subgrid_faces[direction]: - proto_split[direction] = face.coord - if proto_split[direction] <= self.left_edge[direction]: - continue - if proto_split[direction] == self.right_edge[direction]: - if stack == 2: return [self] - return self.sweep((direction + 1) % 3, stack + 1) - if face.proj_overlap(self.left_edge, proto_split) == 1: - left, right = self.split(proto_split, direction) - LC = left.sweep((direction + 1) % 3) - RC = right.sweep(direction) - return LC + RC - raise RuntimeError - - @cython.boundscheck(False) - @cython.wraparound(False) - cdef object split(self, np.float64_t *sp, int direction): - cdef int i - cdef np.ndarray split_left = self.LeftEdge.copy() - cdef np.ndarray split_right = self.RightEdge.copy() - - for i in range(3): split_left[i] = self.right_edge[i] - split_left[direction] = sp[direction] - left = ProtoPrism(self.parent_grid_id, self.LeftEdge, split_left, - self.subgrid_faces) - - for i in range(3): split_right[i] = self.left_edge[i] - split_right[direction] = sp[direction] - right = ProtoPrism(self.parent_grid_id, split_right, self.RightEdge, - self.subgrid_faces) - - return (left, right) - - @cython.boundscheck(False) - @cython.wraparound(False) - def get_brick(self, np.ndarray[np.float64_t, ndim=1] grid_left_edge, - np.ndarray[np.float64_t, ndim=1] grid_dds, - child_mask): - # We get passed in the left edge, the dds (which gives dimensions) and - # the data, which is already vertex-centered. - cdef PartitionedGrid PG - cdef int li[3], ri[3], idims[3], i - for i in range(3): - li[i] = lrint((self.left_edge[i] - grid_left_edge[i])/grid_dds[i]) - ri[i] = lrint((self.right_edge[i] - grid_left_edge[i])/grid_dds[i]) - idims[i] = ri[i] - li[i] - if child_mask[li[0], li[1], li[2]] == 0: return [] - cdef np.ndarray[np.int64_t, ndim=1] dims = np.empty(3, dtype='int64') - for i in range(3): - dims[i] = idims[i] - #cdef np.ndarray[np.float64_t, ndim=3] new_data - #new_data = data[li[0]:ri[0]+1,li[1]:ri[1]+1,li[2]:ri[2]+1].copy() - #PG = PartitionedGrid(self.parent_grid_id, new_data, - # self.LeftEdge, self.RightEdge, dims) - return ((li[0], ri[0]), (li[1], ri[1]), (li[2], ri[2]), dims) diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/_amr_utils/fortran_reader.pyx --- a/yt/_amr_utils/fortran_reader.pyx Wed Aug 25 18:03:39 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -""" -Simple readers for fortran unformatted data, specifically for the Tiger code. - -Author: Matthew Turk -Affiliation: UCSD -Homepage: http://yt.enzotools.org/ -License: - Copyright (C) 2010 Matthew Turk. All Rights Reserved. - - This file is part of yt. - - yt is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -""" - -import numpy as np -cimport numpy as np -cimport cython - -from stdio cimport fopen, fclose, FILE - -cdef extern from "stdio.h": - cdef int SEEK_SET - cdef int SEEK_CUR - cdef int SEEK_END - int fseek(FILE *stream, long offset, int whence) - size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream) - long ftell(FILE *stream) - -@cython.boundscheck(False) -@cython.wraparound(False) -def read_tiger_section( - char *fn, - np.ndarray[np.int64_t, ndim=1] slab_start, - np.ndarray[np.int64_t, ndim=1] slab_size, - np.ndarray[np.int64_t, ndim=1] root_size, - int offset = 36): - cdef int strides[3] - strides[0] = 1 - strides[1] = root_size[0] * strides[0] - strides[2] = strides[1] * root_size[1] + 2 - cdef np.int64_t i, j, k - cdef np.ndarray buffer = np.zeros(slab_size, dtype='float32', order='F') - cdef FILE *f = fopen(fn, "rb") - #for i in range(3): offset += strides[i] * slab_start[i] - cdef np.int64_t pos = 0 - cdef np.int64_t moff = 0 - cdef float *data = buffer.data - fseek(f, offset, 0) - # If anybody wants to convert this loop to a SEEK_CUR, that'd be great. - for i in range(slab_size[2]): - for j in range(slab_size[1]): - moff = (slab_start[0] ) * strides[0] \ - + (slab_start[1] + j) * strides[1] \ - + (slab_start[2] + i) * strides[2] - #print offset + 4 * moff, pos - fseek(f, offset + 4 * moff, SEEK_SET) - fread( (data + pos), 4, slab_size[0], f) - pos += slab_size[0] - return buffer diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/_amr_utils/png_writer.pyx --- a/yt/_amr_utils/png_writer.pyx Wed Aug 25 18:03:39 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,170 +0,0 @@ -""" -A light interface to libpng - -Author: Matthew Turk -Affiliation: UCSD -Homepage: http://yt.enzotools.org/ -License: - Copyright (C) 2010 Matthew Turk. All Rights Reserved. - - This file is part of yt. - - yt is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -""" - -import numpy as np -cimport numpy as np -cimport cython - -from stdio cimport fopen, fclose, FILE - -cdef extern from "stdlib.h": - # NOTE that size_t might not be int - void *alloca(int) - -cdef extern from "png.h": - ctypedef unsigned long png_uint_32 - ctypedef long png_int_32 - ctypedef unsigned short png_uint_16 - ctypedef short png_int_16 - ctypedef unsigned char png_byte - ctypedef void *png_voidp - ctypedef png_byte *png_bytep - ctypedef png_uint_32 *png_uint_32p - ctypedef png_int_32 *png_int_32p - ctypedef png_uint_16 *png_uint_16p - ctypedef png_int_16 *png_int_16p - ctypedef char *png_charp - ctypedef char *png_const_charp - ctypedef FILE *png_FILE_p - - ctypedef struct png_struct: - pass - ctypedef png_struct *png_structp - - ctypedef struct png_info: - pass - ctypedef png_info *png_infop - - ctypedef struct png_color_8: - png_byte red - png_byte green - png_byte blue - png_byte gray - png_byte alpha - ctypedef png_color_8 *png_color_8p - - cdef png_const_charp PNG_LIBPNG_VER_STRING - - # Note that we don't support error or warning functions - png_structp png_create_write_struct( - png_const_charp user_png_ver, png_voidp error_ptr, - void *error_fn, void *warn_fn) - - png_infop png_create_info_struct(png_structp png_ptr) - - void png_init_io(png_structp png_ptr, png_FILE_p fp) - - void png_set_IHDR(png_structp png_ptr, png_infop info_ptr, - png_uint_32 width, png_uint_32 height, int bit_depth, - int color_type, int interlace_method, int compression_method, - int filter_method) - - cdef int PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE - cdef int PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE - - void png_set_pHYs(png_structp png_ptr, png_infop info_ptr, - png_uint_32 res_x, png_uint_32 res_y, int unit_type) - - cdef int PNG_RESOLUTION_METER - - void png_set_sBIT(png_structp png_ptr, png_infop info_ptr, - png_color_8p sig_bit) - - void png_write_info(png_structp png_ptr, png_infop info_ptr) - void png_write_image(png_structp png_ptr, png_bytep *image) - void png_write_end(png_structp png_ptr, png_infop info_ptr) - - void png_destroy_write_struct( - png_structp *png_ptr_ptr, png_infop *info_ptr_ptr) - -def write_png(np.ndarray[np.uint8_t, ndim=3] buffer, - char *filename, int dpi=100): - - # This is something of a translation of the matplotlib _png module - cdef png_byte *pix_buffer = buffer.data - cdef int width = buffer.shape[1] - cdef int height = buffer.shape[0] - - cdef FILE* fileobj = fopen(filename, "wb") - cdef png_bytep *row_pointers - cdef png_structp png_ptr - cdef png_infop info_ptr - - cdef png_color_8 sig_bit - cdef png_uint_32 row - - row_pointers = alloca(sizeof(png_bytep) * height) - - for row in range(height): - row_pointers[row] = pix_buffer + row * width * 4 - png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL) - info_ptr = png_create_info_struct(png_ptr) - - # Um we are ignoring setjmp sorry guys - - png_init_io(png_ptr, fileobj) - - png_set_IHDR(png_ptr, info_ptr, width, height, 8, - PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE, - PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE) - - cdef size_t dots_per_meter = (dpi / (2.54 / 100.0)) - png_set_pHYs(png_ptr, info_ptr, dots_per_meter, dots_per_meter, - PNG_RESOLUTION_METER) - - sig_bit.gray = 0 - sig_bit.red = sig_bit.green = sig_bit.blue = sig_bit.alpha = 8 - - png_set_sBIT(png_ptr, info_ptr, &sig_bit) - - png_write_info(png_ptr, info_ptr) - png_write_image(png_ptr, row_pointers) - png_write_end(png_ptr, info_ptr) - - fclose(fileobj) - png_destroy_write_struct(&png_ptr, &info_ptr) - -def add_points_to_image( - np.ndarray[np.uint8_t, ndim=3] buffer, - np.ndarray[np.float64_t, ndim=1] px, - np.ndarray[np.float64_t, ndim=1] py, - np.float64_t pv): - cdef int i, j, k, pi - cdef int np = px.shape[0] - cdef int xs = buffer.shape[0] - cdef int ys = buffer.shape[1] - cdef int v - v = iclip((pv * 255), 0, 255) - for pi in range(np): - j = (xs * px[pi]) - i = (ys * py[pi]) - for k in range(3): - buffer[i, j, k] = 0 - return - for i in range(xs): - for j in range(ys): - for k in range(3): - v = buffer[i, j, k] - buffer[i, j, k] = iclip(v, 0, 255) diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/amr_utils.c --- a/yt/amr_utils.c Wed Aug 25 18:03:39 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32107 +0,0 @@ -/* Generated by Cython 0.13.beta0 on Mon Aug 2 07:18:26 2010 */ - -#define PY_SSIZE_T_CLEAN -#include "Python.h" -#ifndef Py_PYTHON_H - #error Python headers needed to compile C extensions, please install development version of Python. -#else - -#include /* For offsetof */ -#ifndef offsetof -#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) -#endif - -#if !defined(WIN32) && !defined(MS_WINDOWS) - #ifndef __stdcall - #define __stdcall - #endif - #ifndef __cdecl - #define __cdecl - #endif - #ifndef __fastcall - #define __fastcall - #endif -#endif - -#ifndef DL_IMPORT - #define DL_IMPORT(t) t -#endif -#ifndef DL_EXPORT - #define DL_EXPORT(t) t -#endif - -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG -#endif - -#if PY_VERSION_HEX < 0x02040000 - #define METH_COEXIST 0 - #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) - #define PyDict_Contains(d,o) PySequence_Contains(d,o) -#endif - -#if PY_VERSION_HEX < 0x02050000 - typedef int Py_ssize_t; - #define PY_SSIZE_T_MAX INT_MAX - #define PY_SSIZE_T_MIN INT_MIN - #define PY_FORMAT_SIZE_T "" - #define PyInt_FromSsize_t(z) PyInt_FromLong(z) - #define PyInt_AsSsize_t(o) PyInt_AsLong(o) - #define PyNumber_Index(o) PyNumber_Int(o) - #define PyIndex_Check(o) PyNumber_Check(o) - #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) -#endif - -#if PY_VERSION_HEX < 0x02060000 - #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) - #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) - #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) - #define PyVarObject_HEAD_INIT(type, size) \ - PyObject_HEAD_INIT(type) size, - #define PyType_Modified(t) - - typedef struct { - void *buf; - PyObject *obj; - Py_ssize_t len; - Py_ssize_t itemsize; - int readonly; - int ndim; - char *format; - Py_ssize_t *shape; - Py_ssize_t *strides; - Py_ssize_t *suboffsets; - void *internal; - } Py_buffer; - - #define PyBUF_SIMPLE 0 - #define PyBUF_WRITABLE 0x0001 - #define PyBUF_FORMAT 0x0004 - #define PyBUF_ND 0x0008 - #define PyBUF_STRIDES (0x0010 | PyBUF_ND) - #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) - #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) - #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) - #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) - -#endif - -#if PY_MAJOR_VERSION < 3 - #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" -#else - #define __Pyx_BUILTIN_MODULE_NAME "builtins" -#endif - -#if PY_MAJOR_VERSION >= 3 - #define Py_TPFLAGS_CHECKTYPES 0 - #define Py_TPFLAGS_HAVE_INDEX 0 -#endif - -#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) - #define Py_TPFLAGS_HAVE_NEWBUFFER 0 -#endif - -#if PY_MAJOR_VERSION >= 3 - #define PyBaseString_Type PyUnicode_Type - #define PyStringObject PyUnicodeObject - #define PyString_Type PyUnicode_Type - #define PyString_Check PyUnicode_Check - #define PyString_CheckExact PyUnicode_CheckExact -#endif - -#if PY_VERSION_HEX < 0x02060000 - #define PyBytesObject PyStringObject - #define PyBytes_Type PyString_Type - #define PyBytes_Check PyString_Check - #define PyBytes_CheckExact PyString_CheckExact - #define PyBytes_FromString PyString_FromString - #define PyBytes_FromStringAndSize PyString_FromStringAndSize - #define PyBytes_FromFormat PyString_FromFormat - #define PyBytes_DecodeEscape PyString_DecodeEscape - #define PyBytes_AsString PyString_AsString - #define PyBytes_AsStringAndSize PyString_AsStringAndSize - #define PyBytes_Size PyString_Size - #define PyBytes_AS_STRING PyString_AS_STRING - #define PyBytes_GET_SIZE PyString_GET_SIZE - #define PyBytes_Repr PyString_Repr - #define PyBytes_Concat PyString_Concat - #define PyBytes_ConcatAndDel PyString_ConcatAndDel - #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) - #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) -#endif - -#ifndef PySet_CheckExact -# define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) -#endif - -#if PY_MAJOR_VERSION >= 3 - #define PyInt_Type PyLong_Type - #define PyInt_Check(op) PyLong_Check(op) - #define PyInt_CheckExact(op) PyLong_CheckExact(op) - #define PyInt_FromString PyLong_FromString - #define PyInt_FromUnicode PyLong_FromUnicode - #define PyInt_FromLong PyLong_FromLong - #define PyInt_FromSize_t PyLong_FromSize_t - #define PyInt_FromSsize_t PyLong_FromSsize_t - #define PyInt_AsLong PyLong_AsLong - #define PyInt_AS_LONG PyLong_AS_LONG - #define PyInt_AsSsize_t PyLong_AsSsize_t - #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask - #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask -#endif - -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif - -#if PY_MAJOR_VERSION >= 3 - #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) -#endif - -#if PY_VERSION_HEX < 0x02050000 - #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) - #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) - #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) -#else - #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) - #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) - #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) -#endif - -#if PY_VERSION_HEX < 0x02050000 - #define __Pyx_NAMESTR(n) ((char *)(n)) - #define __Pyx_DOCSTR(n) ((char *)(n)) -#else - #define __Pyx_NAMESTR(n) (n) - #define __Pyx_DOCSTR(n) (n) -#endif - -#ifdef __cplusplus -#define __PYX_EXTERN_C extern "C" -#else -#define __PYX_EXTERN_C extern -#endif - -#if defined(WIN32) || defined(MS_WINDOWS) -#define _USE_MATH_DEFINES -#endif -#include -#define __PYX_HAVE_API__yt__amr_utils -#include "stdio.h" -#include "stdlib.h" -#include "numpy/arrayobject.h" -#include "numpy/ufuncobject.h" -#include "math.h" -#include "FixedInterpolator.h" -#include "png.h" - -/* inline attribute */ -#ifndef CYTHON_INLINE - #if defined(__GNUC__) - #define CYTHON_INLINE __inline__ - #elif defined(_MSC_VER) - #define CYTHON_INLINE __inline - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_INLINE inline - #else - #define CYTHON_INLINE - #endif -#endif - -/* unused attribute */ -#ifndef CYTHON_UNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -# elif defined(__ICC) || defined(__INTEL_COMPILER) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -#endif - -typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ - - -/* Type Conversion Predeclarations */ - -#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) -#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) - -#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); - -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); - -#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) - - -#ifdef __GNUC__ -/* Test for GCC > 2.95 */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) -#define likely(x) __builtin_expect(!!(x), 1) -#define unlikely(x) __builtin_expect(!!(x), 0) -#else /* __GNUC__ > 2 ... */ -#define likely(x) (x) -#define unlikely(x) (x) -#endif /* __GNUC__ > 2 ... */ -#else /* __GNUC__ */ -#define likely(x) (x) -#define unlikely(x) (x) -#endif /* __GNUC__ */ - -static PyObject *__pyx_m; -static PyObject *__pyx_b; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static int __pyx_lineno; -static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; -static const char *__pyx_filename; - - -#if !defined(CYTHON_CCOMPLEX) - #if defined(__cplusplus) - #define CYTHON_CCOMPLEX 1 - #elif defined(_Complex_I) - #define CYTHON_CCOMPLEX 1 - #else - #define CYTHON_CCOMPLEX 0 - #endif -#endif - -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - #include - #else - #include - #endif -#endif - -#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) - #undef _Complex_I - #define _Complex_I 1.0fj -#endif - -static const char *__pyx_f[] = { - "DepthFirstOctree.pyx", - "PointsInVolume.pyx", - "VolumeIntegrator.pyx", - "Interpolators.pyx", - "RayIntegrators.pyx", - "CICDeposit.pyx", - "ContourFinding.pyx", - "png_writer.pyx", - "fortran_reader.pyx", - "QuadTree.pyx", - "numpy.pxd", - "amr_utils.pyx", -}; - -typedef npy_int8 __pyx_t_5numpy_int8_t; - -typedef npy_int16 __pyx_t_5numpy_int16_t; - -typedef npy_int32 __pyx_t_5numpy_int32_t; - -typedef npy_int64 __pyx_t_5numpy_int64_t; - -typedef npy_uint8 __pyx_t_5numpy_uint8_t; - -typedef npy_uint16 __pyx_t_5numpy_uint16_t; - -typedef npy_uint32 __pyx_t_5numpy_uint32_t; - -typedef npy_uint64 __pyx_t_5numpy_uint64_t; - -typedef npy_float32 __pyx_t_5numpy_float32_t; - -typedef npy_float64 __pyx_t_5numpy_float64_t; - -typedef npy_long __pyx_t_5numpy_int_t; - -typedef npy_longlong __pyx_t_5numpy_long_t; - -typedef npy_intp __pyx_t_5numpy_intp_t; - -typedef npy_uintp __pyx_t_5numpy_uintp_t; - -typedef npy_ulong __pyx_t_5numpy_uint_t; - -typedef npy_ulonglong __pyx_t_5numpy_ulong_t; - -typedef npy_double __pyx_t_5numpy_float_t; - -typedef npy_double __pyx_t_5numpy_double_t; - -typedef npy_longdouble __pyx_t_5numpy_longdouble_t; - -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - typedef ::std::complex< float > __pyx_t_float_complex; - #else - typedef float _Complex __pyx_t_float_complex; - #endif -#else - typedef struct { float real, imag; } __pyx_t_float_complex; -#endif - -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - typedef ::std::complex< double > __pyx_t_double_complex; - #else - typedef double _Complex __pyx_t_double_complex; - #endif -#else - typedef struct { double real, imag; } __pyx_t_double_complex; -#endif - -/* Type declarations */ - -typedef npy_cfloat __pyx_t_5numpy_cfloat_t; - -typedef npy_cdouble __pyx_t_5numpy_cdouble_t; - -typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; - -typedef npy_cdouble __pyx_t_5numpy_complex_t; - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":76 - * cdef class VectorPlane - * - * cdef struct FieldInterpolationTable: # <<<<<<<<<<<<<< - * # Note that we make an assumption about retaining a reference to values - * # externally. - */ - -struct __pyx_t_2yt_9amr_utils_FieldInterpolationTable { - __pyx_t_5numpy_float64_t *values; - __pyx_t_5numpy_float64_t bounds[2]; - __pyx_t_5numpy_float64_t dbin; - __pyx_t_5numpy_float64_t idbin; - int field_id; - int weight_field_id; - int weight_table_id; - int nbins; - int pass_through; -}; - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":89 - * int pass_through - * - * cdef void FIT_initialize_table(FieldInterpolationTable *fit, int nbins, # <<<<<<<<<<<<<< - * np.float64_t *values, np.float64_t bounds1, np.float64_t bounds2, - * int field_id, int weight_field_id = -1, int weight_table_id = -1, - */ - -struct __pyx_opt_args_2yt_9amr_utils_FIT_initialize_table { - int __pyx_n; - int weight_field_id; - int weight_table_id; - int pass_through; -}; - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":39 - * void *alloca(int) - * - * cdef struct QuadTreeNode: # <<<<<<<<<<<<<< - * np.float64_t *val - * np.float64_t weight_val - */ - -struct __pyx_t_2yt_9amr_utils_QuadTreeNode { - __pyx_t_5numpy_float64_t *val; - __pyx_t_5numpy_float64_t weight_val; - __pyx_t_5numpy_int64_t pos[2]; - int level; - int nvals; - struct __pyx_t_2yt_9amr_utils_QuadTreeNode *children[2][2]; -}; - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":118 - * return (bv + dd*dy*fit.idbin) - * - * cdef class TransferFunctionProxy: # <<<<<<<<<<<<<< - * cdef int n_fields - * cdef int n_field_tables - */ - -struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy { - PyObject_HEAD - struct __pyx_vtabstruct_2yt_9amr_utils_TransferFunctionProxy *__pyx_vtab; - int n_fields; - int n_field_tables; - int ns; - struct __pyx_t_2yt_9amr_utils_FieldInterpolationTable field_tables[6]; - __pyx_t_5numpy_float64_t istorage[6]; - int field_table_ids[6]; - PyObject *tf_obj; - PyObject *my_field_tables; -}; - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":36 - * self.refined_pos = 0 - * - * cdef class OctreeGrid: # <<<<<<<<<<<<<< - * cdef public object child_indices, fields, left_edges, dimensions, dx - * cdef public int level - */ - -struct __pyx_obj_2yt_9amr_utils_OctreeGrid { - PyObject_HEAD - PyObject *child_indices; - PyObject *fields; - PyObject *left_edges; - PyObject *dimensions; - PyObject *dx; - int level; -}; - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":53 - * self.level = level - * - * cdef class OctreeGridList: # <<<<<<<<<<<<<< - * cdef public object grids - * def __cinit__(self, grids): - */ - -struct __pyx_obj_2yt_9amr_utils_OctreeGridList { - PyObject_HEAD - PyObject *grids; -}; - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":575 - * return 1 - * - * cdef class ProtoPrism: # <<<<<<<<<<<<<< - * cdef np.float64_t left_edge[3] - * cdef np.float64_t right_edge[3] - */ - -struct __pyx_obj_2yt_9amr_utils_ProtoPrism { - PyObject_HEAD - struct __pyx_vtabstruct_2yt_9amr_utils_ProtoPrism *__pyx_vtab; - __pyx_t_5numpy_float64_t left_edge[3]; - __pyx_t_5numpy_float64_t right_edge[3]; - PyObject *LeftEdge; - PyObject *RightEdge; - PyObject *subgrid_faces; - int parent_grid_id; -}; - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":30 - * cimport cython - * - * cdef class position: # <<<<<<<<<<<<<< - * cdef public int output_pos, refined_pos - * def __cinit__(self): - */ - -struct __pyx_obj_2yt_9amr_utils_position { - PyObject_HEAD - int output_pos; - int refined_pos; -}; - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":543 - * tf.eval_transfer(dt, self.dvs, rgba, grad) - * - * cdef class GridFace: # <<<<<<<<<<<<<< - * cdef int direction - * cdef public np.float64_t coord - */ - -struct __pyx_obj_2yt_9amr_utils_GridFace { - PyObject_HEAD - struct __pyx_vtabstruct_2yt_9amr_utils_GridFace *__pyx_vtab; - int direction; - __pyx_t_5numpy_float64_t coord; - __pyx_t_5numpy_float64_t left_edge[3]; - __pyx_t_5numpy_float64_t right_edge[3]; -}; - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":99 - * free(node) - * - * cdef class QuadTree: # <<<<<<<<<<<<<< - * cdef int nvals - * cdef np.int64_t po2[80] - */ - -struct __pyx_obj_2yt_9amr_utils_QuadTree { - PyObject_HEAD - struct __pyx_vtabstruct_2yt_9amr_utils_QuadTree *__pyx_vtab; - int nvals; - __pyx_t_5numpy_int64_t po2[80]; - struct __pyx_t_2yt_9amr_utils_QuadTreeNode ***root_nodes; - __pyx_t_5numpy_int64_t top_grid_dims[2]; -}; - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":74 - * np.float64_t *data, np.float64_t *grad) - * - * cdef class VectorPlane # <<<<<<<<<<<<<< - * - * cdef struct FieldInterpolationTable: - */ - -struct __pyx_obj_2yt_9amr_utils_VectorPlane { - PyObject_HEAD - struct __pyx_vtabstruct_2yt_9amr_utils_VectorPlane *__pyx_vtab; - PyObject *avp_pos; - PyObject *avp_dir; - PyObject *acenter; - PyObject *aimage; - __pyx_t_5numpy_float64_t *vp_pos; - __pyx_t_5numpy_float64_t *vp_dir; - __pyx_t_5numpy_float64_t *center; - __pyx_t_5numpy_float64_t *image; - __pyx_t_5numpy_float64_t pdx; - __pyx_t_5numpy_float64_t pdy; - __pyx_t_5numpy_float64_t bounds[4]; - int nv[2]; - int vp_strides[3]; - int im_strides[3]; - int vd_strides[3]; - PyObject *ax_vec; - PyObject *ay_vec; - __pyx_t_5numpy_float64_t *x_vec; - __pyx_t_5numpy_float64_t *y_vec; -}; - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":299 - * tv[offset + k] = fv[k] - * - * cdef class PartitionedGrid: # <<<<<<<<<<<<<< - * cdef public object my_data - * cdef public object LeftEdge - */ - -struct __pyx_obj_2yt_9amr_utils_PartitionedGrid { - PyObject_HEAD - struct __pyx_vtabstruct_2yt_9amr_utils_PartitionedGrid *__pyx_vtab; - PyObject *my_data; - PyObject *LeftEdge; - PyObject *RightEdge; - __pyx_t_5numpy_float64_t *data[6]; - __pyx_t_5numpy_float64_t dvs[6]; - __pyx_t_5numpy_float64_t left_edge[3]; - __pyx_t_5numpy_float64_t right_edge[3]; - __pyx_t_5numpy_float64_t dds[3]; - __pyx_t_5numpy_float64_t idds[3]; - int dims[3]; - int parent_grid_id; - int n_fields; -}; - - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":543 - * tf.eval_transfer(dt, self.dvs, rgba, grad) - * - * cdef class GridFace: # <<<<<<<<<<<<<< - * cdef int direction - * cdef public np.float64_t coord - */ - -struct __pyx_vtabstruct_2yt_9amr_utils_GridFace { - int (*proj_overlap)(struct __pyx_obj_2yt_9amr_utils_GridFace *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *); -}; -static struct __pyx_vtabstruct_2yt_9amr_utils_GridFace *__pyx_vtabptr_2yt_9amr_utils_GridFace; - - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":118 - * return (bv + dd*dy*fit.idbin) - * - * cdef class TransferFunctionProxy: # <<<<<<<<<<<<<< - * cdef int n_fields - * cdef int n_field_tables - */ - -struct __pyx_vtabstruct_2yt_9amr_utils_TransferFunctionProxy { - void (*eval_transfer)(struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *); -}; -static struct __pyx_vtabstruct_2yt_9amr_utils_TransferFunctionProxy *__pyx_vtabptr_2yt_9amr_utils_TransferFunctionProxy; - - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":575 - * return 1 - * - * cdef class ProtoPrism: # <<<<<<<<<<<<<< - * cdef np.float64_t left_edge[3] - * cdef np.float64_t right_edge[3] - */ - -struct __pyx_vtabstruct_2yt_9amr_utils_ProtoPrism { - PyObject *(*split)(struct __pyx_obj_2yt_9amr_utils_ProtoPrism *, __pyx_t_5numpy_float64_t *, int); -}; -static struct __pyx_vtabstruct_2yt_9amr_utils_ProtoPrism *__pyx_vtabptr_2yt_9amr_utils_ProtoPrism; - - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":99 - * free(node) - * - * cdef class QuadTree: # <<<<<<<<<<<<<< - * cdef int nvals - * cdef np.int64_t po2[80] - */ - -struct __pyx_vtabstruct_2yt_9amr_utils_QuadTree { - void (*add_to_position)(struct __pyx_obj_2yt_9amr_utils_QuadTree *, int, __pyx_t_5numpy_int64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t); - struct __pyx_t_2yt_9amr_utils_QuadTreeNode *(*find_on_root_level)(struct __pyx_obj_2yt_9amr_utils_QuadTree *, __pyx_t_5numpy_int64_t *, int); - int (*count_at_level)(struct __pyx_obj_2yt_9amr_utils_QuadTree *, struct __pyx_t_2yt_9amr_utils_QuadTreeNode *, int); - int (*fill_from_level)(struct __pyx_obj_2yt_9amr_utils_QuadTree *, struct __pyx_t_2yt_9amr_utils_QuadTreeNode *, int, __pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *); -}; -static struct __pyx_vtabstruct_2yt_9amr_utils_QuadTree *__pyx_vtabptr_2yt_9amr_utils_QuadTree; - - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":222 - * #rgba[i+3] += trgba[i] * (1.0 - rgba[i+3])*dt*trgba[i+3] - * - * cdef class VectorPlane: # <<<<<<<<<<<<<< - * cdef public object avp_pos, avp_dir, acenter, aimage - * cdef np.float64_t *vp_pos, *vp_dir, *center, *image, - */ - -struct __pyx_vtabstruct_2yt_9amr_utils_VectorPlane { - void (*get_start_stop)(struct __pyx_obj_2yt_9amr_utils_VectorPlane *, __pyx_t_5numpy_float64_t *, int *); - void (*copy_into)(struct __pyx_obj_2yt_9amr_utils_VectorPlane *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, int, int, int, int *); - void (*copy_back)(struct __pyx_obj_2yt_9amr_utils_VectorPlane *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, int, int, int, int *); -}; -static struct __pyx_vtabstruct_2yt_9amr_utils_VectorPlane *__pyx_vtabptr_2yt_9amr_utils_VectorPlane; - - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":299 - * tv[offset + k] = fv[k] - * - * cdef class PartitionedGrid: # <<<<<<<<<<<<<< - * cdef public object my_data - * cdef public object LeftEdge - */ - -struct __pyx_vtabstruct_2yt_9amr_utils_PartitionedGrid { - void (*calculate_extent)(struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *, struct __pyx_obj_2yt_9amr_utils_VectorPlane *, __pyx_t_5numpy_float64_t *); - int (*integrate_ray)(struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *); - void (*sample_values)(struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, int *, __pyx_t_5numpy_float64_t *, struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *); -}; -static struct __pyx_vtabstruct_2yt_9amr_utils_PartitionedGrid *__pyx_vtabptr_2yt_9amr_utils_PartitionedGrid; - -#ifndef CYTHON_REFNANNY - #define CYTHON_REFNANNY 0 -#endif - -#if CYTHON_REFNANNY - typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*SetupContext)(const char*, int, const char*); - void (*FinishContext)(void**); - } __Pyx_RefNannyAPIStruct; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule((char *)modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); - end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; - } - #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) - #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) -#else - #define __Pyx_RefNannySetupContext(name) - #define __Pyx_RefNannyFinishContext() - #define __Pyx_INCREF(r) Py_INCREF(r) - #define __Pyx_DECREF(r) Py_DECREF(r) - #define __Pyx_GOTREF(r) - #define __Pyx_GIVEREF(r) - #define __Pyx_XDECREF(r) Py_XDECREF(r) -#endif /* CYTHON_REFNANNY */ -#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) -#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) - -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ - -static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, - Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ - -static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, - const char* function_name, int kw_allowed); /*proto*/ - -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ - -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ - -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact); /*proto*/ - -/* Run-time type information about structs used with buffers */ -struct __Pyx_StructField_; - -typedef struct { - const char* name; /* for error messages only */ - struct __Pyx_StructField_* fields; - size_t size; /* sizeof(type) */ - char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */ -} __Pyx_TypeInfo; - -typedef struct __Pyx_StructField_ { - __Pyx_TypeInfo* type; - const char* name; - size_t offset; -} __Pyx_StructField; - -typedef struct { - __Pyx_StructField* field; - size_t parent_offset; -} __Pyx_BufFmt_StackElem; - - -static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); -static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); - -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ - - -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { - PyObject *r; - if (!j) return NULL; - r = PyObject_GetItem(o, j); - Py_DECREF(j); - return r; -} - - -#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ - __Pyx_GetItemInt_List_Fast(o, i) : \ - __Pyx_GetItemInt_Generic(o, to_py_func(i))) - -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { - if (likely(o != Py_None)) { - if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { - PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); - Py_INCREF(r); - return r; - } - } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -} - -#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ - __Pyx_GetItemInt_Tuple_Fast(o, i) : \ - __Pyx_GetItemInt_Generic(o, to_py_func(i))) - -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { - if (likely(o != Py_None)) { - if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { - PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); - Py_INCREF(r); - return r; - } - } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -} - - -#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ - __Pyx_GetItemInt_Fast(o, i) : \ - __Pyx_GetItemInt_Generic(o, to_py_func(i))) - -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { - PyObject *r; - if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { - r = PyList_GET_ITEM(o, i); - Py_INCREF(r); - } - else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); - } - else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { - r = PySequence_GetItem(o, i); - } - else { - r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); - } - return r; -} - -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ -#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) -#define __Pyx_BufPtrStrided4d(type, buf, i0, s0, i1, s1, i2, s2, i3, s3) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2 + i3 * s3) -#define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1) - -static void __Pyx_RaiseBufferFallbackError(void); /*proto*/ -#define __Pyx_BufPtrStrided3d(type, buf, i0, s0, i1, s1, i2, s2) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2) -static void __Pyx_RaiseBufferIndexError(int axis); /*proto*/ - -static CYTHON_INLINE long __Pyx_mod_long(long, long); /* proto */ - -static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) { - if (likely(PyList_CheckExact(L))) { - if (PyList_Append(L, x) < 0) return NULL; - Py_INCREF(Py_None); - return Py_None; /* this is just to have an accurate signature */ - } - else { - PyObject *r, *m; - m = __Pyx_GetAttrString(L, "append"); - if (!m) return NULL; - r = PyObject_CallFunctionObjArgs(m, x, NULL); - Py_DECREF(m); - return r; - } -} - -static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */ - -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); - -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); - -static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ -static int __Pyx_EndUnpack(PyObject *, Py_ssize_t expected); /*proto*/ - -#define __Pyx_SetItemInt(o, i, v, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ - __Pyx_SetItemInt_Fast(o, i, v) : \ - __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) - -static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { - int r; - if (!j) return -1; - r = PyObject_SetItem(o, j, v); - Py_DECREF(j); - return r; -} - -static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v) { - if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { - Py_INCREF(v); - Py_DECREF(PyList_GET_ITEM(o, i)); - PyList_SET_ITEM(o, i, v); - return 1; - } - else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && (likely(i >= 0))) - return PySequence_SetItem(o, i, v); - else { - PyObject *j = PyInt_FromSsize_t(i); - return __Pyx_SetItemInt_Generic(o, j, v); - } -} - -static CYTHON_INLINE __pyx_t_5numpy_int64_t __Pyx_div___pyx_t_5numpy_int64_t(__pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t); /* proto */ - -#define UNARY_NEG_WOULD_OVERFLOW(x) (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) - -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); - -static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ -#if PY_MAJOR_VERSION < 3 -static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); -static void __Pyx_ReleaseBuffer(Py_buffer *view); -#else -#define __Pyx_GetBuffer PyObject_GetBuffer -#define __Pyx_ReleaseBuffer PyBuffer_Release -#endif - -Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0}; -Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1}; - -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ - -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp); - -static CYTHON_INLINE npy_int32 __Pyx_PyInt_from_py_npy_int32(PyObject *); - -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int32(npy_int32); - -static int __Pyx_Print(PyObject*, PyObject *, int); /*proto*/ -#if PY_MAJOR_VERSION >= 3 -static PyObject* __pyx_print = 0; -static PyObject* __pyx_print_kwargs = 0; -#endif - -static CYTHON_INLINE npy_int64 __Pyx_PyInt_from_py_npy_int64(PyObject *); - -static int __Pyx_PrintOne(PyObject* stream, PyObject *o); /*proto*/ - -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ - -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int64(npy_int64); - -#if PY_VERSION_HEX < 0x02050000 -#ifndef PyAnySet_CheckExact - -#define PyAnySet_CheckExact(ob) \ - ((ob)->ob_type == &PySet_Type || \ - (ob)->ob_type == &PyFrozenSet_Type) - -#define PySet_New(iterable) \ - PyObject_CallFunctionObjArgs((PyObject *)&PySet_Type, (iterable), NULL) - -#define Pyx_PyFrozenSet_New(iterable) \ - PyObject_CallFunctionObjArgs((PyObject *)&PyFrozenSet_Type, (iterable), NULL) - -#define PySet_Size(anyset) \ - PyObject_Size((anyset)) - -#define PySet_Contains(anyset, key) \ - PySequence_Contains((anyset), (key)) - -#define PySet_Pop(set) \ - PyObject_CallMethod(set, (char *)"pop", NULL) - -static CYTHON_INLINE int PySet_Clear(PyObject *set) { - PyObject *ret = PyObject_CallMethod(set, (char *)"clear", NULL); - if (!ret) return -1; - Py_DECREF(ret); return 0; -} - -static CYTHON_INLINE int PySet_Discard(PyObject *set, PyObject *key) { - PyObject *ret = PyObject_CallMethod(set, (char *)"discard", (char *)"O", key); - if (!ret) return -1; - Py_DECREF(ret); return 0; -} - -static CYTHON_INLINE int PySet_Add(PyObject *set, PyObject *key) { - PyObject *ret = PyObject_CallMethod(set, (char *)"add", (char *)"O", key); - if (!ret) return -1; - Py_DECREF(ret); return 0; -} - -#endif /* PyAnySet_CheckExact (<= Py2.4) */ - -#if PY_VERSION_HEX < 0x02040000 -#ifndef Py_SETOBJECT_H -#define Py_SETOBJECT_H - -static PyTypeObject *__Pyx_PySet_Type = NULL; -static PyTypeObject *__Pyx_PyFrozenSet_Type = NULL; - -#define PySet_Type (*__Pyx_PySet_Type) -#define PyFrozenSet_Type (*__Pyx_PyFrozenSet_Type) - -#define PyAnySet_Check(ob) \ - (PyAnySet_CheckExact(ob) || \ - PyType_IsSubtype((ob)->ob_type, &PySet_Type) || \ - PyType_IsSubtype((ob)->ob_type, &PyFrozenSet_Type)) - -#define PyFrozenSet_CheckExact(ob) ((ob)->ob_type == &PyFrozenSet_Type) - -static int __Pyx_Py23SetsImport(void) { - PyObject *sets=0, *Set=0, *ImmutableSet=0; - - sets = PyImport_ImportModule((char *)"sets"); - if (!sets) goto bad; - Set = PyObject_GetAttrString(sets, (char *)"Set"); - if (!Set) goto bad; - ImmutableSet = PyObject_GetAttrString(sets, (char *)"ImmutableSet"); - if (!ImmutableSet) goto bad; - Py_DECREF(sets); - - __Pyx_PySet_Type = (PyTypeObject*) Set; - __Pyx_PyFrozenSet_Type = (PyTypeObject*) ImmutableSet; - - return 0; - - bad: - Py_XDECREF(sets); - Py_XDECREF(Set); - Py_XDECREF(ImmutableSet); - return -1; -} - -#else -static int __Pyx_Py23SetsImport(void) { return 0; } -#endif /* !Py_SETOBJECT_H */ -#endif /* < Py2.4 */ -#endif /* < Py2.5 */ - -static CYTHON_INLINE png_uint_32 __Pyx_PyInt_from_py_png_uint_32(PyObject *); - -static CYTHON_INLINE long __Pyx_pow_long(long, long); /* proto */ - -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - #define __Pyx_CREAL(z) ((z).real()) - #define __Pyx_CIMAG(z) ((z).imag()) - #else - #define __Pyx_CREAL(z) (__real__(z)) - #define __Pyx_CIMAG(z) (__imag__(z)) - #endif -#else - #define __Pyx_CREAL(z) ((z).real) - #define __Pyx_CIMAG(z) ((z).imag) -#endif - -#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX - #define __Pyx_SET_CREAL(z,x) ((z).real(x)) - #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) -#else - #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) - #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) -#endif - -static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); - -#if CYTHON_CCOMPLEX - #define __Pyx_c_eqf(a, b) ((a)==(b)) - #define __Pyx_c_sumf(a, b) ((a)+(b)) - #define __Pyx_c_difff(a, b) ((a)-(b)) - #define __Pyx_c_prodf(a, b) ((a)*(b)) - #define __Pyx_c_quotf(a, b) ((a)/(b)) - #define __Pyx_c_negf(a) (-(a)) - #ifdef __cplusplus - #define __Pyx_c_is_zerof(z) ((z)==(float)0) - #define __Pyx_c_conjf(z) (::std::conj(z)) - /*#define __Pyx_c_absf(z) (::std::abs(z))*/ - #else - #define __Pyx_c_is_zerof(z) ((z)==0) - #define __Pyx_c_conjf(z) (conjf(z)) - /*#define __Pyx_c_absf(z) (cabsf(z))*/ - #endif -#else - static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); - static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); - /*static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);*/ -#endif - -static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); - -#if CYTHON_CCOMPLEX - #define __Pyx_c_eq(a, b) ((a)==(b)) - #define __Pyx_c_sum(a, b) ((a)+(b)) - #define __Pyx_c_diff(a, b) ((a)-(b)) - #define __Pyx_c_prod(a, b) ((a)*(b)) - #define __Pyx_c_quot(a, b) ((a)/(b)) - #define __Pyx_c_neg(a) (-(a)) - #ifdef __cplusplus - #define __Pyx_c_is_zero(z) ((z)==(double)0) - #define __Pyx_c_conj(z) (::std::conj(z)) - /*#define __Pyx_c_abs(z) (::std::abs(z))*/ - #else - #define __Pyx_c_is_zero(z) ((z)==0) - #define __Pyx_c_conj(z) (conj(z)) - /*#define __Pyx_c_abs(z) (cabs(z))*/ - #endif -#else - static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); - static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); - /*static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);*/ -#endif - -static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); - -static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); - -static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); - -static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); - -static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); - -static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); - -static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); - -static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); - -static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); - -static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); - -static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); - -static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); - -static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); - -static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); - -static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); - -static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); - -static void __Pyx_WriteUnraisable(const char *name); /*proto*/ - -static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ - -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/ - -static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ - -static void __Pyx_AddTraceback(const char *funcname); /*proto*/ - -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ -/* Module declarations from cpython.buffer */ - -/* Module declarations from cpython.ref */ - -/* Module declarations from libc.stdio */ - -/* Module declarations from cpython.object */ - -/* Module declarations from libc.stdlib */ - -/* Module declarations from numpy */ - -/* Module declarations from numpy */ - -static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; -static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; -static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; -static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; -static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ -/* Module declarations from cython */ - -/* Module declarations from stdlib */ - -/* Module declarations from stdio */ - -/* Module declarations from yt.amr_utils */ - -static PyTypeObject *__pyx_ptype_2yt_9amr_utils_position = 0; -static PyTypeObject *__pyx_ptype_2yt_9amr_utils_OctreeGrid = 0; -static PyTypeObject *__pyx_ptype_2yt_9amr_utils_OctreeGridList = 0; -static PyTypeObject *__pyx_ptype_2yt_9amr_utils_VectorPlane = 0; -static PyTypeObject *__pyx_ptype_2yt_9amr_utils_TransferFunctionProxy = 0; -static PyTypeObject *__pyx_ptype_2yt_9amr_utils_PartitionedGrid = 0; -static PyTypeObject *__pyx_ptype_2yt_9amr_utils_GridFace = 0; -static PyTypeObject *__pyx_ptype_2yt_9amr_utils_ProtoPrism = 0; -static PyTypeObject *__pyx_ptype_2yt_9amr_utils_QuadTree = 0; -static CYTHON_INLINE void __pyx_f_2yt_9amr_utils_set_rotated_pos(__pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t (*)[3], __pyx_t_5numpy_float64_t *, int, int, int); /*proto*/ -static void __pyx_f_2yt_9amr_utils_normalize_vector(__pyx_t_5numpy_float64_t *); /*proto*/ -static void __pyx_f_2yt_9amr_utils_get_cross_product(__pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *); /*proto*/ -static int __pyx_f_2yt_9amr_utils_check_projected_overlap(__pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, int, __pyx_t_5numpy_float64_t (*)[3], __pyx_t_5numpy_float64_t (*)[3]); /*proto*/ -static CYTHON_INLINE int __pyx_f_2yt_9amr_utils_imax(int, int); /*proto*/ -static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9amr_utils_fmax(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/ -static CYTHON_INLINE int __pyx_f_2yt_9amr_utils_imin(int, int); /*proto*/ -static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9amr_utils_fmin(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/ -static CYTHON_INLINE int __pyx_f_2yt_9amr_utils_iclip(int, int, int); /*proto*/ -static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9amr_utils_fclip(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/ -static void __pyx_f_2yt_9amr_utils_FIT_initialize_table(struct __pyx_t_2yt_9amr_utils_FieldInterpolationTable *, int, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, int, struct __pyx_opt_args_2yt_9amr_utils_FIT_initialize_table *__pyx_optional_args); /*proto*/ -static __pyx_t_5numpy_float64_t __pyx_f_2yt_9amr_utils_FIT_get_value(struct __pyx_t_2yt_9amr_utils_FieldInterpolationTable *, __pyx_t_5numpy_float64_t *); /*proto*/ -static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_9amr_utils_i64max(__pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t); /*proto*/ -static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_9amr_utils_i64min(__pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t); /*proto*/ -static CYTHON_INLINE int __pyx_f_2yt_9amr_utils_are_neighbors(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/ -static void __pyx_f_2yt_9amr_utils_QTN_add_value(struct __pyx_t_2yt_9amr_utils_QuadTreeNode *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t); /*proto*/ -static void __pyx_f_2yt_9amr_utils_QTN_refine(struct __pyx_t_2yt_9amr_utils_QuadTreeNode *); /*proto*/ -static struct __pyx_t_2yt_9amr_utils_QuadTreeNode *__pyx_f_2yt_9amr_utils_QTN_initialize(__pyx_t_5numpy_int64_t *, int, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t, int); /*proto*/ -static void __pyx_f_2yt_9amr_utils_QTN_free(struct __pyx_t_2yt_9amr_utils_QuadTreeNode *); /*proto*/ -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t = { "int32_t", NULL, sizeof(__pyx_t_5numpy_int32_t), 'I' }; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t = { "float64_t", NULL, sizeof(__pyx_t_5numpy_float64_t), 'R' }; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int_t = { "int_t", NULL, sizeof(__pyx_t_5numpy_int_t), 'I' }; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t = { "int8_t", NULL, sizeof(__pyx_t_5numpy_int8_t), 'I' }; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float_t = { "float_t", NULL, sizeof(__pyx_t_5numpy_float_t), 'R' }; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t = { "int64_t", NULL, sizeof(__pyx_t_5numpy_int64_t), 'I' }; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t = { "float32_t", NULL, sizeof(__pyx_t_5numpy_float32_t), 'R' }; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t = { "uint8_t", NULL, sizeof(__pyx_t_5numpy_uint8_t), 'U' }; -#define __Pyx_MODULE_NAME "yt.amr_utils" -int __pyx_module_is_main_yt__amr_utils = 0; - -/* Implementation of yt.amr_utils */ -static PyObject *__pyx_builtin_range; -static PyObject *__pyx_builtin_xrange; -static PyObject *__pyx_builtin_RuntimeError; -static PyObject *__pyx_builtin_ValueError; -static char __pyx_k_1[] = "RecurseOctreeDepthFirst"; -static char __pyx_k_2[] = "RecurseOctreeByLevels"; -static char __pyx_k_3[] = "Field table"; -static char __pyx_k_4[] = "corresponds to"; -static char __pyx_k_5[] = "(Weighted with "; -static char __pyx_k_6[] = ")"; -static char __pyx_k_7[] = "ndarray is not C contiguous"; -static char __pyx_k_8[] = "ndarray is not Fortran contiguous"; -static char __pyx_k_9[] = "Non-native byte order not supported"; -static char __pyx_k_10[] = "unknown dtype code in numpy.pxd (%d)"; -static char __pyx_k_11[] = "Format string allocated too short, see comment in numpy.pxd"; -static char __pyx_k_12[] = "Format string allocated too short."; -static char __pyx_k_13[] = "\nContainer file to hold all our Cython routines. This is to avoid problems with\nstatic linking.\n\nAuthor: Matthew Turk \nAffiliation: KIPAC/SLAC/Stanford\nHomepage: http://yt.enzotools.org/\nLicense:\n Copyright (C) 2008 Matthew Turk. All Rights Reserved.\n\n This file is part of yt.\n\n yt is free software; you can redistribute it and/or modify\n it under the terms of the GNU General Public License as published by\n the Free Software Foundation; either version 3 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see .\n"; -static char __pyx_k_14[] = "Transfer3D (line 36)"; -static char __pyx_k_15[] = "TransferShells (line 74)"; -static char __pyx_k__B[] = "B"; -static char __pyx_k__F[] = "F"; -static char __pyx_k__H[] = "H"; -static char __pyx_k__I[] = "I"; -static char __pyx_k__L[] = "L"; -static char __pyx_k__O[] = "O"; -static char __pyx_k__Q[] = "Q"; -static char __pyx_k__a[] = "a"; -static char __pyx_k__b[] = "b"; -static char __pyx_k__d[] = "d"; -static char __pyx_k__e[] = "e"; -static char __pyx_k__f[] = "f"; -static char __pyx_k__g[] = "g"; -static char __pyx_k__h[] = "h"; -static char __pyx_k__i[] = "i"; -static char __pyx_k__l[] = "l"; -static char __pyx_k__q[] = "q"; -static char __pyx_k__u[] = "u"; -static char __pyx_k__v[] = "v"; -static char __pyx_k__x[] = "x"; -static char __pyx_k__y[] = "y"; -static char __pyx_k__z[] = "z"; -static char __pyx_k__Zd[] = "Zd"; -static char __pyx_k__Zf[] = "Zf"; -static char __pyx_k__Zg[] = "Zg"; -static char __pyx_k__cm[] = "cm"; -static char __pyx_k__dx[] = "dx"; -static char __pyx_k__dy[] = "dy"; -static char __pyx_k__dz[] = "dz"; -static char __pyx_k__fn[] = "fn"; -static char __pyx_k__gi[] = "gi"; -static char __pyx_k__np[] = "np"; -static char __pyx_k__ns[] = "ns"; -static char __pyx_k__nv[] = "nv"; -static char __pyx_k__pv[] = "pv"; -static char __pyx_k__px[] = "px"; -static char __pyx_k__py[] = "py"; -static char __pyx_k__rb[] = "rb"; -static char __pyx_k__tf[] = "tf"; -static char __pyx_k__ug[] = "ug"; -static char __pyx_k__vp[] = "vp"; -static char __pyx_k__wb[] = "wb"; -static char __pyx_k__buf[] = "buf"; -static char __pyx_k__dds[] = "dds"; -static char __pyx_k__dpi[] = "dpi"; -static char __pyx_k__dvs[] = "dvs"; -static char __pyx_k__i_f[] = "i_f"; -static char __pyx_k__i_i[] = "i_i"; -static char __pyx_k__i_s[] = "i_s"; -static char __pyx_k__ind[] = "ind"; -static char __pyx_k__j_f[] = "j_f"; -static char __pyx_k__j_i[] = "j_i"; -static char __pyx_k__k_f[] = "k_f"; -static char __pyx_k__k_i[] = "k_i"; -static char __pyx_k__o_s[] = "o_s"; -static char __pyx_k__obj[] = "obj"; -static char __pyx_k__pdx[] = "pdx"; -static char __pyx_k__pdy[] = "pdy"; -static char __pyx_k__po2[] = "po2"; -static char __pyx_k__pos[] = "pos"; -static char __pyx_k__pxs[] = "pxs"; -static char __pyx_k__pys[] = "pys"; -static char __pyx_k__red[] = "red"; -static char __pyx_k__val[] = "val"; -static char __pyx_k__base[] = "base"; -static char __pyx_k__blue[] = "blue"; -static char __pyx_k__copy[] = "copy"; -static char __pyx_k__data[] = "data"; -static char __pyx_k__dbin[] = "dbin"; -static char __pyx_k__dims[] = "dims"; -static char __pyx_k__gray[] = "gray"; -static char __pyx_k__grid[] = "grid"; -static char __pyx_k__idds[] = "idds"; -static char __pyx_k__imax[] = "imax"; -static char __pyx_k__imin[] = "imin"; -static char __pyx_k__int8[] = "int8"; -static char __pyx_k__jmax[] = "jmax"; -static char __pyx_k__jmin[] = "jmin"; -static char __pyx_k__kmax[] = "kmax"; -static char __pyx_k__kmin[] = "kmin"; -static char __pyx_k__left[] = "left"; -static char __pyx_k__mask[] = "mask"; -static char __pyx_k__mass[] = "mass"; -static char __pyx_k__ndim[] = "ndim"; -static char __pyx_k__posx[] = "posx"; -static char __pyx_k__posy[] = "posy"; -static char __pyx_k__posz[] = "posz"; -static char __pyx_k__x_is[] = "x_is"; -static char __pyx_k__y_is[] = "y_is"; -static char __pyx_k__z_is[] = "z_is"; -static char __pyx_k__alpha[] = "alpha"; -static char __pyx_k__coord[] = "coord"; -static char __pyx_k__descr[] = "descr"; -static char __pyx_k__dtype[] = "dtype"; -static char __pyx_k__empty[] = "empty"; -static char __pyx_k__field[] = "field"; -static char __pyx_k__floor[] = "floor"; -static char __pyx_k__green[] = "green"; -static char __pyx_k__grids[] = "grids"; -static char __pyx_k__idbin[] = "idbin"; -static char __pyx_k__image[] = "image"; -static char __pyx_k__int32[] = "int32"; -static char __pyx_k__int64[] = "int64"; -static char __pyx_k__joins[] = "joins"; -static char __pyx_k__level[] = "level"; -static char __pyx_k__names[] = "names"; -static char __pyx_k__nbins[] = "nbins"; -static char __pyx_k__numpy[] = "numpy"; -static char __pyx_k__nvals[] = "nvals"; -static char __pyx_k__order[] = "order"; -static char __pyx_k__pmask[] = "pmask"; -static char __pyx_k__pvals[] = "pvals"; -static char __pyx_k__range[] = "range"; -static char __pyx_k__shape[] = "shape"; -static char __pyx_k__split[] = "split"; -static char __pyx_k__stack[] = "stack"; -static char __pyx_k__sweep[] = "sweep"; -static char __pyx_k__table[] = "table"; -static char __pyx_k__wvals[] = "wvals"; -static char __pyx_k__x_vec[] = "x_vec"; -static char __pyx_k__y_vec[] = "y_vec"; -static char __pyx_k__zeros[] = "zeros"; -static char __pyx_k__aimage[] = "aimage"; -static char __pyx_k__ax_vec[] = "ax_vec"; -static char __pyx_k__ay_vec[] = "ay_vec"; -static char __pyx_k__bounds[] = "bounds"; -static char __pyx_k__buffer[] = "buffer"; -static char __pyx_k__center[] = "center"; -static char __pyx_k__curpos[] = "curpos"; -static char __pyx_k__fields[] = "fields"; -static char __pyx_k__format[] = "format"; -static char __pyx_k__grid_t[] = "grid_t"; -static char __pyx_k__offset[] = "offset"; -static char __pyx_k__output[] = "output"; -static char __pyx_k__points[] = "points"; -static char __pyx_k__shells[] = "shells"; -static char __pyx_k__tables[] = "tables"; -static char __pyx_k__tf_obj[] = "tf_obj"; -static char __pyx_k__values[] = "values"; -static char __pyx_k__vp_dir[] = "vp_dir"; -static char __pyx_k__vp_pos[] = "vp_pos"; -static char __pyx_k__x_bins[] = "x_bins"; -static char __pyx_k__x_vals[] = "x_vals"; -static char __pyx_k__xrange[] = "xrange"; -static char __pyx_k__y_bins[] = "y_bins"; -static char __pyx_k__y_vals[] = "y_vals"; -static char __pyx_k__z_bins[] = "z_bins"; -static char __pyx_k__z_vals[] = "z_vals"; -static char __pyx_k__Channel[] = "Channel"; -static char __pyx_k__acenter[] = "acenter"; -static char __pyx_k__avp_dir[] = "avp_dir"; -static char __pyx_k__avp_pos[] = "avp_pos"; -static char __pyx_k__corners[] = "corners"; -static char __pyx_k__float32[] = "float32"; -static char __pyx_k__float64[] = "float64"; -static char __pyx_k__grid_dt[] = "grid_dt"; -static char __pyx_k__istride[] = "istride"; -static char __pyx_k__jstride[] = "jstride"; -static char __pyx_k__max_ind[] = "max_ind"; -static char __pyx_k__my_data[] = "my_data"; -static char __pyx_k__nshells[] = "nshells"; -static char __pyx_k__refined[] = "refined"; -static char __pyx_k__rot_mat[] = "rot_mat"; -static char __pyx_k__strides[] = "strides"; -static char __pyx_k__LeftEdge[] = "LeftEdge"; -static char __pyx_k____main__[] = "__main__"; -static char __pyx_k____test__[] = "__test__"; -static char __pyx_k__cellSize[] = "cellSize"; -static char __pyx_k__children[] = "children"; -static char __pyx_k__field_id[] = "field_id"; -static char __pyx_k__filename[] = "filename"; -static char __pyx_k__grid_dds[] = "grid_dds"; -static char __pyx_k__istorage[] = "istorage"; -static char __pyx_k__itemsize[] = "itemsize"; -static char __pyx_k__leftEdge[] = "leftEdge"; -static char __pyx_k__n_fields[] = "n_fields"; -static char __pyx_k__readonly[] = "readonly"; -static char __pyx_k__type_num[] = "type_num"; -static char __pyx_k__x_bounds[] = "x_bounds"; -static char __pyx_k__RightEdge[] = "RightEdge"; -static char __pyx_k__byteorder[] = "byteorder"; -static char __pyx_k__copy_back[] = "copy_back"; -static char __pyx_k__copy_into[] = "copy_into"; -static char __pyx_k__direction[] = "direction"; -static char __pyx_k__field_ids[] = "field_ids"; -static char __pyx_k__genealogy[] = "genealogy"; -static char __pyx_k__grid_mask[] = "grid_mask"; -static char __pyx_k__left_edge[] = "left_edge"; -static char __pyx_k__root_size[] = "root_size"; -static char __pyx_k__slab_size[] = "slab_size"; -static char __pyx_k__Transfer3D[] = "Transfer3D"; -static char __pyx_k__ValueError[] = "ValueError"; -static char __pyx_k__box_center[] = "box_center"; -static char __pyx_k__box_origin[] = "box_origin"; -static char __pyx_k__child_mask[] = "child_mask"; -static char __pyx_k__count_only[] = "count_only"; -static char __pyx_k__dimensions[] = "dimensions"; -static char __pyx_k__im_strides[] = "im_strides"; -static char __pyx_k__left_edges[] = "left_edges"; -static char __pyx_k__npositions[] = "npositions"; -static char __pyx_k__output_pos[] = "output_pos"; -static char __pyx_k__right_edge[] = "right_edge"; -static char __pyx_k__root_nodes[] = "root_nodes"; -static char __pyx_k__slab_start[] = "slab_start"; -static char __pyx_k__suboffsets[] = "suboffsets"; -static char __pyx_k__vd_strides[] = "vd_strides"; -static char __pyx_k__vp_strides[] = "vp_strides"; -static char __pyx_k__weight_val[] = "weight_val"; -static char __pyx_k__box_lengths[] = "box_lengths"; -static char __pyx_k__box_vectors[] = "box_vectors"; -static char __pyx_k__break_first[] = "break_first"; -static char __pyx_k__refined_pos[] = "refined_pos"; -static char __pyx_k__start_index[] = "start_index"; -static char __pyx_k__RuntimeError[] = "RuntimeError"; -static char __pyx_k__field_tables[] = "field_tables"; -static char __pyx_k__pass_through[] = "pass_through"; -static char __pyx_k__proj_overlap[] = "proj_overlap"; -static char __pyx_k__pweight_vals[] = "pweight_vals"; -static char __pyx_k__child_indices[] = "child_indices"; -static char __pyx_k__eval_transfer[] = "eval_transfer"; -static char __pyx_k__gridDimension[] = "gridDimension"; -static char __pyx_k__integrate_ray[] = "integrate_ray"; -static char __pyx_k__sample_values[] = "sample_values"; -static char __pyx_k__subgrid_faces[] = "subgrid_faces"; -static char __pyx_k__top_grid_dims[] = "top_grid_dims"; -static char __pyx_k__TransferShells[] = "TransferShells"; -static char __pyx_k__count_at_level[] = "count_at_level"; -static char __pyx_k__get_start_stop[] = "get_start_stop"; -static char __pyx_k__grid_left_edge[] = "grid_left_edge"; -static char __pyx_k__n_field_tables[] = "n_field_tables"; -static char __pyx_k__parent_grid_id[] = "parent_grid_id"; -static char __pyx_k__add_to_position[] = "add_to_position"; -static char __pyx_k__field_table_ids[] = "field_table_ids"; -static char __pyx_k__fill_from_level[] = "fill_from_level"; -static char __pyx_k__grid_left_edges[] = "grid_left_edges"; -static char __pyx_k__grid_right_edge[] = "grid_right_edge"; -static char __pyx_k__my_field_tables[] = "my_field_tables"; -static char __pyx_k__weight_field_id[] = "weight_field_id"; -static char __pyx_k__weight_table_id[] = "weight_table_id"; -static char __pyx_k__calculate_extent[] = "calculate_extent"; -static char __pyx_k__grid_right_edges[] = "grid_right_edges"; -static char __pyx_k__weight_field_ids[] = "weight_field_ids"; -static char __pyx_k__weight_table_ids[] = "weight_table_ids"; -static char __pyx_k__find_on_root_level[] = "find_on_root_level"; -static PyObject *__pyx_n_s_1; -static PyObject *__pyx_kp_u_10; -static PyObject *__pyx_kp_u_11; -static PyObject *__pyx_kp_u_12; -static PyObject *__pyx_kp_u_14; -static PyObject *__pyx_kp_u_15; -static PyObject *__pyx_n_s_2; -static PyObject *__pyx_kp_s_3; -static PyObject *__pyx_kp_s_4; -static PyObject *__pyx_kp_s_5; -static PyObject *__pyx_kp_s_6; -static PyObject *__pyx_kp_u_7; -static PyObject *__pyx_kp_u_8; -static PyObject *__pyx_kp_u_9; -static PyObject *__pyx_n_s__Channel; -static PyObject *__pyx_n_s__F; -static PyObject *__pyx_n_s__LeftEdge; -static PyObject *__pyx_n_s__RightEdge; -static PyObject *__pyx_n_s__RuntimeError; -static PyObject *__pyx_n_s__Transfer3D; -static PyObject *__pyx_n_s__TransferShells; -static PyObject *__pyx_n_s__ValueError; -static PyObject *__pyx_n_s____main__; -static PyObject *__pyx_n_s____test__; -static PyObject *__pyx_n_s__a; -static PyObject *__pyx_n_s__acenter; -static PyObject *__pyx_n_s__add_to_position; -static PyObject *__pyx_n_s__aimage; -static PyObject *__pyx_n_s__alpha; -static PyObject *__pyx_n_s__avp_dir; -static PyObject *__pyx_n_s__avp_pos; -static PyObject *__pyx_n_s__ax_vec; -static PyObject *__pyx_n_s__ay_vec; -static PyObject *__pyx_n_s__base; -static PyObject *__pyx_n_s__blue; -static PyObject *__pyx_n_s__bounds; -static PyObject *__pyx_n_s__box_center; -static PyObject *__pyx_n_s__box_lengths; -static PyObject *__pyx_n_s__box_origin; -static PyObject *__pyx_n_s__box_vectors; -static PyObject *__pyx_n_s__break_first; -static PyObject *__pyx_n_s__buf; -static PyObject *__pyx_n_s__buffer; -static PyObject *__pyx_n_s__byteorder; -static PyObject *__pyx_n_s__calculate_extent; -static PyObject *__pyx_n_s__cellSize; -static PyObject *__pyx_n_s__center; -static PyObject *__pyx_n_s__child_indices; -static PyObject *__pyx_n_s__child_mask; -static PyObject *__pyx_n_s__children; -static PyObject *__pyx_n_s__cm; -static PyObject *__pyx_n_s__coord; -static PyObject *__pyx_n_s__copy; -static PyObject *__pyx_n_s__copy_back; -static PyObject *__pyx_n_s__copy_into; -static PyObject *__pyx_n_s__corners; -static PyObject *__pyx_n_s__count_at_level; -static PyObject *__pyx_n_s__count_only; -static PyObject *__pyx_n_s__curpos; -static PyObject *__pyx_n_s__data; -static PyObject *__pyx_n_s__dbin; -static PyObject *__pyx_n_s__dds; -static PyObject *__pyx_n_s__descr; -static PyObject *__pyx_n_s__dimensions; -static PyObject *__pyx_n_s__dims; -static PyObject *__pyx_n_s__direction; -static PyObject *__pyx_n_s__dpi; -static PyObject *__pyx_n_s__dtype; -static PyObject *__pyx_n_s__dvs; -static PyObject *__pyx_n_s__dx; -static PyObject *__pyx_n_s__dy; -static PyObject *__pyx_n_s__dz; -static PyObject *__pyx_n_s__e; -static PyObject *__pyx_n_s__empty; -static PyObject *__pyx_n_s__eval_transfer; -static PyObject *__pyx_n_s__field; -static PyObject *__pyx_n_s__field_id; -static PyObject *__pyx_n_s__field_ids; -static PyObject *__pyx_n_s__field_table_ids; -static PyObject *__pyx_n_s__field_tables; -static PyObject *__pyx_n_s__fields; -static PyObject *__pyx_n_s__filename; -static PyObject *__pyx_n_s__fill_from_level; -static PyObject *__pyx_n_s__find_on_root_level; -static PyObject *__pyx_n_s__float32; -static PyObject *__pyx_n_s__float64; -static PyObject *__pyx_n_s__floor; -static PyObject *__pyx_n_s__fn; -static PyObject *__pyx_n_s__format; -static PyObject *__pyx_n_s__genealogy; -static PyObject *__pyx_n_s__get_start_stop; -static PyObject *__pyx_n_s__gi; -static PyObject *__pyx_n_s__gray; -static PyObject *__pyx_n_s__green; -static PyObject *__pyx_n_s__grid; -static PyObject *__pyx_n_s__gridDimension; -static PyObject *__pyx_n_s__grid_dds; -static PyObject *__pyx_n_s__grid_dt; -static PyObject *__pyx_n_s__grid_left_edge; -static PyObject *__pyx_n_s__grid_left_edges; -static PyObject *__pyx_n_s__grid_mask; -static PyObject *__pyx_n_s__grid_right_edge; -static PyObject *__pyx_n_s__grid_right_edges; -static PyObject *__pyx_n_s__grid_t; -static PyObject *__pyx_n_s__grids; -static PyObject *__pyx_n_s__i_f; -static PyObject *__pyx_n_s__i_i; -static PyObject *__pyx_n_s__i_s; -static PyObject *__pyx_n_s__idbin; -static PyObject *__pyx_n_s__idds; -static PyObject *__pyx_n_s__im_strides; -static PyObject *__pyx_n_s__image; -static PyObject *__pyx_n_s__imax; -static PyObject *__pyx_n_s__imin; -static PyObject *__pyx_n_s__ind; -static PyObject *__pyx_n_s__int32; -static PyObject *__pyx_n_s__int64; -static PyObject *__pyx_n_s__int8; -static PyObject *__pyx_n_s__integrate_ray; -static PyObject *__pyx_n_s__istorage; -static PyObject *__pyx_n_s__istride; -static PyObject *__pyx_n_s__itemsize; -static PyObject *__pyx_n_s__j_f; -static PyObject *__pyx_n_s__j_i; -static PyObject *__pyx_n_s__jmax; -static PyObject *__pyx_n_s__jmin; -static PyObject *__pyx_n_s__joins; -static PyObject *__pyx_n_s__jstride; -static PyObject *__pyx_n_s__k_f; -static PyObject *__pyx_n_s__k_i; -static PyObject *__pyx_n_s__kmax; -static PyObject *__pyx_n_s__kmin; -static PyObject *__pyx_n_s__left; -static PyObject *__pyx_n_s__leftEdge; -static PyObject *__pyx_n_s__left_edge; -static PyObject *__pyx_n_s__left_edges; -static PyObject *__pyx_n_s__level; -static PyObject *__pyx_n_s__mask; -static PyObject *__pyx_n_s__mass; -static PyObject *__pyx_n_s__max_ind; -static PyObject *__pyx_n_s__my_data; -static PyObject *__pyx_n_s__my_field_tables; -static PyObject *__pyx_n_s__n_field_tables; -static PyObject *__pyx_n_s__n_fields; -static PyObject *__pyx_n_s__names; -static PyObject *__pyx_n_s__nbins; -static PyObject *__pyx_n_s__ndim; -static PyObject *__pyx_n_s__np; -static PyObject *__pyx_n_s__npositions; -static PyObject *__pyx_n_s__ns; -static PyObject *__pyx_n_s__nshells; -static PyObject *__pyx_n_s__numpy; -static PyObject *__pyx_n_s__nv; -static PyObject *__pyx_n_s__nvals; -static PyObject *__pyx_n_s__o_s; -static PyObject *__pyx_n_s__obj; -static PyObject *__pyx_n_s__offset; -static PyObject *__pyx_n_s__order; -static PyObject *__pyx_n_s__output; -static PyObject *__pyx_n_s__output_pos; -static PyObject *__pyx_n_s__parent_grid_id; -static PyObject *__pyx_n_s__pass_through; -static PyObject *__pyx_n_s__pdx; -static PyObject *__pyx_n_s__pdy; -static PyObject *__pyx_n_s__pmask; -static PyObject *__pyx_n_s__po2; -static PyObject *__pyx_n_s__points; -static PyObject *__pyx_n_s__pos; -static PyObject *__pyx_n_s__posx; -static PyObject *__pyx_n_s__posy; -static PyObject *__pyx_n_s__posz; -static PyObject *__pyx_n_s__proj_overlap; -static PyObject *__pyx_n_s__pv; -static PyObject *__pyx_n_s__pvals; -static PyObject *__pyx_n_s__pweight_vals; -static PyObject *__pyx_n_s__px; -static PyObject *__pyx_n_s__pxs; -static PyObject *__pyx_n_s__py; -static PyObject *__pyx_n_s__pys; -static PyObject *__pyx_n_s__range; -static PyObject *__pyx_n_s__readonly; -static PyObject *__pyx_n_s__red; -static PyObject *__pyx_n_s__refined; -static PyObject *__pyx_n_s__refined_pos; -static PyObject *__pyx_n_s__right_edge; -static PyObject *__pyx_n_s__root_nodes; -static PyObject *__pyx_n_s__root_size; -static PyObject *__pyx_n_s__rot_mat; -static PyObject *__pyx_n_s__sample_values; -static PyObject *__pyx_n_s__shape; -static PyObject *__pyx_n_s__shells; -static PyObject *__pyx_n_s__slab_size; -static PyObject *__pyx_n_s__slab_start; -static PyObject *__pyx_n_s__split; -static PyObject *__pyx_n_s__stack; -static PyObject *__pyx_n_s__start_index; -static PyObject *__pyx_n_s__strides; -static PyObject *__pyx_n_s__subgrid_faces; -static PyObject *__pyx_n_s__suboffsets; -static PyObject *__pyx_n_s__sweep; -static PyObject *__pyx_n_s__table; -static PyObject *__pyx_n_s__tables; -static PyObject *__pyx_n_s__tf; -static PyObject *__pyx_n_s__tf_obj; -static PyObject *__pyx_n_s__top_grid_dims; -static PyObject *__pyx_n_s__type_num; -static PyObject *__pyx_n_s__u; -static PyObject *__pyx_n_s__ug; -static PyObject *__pyx_n_s__v; -static PyObject *__pyx_n_s__val; -static PyObject *__pyx_n_s__values; -static PyObject *__pyx_n_s__vd_strides; -static PyObject *__pyx_n_s__vp; -static PyObject *__pyx_n_s__vp_dir; -static PyObject *__pyx_n_s__vp_pos; -static PyObject *__pyx_n_s__vp_strides; -static PyObject *__pyx_n_s__weight_field_id; -static PyObject *__pyx_n_s__weight_field_ids; -static PyObject *__pyx_n_s__weight_table_id; -static PyObject *__pyx_n_s__weight_table_ids; -static PyObject *__pyx_n_s__weight_val; -static PyObject *__pyx_n_s__wvals; -static PyObject *__pyx_n_s__x; -static PyObject *__pyx_n_s__x_bins; -static PyObject *__pyx_n_s__x_bounds; -static PyObject *__pyx_n_s__x_is; -static PyObject *__pyx_n_s__x_vals; -static PyObject *__pyx_n_s__x_vec; -static PyObject *__pyx_n_s__xrange; -static PyObject *__pyx_n_s__y; -static PyObject *__pyx_n_s__y_bins; -static PyObject *__pyx_n_s__y_is; -static PyObject *__pyx_n_s__y_vals; -static PyObject *__pyx_n_s__y_vec; -static PyObject *__pyx_n_s__z; -static PyObject *__pyx_n_s__z_bins; -static PyObject *__pyx_n_s__z_is; -static PyObject *__pyx_n_s__z_vals; -static PyObject *__pyx_n_s__zeros; -static PyObject *__pyx_int_0; -static PyObject *__pyx_int_1; -static PyObject *__pyx_int_2; -static PyObject *__pyx_int_3; -static PyObject *__pyx_int_15; - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":31 - * - * cdef class position: - * cdef public int output_pos, refined_pos # <<<<<<<<<<<<<< - * def __cinit__(self): - * self.output_pos = 0 - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_8position_10output_pos___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_8position_10output_pos___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2yt_9amr_utils_position *)__pyx_v_self)->output_pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("yt.amr_utils.position.output_pos.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_8position_10output_pos___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_8position_10output_pos___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - int __pyx_t_1; - __Pyx_RefNannySetupContext("__set__"); - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_obj_2yt_9amr_utils_position *)__pyx_v_self)->output_pos = __pyx_t_1; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("yt.amr_utils.position.output_pos.__set__"); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_2yt_9amr_utils_8position_11refined_pos___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_8position_11refined_pos___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2yt_9amr_utils_position *)__pyx_v_self)->refined_pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("yt.amr_utils.position.refined_pos.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_8position_11refined_pos___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_8position_11refined_pos___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - int __pyx_t_1; - __Pyx_RefNannySetupContext("__set__"); - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_obj_2yt_9amr_utils_position *)__pyx_v_self)->refined_pos = __pyx_t_1; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("yt.amr_utils.position.refined_pos.__set__"); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/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_9amr_utils_8position___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_8position___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_r; - __Pyx_RefNannySetupContext("__cinit__"); - if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/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_9amr_utils_position *)__pyx_v_self)->output_pos = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":34 - * def __cinit__(self): - * self.output_pos = 0 - * self.refined_pos = 0 # <<<<<<<<<<<<<< - * - * cdef class OctreeGrid: - */ - ((struct __pyx_obj_2yt_9amr_utils_position *)__pyx_v_self)->refined_pos = 0; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":37 - * - * cdef class OctreeGrid: - * cdef public object child_indices, fields, left_edges, dimensions, dx # <<<<<<<<<<<<<< - * cdef public int level - * def __cinit__(self, - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_10OctreeGrid_13child_indices___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_10OctreeGrid_13child_indices___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->child_indices); - __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->child_indices; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_13child_indices___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_13child_indices___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannySetupContext("__set__"); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->child_indices); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->child_indices); - ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->child_indices = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_13child_indices___del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_13child_indices___del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->child_indices); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->child_indices); - ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->child_indices = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_2yt_9amr_utils_10OctreeGrid_6fields___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_10OctreeGrid_6fields___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->fields); - __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->fields; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_6fields___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_6fields___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannySetupContext("__set__"); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->fields); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->fields); - ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->fields = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_6fields___del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_6fields___del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->fields); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->fields); - ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->fields = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_2yt_9amr_utils_10OctreeGrid_10left_edges___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_10OctreeGrid_10left_edges___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->left_edges); - __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->left_edges; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_10left_edges___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_10left_edges___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannySetupContext("__set__"); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->left_edges); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->left_edges); - ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->left_edges = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_10left_edges___del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_10left_edges___del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->left_edges); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->left_edges); - ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->left_edges = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_2yt_9amr_utils_10OctreeGrid_10dimensions___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_10OctreeGrid_10dimensions___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dimensions); - __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dimensions; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_10dimensions___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_10dimensions___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannySetupContext("__set__"); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dimensions); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dimensions); - ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dimensions = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_10dimensions___del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_10dimensions___del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dimensions); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dimensions); - ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dimensions = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_2yt_9amr_utils_10OctreeGrid_2dx___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_10OctreeGrid_2dx___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dx); - __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dx; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_2dx___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_2dx___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannySetupContext("__set__"); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dx); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dx); - ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dx = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_2dx___del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_2dx___del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dx); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dx); - ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dx = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":38 - * 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, - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_10OctreeGrid_5level___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_10OctreeGrid_5level___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->level); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("yt.amr_utils.OctreeGrid.level.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_5level___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_5level___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - int __pyx_t_1; - __Pyx_RefNannySetupContext("__set__"); - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->level = __pyx_t_1; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("yt.amr_utils.OctreeGrid.level.__set__"); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":39 - * cdef public object child_indices, fields, left_edges, dimensions, dx - * cdef public int level - * def __cinit__(self, # <<<<<<<<<<<<<< - * np.ndarray[np.int32_t, ndim=3] child_indices, - * np.ndarray[np.float64_t, ndim=4] fields, - */ - -static int __pyx_pf_2yt_9amr_utils_10OctreeGrid___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_10OctreeGrid___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_child_indices = 0; - PyArrayObject *__pyx_v_fields = 0; - 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; - Py_ssize_t __pyx_bstride_2_child_indices = 0; - 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_fields; - Py_ssize_t __pyx_bstride_0_fields = 0; - Py_ssize_t __pyx_bstride_1_fields = 0; - Py_ssize_t __pyx_bstride_2_fields = 0; - Py_ssize_t __pyx_bstride_3_fields = 0; - Py_ssize_t __pyx_bshape_0_fields = 0; - Py_ssize_t __pyx_bshape_1_fields = 0; - Py_ssize_t __pyx_bshape_2_fields = 0; - Py_ssize_t __pyx_bshape_3_fields = 0; - 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_left_edges; - Py_ssize_t __pyx_bstride_0_left_edges = 0; - Py_ssize_t __pyx_bshape_0_left_edges = 0; - Py_buffer __pyx_bstruct_dimensions; - Py_ssize_t __pyx_bstride_0_dimensions = 0; - Py_ssize_t __pyx_bshape_0_dimensions = 0; - int __pyx_r; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__child_indices,&__pyx_n_s__fields,&__pyx_n_s__left_edges,&__pyx_n_s__dimensions,&__pyx_n_s__dx,&__pyx_n_s__level,0}; - __Pyx_RefNannySetupContext("__cinit__"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[6] = {0,0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__child_indices); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fields); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left_edges); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dimensions); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dx); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__level); - if (likely(values[5])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_child_indices = ((PyArrayObject *)values[0]); - __pyx_v_fields = ((PyArrayObject *)values[1]); - __pyx_v_left_edges = ((PyArrayObject *)values[2]); - __pyx_v_dimensions = ((PyArrayObject *)values[3]); - __pyx_v_dx = ((PyArrayObject *)values[4]); - __pyx_v_level = __Pyx_PyInt_AsInt(values[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 (PyTuple_GET_SIZE(__pyx_args) != 6) { - goto __pyx_L5_argtuple_error; - } else { - __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_AsInt(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;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.OctreeGrid.__cinit__"); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_child_indices.buf = NULL; - __pyx_bstruct_fields.buf = NULL; - __pyx_bstruct_left_edges.buf = NULL; - __pyx_bstruct_dimensions.buf = NULL; - __pyx_bstruct_dx.buf = NULL; - 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;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_child_indices, (PyObject*)__pyx_v_child_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -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]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_fields, (PyObject*)__pyx_v_fields, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -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]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_left_edges, (PyObject*)__pyx_v_left_edges, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -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]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dimensions, (PyObject*)__pyx_v_dimensions, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -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]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dx, (PyObject*)__pyx_v_dx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_dx = __pyx_bstruct_dx.strides[0]; - __pyx_bshape_0_dx = __pyx_bstruct_dx.shape[0]; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/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 - */ - __Pyx_INCREF(((PyObject *)__pyx_v_child_indices)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_child_indices)); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->child_indices); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->child_indices); - ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->child_indices = ((PyObject *)__pyx_v_child_indices); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":47 - * int level): - * self.child_indices = child_indices - * self.fields = fields # <<<<<<<<<<<<<< - * self.left_edges = left_edges - * self.dimensions = dimensions - */ - __Pyx_INCREF(((PyObject *)__pyx_v_fields)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_fields)); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->fields); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->fields); - ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->fields = ((PyObject *)__pyx_v_fields); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":48 - * self.child_indices = child_indices - * self.fields = fields - * self.left_edges = left_edges # <<<<<<<<<<<<<< - * self.dimensions = dimensions - * self.dx = dx - */ - __Pyx_INCREF(((PyObject *)__pyx_v_left_edges)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_left_edges)); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->left_edges); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->left_edges); - ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->left_edges = ((PyObject *)__pyx_v_left_edges); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":49 - * self.fields = fields - * self.left_edges = left_edges - * self.dimensions = dimensions # <<<<<<<<<<<<<< - * self.dx = dx - * self.level = level - */ - __Pyx_INCREF(((PyObject *)__pyx_v_dimensions)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_dimensions)); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dimensions); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dimensions); - ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dimensions = ((PyObject *)__pyx_v_dimensions); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":50 - * self.left_edges = left_edges - * self.dimensions = dimensions - * self.dx = dx # <<<<<<<<<<<<<< - * self.level = level - * - */ - __Pyx_INCREF(((PyObject *)__pyx_v_dx)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_dx)); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dx); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dx); - ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dx = ((PyObject *)__pyx_v_dx); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":51 - * self.dimensions = dimensions - * self.dx = dx - * self.level = level # <<<<<<<<<<<<<< - * - * cdef class OctreeGridList: - */ - ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->level = __pyx_v_level; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_child_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fields); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dx); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edges); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dimensions); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.amr_utils.OctreeGrid.__cinit__"); - __pyx_r = -1; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_child_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fields); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dx); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edges); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dimensions); - __pyx_L2:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":54 - * - * cdef class OctreeGridList: - * cdef public object grids # <<<<<<<<<<<<<< - * def __cinit__(self, grids): - * self.grids = grids - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_14OctreeGridList_5grids___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_14OctreeGridList_5grids___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)__pyx_v_self)->grids); - __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)__pyx_v_self)->grids; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_14OctreeGridList_5grids___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_14OctreeGridList_5grids___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannySetupContext("__set__"); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)__pyx_v_self)->grids); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)__pyx_v_self)->grids); - ((struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)__pyx_v_self)->grids = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_14OctreeGridList_5grids___del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_14OctreeGridList_5grids___del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)__pyx_v_self)->grids); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)__pyx_v_self)->grids); - ((struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)__pyx_v_self)->grids = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":55 - * cdef class OctreeGridList: - * cdef public object grids - * def __cinit__(self, grids): # <<<<<<<<<<<<<< - * self.grids = grids - * - */ - -static int __pyx_pf_2yt_9amr_utils_14OctreeGridList___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_14OctreeGridList___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_grids = 0; - int __pyx_r; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__grids,0}; - __Pyx_RefNannySetupContext("__cinit__"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[1] = {0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grids); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_grids = values[0]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_grids = PyTuple_GET_ITEM(__pyx_args, 0); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.OctreeGridList.__cinit__"); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":56 - * cdef public object grids - * def __cinit__(self, grids): - * self.grids = grids # <<<<<<<<<<<<<< - * - * def __getitem__(self, int item): - */ - __Pyx_INCREF(__pyx_v_grids); - __Pyx_GIVEREF(__pyx_v_grids); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)__pyx_v_self)->grids); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)__pyx_v_self)->grids); - ((struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)__pyx_v_self)->grids = __pyx_v_grids; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":58 - * self.grids = grids - * - * def __getitem__(self, int item): # <<<<<<<<<<<<<< - * return self.grids[item] - * - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_14OctreeGridList___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_item); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_14OctreeGridList___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_item) { - int __pyx_v_item; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__getitem__"); - assert(__pyx_arg_item); { - __pyx_v_item = __Pyx_PyInt_AsInt(__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_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.OctreeGridList.__getitem__"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":59 - * - * def __getitem__(self, int item): - * return self.grids[item] # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetItemInt(((struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)__pyx_v_self)->grids, __pyx_v_item, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("yt.amr_utils.OctreeGridList.__getitem__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":62 - * - * @cython.boundscheck(False) - * def RecurseOctreeDepthFirst(int i_i, int j_i, int k_i, # <<<<<<<<<<<<<< - * int i_f, int j_f, int k_f, - * position curpos, int gi, - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_RecurseOctreeDepthFirst(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_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_9amr_utils_position *__pyx_v_curpos = 0; - int __pyx_v_gi; - PyArrayObject *__pyx_v_output = 0; - PyArrayObject *__pyx_v_refined = 0; - struct __pyx_obj_2yt_9amr_utils_OctreeGridList *__pyx_v_grids = 0; - int __pyx_v_i; - int __pyx_v_i_off; - int __pyx_v_j; - int __pyx_v_j_off; - int __pyx_v_k; - int __pyx_v_k_off; - int __pyx_v_ci; - int __pyx_v_fi; - int __pyx_v_child_i; - int __pyx_v_child_j; - int __pyx_v_child_k; - struct __pyx_obj_2yt_9amr_utils_OctreeGrid *__pyx_v_child_grid; - struct __pyx_obj_2yt_9amr_utils_OctreeGrid *__pyx_v_grid = 0; - PyArrayObject *__pyx_v_child_indices = 0; - PyArrayObject *__pyx_v_dimensions = 0; - PyArrayObject *__pyx_v_fields = 0; - PyArrayObject *__pyx_v_leftedges = 0; - __pyx_t_5numpy_float64_t __pyx_v_dx; - __pyx_t_5numpy_float64_t __pyx_v_child_dx; - PyArrayObject *__pyx_v_child_leftedges; - __pyx_t_5numpy_float64_t __pyx_v_cx; - __pyx_t_5numpy_float64_t __pyx_v_cy; - __pyx_t_5numpy_float64_t __pyx_v_cz; - PyObject *__pyx_v_s; - Py_buffer __pyx_bstruct_leftedges; - Py_ssize_t __pyx_bstride_0_leftedges = 0; - Py_ssize_t __pyx_bshape_0_leftedges = 0; - Py_buffer __pyx_bstruct_refined; - Py_ssize_t __pyx_bstride_0_refined = 0; - Py_ssize_t __pyx_bshape_0_refined = 0; - Py_buffer __pyx_bstruct_child_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; - Py_ssize_t __pyx_bstride_2_child_indices = 0; - 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_fields; - Py_ssize_t __pyx_bstride_0_fields = 0; - Py_ssize_t __pyx_bstride_1_fields = 0; - Py_ssize_t __pyx_bstride_2_fields = 0; - Py_ssize_t __pyx_bstride_3_fields = 0; - Py_ssize_t __pyx_bshape_0_fields = 0; - Py_ssize_t __pyx_bshape_1_fields = 0; - Py_ssize_t __pyx_bshape_2_fields = 0; - Py_ssize_t __pyx_bshape_3_fields = 0; - Py_buffer __pyx_bstruct_output; - Py_ssize_t __pyx_bstride_0_output = 0; - Py_ssize_t __pyx_bstride_1_output = 0; - Py_ssize_t __pyx_bshape_0_output = 0; - Py_ssize_t __pyx_bshape_1_output = 0; - PyObject *__pyx_r = NULL; - long __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyArrayObject *__pyx_t_3 = NULL; - PyArrayObject *__pyx_t_4 = NULL; - PyArrayObject *__pyx_t_5 = NULL; - PyArrayObject *__pyx_t_6 = NULL; - __pyx_t_5numpy_float64_t __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - long __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; - long __pyx_t_15; - PyObject *__pyx_t_16 = NULL; - PyObject *__pyx_t_17 = NULL; - PyObject *__pyx_t_18 = NULL; - int __pyx_t_19; - int __pyx_t_20; - npy_intp __pyx_t_21; - int __pyx_t_22; - int __pyx_t_23; - int __pyx_t_24; - int __pyx_t_25; - int __pyx_t_26; - int __pyx_t_27; - int __pyx_t_28; - long __pyx_t_29; - PyArrayObject *__pyx_t_30 = NULL; - int __pyx_t_31; - PyObject *__pyx_t_32 = NULL; - PyObject *__pyx_t_33 = NULL; - PyObject *__pyx_t_34 = NULL; - long __pyx_t_35; - long __pyx_t_36; - PyObject *__pyx_t_37 = NULL; - PyObject *__pyx_t_38 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__i_i,&__pyx_n_s__j_i,&__pyx_n_s__k_i,&__pyx_n_s__i_f,&__pyx_n_s__j_f,&__pyx_n_s__k_f,&__pyx_n_s__curpos,&__pyx_n_s__gi,&__pyx_n_s__output,&__pyx_n_s__refined,&__pyx_n_s__grids,0}; - __Pyx_RefNannySetupContext("RecurseOctreeDepthFirst"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i_i); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__j_i); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("RecurseOctreeDepthFirst", 1, 11, 11, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__k_i); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("RecurseOctreeDepthFirst", 1, 11, 11, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i_f); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("RecurseOctreeDepthFirst", 1, 11, 11, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__j_f); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("RecurseOctreeDepthFirst", 1, 11, 11, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__k_f); - if (likely(values[5])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("RecurseOctreeDepthFirst", 1, 11, 11, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 6: - values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__curpos); - if (likely(values[6])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("RecurseOctreeDepthFirst", 1, 11, 11, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 7: - values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__gi); - if (likely(values[7])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("RecurseOctreeDepthFirst", 1, 11, 11, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 8: - values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__output); - if (likely(values[8])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("RecurseOctreeDepthFirst", 1, 11, 11, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 9: - values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__refined); - if (likely(values[9])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("RecurseOctreeDepthFirst", 1, 11, 11, 9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 10: - values[10] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grids); - if (likely(values[10])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("RecurseOctreeDepthFirst", 1, 11, 11, 10); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "RecurseOctreeDepthFirst") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_i_i = __Pyx_PyInt_AsInt(values[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_AsInt(values[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_AsInt(values[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_AsInt(values[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_AsInt(values[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_AsInt(values[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_9amr_utils_position *)values[6]); - __pyx_v_gi = __Pyx_PyInt_AsInt(values[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 *)values[8]); - __pyx_v_refined = ((PyArrayObject *)values[9]); - __pyx_v_grids = ((struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)values[10]); - } else if (PyTuple_GET_SIZE(__pyx_args) != 11) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_i_i = __Pyx_PyInt_AsInt(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_AsInt(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_AsInt(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_AsInt(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_AsInt(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_AsInt(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_9amr_utils_position *)PyTuple_GET_ITEM(__pyx_args, 6)); - __pyx_v_gi = __Pyx_PyInt_AsInt(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_9amr_utils_OctreeGridList *)PyTuple_GET_ITEM(__pyx_args, 10)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("RecurseOctreeDepthFirst", 1, 11, 11, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.RecurseOctreeDepthFirst"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_v_child_grid = ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_child_leftedges = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_s = Py_None; __Pyx_INCREF(Py_None); - __pyx_bstruct_child_indices.buf = NULL; - __pyx_bstruct_dimensions.buf = NULL; - __pyx_bstruct_fields.buf = NULL; - __pyx_bstruct_leftedges.buf = NULL; - __pyx_bstruct_child_leftedges.buf = NULL; - __pyx_bstruct_output.buf = NULL; - __pyx_bstruct_refined.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_curpos), __pyx_ptype_2yt_9amr_utils_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_9amr_utils_OctreeGridList, 1, "grids", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_output, (PyObject*)__pyx_v_output, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -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]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_refined, (PyObject*)__pyx_v_refined, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_refined = __pyx_bstruct_refined.strides[0]; - __pyx_bshape_0_refined = __pyx_bstruct_refined.shape[0]; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":71 - * cdef int child_i, child_j, child_k - * cdef OctreeGrid child_grid - * cdef OctreeGrid grid = grids[gi-1] # <<<<<<<<<<<<<< - * cdef np.ndarray[np.int32_t, ndim=3] child_indices = grid.child_indices - * cdef np.ndarray[np.int32_t, ndim=1] dimensions = grid.dimensions - */ - __pyx_t_1 = (__pyx_v_gi - 1); - __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_grids), __pyx_t_1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_2yt_9amr_utils_OctreeGrid))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_grid = ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":72 - * cdef OctreeGrid child_grid - * cdef OctreeGrid grid = grids[gi-1] - * cdef np.ndarray[np.int32_t, ndim=3] child_indices = grid.child_indices # <<<<<<<<<<<<<< - * cdef np.ndarray[np.int32_t, ndim=1] dimensions = grid.dimensions - * cdef np.ndarray[np.float64_t, ndim=4] fields = grid.fields - */ - if (!(likely(((__pyx_v_grid->child_indices) == Py_None) || likely(__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_3 = ((PyArrayObject *)__pyx_v_grid->child_indices); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_child_indices, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) { - __pyx_v_child_indices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_child_indices.buf = NULL; - {__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]; - } - } - __pyx_t_3 = 0; - __Pyx_INCREF(__pyx_v_grid->child_indices); - __pyx_v_child_indices = ((PyArrayObject *)__pyx_v_grid->child_indices); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/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 (!(likely(((__pyx_v_grid->dimensions) == Py_None) || likely(__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_4 = ((PyArrayObject *)__pyx_v_grid->dimensions); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dimensions, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_dimensions = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_dimensions.buf = NULL; - {__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]; - } - } - __pyx_t_4 = 0; - __Pyx_INCREF(__pyx_v_grid->dimensions); - __pyx_v_dimensions = ((PyArrayObject *)__pyx_v_grid->dimensions); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/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.float64_t dx = grid.dx[0] - */ - if (!(likely(((__pyx_v_grid->fields) == Py_None) || likely(__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_5 = ((PyArrayObject *)__pyx_v_grid->fields); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_fields, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) { - __pyx_v_fields = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_fields.buf = NULL; - {__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]; - } - } - __pyx_t_5 = 0; - __Pyx_INCREF(__pyx_v_grid->fields); - __pyx_v_fields = ((PyArrayObject *)__pyx_v_grid->fields); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/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.float64_t dx = grid.dx[0] - * cdef np.float64_t child_dx - */ - if (!(likely(((__pyx_v_grid->left_edges) == Py_None) || likely(__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_6 = ((PyArrayObject *)__pyx_v_grid->left_edges); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_leftedges, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_leftedges = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_leftedges.buf = NULL; - {__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]; - } - } - __pyx_t_6 = 0; - __Pyx_INCREF(__pyx_v_grid->left_edges); - __pyx_v_leftedges = ((PyArrayObject *)__pyx_v_grid->left_edges); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/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.float64_t dx = grid.dx[0] # <<<<<<<<<<<<<< - * cdef np.float64_t child_dx - * cdef np.ndarray[np.float64_t, ndim=1] child_leftedges - */ - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_grid->dx, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_7 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_dx = __pyx_t_7; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":80 - * cdef np.ndarray[np.float64_t, ndim=1] child_leftedges - * cdef np.float64_t cx, cy, cz - * for k_off in range(k_f): # <<<<<<<<<<<<<< - * k = k_off + k_i - * cz = (leftedges[2] + k*dx) - */ - __pyx_t_8 = __pyx_v_k_f; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_k_off = __pyx_t_9; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":81 - * cdef np.float64_t cx, cy, cz - * for k_off in range(k_f): - * k = k_off + k_i # <<<<<<<<<<<<<< - * cz = (leftedges[2] + k*dx) - * for j_off in range(j_f): - */ - __pyx_v_k = (__pyx_v_k_off + __pyx_v_k_i); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":82 - * for k_off in range(k_f): - * k = k_off + k_i - * cz = (leftedges[2] + k*dx) # <<<<<<<<<<<<<< - * for j_off in range(j_f): - * j = j_off + j_i - */ - __pyx_t_1 = 2; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_bshape_0_leftedges; - __pyx_v_cz = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_leftedges.buf, __pyx_t_1, __pyx_bstride_0_leftedges)) + (__pyx_v_k * __pyx_v_dx)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":83 - * k = k_off + k_i - * cz = (leftedges[2] + k*dx) - * for j_off in range(j_f): # <<<<<<<<<<<<<< - * j = j_off + j_i - * cy = (leftedges[1] + j*dx) - */ - __pyx_t_10 = __pyx_v_j_f; - for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { - __pyx_v_j_off = __pyx_t_11; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":84 - * cz = (leftedges[2] + k*dx) - * for j_off in range(j_f): - * j = j_off + j_i # <<<<<<<<<<<<<< - * cy = (leftedges[1] + j*dx) - * for i_off in range(i_f): - */ - __pyx_v_j = (__pyx_v_j_off + __pyx_v_j_i); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":85 - * for j_off in range(j_f): - * j = j_off + j_i - * cy = (leftedges[1] + j*dx) # <<<<<<<<<<<<<< - * for i_off in range(i_f): - * i = i_off + i_i - */ - __pyx_t_12 = 1; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_bshape_0_leftedges; - __pyx_v_cy = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_leftedges.buf, __pyx_t_12, __pyx_bstride_0_leftedges)) + (__pyx_v_j * __pyx_v_dx)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":86 - * j = j_off + j_i - * cy = (leftedges[1] + j*dx) - * for i_off in range(i_f): # <<<<<<<<<<<<<< - * i = i_off + i_i - * cx = (leftedges[0] + i*dx) - */ - __pyx_t_13 = __pyx_v_i_f; - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { - __pyx_v_i_off = __pyx_t_14; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":87 - * cy = (leftedges[1] + j*dx) - * for i_off in range(i_f): - * i = i_off + i_i # <<<<<<<<<<<<<< - * cx = (leftedges[0] + i*dx) - * ci = grid.child_indices[i,j,k] - */ - __pyx_v_i = (__pyx_v_i_off + __pyx_v_i_i); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":88 - * for i_off in range(i_f): - * i = i_off + i_i - * cx = (leftedges[0] + i*dx) # <<<<<<<<<<<<<< - * ci = grid.child_indices[i,j,k] - * if ci == -1: - */ - __pyx_t_15 = 0; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_0_leftedges; - __pyx_v_cx = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_leftedges.buf, __pyx_t_15, __pyx_bstride_0_leftedges)) + (__pyx_v_i * __pyx_v_dx)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":89 - * i = i_off + i_i - * cx = (leftedges[0] + i*dx) - * ci = grid.child_indices[i,j,k] # <<<<<<<<<<<<<< - * if ci == -1: - * for fi in range(fields.shape[0]): - */ - __pyx_t_2 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_16 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_16); - __pyx_t_17 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_17); - __pyx_t_18 = PyTuple_New(3); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_16); - __Pyx_GIVEREF(__pyx_t_16); - PyTuple_SET_ITEM(__pyx_t_18, 2, __pyx_t_17); - __Pyx_GIVEREF(__pyx_t_17); - __pyx_t_2 = 0; - __pyx_t_16 = 0; - __pyx_t_17 = 0; - __pyx_t_17 = PyObject_GetItem(__pyx_v_grid->child_indices, __pyx_t_18); if (!__pyx_t_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_17); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_19 = __Pyx_PyInt_AsInt(__pyx_t_17); if (unlikely((__pyx_t_19 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __pyx_v_ci = __pyx_t_19; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":90 - * cx = (leftedges[0] + i*dx) - * 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_t_20 = (__pyx_v_ci == -1); - if (__pyx_t_20) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":91 - * 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_t_21 = (__pyx_v_fields->dimensions[0]); - for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_21; __pyx_t_19+=1) { - __pyx_v_fi = __pyx_t_19; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":92 - * 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_22 = __pyx_v_fi; - __pyx_t_23 = __pyx_v_i; - __pyx_t_24 = __pyx_v_j; - __pyx_t_25 = __pyx_v_k; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_bshape_0_fields; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_bshape_1_fields; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_bshape_2_fields; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_bshape_3_fields; - __pyx_t_26 = __pyx_v_curpos->output_pos; - __pyx_t_27 = __pyx_v_fi; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_bshape_0_output; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_bshape_1_output; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_output.buf, __pyx_t_26, __pyx_bstride_0_output, __pyx_t_27, __pyx_bstride_1_output) = (*__Pyx_BufPtrStrided4d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_fields.buf, __pyx_t_22, __pyx_bstride_0_fields, __pyx_t_23, __pyx_bstride_1_fields, __pyx_t_24, __pyx_bstride_2_fields, __pyx_t_25, __pyx_bstride_3_fields)); - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":93 - * 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_19 = __pyx_v_curpos->refined_pos; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_bshape_0_refined; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_refined.buf, __pyx_t_19, __pyx_bstride_0_refined) = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":94 - * 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; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":95 - * refined[curpos.refined_pos] = 0 - * curpos.output_pos += 1 - * curpos.refined_pos += 1 # <<<<<<<<<<<<<< - * else: - * refined[curpos.refined_pos] = 1 - */ - __pyx_v_curpos->refined_pos += 1; - goto __pyx_L12; - } - /*else*/ { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":97 - * curpos.refined_pos += 1 - * else: - * refined[curpos.refined_pos] = 1 # <<<<<<<<<<<<<< - * curpos.refined_pos += 1 - * child_grid = grids[ci-1] - */ - __pyx_t_28 = __pyx_v_curpos->refined_pos; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_bshape_0_refined; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_refined.buf, __pyx_t_28, __pyx_bstride_0_refined) = 1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":98 - * else: - * refined[curpos.refined_pos] = 1 - * curpos.refined_pos += 1 # <<<<<<<<<<<<<< - * child_grid = grids[ci-1] - * child_dx = child_grid.dx[0] - */ - __pyx_v_curpos->refined_pos += 1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":99 - * refined[curpos.refined_pos] = 1 - * curpos.refined_pos += 1 - * child_grid = grids[ci-1] # <<<<<<<<<<<<<< - * child_dx = child_grid.dx[0] - * child_leftedges = child_grid.left_edges - */ - __pyx_t_29 = (__pyx_v_ci - 1); - __pyx_t_17 = __Pyx_GetItemInt(((PyObject *)__pyx_v_grids), __pyx_t_29, sizeof(long), PyInt_FromLong); if (!__pyx_t_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_17); - if (!(likely(((__pyx_t_17) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_17, __pyx_ptype_2yt_9amr_utils_OctreeGrid))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_child_grid)); - __pyx_v_child_grid = ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_t_17); - __pyx_t_17 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":100 - * curpos.refined_pos += 1 - * child_grid = grids[ci-1] - * child_dx = child_grid.dx[0] # <<<<<<<<<<<<<< - * child_leftedges = child_grid.left_edges - * child_i = int((cx - child_leftedges[0])/child_dx) - */ - __pyx_t_17 = __Pyx_GetItemInt(__pyx_v_child_grid->dx, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_17); - __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_17); if (unlikely((__pyx_t_7 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __pyx_v_child_dx = __pyx_t_7; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":101 - * child_grid = grids[ci-1] - * child_dx = child_grid.dx[0] - * child_leftedges = child_grid.left_edges # <<<<<<<<<<<<<< - * child_i = int((cx - child_leftedges[0])/child_dx) - * child_j = int((cy - child_leftedges[1])/child_dx) - */ - if (!(likely(((__pyx_v_child_grid->left_edges) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_child_grid->left_edges, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_30 = ((PyArrayObject *)__pyx_v_child_grid->left_edges); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_child_leftedges); - __pyx_t_31 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_child_leftedges, (PyObject*)__pyx_t_30, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_31 < 0)) { - PyErr_Fetch(&__pyx_t_32, &__pyx_t_33, &__pyx_t_34); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_child_leftedges, (PyObject*)__pyx_v_child_leftedges, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_32); Py_XDECREF(__pyx_t_33); Py_XDECREF(__pyx_t_34); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_32, __pyx_t_33, __pyx_t_34); - } - } - __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_31 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_30 = 0; - __Pyx_INCREF(__pyx_v_child_grid->left_edges); - __Pyx_DECREF(((PyObject *)__pyx_v_child_leftedges)); - __pyx_v_child_leftedges = ((PyArrayObject *)__pyx_v_child_grid->left_edges); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":102 - * child_dx = child_grid.dx[0] - * child_leftedges = child_grid.left_edges - * child_i = int((cx - child_leftedges[0])/child_dx) # <<<<<<<<<<<<<< - * child_j = int((cy - child_leftedges[1])/child_dx) - * child_k = int((cz - child_leftedges[2])/child_dx) - */ - __pyx_t_29 = 0; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_bshape_0_child_leftedges; - __pyx_t_7 = (__pyx_v_cx - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_child_leftedges.buf, __pyx_t_29, __pyx_bstride_0_child_leftedges))); - if (unlikely(__pyx_v_child_dx == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_child_i = ((int)(__pyx_t_7 / __pyx_v_child_dx)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":103 - * child_leftedges = child_grid.left_edges - * child_i = int((cx - child_leftedges[0])/child_dx) - * child_j = int((cy - child_leftedges[1])/child_dx) # <<<<<<<<<<<<<< - * child_k = int((cz - child_leftedges[2])/child_dx) - * s = RecurseOctreeDepthFirst(child_i, child_j, child_k, 2, 2, 2, - */ - __pyx_t_35 = 1; - if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_bshape_0_child_leftedges; - __pyx_t_7 = (__pyx_v_cy - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_child_leftedges.buf, __pyx_t_35, __pyx_bstride_0_child_leftedges))); - if (unlikely(__pyx_v_child_dx == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_child_j = ((int)(__pyx_t_7 / __pyx_v_child_dx)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":104 - * child_i = int((cx - child_leftedges[0])/child_dx) - * child_j = int((cy - child_leftedges[1])/child_dx) - * child_k = int((cz - child_leftedges[2])/child_dx) # <<<<<<<<<<<<<< - * s = RecurseOctreeDepthFirst(child_i, child_j, child_k, 2, 2, 2, - * curpos, ci, output, refined, grids) - */ - __pyx_t_36 = 2; - if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_bshape_0_child_leftedges; - __pyx_t_7 = (__pyx_v_cz - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_child_leftedges.buf, __pyx_t_36, __pyx_bstride_0_child_leftedges))); - if (unlikely(__pyx_v_child_dx == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_child_k = ((int)(__pyx_t_7 / __pyx_v_child_dx)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":105 - * child_j = int((cy - child_leftedges[1])/child_dx) - * child_k = int((cz - child_leftedges[2])/child_dx) - * s = RecurseOctreeDepthFirst(child_i, child_j, child_k, 2, 2, 2, # <<<<<<<<<<<<<< - * curpos, ci, output, refined, grids) - * return s - */ - __pyx_t_17 = __Pyx_GetName(__pyx_m, __pyx_n_s_1); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_17); - __pyx_t_18 = PyInt_FromLong(__pyx_v_child_i); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_16 = PyInt_FromLong(__pyx_v_child_j); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_16); - __pyx_t_2 = PyInt_FromLong(__pyx_v_child_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":106 - * child_k = int((cz - child_leftedges[2])/child_dx) - * s = RecurseOctreeDepthFirst(child_i, child_j, child_k, 2, 2, 2, - * curpos, ci, output, refined, grids) # <<<<<<<<<<<<<< - * return s - * - */ - __pyx_t_37 = PyInt_FromLong(__pyx_v_ci); if (unlikely(!__pyx_t_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_37); - __pyx_t_38 = PyTuple_New(11); if (unlikely(!__pyx_t_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_38); - PyTuple_SET_ITEM(__pyx_t_38, 0, __pyx_t_18); - __Pyx_GIVEREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_38, 1, __pyx_t_16); - __Pyx_GIVEREF(__pyx_t_16); - PyTuple_SET_ITEM(__pyx_t_38, 2, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_INCREF(__pyx_int_2); - PyTuple_SET_ITEM(__pyx_t_38, 3, __pyx_int_2); - __Pyx_GIVEREF(__pyx_int_2); - __Pyx_INCREF(__pyx_int_2); - PyTuple_SET_ITEM(__pyx_t_38, 4, __pyx_int_2); - __Pyx_GIVEREF(__pyx_int_2); - __Pyx_INCREF(__pyx_int_2); - PyTuple_SET_ITEM(__pyx_t_38, 5, __pyx_int_2); - __Pyx_GIVEREF(__pyx_int_2); - __Pyx_INCREF(((PyObject *)__pyx_v_curpos)); - PyTuple_SET_ITEM(__pyx_t_38, 6, ((PyObject *)__pyx_v_curpos)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_curpos)); - PyTuple_SET_ITEM(__pyx_t_38, 7, __pyx_t_37); - __Pyx_GIVEREF(__pyx_t_37); - __Pyx_INCREF(((PyObject *)__pyx_v_output)); - PyTuple_SET_ITEM(__pyx_t_38, 8, ((PyObject *)__pyx_v_output)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_output)); - __Pyx_INCREF(((PyObject *)__pyx_v_refined)); - PyTuple_SET_ITEM(__pyx_t_38, 9, ((PyObject *)__pyx_v_refined)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_refined)); - __Pyx_INCREF(((PyObject *)__pyx_v_grids)); - PyTuple_SET_ITEM(__pyx_t_38, 10, ((PyObject *)__pyx_v_grids)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_grids)); - __pyx_t_18 = 0; - __pyx_t_16 = 0; - __pyx_t_2 = 0; - __pyx_t_37 = 0; - __pyx_t_37 = PyObject_Call(__pyx_t_17, __pyx_t_38, NULL); if (unlikely(!__pyx_t_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_37); - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_DECREF(__pyx_t_38); __pyx_t_38 = 0; - __Pyx_DECREF(__pyx_v_s); - __pyx_v_s = __pyx_t_37; - __pyx_t_37 = 0; - } - __pyx_L12:; - } - } - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":107 - * s = RecurseOctreeDepthFirst(child_i, child_j, child_k, 2, 2, 2, - * curpos, ci, output, refined, grids) - * return s # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_s); - __pyx_r = __pyx_v_s; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_16); - __Pyx_XDECREF(__pyx_t_17); - __Pyx_XDECREF(__pyx_t_18); - __Pyx_XDECREF(__pyx_t_37); - __Pyx_XDECREF(__pyx_t_38); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_leftedges); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_refined); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_child_leftedges); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dimensions); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_child_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fields); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.amr_utils.RecurseOctreeDepthFirst"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_leftedges); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_refined); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_child_leftedges); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dimensions); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_child_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fields); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output); - __pyx_L2:; - __Pyx_DECREF((PyObject *)__pyx_v_child_grid); - __Pyx_XDECREF((PyObject *)__pyx_v_grid); - __Pyx_XDECREF((PyObject *)__pyx_v_child_indices); - __Pyx_XDECREF((PyObject *)__pyx_v_dimensions); - __Pyx_XDECREF((PyObject *)__pyx_v_fields); - __Pyx_XDECREF((PyObject *)__pyx_v_leftedges); - __Pyx_DECREF((PyObject *)__pyx_v_child_leftedges); - __Pyx_DECREF(__pyx_v_s); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":110 - * - * @cython.boundscheck(False) - * def RecurseOctreeByLevels(int i_i, int j_i, int k_i, # <<<<<<<<<<<<<< - * int i_f, int j_f, int k_f, - * np.ndarray[np.int32_t, ndim=1] curpos, - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_RecurseOctreeByLevels(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_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; - int __pyx_v_i_f; - int __pyx_v_j_f; - int __pyx_v_k_f; - PyArrayObject *__pyx_v_curpos = 0; - int __pyx_v_gi; - PyArrayObject *__pyx_v_output = 0; - PyArrayObject *__pyx_v_genealogy = 0; - PyArrayObject *__pyx_v_corners = 0; - struct __pyx_obj_2yt_9amr_utils_OctreeGridList *__pyx_v_grids = 0; - __pyx_t_5numpy_int32_t __pyx_v_i; - __pyx_t_5numpy_int32_t __pyx_v_i_off; - __pyx_t_5numpy_int32_t __pyx_v_j; - __pyx_t_5numpy_int32_t __pyx_v_j_off; - __pyx_t_5numpy_int32_t __pyx_v_k; - __pyx_t_5numpy_int32_t __pyx_v_k_off; - __pyx_t_5numpy_int32_t __pyx_v_ci; - __pyx_t_5numpy_int32_t __pyx_v_fi; - int __pyx_v_child_i; - int __pyx_v_child_j; - int __pyx_v_child_k; - struct __pyx_obj_2yt_9amr_utils_OctreeGrid *__pyx_v_child_grid; - struct __pyx_obj_2yt_9amr_utils_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; - PyArrayObject *__pyx_v_leftedges = 0; - __pyx_t_5numpy_float64_t __pyx_v_dx; - __pyx_t_5numpy_float64_t __pyx_v_child_dx; - PyArrayObject *__pyx_v_child_leftedges; - __pyx_t_5numpy_float64_t __pyx_v_cx; - __pyx_t_5numpy_float64_t __pyx_v_cy; - __pyx_t_5numpy_float64_t __pyx_v_cz; - int __pyx_v_cp; - PyObject *__pyx_v_s; - Py_buffer __pyx_bstruct_leftedges; - Py_ssize_t __pyx_bstride_0_leftedges = 0; - Py_ssize_t __pyx_bshape_0_leftedges = 0; - Py_buffer __pyx_bstruct_curpos; - Py_ssize_t __pyx_bstride_0_curpos = 0; - Py_ssize_t __pyx_bshape_0_curpos = 0; - Py_buffer __pyx_bstruct_child_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; - Py_ssize_t __pyx_bstride_2_child_indices = 0; - 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_corners; - Py_ssize_t __pyx_bstride_0_corners = 0; - Py_ssize_t __pyx_bstride_1_corners = 0; - Py_ssize_t __pyx_bshape_0_corners = 0; - Py_ssize_t __pyx_bshape_1_corners = 0; - Py_buffer __pyx_bstruct_fields; - Py_ssize_t __pyx_bstride_0_fields = 0; - Py_ssize_t __pyx_bstride_1_fields = 0; - Py_ssize_t __pyx_bstride_2_fields = 0; - Py_ssize_t __pyx_bstride_3_fields = 0; - Py_ssize_t __pyx_bshape_0_fields = 0; - Py_ssize_t __pyx_bshape_1_fields = 0; - Py_ssize_t __pyx_bshape_2_fields = 0; - Py_ssize_t __pyx_bshape_3_fields = 0; - Py_buffer __pyx_bstruct_output; - Py_ssize_t __pyx_bstride_0_output = 0; - Py_ssize_t __pyx_bstride_1_output = 0; - Py_ssize_t __pyx_bshape_0_output = 0; - Py_ssize_t __pyx_bshape_1_output = 0; - PyObject *__pyx_r = NULL; - long __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyArrayObject *__pyx_t_3 = NULL; - PyArrayObject *__pyx_t_4 = NULL; - PyArrayObject *__pyx_t_5 = NULL; - PyArrayObject *__pyx_t_6 = NULL; - __pyx_t_5numpy_float64_t __pyx_t_7; - int __pyx_t_8; - __pyx_t_5numpy_int32_t __pyx_t_9; - int __pyx_t_10; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - int __pyx_t_13; - __pyx_t_5numpy_int32_t __pyx_t_14; - long __pyx_t_15; - int __pyx_t_16; - __pyx_t_5numpy_int32_t __pyx_t_17; - long __pyx_t_18; - int __pyx_t_19; - int __pyx_t_20; - long __pyx_t_21; - int __pyx_t_22; - long __pyx_t_23; - int __pyx_t_24; - long __pyx_t_25; - int __pyx_t_26; - __pyx_t_5numpy_int32_t __pyx_t_27; - long __pyx_t_28; - npy_intp __pyx_t_29; - __pyx_t_5numpy_int32_t __pyx_t_30; - __pyx_t_5numpy_int32_t __pyx_t_31; - __pyx_t_5numpy_int32_t __pyx_t_32; - __pyx_t_5numpy_int32_t __pyx_t_33; - __pyx_t_5numpy_int32_t __pyx_t_34; - int __pyx_t_35; - __pyx_t_5numpy_int32_t __pyx_t_36; - __pyx_t_5numpy_int32_t __pyx_t_37; - __pyx_t_5numpy_int32_t __pyx_t_38; - long __pyx_t_39; - PyArrayObject *__pyx_t_40 = NULL; - int __pyx_t_41; - PyObject *__pyx_t_42 = NULL; - PyObject *__pyx_t_43 = NULL; - PyObject *__pyx_t_44 = NULL; - long __pyx_t_45; - long __pyx_t_46; - long __pyx_t_47; - long __pyx_t_48; - long __pyx_t_49; - long __pyx_t_50; - PyObject *__pyx_t_51 = NULL; - PyObject *__pyx_t_52 = NULL; - PyObject *__pyx_t_53 = NULL; - int __pyx_t_54; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__i_i,&__pyx_n_s__j_i,&__pyx_n_s__k_i,&__pyx_n_s__i_f,&__pyx_n_s__j_f,&__pyx_n_s__k_f,&__pyx_n_s__curpos,&__pyx_n_s__gi,&__pyx_n_s__output,&__pyx_n_s__genealogy,&__pyx_n_s__corners,&__pyx_n_s__grids,0}; - __Pyx_RefNannySetupContext("RecurseOctreeByLevels"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i_i); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__j_i); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("RecurseOctreeByLevels", 1, 12, 12, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__k_i); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("RecurseOctreeByLevels", 1, 12, 12, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i_f); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("RecurseOctreeByLevels", 1, 12, 12, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__j_f); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("RecurseOctreeByLevels", 1, 12, 12, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__k_f); - if (likely(values[5])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("RecurseOctreeByLevels", 1, 12, 12, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 6: - values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__curpos); - if (likely(values[6])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("RecurseOctreeByLevels", 1, 12, 12, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 7: - values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__gi); - if (likely(values[7])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("RecurseOctreeByLevels", 1, 12, 12, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 8: - values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__output); - if (likely(values[8])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("RecurseOctreeByLevels", 1, 12, 12, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 9: - values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__genealogy); - if (likely(values[9])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("RecurseOctreeByLevels", 1, 12, 12, 9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 10: - values[10] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__corners); - if (likely(values[10])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("RecurseOctreeByLevels", 1, 12, 12, 10); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 11: - values[11] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grids); - if (likely(values[11])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("RecurseOctreeByLevels", 1, 12, 12, 11); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "RecurseOctreeByLevels") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_i_i = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_i_i == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_j_i = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_j_i == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_k_i = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_k_i == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_i_f = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_i_f == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_j_f = __Pyx_PyInt_AsInt(values[4]); if (unlikely((__pyx_v_j_f == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_k_f = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_k_f == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_curpos = ((PyArrayObject *)values[6]); - __pyx_v_gi = __Pyx_PyInt_AsInt(values[7]); if (unlikely((__pyx_v_gi == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_output = ((PyArrayObject *)values[8]); - __pyx_v_genealogy = ((PyArrayObject *)values[9]); - __pyx_v_corners = ((PyArrayObject *)values[10]); - __pyx_v_grids = ((struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)values[11]); - } else if (PyTuple_GET_SIZE(__pyx_args) != 12) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_i_i = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_i_i == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_j_i = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_j_i == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_k_i = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_k_i == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_i_f = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_i_f == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_j_f = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_j_f == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_k_f = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_k_f == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_curpos = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 6)); - __pyx_v_gi = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 7)); if (unlikely((__pyx_v_gi == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_output = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 8)); - __pyx_v_genealogy = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 9)); - __pyx_v_corners = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 10)); - __pyx_v_grids = ((struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)PyTuple_GET_ITEM(__pyx_args, 11)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("RecurseOctreeByLevels", 1, 12, 12, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.RecurseOctreeByLevels"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_v_child_grid = ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_child_leftedges = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_s = Py_None; __Pyx_INCREF(Py_None); - __pyx_bstruct_child_indices.buf = NULL; - __pyx_bstruct_dimensions.buf = NULL; - __pyx_bstruct_fields.buf = NULL; - __pyx_bstruct_leftedges.buf = NULL; - __pyx_bstruct_child_leftedges.buf = NULL; - __pyx_bstruct_curpos.buf = NULL; - __pyx_bstruct_output.buf = NULL; - __pyx_bstruct_genealogy.buf = NULL; - __pyx_bstruct_corners.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_curpos), __pyx_ptype_5numpy_ndarray, 1, "curpos", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_output), __pyx_ptype_5numpy_ndarray, 1, "output", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_genealogy), __pyx_ptype_5numpy_ndarray, 1, "genealogy", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_corners), __pyx_ptype_5numpy_ndarray, 1, "corners", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grids), __pyx_ptype_2yt_9amr_utils_OctreeGridList, 1, "grids", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_curpos, (PyObject*)__pyx_v_curpos, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_curpos = __pyx_bstruct_curpos.strides[0]; - __pyx_bshape_0_curpos = __pyx_bstruct_curpos.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_output, (PyObject*)__pyx_v_output, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_output = __pyx_bstruct_output.strides[0]; __pyx_bstride_1_output = __pyx_bstruct_output.strides[1]; - __pyx_bshape_0_output = __pyx_bstruct_output.shape[0]; __pyx_bshape_1_output = __pyx_bstruct_output.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_genealogy, (PyObject*)__pyx_v_genealogy, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_genealogy = __pyx_bstruct_genealogy.strides[0]; __pyx_bstride_1_genealogy = __pyx_bstruct_genealogy.strides[1]; - __pyx_bshape_0_genealogy = __pyx_bstruct_genealogy.shape[0]; __pyx_bshape_1_genealogy = __pyx_bstruct_genealogy.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_corners, (PyObject*)__pyx_v_corners, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_corners = __pyx_bstruct_corners.strides[0]; __pyx_bstride_1_corners = __pyx_bstruct_corners.strides[1]; - __pyx_bshape_0_corners = __pyx_bstruct_corners.shape[0]; __pyx_bshape_1_corners = __pyx_bstruct_corners.shape[1]; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":121 - * 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 - */ - __pyx_t_1 = (__pyx_v_gi - 1); - __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_grids), __pyx_t_1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_2yt_9amr_utils_OctreeGrid))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_grid = ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":122 - * 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/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":123 - * 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 (!(likely(((__pyx_v_grid->child_indices) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_grid->child_indices, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = ((PyArrayObject *)__pyx_v_grid->child_indices); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_child_indices, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) { - __pyx_v_child_indices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_child_indices.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_child_indices = __pyx_bstruct_child_indices.strides[0]; __pyx_bstride_1_child_indices = __pyx_bstruct_child_indices.strides[1]; __pyx_bstride_2_child_indices = __pyx_bstruct_child_indices.strides[2]; - __pyx_bshape_0_child_indices = __pyx_bstruct_child_indices.shape[0]; __pyx_bshape_1_child_indices = __pyx_bstruct_child_indices.shape[1]; __pyx_bshape_2_child_indices = __pyx_bstruct_child_indices.shape[2]; - } - } - __pyx_t_3 = 0; - __Pyx_INCREF(__pyx_v_grid->child_indices); - __pyx_v_child_indices = ((PyArrayObject *)__pyx_v_grid->child_indices); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":124 - * 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 (!(likely(((__pyx_v_grid->dimensions) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_grid->dimensions, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = ((PyArrayObject *)__pyx_v_grid->dimensions); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dimensions, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_dimensions = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_dimensions.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_dimensions = __pyx_bstruct_dimensions.strides[0]; - __pyx_bshape_0_dimensions = __pyx_bstruct_dimensions.shape[0]; - } - } - __pyx_t_4 = 0; - __Pyx_INCREF(__pyx_v_grid->dimensions); - __pyx_v_dimensions = ((PyArrayObject *)__pyx_v_grid->dimensions); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":125 - * 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.float64_t dx = grid.dx[0] - */ - if (!(likely(((__pyx_v_grid->fields) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_grid->fields, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = ((PyArrayObject *)__pyx_v_grid->fields); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_fields, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) { - __pyx_v_fields = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_fields.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_fields = __pyx_bstruct_fields.strides[0]; __pyx_bstride_1_fields = __pyx_bstruct_fields.strides[1]; __pyx_bstride_2_fields = __pyx_bstruct_fields.strides[2]; __pyx_bstride_3_fields = __pyx_bstruct_fields.strides[3]; - __pyx_bshape_0_fields = __pyx_bstruct_fields.shape[0]; __pyx_bshape_1_fields = __pyx_bstruct_fields.shape[1]; __pyx_bshape_2_fields = __pyx_bstruct_fields.shape[2]; __pyx_bshape_3_fields = __pyx_bstruct_fields.shape[3]; - } - } - __pyx_t_5 = 0; - __Pyx_INCREF(__pyx_v_grid->fields); - __pyx_v_fields = ((PyArrayObject *)__pyx_v_grid->fields); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":126 - * 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.float64_t dx = grid.dx[0] - * cdef np.float64_t child_dx - */ - if (!(likely(((__pyx_v_grid->left_edges) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_grid->left_edges, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = ((PyArrayObject *)__pyx_v_grid->left_edges); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_leftedges, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_leftedges = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_leftedges.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_leftedges = __pyx_bstruct_leftedges.strides[0]; - __pyx_bshape_0_leftedges = __pyx_bstruct_leftedges.shape[0]; - } - } - __pyx_t_6 = 0; - __Pyx_INCREF(__pyx_v_grid->left_edges); - __pyx_v_leftedges = ((PyArrayObject *)__pyx_v_grid->left_edges); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":127 - * 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.float64_t dx = grid.dx[0] # <<<<<<<<<<<<<< - * cdef np.float64_t child_dx - * cdef np.ndarray[np.float64_t, ndim=1] child_leftedges - */ - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_grid->dx, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_7 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_dx = __pyx_t_7; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":132 - * cdef np.float64_t cx, cy, cz - * cdef int cp - * for i_off in range(i_f): # <<<<<<<<<<<<<< - * i = i_off + i_i - * cx = (leftedges[0] + i*dx) - */ - __pyx_t_8 = __pyx_v_i_f; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i_off = __pyx_t_9; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":133 - * cdef int cp - * for i_off in range(i_f): - * i = i_off + i_i # <<<<<<<<<<<<<< - * cx = (leftedges[0] + i*dx) - * if i_f > 2: print k, cz - */ - __pyx_v_i = (__pyx_v_i_off + __pyx_v_i_i); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":134 - * for i_off in range(i_f): - * i = i_off + i_i - * cx = (leftedges[0] + i*dx) # <<<<<<<<<<<<<< - * if i_f > 2: print k, cz - * for j_off in range(j_f): - */ - __pyx_t_1 = 0; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_bshape_0_leftedges; - __pyx_v_cx = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_leftedges.buf, __pyx_t_1, __pyx_bstride_0_leftedges)) + (__pyx_v_i * __pyx_v_dx)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":135 - * i = i_off + i_i - * cx = (leftedges[0] + i*dx) - * if i_f > 2: print k, cz # <<<<<<<<<<<<<< - * for j_off in range(j_f): - * j = j_off + j_i - */ - __pyx_t_10 = (__pyx_v_i_f > 2); - if (__pyx_t_10) { - __pyx_t_2 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_11 = PyFloat_FromDouble(__pyx_v_cz); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_11); - __Pyx_GIVEREF(__pyx_t_11); - __pyx_t_2 = 0; - __pyx_t_11 = 0; - if (__Pyx_Print(0, __pyx_t_12, 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - goto __pyx_L8; - } - __pyx_L8:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":136 - * cx = (leftedges[0] + i*dx) - * if i_f > 2: print k, cz - * for j_off in range(j_f): # <<<<<<<<<<<<<< - * j = j_off + j_i - * cy = (leftedges[1] + j*dx) - */ - __pyx_t_13 = __pyx_v_j_f; - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { - __pyx_v_j_off = __pyx_t_14; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":137 - * if i_f > 2: print k, cz - * for j_off in range(j_f): - * j = j_off + j_i # <<<<<<<<<<<<<< - * cy = (leftedges[1] + j*dx) - * for k_off in range(k_f): - */ - __pyx_v_j = (__pyx_v_j_off + __pyx_v_j_i); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":138 - * for j_off in range(j_f): - * j = j_off + j_i - * cy = (leftedges[1] + j*dx) # <<<<<<<<<<<<<< - * for k_off in range(k_f): - * k = k_off + k_i - */ - __pyx_t_15 = 1; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_0_leftedges; - __pyx_v_cy = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_leftedges.buf, __pyx_t_15, __pyx_bstride_0_leftedges)) + (__pyx_v_j * __pyx_v_dx)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":139 - * j = j_off + j_i - * cy = (leftedges[1] + j*dx) - * for k_off in range(k_f): # <<<<<<<<<<<<<< - * k = k_off + k_i - * cz = (leftedges[2] + k*dx) - */ - __pyx_t_16 = __pyx_v_k_f; - for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { - __pyx_v_k_off = __pyx_t_17; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":140 - * cy = (leftedges[1] + j*dx) - * for k_off in range(k_f): - * k = k_off + k_i # <<<<<<<<<<<<<< - * cz = (leftedges[2] + k*dx) - * cp = curpos[level] - */ - __pyx_v_k = (__pyx_v_k_off + __pyx_v_k_i); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":141 - * for k_off in range(k_f): - * k = k_off + k_i - * cz = (leftedges[2] + k*dx) # <<<<<<<<<<<<<< - * cp = curpos[level] - * corners[cp, 0] = cx - */ - __pyx_t_18 = 2; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_bshape_0_leftedges; - __pyx_v_cz = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_leftedges.buf, __pyx_t_18, __pyx_bstride_0_leftedges)) + (__pyx_v_k * __pyx_v_dx)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":142 - * k = k_off + k_i - * cz = (leftedges[2] + k*dx) - * cp = curpos[level] # <<<<<<<<<<<<<< - * corners[cp, 0] = cx - * corners[cp, 1] = cy - */ - __pyx_t_19 = __pyx_v_level; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_bshape_0_curpos; - __pyx_v_cp = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_curpos.buf, __pyx_t_19, __pyx_bstride_0_curpos)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":143 - * cz = (leftedges[2] + k*dx) - * cp = curpos[level] - * corners[cp, 0] = cx # <<<<<<<<<<<<<< - * corners[cp, 1] = cy - * corners[cp, 2] = cz - */ - __pyx_t_20 = __pyx_v_cp; - __pyx_t_21 = 0; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_bshape_0_corners; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_bshape_1_corners; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_corners.buf, __pyx_t_20, __pyx_bstride_0_corners, __pyx_t_21, __pyx_bstride_1_corners) = __pyx_v_cx; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":144 - * cp = curpos[level] - * corners[cp, 0] = cx - * corners[cp, 1] = cy # <<<<<<<<<<<<<< - * corners[cp, 2] = cz - * genealogy[curpos[level], 2] = level - */ - __pyx_t_22 = __pyx_v_cp; - __pyx_t_23 = 1; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_bshape_0_corners; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_bshape_1_corners; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_corners.buf, __pyx_t_22, __pyx_bstride_0_corners, __pyx_t_23, __pyx_bstride_1_corners) = __pyx_v_cy; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":145 - * corners[cp, 0] = cx - * corners[cp, 1] = cy - * corners[cp, 2] = cz # <<<<<<<<<<<<<< - * genealogy[curpos[level], 2] = level - * # always output data - */ - __pyx_t_24 = __pyx_v_cp; - __pyx_t_25 = 2; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_bshape_0_corners; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_bshape_1_corners; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_corners.buf, __pyx_t_24, __pyx_bstride_0_corners, __pyx_t_25, __pyx_bstride_1_corners) = __pyx_v_cz; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":146 - * corners[cp, 1] = cy - * corners[cp, 2] = cz - * genealogy[curpos[level], 2] = level # <<<<<<<<<<<<<< - * # always output data - * for fi in range(fields.shape[0]): - */ - __pyx_t_26 = __pyx_v_level; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_bshape_0_curpos; - __pyx_t_27 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_curpos.buf, __pyx_t_26, __pyx_bstride_0_curpos)); - __pyx_t_28 = 2; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_bshape_0_genealogy; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_bshape_1_genealogy; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_genealogy.buf, __pyx_t_27, __pyx_bstride_0_genealogy, __pyx_t_28, __pyx_bstride_1_genealogy) = __pyx_v_level; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":148 - * genealogy[curpos[level], 2] = level - * # always output data - * for fi in range(fields.shape[0]): # <<<<<<<<<<<<<< - * output[cp,fi] = fields[fi,i,j,k] - * ci = child_indices[i,j,k] - */ - __pyx_t_29 = (__pyx_v_fields->dimensions[0]); - for (__pyx_t_30 = 0; __pyx_t_30 < __pyx_t_29; __pyx_t_30+=1) { - __pyx_v_fi = __pyx_t_30; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":149 - * # always output data - * for fi in range(fields.shape[0]): - * output[cp,fi] = fields[fi,i,j,k] # <<<<<<<<<<<<<< - * ci = child_indices[i,j,k] - * if ci > -1: - */ - __pyx_t_31 = __pyx_v_fi; - __pyx_t_32 = __pyx_v_i; - __pyx_t_33 = __pyx_v_j; - __pyx_t_34 = __pyx_v_k; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_bshape_0_fields; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_bshape_1_fields; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_bshape_2_fields; - if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_bshape_3_fields; - __pyx_t_35 = __pyx_v_cp; - __pyx_t_36 = __pyx_v_fi; - if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_bshape_0_output; - if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_bshape_1_output; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_output.buf, __pyx_t_35, __pyx_bstride_0_output, __pyx_t_36, __pyx_bstride_1_output) = (*__Pyx_BufPtrStrided4d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_fields.buf, __pyx_t_31, __pyx_bstride_0_fields, __pyx_t_32, __pyx_bstride_1_fields, __pyx_t_33, __pyx_bstride_2_fields, __pyx_t_34, __pyx_bstride_3_fields)); - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":150 - * for fi in range(fields.shape[0]): - * output[cp,fi] = fields[fi,i,j,k] - * ci = child_indices[i,j,k] # <<<<<<<<<<<<<< - * if ci > -1: - * child_grid = grids[ci-1] - */ - __pyx_t_30 = __pyx_v_i; - __pyx_t_37 = __pyx_v_j; - __pyx_t_38 = __pyx_v_k; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_bshape_0_child_indices; - if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_bshape_1_child_indices; - if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_bshape_2_child_indices; - __pyx_v_ci = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_child_indices.buf, __pyx_t_30, __pyx_bstride_0_child_indices, __pyx_t_37, __pyx_bstride_1_child_indices, __pyx_t_38, __pyx_bstride_2_child_indices)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":151 - * output[cp,fi] = fields[fi,i,j,k] - * ci = child_indices[i,j,k] - * if ci > -1: # <<<<<<<<<<<<<< - * child_grid = grids[ci-1] - * child_dx = child_grid.dx[0] - */ - __pyx_t_10 = (__pyx_v_ci > -1); - if (__pyx_t_10) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":152 - * ci = child_indices[i,j,k] - * if ci > -1: - * child_grid = grids[ci-1] # <<<<<<<<<<<<<< - * child_dx = child_grid.dx[0] - * child_leftedges = child_grid.left_edges - */ - __pyx_t_39 = (__pyx_v_ci - 1); - __pyx_t_12 = __Pyx_GetItemInt(((PyObject *)__pyx_v_grids), __pyx_t_39, sizeof(long), PyInt_FromLong); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_2yt_9amr_utils_OctreeGrid))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_child_grid)); - __pyx_v_child_grid = ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_t_12); - __pyx_t_12 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":153 - * if ci > -1: - * child_grid = grids[ci-1] - * child_dx = child_grid.dx[0] # <<<<<<<<<<<<<< - * child_leftedges = child_grid.left_edges - * child_i = int((cx-child_leftedges[0])/child_dx) - */ - __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_child_grid->dx, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_7 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_v_child_dx = __pyx_t_7; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":154 - * child_grid = grids[ci-1] - * child_dx = child_grid.dx[0] - * child_leftedges = child_grid.left_edges # <<<<<<<<<<<<<< - * child_i = int((cx-child_leftedges[0])/child_dx) - * child_j = int((cy-child_leftedges[1])/child_dx) - */ - if (!(likely(((__pyx_v_child_grid->left_edges) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_child_grid->left_edges, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_40 = ((PyArrayObject *)__pyx_v_child_grid->left_edges); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_child_leftedges); - __pyx_t_41 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_child_leftedges, (PyObject*)__pyx_t_40, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_41 < 0)) { - PyErr_Fetch(&__pyx_t_42, &__pyx_t_43, &__pyx_t_44); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_child_leftedges, (PyObject*)__pyx_v_child_leftedges, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_42); Py_XDECREF(__pyx_t_43); Py_XDECREF(__pyx_t_44); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_42, __pyx_t_43, __pyx_t_44); - } - } - __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_41 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_40 = 0; - __Pyx_INCREF(__pyx_v_child_grid->left_edges); - __Pyx_DECREF(((PyObject *)__pyx_v_child_leftedges)); - __pyx_v_child_leftedges = ((PyArrayObject *)__pyx_v_child_grid->left_edges); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":155 - * child_dx = child_grid.dx[0] - * child_leftedges = child_grid.left_edges - * child_i = int((cx-child_leftedges[0])/child_dx) # <<<<<<<<<<<<<< - * child_j = int((cy-child_leftedges[1])/child_dx) - * child_k = int((cz-child_leftedges[2])/child_dx) - */ - __pyx_t_39 = 0; - if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_bshape_0_child_leftedges; - __pyx_t_7 = (__pyx_v_cx - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_child_leftedges.buf, __pyx_t_39, __pyx_bstride_0_child_leftedges))); - if (unlikely(__pyx_v_child_dx == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_child_i = ((int)(__pyx_t_7 / __pyx_v_child_dx)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":156 - * child_leftedges = child_grid.left_edges - * child_i = int((cx-child_leftedges[0])/child_dx) - * child_j = int((cy-child_leftedges[1])/child_dx) # <<<<<<<<<<<<<< - * child_k = int((cz-child_leftedges[2])/child_dx) - * # set current child id to id of next cell to examine - */ - __pyx_t_45 = 1; - if (__pyx_t_45 < 0) __pyx_t_45 += __pyx_bshape_0_child_leftedges; - __pyx_t_7 = (__pyx_v_cy - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_child_leftedges.buf, __pyx_t_45, __pyx_bstride_0_child_leftedges))); - if (unlikely(__pyx_v_child_dx == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_child_j = ((int)(__pyx_t_7 / __pyx_v_child_dx)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":157 - * child_i = int((cx-child_leftedges[0])/child_dx) - * child_j = int((cy-child_leftedges[1])/child_dx) - * child_k = int((cz-child_leftedges[2])/child_dx) # <<<<<<<<<<<<<< - * # set current child id to id of next cell to examine - * genealogy[cp, 0] = curpos[level+1] - */ - __pyx_t_46 = 2; - if (__pyx_t_46 < 0) __pyx_t_46 += __pyx_bshape_0_child_leftedges; - __pyx_t_7 = (__pyx_v_cz - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_child_leftedges.buf, __pyx_t_46, __pyx_bstride_0_child_leftedges))); - if (unlikely(__pyx_v_child_dx == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_child_k = ((int)(__pyx_t_7 / __pyx_v_child_dx)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":159 - * child_k = int((cz-child_leftedges[2])/child_dx) - * # set current child id to id of next cell to examine - * genealogy[cp, 0] = curpos[level+1] # <<<<<<<<<<<<<< - * # set next parent id to id of current cell - * genealogy[curpos[level+1]:curpos[level+1]+8, 1] = cp - */ - __pyx_t_47 = (__pyx_v_level + 1); - if (__pyx_t_47 < 0) __pyx_t_47 += __pyx_bshape_0_curpos; - __pyx_t_41 = __pyx_v_cp; - __pyx_t_48 = 0; - if (__pyx_t_41 < 0) __pyx_t_41 += __pyx_bshape_0_genealogy; - if (__pyx_t_48 < 0) __pyx_t_48 += __pyx_bshape_1_genealogy; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_genealogy.buf, __pyx_t_41, __pyx_bstride_0_genealogy, __pyx_t_48, __pyx_bstride_1_genealogy) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_curpos.buf, __pyx_t_47, __pyx_bstride_0_curpos)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":161 - * genealogy[cp, 0] = curpos[level+1] - * # set next parent id to id of current cell - * genealogy[curpos[level+1]:curpos[level+1]+8, 1] = cp # <<<<<<<<<<<<<< - * s = RecurseOctreeByLevels(child_i, child_j, child_k, 2, 2, 2, - * curpos, ci, output, genealogy, - */ - __pyx_t_12 = PyInt_FromLong(__pyx_v_cp); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_49 = (__pyx_v_level + 1); - if (__pyx_t_49 < 0) __pyx_t_49 += __pyx_bshape_0_curpos; - __pyx_t_11 = __Pyx_PyInt_to_py_npy_int32((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_curpos.buf, __pyx_t_49, __pyx_bstride_0_curpos))); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_50 = (__pyx_v_level + 1); - if (__pyx_t_50 < 0) __pyx_t_50 += __pyx_bshape_0_curpos; - __pyx_t_2 = PyInt_FromLong(((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_curpos.buf, __pyx_t_50, __pyx_bstride_0_curpos)) + 8)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_51 = PySlice_New(__pyx_t_11, __pyx_t_2, Py_None); if (unlikely(!__pyx_t_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_51); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_51); - __Pyx_GIVEREF(__pyx_t_51); - __Pyx_INCREF(__pyx_int_1); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_1); - __Pyx_GIVEREF(__pyx_int_1); - __pyx_t_51 = 0; - if (PyObject_SetItem(((PyObject *)__pyx_v_genealogy), __pyx_t_2, __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":162 - * # set next parent id to id of current cell - * genealogy[curpos[level+1]:curpos[level+1]+8, 1] = cp - * s = RecurseOctreeByLevels(child_i, child_j, child_k, 2, 2, 2, # <<<<<<<<<<<<<< - * curpos, ci, output, genealogy, - * corners, grids) - */ - __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s_2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_2 = PyInt_FromLong(__pyx_v_child_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_51 = PyInt_FromLong(__pyx_v_child_j); if (unlikely(!__pyx_t_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_51); - __pyx_t_11 = PyInt_FromLong(__pyx_v_child_k); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":163 - * genealogy[curpos[level+1]:curpos[level+1]+8, 1] = cp - * s = RecurseOctreeByLevels(child_i, child_j, child_k, 2, 2, 2, - * curpos, ci, output, genealogy, # <<<<<<<<<<<<<< - * corners, grids) - * curpos[level] += 1 - */ - __pyx_t_52 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_ci); if (unlikely(!__pyx_t_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_52); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":164 - * s = RecurseOctreeByLevels(child_i, child_j, child_k, 2, 2, 2, - * curpos, ci, output, genealogy, - * corners, grids) # <<<<<<<<<<<<<< - * curpos[level] += 1 - * return s - */ - __pyx_t_53 = PyTuple_New(12); if (unlikely(!__pyx_t_53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_53); - PyTuple_SET_ITEM(__pyx_t_53, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_53, 1, __pyx_t_51); - __Pyx_GIVEREF(__pyx_t_51); - PyTuple_SET_ITEM(__pyx_t_53, 2, __pyx_t_11); - __Pyx_GIVEREF(__pyx_t_11); - __Pyx_INCREF(__pyx_int_2); - PyTuple_SET_ITEM(__pyx_t_53, 3, __pyx_int_2); - __Pyx_GIVEREF(__pyx_int_2); - __Pyx_INCREF(__pyx_int_2); - PyTuple_SET_ITEM(__pyx_t_53, 4, __pyx_int_2); - __Pyx_GIVEREF(__pyx_int_2); - __Pyx_INCREF(__pyx_int_2); - PyTuple_SET_ITEM(__pyx_t_53, 5, __pyx_int_2); - __Pyx_GIVEREF(__pyx_int_2); - __Pyx_INCREF(((PyObject *)__pyx_v_curpos)); - PyTuple_SET_ITEM(__pyx_t_53, 6, ((PyObject *)__pyx_v_curpos)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_curpos)); - PyTuple_SET_ITEM(__pyx_t_53, 7, __pyx_t_52); - __Pyx_GIVEREF(__pyx_t_52); - __Pyx_INCREF(((PyObject *)__pyx_v_output)); - PyTuple_SET_ITEM(__pyx_t_53, 8, ((PyObject *)__pyx_v_output)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_output)); - __Pyx_INCREF(((PyObject *)__pyx_v_genealogy)); - PyTuple_SET_ITEM(__pyx_t_53, 9, ((PyObject *)__pyx_v_genealogy)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_genealogy)); - __Pyx_INCREF(((PyObject *)__pyx_v_corners)); - PyTuple_SET_ITEM(__pyx_t_53, 10, ((PyObject *)__pyx_v_corners)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_corners)); - __Pyx_INCREF(((PyObject *)__pyx_v_grids)); - PyTuple_SET_ITEM(__pyx_t_53, 11, ((PyObject *)__pyx_v_grids)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_grids)); - __pyx_t_2 = 0; - __pyx_t_51 = 0; - __pyx_t_11 = 0; - __pyx_t_52 = 0; - __pyx_t_52 = PyObject_Call(__pyx_t_12, __pyx_t_53, NULL); if (unlikely(!__pyx_t_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_52); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_53); __pyx_t_53 = 0; - __Pyx_DECREF(__pyx_v_s); - __pyx_v_s = __pyx_t_52; - __pyx_t_52 = 0; - goto __pyx_L15; - } - __pyx_L15:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":165 - * curpos, ci, output, genealogy, - * corners, grids) - * curpos[level] += 1 # <<<<<<<<<<<<<< - * return s - * - */ - __pyx_t_54 = __pyx_v_level; - if (__pyx_t_54 < 0) __pyx_t_54 += __pyx_bshape_0_curpos; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_curpos.buf, __pyx_t_54, __pyx_bstride_0_curpos) += 1; - } - } - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":166 - * corners, grids) - * curpos[level] += 1 - * return s # <<<<<<<<<<<<<< - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_s); - __pyx_r = __pyx_v_s; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_XDECREF(__pyx_t_51); - __Pyx_XDECREF(__pyx_t_52); - __Pyx_XDECREF(__pyx_t_53); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_leftedges); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_curpos); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_child_leftedges); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dimensions); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_child_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_genealogy); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_corners); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fields); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.amr_utils.RecurseOctreeByLevels"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_leftedges); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_curpos); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_child_leftedges); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dimensions); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_child_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_genealogy); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_corners); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fields); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output); - __pyx_L2:; - __Pyx_DECREF((PyObject *)__pyx_v_child_grid); - __Pyx_XDECREF((PyObject *)__pyx_v_grid); - __Pyx_XDECREF((PyObject *)__pyx_v_child_indices); - __Pyx_XDECREF((PyObject *)__pyx_v_dimensions); - __Pyx_XDECREF((PyObject *)__pyx_v_fields); - __Pyx_XDECREF((PyObject *)__pyx_v_leftedges); - __Pyx_DECREF((PyObject *)__pyx_v_child_leftedges); - __Pyx_DECREF(__pyx_v_s); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":31 - * - * @cython.boundscheck(False) - * def UnilinearlyInterpolate(np.ndarray[np.float64_t, ndim=1] table, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t, ndim=1] x_vals, - * np.ndarray[np.float64_t, ndim=1] x_bins, - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_UnilinearlyInterpolate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_UnilinearlyInterpolate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_table = 0; - PyArrayObject *__pyx_v_x_vals = 0; - PyArrayObject *__pyx_v_x_bins = 0; - PyArrayObject *__pyx_v_x_is = 0; - PyArrayObject *__pyx_v_output = 0; - double __pyx_v_x; - double __pyx_v_xp; - double __pyx_v_xm; - int __pyx_v_i; - int __pyx_v_x_i; - PyObject *__pyx_v_dx_inv; - Py_buffer __pyx_bstruct_x_is; - Py_ssize_t __pyx_bstride_0_x_is = 0; - Py_ssize_t __pyx_bshape_0_x_is = 0; - Py_buffer __pyx_bstruct_output; - Py_ssize_t __pyx_bstride_0_output = 0; - Py_ssize_t __pyx_bshape_0_output = 0; - Py_buffer __pyx_bstruct_x_vals; - Py_ssize_t __pyx_bstride_0_x_vals = 0; - Py_ssize_t __pyx_bshape_0_x_vals = 0; - Py_buffer __pyx_bstruct_table; - Py_ssize_t __pyx_bstride_0_table = 0; - Py_ssize_t __pyx_bshape_0_table = 0; - Py_buffer __pyx_bstruct_x_bins; - Py_ssize_t __pyx_bstride_0_x_bins = 0; - Py_ssize_t __pyx_bshape_0_x_bins = 0; - PyObject *__pyx_r = NULL; - npy_intp __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - long __pyx_t_5; - int __pyx_t_6; - __pyx_t_5numpy_float64_t __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - double __pyx_t_11; - long __pyx_t_12; - int __pyx_t_13; - long __pyx_t_14; - int __pyx_t_15; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__table,&__pyx_n_s__x_vals,&__pyx_n_s__x_bins,&__pyx_n_s__x_is,&__pyx_n_s__output,0}; - __Pyx_RefNannySetupContext("UnilinearlyInterpolate"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[5] = {0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__table); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x_vals); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("UnilinearlyInterpolate", 1, 5, 5, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x_bins); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("UnilinearlyInterpolate", 1, 5, 5, 2); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x_is); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("UnilinearlyInterpolate", 1, 5, 5, 3); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__output); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("UnilinearlyInterpolate", 1, 5, 5, 4); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "UnilinearlyInterpolate") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_table = ((PyArrayObject *)values[0]); - __pyx_v_x_vals = ((PyArrayObject *)values[1]); - __pyx_v_x_bins = ((PyArrayObject *)values[2]); - __pyx_v_x_is = ((PyArrayObject *)values[3]); - __pyx_v_output = ((PyArrayObject *)values[4]); - } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_table = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_x_vals = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_x_bins = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_x_is = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); - __pyx_v_output = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("UnilinearlyInterpolate", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.UnilinearlyInterpolate"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_v_dx_inv = Py_None; __Pyx_INCREF(Py_None); - __pyx_bstruct_table.buf = NULL; - __pyx_bstruct_x_vals.buf = NULL; - __pyx_bstruct_x_bins.buf = NULL; - __pyx_bstruct_x_is.buf = NULL; - __pyx_bstruct_output.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_table), __pyx_ptype_5numpy_ndarray, 1, "table", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x_vals), __pyx_ptype_5numpy_ndarray, 1, "x_vals", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x_bins), __pyx_ptype_5numpy_ndarray, 1, "x_bins", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x_is), __pyx_ptype_5numpy_ndarray, 1, "x_is", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 34; __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[3]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_table, (PyObject*)__pyx_v_table, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_table = __pyx_bstruct_table.strides[0]; - __pyx_bshape_0_table = __pyx_bstruct_table.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x_vals, (PyObject*)__pyx_v_x_vals, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_x_vals = __pyx_bstruct_x_vals.strides[0]; - __pyx_bshape_0_x_vals = __pyx_bstruct_x_vals.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x_bins, (PyObject*)__pyx_v_x_bins, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_x_bins = __pyx_bstruct_x_bins.strides[0]; - __pyx_bshape_0_x_bins = __pyx_bstruct_x_bins.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x_is, (PyObject*)__pyx_v_x_is, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_x_is = __pyx_bstruct_x_is.strides[0]; - __pyx_bshape_0_x_is = __pyx_bstruct_x_is.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_output, (PyObject*)__pyx_v_output, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_output = __pyx_bstruct_output.strides[0]; - __pyx_bshape_0_output = __pyx_bstruct_output.shape[0]; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":38 - * cdef double x, xp, xm - * cdef int i, x_i, y_i - * for i in range(x_vals.shape[0]): # <<<<<<<<<<<<<< - * x_i = x_is[i] - * x = x_vals[i] - */ - __pyx_t_1 = (__pyx_v_x_vals->dimensions[0]); - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":39 - * cdef int i, x_i, y_i - * for i in range(x_vals.shape[0]): - * x_i = x_is[i] # <<<<<<<<<<<<<< - * x = x_vals[i] - * dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) - */ - __pyx_t_3 = __pyx_v_i; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_bshape_0_x_is; - __pyx_v_x_i = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_x_is.buf, __pyx_t_3, __pyx_bstride_0_x_is)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":40 - * for i in range(x_vals.shape[0]): - * x_i = x_is[i] - * x = x_vals[i] # <<<<<<<<<<<<<< - * dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) - * xp = (x - x_bins[x_i]) * dx_inv - */ - __pyx_t_4 = __pyx_v_i; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_bshape_0_x_vals; - __pyx_v_x = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x_vals.buf, __pyx_t_4, __pyx_bstride_0_x_vals)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":41 - * x_i = x_is[i] - * x = x_vals[i] - * dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) # <<<<<<<<<<<<<< - * xp = (x - x_bins[x_i]) * dx_inv - * xm = (x_bins[x_i+1] - x) * dx_inv - */ - __pyx_t_5 = (__pyx_v_x_i + 1); - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_bshape_0_x_bins; - __pyx_t_6 = __pyx_v_x_i; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_bshape_0_x_bins; - __pyx_t_7 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x_bins.buf, __pyx_t_5, __pyx_bstride_0_x_bins)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x_bins.buf, __pyx_t_6, __pyx_bstride_0_x_bins))); - if (unlikely(__pyx_t_7 == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_8 = PyFloat_FromDouble((1.0 / __pyx_t_7)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_v_dx_inv); - __pyx_v_dx_inv = __pyx_t_8; - __pyx_t_8 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":42 - * x = x_vals[i] - * dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) - * xp = (x - x_bins[x_i]) * dx_inv # <<<<<<<<<<<<<< - * xm = (x_bins[x_i+1] - x) * dx_inv - * output[i] = table[x_i ] * (xm) \ - */ - __pyx_t_9 = __pyx_v_x_i; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_bshape_0_x_bins; - __pyx_t_8 = PyFloat_FromDouble((__pyx_v_x - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x_bins.buf, __pyx_t_9, __pyx_bstride_0_x_bins)))); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_10 = PyNumber_Multiply(__pyx_t_8, __pyx_v_dx_inv); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_10); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_v_xp = __pyx_t_11; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":43 - * dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) - * xp = (x - x_bins[x_i]) * dx_inv - * xm = (x_bins[x_i+1] - x) * dx_inv # <<<<<<<<<<<<<< - * output[i] = table[x_i ] * (xm) \ - * + table[x_i+1] * (xp) - */ - __pyx_t_12 = (__pyx_v_x_i + 1); - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_bshape_0_x_bins; - __pyx_t_10 = PyFloat_FromDouble(((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x_bins.buf, __pyx_t_12, __pyx_bstride_0_x_bins)) - __pyx_v_x)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = PyNumber_Multiply(__pyx_t_10, __pyx_v_dx_inv); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_v_xm = __pyx_t_11; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":44 - * xp = (x - x_bins[x_i]) * dx_inv - * xm = (x_bins[x_i+1] - x) * dx_inv - * output[i] = table[x_i ] * (xm) \ # <<<<<<<<<<<<<< - * + table[x_i+1] * (xp) - * - */ - __pyx_t_13 = __pyx_v_x_i; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_bshape_0_table; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":45 - * xm = (x_bins[x_i+1] - x) * dx_inv - * output[i] = table[x_i ] * (xm) \ - * + table[x_i+1] * (xp) # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) - */ - __pyx_t_14 = (__pyx_v_x_i + 1); - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_0_table; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":44 - * xp = (x - x_bins[x_i]) * dx_inv - * xm = (x_bins[x_i+1] - x) * dx_inv - * output[i] = table[x_i ] * (xm) \ # <<<<<<<<<<<<<< - * + table[x_i+1] * (xp) - * - */ - __pyx_t_15 = __pyx_v_i; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_0_output; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_output.buf, __pyx_t_15, __pyx_bstride_0_output) = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_table.buf, __pyx_t_13, __pyx_bstride_0_table)) * __pyx_v_xm) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_table.buf, __pyx_t_14, __pyx_bstride_0_table)) * __pyx_v_xp)); - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_10); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_is); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_vals); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_table); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_bins); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.amr_utils.UnilinearlyInterpolate"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_is); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_vals); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_table); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_bins); - __pyx_L2:; - __Pyx_DECREF(__pyx_v_dx_inv); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":48 - * - * @cython.boundscheck(False) - * def BilinearlyInterpolate(np.ndarray[np.float64_t, ndim=2] table, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t, ndim=1] x_vals, - * np.ndarray[np.float64_t, ndim=1] y_vals, - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_BilinearlyInterpolate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_BilinearlyInterpolate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_table = 0; - PyArrayObject *__pyx_v_x_vals = 0; - PyArrayObject *__pyx_v_y_vals = 0; - PyArrayObject *__pyx_v_x_bins = 0; - PyArrayObject *__pyx_v_y_bins = 0; - PyArrayObject *__pyx_v_x_is = 0; - PyArrayObject *__pyx_v_y_is = 0; - PyArrayObject *__pyx_v_output = 0; - double __pyx_v_x; - double __pyx_v_xp; - double __pyx_v_xm; - double __pyx_v_y; - double __pyx_v_yp; - double __pyx_v_ym; - double __pyx_v_dx_inv; - double __pyx_v_dy_inv; - int __pyx_v_i; - int __pyx_v_x_i; - int __pyx_v_y_i; - Py_buffer __pyx_bstruct_y_vals; - Py_ssize_t __pyx_bstride_0_y_vals = 0; - Py_ssize_t __pyx_bshape_0_y_vals = 0; - Py_buffer __pyx_bstruct_output; - Py_ssize_t __pyx_bstride_0_output = 0; - Py_ssize_t __pyx_bshape_0_output = 0; - Py_buffer __pyx_bstruct_y_is; - Py_ssize_t __pyx_bstride_0_y_is = 0; - Py_ssize_t __pyx_bshape_0_y_is = 0; - Py_buffer __pyx_bstruct_y_bins; - Py_ssize_t __pyx_bstride_0_y_bins = 0; - Py_ssize_t __pyx_bshape_0_y_bins = 0; - Py_buffer __pyx_bstruct_x_is; - Py_ssize_t __pyx_bstride_0_x_is = 0; - Py_ssize_t __pyx_bshape_0_x_is = 0; - Py_buffer __pyx_bstruct_x_vals; - Py_ssize_t __pyx_bstride_0_x_vals = 0; - Py_ssize_t __pyx_bshape_0_x_vals = 0; - Py_buffer __pyx_bstruct_table; - Py_ssize_t __pyx_bstride_0_table = 0; - Py_ssize_t __pyx_bstride_1_table = 0; - Py_ssize_t __pyx_bshape_0_table = 0; - Py_ssize_t __pyx_bshape_1_table = 0; - Py_buffer __pyx_bstruct_x_bins; - Py_ssize_t __pyx_bstride_0_x_bins = 0; - Py_ssize_t __pyx_bshape_0_x_bins = 0; - PyObject *__pyx_r = NULL; - npy_intp __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - long __pyx_t_7; - int __pyx_t_8; - __pyx_t_5numpy_float64_t __pyx_t_9; - long __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; - long __pyx_t_14; - long __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - long __pyx_t_18; - int __pyx_t_19; - int __pyx_t_20; - long __pyx_t_21; - long __pyx_t_22; - long __pyx_t_23; - int __pyx_t_24; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__table,&__pyx_n_s__x_vals,&__pyx_n_s__y_vals,&__pyx_n_s__x_bins,&__pyx_n_s__y_bins,&__pyx_n_s__x_is,&__pyx_n_s__y_is,&__pyx_n_s__output,0}; - __Pyx_RefNannySetupContext("BilinearlyInterpolate"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[8] = {0,0,0,0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__table); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x_vals); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("BilinearlyInterpolate", 1, 8, 8, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y_vals); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("BilinearlyInterpolate", 1, 8, 8, 2); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x_bins); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("BilinearlyInterpolate", 1, 8, 8, 3); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y_bins); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("BilinearlyInterpolate", 1, 8, 8, 4); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x_is); - if (likely(values[5])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("BilinearlyInterpolate", 1, 8, 8, 5); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 6: - values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y_is); - if (likely(values[6])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("BilinearlyInterpolate", 1, 8, 8, 6); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 7: - values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__output); - if (likely(values[7])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("BilinearlyInterpolate", 1, 8, 8, 7); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "BilinearlyInterpolate") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_table = ((PyArrayObject *)values[0]); - __pyx_v_x_vals = ((PyArrayObject *)values[1]); - __pyx_v_y_vals = ((PyArrayObject *)values[2]); - __pyx_v_x_bins = ((PyArrayObject *)values[3]); - __pyx_v_y_bins = ((PyArrayObject *)values[4]); - __pyx_v_x_is = ((PyArrayObject *)values[5]); - __pyx_v_y_is = ((PyArrayObject *)values[6]); - __pyx_v_output = ((PyArrayObject *)values[7]); - } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_table = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_x_vals = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_y_vals = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_x_bins = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); - __pyx_v_y_bins = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); - __pyx_v_x_is = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 5)); - __pyx_v_y_is = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 6)); - __pyx_v_output = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 7)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("BilinearlyInterpolate", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.BilinearlyInterpolate"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_table.buf = NULL; - __pyx_bstruct_x_vals.buf = NULL; - __pyx_bstruct_y_vals.buf = NULL; - __pyx_bstruct_x_bins.buf = NULL; - __pyx_bstruct_y_bins.buf = NULL; - __pyx_bstruct_x_is.buf = NULL; - __pyx_bstruct_y_is.buf = NULL; - __pyx_bstruct_output.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_table), __pyx_ptype_5numpy_ndarray, 1, "table", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x_vals), __pyx_ptype_5numpy_ndarray, 1, "x_vals", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y_vals), __pyx_ptype_5numpy_ndarray, 1, "y_vals", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x_bins), __pyx_ptype_5numpy_ndarray, 1, "x_bins", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y_bins), __pyx_ptype_5numpy_ndarray, 1, "y_bins", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x_is), __pyx_ptype_5numpy_ndarray, 1, "x_is", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y_is), __pyx_ptype_5numpy_ndarray, 1, "y_is", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 54; __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[3]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_table, (PyObject*)__pyx_v_table, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_table = __pyx_bstruct_table.strides[0]; __pyx_bstride_1_table = __pyx_bstruct_table.strides[1]; - __pyx_bshape_0_table = __pyx_bstruct_table.shape[0]; __pyx_bshape_1_table = __pyx_bstruct_table.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x_vals, (PyObject*)__pyx_v_x_vals, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_x_vals = __pyx_bstruct_x_vals.strides[0]; - __pyx_bshape_0_x_vals = __pyx_bstruct_x_vals.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_y_vals, (PyObject*)__pyx_v_y_vals, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_y_vals = __pyx_bstruct_y_vals.strides[0]; - __pyx_bshape_0_y_vals = __pyx_bstruct_y_vals.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x_bins, (PyObject*)__pyx_v_x_bins, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_x_bins = __pyx_bstruct_x_bins.strides[0]; - __pyx_bshape_0_x_bins = __pyx_bstruct_x_bins.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_y_bins, (PyObject*)__pyx_v_y_bins, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_y_bins = __pyx_bstruct_y_bins.strides[0]; - __pyx_bshape_0_y_bins = __pyx_bstruct_y_bins.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x_is, (PyObject*)__pyx_v_x_is, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_x_is = __pyx_bstruct_x_is.strides[0]; - __pyx_bshape_0_x_is = __pyx_bstruct_x_is.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_y_is, (PyObject*)__pyx_v_y_is, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_y_is = __pyx_bstruct_y_is.strides[0]; - __pyx_bshape_0_y_is = __pyx_bstruct_y_is.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_output, (PyObject*)__pyx_v_output, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_output = __pyx_bstruct_output.strides[0]; - __pyx_bshape_0_output = __pyx_bstruct_output.shape[0]; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":60 - * cdef double dx_inv, dy_inv - * cdef int i, x_i, y_i - * for i in range(x_vals.shape[0]): # <<<<<<<<<<<<<< - * x_i = x_is[i] - * y_i = y_is[i] - */ - __pyx_t_1 = (__pyx_v_x_vals->dimensions[0]); - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":61 - * cdef int i, x_i, y_i - * for i in range(x_vals.shape[0]): - * x_i = x_is[i] # <<<<<<<<<<<<<< - * y_i = y_is[i] - * x = x_vals[i] - */ - __pyx_t_3 = __pyx_v_i; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_bshape_0_x_is; - __pyx_v_x_i = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_x_is.buf, __pyx_t_3, __pyx_bstride_0_x_is)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":62 - * for i in range(x_vals.shape[0]): - * x_i = x_is[i] - * y_i = y_is[i] # <<<<<<<<<<<<<< - * x = x_vals[i] - * y = y_vals[i] - */ - __pyx_t_4 = __pyx_v_i; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_bshape_0_y_is; - __pyx_v_y_i = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_y_is.buf, __pyx_t_4, __pyx_bstride_0_y_is)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":63 - * x_i = x_is[i] - * y_i = y_is[i] - * x = x_vals[i] # <<<<<<<<<<<<<< - * y = y_vals[i] - * dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) - */ - __pyx_t_5 = __pyx_v_i; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_bshape_0_x_vals; - __pyx_v_x = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x_vals.buf, __pyx_t_5, __pyx_bstride_0_x_vals)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":64 - * y_i = y_is[i] - * x = x_vals[i] - * y = y_vals[i] # <<<<<<<<<<<<<< - * dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) - * dy_inv = 1.0 / (y_bins[y_i+1] - y_bins[y_i]) - */ - __pyx_t_6 = __pyx_v_i; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_bshape_0_y_vals; - __pyx_v_y = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y_vals.buf, __pyx_t_6, __pyx_bstride_0_y_vals)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":65 - * x = x_vals[i] - * y = y_vals[i] - * dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) # <<<<<<<<<<<<<< - * dy_inv = 1.0 / (y_bins[y_i+1] - y_bins[y_i]) - * xp = (x - x_bins[x_i]) * dx_inv - */ - __pyx_t_7 = (__pyx_v_x_i + 1); - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_bshape_0_x_bins; - __pyx_t_8 = __pyx_v_x_i; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_bshape_0_x_bins; - __pyx_t_9 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x_bins.buf, __pyx_t_7, __pyx_bstride_0_x_bins)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x_bins.buf, __pyx_t_8, __pyx_bstride_0_x_bins))); - if (unlikely(__pyx_t_9 == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_dx_inv = (1.0 / __pyx_t_9); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":66 - * y = y_vals[i] - * dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) - * dy_inv = 1.0 / (y_bins[y_i+1] - y_bins[y_i]) # <<<<<<<<<<<<<< - * xp = (x - x_bins[x_i]) * dx_inv - * yp = (y - y_bins[y_i]) * dy_inv - */ - __pyx_t_10 = (__pyx_v_y_i + 1); - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_bshape_0_y_bins; - __pyx_t_11 = __pyx_v_y_i; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_bshape_0_y_bins; - __pyx_t_9 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y_bins.buf, __pyx_t_10, __pyx_bstride_0_y_bins)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y_bins.buf, __pyx_t_11, __pyx_bstride_0_y_bins))); - if (unlikely(__pyx_t_9 == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_dy_inv = (1.0 / __pyx_t_9); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":67 - * dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) - * dy_inv = 1.0 / (y_bins[y_i+1] - y_bins[y_i]) - * xp = (x - x_bins[x_i]) * dx_inv # <<<<<<<<<<<<<< - * yp = (y - y_bins[y_i]) * dy_inv - * xm = (x_bins[x_i+1] - x) * dx_inv - */ - __pyx_t_12 = __pyx_v_x_i; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_bshape_0_x_bins; - __pyx_v_xp = ((__pyx_v_x - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x_bins.buf, __pyx_t_12, __pyx_bstride_0_x_bins))) * __pyx_v_dx_inv); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":68 - * dy_inv = 1.0 / (y_bins[y_i+1] - y_bins[y_i]) - * xp = (x - x_bins[x_i]) * dx_inv - * yp = (y - y_bins[y_i]) * dy_inv # <<<<<<<<<<<<<< - * xm = (x_bins[x_i+1] - x) * dx_inv - * ym = (y_bins[y_i+1] - y) * dy_inv - */ - __pyx_t_13 = __pyx_v_y_i; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_bshape_0_y_bins; - __pyx_v_yp = ((__pyx_v_y - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y_bins.buf, __pyx_t_13, __pyx_bstride_0_y_bins))) * __pyx_v_dy_inv); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":69 - * xp = (x - x_bins[x_i]) * dx_inv - * yp = (y - y_bins[y_i]) * dy_inv - * xm = (x_bins[x_i+1] - x) * dx_inv # <<<<<<<<<<<<<< - * ym = (y_bins[y_i+1] - y) * dy_inv - * output[i] = table[x_i , y_i ] * (xm*ym) \ - */ - __pyx_t_14 = (__pyx_v_x_i + 1); - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_0_x_bins; - __pyx_v_xm = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x_bins.buf, __pyx_t_14, __pyx_bstride_0_x_bins)) - __pyx_v_x) * __pyx_v_dx_inv); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":70 - * yp = (y - y_bins[y_i]) * dy_inv - * xm = (x_bins[x_i+1] - x) * dx_inv - * ym = (y_bins[y_i+1] - y) * dy_inv # <<<<<<<<<<<<<< - * output[i] = table[x_i , y_i ] * (xm*ym) \ - * + table[x_i+1, y_i ] * (xp*ym) \ - */ - __pyx_t_15 = (__pyx_v_y_i + 1); - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_0_y_bins; - __pyx_v_ym = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y_bins.buf, __pyx_t_15, __pyx_bstride_0_y_bins)) - __pyx_v_y) * __pyx_v_dy_inv); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":71 - * xm = (x_bins[x_i+1] - x) * dx_inv - * ym = (y_bins[y_i+1] - y) * dy_inv - * output[i] = table[x_i , y_i ] * (xm*ym) \ # <<<<<<<<<<<<<< - * + table[x_i+1, y_i ] * (xp*ym) \ - * + table[x_i , y_i+1] * (xm*yp) \ - */ - __pyx_t_16 = __pyx_v_x_i; - __pyx_t_17 = __pyx_v_y_i; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_bshape_0_table; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_bshape_1_table; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":72 - * ym = (y_bins[y_i+1] - y) * dy_inv - * output[i] = table[x_i , y_i ] * (xm*ym) \ - * + table[x_i+1, y_i ] * (xp*ym) \ # <<<<<<<<<<<<<< - * + table[x_i , y_i+1] * (xm*yp) \ - * + table[x_i+1, y_i+1] * (xp*yp) - */ - __pyx_t_18 = (__pyx_v_x_i + 1); - __pyx_t_19 = __pyx_v_y_i; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_bshape_0_table; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_bshape_1_table; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":73 - * output[i] = table[x_i , y_i ] * (xm*ym) \ - * + table[x_i+1, y_i ] * (xp*ym) \ - * + table[x_i , y_i+1] * (xm*yp) \ # <<<<<<<<<<<<<< - * + table[x_i+1, y_i+1] * (xp*yp) - * - */ - __pyx_t_20 = __pyx_v_x_i; - __pyx_t_21 = (__pyx_v_y_i + 1); - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_bshape_0_table; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_bshape_1_table; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":74 - * + table[x_i+1, y_i ] * (xp*ym) \ - * + table[x_i , y_i+1] * (xm*yp) \ - * + table[x_i+1, y_i+1] * (xp*yp) # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) - */ - __pyx_t_22 = (__pyx_v_x_i + 1); - __pyx_t_23 = (__pyx_v_y_i + 1); - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_bshape_0_table; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_bshape_1_table; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":71 - * xm = (x_bins[x_i+1] - x) * dx_inv - * ym = (y_bins[y_i+1] - y) * dy_inv - * output[i] = table[x_i , y_i ] * (xm*ym) \ # <<<<<<<<<<<<<< - * + table[x_i+1, y_i ] * (xp*ym) \ - * + table[x_i , y_i+1] * (xm*yp) \ - */ - __pyx_t_24 = __pyx_v_i; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_bshape_0_output; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_output.buf, __pyx_t_24, __pyx_bstride_0_output) = (((((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_table.buf, __pyx_t_16, __pyx_bstride_0_table, __pyx_t_17, __pyx_bstride_1_table)) * (__pyx_v_xm * __pyx_v_ym)) + ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_table.buf, __pyx_t_18, __pyx_bstride_0_table, __pyx_t_19, __pyx_bstride_1_table)) * (__pyx_v_xp * __pyx_v_ym))) + ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_table.buf, __pyx_t_20, __pyx_bstride_0_table, __pyx_t_21, __pyx_bstride_1_table)) * (__pyx_v_xm * __pyx_v_yp))) + ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_table.buf, __pyx_t_22, __pyx_bstride_0_table, __pyx_t_23, __pyx_bstride_1_table)) * (__pyx_v_xp * __pyx_v_yp))); - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y_vals); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y_is); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y_bins); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_is); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_vals); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_table); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_bins); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.amr_utils.BilinearlyInterpolate"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y_vals); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y_is); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y_bins); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_is); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_vals); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_table); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_bins); - __pyx_L2:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":77 - * - * @cython.boundscheck(False) - * def TrilinearlyInterpolate(np.ndarray[np.float64_t, ndim=3] table, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t, ndim=1] x_vals, - * np.ndarray[np.float64_t, ndim=1] y_vals, - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_TrilinearlyInterpolate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_TrilinearlyInterpolate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_table = 0; - PyArrayObject *__pyx_v_x_vals = 0; - PyArrayObject *__pyx_v_y_vals = 0; - PyArrayObject *__pyx_v_z_vals = 0; - PyArrayObject *__pyx_v_x_bins = 0; - PyArrayObject *__pyx_v_y_bins = 0; - PyArrayObject *__pyx_v_z_bins = 0; - PyArrayObject *__pyx_v_x_is = 0; - PyArrayObject *__pyx_v_y_is = 0; - PyArrayObject *__pyx_v_z_is = 0; - PyArrayObject *__pyx_v_output = 0; - double __pyx_v_x; - double __pyx_v_xp; - double __pyx_v_xm; - double __pyx_v_y; - double __pyx_v_yp; - double __pyx_v_ym; - double __pyx_v_z; - double __pyx_v_zp; - double __pyx_v_zm; - double __pyx_v_dx_inv; - double __pyx_v_dy_inv; - double __pyx_v_dz_inv; - int __pyx_v_i; - int __pyx_v_x_i; - int __pyx_v_y_i; - int __pyx_v_z_i; - Py_buffer __pyx_bstruct_z_is; - Py_ssize_t __pyx_bstride_0_z_is = 0; - Py_ssize_t __pyx_bshape_0_z_is = 0; - Py_buffer __pyx_bstruct_x_vals; - Py_ssize_t __pyx_bstride_0_x_vals = 0; - Py_ssize_t __pyx_bshape_0_x_vals = 0; - Py_buffer __pyx_bstruct_y_is; - Py_ssize_t __pyx_bstride_0_y_is = 0; - Py_ssize_t __pyx_bshape_0_y_is = 0; - Py_buffer __pyx_bstruct_y_bins; - Py_ssize_t __pyx_bstride_0_y_bins = 0; - Py_ssize_t __pyx_bshape_0_y_bins = 0; - Py_buffer __pyx_bstruct_z_bins; - Py_ssize_t __pyx_bstride_0_z_bins = 0; - Py_ssize_t __pyx_bshape_0_z_bins = 0; - Py_buffer __pyx_bstruct_x_is; - Py_ssize_t __pyx_bstride_0_x_is = 0; - Py_ssize_t __pyx_bshape_0_x_is = 0; - Py_buffer __pyx_bstruct_output; - Py_ssize_t __pyx_bstride_0_output = 0; - Py_ssize_t __pyx_bshape_0_output = 0; - Py_buffer __pyx_bstruct_table; - Py_ssize_t __pyx_bstride_0_table = 0; - Py_ssize_t __pyx_bstride_1_table = 0; - Py_ssize_t __pyx_bstride_2_table = 0; - Py_ssize_t __pyx_bshape_0_table = 0; - Py_ssize_t __pyx_bshape_1_table = 0; - Py_ssize_t __pyx_bshape_2_table = 0; - Py_buffer __pyx_bstruct_x_bins; - Py_ssize_t __pyx_bstride_0_x_bins = 0; - Py_ssize_t __pyx_bshape_0_x_bins = 0; - Py_buffer __pyx_bstruct_y_vals; - Py_ssize_t __pyx_bstride_0_y_vals = 0; - Py_ssize_t __pyx_bshape_0_y_vals = 0; - Py_buffer __pyx_bstruct_z_vals; - Py_ssize_t __pyx_bstride_0_z_vals = 0; - Py_ssize_t __pyx_bshape_0_z_vals = 0; - PyObject *__pyx_r = NULL; - npy_intp __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - long __pyx_t_9; - int __pyx_t_10; - __pyx_t_5numpy_float64_t __pyx_t_11; - long __pyx_t_12; - int __pyx_t_13; - long __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - int __pyx_t_18; - long __pyx_t_19; - long __pyx_t_20; - long __pyx_t_21; - int __pyx_t_22; - int __pyx_t_23; - int __pyx_t_24; - long __pyx_t_25; - int __pyx_t_26; - int __pyx_t_27; - int __pyx_t_28; - long __pyx_t_29; - int __pyx_t_30; - int __pyx_t_31; - int __pyx_t_32; - long __pyx_t_33; - long __pyx_t_34; - int __pyx_t_35; - long __pyx_t_36; - int __pyx_t_37; - long __pyx_t_38; - long __pyx_t_39; - long __pyx_t_40; - long __pyx_t_41; - int __pyx_t_42; - long __pyx_t_43; - long __pyx_t_44; - long __pyx_t_45; - int __pyx_t_46; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__table,&__pyx_n_s__x_vals,&__pyx_n_s__y_vals,&__pyx_n_s__z_vals,&__pyx_n_s__x_bins,&__pyx_n_s__y_bins,&__pyx_n_s__z_bins,&__pyx_n_s__x_is,&__pyx_n_s__y_is,&__pyx_n_s__z_is,&__pyx_n_s__output,0}; - __Pyx_RefNannySetupContext("TrilinearlyInterpolate"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__table); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x_vals); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("TrilinearlyInterpolate", 1, 11, 11, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y_vals); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("TrilinearlyInterpolate", 1, 11, 11, 2); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__z_vals); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("TrilinearlyInterpolate", 1, 11, 11, 3); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x_bins); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("TrilinearlyInterpolate", 1, 11, 11, 4); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y_bins); - if (likely(values[5])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("TrilinearlyInterpolate", 1, 11, 11, 5); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 6: - values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__z_bins); - if (likely(values[6])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("TrilinearlyInterpolate", 1, 11, 11, 6); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 7: - values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x_is); - if (likely(values[7])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("TrilinearlyInterpolate", 1, 11, 11, 7); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 8: - values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y_is); - if (likely(values[8])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("TrilinearlyInterpolate", 1, 11, 11, 8); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 9: - values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__z_is); - if (likely(values[9])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("TrilinearlyInterpolate", 1, 11, 11, 9); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 10: - values[10] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__output); - if (likely(values[10])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("TrilinearlyInterpolate", 1, 11, 11, 10); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "TrilinearlyInterpolate") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_table = ((PyArrayObject *)values[0]); - __pyx_v_x_vals = ((PyArrayObject *)values[1]); - __pyx_v_y_vals = ((PyArrayObject *)values[2]); - __pyx_v_z_vals = ((PyArrayObject *)values[3]); - __pyx_v_x_bins = ((PyArrayObject *)values[4]); - __pyx_v_y_bins = ((PyArrayObject *)values[5]); - __pyx_v_z_bins = ((PyArrayObject *)values[6]); - __pyx_v_x_is = ((PyArrayObject *)values[7]); - __pyx_v_y_is = ((PyArrayObject *)values[8]); - __pyx_v_z_is = ((PyArrayObject *)values[9]); - __pyx_v_output = ((PyArrayObject *)values[10]); - } else if (PyTuple_GET_SIZE(__pyx_args) != 11) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_table = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_x_vals = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_y_vals = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_z_vals = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); - __pyx_v_x_bins = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); - __pyx_v_y_bins = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 5)); - __pyx_v_z_bins = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 6)); - __pyx_v_x_is = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 7)); - __pyx_v_y_is = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 8)); - __pyx_v_z_is = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 9)); - __pyx_v_output = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 10)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("TrilinearlyInterpolate", 1, 11, 11, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.TrilinearlyInterpolate"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_table.buf = NULL; - __pyx_bstruct_x_vals.buf = NULL; - __pyx_bstruct_y_vals.buf = NULL; - __pyx_bstruct_z_vals.buf = NULL; - __pyx_bstruct_x_bins.buf = NULL; - __pyx_bstruct_y_bins.buf = NULL; - __pyx_bstruct_z_bins.buf = NULL; - __pyx_bstruct_x_is.buf = NULL; - __pyx_bstruct_y_is.buf = NULL; - __pyx_bstruct_z_is.buf = NULL; - __pyx_bstruct_output.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_table), __pyx_ptype_5numpy_ndarray, 1, "table", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x_vals), __pyx_ptype_5numpy_ndarray, 1, "x_vals", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y_vals), __pyx_ptype_5numpy_ndarray, 1, "y_vals", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_z_vals), __pyx_ptype_5numpy_ndarray, 1, "z_vals", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x_bins), __pyx_ptype_5numpy_ndarray, 1, "x_bins", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y_bins), __pyx_ptype_5numpy_ndarray, 1, "y_bins", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_z_bins), __pyx_ptype_5numpy_ndarray, 1, "z_bins", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x_is), __pyx_ptype_5numpy_ndarray, 1, "x_is", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y_is), __pyx_ptype_5numpy_ndarray, 1, "y_is", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_z_is), __pyx_ptype_5numpy_ndarray, 1, "z_is", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 86; __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[3]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_table, (PyObject*)__pyx_v_table, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_table = __pyx_bstruct_table.strides[0]; __pyx_bstride_1_table = __pyx_bstruct_table.strides[1]; __pyx_bstride_2_table = __pyx_bstruct_table.strides[2]; - __pyx_bshape_0_table = __pyx_bstruct_table.shape[0]; __pyx_bshape_1_table = __pyx_bstruct_table.shape[1]; __pyx_bshape_2_table = __pyx_bstruct_table.shape[2]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x_vals, (PyObject*)__pyx_v_x_vals, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_x_vals = __pyx_bstruct_x_vals.strides[0]; - __pyx_bshape_0_x_vals = __pyx_bstruct_x_vals.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_y_vals, (PyObject*)__pyx_v_y_vals, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_y_vals = __pyx_bstruct_y_vals.strides[0]; - __pyx_bshape_0_y_vals = __pyx_bstruct_y_vals.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_z_vals, (PyObject*)__pyx_v_z_vals, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_z_vals = __pyx_bstruct_z_vals.strides[0]; - __pyx_bshape_0_z_vals = __pyx_bstruct_z_vals.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x_bins, (PyObject*)__pyx_v_x_bins, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_x_bins = __pyx_bstruct_x_bins.strides[0]; - __pyx_bshape_0_x_bins = __pyx_bstruct_x_bins.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_y_bins, (PyObject*)__pyx_v_y_bins, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_y_bins = __pyx_bstruct_y_bins.strides[0]; - __pyx_bshape_0_y_bins = __pyx_bstruct_y_bins.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_z_bins, (PyObject*)__pyx_v_z_bins, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_z_bins = __pyx_bstruct_z_bins.strides[0]; - __pyx_bshape_0_z_bins = __pyx_bstruct_z_bins.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x_is, (PyObject*)__pyx_v_x_is, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_x_is = __pyx_bstruct_x_is.strides[0]; - __pyx_bshape_0_x_is = __pyx_bstruct_x_is.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_y_is, (PyObject*)__pyx_v_y_is, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_y_is = __pyx_bstruct_y_is.strides[0]; - __pyx_bshape_0_y_is = __pyx_bstruct_y_is.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_z_is, (PyObject*)__pyx_v_z_is, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_z_is = __pyx_bstruct_z_is.strides[0]; - __pyx_bshape_0_z_is = __pyx_bstruct_z_is.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_output, (PyObject*)__pyx_v_output, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_output = __pyx_bstruct_output.strides[0]; - __pyx_bshape_0_output = __pyx_bstruct_output.shape[0]; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":93 - * cdef double dx_inv, dy_inv, dz_inv - * cdef int i, x_i, y_i, z_i - * for i in range(x_vals.shape[0]): # <<<<<<<<<<<<<< - * x_i = x_is[i] - * y_i = y_is[i] - */ - __pyx_t_1 = (__pyx_v_x_vals->dimensions[0]); - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":94 - * cdef int i, x_i, y_i, z_i - * for i in range(x_vals.shape[0]): - * x_i = x_is[i] # <<<<<<<<<<<<<< - * y_i = y_is[i] - * z_i = z_is[i] - */ - __pyx_t_3 = __pyx_v_i; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_bshape_0_x_is; - __pyx_v_x_i = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int_t *, __pyx_bstruct_x_is.buf, __pyx_t_3, __pyx_bstride_0_x_is)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":95 - * for i in range(x_vals.shape[0]): - * x_i = x_is[i] - * y_i = y_is[i] # <<<<<<<<<<<<<< - * z_i = z_is[i] - * x = x_vals[i] - */ - __pyx_t_4 = __pyx_v_i; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_bshape_0_y_is; - __pyx_v_y_i = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int_t *, __pyx_bstruct_y_is.buf, __pyx_t_4, __pyx_bstride_0_y_is)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":96 - * x_i = x_is[i] - * y_i = y_is[i] - * z_i = z_is[i] # <<<<<<<<<<<<<< - * x = x_vals[i] - * y = y_vals[i] - */ - __pyx_t_5 = __pyx_v_i; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_bshape_0_z_is; - __pyx_v_z_i = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int_t *, __pyx_bstruct_z_is.buf, __pyx_t_5, __pyx_bstride_0_z_is)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":97 - * y_i = y_is[i] - * z_i = z_is[i] - * x = x_vals[i] # <<<<<<<<<<<<<< - * y = y_vals[i] - * z = z_vals[i] - */ - __pyx_t_6 = __pyx_v_i; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_bshape_0_x_vals; - __pyx_v_x = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x_vals.buf, __pyx_t_6, __pyx_bstride_0_x_vals)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":98 - * z_i = z_is[i] - * x = x_vals[i] - * y = y_vals[i] # <<<<<<<<<<<<<< - * z = z_vals[i] - * dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) - */ - __pyx_t_7 = __pyx_v_i; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_bshape_0_y_vals; - __pyx_v_y = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y_vals.buf, __pyx_t_7, __pyx_bstride_0_y_vals)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":99 - * x = x_vals[i] - * y = y_vals[i] - * z = z_vals[i] # <<<<<<<<<<<<<< - * dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) - * dy_inv = 1.0 / (y_bins[y_i+1] - y_bins[y_i]) - */ - __pyx_t_8 = __pyx_v_i; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_bshape_0_z_vals; - __pyx_v_z = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_z_vals.buf, __pyx_t_8, __pyx_bstride_0_z_vals)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":100 - * y = y_vals[i] - * z = z_vals[i] - * dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) # <<<<<<<<<<<<<< - * dy_inv = 1.0 / (y_bins[y_i+1] - y_bins[y_i]) - * dz_inv = 1.0 / (z_bins[z_i+1] - z_bins[z_i]) - */ - __pyx_t_9 = (__pyx_v_x_i + 1); - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_bshape_0_x_bins; - __pyx_t_10 = __pyx_v_x_i; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_bshape_0_x_bins; - __pyx_t_11 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x_bins.buf, __pyx_t_9, __pyx_bstride_0_x_bins)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x_bins.buf, __pyx_t_10, __pyx_bstride_0_x_bins))); - if (unlikely(__pyx_t_11 == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_dx_inv = (1.0 / __pyx_t_11); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":101 - * z = z_vals[i] - * dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) - * dy_inv = 1.0 / (y_bins[y_i+1] - y_bins[y_i]) # <<<<<<<<<<<<<< - * dz_inv = 1.0 / (z_bins[z_i+1] - z_bins[z_i]) - * xp = (x - x_bins[x_i]) * dx_inv - */ - __pyx_t_12 = (__pyx_v_y_i + 1); - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_bshape_0_y_bins; - __pyx_t_13 = __pyx_v_y_i; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_bshape_0_y_bins; - __pyx_t_11 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y_bins.buf, __pyx_t_12, __pyx_bstride_0_y_bins)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y_bins.buf, __pyx_t_13, __pyx_bstride_0_y_bins))); - if (unlikely(__pyx_t_11 == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_dy_inv = (1.0 / __pyx_t_11); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":102 - * dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) - * dy_inv = 1.0 / (y_bins[y_i+1] - y_bins[y_i]) - * dz_inv = 1.0 / (z_bins[z_i+1] - z_bins[z_i]) # <<<<<<<<<<<<<< - * xp = (x - x_bins[x_i]) * dx_inv - * yp = (y - y_bins[y_i]) * dy_inv - */ - __pyx_t_14 = (__pyx_v_z_i + 1); - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_0_z_bins; - __pyx_t_15 = __pyx_v_z_i; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_0_z_bins; - __pyx_t_11 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_z_bins.buf, __pyx_t_14, __pyx_bstride_0_z_bins)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_z_bins.buf, __pyx_t_15, __pyx_bstride_0_z_bins))); - if (unlikely(__pyx_t_11 == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_dz_inv = (1.0 / __pyx_t_11); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":103 - * dy_inv = 1.0 / (y_bins[y_i+1] - y_bins[y_i]) - * dz_inv = 1.0 / (z_bins[z_i+1] - z_bins[z_i]) - * xp = (x - x_bins[x_i]) * dx_inv # <<<<<<<<<<<<<< - * yp = (y - y_bins[y_i]) * dy_inv - * zp = (z - z_bins[z_i]) * dz_inv - */ - __pyx_t_16 = __pyx_v_x_i; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_bshape_0_x_bins; - __pyx_v_xp = ((__pyx_v_x - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x_bins.buf, __pyx_t_16, __pyx_bstride_0_x_bins))) * __pyx_v_dx_inv); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":104 - * dz_inv = 1.0 / (z_bins[z_i+1] - z_bins[z_i]) - * xp = (x - x_bins[x_i]) * dx_inv - * yp = (y - y_bins[y_i]) * dy_inv # <<<<<<<<<<<<<< - * zp = (z - z_bins[z_i]) * dz_inv - * xm = (x_bins[x_i+1] - x) * dx_inv - */ - __pyx_t_17 = __pyx_v_y_i; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_bshape_0_y_bins; - __pyx_v_yp = ((__pyx_v_y - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y_bins.buf, __pyx_t_17, __pyx_bstride_0_y_bins))) * __pyx_v_dy_inv); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":105 - * xp = (x - x_bins[x_i]) * dx_inv - * yp = (y - y_bins[y_i]) * dy_inv - * zp = (z - z_bins[z_i]) * dz_inv # <<<<<<<<<<<<<< - * xm = (x_bins[x_i+1] - x) * dx_inv - * ym = (y_bins[y_i+1] - y) * dy_inv - */ - __pyx_t_18 = __pyx_v_z_i; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_bshape_0_z_bins; - __pyx_v_zp = ((__pyx_v_z - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_z_bins.buf, __pyx_t_18, __pyx_bstride_0_z_bins))) * __pyx_v_dz_inv); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":106 - * yp = (y - y_bins[y_i]) * dy_inv - * zp = (z - z_bins[z_i]) * dz_inv - * xm = (x_bins[x_i+1] - x) * dx_inv # <<<<<<<<<<<<<< - * ym = (y_bins[y_i+1] - y) * dy_inv - * zm = (z_bins[z_i+1] - z) * dz_inv - */ - __pyx_t_19 = (__pyx_v_x_i + 1); - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_bshape_0_x_bins; - __pyx_v_xm = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x_bins.buf, __pyx_t_19, __pyx_bstride_0_x_bins)) - __pyx_v_x) * __pyx_v_dx_inv); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":107 - * zp = (z - z_bins[z_i]) * dz_inv - * xm = (x_bins[x_i+1] - x) * dx_inv - * ym = (y_bins[y_i+1] - y) * dy_inv # <<<<<<<<<<<<<< - * zm = (z_bins[z_i+1] - z) * dz_inv - * output[i] = table[x_i ,y_i ,z_i ] * (xm*ym*zm) \ - */ - __pyx_t_20 = (__pyx_v_y_i + 1); - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_bshape_0_y_bins; - __pyx_v_ym = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y_bins.buf, __pyx_t_20, __pyx_bstride_0_y_bins)) - __pyx_v_y) * __pyx_v_dy_inv); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":108 - * xm = (x_bins[x_i+1] - x) * dx_inv - * ym = (y_bins[y_i+1] - y) * dy_inv - * zm = (z_bins[z_i+1] - z) * dz_inv # <<<<<<<<<<<<<< - * output[i] = table[x_i ,y_i ,z_i ] * (xm*ym*zm) \ - * + table[x_i+1,y_i ,z_i ] * (xp*ym*zm) \ - */ - __pyx_t_21 = (__pyx_v_z_i + 1); - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_bshape_0_z_bins; - __pyx_v_zm = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_z_bins.buf, __pyx_t_21, __pyx_bstride_0_z_bins)) - __pyx_v_z) * __pyx_v_dz_inv); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":109 - * ym = (y_bins[y_i+1] - y) * dy_inv - * zm = (z_bins[z_i+1] - z) * dz_inv - * output[i] = table[x_i ,y_i ,z_i ] * (xm*ym*zm) \ # <<<<<<<<<<<<<< - * + table[x_i+1,y_i ,z_i ] * (xp*ym*zm) \ - * + table[x_i ,y_i+1,z_i ] * (xm*yp*zm) \ - */ - __pyx_t_22 = __pyx_v_x_i; - __pyx_t_23 = __pyx_v_y_i; - __pyx_t_24 = __pyx_v_z_i; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_bshape_0_table; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_bshape_1_table; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_bshape_2_table; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":110 - * zm = (z_bins[z_i+1] - z) * dz_inv - * output[i] = table[x_i ,y_i ,z_i ] * (xm*ym*zm) \ - * + table[x_i+1,y_i ,z_i ] * (xp*ym*zm) \ # <<<<<<<<<<<<<< - * + table[x_i ,y_i+1,z_i ] * (xm*yp*zm) \ - * + table[x_i ,y_i ,z_i+1] * (xm*ym*zp) \ - */ - __pyx_t_25 = (__pyx_v_x_i + 1); - __pyx_t_26 = __pyx_v_y_i; - __pyx_t_27 = __pyx_v_z_i; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_bshape_0_table; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_bshape_1_table; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_bshape_2_table; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":111 - * output[i] = table[x_i ,y_i ,z_i ] * (xm*ym*zm) \ - * + table[x_i+1,y_i ,z_i ] * (xp*ym*zm) \ - * + table[x_i ,y_i+1,z_i ] * (xm*yp*zm) \ # <<<<<<<<<<<<<< - * + table[x_i ,y_i ,z_i+1] * (xm*ym*zp) \ - * + table[x_i+1,y_i ,z_i+1] * (xp*ym*zp) \ - */ - __pyx_t_28 = __pyx_v_x_i; - __pyx_t_29 = (__pyx_v_y_i + 1); - __pyx_t_30 = __pyx_v_z_i; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_bshape_0_table; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_bshape_1_table; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_bshape_2_table; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":112 - * + table[x_i+1,y_i ,z_i ] * (xp*ym*zm) \ - * + table[x_i ,y_i+1,z_i ] * (xm*yp*zm) \ - * + table[x_i ,y_i ,z_i+1] * (xm*ym*zp) \ # <<<<<<<<<<<<<< - * + table[x_i+1,y_i ,z_i+1] * (xp*ym*zp) \ - * + table[x_i ,y_i+1,z_i+1] * (xm*yp*zp) \ - */ - __pyx_t_31 = __pyx_v_x_i; - __pyx_t_32 = __pyx_v_y_i; - __pyx_t_33 = (__pyx_v_z_i + 1); - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_bshape_0_table; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_bshape_1_table; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_bshape_2_table; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":113 - * + table[x_i ,y_i+1,z_i ] * (xm*yp*zm) \ - * + table[x_i ,y_i ,z_i+1] * (xm*ym*zp) \ - * + table[x_i+1,y_i ,z_i+1] * (xp*ym*zp) \ # <<<<<<<<<<<<<< - * + table[x_i ,y_i+1,z_i+1] * (xm*yp*zp) \ - * + table[x_i+1,y_i+1,z_i ] * (xp*yp*zm) \ - */ - __pyx_t_34 = (__pyx_v_x_i + 1); - __pyx_t_35 = __pyx_v_y_i; - __pyx_t_36 = (__pyx_v_z_i + 1); - if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_bshape_0_table; - if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_bshape_1_table; - if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_bshape_2_table; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":114 - * + table[x_i ,y_i ,z_i+1] * (xm*ym*zp) \ - * + table[x_i+1,y_i ,z_i+1] * (xp*ym*zp) \ - * + table[x_i ,y_i+1,z_i+1] * (xm*yp*zp) \ # <<<<<<<<<<<<<< - * + table[x_i+1,y_i+1,z_i ] * (xp*yp*zm) \ - * + table[x_i+1,y_i+1,z_i+1] * (xp*yp*zp) - */ - __pyx_t_37 = __pyx_v_x_i; - __pyx_t_38 = (__pyx_v_y_i + 1); - __pyx_t_39 = (__pyx_v_z_i + 1); - if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_bshape_0_table; - if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_bshape_1_table; - if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_bshape_2_table; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":115 - * + table[x_i+1,y_i ,z_i+1] * (xp*ym*zp) \ - * + table[x_i ,y_i+1,z_i+1] * (xm*yp*zp) \ - * + table[x_i+1,y_i+1,z_i ] * (xp*yp*zm) \ # <<<<<<<<<<<<<< - * + table[x_i+1,y_i+1,z_i+1] * (xp*yp*zp) - */ - __pyx_t_40 = (__pyx_v_x_i + 1); - __pyx_t_41 = (__pyx_v_y_i + 1); - __pyx_t_42 = __pyx_v_z_i; - if (__pyx_t_40 < 0) __pyx_t_40 += __pyx_bshape_0_table; - if (__pyx_t_41 < 0) __pyx_t_41 += __pyx_bshape_1_table; - if (__pyx_t_42 < 0) __pyx_t_42 += __pyx_bshape_2_table; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":116 - * + table[x_i ,y_i+1,z_i+1] * (xm*yp*zp) \ - * + table[x_i+1,y_i+1,z_i ] * (xp*yp*zm) \ - * + table[x_i+1,y_i+1,z_i+1] * (xp*yp*zp) # <<<<<<<<<<<<<< - */ - __pyx_t_43 = (__pyx_v_x_i + 1); - __pyx_t_44 = (__pyx_v_y_i + 1); - __pyx_t_45 = (__pyx_v_z_i + 1); - if (__pyx_t_43 < 0) __pyx_t_43 += __pyx_bshape_0_table; - if (__pyx_t_44 < 0) __pyx_t_44 += __pyx_bshape_1_table; - if (__pyx_t_45 < 0) __pyx_t_45 += __pyx_bshape_2_table; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":109 - * ym = (y_bins[y_i+1] - y) * dy_inv - * zm = (z_bins[z_i+1] - z) * dz_inv - * output[i] = table[x_i ,y_i ,z_i ] * (xm*ym*zm) \ # <<<<<<<<<<<<<< - * + table[x_i+1,y_i ,z_i ] * (xp*ym*zm) \ - * + table[x_i ,y_i+1,z_i ] * (xm*yp*zm) \ - */ - __pyx_t_46 = __pyx_v_i; - if (__pyx_t_46 < 0) __pyx_t_46 += __pyx_bshape_0_output; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_output.buf, __pyx_t_46, __pyx_bstride_0_output) = (((((((((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_table.buf, __pyx_t_22, __pyx_bstride_0_table, __pyx_t_23, __pyx_bstride_1_table, __pyx_t_24, __pyx_bstride_2_table)) * ((__pyx_v_xm * __pyx_v_ym) * __pyx_v_zm)) + ((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_table.buf, __pyx_t_25, __pyx_bstride_0_table, __pyx_t_26, __pyx_bstride_1_table, __pyx_t_27, __pyx_bstride_2_table)) * ((__pyx_v_xp * __pyx_v_ym) * __pyx_v_zm))) + ((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_table.buf, __pyx_t_28, __pyx_bstride_0_table, __pyx_t_29, __pyx_bstride_1_table, __pyx_t_30, __pyx_bstride_2_table)) * ((__pyx_v_xm * __pyx_v_yp) * __pyx_v_zm))) + ((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_table.buf, __pyx_t_31, __pyx_bstride_0_table, __pyx_t_32, __pyx_bstride_1_table, __pyx_t_33, __pyx_bstride_2_table)) * ((__pyx_v_xm * __pyx_v_ym) * __pyx_v_zp))) + ((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_table.buf, __pyx_t_34, __pyx_bstride_0_table, __pyx_t_35, __pyx_bstride_1_table, __pyx_t_36, __pyx_bstride_2_table)) * ((__pyx_v_xp * __pyx_v_ym) * __pyx_v_zp))) + ((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_table.buf, __pyx_t_37, __pyx_bstride_0_table, __pyx_t_38, __pyx_bstride_1_table, __pyx_t_39, __pyx_bstride_2_table)) * ((__pyx_v_xm * __pyx_v_yp) * __pyx_v_zp))) + ((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_table.buf, __pyx_t_40, __pyx_bstride_0_table, __pyx_t_41, __pyx_bstride_1_table, __pyx_t_42, __pyx_bstride_2_table)) * ((__pyx_v_xp * __pyx_v_yp) * __pyx_v_zm))) + ((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_table.buf, __pyx_t_43, __pyx_bstride_0_table, __pyx_t_44, __pyx_bstride_1_table, __pyx_t_45, __pyx_bstride_2_table)) * ((__pyx_v_xp * __pyx_v_yp) * __pyx_v_zp))); - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_z_is); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_vals); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y_is); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y_bins); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_z_bins); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_is); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_table); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_bins); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y_vals); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_z_vals); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.amr_utils.TrilinearlyInterpolate"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_z_is); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_vals); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y_is); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y_bins); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_z_bins); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_is); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_table); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_bins); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y_vals); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_z_vals); - __pyx_L2:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":36 - * @cython.wraparound(False) - * @cython.boundscheck(False) - * def planar_points_in_volume( # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t, ndim=2] points, - * np.ndarray[np.int8_t, ndim=1] pmask, # pixel mask - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_planar_points_in_volume(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_planar_points_in_volume(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_points = 0; - PyArrayObject *__pyx_v_pmask = 0; - PyArrayObject *__pyx_v_left_edge = 0; - PyArrayObject *__pyx_v_right_edge = 0; - PyArrayObject *__pyx_v_mask = 0; - float __pyx_v_dx; - PyArrayObject *__pyx_v_valid = 0; - int __pyx_v_i; - int __pyx_v_dim; - int __pyx_v_count; - int __pyx_v_ex; - double __pyx_v_dx_inv; - unsigned int __pyx_v_idx[3]; - PyArrayObject *__pyx_v_result = 0; - Py_buffer __pyx_bstruct_valid; - Py_ssize_t __pyx_bstride_0_valid = 0; - Py_ssize_t __pyx_bshape_0_valid = 0; - Py_buffer __pyx_bstruct_right_edge; - Py_ssize_t __pyx_bstride_0_right_edge = 0; - Py_ssize_t __pyx_bshape_0_right_edge = 0; - Py_buffer __pyx_bstruct_mask; - Py_ssize_t __pyx_bstride_0_mask = 0; - Py_ssize_t __pyx_bstride_1_mask = 0; - Py_ssize_t __pyx_bstride_2_mask = 0; - Py_ssize_t __pyx_bshape_0_mask = 0; - Py_ssize_t __pyx_bshape_1_mask = 0; - Py_ssize_t __pyx_bshape_2_mask = 0; - Py_buffer __pyx_bstruct_points; - Py_ssize_t __pyx_bstride_0_points = 0; - Py_ssize_t __pyx_bstride_1_points = 0; - Py_ssize_t __pyx_bshape_0_points = 0; - Py_ssize_t __pyx_bshape_1_points = 0; - Py_buffer __pyx_bstruct_left_edge; - Py_ssize_t __pyx_bstride_0_left_edge = 0; - Py_ssize_t __pyx_bshape_0_left_edge = 0; - Py_buffer __pyx_bstruct_pmask; - Py_ssize_t __pyx_bstride_0_pmask = 0; - Py_ssize_t __pyx_bshape_0_pmask = 0; - Py_buffer __pyx_bstruct_result; - Py_ssize_t __pyx_bstride_0_result = 0; - Py_ssize_t __pyx_bshape_0_result = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyArrayObject *__pyx_t_5 = NULL; - npy_intp __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; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - int __pyx_t_18; - int __pyx_t_19; - int __pyx_t_20; - int __pyx_t_21; - int __pyx_t_22; - unsigned int __pyx_t_23; - unsigned int __pyx_t_24; - unsigned int __pyx_t_25; - PyArrayObject *__pyx_t_26 = NULL; - int __pyx_t_27; - int __pyx_t_28; - int __pyx_t_29; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__points,&__pyx_n_s__pmask,&__pyx_n_s__left_edge,&__pyx_n_s__right_edge,&__pyx_n_s__mask,&__pyx_n_s__dx,0}; - __Pyx_RefNannySetupContext("planar_points_in_volume"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[6] = {0,0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__points); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pmask); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("planar_points_in_volume", 1, 6, 6, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left_edge); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("planar_points_in_volume", 1, 6, 6, 2); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right_edge); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("planar_points_in_volume", 1, 6, 6, 3); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("planar_points_in_volume", 1, 6, 6, 4); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dx); - if (likely(values[5])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("planar_points_in_volume", 1, 6, 6, 5); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "planar_points_in_volume") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_points = ((PyArrayObject *)values[0]); - __pyx_v_pmask = ((PyArrayObject *)values[1]); - __pyx_v_left_edge = ((PyArrayObject *)values[2]); - __pyx_v_right_edge = ((PyArrayObject *)values[3]); - __pyx_v_mask = ((PyArrayObject *)values[4]); - __pyx_v_dx = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_dx == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_points = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_pmask = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_left_edge = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_right_edge = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); - __pyx_v_mask = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); - __pyx_v_dx = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_dx == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("planar_points_in_volume", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.planar_points_in_volume"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_valid.buf = NULL; - __pyx_bstruct_result.buf = NULL; - __pyx_bstruct_points.buf = NULL; - __pyx_bstruct_pmask.buf = NULL; - __pyx_bstruct_left_edge.buf = NULL; - __pyx_bstruct_right_edge.buf = NULL; - __pyx_bstruct_mask.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_points), __pyx_ptype_5numpy_ndarray, 1, "points", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pmask), __pyx_ptype_5numpy_ndarray, 1, "pmask", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left_edge), __pyx_ptype_5numpy_ndarray, 1, "left_edge", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right_edge), __pyx_ptype_5numpy_ndarray, 1, "right_edge", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_points, (PyObject*)__pyx_v_points, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_points = __pyx_bstruct_points.strides[0]; __pyx_bstride_1_points = __pyx_bstruct_points.strides[1]; - __pyx_bshape_0_points = __pyx_bstruct_points.shape[0]; __pyx_bshape_1_points = __pyx_bstruct_points.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_pmask, (PyObject*)__pyx_v_pmask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_pmask = __pyx_bstruct_pmask.strides[0]; - __pyx_bshape_0_pmask = __pyx_bstruct_pmask.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_left_edge, (PyObject*)__pyx_v_left_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_left_edge = __pyx_bstruct_left_edge.strides[0]; - __pyx_bshape_0_left_edge = __pyx_bstruct_left_edge.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_right_edge, (PyObject*)__pyx_v_right_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_right_edge = __pyx_bstruct_right_edge.strides[0]; - __pyx_bshape_0_right_edge = __pyx_bstruct_right_edge.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_mask, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_mask = __pyx_bstruct_mask.strides[0]; __pyx_bstride_1_mask = __pyx_bstruct_mask.strides[1]; __pyx_bstride_2_mask = __pyx_bstruct_mask.strides[2]; - __pyx_bshape_0_mask = __pyx_bstruct_mask.shape[0]; __pyx_bshape_1_mask = __pyx_bstruct_mask.shape[1]; __pyx_bshape_2_mask = __pyx_bstruct_mask.shape[2]; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":44 - * float dx): - * cdef np.ndarray[np.int8_t, ndim=1] \ - * valid = np.zeros(points.shape[0], dtype='int8') # <<<<<<<<<<<<<< - * cdef int i, dim, count - * cdef int ex - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_to_py_npy_intp((__pyx_v_points->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__int8)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_valid, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_valid = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_valid.buf = NULL; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_valid = __pyx_bstruct_valid.strides[0]; - __pyx_bshape_0_valid = __pyx_bstruct_valid.shape[0]; - } - } - __pyx_t_5 = 0; - __pyx_v_valid = ((PyArrayObject *)__pyx_t_4); - __pyx_t_4 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":49 - * cdef double dx_inv - * cdef unsigned int idx[3] - * count = 0 # <<<<<<<<<<<<<< - * dx_inv = 1.0 / dx - * for i in xrange(points.shape[0]): - */ - __pyx_v_count = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":50 - * cdef unsigned int idx[3] - * count = 0 - * dx_inv = 1.0 / dx # <<<<<<<<<<<<<< - * for i in xrange(points.shape[0]): - * if pmask[i] == 0: - */ - if (unlikely(__pyx_v_dx == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_dx_inv = (1.0 / __pyx_v_dx); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":51 - * count = 0 - * dx_inv = 1.0 / dx - * for i in xrange(points.shape[0]): # <<<<<<<<<<<<<< - * if pmask[i] == 0: - * continue - */ - __pyx_t_6 = (__pyx_v_points->dimensions[0]); - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_i = __pyx_t_7; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":52 - * dx_inv = 1.0 / dx - * for i in xrange(points.shape[0]): - * if pmask[i] == 0: # <<<<<<<<<<<<<< - * continue - * ex = 1 - */ - __pyx_t_8 = __pyx_v_i; - __pyx_t_9 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_bstruct_pmask.buf, __pyx_t_8, __pyx_bstride_0_pmask)) == 0); - if (__pyx_t_9) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":53 - * for i in xrange(points.shape[0]): - * if pmask[i] == 0: - * continue # <<<<<<<<<<<<<< - * ex = 1 - * for dim in xrange(3): - */ - goto __pyx_L6_continue; - goto __pyx_L8; - } - __pyx_L8:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":54 - * if pmask[i] == 0: - * continue - * ex = 1 # <<<<<<<<<<<<<< - * for dim in xrange(3): - * if points[i,dim] < left_edge[dim] or points[i,dim] > right_edge[dim]: - */ - __pyx_v_ex = 1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":55 - * continue - * ex = 1 - * for dim in xrange(3): # <<<<<<<<<<<<<< - * if points[i,dim] < left_edge[dim] or points[i,dim] > right_edge[dim]: - * valid[i] = ex = 0 - */ - for (__pyx_t_10 = 0; __pyx_t_10 < 3; __pyx_t_10+=1) { - __pyx_v_dim = __pyx_t_10; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":56 - * ex = 1 - * for dim in xrange(3): - * if points[i,dim] < left_edge[dim] or points[i,dim] > right_edge[dim]: # <<<<<<<<<<<<<< - * valid[i] = ex = 0 - * break - */ - __pyx_t_11 = __pyx_v_i; - __pyx_t_12 = __pyx_v_dim; - __pyx_t_13 = __pyx_v_dim; - __pyx_t_9 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_points.buf, __pyx_t_11, __pyx_bstride_0_points, __pyx_t_12, __pyx_bstride_1_points)) < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_13, __pyx_bstride_0_left_edge))); - if (!__pyx_t_9) { - __pyx_t_14 = __pyx_v_i; - __pyx_t_15 = __pyx_v_dim; - __pyx_t_16 = __pyx_v_dim; - __pyx_t_17 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_points.buf, __pyx_t_14, __pyx_bstride_0_points, __pyx_t_15, __pyx_bstride_1_points)) > (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_16, __pyx_bstride_0_right_edge))); - __pyx_t_18 = __pyx_t_17; - } else { - __pyx_t_18 = __pyx_t_9; - } - if (__pyx_t_18) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":57 - * for dim in xrange(3): - * if points[i,dim] < left_edge[dim] or points[i,dim] > right_edge[dim]: - * valid[i] = ex = 0 # <<<<<<<<<<<<<< - * break - * if ex == 1: - */ - __pyx_t_19 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_bstruct_valid.buf, __pyx_t_19, __pyx_bstride_0_valid) = 0; - __pyx_v_ex = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":58 - * if points[i,dim] < left_edge[dim] or points[i,dim] > right_edge[dim]: - * valid[i] = ex = 0 - * break # <<<<<<<<<<<<<< - * if ex == 1: - * for dim in xrange(3): - */ - goto __pyx_L10_break; - goto __pyx_L11; - } - __pyx_L11:; - } - __pyx_L10_break:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":59 - * valid[i] = ex = 0 - * break - * if ex == 1: # <<<<<<<<<<<<<< - * for dim in xrange(3): - * idx[dim] = \ - */ - __pyx_t_18 = (__pyx_v_ex == 1); - if (__pyx_t_18) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":60 - * break - * if ex == 1: - * for dim in xrange(3): # <<<<<<<<<<<<<< - * idx[dim] = \ - * ((points[i,dim] - left_edge[dim]) * dx_inv) - */ - for (__pyx_t_10 = 0; __pyx_t_10 < 3; __pyx_t_10+=1) { - __pyx_v_dim = __pyx_t_10; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":62 - * for dim in xrange(3): - * idx[dim] = \ - * ((points[i,dim] - left_edge[dim]) * dx_inv) # <<<<<<<<<<<<<< - * if mask[idx[0], idx[1], idx[2]] == 1: - * valid[i] = 1 - */ - __pyx_t_20 = __pyx_v_i; - __pyx_t_21 = __pyx_v_dim; - __pyx_t_22 = __pyx_v_dim; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":61 - * if ex == 1: - * for dim in xrange(3): - * idx[dim] = \ # <<<<<<<<<<<<<< - * ((points[i,dim] - left_edge[dim]) * dx_inv) - * if mask[idx[0], idx[1], idx[2]] == 1: - */ - (__pyx_v_idx[__pyx_v_dim]) = ((unsigned int)(((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_points.buf, __pyx_t_20, __pyx_bstride_0_points, __pyx_t_21, __pyx_bstride_1_points)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_22, __pyx_bstride_0_left_edge))) * __pyx_v_dx_inv)); - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":63 - * idx[dim] = \ - * ((points[i,dim] - left_edge[dim]) * dx_inv) - * if mask[idx[0], idx[1], idx[2]] == 1: # <<<<<<<<<<<<<< - * valid[i] = 1 - * count += 1 - */ - __pyx_t_23 = (__pyx_v_idx[0]); - __pyx_t_24 = (__pyx_v_idx[1]); - __pyx_t_25 = (__pyx_v_idx[2]); - __pyx_t_18 = ((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_mask.buf, __pyx_t_23, __pyx_bstride_0_mask, __pyx_t_24, __pyx_bstride_1_mask, __pyx_t_25, __pyx_bstride_2_mask)) == 1); - if (__pyx_t_18) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":64 - * ((points[i,dim] - left_edge[dim]) * dx_inv) - * if mask[idx[0], idx[1], idx[2]] == 1: - * valid[i] = 1 # <<<<<<<<<<<<<< - * count += 1 - * - */ - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_bstruct_valid.buf, __pyx_t_10, __pyx_bstride_0_valid) = 1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":65 - * if mask[idx[0], idx[1], idx[2]] == 1: - * valid[i] = 1 - * count += 1 # <<<<<<<<<<<<<< - * - * cdef np.ndarray[np.int32_t, ndim=1] result = np.empty(count, dtype='int32') - */ - __pyx_v_count += 1; - goto __pyx_L15; - } - __pyx_L15:; - goto __pyx_L12; - } - __pyx_L12:; - __pyx_L6_continue:; - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":67 - * count += 1 - * - * cdef np.ndarray[np.int32_t, ndim=1] result = np.empty(count, dtype='int32') # <<<<<<<<<<<<<< - * count = 0 - * for i in xrange(points.shape[0]): - */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyInt_FromLong(__pyx_v_count); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__int32)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_3, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_26 = ((PyArrayObject *)__pyx_t_2); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_result, (PyObject*)__pyx_t_26, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_result = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_result.buf = NULL; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_result = __pyx_bstruct_result.strides[0]; - __pyx_bshape_0_result = __pyx_bstruct_result.shape[0]; - } - } - __pyx_t_26 = 0; - __pyx_v_result = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":68 - * - * cdef np.ndarray[np.int32_t, ndim=1] result = np.empty(count, dtype='int32') - * count = 0 # <<<<<<<<<<<<<< - * for i in xrange(points.shape[0]): - * if valid[i] == 1 and pmask[i] == 1: - */ - __pyx_v_count = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":69 - * cdef np.ndarray[np.int32_t, ndim=1] result = np.empty(count, dtype='int32') - * count = 0 - * for i in xrange(points.shape[0]): # <<<<<<<<<<<<<< - * if valid[i] == 1 and pmask[i] == 1: - * result[count] = i - */ - __pyx_t_6 = (__pyx_v_points->dimensions[0]); - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_i = __pyx_t_7; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":70 - * count = 0 - * for i in xrange(points.shape[0]): - * if valid[i] == 1 and pmask[i] == 1: # <<<<<<<<<<<<<< - * result[count] = i - * count += 1 - */ - __pyx_t_27 = __pyx_v_i; - __pyx_t_18 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_bstruct_valid.buf, __pyx_t_27, __pyx_bstride_0_valid)) == 1); - if (__pyx_t_18) { - __pyx_t_28 = __pyx_v_i; - __pyx_t_9 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_bstruct_pmask.buf, __pyx_t_28, __pyx_bstride_0_pmask)) == 1); - __pyx_t_17 = __pyx_t_9; - } else { - __pyx_t_17 = __pyx_t_18; - } - if (__pyx_t_17) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":71 - * for i in xrange(points.shape[0]): - * if valid[i] == 1 and pmask[i] == 1: - * result[count] = i # <<<<<<<<<<<<<< - * count += 1 - * - */ - __pyx_t_29 = __pyx_v_count; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_result.buf, __pyx_t_29, __pyx_bstride_0_result) = __pyx_v_i; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":72 - * if valid[i] == 1 and pmask[i] == 1: - * result[count] = i - * count += 1 # <<<<<<<<<<<<<< - * - * return result - */ - __pyx_v_count += 1; - goto __pyx_L18; - } - __pyx_L18:; - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":74 - * count += 1 - * - * return result # <<<<<<<<<<<<<< - * - * cdef inline void set_rotated_pos( - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = ((PyObject *)__pyx_v_result); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_valid); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_right_edge); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_points); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edge); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_pmask); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.amr_utils.planar_points_in_volume"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_valid); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_right_edge); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_points); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edge); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_pmask); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_valid); - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":76 - * return result - * - * cdef inline void set_rotated_pos( # <<<<<<<<<<<<<< - * np.float64_t cp[3], np.float64_t rdds[3][3], - * np.float64_t rorigin[3], int i, int j, int k): - */ - -static CYTHON_INLINE void __pyx_f_2yt_9amr_utils_set_rotated_pos(__pyx_t_5numpy_float64_t *__pyx_v_cp, __pyx_t_5numpy_float64_t (*__pyx_v_rdds)[3], __pyx_t_5numpy_float64_t *__pyx_v_rorigin, int __pyx_v_i, int __pyx_v_j, int __pyx_v_k) { - int __pyx_v_oi; - int __pyx_t_1; - __Pyx_RefNannySetupContext("set_rotated_pos"); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":80 - * np.float64_t rorigin[3], int i, int j, int k): - * cdef int oi - * for oi in range(3): # <<<<<<<<<<<<<< - * cp[oi] = rdds[0][oi] * (0.5 + i) \ - * + rdds[1][oi] * (0.5 + j) \ - */ - for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { - __pyx_v_oi = __pyx_t_1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":81 - * cdef int oi - * for oi in range(3): - * cp[oi] = rdds[0][oi] * (0.5 + i) \ # <<<<<<<<<<<<<< - * + rdds[1][oi] * (0.5 + j) \ - * + rdds[2][oi] * (0.5 + k) \ - */ - (__pyx_v_cp[__pyx_v_oi]) = ((((((__pyx_v_rdds[0])[__pyx_v_oi]) * (0.5 + __pyx_v_i)) + (((__pyx_v_rdds[1])[__pyx_v_oi]) * (0.5 + __pyx_v_j))) + (((__pyx_v_rdds[2])[__pyx_v_oi]) * (0.5 + __pyx_v_k))) + (__pyx_v_rorigin[__pyx_v_oi])); - } - - __Pyx_RefNannyFinishContext(); -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":88 - * #@cython.wraparound(False) - * #@cython.boundscheck(False) - * def grid_points_in_volume( # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t, ndim=1] box_lengths, - * np.ndarray[np.float64_t, ndim=1] box_origin, - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_grid_points_in_volume(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_grid_points_in_volume(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_box_lengths = 0; - PyArrayObject *__pyx_v_box_origin = 0; - PyArrayObject *__pyx_v_rot_mat = 0; - PyArrayObject *__pyx_v_grid_left_edge = 0; - PyArrayObject *__pyx_v_grid_right_edge = 0; - PyArrayObject *__pyx_v_dds = 0; - PyArrayObject *__pyx_v_mask = 0; - int __pyx_v_break_first; - int __pyx_v_n[3]; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - __pyx_t_5numpy_float64_t __pyx_v_rds[3][3]; - __pyx_t_5numpy_float64_t __pyx_v_cur_pos[3]; - __pyx_t_5numpy_float64_t __pyx_v_rorigin[3]; - Py_buffer __pyx_bstruct_dds; - Py_ssize_t __pyx_bstride_0_dds = 0; - Py_ssize_t __pyx_bshape_0_dds = 0; - Py_buffer __pyx_bstruct_grid_right_edge; - Py_ssize_t __pyx_bstride_0_grid_right_edge = 0; - Py_ssize_t __pyx_bshape_0_grid_right_edge = 0; - Py_buffer __pyx_bstruct_mask; - Py_ssize_t __pyx_bstride_0_mask = 0; - Py_ssize_t __pyx_bstride_1_mask = 0; - Py_ssize_t __pyx_bstride_2_mask = 0; - Py_ssize_t __pyx_bshape_0_mask = 0; - Py_ssize_t __pyx_bshape_1_mask = 0; - Py_ssize_t __pyx_bshape_2_mask = 0; - Py_buffer __pyx_bstruct_box_lengths; - Py_ssize_t __pyx_bstride_0_box_lengths = 0; - Py_ssize_t __pyx_bshape_0_box_lengths = 0; - Py_buffer __pyx_bstruct_rot_mat; - Py_ssize_t __pyx_bstride_0_rot_mat = 0; - Py_ssize_t __pyx_bstride_1_rot_mat = 0; - Py_ssize_t __pyx_bshape_0_rot_mat = 0; - Py_ssize_t __pyx_bshape_1_rot_mat = 0; - Py_buffer __pyx_bstruct_box_origin; - Py_ssize_t __pyx_bstride_0_box_origin = 0; - Py_ssize_t __pyx_bshape_0_box_origin = 0; - Py_buffer __pyx_bstruct_grid_left_edge; - Py_ssize_t __pyx_bstride_0_grid_left_edge = 0; - Py_ssize_t __pyx_bshape_0_grid_left_edge = 0; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - 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; - long __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - long __pyx_t_17; - long __pyx_t_18; - int __pyx_t_19; - int __pyx_t_20; - int __pyx_t_21; - __pyx_t_5numpy_int32_t __pyx_t_22; - int __pyx_t_23; - int __pyx_t_24; - int __pyx_t_25; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__box_lengths,&__pyx_n_s__box_origin,&__pyx_n_s__rot_mat,&__pyx_n_s__grid_left_edge,&__pyx_n_s__grid_right_edge,&__pyx_n_s__dds,&__pyx_n_s__mask,&__pyx_n_s__break_first,0}; - __Pyx_RefNannySetupContext("grid_points_in_volume"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[8] = {0,0,0,0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__box_lengths); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__box_origin); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("grid_points_in_volume", 1, 8, 8, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rot_mat); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("grid_points_in_volume", 1, 8, 8, 2); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid_left_edge); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("grid_points_in_volume", 1, 8, 8, 3); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid_right_edge); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("grid_points_in_volume", 1, 8, 8, 4); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dds); - if (likely(values[5])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("grid_points_in_volume", 1, 8, 8, 5); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 6: - values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask); - if (likely(values[6])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("grid_points_in_volume", 1, 8, 8, 6); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 7: - values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__break_first); - if (likely(values[7])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("grid_points_in_volume", 1, 8, 8, 7); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "grid_points_in_volume") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_box_lengths = ((PyArrayObject *)values[0]); - __pyx_v_box_origin = ((PyArrayObject *)values[1]); - __pyx_v_rot_mat = ((PyArrayObject *)values[2]); - __pyx_v_grid_left_edge = ((PyArrayObject *)values[3]); - __pyx_v_grid_right_edge = ((PyArrayObject *)values[4]); - __pyx_v_dds = ((PyArrayObject *)values[5]); - __pyx_v_mask = ((PyArrayObject *)values[6]); - __pyx_v_break_first = __Pyx_PyInt_AsInt(values[7]); if (unlikely((__pyx_v_break_first == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_box_lengths = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_box_origin = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_rot_mat = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_grid_left_edge = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); - __pyx_v_grid_right_edge = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); - __pyx_v_dds = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 5)); - __pyx_v_mask = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 6)); - __pyx_v_break_first = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 7)); if (unlikely((__pyx_v_break_first == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("grid_points_in_volume", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.grid_points_in_volume"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_box_lengths.buf = NULL; - __pyx_bstruct_box_origin.buf = NULL; - __pyx_bstruct_rot_mat.buf = NULL; - __pyx_bstruct_grid_left_edge.buf = NULL; - __pyx_bstruct_grid_right_edge.buf = NULL; - __pyx_bstruct_dds.buf = NULL; - __pyx_bstruct_mask.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_box_lengths), __pyx_ptype_5numpy_ndarray, 1, "box_lengths", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_box_origin), __pyx_ptype_5numpy_ndarray, 1, "box_origin", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rot_mat), __pyx_ptype_5numpy_ndarray, 1, "rot_mat", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grid_left_edge), __pyx_ptype_5numpy_ndarray, 1, "grid_left_edge", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grid_right_edge), __pyx_ptype_5numpy_ndarray, 1, "grid_right_edge", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dds), __pyx_ptype_5numpy_ndarray, 1, "dds", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_box_lengths, (PyObject*)__pyx_v_box_lengths, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_box_lengths = __pyx_bstruct_box_lengths.strides[0]; - __pyx_bshape_0_box_lengths = __pyx_bstruct_box_lengths.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_box_origin, (PyObject*)__pyx_v_box_origin, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_box_origin = __pyx_bstruct_box_origin.strides[0]; - __pyx_bshape_0_box_origin = __pyx_bstruct_box_origin.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_rot_mat, (PyObject*)__pyx_v_rot_mat, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_rot_mat = __pyx_bstruct_rot_mat.strides[0]; __pyx_bstride_1_rot_mat = __pyx_bstruct_rot_mat.strides[1]; - __pyx_bshape_0_rot_mat = __pyx_bstruct_rot_mat.shape[0]; __pyx_bshape_1_rot_mat = __pyx_bstruct_rot_mat.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_grid_left_edge, (PyObject*)__pyx_v_grid_left_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_grid_left_edge = __pyx_bstruct_grid_left_edge.strides[0]; - __pyx_bshape_0_grid_left_edge = __pyx_bstruct_grid_left_edge.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_grid_right_edge, (PyObject*)__pyx_v_grid_right_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_grid_right_edge = __pyx_bstruct_grid_right_edge.strides[0]; - __pyx_bshape_0_grid_right_edge = __pyx_bstruct_grid_right_edge.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dds, (PyObject*)__pyx_v_dds, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_dds = __pyx_bstruct_dds.strides[0]; - __pyx_bshape_0_dds = __pyx_bstruct_dds.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_mask, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_mask = __pyx_bstruct_mask.strides[0]; __pyx_bstride_1_mask = __pyx_bstruct_mask.strides[1]; __pyx_bstride_2_mask = __pyx_bstruct_mask.strides[2]; - __pyx_bshape_0_mask = __pyx_bstruct_mask.shape[0]; __pyx_bshape_1_mask = __pyx_bstruct_mask.shape[1]; __pyx_bshape_2_mask = __pyx_bstruct_mask.shape[2]; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":99 - * cdef int n[3], i, j, k, ax - * cdef np.float64_t rds[3][3], cur_pos[3], rorigin[3] - * for i in range(3): # <<<<<<<<<<<<<< - * rorigin[i] = 0.0 - * for i in range(3): - */ - for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":100 - * cdef np.float64_t rds[3][3], cur_pos[3], rorigin[3] - * for i in range(3): - * rorigin[i] = 0.0 # <<<<<<<<<<<<<< - * for i in range(3): - * n[i] = mask.shape[i] - */ - (__pyx_v_rorigin[__pyx_v_i]) = 0.0; - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":101 - * for i in range(3): - * rorigin[i] = 0.0 - * for i in range(3): # <<<<<<<<<<<<<< - * n[i] = mask.shape[i] - * for j in range(3): - */ - for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":102 - * rorigin[i] = 0.0 - * for i in range(3): - * n[i] = mask.shape[i] # <<<<<<<<<<<<<< - * for j in range(3): - * # Set up our transposed dx, which has a component in every - */ - (__pyx_v_n[__pyx_v_i]) = (__pyx_v_mask->dimensions[__pyx_v_i]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":103 - * for i in range(3): - * n[i] = mask.shape[i] - * for j in range(3): # <<<<<<<<<<<<<< - * # Set up our transposed dx, which has a component in every - * # direction - */ - for (__pyx_t_2 = 0; __pyx_t_2 < 3; __pyx_t_2+=1) { - __pyx_v_j = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":106 - * # Set up our transposed dx, which has a component in every - * # direction - * rds[i][j] = dds[i] * rot_mat[j,i] # <<<<<<<<<<<<<< - * # In our rotated coordinate system, the box origin is 0,0,0 - * # so we subtract the box_origin from the grid_origin and rotate - */ - __pyx_t_3 = __pyx_v_i; - __pyx_t_4 = -1; - if (__pyx_t_3 < 0) { - __pyx_t_3 += __pyx_bshape_0_dds; - if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 0; - } else if (unlikely(__pyx_t_3 >= __pyx_bshape_0_dds)) __pyx_t_4 = 0; - if (unlikely(__pyx_t_4 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_4); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = __pyx_v_j; - __pyx_t_5 = __pyx_v_i; - __pyx_t_6 = -1; - if (__pyx_t_4 < 0) { - __pyx_t_4 += __pyx_bshape_0_rot_mat; - if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0; - } else if (unlikely(__pyx_t_4 >= __pyx_bshape_0_rot_mat)) __pyx_t_6 = 0; - if (__pyx_t_5 < 0) { - __pyx_t_5 += __pyx_bshape_1_rot_mat; - if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1; - } else if (unlikely(__pyx_t_5 >= __pyx_bshape_1_rot_mat)) __pyx_t_6 = 1; - if (unlikely(__pyx_t_6 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_6); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - ((__pyx_v_rds[__pyx_v_i])[__pyx_v_j]) = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dds.buf, __pyx_t_3, __pyx_bstride_0_dds)) * (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_rot_mat.buf, __pyx_t_4, __pyx_bstride_0_rot_mat, __pyx_t_5, __pyx_bstride_1_rot_mat))); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":110 - * # so we subtract the box_origin from the grid_origin and rotate - * # that - * rorigin[j] += (grid_left_edge[i] - box_origin[i]) * rot_mat[j,i] # <<<<<<<<<<<<<< - * - * for i in range(n[0]): - */ - __pyx_t_6 = __pyx_v_i; - __pyx_t_7 = -1; - if (__pyx_t_6 < 0) { - __pyx_t_6 += __pyx_bshape_0_grid_left_edge; - if (unlikely(__pyx_t_6 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_6 >= __pyx_bshape_0_grid_left_edge)) __pyx_t_7 = 0; - if (unlikely(__pyx_t_7 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_7); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_7 = __pyx_v_i; - __pyx_t_8 = -1; - if (__pyx_t_7 < 0) { - __pyx_t_7 += __pyx_bshape_0_box_origin; - if (unlikely(__pyx_t_7 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_7 >= __pyx_bshape_0_box_origin)) __pyx_t_8 = 0; - if (unlikely(__pyx_t_8 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_8); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_8 = __pyx_v_j; - __pyx_t_9 = __pyx_v_i; - __pyx_t_10 = -1; - if (__pyx_t_8 < 0) { - __pyx_t_8 += __pyx_bshape_0_rot_mat; - if (unlikely(__pyx_t_8 < 0)) __pyx_t_10 = 0; - } else if (unlikely(__pyx_t_8 >= __pyx_bshape_0_rot_mat)) __pyx_t_10 = 0; - if (__pyx_t_9 < 0) { - __pyx_t_9 += __pyx_bshape_1_rot_mat; - if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 1; - } else if (unlikely(__pyx_t_9 >= __pyx_bshape_1_rot_mat)) __pyx_t_10 = 1; - if (unlikely(__pyx_t_10 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_10); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - (__pyx_v_rorigin[__pyx_v_j]) += (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_grid_left_edge.buf, __pyx_t_6, __pyx_bstride_0_grid_left_edge)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_box_origin.buf, __pyx_t_7, __pyx_bstride_0_box_origin))) * (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_rot_mat.buf, __pyx_t_8, __pyx_bstride_0_rot_mat, __pyx_t_9, __pyx_bstride_1_rot_mat))); - } - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":112 - * rorigin[j] += (grid_left_edge[i] - box_origin[i]) * rot_mat[j,i] - * - * for i in range(n[0]): # <<<<<<<<<<<<<< - * for j in range(n[1]): - * for k in range(n[2]): - */ - __pyx_t_1 = (__pyx_v_n[0]); - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":113 - * - * for i in range(n[0]): - * for j in range(n[1]): # <<<<<<<<<<<<<< - * for k in range(n[2]): - * set_rotated_pos(cur_pos, rds, rorigin, i, j, k) - */ - __pyx_t_10 = (__pyx_v_n[1]); - for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { - __pyx_v_j = __pyx_t_11; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":114 - * for i in range(n[0]): - * for j in range(n[1]): - * for k in range(n[2]): # <<<<<<<<<<<<<< - * set_rotated_pos(cur_pos, rds, rorigin, i, j, k) - * if (cur_pos[0] > box_lengths[0]): continue - */ - __pyx_t_12 = (__pyx_v_n[2]); - for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { - __pyx_v_k = __pyx_t_13; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":115 - * for j in range(n[1]): - * for k in range(n[2]): - * set_rotated_pos(cur_pos, rds, rorigin, i, j, k) # <<<<<<<<<<<<<< - * if (cur_pos[0] > box_lengths[0]): continue - * if (cur_pos[1] > box_lengths[1]): continue - */ - __pyx_f_2yt_9amr_utils_set_rotated_pos(__pyx_v_cur_pos, __pyx_v_rds, __pyx_v_rorigin, __pyx_v_i, __pyx_v_j, __pyx_v_k); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":116 - * for k in range(n[2]): - * set_rotated_pos(cur_pos, rds, rorigin, i, j, k) - * if (cur_pos[0] > box_lengths[0]): continue # <<<<<<<<<<<<<< - * if (cur_pos[1] > box_lengths[1]): continue - * if (cur_pos[2] > box_lengths[2]): continue - */ - __pyx_t_14 = 0; - __pyx_t_15 = -1; - if (__pyx_t_14 < 0) { - __pyx_t_14 += __pyx_bshape_0_box_lengths; - if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 0; - } else if (unlikely(__pyx_t_14 >= __pyx_bshape_0_box_lengths)) __pyx_t_15 = 0; - if (unlikely(__pyx_t_15 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_15); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_16 = ((__pyx_v_cur_pos[0]) > (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_box_lengths.buf, __pyx_t_14, __pyx_bstride_0_box_lengths))); - if (__pyx_t_16) { - goto __pyx_L16_continue; - goto __pyx_L18; - } - __pyx_L18:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":117 - * set_rotated_pos(cur_pos, rds, rorigin, i, j, k) - * if (cur_pos[0] > box_lengths[0]): continue - * if (cur_pos[1] > box_lengths[1]): continue # <<<<<<<<<<<<<< - * if (cur_pos[2] > box_lengths[2]): continue - * if (cur_pos[0] < 0.0): continue - */ - __pyx_t_17 = 1; - __pyx_t_15 = -1; - if (__pyx_t_17 < 0) { - __pyx_t_17 += __pyx_bshape_0_box_lengths; - if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 0; - } else if (unlikely(__pyx_t_17 >= __pyx_bshape_0_box_lengths)) __pyx_t_15 = 0; - if (unlikely(__pyx_t_15 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_15); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_16 = ((__pyx_v_cur_pos[1]) > (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_box_lengths.buf, __pyx_t_17, __pyx_bstride_0_box_lengths))); - if (__pyx_t_16) { - goto __pyx_L16_continue; - goto __pyx_L19; - } - __pyx_L19:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":118 - * if (cur_pos[0] > box_lengths[0]): continue - * if (cur_pos[1] > box_lengths[1]): continue - * if (cur_pos[2] > box_lengths[2]): continue # <<<<<<<<<<<<<< - * if (cur_pos[0] < 0.0): continue - * if (cur_pos[1] < 0.0): continue - */ - __pyx_t_18 = 2; - __pyx_t_15 = -1; - if (__pyx_t_18 < 0) { - __pyx_t_18 += __pyx_bshape_0_box_lengths; - if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 0; - } else if (unlikely(__pyx_t_18 >= __pyx_bshape_0_box_lengths)) __pyx_t_15 = 0; - if (unlikely(__pyx_t_15 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_15); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_16 = ((__pyx_v_cur_pos[2]) > (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_box_lengths.buf, __pyx_t_18, __pyx_bstride_0_box_lengths))); - if (__pyx_t_16) { - goto __pyx_L16_continue; - goto __pyx_L20; - } - __pyx_L20:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":119 - * if (cur_pos[1] > box_lengths[1]): continue - * if (cur_pos[2] > box_lengths[2]): continue - * if (cur_pos[0] < 0.0): continue # <<<<<<<<<<<<<< - * if (cur_pos[1] < 0.0): continue - * if (cur_pos[2] < 0.0): continue - */ - __pyx_t_16 = ((__pyx_v_cur_pos[0]) < 0.0); - if (__pyx_t_16) { - goto __pyx_L16_continue; - goto __pyx_L21; - } - __pyx_L21:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":120 - * if (cur_pos[2] > box_lengths[2]): continue - * if (cur_pos[0] < 0.0): continue - * if (cur_pos[1] < 0.0): continue # <<<<<<<<<<<<<< - * if (cur_pos[2] < 0.0): continue - * if break_first: - */ - __pyx_t_16 = ((__pyx_v_cur_pos[1]) < 0.0); - if (__pyx_t_16) { - goto __pyx_L16_continue; - goto __pyx_L22; - } - __pyx_L22:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":121 - * if (cur_pos[0] < 0.0): continue - * if (cur_pos[1] < 0.0): continue - * if (cur_pos[2] < 0.0): continue # <<<<<<<<<<<<<< - * if break_first: - * if mask[i,j,k]: return 1 - */ - __pyx_t_16 = ((__pyx_v_cur_pos[2]) < 0.0); - if (__pyx_t_16) { - goto __pyx_L16_continue; - goto __pyx_L23; - } - __pyx_L23:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":122 - * if (cur_pos[1] < 0.0): continue - * if (cur_pos[2] < 0.0): continue - * if break_first: # <<<<<<<<<<<<<< - * if mask[i,j,k]: return 1 - * else: - */ - if (__pyx_v_break_first) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":123 - * if (cur_pos[2] < 0.0): continue - * if break_first: - * if mask[i,j,k]: return 1 # <<<<<<<<<<<<<< - * else: - * mask[i,j,k] = 1 - */ - __pyx_t_15 = __pyx_v_i; - __pyx_t_19 = __pyx_v_j; - __pyx_t_20 = __pyx_v_k; - __pyx_t_21 = -1; - if (__pyx_t_15 < 0) { - __pyx_t_15 += __pyx_bshape_0_mask; - if (unlikely(__pyx_t_15 < 0)) __pyx_t_21 = 0; - } else if (unlikely(__pyx_t_15 >= __pyx_bshape_0_mask)) __pyx_t_21 = 0; - if (__pyx_t_19 < 0) { - __pyx_t_19 += __pyx_bshape_1_mask; - if (unlikely(__pyx_t_19 < 0)) __pyx_t_21 = 1; - } else if (unlikely(__pyx_t_19 >= __pyx_bshape_1_mask)) __pyx_t_21 = 1; - if (__pyx_t_20 < 0) { - __pyx_t_20 += __pyx_bshape_2_mask; - if (unlikely(__pyx_t_20 < 0)) __pyx_t_21 = 2; - } else if (unlikely(__pyx_t_20 >= __pyx_bshape_2_mask)) __pyx_t_21 = 2; - if (unlikely(__pyx_t_21 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_21); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_22 = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_mask.buf, __pyx_t_15, __pyx_bstride_0_mask, __pyx_t_19, __pyx_bstride_1_mask, __pyx_t_20, __pyx_bstride_2_mask)); - if (__pyx_t_22) { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_int_1); - __pyx_r = __pyx_int_1; - goto __pyx_L0; - goto __pyx_L25; - } - __pyx_L25:; - goto __pyx_L24; - } - /*else*/ { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":125 - * if mask[i,j,k]: return 1 - * else: - * mask[i,j,k] = 1 # <<<<<<<<<<<<<< - * return 0 - * - */ - __pyx_t_21 = __pyx_v_i; - __pyx_t_23 = __pyx_v_j; - __pyx_t_24 = __pyx_v_k; - __pyx_t_25 = -1; - if (__pyx_t_21 < 0) { - __pyx_t_21 += __pyx_bshape_0_mask; - if (unlikely(__pyx_t_21 < 0)) __pyx_t_25 = 0; - } else if (unlikely(__pyx_t_21 >= __pyx_bshape_0_mask)) __pyx_t_25 = 0; - if (__pyx_t_23 < 0) { - __pyx_t_23 += __pyx_bshape_1_mask; - if (unlikely(__pyx_t_23 < 0)) __pyx_t_25 = 1; - } else if (unlikely(__pyx_t_23 >= __pyx_bshape_1_mask)) __pyx_t_25 = 1; - if (__pyx_t_24 < 0) { - __pyx_t_24 += __pyx_bshape_2_mask; - if (unlikely(__pyx_t_24 < 0)) __pyx_t_25 = 2; - } else if (unlikely(__pyx_t_24 >= __pyx_bshape_2_mask)) __pyx_t_25 = 2; - if (unlikely(__pyx_t_25 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_25); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_mask.buf, __pyx_t_21, __pyx_bstride_0_mask, __pyx_t_23, __pyx_bstride_1_mask, __pyx_t_24, __pyx_bstride_2_mask) = 1; - } - __pyx_L24:; - __pyx_L16_continue:; - } - } - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":126 - * else: - * mask[i,j,k] = 1 - * return 0 # <<<<<<<<<<<<<< - * - * cdef void normalize_vector(np.float64_t vec[3]): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_int_0); - __pyx_r = __pyx_int_0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dds); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_right_edge); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_box_lengths); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_rot_mat); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_box_origin); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_left_edge); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.amr_utils.grid_points_in_volume"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dds); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_right_edge); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_box_lengths); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_rot_mat); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_box_origin); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_left_edge); - __pyx_L2:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":128 - * return 0 - * - * cdef void normalize_vector(np.float64_t vec[3]): # <<<<<<<<<<<<<< - * cdef int i - * cdef np.float64_t norm = 0.0 - */ - -static void __pyx_f_2yt_9amr_utils_normalize_vector(__pyx_t_5numpy_float64_t *__pyx_v_vec) { - int __pyx_v_i; - __pyx_t_5numpy_float64_t __pyx_v_norm; - int __pyx_t_1; - __Pyx_RefNannySetupContext("normalize_vector"); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":130 - * cdef void normalize_vector(np.float64_t vec[3]): - * cdef int i - * cdef np.float64_t norm = 0.0 # <<<<<<<<<<<<<< - * for i in range(3): - * norm += vec[i]*vec[i] - */ - __pyx_v_norm = 0.0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":131 - * cdef int i - * cdef np.float64_t norm = 0.0 - * for i in range(3): # <<<<<<<<<<<<<< - * norm += vec[i]*vec[i] - * norm = norm**0.5 - */ - for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":132 - * cdef np.float64_t norm = 0.0 - * for i in range(3): - * norm += vec[i]*vec[i] # <<<<<<<<<<<<<< - * norm = norm**0.5 - * for i in range(3): - */ - __pyx_v_norm += ((__pyx_v_vec[__pyx_v_i]) * (__pyx_v_vec[__pyx_v_i])); - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":133 - * for i in range(3): - * norm += vec[i]*vec[i] - * norm = norm**0.5 # <<<<<<<<<<<<<< - * for i in range(3): - * vec[i] /= norm - */ - __pyx_v_norm = pow(__pyx_v_norm, 0.5); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":134 - * norm += vec[i]*vec[i] - * norm = norm**0.5 - * for i in range(3): # <<<<<<<<<<<<<< - * vec[i] /= norm - * - */ - for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":135 - * norm = norm**0.5 - * for i in range(3): - * vec[i] /= norm # <<<<<<<<<<<<<< - * - * cdef void get_cross_product(np.float64_t v1[3], - */ - (__pyx_v_vec[__pyx_v_i]) /= __pyx_v_norm; - } - - __Pyx_RefNannyFinishContext(); -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":137 - * vec[i] /= norm - * - * cdef void get_cross_product(np.float64_t v1[3], # <<<<<<<<<<<<<< - * np.float64_t v2[3], - * np.float64_t cp[3]): - */ - -static void __pyx_f_2yt_9amr_utils_get_cross_product(__pyx_t_5numpy_float64_t *__pyx_v_v1, __pyx_t_5numpy_float64_t *__pyx_v_v2, __pyx_t_5numpy_float64_t *__pyx_v_cp) { - __Pyx_RefNannySetupContext("get_cross_product"); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":140 - * np.float64_t v2[3], - * np.float64_t cp[3]): - * cp[0] = v1[1]*v2[2] - v1[2]*v2[1] # <<<<<<<<<<<<<< - * cp[1] = v1[3]*v2[0] - v1[0]*v2[3] - * cp[2] = v1[0]*v2[1] - v1[1]*v2[0] - */ - (__pyx_v_cp[0]) = (((__pyx_v_v1[1]) * (__pyx_v_v2[2])) - ((__pyx_v_v1[2]) * (__pyx_v_v2[1]))); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":141 - * np.float64_t cp[3]): - * cp[0] = v1[1]*v2[2] - v1[2]*v2[1] - * cp[1] = v1[3]*v2[0] - v1[0]*v2[3] # <<<<<<<<<<<<<< - * cp[2] = v1[0]*v2[1] - v1[1]*v2[0] - * #print cp[0], cp[1], cp[2] - */ - (__pyx_v_cp[1]) = (((__pyx_v_v1[3]) * (__pyx_v_v2[0])) - ((__pyx_v_v1[0]) * (__pyx_v_v2[3]))); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":142 - * cp[0] = v1[1]*v2[2] - v1[2]*v2[1] - * cp[1] = v1[3]*v2[0] - v1[0]*v2[3] - * cp[2] = v1[0]*v2[1] - v1[1]*v2[0] # <<<<<<<<<<<<<< - * #print cp[0], cp[1], cp[2] - * - */ - (__pyx_v_cp[2]) = (((__pyx_v_v1[0]) * (__pyx_v_v2[1])) - ((__pyx_v_v1[1]) * (__pyx_v_v2[0]))); - - __Pyx_RefNannyFinishContext(); -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":145 - * #print cp[0], cp[1], cp[2] - * - * cdef int check_projected_overlap( # <<<<<<<<<<<<<< - * np.float64_t sep_ax[3], np.float64_t sep_vec[3], int gi, - * np.float64_t b_vec[3][3], np.float64_t g_vec[3][3]): - */ - -static int __pyx_f_2yt_9amr_utils_check_projected_overlap(__pyx_t_5numpy_float64_t *__pyx_v_sep_ax, __pyx_t_5numpy_float64_t *__pyx_v_sep_vec, int __pyx_v_gi, __pyx_t_5numpy_float64_t (*__pyx_v_b_vec)[3], __pyx_t_5numpy_float64_t (*__pyx_v_g_vec)[3]) { - int __pyx_v_g_ax; - int __pyx_v_b_ax; - __pyx_t_5numpy_float64_t __pyx_v_tba; - __pyx_t_5numpy_float64_t __pyx_v_tga; - __pyx_t_5numpy_float64_t __pyx_v_ba; - __pyx_t_5numpy_float64_t __pyx_v_ga; - __pyx_t_5numpy_float64_t __pyx_v_sep_dot; - int __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - __Pyx_RefNannySetupContext("check_projected_overlap"); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":150 - * cdef int g_ax, b_ax - * cdef np.float64_t tba, tga, ba, ga, sep_dot - * ba = ga = sep_dot = 0.0 # <<<<<<<<<<<<<< - * for g_ax in range(3): - * # We need the grid vectors, which we'll precompute here - */ - __pyx_v_ba = 0.0; - __pyx_v_ga = 0.0; - __pyx_v_sep_dot = 0.0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":151 - * cdef np.float64_t tba, tga, ba, ga, sep_dot - * ba = ga = sep_dot = 0.0 - * for g_ax in range(3): # <<<<<<<<<<<<<< - * # We need the grid vectors, which we'll precompute here - * tba = tga = 0.0 - */ - for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { - __pyx_v_g_ax = __pyx_t_1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":153 - * for g_ax in range(3): - * # We need the grid vectors, which we'll precompute here - * tba = tga = 0.0 # <<<<<<<<<<<<<< - * for b_ax in range(3): - * tba += b_vec[g_ax][b_ax] * sep_vec[b_ax] - */ - __pyx_v_tba = 0.0; - __pyx_v_tga = 0.0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":154 - * # We need the grid vectors, which we'll precompute here - * tba = tga = 0.0 - * for b_ax in range(3): # <<<<<<<<<<<<<< - * tba += b_vec[g_ax][b_ax] * sep_vec[b_ax] - * tga += g_vec[g_ax][b_ax] * sep_vec[b_ax] - */ - for (__pyx_t_2 = 0; __pyx_t_2 < 3; __pyx_t_2+=1) { - __pyx_v_b_ax = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":155 - * tba = tga = 0.0 - * for b_ax in range(3): - * tba += b_vec[g_ax][b_ax] * sep_vec[b_ax] # <<<<<<<<<<<<<< - * tga += g_vec[g_ax][b_ax] * sep_vec[b_ax] - * ba += fabs(tba) - */ - __pyx_v_tba += (((__pyx_v_b_vec[__pyx_v_g_ax])[__pyx_v_b_ax]) * (__pyx_v_sep_vec[__pyx_v_b_ax])); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":156 - * for b_ax in range(3): - * tba += b_vec[g_ax][b_ax] * sep_vec[b_ax] - * tga += g_vec[g_ax][b_ax] * sep_vec[b_ax] # <<<<<<<<<<<<<< - * ba += fabs(tba) - * ga += fabs(tga) - */ - __pyx_v_tga += (((__pyx_v_g_vec[__pyx_v_g_ax])[__pyx_v_b_ax]) * (__pyx_v_sep_vec[__pyx_v_b_ax])); - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":157 - * tba += b_vec[g_ax][b_ax] * sep_vec[b_ax] - * tga += g_vec[g_ax][b_ax] * sep_vec[b_ax] - * ba += fabs(tba) # <<<<<<<<<<<<<< - * ga += fabs(tga) - * sep_dot += sep_vec[g_ax] * sep_ax[g_ax] - */ - __pyx_v_ba += fabs(__pyx_v_tba); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":158 - * tga += g_vec[g_ax][b_ax] * sep_vec[b_ax] - * ba += fabs(tba) - * ga += fabs(tga) # <<<<<<<<<<<<<< - * sep_dot += sep_vec[g_ax] * sep_ax[g_ax] - * #print sep_vec[0], sep_vec[1], sep_vec[2], - */ - __pyx_v_ga += fabs(__pyx_v_tga); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":159 - * ba += fabs(tba) - * ga += fabs(tga) - * sep_dot += sep_vec[g_ax] * sep_ax[g_ax] # <<<<<<<<<<<<<< - * #print sep_vec[0], sep_vec[1], sep_vec[2], - * #print sep_ax[0], sep_ax[1], sep_ax[2] - */ - __pyx_v_sep_dot += ((__pyx_v_sep_vec[__pyx_v_g_ax]) * (__pyx_v_sep_ax[__pyx_v_g_ax])); - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":162 - * #print sep_vec[0], sep_vec[1], sep_vec[2], - * #print sep_ax[0], sep_ax[1], sep_ax[2] - * return (fabs(sep_dot) > ba+ga) # <<<<<<<<<<<<<< - * # Now we do - * - */ - __pyx_r = (fabs(__pyx_v_sep_dot) > (__pyx_v_ba + __pyx_v_ga)); - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":167 - * @cython.wraparound(False) - * @cython.boundscheck(False) - * def find_grids_in_inclined_box( # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t, ndim=2] box_vectors, - * np.ndarray[np.float64_t, ndim=1] box_center, - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_find_grids_in_inclined_box(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_find_grids_in_inclined_box(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_box_vectors = 0; - PyArrayObject *__pyx_v_box_center = 0; - PyArrayObject *__pyx_v_grid_left_edges = 0; - PyArrayObject *__pyx_v_grid_right_edges = 0; - int __pyx_v_n; - int __pyx_v_g_ax; - int __pyx_v_b_ax; - int __pyx_v_gi; - __pyx_t_5numpy_float64_t __pyx_v_b_vec[3][3]; - __pyx_t_5numpy_float64_t __pyx_v_g_vec[3][3]; - __pyx_t_5numpy_float64_t __pyx_v_a_vec[3][3]; - __pyx_t_5numpy_float64_t __pyx_v_sep_ax[15][3]; - __pyx_t_5numpy_float64_t __pyx_v_sep_vec[3]; - PyArrayObject *__pyx_v_good = 0; - PyArrayObject *__pyx_v_grid_centers; - Py_buffer __pyx_bstruct_grid_left_edges; - Py_ssize_t __pyx_bstride_0_grid_left_edges = 0; - Py_ssize_t __pyx_bstride_1_grid_left_edges = 0; - Py_ssize_t __pyx_bshape_0_grid_left_edges = 0; - Py_ssize_t __pyx_bshape_1_grid_left_edges = 0; - Py_buffer __pyx_bstruct_box_vectors; - Py_ssize_t __pyx_bstride_0_box_vectors = 0; - Py_ssize_t __pyx_bstride_1_box_vectors = 0; - Py_ssize_t __pyx_bshape_0_box_vectors = 0; - Py_ssize_t __pyx_bshape_1_box_vectors = 0; - Py_buffer __pyx_bstruct_good; - Py_ssize_t __pyx_bstride_0_good = 0; - Py_ssize_t __pyx_bshape_0_good = 0; - Py_buffer __pyx_bstruct_grid_right_edges; - Py_ssize_t __pyx_bstride_0_grid_right_edges = 0; - Py_ssize_t __pyx_bstride_1_grid_right_edges = 0; - Py_ssize_t __pyx_bshape_0_grid_right_edges = 0; - Py_ssize_t __pyx_bshape_1_grid_right_edges = 0; - Py_buffer __pyx_bstruct_grid_centers; - Py_ssize_t __pyx_bstride_0_grid_centers = 0; - Py_ssize_t __pyx_bstride_1_grid_centers = 0; - Py_ssize_t __pyx_bshape_0_grid_centers = 0; - Py_ssize_t __pyx_bshape_1_grid_centers = 0; - Py_buffer __pyx_bstruct_box_center; - Py_ssize_t __pyx_bstride_0_box_center = 0; - Py_ssize_t __pyx_bshape_0_box_center = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyArrayObject *__pyx_t_5 = NULL; - int __pyx_t_6; - int __pyx_t_7; - PyArrayObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - int __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - int __pyx_t_18; - int __pyx_t_19; - int __pyx_t_20; - int __pyx_t_21; - int __pyx_t_22; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__box_vectors,&__pyx_n_s__box_center,&__pyx_n_s__grid_left_edges,&__pyx_n_s__grid_right_edges,0}; - __Pyx_RefNannySetupContext("find_grids_in_inclined_box"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[4] = {0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__box_vectors); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__box_center); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("find_grids_in_inclined_box", 1, 4, 4, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid_left_edges); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("find_grids_in_inclined_box", 1, 4, 4, 2); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid_right_edges); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("find_grids_in_inclined_box", 1, 4, 4, 3); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "find_grids_in_inclined_box") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_box_vectors = ((PyArrayObject *)values[0]); - __pyx_v_box_center = ((PyArrayObject *)values[1]); - __pyx_v_grid_left_edges = ((PyArrayObject *)values[2]); - __pyx_v_grid_right_edges = ((PyArrayObject *)values[3]); - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_box_vectors = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_box_center = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_grid_left_edges = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_grid_right_edges = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("find_grids_in_inclined_box", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.find_grids_in_inclined_box"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_v_grid_centers = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_bstruct_good.buf = NULL; - __pyx_bstruct_grid_centers.buf = NULL; - __pyx_bstruct_box_vectors.buf = NULL; - __pyx_bstruct_box_center.buf = NULL; - __pyx_bstruct_grid_left_edges.buf = NULL; - __pyx_bstruct_grid_right_edges.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_box_vectors), __pyx_ptype_5numpy_ndarray, 1, "box_vectors", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_box_center), __pyx_ptype_5numpy_ndarray, 1, "box_center", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grid_left_edges), __pyx_ptype_5numpy_ndarray, 1, "grid_left_edges", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grid_right_edges), __pyx_ptype_5numpy_ndarray, 1, "grid_right_edges", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_box_vectors, (PyObject*)__pyx_v_box_vectors, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_box_vectors = __pyx_bstruct_box_vectors.strides[0]; __pyx_bstride_1_box_vectors = __pyx_bstruct_box_vectors.strides[1]; - __pyx_bshape_0_box_vectors = __pyx_bstruct_box_vectors.shape[0]; __pyx_bshape_1_box_vectors = __pyx_bstruct_box_vectors.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_box_center, (PyObject*)__pyx_v_box_center, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_box_center = __pyx_bstruct_box_center.strides[0]; - __pyx_bshape_0_box_center = __pyx_bstruct_box_center.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_grid_left_edges, (PyObject*)__pyx_v_grid_left_edges, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_grid_left_edges = __pyx_bstruct_grid_left_edges.strides[0]; __pyx_bstride_1_grid_left_edges = __pyx_bstruct_grid_left_edges.strides[1]; - __pyx_bshape_0_grid_left_edges = __pyx_bstruct_grid_left_edges.shape[0]; __pyx_bshape_1_grid_left_edges = __pyx_bstruct_grid_left_edges.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_grid_right_edges, (PyObject*)__pyx_v_grid_right_edges, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_grid_right_edges = __pyx_bstruct_grid_right_edges.strides[0]; __pyx_bstride_1_grid_right_edges = __pyx_bstruct_grid_right_edges.strides[1]; - __pyx_bshape_0_grid_right_edges = __pyx_bstruct_grid_right_edges.shape[0]; __pyx_bshape_1_grid_right_edges = __pyx_bstruct_grid_right_edges.shape[1]; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":174 - * - * # http://www.gamasutra.com/view/feature/3383/simple_intersection_tests_for_games.php?page=5 - * cdef int n = grid_right_edges.shape[0] # <<<<<<<<<<<<<< - * cdef int g_ax, b_ax, gi - * cdef np.float64_t b_vec[3][3], g_vec[3][3], a_vec[3][3], sep_ax[15][3] - */ - __pyx_v_n = (__pyx_v_grid_right_edges->dimensions[0]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":178 - * cdef np.float64_t b_vec[3][3], g_vec[3][3], a_vec[3][3], sep_ax[15][3] - * cdef np.float64_t sep_vec[3], norm - * cdef np.ndarray[np.int32_t, ndim=1] good = np.zeros(n, dtype='int32') # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t, ndim=2] grid_centers - * # Fill in our axis unit vectors - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(__pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__int32)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_good, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_good = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_good.buf = NULL; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_good = __pyx_bstruct_good.strides[0]; - __pyx_bshape_0_good = __pyx_bstruct_good.shape[0]; - } - } - __pyx_t_5 = 0; - __pyx_v_good = ((PyArrayObject *)__pyx_t_4); - __pyx_t_4 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":181 - * cdef np.ndarray[np.float64_t, ndim=2] grid_centers - * # Fill in our axis unit vectors - * for b_ax in range(3): # <<<<<<<<<<<<<< - * for g_ax in range(3): - * a_vec[b_ax][g_ax] = (b_ax == g_ax) - */ - for (__pyx_t_6 = 0; __pyx_t_6 < 3; __pyx_t_6+=1) { - __pyx_v_b_ax = __pyx_t_6; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":182 - * # Fill in our axis unit vectors - * for b_ax in range(3): - * for g_ax in range(3): # <<<<<<<<<<<<<< - * a_vec[b_ax][g_ax] = (b_ax == g_ax) - * grid_centers = (grid_right_edges + grid_left_edges)/2.0 - */ - for (__pyx_t_7 = 0; __pyx_t_7 < 3; __pyx_t_7+=1) { - __pyx_v_g_ax = __pyx_t_7; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":183 - * for b_ax in range(3): - * for g_ax in range(3): - * a_vec[b_ax][g_ax] = (b_ax == g_ax) # <<<<<<<<<<<<<< - * grid_centers = (grid_right_edges + grid_left_edges)/2.0 - * - */ - ((__pyx_v_a_vec[__pyx_v_b_ax])[__pyx_v_g_ax]) = ((__pyx_t_5numpy_float64_t)(__pyx_v_b_ax == __pyx_v_g_ax)); - } - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":184 - * for g_ax in range(3): - * a_vec[b_ax][g_ax] = (b_ax == g_ax) - * grid_centers = (grid_right_edges + grid_left_edges)/2.0 # <<<<<<<<<<<<<< - * - * # Now we pre-compute our candidate separating axes, because the unit - */ - __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_v_grid_right_edges), ((PyObject *)__pyx_v_grid_left_edges)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = ((PyArrayObject *)__pyx_t_3); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_centers); - __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_grid_centers, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); - if (unlikely(__pyx_t_6 < 0)) { - PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_grid_centers, (PyObject*)__pyx_v_grid_centers, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11); - } - } - __pyx_bstride_0_grid_centers = __pyx_bstruct_grid_centers.strides[0]; __pyx_bstride_1_grid_centers = __pyx_bstruct_grid_centers.strides[1]; - __pyx_bshape_0_grid_centers = __pyx_bstruct_grid_centers.shape[0]; __pyx_bshape_1_grid_centers = __pyx_bstruct_grid_centers.shape[1]; - if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_8 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_grid_centers)); - __pyx_v_grid_centers = ((PyArrayObject *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":188 - * # Now we pre-compute our candidate separating axes, because the unit - * # vectors for all the grids are identical - * for b_ax in range(3): # <<<<<<<<<<<<<< - * # We have 6 principal axes we already know, which are the grid (domain) - * # principal axes and the box axes - */ - for (__pyx_t_6 = 0; __pyx_t_6 < 3; __pyx_t_6+=1) { - __pyx_v_b_ax = __pyx_t_6; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":191 - * # We have 6 principal axes we already know, which are the grid (domain) - * # principal axes and the box axes - * sep_ax[b_ax][0] = sep_ax[b_ax][1] = sep_ax[b_ax][2] = 0.0 # <<<<<<<<<<<<<< - * sep_ax[b_ax][b_ax] = 1.0 # delta_ijk, for grid axes - * for g_ax in range(3): - */ - ((__pyx_v_sep_ax[__pyx_v_b_ax])[0]) = 0.0; - ((__pyx_v_sep_ax[__pyx_v_b_ax])[1]) = 0.0; - ((__pyx_v_sep_ax[__pyx_v_b_ax])[2]) = 0.0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":192 - * # principal axes and the box axes - * sep_ax[b_ax][0] = sep_ax[b_ax][1] = sep_ax[b_ax][2] = 0.0 - * sep_ax[b_ax][b_ax] = 1.0 # delta_ijk, for grid axes # <<<<<<<<<<<<<< - * for g_ax in range(3): - * b_vec[b_ax][g_ax] = 0.5*box_vectors[b_ax,g_ax] - */ - ((__pyx_v_sep_ax[__pyx_v_b_ax])[__pyx_v_b_ax]) = 1.0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":193 - * sep_ax[b_ax][0] = sep_ax[b_ax][1] = sep_ax[b_ax][2] = 0.0 - * sep_ax[b_ax][b_ax] = 1.0 # delta_ijk, for grid axes - * for g_ax in range(3): # <<<<<<<<<<<<<< - * b_vec[b_ax][g_ax] = 0.5*box_vectors[b_ax,g_ax] - * sep_ax[b_ax + 3][g_ax] = b_vec[b_ax][g_ax] # box axes - */ - for (__pyx_t_7 = 0; __pyx_t_7 < 3; __pyx_t_7+=1) { - __pyx_v_g_ax = __pyx_t_7; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":194 - * sep_ax[b_ax][b_ax] = 1.0 # delta_ijk, for grid axes - * for g_ax in range(3): - * b_vec[b_ax][g_ax] = 0.5*box_vectors[b_ax,g_ax] # <<<<<<<<<<<<<< - * sep_ax[b_ax + 3][g_ax] = b_vec[b_ax][g_ax] # box axes - * normalize_vector(sep_ax[b_ax + 3]) - */ - __pyx_t_12 = __pyx_v_b_ax; - __pyx_t_13 = __pyx_v_g_ax; - ((__pyx_v_b_vec[__pyx_v_b_ax])[__pyx_v_g_ax]) = (0.5 * (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_box_vectors.buf, __pyx_t_12, __pyx_bstride_0_box_vectors, __pyx_t_13, __pyx_bstride_1_box_vectors))); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":195 - * for g_ax in range(3): - * b_vec[b_ax][g_ax] = 0.5*box_vectors[b_ax,g_ax] - * sep_ax[b_ax + 3][g_ax] = b_vec[b_ax][g_ax] # box axes # <<<<<<<<<<<<<< - * normalize_vector(sep_ax[b_ax + 3]) - * for g_ax in range(3): - */ - ((__pyx_v_sep_ax[(__pyx_v_b_ax + 3)])[__pyx_v_g_ax]) = ((__pyx_v_b_vec[__pyx_v_b_ax])[__pyx_v_g_ax]); - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":196 - * b_vec[b_ax][g_ax] = 0.5*box_vectors[b_ax,g_ax] - * sep_ax[b_ax + 3][g_ax] = b_vec[b_ax][g_ax] # box axes - * normalize_vector(sep_ax[b_ax + 3]) # <<<<<<<<<<<<<< - * for g_ax in range(3): - * get_cross_product(b_vec[b_ax], a_vec[g_ax], sep_ax[b_ax*3 + g_ax + 6]) - */ - __pyx_f_2yt_9amr_utils_normalize_vector((__pyx_v_sep_ax[(__pyx_v_b_ax + 3)])); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":197 - * sep_ax[b_ax + 3][g_ax] = b_vec[b_ax][g_ax] # box axes - * normalize_vector(sep_ax[b_ax + 3]) - * for g_ax in range(3): # <<<<<<<<<<<<<< - * get_cross_product(b_vec[b_ax], a_vec[g_ax], sep_ax[b_ax*3 + g_ax + 6]) - * normalize_vector(sep_ax[b_ax*3 + g_ax + 6]) - */ - for (__pyx_t_7 = 0; __pyx_t_7 < 3; __pyx_t_7+=1) { - __pyx_v_g_ax = __pyx_t_7; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":198 - * normalize_vector(sep_ax[b_ax + 3]) - * for g_ax in range(3): - * get_cross_product(b_vec[b_ax], a_vec[g_ax], sep_ax[b_ax*3 + g_ax + 6]) # <<<<<<<<<<<<<< - * normalize_vector(sep_ax[b_ax*3 + g_ax + 6]) - * - */ - __pyx_f_2yt_9amr_utils_get_cross_product((__pyx_v_b_vec[__pyx_v_b_ax]), (__pyx_v_a_vec[__pyx_v_g_ax]), (__pyx_v_sep_ax[(((__pyx_v_b_ax * 3) + __pyx_v_g_ax) + 6)])); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":199 - * for g_ax in range(3): - * get_cross_product(b_vec[b_ax], a_vec[g_ax], sep_ax[b_ax*3 + g_ax + 6]) - * normalize_vector(sep_ax[b_ax*3 + g_ax + 6]) # <<<<<<<<<<<<<< - * - * for gi in range(n): - */ - __pyx_f_2yt_9amr_utils_normalize_vector((__pyx_v_sep_ax[(((__pyx_v_b_ax * 3) + __pyx_v_g_ax) + 6)])); - } - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":201 - * normalize_vector(sep_ax[b_ax*3 + g_ax + 6]) - * - * for gi in range(n): # <<<<<<<<<<<<<< - * for g_ax in range(3): - * # Calculate the separation vector - */ - __pyx_t_6 = __pyx_v_n; - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_gi = __pyx_t_7; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":202 - * - * for gi in range(n): - * for g_ax in range(3): # <<<<<<<<<<<<<< - * # Calculate the separation vector - * sep_vec[g_ax] = grid_centers[gi, g_ax] - box_center[g_ax] - */ - for (__pyx_t_14 = 0; __pyx_t_14 < 3; __pyx_t_14+=1) { - __pyx_v_g_ax = __pyx_t_14; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":204 - * for g_ax in range(3): - * # Calculate the separation vector - * sep_vec[g_ax] = grid_centers[gi, g_ax] - box_center[g_ax] # <<<<<<<<<<<<<< - * # Calculate the grid axis lengths - * g_vec[g_ax][0] = g_vec[g_ax][1] = g_vec[g_ax][2] = 0.0 - */ - __pyx_t_15 = __pyx_v_gi; - __pyx_t_16 = __pyx_v_g_ax; - __pyx_t_17 = __pyx_v_g_ax; - (__pyx_v_sep_vec[__pyx_v_g_ax]) = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_grid_centers.buf, __pyx_t_15, __pyx_bstride_0_grid_centers, __pyx_t_16, __pyx_bstride_1_grid_centers)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_box_center.buf, __pyx_t_17, __pyx_bstride_0_box_center))); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":206 - * sep_vec[g_ax] = grid_centers[gi, g_ax] - box_center[g_ax] - * # Calculate the grid axis lengths - * g_vec[g_ax][0] = g_vec[g_ax][1] = g_vec[g_ax][2] = 0.0 # <<<<<<<<<<<<<< - * g_vec[g_ax][g_ax] = 0.5 * (grid_right_edges[gi, g_ax] - * - grid_left_edges[gi, g_ax]) - */ - ((__pyx_v_g_vec[__pyx_v_g_ax])[0]) = 0.0; - ((__pyx_v_g_vec[__pyx_v_g_ax])[1]) = 0.0; - ((__pyx_v_g_vec[__pyx_v_g_ax])[2]) = 0.0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":207 - * # Calculate the grid axis lengths - * g_vec[g_ax][0] = g_vec[g_ax][1] = g_vec[g_ax][2] = 0.0 - * g_vec[g_ax][g_ax] = 0.5 * (grid_right_edges[gi, g_ax] # <<<<<<<<<<<<<< - * - grid_left_edges[gi, g_ax]) - * for b_ax in range(15): - */ - __pyx_t_18 = __pyx_v_gi; - __pyx_t_19 = __pyx_v_g_ax; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":208 - * g_vec[g_ax][0] = g_vec[g_ax][1] = g_vec[g_ax][2] = 0.0 - * g_vec[g_ax][g_ax] = 0.5 * (grid_right_edges[gi, g_ax] - * - grid_left_edges[gi, g_ax]) # <<<<<<<<<<<<<< - * for b_ax in range(15): - * #print b_ax, - */ - __pyx_t_20 = __pyx_v_gi; - __pyx_t_21 = __pyx_v_g_ax; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":207 - * # Calculate the grid axis lengths - * g_vec[g_ax][0] = g_vec[g_ax][1] = g_vec[g_ax][2] = 0.0 - * g_vec[g_ax][g_ax] = 0.5 * (grid_right_edges[gi, g_ax] # <<<<<<<<<<<<<< - * - grid_left_edges[gi, g_ax]) - * for b_ax in range(15): - */ - ((__pyx_v_g_vec[__pyx_v_g_ax])[__pyx_v_g_ax]) = (0.5 * ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_grid_right_edges.buf, __pyx_t_18, __pyx_bstride_0_grid_right_edges, __pyx_t_19, __pyx_bstride_1_grid_right_edges)) - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_grid_left_edges.buf, __pyx_t_20, __pyx_bstride_0_grid_left_edges, __pyx_t_21, __pyx_bstride_1_grid_left_edges)))); - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":209 - * g_vec[g_ax][g_ax] = 0.5 * (grid_right_edges[gi, g_ax] - * - grid_left_edges[gi, g_ax]) - * for b_ax in range(15): # <<<<<<<<<<<<<< - * #print b_ax, - * if check_projected_overlap( - */ - for (__pyx_t_14 = 0; __pyx_t_14 < 15; __pyx_t_14+=1) { - __pyx_v_b_ax = __pyx_t_14; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":213 - * if check_projected_overlap( - * sep_ax[b_ax], sep_vec, gi, - * b_vec, g_vec): # <<<<<<<<<<<<<< - * good[gi] = 1 - * break - */ - __pyx_t_22 = __pyx_f_2yt_9amr_utils_check_projected_overlap((__pyx_v_sep_ax[__pyx_v_b_ax]), __pyx_v_sep_vec, __pyx_v_gi, __pyx_v_b_vec, __pyx_v_g_vec); - if (__pyx_t_22) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":214 - * sep_ax[b_ax], sep_vec, gi, - * b_vec, g_vec): - * good[gi] = 1 # <<<<<<<<<<<<<< - * break - * return good - */ - __pyx_t_22 = __pyx_v_gi; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_good.buf, __pyx_t_22, __pyx_bstride_0_good) = 1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":215 - * b_vec, g_vec): - * good[gi] = 1 - * break # <<<<<<<<<<<<<< - * return good - * - */ - goto __pyx_L21_break; - goto __pyx_L22; - } - __pyx_L22:; - } - __pyx_L21_break:; - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":216 - * good[gi] = 1 - * break - * return good # <<<<<<<<<<<<<< - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_good)); - __pyx_r = ((PyObject *)__pyx_v_good); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_left_edges); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_box_vectors); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_good); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_right_edges); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_centers); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_box_center); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.amr_utils.find_grids_in_inclined_box"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_left_edges); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_box_vectors); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_good); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_right_edges); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_centers); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_box_center); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_good); - __Pyx_DECREF((PyObject *)__pyx_v_grid_centers); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":36 - * - * @cython.boundscheck(False) - * def Transfer3D(np.ndarray[np.float64_t, ndim=3] i_s, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t, ndim=4] o_s, - * np.ndarray[np.float64_t, ndim=4] e, - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_Transfer3D(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_2yt_9amr_utils_Transfer3D[] = "\n This function accepts an incoming slab (*i_s*), a buffer\n for an outgoing set of values at every point in the grid (*o_s*),\n an emission array (*e*), an absorption array (*a*), and dimensions of\n the grid (*imin*, *imax*, *jmin*, *jmax*, *kmin*, *kmax*) as well\n as strides in the *i* and *j* directions, and a *dx* of the grid being\n integrated.\n "; -static PyObject *__pyx_pf_2yt_9amr_utils_Transfer3D(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_i_s = 0; - PyArrayObject *__pyx_v_o_s = 0; - PyArrayObject *__pyx_v_e = 0; - PyArrayObject *__pyx_v_a = 0; - int __pyx_v_imin; - int __pyx_v_imax; - int __pyx_v_jmin; - int __pyx_v_jmax; - int __pyx_v_kmin; - int __pyx_v_kmax; - int __pyx_v_istride; - int __pyx_v_jstride; - __pyx_t_5numpy_float64_t __pyx_v_dx; - int __pyx_v_i; - int __pyx_v_ii; - int __pyx_v_j; - int __pyx_v_jj; - int __pyx_v_k; - int __pyx_v_kk; - int __pyx_v_n; - int __pyx_v_nn; - __pyx_t_5numpy_float64_t *__pyx_v_temp; - Py_buffer __pyx_bstruct_o_s; - Py_ssize_t __pyx_bstride_0_o_s = 0; - Py_ssize_t __pyx_bstride_1_o_s = 0; - Py_ssize_t __pyx_bstride_2_o_s = 0; - Py_ssize_t __pyx_bstride_3_o_s = 0; - Py_ssize_t __pyx_bshape_0_o_s = 0; - Py_ssize_t __pyx_bshape_1_o_s = 0; - Py_ssize_t __pyx_bshape_2_o_s = 0; - Py_ssize_t __pyx_bshape_3_o_s = 0; - Py_buffer __pyx_bstruct_i_s; - Py_ssize_t __pyx_bstride_0_i_s = 0; - Py_ssize_t __pyx_bstride_1_i_s = 0; - Py_ssize_t __pyx_bstride_2_i_s = 0; - Py_ssize_t __pyx_bshape_0_i_s = 0; - Py_ssize_t __pyx_bshape_1_i_s = 0; - Py_ssize_t __pyx_bshape_2_i_s = 0; - Py_buffer __pyx_bstruct_a; - Py_ssize_t __pyx_bstride_0_a = 0; - Py_ssize_t __pyx_bstride_1_a = 0; - Py_ssize_t __pyx_bstride_2_a = 0; - Py_ssize_t __pyx_bstride_3_a = 0; - Py_ssize_t __pyx_bshape_0_a = 0; - Py_ssize_t __pyx_bshape_1_a = 0; - Py_ssize_t __pyx_bshape_2_a = 0; - Py_ssize_t __pyx_bshape_3_a = 0; - Py_buffer __pyx_bstruct_e; - Py_ssize_t __pyx_bstride_0_e = 0; - Py_ssize_t __pyx_bstride_1_e = 0; - Py_ssize_t __pyx_bstride_2_e = 0; - Py_ssize_t __pyx_bstride_3_e = 0; - Py_ssize_t __pyx_bshape_0_e = 0; - Py_ssize_t __pyx_bshape_1_e = 0; - Py_ssize_t __pyx_bshape_2_e = 0; - Py_ssize_t __pyx_bshape_3_e = 0; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - 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; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - int __pyx_t_18; - int __pyx_t_19; - int __pyx_t_20; - int __pyx_t_21; - int __pyx_t_22; - int __pyx_t_23; - int __pyx_t_24; - int __pyx_t_25; - int __pyx_t_26; - int __pyx_t_27; - int __pyx_t_28; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__i_s,&__pyx_n_s__o_s,&__pyx_n_s__e,&__pyx_n_s__a,&__pyx_n_s__imin,&__pyx_n_s__imax,&__pyx_n_s__jmin,&__pyx_n_s__jmax,&__pyx_n_s__kmin,&__pyx_n_s__kmax,&__pyx_n_s__istride,&__pyx_n_s__jstride,&__pyx_n_s__dx,0}; - __Pyx_RefNannySetupContext("Transfer3D"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[13] = {0,0,0,0,0,0,0,0,0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i_s); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__o_s); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 1); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__e); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 2); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 3); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__imin); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 4); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__imax); - if (likely(values[5])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 5); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 6: - values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__jmin); - if (likely(values[6])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 6); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 7: - values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__jmax); - if (likely(values[7])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 7); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 8: - values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__kmin); - if (likely(values[8])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 8); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 9: - values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__kmax); - if (likely(values[9])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 9); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 10: - values[10] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__istride); - if (likely(values[10])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 10); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 11: - values[11] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__jstride); - if (likely(values[11])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 11); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 12: - values[12] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dx); - if (likely(values[12])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 12); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "Transfer3D") < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_i_s = ((PyArrayObject *)values[0]); - __pyx_v_o_s = ((PyArrayObject *)values[1]); - __pyx_v_e = ((PyArrayObject *)values[2]); - __pyx_v_a = ((PyArrayObject *)values[3]); - __pyx_v_imin = __Pyx_PyInt_AsInt(values[4]); if (unlikely((__pyx_v_imin == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_imax = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_imax == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_jmin = __Pyx_PyInt_AsInt(values[6]); if (unlikely((__pyx_v_jmin == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_jmax = __Pyx_PyInt_AsInt(values[7]); if (unlikely((__pyx_v_jmax == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_kmin = __Pyx_PyInt_AsInt(values[8]); if (unlikely((__pyx_v_kmin == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_kmax = __Pyx_PyInt_AsInt(values[9]); if (unlikely((__pyx_v_kmax == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_istride = __Pyx_PyInt_AsInt(values[10]); if (unlikely((__pyx_v_istride == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_jstride = __Pyx_PyInt_AsInt(values[11]); if (unlikely((__pyx_v_jstride == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_dx = __pyx_PyFloat_AsDouble(values[12]); if (unlikely((__pyx_v_dx == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 13) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_i_s = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_o_s = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_e = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_a = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); - __pyx_v_imin = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_imin == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_imax = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_imax == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_jmin = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 6)); if (unlikely((__pyx_v_jmin == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_jmax = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 7)); if (unlikely((__pyx_v_jmax == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_kmin = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 8)); if (unlikely((__pyx_v_kmin == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_kmax = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 9)); if (unlikely((__pyx_v_kmax == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_istride = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 10)); if (unlikely((__pyx_v_istride == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_jstride = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 11)); if (unlikely((__pyx_v_jstride == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_dx = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 12)); if (unlikely((__pyx_v_dx == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.Transfer3D"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_i_s.buf = NULL; - __pyx_bstruct_o_s.buf = NULL; - __pyx_bstruct_e.buf = NULL; - __pyx_bstruct_a.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_i_s), __pyx_ptype_5numpy_ndarray, 1, "i_s", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_o_s), __pyx_ptype_5numpy_ndarray, 1, "o_s", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_e), __pyx_ptype_5numpy_ndarray, 1, "e", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_5numpy_ndarray, 1, "a", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_i_s, (PyObject*)__pyx_v_i_s, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_i_s = __pyx_bstruct_i_s.strides[0]; __pyx_bstride_1_i_s = __pyx_bstruct_i_s.strides[1]; __pyx_bstride_2_i_s = __pyx_bstruct_i_s.strides[2]; - __pyx_bshape_0_i_s = __pyx_bstruct_i_s.shape[0]; __pyx_bshape_1_i_s = __pyx_bstruct_i_s.shape[1]; __pyx_bshape_2_i_s = __pyx_bstruct_i_s.shape[2]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_o_s, (PyObject*)__pyx_v_o_s, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_o_s = __pyx_bstruct_o_s.strides[0]; __pyx_bstride_1_o_s = __pyx_bstruct_o_s.strides[1]; __pyx_bstride_2_o_s = __pyx_bstruct_o_s.strides[2]; __pyx_bstride_3_o_s = __pyx_bstruct_o_s.strides[3]; - __pyx_bshape_0_o_s = __pyx_bstruct_o_s.shape[0]; __pyx_bshape_1_o_s = __pyx_bstruct_o_s.shape[1]; __pyx_bshape_2_o_s = __pyx_bstruct_o_s.shape[2]; __pyx_bshape_3_o_s = __pyx_bstruct_o_s.shape[3]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_e, (PyObject*)__pyx_v_e, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_e = __pyx_bstruct_e.strides[0]; __pyx_bstride_1_e = __pyx_bstruct_e.strides[1]; __pyx_bstride_2_e = __pyx_bstruct_e.strides[2]; __pyx_bstride_3_e = __pyx_bstruct_e.strides[3]; - __pyx_bshape_0_e = __pyx_bstruct_e.shape[0]; __pyx_bshape_1_e = __pyx_bstruct_e.shape[1]; __pyx_bshape_2_e = __pyx_bstruct_e.shape[2]; __pyx_bshape_3_e = __pyx_bstruct_e.shape[3]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_a, (PyObject*)__pyx_v_a, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_a = __pyx_bstruct_a.strides[0]; __pyx_bstride_1_a = __pyx_bstruct_a.strides[1]; __pyx_bstride_2_a = __pyx_bstruct_a.strides[2]; __pyx_bstride_3_a = __pyx_bstruct_a.strides[3]; - __pyx_bshape_0_a = __pyx_bstruct_a.shape[0]; __pyx_bshape_1_a = __pyx_bstruct_a.shape[1]; __pyx_bshape_2_a = __pyx_bstruct_a.shape[2]; __pyx_bshape_3_a = __pyx_bstruct_a.shape[3]; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":55 - * cdef int k, kk - * cdef int n, nn - * nn = o_s.shape[3] # This might be slow # <<<<<<<<<<<<<< - * cdef np.float64_t *temp = malloc(sizeof(np.float64_t) * nn) - * for i in range((imax-imin)*istride): - */ - __pyx_v_nn = (__pyx_v_o_s->dimensions[3]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":56 - * cdef int n, nn - * nn = o_s.shape[3] # This might be slow - * cdef np.float64_t *temp = malloc(sizeof(np.float64_t) * nn) # <<<<<<<<<<<<<< - * for i in range((imax-imin)*istride): - * ii = i + imin*istride - */ - __pyx_v_temp = ((__pyx_t_5numpy_float64_t *)malloc(((sizeof(__pyx_t_5numpy_float64_t)) * __pyx_v_nn))); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":57 - * nn = o_s.shape[3] # This might be slow - * cdef np.float64_t *temp = malloc(sizeof(np.float64_t) * nn) - * for i in range((imax-imin)*istride): # <<<<<<<<<<<<<< - * ii = i + imin*istride - * for j in range((jmax-jmin)*jstride): - */ - __pyx_t_1 = ((__pyx_v_imax - __pyx_v_imin) * __pyx_v_istride); - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":58 - * cdef np.float64_t *temp = malloc(sizeof(np.float64_t) * nn) - * for i in range((imax-imin)*istride): - * ii = i + imin*istride # <<<<<<<<<<<<<< - * for j in range((jmax-jmin)*jstride): - * jj = j + jmin*jstride - */ - __pyx_v_ii = (__pyx_v_i + (__pyx_v_imin * __pyx_v_istride)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":59 - * for i in range((imax-imin)*istride): - * ii = i + imin*istride - * for j in range((jmax-jmin)*jstride): # <<<<<<<<<<<<<< - * jj = j + jmin*jstride - * # Not sure about the ordering of the loops here - */ - __pyx_t_3 = ((__pyx_v_jmax - __pyx_v_jmin) * __pyx_v_jstride); - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_j = __pyx_t_4; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":60 - * ii = i + imin*istride - * for j in range((jmax-jmin)*jstride): - * jj = j + jmin*jstride # <<<<<<<<<<<<<< - * # Not sure about the ordering of the loops here - * for n in range(nn): - */ - __pyx_v_jj = (__pyx_v_j + (__pyx_v_jmin * __pyx_v_jstride)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":62 - * jj = j + jmin*jstride - * # Not sure about the ordering of the loops here - * for n in range(nn): # <<<<<<<<<<<<<< - * temp[n] = i_s[ii,jj,n] - * for k in range(kmax-kmin): - */ - __pyx_t_5 = __pyx_v_nn; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_n = __pyx_t_6; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":63 - * # Not sure about the ordering of the loops here - * for n in range(nn): - * temp[n] = i_s[ii,jj,n] # <<<<<<<<<<<<<< - * for k in range(kmax-kmin): - * kk = k + kmin#*kstride, which doesn't make any sense - */ - __pyx_t_7 = __pyx_v_ii; - __pyx_t_8 = __pyx_v_jj; - __pyx_t_9 = __pyx_v_n; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_bshape_0_i_s; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_bshape_1_i_s; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_bshape_2_i_s; - (__pyx_v_temp[__pyx_v_n]) = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_i_s.buf, __pyx_t_7, __pyx_bstride_0_i_s, __pyx_t_8, __pyx_bstride_1_i_s, __pyx_t_9, __pyx_bstride_2_i_s)); - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":64 - * for n in range(nn): - * temp[n] = i_s[ii,jj,n] - * for k in range(kmax-kmin): # <<<<<<<<<<<<<< - * kk = k + kmin#*kstride, which doesn't make any sense - * for n in range(nn): - */ - __pyx_t_5 = (__pyx_v_kmax - __pyx_v_kmin); - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_k = __pyx_t_6; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":65 - * temp[n] = i_s[ii,jj,n] - * for k in range(kmax-kmin): - * kk = k + kmin#*kstride, which doesn't make any sense # <<<<<<<<<<<<<< - * for n in range(nn): - * o_s[i,j,k,n] = temp[n] + dx*(e[i,j,k,n] - temp[n]*a[i,j,k,n]) - */ - __pyx_v_kk = (__pyx_v_k + __pyx_v_kmin); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":66 - * for k in range(kmax-kmin): - * kk = k + kmin#*kstride, which doesn't make any sense - * for n in range(nn): # <<<<<<<<<<<<<< - * o_s[i,j,k,n] = temp[n] + dx*(e[i,j,k,n] - temp[n]*a[i,j,k,n]) - * temp[n] = o_s[i,j,k,n] - */ - __pyx_t_10 = __pyx_v_nn; - for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { - __pyx_v_n = __pyx_t_11; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":67 - * kk = k + kmin#*kstride, which doesn't make any sense - * for n in range(nn): - * o_s[i,j,k,n] = temp[n] + dx*(e[i,j,k,n] - temp[n]*a[i,j,k,n]) # <<<<<<<<<<<<<< - * temp[n] = o_s[i,j,k,n] - * for n in range(nn): - */ - __pyx_t_12 = __pyx_v_i; - __pyx_t_13 = __pyx_v_j; - __pyx_t_14 = __pyx_v_k; - __pyx_t_15 = __pyx_v_n; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_bshape_0_e; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_bshape_1_e; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_2_e; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_3_e; - __pyx_t_16 = __pyx_v_i; - __pyx_t_17 = __pyx_v_j; - __pyx_t_18 = __pyx_v_k; - __pyx_t_19 = __pyx_v_n; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_bshape_0_a; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_bshape_1_a; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_bshape_2_a; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_bshape_3_a; - __pyx_t_20 = __pyx_v_i; - __pyx_t_21 = __pyx_v_j; - __pyx_t_22 = __pyx_v_k; - __pyx_t_23 = __pyx_v_n; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_bshape_0_o_s; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_bshape_1_o_s; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_bshape_2_o_s; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_bshape_3_o_s; - *__Pyx_BufPtrStrided4d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_o_s.buf, __pyx_t_20, __pyx_bstride_0_o_s, __pyx_t_21, __pyx_bstride_1_o_s, __pyx_t_22, __pyx_bstride_2_o_s, __pyx_t_23, __pyx_bstride_3_o_s) = ((__pyx_v_temp[__pyx_v_n]) + (__pyx_v_dx * ((*__Pyx_BufPtrStrided4d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_e.buf, __pyx_t_12, __pyx_bstride_0_e, __pyx_t_13, __pyx_bstride_1_e, __pyx_t_14, __pyx_bstride_2_e, __pyx_t_15, __pyx_bstride_3_e)) - ((__pyx_v_temp[__pyx_v_n]) * (*__Pyx_BufPtrStrided4d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_a.buf, __pyx_t_16, __pyx_bstride_0_a, __pyx_t_17, __pyx_bstride_1_a, __pyx_t_18, __pyx_bstride_2_a, __pyx_t_19, __pyx_bstride_3_a)))))); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":68 - * for n in range(nn): - * o_s[i,j,k,n] = temp[n] + dx*(e[i,j,k,n] - temp[n]*a[i,j,k,n]) - * temp[n] = o_s[i,j,k,n] # <<<<<<<<<<<<<< - * for n in range(nn): - * i_s[ii,jj,n] = temp[n] - */ - __pyx_t_24 = __pyx_v_i; - __pyx_t_25 = __pyx_v_j; - __pyx_t_26 = __pyx_v_k; - __pyx_t_27 = __pyx_v_n; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_bshape_0_o_s; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_bshape_1_o_s; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_bshape_2_o_s; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_bshape_3_o_s; - (__pyx_v_temp[__pyx_v_n]) = (*__Pyx_BufPtrStrided4d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_o_s.buf, __pyx_t_24, __pyx_bstride_0_o_s, __pyx_t_25, __pyx_bstride_1_o_s, __pyx_t_26, __pyx_bstride_2_o_s, __pyx_t_27, __pyx_bstride_3_o_s)); - } - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":69 - * o_s[i,j,k,n] = temp[n] + dx*(e[i,j,k,n] - temp[n]*a[i,j,k,n]) - * temp[n] = o_s[i,j,k,n] - * for n in range(nn): # <<<<<<<<<<<<<< - * i_s[ii,jj,n] = temp[n] - * free(temp) - */ - __pyx_t_5 = __pyx_v_nn; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_n = __pyx_t_6; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":70 - * temp[n] = o_s[i,j,k,n] - * for n in range(nn): - * i_s[ii,jj,n] = temp[n] # <<<<<<<<<<<<<< - * free(temp) - * - */ - __pyx_t_10 = __pyx_v_ii; - __pyx_t_11 = __pyx_v_jj; - __pyx_t_28 = __pyx_v_n; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_bshape_0_i_s; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_bshape_1_i_s; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_bshape_2_i_s; - *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_i_s.buf, __pyx_t_10, __pyx_bstride_0_i_s, __pyx_t_11, __pyx_bstride_1_i_s, __pyx_t_28, __pyx_bstride_2_i_s) = (__pyx_v_temp[__pyx_v_n]); - } - } - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":71 - * for n in range(nn): - * i_s[ii,jj,n] = temp[n] - * free(temp) # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) - */ - free(__pyx_v_temp); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_o_s); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_i_s); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_a); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_e); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.amr_utils.Transfer3D"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_o_s); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_i_s); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_a); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_e); - __pyx_L2:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":74 - * - * @cython.boundscheck(False) - * def TransferShells(np.ndarray[np.float64_t, ndim=3] i_s, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t, ndim=3] data, - * np.ndarray[np.float64_t, ndim=2] shells): - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_TransferShells(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_2yt_9amr_utils_TransferShells[] = "\n This function accepts an incoming slab (*i_s*), a buffer of *data*,\n and a list of shells specified as [ (value, tolerance, r, g, b), ... ].\n "; -static PyObject *__pyx_pf_2yt_9amr_utils_TransferShells(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_i_s = 0; - PyArrayObject *__pyx_v_data = 0; - PyArrayObject *__pyx_v_shells = 0; - int __pyx_v_i; - int __pyx_v_ii; - int __pyx_v_j; - int __pyx_v_jj; - int __pyx_v_k; - int __pyx_v_kk; - int __pyx_v_n; - int __pyx_v_nn; - __pyx_t_5numpy_float64_t __pyx_v_dist; - float __pyx_v_rgba[4]; - float __pyx_v_alpha; - Py_buffer __pyx_bstruct_shells; - Py_ssize_t __pyx_bstride_0_shells = 0; - Py_ssize_t __pyx_bstride_1_shells = 0; - Py_ssize_t __pyx_bshape_0_shells = 0; - Py_ssize_t __pyx_bshape_1_shells = 0; - Py_buffer __pyx_bstruct_i_s; - Py_ssize_t __pyx_bstride_0_i_s = 0; - Py_ssize_t __pyx_bstride_1_i_s = 0; - Py_ssize_t __pyx_bstride_2_i_s = 0; - Py_ssize_t __pyx_bshape_0_i_s = 0; - Py_ssize_t __pyx_bshape_1_i_s = 0; - Py_ssize_t __pyx_bshape_2_i_s = 0; - Py_buffer __pyx_bstruct_data; - Py_ssize_t __pyx_bstride_0_data = 0; - Py_ssize_t __pyx_bstride_1_data = 0; - Py_ssize_t __pyx_bstride_2_data = 0; - Py_ssize_t __pyx_bshape_0_data = 0; - Py_ssize_t __pyx_bshape_1_data = 0; - Py_ssize_t __pyx_bshape_2_data = 0; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - long __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - long __pyx_t_16; - int __pyx_t_17; - long __pyx_t_18; - int __pyx_t_19; - long __pyx_t_20; - int __pyx_t_21; - long __pyx_t_22; - int __pyx_t_23; - long __pyx_t_24; - int __pyx_t_25; - int __pyx_t_26; - long __pyx_t_27; - int __pyx_t_28; - int __pyx_t_29; - long __pyx_t_30; - int __pyx_t_31; - int __pyx_t_32; - long __pyx_t_33; - int __pyx_t_34; - int __pyx_t_35; - long __pyx_t_36; - int __pyx_t_37; - int __pyx_t_38; - long __pyx_t_39; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__i_s,&__pyx_n_s__data,&__pyx_n_s__shells,0}; - __Pyx_RefNannySetupContext("TransferShells"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[3] = {0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i_s); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("TransferShells", 1, 3, 3, 1); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__shells); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("TransferShells", 1, 3, 3, 2); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "TransferShells") < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_i_s = ((PyArrayObject *)values[0]); - __pyx_v_data = ((PyArrayObject *)values[1]); - __pyx_v_shells = ((PyArrayObject *)values[2]); - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_i_s = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_data = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_shells = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("TransferShells", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.TransferShells"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_i_s.buf = NULL; - __pyx_bstruct_data.buf = NULL; - __pyx_bstruct_shells.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_i_s), __pyx_ptype_5numpy_ndarray, 1, "i_s", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), __pyx_ptype_5numpy_ndarray, 1, "data", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shells), __pyx_ptype_5numpy_ndarray, 1, "shells", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_i_s, (PyObject*)__pyx_v_i_s, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_i_s = __pyx_bstruct_i_s.strides[0]; __pyx_bstride_1_i_s = __pyx_bstruct_i_s.strides[1]; __pyx_bstride_2_i_s = __pyx_bstruct_i_s.strides[2]; - __pyx_bshape_0_i_s = __pyx_bstruct_i_s.shape[0]; __pyx_bshape_1_i_s = __pyx_bstruct_i_s.shape[1]; __pyx_bshape_2_i_s = __pyx_bstruct_i_s.shape[2]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_data, (PyObject*)__pyx_v_data, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_data = __pyx_bstruct_data.strides[0]; __pyx_bstride_1_data = __pyx_bstruct_data.strides[1]; __pyx_bstride_2_data = __pyx_bstruct_data.strides[2]; - __pyx_bshape_0_data = __pyx_bstruct_data.shape[0]; __pyx_bshape_1_data = __pyx_bstruct_data.shape[1]; __pyx_bshape_2_data = __pyx_bstruct_data.shape[2]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_shells, (PyObject*)__pyx_v_shells, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_shells = __pyx_bstruct_shells.strides[0]; __pyx_bstride_1_shells = __pyx_bstruct_shells.strides[1]; - __pyx_bshape_0_shells = __pyx_bstruct_shells.shape[0]; __pyx_bshape_1_shells = __pyx_bstruct_shells.shape[1]; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":86 - * cdef int n, nn - * cdef np.float64_t dist - * ii = data.shape[0] # <<<<<<<<<<<<<< - * jj = data.shape[1] - * kk = data.shape[2] - */ - __pyx_v_ii = (__pyx_v_data->dimensions[0]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":87 - * cdef np.float64_t dist - * ii = data.shape[0] - * jj = data.shape[1] # <<<<<<<<<<<<<< - * kk = data.shape[2] - * nn = shells.shape[0] - */ - __pyx_v_jj = (__pyx_v_data->dimensions[1]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":88 - * ii = data.shape[0] - * jj = data.shape[1] - * kk = data.shape[2] # <<<<<<<<<<<<<< - * nn = shells.shape[0] - * cdef float rgba[4] - */ - __pyx_v_kk = (__pyx_v_data->dimensions[2]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":89 - * jj = data.shape[1] - * kk = data.shape[2] - * nn = shells.shape[0] # <<<<<<<<<<<<<< - * cdef float rgba[4] - * cdef float alpha - */ - __pyx_v_nn = (__pyx_v_shells->dimensions[0]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":92 - * cdef float rgba[4] - * cdef float alpha - * for i in range(ii): # <<<<<<<<<<<<<< - * for j in range(jj): - * # Not sure about the ordering of the loops here - */ - __pyx_t_1 = __pyx_v_ii; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":93 - * cdef float alpha - * for i in range(ii): - * for j in range(jj): # <<<<<<<<<<<<<< - * # Not sure about the ordering of the loops here - * for k in range(kk): - */ - __pyx_t_3 = __pyx_v_jj; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_j = __pyx_t_4; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":95 - * for j in range(jj): - * # Not sure about the ordering of the loops here - * for k in range(kk): # <<<<<<<<<<<<<< - * for n in range(nn): - * dist = shells[n, 0] - data[i,j,k] - */ - __pyx_t_5 = __pyx_v_kk; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_k = __pyx_t_6; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":96 - * # Not sure about the ordering of the loops here - * for k in range(kk): - * for n in range(nn): # <<<<<<<<<<<<<< - * dist = shells[n, 0] - data[i,j,k] - * if dist < 0: dist *= -1.0 - */ - __pyx_t_7 = __pyx_v_nn; - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { - __pyx_v_n = __pyx_t_8; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":97 - * for k in range(kk): - * for n in range(nn): - * dist = shells[n, 0] - data[i,j,k] # <<<<<<<<<<<<<< - * if dist < 0: dist *= -1.0 - * if dist < shells[n,1]: - */ - __pyx_t_9 = __pyx_v_n; - __pyx_t_10 = 0; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_bshape_0_shells; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_bshape_1_shells; - __pyx_t_11 = __pyx_v_i; - __pyx_t_12 = __pyx_v_j; - __pyx_t_13 = __pyx_v_k; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_bshape_0_data; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_bshape_1_data; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_bshape_2_data; - __pyx_v_dist = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_shells.buf, __pyx_t_9, __pyx_bstride_0_shells, __pyx_t_10, __pyx_bstride_1_shells)) - (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_data.buf, __pyx_t_11, __pyx_bstride_0_data, __pyx_t_12, __pyx_bstride_1_data, __pyx_t_13, __pyx_bstride_2_data))); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":98 - * for n in range(nn): - * dist = shells[n, 0] - data[i,j,k] - * if dist < 0: dist *= -1.0 # <<<<<<<<<<<<<< - * if dist < shells[n,1]: - * dist = exp(-dist/8.0) - */ - __pyx_t_14 = (__pyx_v_dist < 0.0); - if (__pyx_t_14) { - __pyx_v_dist *= (-1.0); - goto __pyx_L14; - } - __pyx_L14:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":99 - * dist = shells[n, 0] - data[i,j,k] - * if dist < 0: dist *= -1.0 - * if dist < shells[n,1]: # <<<<<<<<<<<<<< - * dist = exp(-dist/8.0) - * rgba[0] = shells[n,2] - */ - __pyx_t_15 = __pyx_v_n; - __pyx_t_16 = 1; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_0_shells; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_bshape_1_shells; - __pyx_t_14 = (__pyx_v_dist < (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_shells.buf, __pyx_t_15, __pyx_bstride_0_shells, __pyx_t_16, __pyx_bstride_1_shells))); - if (__pyx_t_14) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":100 - * if dist < 0: dist *= -1.0 - * if dist < shells[n,1]: - * dist = exp(-dist/8.0) # <<<<<<<<<<<<<< - * rgba[0] = shells[n,2] - * rgba[1] = shells[n,3] - */ - __pyx_v_dist = exp(((-__pyx_v_dist) / 8.0)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":101 - * if dist < shells[n,1]: - * dist = exp(-dist/8.0) - * rgba[0] = shells[n,2] # <<<<<<<<<<<<<< - * rgba[1] = shells[n,3] - * rgba[2] = shells[n,4] - */ - __pyx_t_17 = __pyx_v_n; - __pyx_t_18 = 2; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_bshape_0_shells; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_bshape_1_shells; - (__pyx_v_rgba[0]) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_shells.buf, __pyx_t_17, __pyx_bstride_0_shells, __pyx_t_18, __pyx_bstride_1_shells)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":102 - * dist = exp(-dist/8.0) - * rgba[0] = shells[n,2] - * rgba[1] = shells[n,3] # <<<<<<<<<<<<<< - * rgba[2] = shells[n,4] - * rgba[3] = shells[n,5] - */ - __pyx_t_19 = __pyx_v_n; - __pyx_t_20 = 3; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_bshape_0_shells; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_bshape_1_shells; - (__pyx_v_rgba[1]) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_shells.buf, __pyx_t_19, __pyx_bstride_0_shells, __pyx_t_20, __pyx_bstride_1_shells)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":103 - * rgba[0] = shells[n,2] - * rgba[1] = shells[n,3] - * rgba[2] = shells[n,4] # <<<<<<<<<<<<<< - * rgba[3] = shells[n,5] - * alpha = i_s[i,j,3] - */ - __pyx_t_21 = __pyx_v_n; - __pyx_t_22 = 4; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_bshape_0_shells; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_bshape_1_shells; - (__pyx_v_rgba[2]) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_shells.buf, __pyx_t_21, __pyx_bstride_0_shells, __pyx_t_22, __pyx_bstride_1_shells)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":104 - * rgba[1] = shells[n,3] - * rgba[2] = shells[n,4] - * rgba[3] = shells[n,5] # <<<<<<<<<<<<<< - * alpha = i_s[i,j,3] - * dist *= dist # This might improve appearance - */ - __pyx_t_23 = __pyx_v_n; - __pyx_t_24 = 5; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_bshape_0_shells; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_bshape_1_shells; - (__pyx_v_rgba[3]) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_shells.buf, __pyx_t_23, __pyx_bstride_0_shells, __pyx_t_24, __pyx_bstride_1_shells)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":105 - * rgba[2] = shells[n,4] - * rgba[3] = shells[n,5] - * alpha = i_s[i,j,3] # <<<<<<<<<<<<<< - * dist *= dist # This might improve appearance - * i_s[i,j,0] += (1.0 - alpha)*rgba[0]*dist*rgba[3] - */ - __pyx_t_25 = __pyx_v_i; - __pyx_t_26 = __pyx_v_j; - __pyx_t_27 = 3; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_bshape_0_i_s; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_bshape_1_i_s; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_bshape_2_i_s; - __pyx_v_alpha = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_i_s.buf, __pyx_t_25, __pyx_bstride_0_i_s, __pyx_t_26, __pyx_bstride_1_i_s, __pyx_t_27, __pyx_bstride_2_i_s)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":106 - * rgba[3] = shells[n,5] - * alpha = i_s[i,j,3] - * dist *= dist # This might improve appearance # <<<<<<<<<<<<<< - * i_s[i,j,0] += (1.0 - alpha)*rgba[0]*dist*rgba[3] - * i_s[i,j,1] += (1.0 - alpha)*rgba[1]*dist*rgba[3] - */ - __pyx_v_dist *= __pyx_v_dist; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":107 - * alpha = i_s[i,j,3] - * dist *= dist # This might improve appearance - * i_s[i,j,0] += (1.0 - alpha)*rgba[0]*dist*rgba[3] # <<<<<<<<<<<<<< - * i_s[i,j,1] += (1.0 - alpha)*rgba[1]*dist*rgba[3] - * i_s[i,j,2] += (1.0 - alpha)*rgba[2]*dist*rgba[3] - */ - __pyx_t_28 = __pyx_v_i; - __pyx_t_29 = __pyx_v_j; - __pyx_t_30 = 0; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_bshape_0_i_s; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_bshape_1_i_s; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_bshape_2_i_s; - *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_i_s.buf, __pyx_t_28, __pyx_bstride_0_i_s, __pyx_t_29, __pyx_bstride_1_i_s, __pyx_t_30, __pyx_bstride_2_i_s) += ((((1.0 - __pyx_v_alpha) * (__pyx_v_rgba[0])) * __pyx_v_dist) * (__pyx_v_rgba[3])); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":108 - * dist *= dist # This might improve appearance - * i_s[i,j,0] += (1.0 - alpha)*rgba[0]*dist*rgba[3] - * i_s[i,j,1] += (1.0 - alpha)*rgba[1]*dist*rgba[3] # <<<<<<<<<<<<<< - * i_s[i,j,2] += (1.0 - alpha)*rgba[2]*dist*rgba[3] - * i_s[i,j,3] += (1.0 - alpha)*rgba[3]*dist*rgba[3] - */ - __pyx_t_31 = __pyx_v_i; - __pyx_t_32 = __pyx_v_j; - __pyx_t_33 = 1; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_bshape_0_i_s; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_bshape_1_i_s; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_bshape_2_i_s; - *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_i_s.buf, __pyx_t_31, __pyx_bstride_0_i_s, __pyx_t_32, __pyx_bstride_1_i_s, __pyx_t_33, __pyx_bstride_2_i_s) += ((((1.0 - __pyx_v_alpha) * (__pyx_v_rgba[1])) * __pyx_v_dist) * (__pyx_v_rgba[3])); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":109 - * i_s[i,j,0] += (1.0 - alpha)*rgba[0]*dist*rgba[3] - * i_s[i,j,1] += (1.0 - alpha)*rgba[1]*dist*rgba[3] - * i_s[i,j,2] += (1.0 - alpha)*rgba[2]*dist*rgba[3] # <<<<<<<<<<<<<< - * i_s[i,j,3] += (1.0 - alpha)*rgba[3]*dist*rgba[3] - * break - */ - __pyx_t_34 = __pyx_v_i; - __pyx_t_35 = __pyx_v_j; - __pyx_t_36 = 2; - if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_bshape_0_i_s; - if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_bshape_1_i_s; - if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_bshape_2_i_s; - *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_i_s.buf, __pyx_t_34, __pyx_bstride_0_i_s, __pyx_t_35, __pyx_bstride_1_i_s, __pyx_t_36, __pyx_bstride_2_i_s) += ((((1.0 - __pyx_v_alpha) * (__pyx_v_rgba[2])) * __pyx_v_dist) * (__pyx_v_rgba[3])); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":110 - * i_s[i,j,1] += (1.0 - alpha)*rgba[1]*dist*rgba[3] - * i_s[i,j,2] += (1.0 - alpha)*rgba[2]*dist*rgba[3] - * i_s[i,j,3] += (1.0 - alpha)*rgba[3]*dist*rgba[3] # <<<<<<<<<<<<<< - * break - * - */ - __pyx_t_37 = __pyx_v_i; - __pyx_t_38 = __pyx_v_j; - __pyx_t_39 = 3; - if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_bshape_0_i_s; - if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_bshape_1_i_s; - if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_bshape_2_i_s; - *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_i_s.buf, __pyx_t_37, __pyx_bstride_0_i_s, __pyx_t_38, __pyx_bstride_1_i_s, __pyx_t_39, __pyx_bstride_2_i_s) += ((((1.0 - __pyx_v_alpha) * (__pyx_v_rgba[3])) * __pyx_v_dist) * (__pyx_v_rgba[3])); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":111 - * i_s[i,j,2] += (1.0 - alpha)*rgba[2]*dist*rgba[3] - * i_s[i,j,3] += (1.0 - alpha)*rgba[3]*dist*rgba[3] - * break # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) - */ - goto __pyx_L13_break; - goto __pyx_L15; - } - __pyx_L15:; - } - __pyx_L13_break:; - } - } - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_shells); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_i_s); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.amr_utils.TransferShells"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_shells); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_i_s); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data); - __pyx_L2:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":114 - * - * @cython.boundscheck(False) - * def Transfer1D(float i_s, # <<<<<<<<<<<<<< - * np.ndarray[np.float_t, ndim=1] o_s, - * np.ndarray[np.float_t, ndim=1] e, - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_Transfer1D(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_Transfer1D(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - float __pyx_v_i_s; - PyArrayObject *__pyx_v_o_s = 0; - PyArrayObject *__pyx_v_e = 0; - PyArrayObject *__pyx_v_a = 0; - PyArrayObject *__pyx_v_dx = 0; - int __pyx_v_imin; - int __pyx_v_imax; - int __pyx_v_i; - Py_buffer __pyx_bstruct_a; - Py_ssize_t __pyx_bstride_0_a = 0; - Py_ssize_t __pyx_bshape_0_a = 0; - Py_buffer __pyx_bstruct_e; - Py_ssize_t __pyx_bstride_0_e = 0; - Py_ssize_t __pyx_bshape_0_e = 0; - Py_buffer __pyx_bstruct_o_s; - Py_ssize_t __pyx_bstride_0_o_s = 0; - Py_ssize_t __pyx_bshape_0_o_s = 0; - Py_buffer __pyx_bstruct_dx; - Py_ssize_t __pyx_bstride_0_dx = 0; - Py_ssize_t __pyx_bshape_0_dx = 0; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__i_s,&__pyx_n_s__o_s,&__pyx_n_s__e,&__pyx_n_s__a,&__pyx_n_s__dx,&__pyx_n_s__imin,&__pyx_n_s__imax,0}; - __Pyx_RefNannySetupContext("Transfer1D"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[7] = {0,0,0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i_s); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__o_s); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("Transfer1D", 1, 7, 7, 1); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__e); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("Transfer1D", 1, 7, 7, 2); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("Transfer1D", 1, 7, 7, 3); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dx); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("Transfer1D", 1, 7, 7, 4); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__imin); - if (likely(values[5])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("Transfer1D", 1, 7, 7, 5); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 6: - values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__imax); - if (likely(values[6])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("Transfer1D", 1, 7, 7, 6); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "Transfer1D") < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_i_s = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_i_s == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_o_s = ((PyArrayObject *)values[1]); - __pyx_v_e = ((PyArrayObject *)values[2]); - __pyx_v_a = ((PyArrayObject *)values[3]); - __pyx_v_dx = ((PyArrayObject *)values[4]); - __pyx_v_imin = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_imin == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_imax = __Pyx_PyInt_AsInt(values[6]); if (unlikely((__pyx_v_imax == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_i_s = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_i_s == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_o_s = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_e = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_a = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); - __pyx_v_dx = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); - __pyx_v_imin = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_imin == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_imax = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 6)); if (unlikely((__pyx_v_imax == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("Transfer1D", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.Transfer1D"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_o_s.buf = NULL; - __pyx_bstruct_e.buf = NULL; - __pyx_bstruct_a.buf = NULL; - __pyx_bstruct_dx.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_o_s), __pyx_ptype_5numpy_ndarray, 1, "o_s", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_e), __pyx_ptype_5numpy_ndarray, 1, "e", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_5numpy_ndarray, 1, "a", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 117; __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[4]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_o_s, (PyObject*)__pyx_v_o_s, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_o_s = __pyx_bstruct_o_s.strides[0]; - __pyx_bshape_0_o_s = __pyx_bstruct_o_s.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_e, (PyObject*)__pyx_v_e, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_e = __pyx_bstruct_e.strides[0]; - __pyx_bshape_0_e = __pyx_bstruct_e.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_a, (PyObject*)__pyx_v_a, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_a = __pyx_bstruct_a.strides[0]; - __pyx_bshape_0_a = __pyx_bstruct_a.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dx, (PyObject*)__pyx_v_dx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_dx = __pyx_bstruct_dx.strides[0]; - __pyx_bshape_0_dx = __pyx_bstruct_dx.shape[0]; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":121 - * int imin, int imax): - * cdef int i - * for i in range(imin, imax): # <<<<<<<<<<<<<< - * o_s[i] = i_s + dx[i]*(e[i] - i_s*a[i]) - * i_s = o_s[i] - */ - __pyx_t_1 = __pyx_v_imax; - for (__pyx_t_2 = __pyx_v_imin; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":122 - * cdef int i - * for i in range(imin, imax): - * o_s[i] = i_s + dx[i]*(e[i] - i_s*a[i]) # <<<<<<<<<<<<<< - * i_s = o_s[i] - * return i_s - */ - __pyx_t_3 = __pyx_v_i; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_bshape_0_dx; - __pyx_t_4 = __pyx_v_i; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_bshape_0_e; - __pyx_t_5 = __pyx_v_i; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_bshape_0_a; - __pyx_t_6 = __pyx_v_i; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_bshape_0_o_s; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float_t *, __pyx_bstruct_o_s.buf, __pyx_t_6, __pyx_bstride_0_o_s) = (__pyx_v_i_s + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float_t *, __pyx_bstruct_dx.buf, __pyx_t_3, __pyx_bstride_0_dx)) * ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float_t *, __pyx_bstruct_e.buf, __pyx_t_4, __pyx_bstride_0_e)) - (__pyx_v_i_s * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float_t *, __pyx_bstruct_a.buf, __pyx_t_5, __pyx_bstride_0_a)))))); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":123 - * for i in range(imin, imax): - * o_s[i] = i_s + dx[i]*(e[i] - i_s*a[i]) - * i_s = o_s[i] # <<<<<<<<<<<<<< - * return i_s - * - */ - __pyx_t_7 = __pyx_v_i; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_bshape_0_o_s; - __pyx_v_i_s = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float_t *, __pyx_bstruct_o_s.buf, __pyx_t_7, __pyx_bstride_0_o_s)); - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":124 - * o_s[i] = i_s + dx[i]*(e[i] - i_s*a[i]) - * i_s = o_s[i] - * return i_s # <<<<<<<<<<<<<< - * - * @cython.wraparound(False) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_8 = PyFloat_FromDouble(__pyx_v_i_s); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_r = __pyx_t_8; - __pyx_t_8 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_8); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_a); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_e); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_o_s); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dx); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.amr_utils.Transfer1D"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_a); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_e); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_o_s); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dx); - __pyx_L2:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":128 - * @cython.wraparound(False) - * @cython.boundscheck(False) - * def VoxelTraversal(np.ndarray[np.int_t, ndim=3] grid_mask, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t, ndim=3] grid_t, - * np.ndarray[np.float64_t, ndim=3] grid_dt, - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_VoxelTraversal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_VoxelTraversal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_grid_mask = 0; - PyArrayObject *__pyx_v_grid_t = 0; - PyArrayObject *__pyx_v_grid_dt = 0; - PyArrayObject *__pyx_v_left_edge = 0; - PyArrayObject *__pyx_v_right_edge = 0; - PyArrayObject *__pyx_v_dx = 0; - PyArrayObject *__pyx_v_u = 0; - PyArrayObject *__pyx_v_v = 0; - int __pyx_v_i; - int __pyx_v_x; - int __pyx_v_y; - __pyx_t_5numpy_float64_t __pyx_v_tl; - __pyx_t_5numpy_float64_t __pyx_v_tr; - __pyx_t_5numpy_float64_t __pyx_v_intersect_t; - __pyx_t_5numpy_float64_t __pyx_v_enter_t; - __pyx_t_5numpy_float64_t __pyx_v_dt_tolerance; - PyArrayObject *__pyx_v_step = 0; - PyArrayObject *__pyx_v_cur_ind = 0; - PyArrayObject *__pyx_v_tdelta = 0; - PyArrayObject *__pyx_v_tmax = 0; - PyArrayObject *__pyx_v_intersect = 0; - Py_buffer __pyx_bstruct_right_edge; - Py_ssize_t __pyx_bstride_0_right_edge = 0; - Py_ssize_t __pyx_bshape_0_right_edge = 0; - Py_buffer __pyx_bstruct_intersect; - Py_ssize_t __pyx_bstride_0_intersect = 0; - Py_ssize_t __pyx_bshape_0_intersect = 0; - Py_buffer __pyx_bstruct_grid_t; - Py_ssize_t __pyx_bstride_0_grid_t = 0; - Py_ssize_t __pyx_bstride_1_grid_t = 0; - Py_ssize_t __pyx_bstride_2_grid_t = 0; - Py_ssize_t __pyx_bshape_0_grid_t = 0; - Py_ssize_t __pyx_bshape_1_grid_t = 0; - Py_ssize_t __pyx_bshape_2_grid_t = 0; - Py_buffer __pyx_bstruct_grid_dt; - Py_ssize_t __pyx_bstride_0_grid_dt = 0; - Py_ssize_t __pyx_bstride_1_grid_dt = 0; - Py_ssize_t __pyx_bstride_2_grid_dt = 0; - Py_ssize_t __pyx_bshape_0_grid_dt = 0; - Py_ssize_t __pyx_bshape_1_grid_dt = 0; - Py_ssize_t __pyx_bshape_2_grid_dt = 0; - Py_buffer __pyx_bstruct_cur_ind; - Py_ssize_t __pyx_bstride_0_cur_ind = 0; - Py_ssize_t __pyx_bshape_0_cur_ind = 0; - Py_buffer __pyx_bstruct_left_edge; - Py_ssize_t __pyx_bstride_0_left_edge = 0; - Py_ssize_t __pyx_bshape_0_left_edge = 0; - Py_buffer __pyx_bstruct_step; - Py_ssize_t __pyx_bstride_0_step = 0; - Py_ssize_t __pyx_bshape_0_step = 0; - 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_tdelta; - Py_ssize_t __pyx_bstride_0_tdelta = 0; - Py_ssize_t __pyx_bshape_0_tdelta = 0; - Py_buffer __pyx_bstruct_tmax; - Py_ssize_t __pyx_bstride_0_tmax = 0; - Py_ssize_t __pyx_bshape_0_tmax = 0; - Py_buffer __pyx_bstruct_grid_mask; - Py_ssize_t __pyx_bstride_0_grid_mask = 0; - Py_ssize_t __pyx_bstride_1_grid_mask = 0; - Py_ssize_t __pyx_bstride_2_grid_mask = 0; - Py_ssize_t __pyx_bshape_0_grid_mask = 0; - Py_ssize_t __pyx_bshape_1_grid_mask = 0; - Py_ssize_t __pyx_bshape_2_grid_mask = 0; - Py_buffer __pyx_bstruct_u; - Py_ssize_t __pyx_bstride_0_u = 0; - Py_ssize_t __pyx_bshape_0_u = 0; - Py_buffer __pyx_bstruct_v; - Py_ssize_t __pyx_bstride_0_v = 0; - Py_ssize_t __pyx_bshape_0_v = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyArrayObject *__pyx_t_6 = NULL; - PyArrayObject *__pyx_t_7 = NULL; - PyArrayObject *__pyx_t_8 = NULL; - PyArrayObject *__pyx_t_9 = NULL; - PyArrayObject *__pyx_t_10 = NULL; - int __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - __pyx_t_5numpy_float64_t __pyx_t_18; - int __pyx_t_19; - __pyx_t_5numpy_float64_t __pyx_t_20; - int __pyx_t_21; - int __pyx_t_22; - int __pyx_t_23; - int __pyx_t_24; - int __pyx_t_25; - int __pyx_t_26; - int __pyx_t_27; - int __pyx_t_28; - int __pyx_t_29; - int __pyx_t_30; - int __pyx_t_31; - int __pyx_t_32; - int __pyx_t_33; - int __pyx_t_34; - int __pyx_t_35; - int __pyx_t_36; - int __pyx_t_37; - int __pyx_t_38; - int __pyx_t_39; - int __pyx_t_40; - int __pyx_t_41; - int __pyx_t_42; - long __pyx_t_43; - long __pyx_t_44; - long __pyx_t_45; - long __pyx_t_46; - long __pyx_t_47; - long __pyx_t_48; - long __pyx_t_49; - long __pyx_t_50; - long __pyx_t_51; - PyObject *__pyx_t_52 = NULL; - PyObject *__pyx_t_53 = NULL; - PyObject *__pyx_t_54 = NULL; - int __pyx_t_55; - int __pyx_t_56; - int __pyx_t_57; - int __pyx_t_58; - __pyx_t_5numpy_int64_t __pyx_t_59; - int __pyx_t_60; - int __pyx_t_61; - int __pyx_t_62; - int __pyx_t_63; - int __pyx_t_64; - int __pyx_t_65; - int __pyx_t_66; - int __pyx_t_67; - int __pyx_t_68; - int __pyx_t_69; - int __pyx_t_70; - int __pyx_t_71; - int __pyx_t_72; - int __pyx_t_73; - int __pyx_t_74; - int __pyx_t_75; - int __pyx_t_76; - int __pyx_t_77; - int __pyx_t_78; - int __pyx_t_79; - int __pyx_t_80; - int __pyx_t_81; - int __pyx_t_82; - int __pyx_t_83; - int __pyx_t_84; - int __pyx_t_85; - int __pyx_t_86; - int __pyx_t_87; - int __pyx_t_88; - int __pyx_t_89; - long __pyx_t_90; - long __pyx_t_91; - long __pyx_t_92; - long __pyx_t_93; - long __pyx_t_94; - long __pyx_t_95; - __pyx_t_5numpy_int64_t __pyx_t_96; - __pyx_t_5numpy_int64_t __pyx_t_97; - long __pyx_t_98; - long __pyx_t_99; - long __pyx_t_100; - long __pyx_t_101; - long __pyx_t_102; - long __pyx_t_103; - __pyx_t_5numpy_int64_t __pyx_t_104; - __pyx_t_5numpy_int64_t __pyx_t_105; - __pyx_t_5numpy_int64_t __pyx_t_106; - long __pyx_t_107; - long __pyx_t_108; - long __pyx_t_109; - long __pyx_t_110; - long __pyx_t_111; - long __pyx_t_112; - long __pyx_t_113; - __pyx_t_5numpy_int64_t __pyx_t_114; - __pyx_t_5numpy_int64_t __pyx_t_115; - __pyx_t_5numpy_int64_t __pyx_t_116; - long __pyx_t_117; - long __pyx_t_118; - long __pyx_t_119; - long __pyx_t_120; - __pyx_t_5numpy_int64_t __pyx_t_121; - __pyx_t_5numpy_int64_t __pyx_t_122; - __pyx_t_5numpy_int64_t __pyx_t_123; - long __pyx_t_124; - long __pyx_t_125; - long __pyx_t_126; - long __pyx_t_127; - long __pyx_t_128; - long __pyx_t_129; - long __pyx_t_130; - long __pyx_t_131; - __pyx_t_5numpy_int64_t __pyx_t_132; - __pyx_t_5numpy_int64_t __pyx_t_133; - __pyx_t_5numpy_int64_t __pyx_t_134; - long __pyx_t_135; - long __pyx_t_136; - long __pyx_t_137; - long __pyx_t_138; - __pyx_t_5numpy_int64_t __pyx_t_139; - __pyx_t_5numpy_int64_t __pyx_t_140; - __pyx_t_5numpy_int64_t __pyx_t_141; - long __pyx_t_142; - long __pyx_t_143; - long __pyx_t_144; - long __pyx_t_145; - long __pyx_t_146; - long __pyx_t_147; - long __pyx_t_148; - long __pyx_t_149; - long __pyx_t_150; - long __pyx_t_151; - __pyx_t_5numpy_int64_t __pyx_t_152; - __pyx_t_5numpy_int64_t __pyx_t_153; - __pyx_t_5numpy_int64_t __pyx_t_154; - long __pyx_t_155; - long __pyx_t_156; - long __pyx_t_157; - long __pyx_t_158; - __pyx_t_5numpy_int64_t __pyx_t_159; - __pyx_t_5numpy_int64_t __pyx_t_160; - __pyx_t_5numpy_int64_t __pyx_t_161; - long __pyx_t_162; - long __pyx_t_163; - long __pyx_t_164; - long __pyx_t_165; - long __pyx_t_166; - long __pyx_t_167; - long __pyx_t_168; - long __pyx_t_169; - __pyx_t_5numpy_int64_t __pyx_t_170; - __pyx_t_5numpy_int64_t __pyx_t_171; - __pyx_t_5numpy_int64_t __pyx_t_172; - long __pyx_t_173; - long __pyx_t_174; - long __pyx_t_175; - long __pyx_t_176; - __pyx_t_5numpy_int64_t __pyx_t_177; - __pyx_t_5numpy_int64_t __pyx_t_178; - __pyx_t_5numpy_int64_t __pyx_t_179; - long __pyx_t_180; - long __pyx_t_181; - long __pyx_t_182; - long __pyx_t_183; - long __pyx_t_184; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__grid_mask,&__pyx_n_s__grid_t,&__pyx_n_s__grid_dt,&__pyx_n_s__left_edge,&__pyx_n_s__right_edge,&__pyx_n_s__dx,&__pyx_n_s__u,&__pyx_n_s__v,0}; - __Pyx_RefNannySetupContext("VoxelTraversal"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[8] = {0,0,0,0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid_mask); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid_t); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("VoxelTraversal", 1, 8, 8, 1); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid_dt); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("VoxelTraversal", 1, 8, 8, 2); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left_edge); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("VoxelTraversal", 1, 8, 8, 3); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right_edge); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("VoxelTraversal", 1, 8, 8, 4); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dx); - if (likely(values[5])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("VoxelTraversal", 1, 8, 8, 5); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 6: - values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__u); - if (likely(values[6])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("VoxelTraversal", 1, 8, 8, 6); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 7: - values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__v); - if (likely(values[7])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("VoxelTraversal", 1, 8, 8, 7); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "VoxelTraversal") < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_grid_mask = ((PyArrayObject *)values[0]); - __pyx_v_grid_t = ((PyArrayObject *)values[1]); - __pyx_v_grid_dt = ((PyArrayObject *)values[2]); - __pyx_v_left_edge = ((PyArrayObject *)values[3]); - __pyx_v_right_edge = ((PyArrayObject *)values[4]); - __pyx_v_dx = ((PyArrayObject *)values[5]); - __pyx_v_u = ((PyArrayObject *)values[6]); - __pyx_v_v = ((PyArrayObject *)values[7]); - } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_grid_mask = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_grid_t = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_grid_dt = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_left_edge = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); - __pyx_v_right_edge = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); - __pyx_v_dx = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 5)); - __pyx_v_u = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 6)); - __pyx_v_v = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 7)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("VoxelTraversal", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.VoxelTraversal"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_step.buf = NULL; - __pyx_bstruct_cur_ind.buf = NULL; - __pyx_bstruct_tdelta.buf = NULL; - __pyx_bstruct_tmax.buf = NULL; - __pyx_bstruct_intersect.buf = NULL; - __pyx_bstruct_grid_mask.buf = NULL; - __pyx_bstruct_grid_t.buf = NULL; - __pyx_bstruct_grid_dt.buf = NULL; - __pyx_bstruct_left_edge.buf = NULL; - __pyx_bstruct_right_edge.buf = NULL; - __pyx_bstruct_dx.buf = NULL; - __pyx_bstruct_u.buf = NULL; - __pyx_bstruct_v.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grid_mask), __pyx_ptype_5numpy_ndarray, 1, "grid_mask", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grid_t), __pyx_ptype_5numpy_ndarray, 1, "grid_t", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grid_dt), __pyx_ptype_5numpy_ndarray, 1, "grid_dt", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left_edge), __pyx_ptype_5numpy_ndarray, 1, "left_edge", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right_edge), __pyx_ptype_5numpy_ndarray, 1, "right_edge", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 132; __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[4]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_u), __pyx_ptype_5numpy_ndarray, 1, "u", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_grid_mask, (PyObject*)__pyx_v_grid_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_grid_mask = __pyx_bstruct_grid_mask.strides[0]; __pyx_bstride_1_grid_mask = __pyx_bstruct_grid_mask.strides[1]; __pyx_bstride_2_grid_mask = __pyx_bstruct_grid_mask.strides[2]; - __pyx_bshape_0_grid_mask = __pyx_bstruct_grid_mask.shape[0]; __pyx_bshape_1_grid_mask = __pyx_bstruct_grid_mask.shape[1]; __pyx_bshape_2_grid_mask = __pyx_bstruct_grid_mask.shape[2]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_grid_t, (PyObject*)__pyx_v_grid_t, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_grid_t = __pyx_bstruct_grid_t.strides[0]; __pyx_bstride_1_grid_t = __pyx_bstruct_grid_t.strides[1]; __pyx_bstride_2_grid_t = __pyx_bstruct_grid_t.strides[2]; - __pyx_bshape_0_grid_t = __pyx_bstruct_grid_t.shape[0]; __pyx_bshape_1_grid_t = __pyx_bstruct_grid_t.shape[1]; __pyx_bshape_2_grid_t = __pyx_bstruct_grid_t.shape[2]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_grid_dt, (PyObject*)__pyx_v_grid_dt, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_grid_dt = __pyx_bstruct_grid_dt.strides[0]; __pyx_bstride_1_grid_dt = __pyx_bstruct_grid_dt.strides[1]; __pyx_bstride_2_grid_dt = __pyx_bstruct_grid_dt.strides[2]; - __pyx_bshape_0_grid_dt = __pyx_bstruct_grid_dt.shape[0]; __pyx_bshape_1_grid_dt = __pyx_bstruct_grid_dt.shape[1]; __pyx_bshape_2_grid_dt = __pyx_bstruct_grid_dt.shape[2]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_left_edge, (PyObject*)__pyx_v_left_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_left_edge = __pyx_bstruct_left_edge.strides[0]; - __pyx_bshape_0_left_edge = __pyx_bstruct_left_edge.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_right_edge, (PyObject*)__pyx_v_right_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_right_edge = __pyx_bstruct_right_edge.strides[0]; - __pyx_bshape_0_right_edge = __pyx_bstruct_right_edge.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dx, (PyObject*)__pyx_v_dx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __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]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_u, (PyObject*)__pyx_v_u, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_u = __pyx_bstruct_u.strides[0]; - __pyx_bshape_0_u = __pyx_bstruct_u.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_v, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_v = __pyx_bstruct_v.strides[0]; - __pyx_bshape_0_v = __pyx_bstruct_v.shape[0]; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":141 - * cdef int i, x, y - * cdef np.float64_t tl, tr, intersect_t, enter_t, exit_t, dt_tolerance - * cdef np.ndarray[np.int64_t, ndim=1] step = np.empty((3,), dtype=np.int64) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.int64_t, ndim=1] cur_ind = np.empty((3,), dtype=np.int64) - * cdef np.ndarray[np.float64_t, ndim=1] tdelta = np.empty((3,), dtype=np.float64) - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = ((PyArrayObject *)__pyx_t_5); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_step, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_step = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_step.buf = NULL; - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_step = __pyx_bstruct_step.strides[0]; - __pyx_bshape_0_step = __pyx_bstruct_step.shape[0]; - } - } - __pyx_t_6 = 0; - __pyx_v_step = ((PyArrayObject *)__pyx_t_5); - __pyx_t_5 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":142 - * cdef np.float64_t tl, tr, intersect_t, enter_t, exit_t, dt_tolerance - * cdef np.ndarray[np.int64_t, ndim=1] step = np.empty((3,), dtype=np.int64) - * cdef np.ndarray[np.int64_t, ndim=1] cur_ind = np.empty((3,), dtype=np.int64) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t, ndim=1] tdelta = np.empty((3,), dtype=np.float64) - * cdef np.ndarray[np.float64_t, ndim=1] tmax = np.empty((3,), dtype=np.float64) - */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__int64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_3, ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = ((PyArrayObject *)__pyx_t_4); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_cur_ind, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_cur_ind = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_cur_ind.buf = NULL; - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_cur_ind = __pyx_bstruct_cur_ind.strides[0]; - __pyx_bshape_0_cur_ind = __pyx_bstruct_cur_ind.shape[0]; - } - } - __pyx_t_7 = 0; - __pyx_v_cur_ind = ((PyArrayObject *)__pyx_t_4); - __pyx_t_4 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":143 - * cdef np.ndarray[np.int64_t, ndim=1] step = np.empty((3,), dtype=np.int64) - * cdef np.ndarray[np.int64_t, ndim=1] cur_ind = np.empty((3,), dtype=np.int64) - * cdef np.ndarray[np.float64_t, ndim=1] tdelta = np.empty((3,), dtype=np.float64) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t, ndim=1] tmax = np.empty((3,), dtype=np.float64) - * cdef np.ndarray[np.float64_t, ndim=1] intersect = np.empty((3,), dtype=np.float64) - */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_5, __pyx_t_3, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = ((PyArrayObject *)__pyx_t_2); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_tdelta, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_tdelta = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_tdelta.buf = NULL; - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_tdelta = __pyx_bstruct_tdelta.strides[0]; - __pyx_bshape_0_tdelta = __pyx_bstruct_tdelta.shape[0]; - } - } - __pyx_t_8 = 0; - __pyx_v_tdelta = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":144 - * cdef np.ndarray[np.int64_t, ndim=1] cur_ind = np.empty((3,), dtype=np.int64) - * cdef np.ndarray[np.float64_t, ndim=1] tdelta = np.empty((3,), dtype=np.float64) - * cdef np.ndarray[np.float64_t, ndim=1] tmax = np.empty((3,), dtype=np.float64) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t, ndim=1] intersect = np.empty((3,), dtype=np.float64) - * intersect_t = 1 - */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_4, __pyx_t_3, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_9 = ((PyArrayObject *)__pyx_t_1); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_tmax, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_tmax = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_tmax.buf = NULL; - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_tmax = __pyx_bstruct_tmax.strides[0]; - __pyx_bshape_0_tmax = __pyx_bstruct_tmax.shape[0]; - } - } - __pyx_t_9 = 0; - __pyx_v_tmax = ((PyArrayObject *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":145 - * cdef np.ndarray[np.float64_t, ndim=1] tdelta = np.empty((3,), dtype=np.float64) - * cdef np.ndarray[np.float64_t, ndim=1] tmax = np.empty((3,), dtype=np.float64) - * cdef np.ndarray[np.float64_t, ndim=1] intersect = np.empty((3,), dtype=np.float64) # <<<<<<<<<<<<<< - * intersect_t = 1 - * dt_tolerance = 1e-6 - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_10 = ((PyArrayObject *)__pyx_t_5); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_intersect, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_intersect = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_intersect.buf = NULL; - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_intersect = __pyx_bstruct_intersect.strides[0]; - __pyx_bshape_0_intersect = __pyx_bstruct_intersect.shape[0]; - } - } - __pyx_t_10 = 0; - __pyx_v_intersect = ((PyArrayObject *)__pyx_t_5); - __pyx_t_5 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":146 - * cdef np.ndarray[np.float64_t, ndim=1] tmax = np.empty((3,), dtype=np.float64) - * cdef np.ndarray[np.float64_t, ndim=1] intersect = np.empty((3,), dtype=np.float64) - * intersect_t = 1 # <<<<<<<<<<<<<< - * dt_tolerance = 1e-6 - * # recall p = v * t + u - */ - __pyx_v_intersect_t = 1.0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":147 - * cdef np.ndarray[np.float64_t, ndim=1] intersect = np.empty((3,), dtype=np.float64) - * intersect_t = 1 - * dt_tolerance = 1e-6 # <<<<<<<<<<<<<< - * # recall p = v * t + u - * # where p is position, v is our vector, u is the start point - */ - __pyx_v_dt_tolerance = 1e-6; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":150 - * # recall p = v * t + u - * # where p is position, v is our vector, u is the start point - * for i in range(3): # <<<<<<<<<<<<<< - * # As long as we're iterating, set some other stuff, too - * if(v[i] < 0): step[i] = -1 - */ - for (__pyx_t_11 = 0; __pyx_t_11 < 3; __pyx_t_11+=1) { - __pyx_v_i = __pyx_t_11; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":152 - * for i in range(3): - * # As long as we're iterating, set some other stuff, too - * if(v[i] < 0): step[i] = -1 # <<<<<<<<<<<<<< - * else: step[i] = 1 - * x = (i+1)%3 - */ - __pyx_t_12 = __pyx_v_i; - __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_12, __pyx_bstride_0_v)) < 0.0); - if (__pyx_t_13) { - __pyx_t_14 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_step.buf, __pyx_t_14, __pyx_bstride_0_step) = -1; - goto __pyx_L8; - } - /*else*/ { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":153 - * # As long as we're iterating, set some other stuff, too - * if(v[i] < 0): step[i] = -1 - * else: step[i] = 1 # <<<<<<<<<<<<<< - * x = (i+1)%3 - * y = (i+2)%3 - */ - __pyx_t_15 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_step.buf, __pyx_t_15, __pyx_bstride_0_step) = 1; - } - __pyx_L8:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":154 - * if(v[i] < 0): step[i] = -1 - * else: step[i] = 1 - * x = (i+1)%3 # <<<<<<<<<<<<<< - * y = (i+2)%3 - * tl = (left_edge[i] - u[i])/v[i] - */ - __pyx_v_x = __Pyx_mod_long((__pyx_v_i + 1), 3); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":155 - * else: step[i] = 1 - * x = (i+1)%3 - * y = (i+2)%3 # <<<<<<<<<<<<<< - * tl = (left_edge[i] - u[i])/v[i] - * tr = (right_edge[i] - u[i])/v[i] - */ - __pyx_v_y = __Pyx_mod_long((__pyx_v_i + 2), 3); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":156 - * x = (i+1)%3 - * y = (i+2)%3 - * tl = (left_edge[i] - u[i])/v[i] # <<<<<<<<<<<<<< - * tr = (right_edge[i] - u[i])/v[i] - * if (left_edge[x] <= (u[x] + tl*v[x]) <= right_edge[x]) and \ - */ - __pyx_t_16 = __pyx_v_i; - __pyx_t_17 = __pyx_v_i; - __pyx_t_18 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_16, __pyx_bstride_0_left_edge)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_17, __pyx_bstride_0_u))); - __pyx_t_19 = __pyx_v_i; - __pyx_t_20 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_19, __pyx_bstride_0_v)); - if (unlikely(__pyx_t_20 == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_tl = (__pyx_t_18 / __pyx_t_20); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":157 - * y = (i+2)%3 - * tl = (left_edge[i] - u[i])/v[i] - * tr = (right_edge[i] - u[i])/v[i] # <<<<<<<<<<<<<< - * if (left_edge[x] <= (u[x] + tl*v[x]) <= right_edge[x]) and \ - * (left_edge[y] <= (u[y] + tl*v[y]) <= right_edge[y]) and \ - */ - __pyx_t_21 = __pyx_v_i; - __pyx_t_22 = __pyx_v_i; - __pyx_t_20 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_21, __pyx_bstride_0_right_edge)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_22, __pyx_bstride_0_u))); - __pyx_t_23 = __pyx_v_i; - __pyx_t_18 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_23, __pyx_bstride_0_v)); - if (unlikely(__pyx_t_18 == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_tr = (__pyx_t_20 / __pyx_t_18); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":158 - * tl = (left_edge[i] - u[i])/v[i] - * tr = (right_edge[i] - u[i])/v[i] - * if (left_edge[x] <= (u[x] + tl*v[x]) <= right_edge[x]) and \ # <<<<<<<<<<<<<< - * (left_edge[y] <= (u[y] + tl*v[y]) <= right_edge[y]) and \ - * (0.0 <= tl < intersect_t): - */ - __pyx_t_24 = __pyx_v_x; - __pyx_t_25 = __pyx_v_x; - __pyx_t_26 = __pyx_v_x; - __pyx_t_18 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_25, __pyx_bstride_0_u)) + (__pyx_v_tl * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_26, __pyx_bstride_0_v)))); - __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_24, __pyx_bstride_0_left_edge)) <= __pyx_t_18); - if (__pyx_t_13) { - __pyx_t_27 = __pyx_v_x; - __pyx_t_13 = (__pyx_t_18 <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_27, __pyx_bstride_0_right_edge))); - } - if (__pyx_t_13) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":159 - * tr = (right_edge[i] - u[i])/v[i] - * if (left_edge[x] <= (u[x] + tl*v[x]) <= right_edge[x]) and \ - * (left_edge[y] <= (u[y] + tl*v[y]) <= right_edge[y]) and \ # <<<<<<<<<<<<<< - * (0.0 <= tl < intersect_t): - * intersect_t = tl - */ - __pyx_t_28 = __pyx_v_y; - __pyx_t_29 = __pyx_v_y; - __pyx_t_30 = __pyx_v_y; - __pyx_t_18 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_29, __pyx_bstride_0_u)) + (__pyx_v_tl * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_30, __pyx_bstride_0_v)))); - __pyx_t_31 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_28, __pyx_bstride_0_left_edge)) <= __pyx_t_18); - if (__pyx_t_31) { - __pyx_t_32 = __pyx_v_y; - __pyx_t_31 = (__pyx_t_18 <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_32, __pyx_bstride_0_right_edge))); - } - if (__pyx_t_31) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":160 - * if (left_edge[x] <= (u[x] + tl*v[x]) <= right_edge[x]) and \ - * (left_edge[y] <= (u[y] + tl*v[y]) <= right_edge[y]) and \ - * (0.0 <= tl < intersect_t): # <<<<<<<<<<<<<< - * intersect_t = tl - * if (left_edge[x] <= (u[x] + tr*v[x]) <= right_edge[x]) and \ - */ - __pyx_t_33 = (0.0 <= __pyx_v_tl); - if (__pyx_t_33) { - __pyx_t_33 = (__pyx_v_tl < __pyx_v_intersect_t); - } - __pyx_t_34 = __pyx_t_33; - } else { - __pyx_t_34 = __pyx_t_31; - } - __pyx_t_31 = __pyx_t_34; - } else { - __pyx_t_31 = __pyx_t_13; - } - if (__pyx_t_31) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":161 - * (left_edge[y] <= (u[y] + tl*v[y]) <= right_edge[y]) and \ - * (0.0 <= tl < intersect_t): - * intersect_t = tl # <<<<<<<<<<<<<< - * if (left_edge[x] <= (u[x] + tr*v[x]) <= right_edge[x]) and \ - * (left_edge[y] <= (u[y] + tr*v[y]) <= right_edge[y]) and \ - */ - __pyx_v_intersect_t = __pyx_v_tl; - goto __pyx_L9; - } - __pyx_L9:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":162 - * (0.0 <= tl < intersect_t): - * intersect_t = tl - * if (left_edge[x] <= (u[x] + tr*v[x]) <= right_edge[x]) and \ # <<<<<<<<<<<<<< - * (left_edge[y] <= (u[y] + tr*v[y]) <= right_edge[y]) and \ - * (0.0 <= tr < intersect_t): - */ - __pyx_t_35 = __pyx_v_x; - __pyx_t_36 = __pyx_v_x; - __pyx_t_37 = __pyx_v_x; - __pyx_t_18 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_36, __pyx_bstride_0_u)) + (__pyx_v_tr * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_37, __pyx_bstride_0_v)))); - __pyx_t_31 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_35, __pyx_bstride_0_left_edge)) <= __pyx_t_18); - if (__pyx_t_31) { - __pyx_t_38 = __pyx_v_x; - __pyx_t_31 = (__pyx_t_18 <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_38, __pyx_bstride_0_right_edge))); - } - if (__pyx_t_31) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":163 - * intersect_t = tl - * if (left_edge[x] <= (u[x] + tr*v[x]) <= right_edge[x]) and \ - * (left_edge[y] <= (u[y] + tr*v[y]) <= right_edge[y]) and \ # <<<<<<<<<<<<<< - * (0.0 <= tr < intersect_t): - * intersect_t = tr - */ - __pyx_t_39 = __pyx_v_y; - __pyx_t_40 = __pyx_v_y; - __pyx_t_41 = __pyx_v_y; - __pyx_t_18 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_40, __pyx_bstride_0_u)) + (__pyx_v_tr * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_41, __pyx_bstride_0_v)))); - __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_39, __pyx_bstride_0_left_edge)) <= __pyx_t_18); - if (__pyx_t_13) { - __pyx_t_42 = __pyx_v_y; - __pyx_t_13 = (__pyx_t_18 <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_42, __pyx_bstride_0_right_edge))); - } - if (__pyx_t_13) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":164 - * if (left_edge[x] <= (u[x] + tr*v[x]) <= right_edge[x]) and \ - * (left_edge[y] <= (u[y] + tr*v[y]) <= right_edge[y]) and \ - * (0.0 <= tr < intersect_t): # <<<<<<<<<<<<<< - * intersect_t = tr - * # if fully enclosed - */ - __pyx_t_34 = (0.0 <= __pyx_v_tr); - if (__pyx_t_34) { - __pyx_t_34 = (__pyx_v_tr < __pyx_v_intersect_t); - } - __pyx_t_33 = __pyx_t_34; - } else { - __pyx_t_33 = __pyx_t_13; - } - __pyx_t_13 = __pyx_t_33; - } else { - __pyx_t_13 = __pyx_t_31; - } - if (__pyx_t_13) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":165 - * (left_edge[y] <= (u[y] + tr*v[y]) <= right_edge[y]) and \ - * (0.0 <= tr < intersect_t): - * intersect_t = tr # <<<<<<<<<<<<<< - * # if fully enclosed - * if (left_edge[0] <= u[0] <= right_edge[0]) and \ - */ - __pyx_v_intersect_t = __pyx_v_tr; - goto __pyx_L10; - } - __pyx_L10:; - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":167 - * intersect_t = tr - * # if fully enclosed - * if (left_edge[0] <= u[0] <= right_edge[0]) and \ # <<<<<<<<<<<<<< - * (left_edge[1] <= u[1] <= right_edge[1]) and \ - * (left_edge[2] <= u[2] <= right_edge[2]): - */ - __pyx_t_43 = 0; - __pyx_t_44 = 0; - __pyx_t_18 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_44, __pyx_bstride_0_u)); - __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_43, __pyx_bstride_0_left_edge)) <= __pyx_t_18); - if (__pyx_t_13) { - __pyx_t_45 = 0; - __pyx_t_13 = (__pyx_t_18 <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_45, __pyx_bstride_0_right_edge))); - } - if (__pyx_t_13) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":168 - * # if fully enclosed - * if (left_edge[0] <= u[0] <= right_edge[0]) and \ - * (left_edge[1] <= u[1] <= right_edge[1]) and \ # <<<<<<<<<<<<<< - * (left_edge[2] <= u[2] <= right_edge[2]): - * intersect_t = 0.0 - */ - __pyx_t_46 = 1; - __pyx_t_47 = 1; - __pyx_t_18 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_47, __pyx_bstride_0_u)); - __pyx_t_31 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_46, __pyx_bstride_0_left_edge)) <= __pyx_t_18); - if (__pyx_t_31) { - __pyx_t_48 = 1; - __pyx_t_31 = (__pyx_t_18 <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_48, __pyx_bstride_0_right_edge))); - } - if (__pyx_t_31) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":169 - * if (left_edge[0] <= u[0] <= right_edge[0]) and \ - * (left_edge[1] <= u[1] <= right_edge[1]) and \ - * (left_edge[2] <= u[2] <= right_edge[2]): # <<<<<<<<<<<<<< - * intersect_t = 0.0 - * if not (0 <= intersect_t <= 1): return - */ - __pyx_t_49 = 2; - __pyx_t_50 = 2; - __pyx_t_18 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_50, __pyx_bstride_0_u)); - __pyx_t_33 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_49, __pyx_bstride_0_left_edge)) <= __pyx_t_18); - if (__pyx_t_33) { - __pyx_t_51 = 2; - __pyx_t_33 = (__pyx_t_18 <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_51, __pyx_bstride_0_right_edge))); - } - __pyx_t_34 = __pyx_t_33; - } else { - __pyx_t_34 = __pyx_t_31; - } - __pyx_t_31 = __pyx_t_34; - } else { - __pyx_t_31 = __pyx_t_13; - } - if (__pyx_t_31) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":170 - * (left_edge[1] <= u[1] <= right_edge[1]) and \ - * (left_edge[2] <= u[2] <= right_edge[2]): - * intersect_t = 0.0 # <<<<<<<<<<<<<< - * if not (0 <= intersect_t <= 1): return - * # Now get the indices of the intersection - */ - __pyx_v_intersect_t = 0.0; - goto __pyx_L11; - } - __pyx_L11:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":171 - * (left_edge[2] <= u[2] <= right_edge[2]): - * intersect_t = 0.0 - * if not (0 <= intersect_t <= 1): return # <<<<<<<<<<<<<< - * # Now get the indices of the intersection - * intersect = u + intersect_t * v - */ - __pyx_t_31 = (0.0 <= __pyx_v_intersect_t); - if (__pyx_t_31) { - __pyx_t_31 = (__pyx_v_intersect_t <= 1.0); - } - __pyx_t_13 = (!__pyx_t_31); - if (__pyx_t_13) { - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - goto __pyx_L12; - } - __pyx_L12:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":173 - * if not (0 <= intersect_t <= 1): return - * # Now get the indices of the intersection - * intersect = u + intersect_t * v # <<<<<<<<<<<<<< - * for i in range(3): - * cur_ind[i] = np.floor((intersect[i] + 1e-8*dx[i] - left_edge[i])/dx[i]) - */ - __pyx_t_5 = PyFloat_FromDouble(__pyx_v_intersect_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyNumber_Multiply(__pyx_t_5, ((PyObject *)__pyx_v_v)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_v_u), __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_10 = ((PyArrayObject *)__pyx_t_5); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_intersect); - __pyx_t_11 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_intersect, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_11 < 0)) { - PyErr_Fetch(&__pyx_t_52, &__pyx_t_53, &__pyx_t_54); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_intersect, (PyObject*)__pyx_v_intersect, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_52); Py_XDECREF(__pyx_t_53); Py_XDECREF(__pyx_t_54); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_52, __pyx_t_53, __pyx_t_54); - } - } - __pyx_bstride_0_intersect = __pyx_bstruct_intersect.strides[0]; - __pyx_bshape_0_intersect = __pyx_bstruct_intersect.shape[0]; - if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_10 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_intersect)); - __pyx_v_intersect = ((PyArrayObject *)__pyx_t_5); - __pyx_t_5 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":174 - * # Now get the indices of the intersection - * intersect = u + intersect_t * v - * for i in range(3): # <<<<<<<<<<<<<< - * cur_ind[i] = np.floor((intersect[i] + 1e-8*dx[i] - left_edge[i])/dx[i]) - * tmax[i] = (((cur_ind[i]+step[i])*dx[i])+left_edge[i]-u[i])/v[i] - */ - for (__pyx_t_11 = 0; __pyx_t_11 < 3; __pyx_t_11+=1) { - __pyx_v_i = __pyx_t_11; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":175 - * intersect = u + intersect_t * v - * for i in range(3): - * cur_ind[i] = np.floor((intersect[i] + 1e-8*dx[i] - left_edge[i])/dx[i]) # <<<<<<<<<<<<<< - * tmax[i] = (((cur_ind[i]+step[i])*dx[i])+left_edge[i]-u[i])/v[i] - * if cur_ind[i] == grid_mask.shape[i] and step[i] < 0: - */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__floor); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_55 = __pyx_v_i; - __pyx_t_56 = __pyx_v_i; - __pyx_t_57 = __pyx_v_i; - __pyx_t_18 = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_intersect.buf, __pyx_t_55, __pyx_bstride_0_intersect)) + (1e-8 * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dx.buf, __pyx_t_56, __pyx_bstride_0_dx)))) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_57, __pyx_bstride_0_left_edge))); - __pyx_t_58 = __pyx_v_i; - __pyx_t_20 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dx.buf, __pyx_t_58, __pyx_bstride_0_dx)); - if (unlikely(__pyx_t_20 == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_5 = PyFloat_FromDouble((__pyx_t_18 / __pyx_t_20)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_59 = __Pyx_PyInt_from_py_npy_int64(__pyx_t_5); if (unlikely((__pyx_t_59 == (npy_int64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_60 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_60, __pyx_bstride_0_cur_ind) = __pyx_t_59; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":176 - * for i in range(3): - * cur_ind[i] = np.floor((intersect[i] + 1e-8*dx[i] - left_edge[i])/dx[i]) - * tmax[i] = (((cur_ind[i]+step[i])*dx[i])+left_edge[i]-u[i])/v[i] # <<<<<<<<<<<<<< - * if cur_ind[i] == grid_mask.shape[i] and step[i] < 0: - * cur_ind[i] = grid_mask.shape[i] - 1 - */ - __pyx_t_61 = __pyx_v_i; - __pyx_t_62 = __pyx_v_i; - __pyx_t_63 = __pyx_v_i; - __pyx_t_64 = __pyx_v_i; - __pyx_t_65 = __pyx_v_i; - __pyx_t_20 = (((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_61, __pyx_bstride_0_cur_ind)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_step.buf, __pyx_t_62, __pyx_bstride_0_step))) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dx.buf, __pyx_t_63, __pyx_bstride_0_dx))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_64, __pyx_bstride_0_left_edge))) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_65, __pyx_bstride_0_u))); - __pyx_t_66 = __pyx_v_i; - __pyx_t_18 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_66, __pyx_bstride_0_v)); - if (unlikely(__pyx_t_18 == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_67 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_67, __pyx_bstride_0_tmax) = (__pyx_t_20 / __pyx_t_18); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":177 - * cur_ind[i] = np.floor((intersect[i] + 1e-8*dx[i] - left_edge[i])/dx[i]) - * tmax[i] = (((cur_ind[i]+step[i])*dx[i])+left_edge[i]-u[i])/v[i] - * if cur_ind[i] == grid_mask.shape[i] and step[i] < 0: # <<<<<<<<<<<<<< - * cur_ind[i] = grid_mask.shape[i] - 1 - * if step[i] > 0: tmax[i] = (((cur_ind[i]+1)*dx[i])+left_edge[i]-u[i])/v[i] - */ - __pyx_t_68 = __pyx_v_i; - __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_68, __pyx_bstride_0_cur_ind)) == (__pyx_v_grid_mask->dimensions[__pyx_v_i])); - if (__pyx_t_13) { - __pyx_t_69 = __pyx_v_i; - __pyx_t_31 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_step.buf, __pyx_t_69, __pyx_bstride_0_step)) < 0); - __pyx_t_34 = __pyx_t_31; - } else { - __pyx_t_34 = __pyx_t_13; - } - if (__pyx_t_34) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":178 - * tmax[i] = (((cur_ind[i]+step[i])*dx[i])+left_edge[i]-u[i])/v[i] - * if cur_ind[i] == grid_mask.shape[i] and step[i] < 0: - * cur_ind[i] = grid_mask.shape[i] - 1 # <<<<<<<<<<<<<< - * if step[i] > 0: tmax[i] = (((cur_ind[i]+1)*dx[i])+left_edge[i]-u[i])/v[i] - * if step[i] < 0: tmax[i] = (((cur_ind[i]+0)*dx[i])+left_edge[i]-u[i])/v[i] - */ - __pyx_t_70 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_70, __pyx_bstride_0_cur_ind) = ((__pyx_v_grid_mask->dimensions[__pyx_v_i]) - 1); - goto __pyx_L15; - } - __pyx_L15:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":179 - * if cur_ind[i] == grid_mask.shape[i] and step[i] < 0: - * cur_ind[i] = grid_mask.shape[i] - 1 - * if step[i] > 0: tmax[i] = (((cur_ind[i]+1)*dx[i])+left_edge[i]-u[i])/v[i] # <<<<<<<<<<<<<< - * if step[i] < 0: tmax[i] = (((cur_ind[i]+0)*dx[i])+left_edge[i]-u[i])/v[i] - * tdelta[i] = (dx[i]/v[i]) - */ - __pyx_t_71 = __pyx_v_i; - __pyx_t_34 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_step.buf, __pyx_t_71, __pyx_bstride_0_step)) > 0); - if (__pyx_t_34) { - __pyx_t_72 = __pyx_v_i; - __pyx_t_73 = __pyx_v_i; - __pyx_t_74 = __pyx_v_i; - __pyx_t_75 = __pyx_v_i; - __pyx_t_18 = (((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_72, __pyx_bstride_0_cur_ind)) + 1) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dx.buf, __pyx_t_73, __pyx_bstride_0_dx))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_74, __pyx_bstride_0_left_edge))) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_75, __pyx_bstride_0_u))); - __pyx_t_76 = __pyx_v_i; - __pyx_t_20 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_76, __pyx_bstride_0_v)); - if (unlikely(__pyx_t_20 == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_77 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_77, __pyx_bstride_0_tmax) = (__pyx_t_18 / __pyx_t_20); - goto __pyx_L16; - } - __pyx_L16:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":180 - * cur_ind[i] = grid_mask.shape[i] - 1 - * if step[i] > 0: tmax[i] = (((cur_ind[i]+1)*dx[i])+left_edge[i]-u[i])/v[i] - * if step[i] < 0: tmax[i] = (((cur_ind[i]+0)*dx[i])+left_edge[i]-u[i])/v[i] # <<<<<<<<<<<<<< - * tdelta[i] = (dx[i]/v[i]) - * if tdelta[i] < 0: tdelta[i] *= -1 - */ - __pyx_t_78 = __pyx_v_i; - __pyx_t_34 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_step.buf, __pyx_t_78, __pyx_bstride_0_step)) < 0); - if (__pyx_t_34) { - __pyx_t_79 = __pyx_v_i; - __pyx_t_80 = __pyx_v_i; - __pyx_t_81 = __pyx_v_i; - __pyx_t_82 = __pyx_v_i; - __pyx_t_20 = (((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_79, __pyx_bstride_0_cur_ind)) + 0) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dx.buf, __pyx_t_80, __pyx_bstride_0_dx))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_81, __pyx_bstride_0_left_edge))) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_82, __pyx_bstride_0_u))); - __pyx_t_83 = __pyx_v_i; - __pyx_t_18 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_83, __pyx_bstride_0_v)); - if (unlikely(__pyx_t_18 == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_84 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_84, __pyx_bstride_0_tmax) = (__pyx_t_20 / __pyx_t_18); - goto __pyx_L17; - } - __pyx_L17:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":181 - * if step[i] > 0: tmax[i] = (((cur_ind[i]+1)*dx[i])+left_edge[i]-u[i])/v[i] - * if step[i] < 0: tmax[i] = (((cur_ind[i]+0)*dx[i])+left_edge[i]-u[i])/v[i] - * tdelta[i] = (dx[i]/v[i]) # <<<<<<<<<<<<<< - * if tdelta[i] < 0: tdelta[i] *= -1 - * # The variable intersect contains the point we first pierce the grid - */ - __pyx_t_85 = __pyx_v_i; - __pyx_t_18 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dx.buf, __pyx_t_85, __pyx_bstride_0_dx)); - __pyx_t_86 = __pyx_v_i; - __pyx_t_20 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_86, __pyx_bstride_0_v)); - if (unlikely(__pyx_t_20 == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_87 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tdelta.buf, __pyx_t_87, __pyx_bstride_0_tdelta) = (__pyx_t_18 / __pyx_t_20); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":182 - * if step[i] < 0: tmax[i] = (((cur_ind[i]+0)*dx[i])+left_edge[i]-u[i])/v[i] - * tdelta[i] = (dx[i]/v[i]) - * if tdelta[i] < 0: tdelta[i] *= -1 # <<<<<<<<<<<<<< - * # The variable intersect contains the point we first pierce the grid - * enter_t = intersect_t - */ - __pyx_t_88 = __pyx_v_i; - __pyx_t_34 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tdelta.buf, __pyx_t_88, __pyx_bstride_0_tdelta)) < 0.0); - if (__pyx_t_34) { - __pyx_t_89 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tdelta.buf, __pyx_t_89, __pyx_bstride_0_tdelta) *= -1.0; - goto __pyx_L18; - } - __pyx_L18:; - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":184 - * if tdelta[i] < 0: tdelta[i] *= -1 - * # The variable intersect contains the point we first pierce the grid - * enter_t = intersect_t # <<<<<<<<<<<<<< - * while 1: - * if (not (0 <= cur_ind[0] < grid_mask.shape[0])) or \ - */ - __pyx_v_enter_t = __pyx_v_intersect_t; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":185 - * # The variable intersect contains the point we first pierce the grid - * enter_t = intersect_t - * while 1: # <<<<<<<<<<<<<< - * if (not (0 <= cur_ind[0] < grid_mask.shape[0])) or \ - * (not (0 <= cur_ind[1] < grid_mask.shape[1])) or \ - */ - while (1) { - if (!1) break; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":186 - * enter_t = intersect_t - * while 1: - * if (not (0 <= cur_ind[0] < grid_mask.shape[0])) or \ # <<<<<<<<<<<<<< - * (not (0 <= cur_ind[1] < grid_mask.shape[1])) or \ - * (not (0 <= cur_ind[2] < grid_mask.shape[2])): - */ - __pyx_t_90 = 0; - __pyx_t_59 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_90, __pyx_bstride_0_cur_ind)); - __pyx_t_34 = (0 <= __pyx_t_59); - if (__pyx_t_34) { - __pyx_t_34 = (__pyx_t_59 < (__pyx_v_grid_mask->dimensions[0])); - } - __pyx_t_13 = (!__pyx_t_34); - if (!__pyx_t_13) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":187 - * while 1: - * if (not (0 <= cur_ind[0] < grid_mask.shape[0])) or \ - * (not (0 <= cur_ind[1] < grid_mask.shape[1])) or \ # <<<<<<<<<<<<<< - * (not (0 <= cur_ind[2] < grid_mask.shape[2])): - * break - */ - __pyx_t_91 = 1; - __pyx_t_59 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_91, __pyx_bstride_0_cur_ind)); - __pyx_t_34 = (0 <= __pyx_t_59); - if (__pyx_t_34) { - __pyx_t_34 = (__pyx_t_59 < (__pyx_v_grid_mask->dimensions[1])); - } - __pyx_t_31 = (!__pyx_t_34); - if (!__pyx_t_31) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":188 - * if (not (0 <= cur_ind[0] < grid_mask.shape[0])) or \ - * (not (0 <= cur_ind[1] < grid_mask.shape[1])) or \ - * (not (0 <= cur_ind[2] < grid_mask.shape[2])): # <<<<<<<<<<<<<< - * break - * # Note that we are calculating t on the fly, but we get *negative* t - */ - __pyx_t_92 = 2; - __pyx_t_59 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_92, __pyx_bstride_0_cur_ind)); - __pyx_t_34 = (0 <= __pyx_t_59); - if (__pyx_t_34) { - __pyx_t_34 = (__pyx_t_59 < (__pyx_v_grid_mask->dimensions[2])); - } - __pyx_t_33 = (!__pyx_t_34); - __pyx_t_34 = __pyx_t_33; - } else { - __pyx_t_34 = __pyx_t_31; - } - __pyx_t_31 = __pyx_t_34; - } else { - __pyx_t_31 = __pyx_t_13; - } - if (__pyx_t_31) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":189 - * (not (0 <= cur_ind[1] < grid_mask.shape[1])) or \ - * (not (0 <= cur_ind[2] < grid_mask.shape[2])): - * break # <<<<<<<<<<<<<< - * # Note that we are calculating t on the fly, but we get *negative* t - * # values from what they should be. - */ - goto __pyx_L20_break; - goto __pyx_L21; - } - __pyx_L21:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":193 - * # values from what they should be. - * # If we've reached t = 1, we are done. - * grid_mask[cur_ind[0], cur_ind[1], cur_ind[2]] = 1 # <<<<<<<<<<<<<< - * if (tmax[0] > 1.0) and (tmax[1] > 1.0) and (tmax[2] > 1.0): - * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = 1.0 - enter_t - */ - __pyx_t_93 = 0; - __pyx_t_94 = 1; - __pyx_t_95 = 2; - __pyx_t_59 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_93, __pyx_bstride_0_cur_ind)); - __pyx_t_96 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_94, __pyx_bstride_0_cur_ind)); - __pyx_t_97 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_95, __pyx_bstride_0_cur_ind)); - *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int_t *, __pyx_bstruct_grid_mask.buf, __pyx_t_59, __pyx_bstride_0_grid_mask, __pyx_t_96, __pyx_bstride_1_grid_mask, __pyx_t_97, __pyx_bstride_2_grid_mask) = 1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":194 - * # If we've reached t = 1, we are done. - * grid_mask[cur_ind[0], cur_ind[1], cur_ind[2]] = 1 - * if (tmax[0] > 1.0) and (tmax[1] > 1.0) and (tmax[2] > 1.0): # <<<<<<<<<<<<<< - * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = 1.0 - enter_t - * break - */ - __pyx_t_98 = 0; - __pyx_t_31 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_98, __pyx_bstride_0_tmax)) > 1.0); - if (__pyx_t_31) { - __pyx_t_99 = 1; - __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_99, __pyx_bstride_0_tmax)) > 1.0); - if (__pyx_t_13) { - __pyx_t_100 = 2; - __pyx_t_34 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_100, __pyx_bstride_0_tmax)) > 1.0); - __pyx_t_33 = __pyx_t_34; - } else { - __pyx_t_33 = __pyx_t_13; - } - __pyx_t_13 = __pyx_t_33; - } else { - __pyx_t_13 = __pyx_t_31; - } - if (__pyx_t_13) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":195 - * grid_mask[cur_ind[0], cur_ind[1], cur_ind[2]] = 1 - * if (tmax[0] > 1.0) and (tmax[1] > 1.0) and (tmax[2] > 1.0): - * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = 1.0 - enter_t # <<<<<<<<<<<<<< - * break - * if tmax[0] < tmax[1]: - */ - __pyx_t_101 = 0; - __pyx_t_102 = 1; - __pyx_t_103 = 2; - __pyx_t_104 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_101, __pyx_bstride_0_cur_ind)); - __pyx_t_105 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_102, __pyx_bstride_0_cur_ind)); - __pyx_t_106 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_103, __pyx_bstride_0_cur_ind)); - *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_grid_dt.buf, __pyx_t_104, __pyx_bstride_0_grid_dt, __pyx_t_105, __pyx_bstride_1_grid_dt, __pyx_t_106, __pyx_bstride_2_grid_dt) = (1.0 - __pyx_v_enter_t); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":196 - * if (tmax[0] > 1.0) and (tmax[1] > 1.0) and (tmax[2] > 1.0): - * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = 1.0 - enter_t - * break # <<<<<<<<<<<<<< - * if tmax[0] < tmax[1]: - * if tmax[0] < tmax[2]: - */ - goto __pyx_L20_break; - goto __pyx_L22; - } - __pyx_L22:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":197 - * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = 1.0 - enter_t - * break - * if tmax[0] < tmax[1]: # <<<<<<<<<<<<<< - * if tmax[0] < tmax[2]: - * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t - */ - __pyx_t_107 = 0; - __pyx_t_108 = 1; - __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_107, __pyx_bstride_0_tmax)) < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_108, __pyx_bstride_0_tmax))); - if (__pyx_t_13) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":198 - * break - * if tmax[0] < tmax[1]: - * if tmax[0] < tmax[2]: # <<<<<<<<<<<<<< - * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t - * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[0] - enter_t - */ - __pyx_t_109 = 0; - __pyx_t_110 = 2; - __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_109, __pyx_bstride_0_tmax)) < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_110, __pyx_bstride_0_tmax))); - if (__pyx_t_13) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":199 - * if tmax[0] < tmax[1]: - * if tmax[0] < tmax[2]: - * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t # <<<<<<<<<<<<<< - * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[0] - enter_t - * enter_t = tmax[0] - */ - __pyx_t_111 = 0; - __pyx_t_112 = 1; - __pyx_t_113 = 2; - __pyx_t_114 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_111, __pyx_bstride_0_cur_ind)); - __pyx_t_115 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_112, __pyx_bstride_0_cur_ind)); - __pyx_t_116 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_113, __pyx_bstride_0_cur_ind)); - *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_grid_t.buf, __pyx_t_114, __pyx_bstride_0_grid_t, __pyx_t_115, __pyx_bstride_1_grid_t, __pyx_t_116, __pyx_bstride_2_grid_t) = __pyx_v_enter_t; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":200 - * if tmax[0] < tmax[2]: - * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t - * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[0] - enter_t # <<<<<<<<<<<<<< - * enter_t = tmax[0] - * tmax[0] += tdelta[0] - */ - __pyx_t_117 = 0; - __pyx_t_118 = 0; - __pyx_t_119 = 1; - __pyx_t_120 = 2; - __pyx_t_121 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_118, __pyx_bstride_0_cur_ind)); - __pyx_t_122 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_119, __pyx_bstride_0_cur_ind)); - __pyx_t_123 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_120, __pyx_bstride_0_cur_ind)); - *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_grid_dt.buf, __pyx_t_121, __pyx_bstride_0_grid_dt, __pyx_t_122, __pyx_bstride_1_grid_dt, __pyx_t_123, __pyx_bstride_2_grid_dt) = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_117, __pyx_bstride_0_tmax)) - __pyx_v_enter_t); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":201 - * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t - * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[0] - enter_t - * enter_t = tmax[0] # <<<<<<<<<<<<<< - * tmax[0] += tdelta[0] - * cur_ind[0] += step[0] - */ - __pyx_t_124 = 0; - __pyx_v_enter_t = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_124, __pyx_bstride_0_tmax)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":202 - * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[0] - enter_t - * enter_t = tmax[0] - * tmax[0] += tdelta[0] # <<<<<<<<<<<<<< - * cur_ind[0] += step[0] - * else: - */ - __pyx_t_125 = 0; - __pyx_t_126 = 0; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_126, __pyx_bstride_0_tmax) += (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tdelta.buf, __pyx_t_125, __pyx_bstride_0_tdelta)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":203 - * enter_t = tmax[0] - * tmax[0] += tdelta[0] - * cur_ind[0] += step[0] # <<<<<<<<<<<<<< - * else: - * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t - */ - __pyx_t_127 = 0; - __pyx_t_128 = 0; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_128, __pyx_bstride_0_cur_ind) += (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_step.buf, __pyx_t_127, __pyx_bstride_0_step)); - goto __pyx_L24; - } - /*else*/ { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":205 - * cur_ind[0] += step[0] - * else: - * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t # <<<<<<<<<<<<<< - * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[2] - enter_t - * enter_t = tmax[2] - */ - __pyx_t_129 = 0; - __pyx_t_130 = 1; - __pyx_t_131 = 2; - __pyx_t_132 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_129, __pyx_bstride_0_cur_ind)); - __pyx_t_133 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_130, __pyx_bstride_0_cur_ind)); - __pyx_t_134 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_131, __pyx_bstride_0_cur_ind)); - *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_grid_t.buf, __pyx_t_132, __pyx_bstride_0_grid_t, __pyx_t_133, __pyx_bstride_1_grid_t, __pyx_t_134, __pyx_bstride_2_grid_t) = __pyx_v_enter_t; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":206 - * else: - * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t - * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[2] - enter_t # <<<<<<<<<<<<<< - * enter_t = tmax[2] - * tmax[2] += tdelta[2] - */ - __pyx_t_135 = 2; - __pyx_t_136 = 0; - __pyx_t_137 = 1; - __pyx_t_138 = 2; - __pyx_t_139 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_136, __pyx_bstride_0_cur_ind)); - __pyx_t_140 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_137, __pyx_bstride_0_cur_ind)); - __pyx_t_141 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_138, __pyx_bstride_0_cur_ind)); - *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_grid_dt.buf, __pyx_t_139, __pyx_bstride_0_grid_dt, __pyx_t_140, __pyx_bstride_1_grid_dt, __pyx_t_141, __pyx_bstride_2_grid_dt) = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_135, __pyx_bstride_0_tmax)) - __pyx_v_enter_t); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":207 - * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t - * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[2] - enter_t - * enter_t = tmax[2] # <<<<<<<<<<<<<< - * tmax[2] += tdelta[2] - * cur_ind[2] += step[2] - */ - __pyx_t_142 = 2; - __pyx_v_enter_t = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_142, __pyx_bstride_0_tmax)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":208 - * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[2] - enter_t - * enter_t = tmax[2] - * tmax[2] += tdelta[2] # <<<<<<<<<<<<<< - * cur_ind[2] += step[2] - * else: - */ - __pyx_t_143 = 2; - __pyx_t_144 = 2; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_144, __pyx_bstride_0_tmax) += (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tdelta.buf, __pyx_t_143, __pyx_bstride_0_tdelta)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":209 - * enter_t = tmax[2] - * tmax[2] += tdelta[2] - * cur_ind[2] += step[2] # <<<<<<<<<<<<<< - * else: - * if tmax[1] < tmax[2]: - */ - __pyx_t_145 = 2; - __pyx_t_146 = 2; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_146, __pyx_bstride_0_cur_ind) += (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_step.buf, __pyx_t_145, __pyx_bstride_0_step)); - } - __pyx_L24:; - goto __pyx_L23; - } - /*else*/ { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":211 - * cur_ind[2] += step[2] - * else: - * if tmax[1] < tmax[2]: # <<<<<<<<<<<<<< - * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t - * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[1] - enter_t - */ - __pyx_t_147 = 1; - __pyx_t_148 = 2; - __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_147, __pyx_bstride_0_tmax)) < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_148, __pyx_bstride_0_tmax))); - if (__pyx_t_13) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":212 - * else: - * if tmax[1] < tmax[2]: - * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t # <<<<<<<<<<<<<< - * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[1] - enter_t - * enter_t = tmax[1] - */ - __pyx_t_149 = 0; - __pyx_t_150 = 1; - __pyx_t_151 = 2; - __pyx_t_152 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_149, __pyx_bstride_0_cur_ind)); - __pyx_t_153 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_150, __pyx_bstride_0_cur_ind)); - __pyx_t_154 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_151, __pyx_bstride_0_cur_ind)); - *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_grid_t.buf, __pyx_t_152, __pyx_bstride_0_grid_t, __pyx_t_153, __pyx_bstride_1_grid_t, __pyx_t_154, __pyx_bstride_2_grid_t) = __pyx_v_enter_t; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":213 - * if tmax[1] < tmax[2]: - * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t - * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[1] - enter_t # <<<<<<<<<<<<<< - * enter_t = tmax[1] - * tmax[1] += tdelta[1] - */ - __pyx_t_155 = 1; - __pyx_t_156 = 0; - __pyx_t_157 = 1; - __pyx_t_158 = 2; - __pyx_t_159 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_156, __pyx_bstride_0_cur_ind)); - __pyx_t_160 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_157, __pyx_bstride_0_cur_ind)); - __pyx_t_161 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_158, __pyx_bstride_0_cur_ind)); - *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_grid_dt.buf, __pyx_t_159, __pyx_bstride_0_grid_dt, __pyx_t_160, __pyx_bstride_1_grid_dt, __pyx_t_161, __pyx_bstride_2_grid_dt) = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_155, __pyx_bstride_0_tmax)) - __pyx_v_enter_t); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":214 - * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t - * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[1] - enter_t - * enter_t = tmax[1] # <<<<<<<<<<<<<< - * tmax[1] += tdelta[1] - * cur_ind[1] += step[1] - */ - __pyx_t_162 = 1; - __pyx_v_enter_t = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_162, __pyx_bstride_0_tmax)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":215 - * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[1] - enter_t - * enter_t = tmax[1] - * tmax[1] += tdelta[1] # <<<<<<<<<<<<<< - * cur_ind[1] += step[1] - * else: - */ - __pyx_t_163 = 1; - __pyx_t_164 = 1; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_164, __pyx_bstride_0_tmax) += (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tdelta.buf, __pyx_t_163, __pyx_bstride_0_tdelta)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":216 - * enter_t = tmax[1] - * tmax[1] += tdelta[1] - * cur_ind[1] += step[1] # <<<<<<<<<<<<<< - * else: - * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t - */ - __pyx_t_165 = 1; - __pyx_t_166 = 1; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_166, __pyx_bstride_0_cur_ind) += (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_step.buf, __pyx_t_165, __pyx_bstride_0_step)); - goto __pyx_L25; - } - /*else*/ { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":218 - * cur_ind[1] += step[1] - * else: - * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t # <<<<<<<<<<<<<< - * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[2] - enter_t - * enter_t = tmax[2] - */ - __pyx_t_167 = 0; - __pyx_t_168 = 1; - __pyx_t_169 = 2; - __pyx_t_170 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_167, __pyx_bstride_0_cur_ind)); - __pyx_t_171 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_168, __pyx_bstride_0_cur_ind)); - __pyx_t_172 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_169, __pyx_bstride_0_cur_ind)); - *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_grid_t.buf, __pyx_t_170, __pyx_bstride_0_grid_t, __pyx_t_171, __pyx_bstride_1_grid_t, __pyx_t_172, __pyx_bstride_2_grid_t) = __pyx_v_enter_t; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":219 - * else: - * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t - * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[2] - enter_t # <<<<<<<<<<<<<< - * enter_t = tmax[2] - * tmax[2] += tdelta[2] - */ - __pyx_t_173 = 2; - __pyx_t_174 = 0; - __pyx_t_175 = 1; - __pyx_t_176 = 2; - __pyx_t_177 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_174, __pyx_bstride_0_cur_ind)); - __pyx_t_178 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_175, __pyx_bstride_0_cur_ind)); - __pyx_t_179 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_176, __pyx_bstride_0_cur_ind)); - *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_grid_dt.buf, __pyx_t_177, __pyx_bstride_0_grid_dt, __pyx_t_178, __pyx_bstride_1_grid_dt, __pyx_t_179, __pyx_bstride_2_grid_dt) = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_173, __pyx_bstride_0_tmax)) - __pyx_v_enter_t); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":220 - * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t - * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[2] - enter_t - * enter_t = tmax[2] # <<<<<<<<<<<<<< - * tmax[2] += tdelta[2] - * cur_ind[2] += step[2] - */ - __pyx_t_180 = 2; - __pyx_v_enter_t = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_180, __pyx_bstride_0_tmax)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":221 - * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[2] - enter_t - * enter_t = tmax[2] - * tmax[2] += tdelta[2] # <<<<<<<<<<<<<< - * cur_ind[2] += step[2] - * return - */ - __pyx_t_181 = 2; - __pyx_t_182 = 2; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_182, __pyx_bstride_0_tmax) += (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tdelta.buf, __pyx_t_181, __pyx_bstride_0_tdelta)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":222 - * enter_t = tmax[2] - * tmax[2] += tdelta[2] - * cur_ind[2] += step[2] # <<<<<<<<<<<<<< - * return - * - */ - __pyx_t_183 = 2; - __pyx_t_184 = 2; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_184, __pyx_bstride_0_cur_ind) += (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_step.buf, __pyx_t_183, __pyx_bstride_0_step)); - } - __pyx_L25:; - } - __pyx_L23:; - } - __pyx_L20_break:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":223 - * tmax[2] += tdelta[2] - * cur_ind[2] += step[2] - * return # <<<<<<<<<<<<<< - * - * @cython.wraparound(False) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_right_edge); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_intersect); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_t); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_dt); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cur_ind); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edge); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_step); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dx); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_tdelta); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_tmax); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_mask); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_u); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_v); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.amr_utils.VoxelTraversal"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_right_edge); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_intersect); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_t); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_dt); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cur_ind); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edge); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_step); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dx); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_tdelta); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_tmax); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_mask); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_u); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_v); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_step); - __Pyx_XDECREF((PyObject *)__pyx_v_cur_ind); - __Pyx_XDECREF((PyObject *)__pyx_v_tdelta); - __Pyx_XDECREF((PyObject *)__pyx_v_tmax); - __Pyx_XDECREF((PyObject *)__pyx_v_intersect); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":227 - * @cython.wraparound(False) - * @cython.boundscheck(False) - * def PlaneVoxelIntegration(np.ndarray[np.float64_t, ndim=1] left_edge, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t, ndim=1] right_edge, - * np.ndarray[np.float64_t, ndim=1] dx, - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_PlaneVoxelIntegration(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_PlaneVoxelIntegration(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_left_edge = 0; - PyArrayObject *__pyx_v_right_edge = 0; - PyArrayObject *__pyx_v_dx = 0; - PyArrayObject *__pyx_v_ug = 0; - PyArrayObject *__pyx_v_v = 0; - PyArrayObject *__pyx_v_image = 0; - PyArrayObject *__pyx_v_data = 0; - PyArrayObject *__pyx_v_shells = 0; - int __pyx_v_i; - int __pyx_v_vi; - long __pyx_v_intersect_t; - double __pyx_v_dt_tolerance; - int __pyx_v_nv; - int __pyx_v_nshells; - PyArrayObject *__pyx_v_u = 0; - Py_buffer __pyx_bstruct_u; - Py_ssize_t __pyx_bstride_0_u = 0; - Py_ssize_t __pyx_bshape_0_u = 0; - Py_buffer __pyx_bstruct_shells; - Py_ssize_t __pyx_bstride_0_shells = 0; - Py_ssize_t __pyx_bstride_1_shells = 0; - Py_ssize_t __pyx_bshape_0_shells = 0; - Py_ssize_t __pyx_bshape_1_shells = 0; - Py_buffer __pyx_bstruct_image; - Py_ssize_t __pyx_bstride_0_image = 0; - Py_ssize_t __pyx_bstride_1_image = 0; - Py_ssize_t __pyx_bshape_0_image = 0; - Py_ssize_t __pyx_bshape_1_image = 0; - Py_buffer __pyx_bstruct_right_edge; - Py_ssize_t __pyx_bstride_0_right_edge = 0; - Py_ssize_t __pyx_bshape_0_right_edge = 0; - 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_v; - Py_ssize_t __pyx_bstride_0_v = 0; - Py_ssize_t __pyx_bshape_0_v = 0; - Py_buffer __pyx_bstruct_left_edge; - Py_ssize_t __pyx_bstride_0_left_edge = 0; - Py_ssize_t __pyx_bshape_0_left_edge = 0; - Py_buffer __pyx_bstruct_ug; - Py_ssize_t __pyx_bstride_0_ug = 0; - Py_ssize_t __pyx_bstride_1_ug = 0; - Py_ssize_t __pyx_bshape_0_ug = 0; - Py_ssize_t __pyx_bshape_1_ug = 0; - Py_buffer __pyx_bstruct_data; - Py_ssize_t __pyx_bstride_0_data = 0; - Py_ssize_t __pyx_bstride_1_data = 0; - Py_ssize_t __pyx_bstride_2_data = 0; - Py_ssize_t __pyx_bshape_0_data = 0; - Py_ssize_t __pyx_bshape_1_data = 0; - Py_ssize_t __pyx_bshape_2_data = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyArrayObject *__pyx_t_6 = NULL; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__left_edge,&__pyx_n_s__right_edge,&__pyx_n_s__dx,&__pyx_n_s__ug,&__pyx_n_s__v,&__pyx_n_s__image,&__pyx_n_s__data,&__pyx_n_s__shells,0}; - __Pyx_RefNannySetupContext("PlaneVoxelIntegration"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[8] = {0,0,0,0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left_edge); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right_edge); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("PlaneVoxelIntegration", 1, 8, 8, 1); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dx); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("PlaneVoxelIntegration", 1, 8, 8, 2); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ug); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("PlaneVoxelIntegration", 1, 8, 8, 3); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__v); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("PlaneVoxelIntegration", 1, 8, 8, 4); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__image); - if (likely(values[5])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("PlaneVoxelIntegration", 1, 8, 8, 5); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 6: - values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data); - if (likely(values[6])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("PlaneVoxelIntegration", 1, 8, 8, 6); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 7: - values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__shells); - if (likely(values[7])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("PlaneVoxelIntegration", 1, 8, 8, 7); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "PlaneVoxelIntegration") < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_left_edge = ((PyArrayObject *)values[0]); - __pyx_v_right_edge = ((PyArrayObject *)values[1]); - __pyx_v_dx = ((PyArrayObject *)values[2]); - __pyx_v_ug = ((PyArrayObject *)values[3]); - __pyx_v_v = ((PyArrayObject *)values[4]); - __pyx_v_image = ((PyArrayObject *)values[5]); - __pyx_v_data = ((PyArrayObject *)values[6]); - __pyx_v_shells = ((PyArrayObject *)values[7]); - } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_left_edge = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_right_edge = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_dx = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_ug = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); - __pyx_v_v = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); - __pyx_v_image = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 5)); - __pyx_v_data = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 6)); - __pyx_v_shells = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 7)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("PlaneVoxelIntegration", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.PlaneVoxelIntegration"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_u.buf = NULL; - __pyx_bstruct_left_edge.buf = NULL; - __pyx_bstruct_right_edge.buf = NULL; - __pyx_bstruct_dx.buf = NULL; - __pyx_bstruct_ug.buf = NULL; - __pyx_bstruct_v.buf = NULL; - __pyx_bstruct_image.buf = NULL; - __pyx_bstruct_data.buf = NULL; - __pyx_bstruct_shells.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left_edge), __pyx_ptype_5numpy_ndarray, 1, "left_edge", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right_edge), __pyx_ptype_5numpy_ndarray, 1, "right_edge", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 228; __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[4]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ug), __pyx_ptype_5numpy_ndarray, 1, "ug", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_image), __pyx_ptype_5numpy_ndarray, 1, "image", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), __pyx_ptype_5numpy_ndarray, 1, "data", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shells), __pyx_ptype_5numpy_ndarray, 1, "shells", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_left_edge, (PyObject*)__pyx_v_left_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_left_edge = __pyx_bstruct_left_edge.strides[0]; - __pyx_bshape_0_left_edge = __pyx_bstruct_left_edge.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_right_edge, (PyObject*)__pyx_v_right_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_right_edge = __pyx_bstruct_right_edge.strides[0]; - __pyx_bshape_0_right_edge = __pyx_bstruct_right_edge.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dx, (PyObject*)__pyx_v_dx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __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]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_ug, (PyObject*)__pyx_v_ug, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_ug = __pyx_bstruct_ug.strides[0]; __pyx_bstride_1_ug = __pyx_bstruct_ug.strides[1]; - __pyx_bshape_0_ug = __pyx_bstruct_ug.shape[0]; __pyx_bshape_1_ug = __pyx_bstruct_ug.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_v, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_v = __pyx_bstruct_v.strides[0]; - __pyx_bshape_0_v = __pyx_bstruct_v.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_image, (PyObject*)__pyx_v_image, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_image = __pyx_bstruct_image.strides[0]; __pyx_bstride_1_image = __pyx_bstruct_image.strides[1]; - __pyx_bshape_0_image = __pyx_bstruct_image.shape[0]; __pyx_bshape_1_image = __pyx_bstruct_image.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_data, (PyObject*)__pyx_v_data, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_data = __pyx_bstruct_data.strides[0]; __pyx_bstride_1_data = __pyx_bstruct_data.strides[1]; __pyx_bstride_2_data = __pyx_bstruct_data.strides[2]; - __pyx_bshape_0_data = __pyx_bstruct_data.shape[0]; __pyx_bshape_1_data = __pyx_bstruct_data.shape[1]; __pyx_bshape_2_data = __pyx_bstruct_data.shape[2]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_shells, (PyObject*)__pyx_v_shells, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_shells = __pyx_bstruct_shells.strides[0]; __pyx_bstride_1_shells = __pyx_bstruct_shells.strides[1]; - __pyx_bshape_0_shells = __pyx_bstruct_shells.shape[0]; __pyx_bshape_1_shells = __pyx_bstruct_shells.shape[1]; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":239 - * # generalized to transfer functions - * cdef int i, x, y, vi - * intersect_t = 1 # <<<<<<<<<<<<<< - * dt_tolerance = 1e-6 - * cdef int nv = ug.shape[0] - */ - __pyx_v_intersect_t = 1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":240 - * cdef int i, x, y, vi - * intersect_t = 1 - * dt_tolerance = 1e-6 # <<<<<<<<<<<<<< - * cdef int nv = ug.shape[0] - * cdef int nshells = shells.shape[0] - */ - __pyx_v_dt_tolerance = 1e-6; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":241 - * intersect_t = 1 - * dt_tolerance = 1e-6 - * cdef int nv = ug.shape[0] # <<<<<<<<<<<<<< - * cdef int nshells = shells.shape[0] - * cdef np.ndarray[np.float64_t, ndim=1] u = np.empty((3,), dtype=np.float64) - */ - __pyx_v_nv = (__pyx_v_ug->dimensions[0]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":242 - * dt_tolerance = 1e-6 - * cdef int nv = ug.shape[0] - * cdef int nshells = shells.shape[0] # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t, ndim=1] u = np.empty((3,), dtype=np.float64) - * # Copy things into temporary location for passing between functions - */ - __pyx_v_nshells = (__pyx_v_shells->dimensions[0]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":243 - * cdef int nv = ug.shape[0] - * cdef int nshells = shells.shape[0] - * cdef np.ndarray[np.float64_t, ndim=1] u = np.empty((3,), dtype=np.float64) # <<<<<<<<<<<<<< - * # Copy things into temporary location for passing between functions - * for vi in range(nv): - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = ((PyArrayObject *)__pyx_t_5); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_u, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_u = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_u.buf = NULL; - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_u = __pyx_bstruct_u.strides[0]; - __pyx_bshape_0_u = __pyx_bstruct_u.shape[0]; - } - } - __pyx_t_6 = 0; - __pyx_v_u = ((PyArrayObject *)__pyx_t_5); - __pyx_t_5 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":245 - * cdef np.ndarray[np.float64_t, ndim=1] u = np.empty((3,), dtype=np.float64) - * # Copy things into temporary location for passing between functions - * for vi in range(nv): # <<<<<<<<<<<<<< - * for i in range(3): u[i] = ug[vi, i] - * integrate_ray(u, v, left_edge, right_edge, dx, - */ - __pyx_t_7 = __pyx_v_nv; - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { - __pyx_v_vi = __pyx_t_8; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":246 - * # Copy things into temporary location for passing between functions - * for vi in range(nv): - * for i in range(3): u[i] = ug[vi, i] # <<<<<<<<<<<<<< - * integrate_ray(u, v, left_edge, right_edge, dx, - * nshells, vi, data, shells, image) - */ - for (__pyx_t_9 = 0; __pyx_t_9 < 3; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; - __pyx_t_10 = __pyx_v_vi; - __pyx_t_11 = __pyx_v_i; - __pyx_t_12 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_12, __pyx_bstride_0_u) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_ug.buf, __pyx_t_10, __pyx_bstride_0_ug, __pyx_t_11, __pyx_bstride_1_ug)); - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":247 - * for vi in range(nv): - * for i in range(3): u[i] = ug[vi, i] - * integrate_ray(u, v, left_edge, right_edge, dx, # <<<<<<<<<<<<<< - * nshells, vi, data, shells, image) - * - */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__integrate_ray); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":248 - * for i in range(3): u[i] = ug[vi, i] - * integrate_ray(u, v, left_edge, right_edge, dx, - * nshells, vi, data, shells, image) # <<<<<<<<<<<<<< - * - * @cython.wraparound(False) - */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_nshells); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyInt_FromLong(__pyx_v_vi); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)__pyx_v_u)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_u)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_u)); - __Pyx_INCREF(((PyObject *)__pyx_v_v)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_v)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_v)); - __Pyx_INCREF(((PyObject *)__pyx_v_left_edge)); - PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_left_edge)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_left_edge)); - __Pyx_INCREF(((PyObject *)__pyx_v_right_edge)); - PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_v_right_edge)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_right_edge)); - __Pyx_INCREF(((PyObject *)__pyx_v_dx)); - PyTuple_SET_ITEM(__pyx_t_2, 4, ((PyObject *)__pyx_v_dx)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_dx)); - PyTuple_SET_ITEM(__pyx_t_2, 5, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 6, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_v_data)); - PyTuple_SET_ITEM(__pyx_t_2, 7, ((PyObject *)__pyx_v_data)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_data)); - __Pyx_INCREF(((PyObject *)__pyx_v_shells)); - PyTuple_SET_ITEM(__pyx_t_2, 8, ((PyObject *)__pyx_v_shells)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_shells)); - __Pyx_INCREF(((PyObject *)__pyx_v_image)); - PyTuple_SET_ITEM(__pyx_t_2, 9, ((PyObject *)__pyx_v_image)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_image)); - __pyx_t_1 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_u); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_shells); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_image); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_right_edge); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dx); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_v); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edge); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ug); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.amr_utils.PlaneVoxelIntegration"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_u); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_shells); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_image); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_right_edge); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dx); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_v); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edge); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ug); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_u); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":252 - * @cython.wraparound(False) - * @cython.boundscheck(False) - * def integrate_ray(np.ndarray[np.float64_t, ndim=1] u, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t, ndim=1] v, - * np.ndarray[np.float64_t, ndim=1] left_edge, - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_integrate_ray(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_integrate_ray(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_u = 0; - PyArrayObject *__pyx_v_v = 0; - PyArrayObject *__pyx_v_left_edge = 0; - PyArrayObject *__pyx_v_right_edge = 0; - PyArrayObject *__pyx_v_dx = 0; - int __pyx_v_nshells; - int __pyx_v_ind; - PyArrayObject *__pyx_v_data = 0; - PyArrayObject *__pyx_v_shells = 0; - PyArrayObject *__pyx_v_image = 0; - int __pyx_v_step[3]; - int __pyx_v_x; - int __pyx_v_y; - int __pyx_v_i; - int __pyx_v_n; - __pyx_t_5numpy_float64_t __pyx_v_intersect_t; - __pyx_t_5numpy_float64_t __pyx_v_dt_tolerance; - __pyx_t_5numpy_float64_t __pyx_v_tl; - __pyx_t_5numpy_float64_t __pyx_v_tr; - __pyx_t_5numpy_float64_t __pyx_v_enter_t; - __pyx_t_5numpy_int64_t __pyx_v_cur_ind[3]; - __pyx_t_5numpy_float64_t __pyx_v_tdelta[3]; - __pyx_t_5numpy_float64_t __pyx_v_tmax[3]; - __pyx_t_5numpy_float64_t __pyx_v_intersect[3]; - __pyx_t_5numpy_float64_t __pyx_v_dt; - __pyx_t_5numpy_float64_t __pyx_v_dv; - __pyx_t_5numpy_float64_t __pyx_v_dist; - __pyx_t_5numpy_float64_t __pyx_v_alpha; - __pyx_t_5numpy_float64_t __pyx_v_one; - int __pyx_v_dims[3]; - __pyx_t_5numpy_float64_t __pyx_v_temp_x; - __pyx_t_5numpy_float64_t __pyx_v_temp_y; - int __pyx_v_ncells; - Py_buffer __pyx_bstruct_image; - Py_ssize_t __pyx_bstride_0_image = 0; - Py_ssize_t __pyx_bstride_1_image = 0; - Py_ssize_t __pyx_bshape_0_image = 0; - Py_ssize_t __pyx_bshape_1_image = 0; - Py_buffer __pyx_bstruct_shells; - Py_ssize_t __pyx_bstride_0_shells = 0; - Py_ssize_t __pyx_bstride_1_shells = 0; - Py_ssize_t __pyx_bshape_0_shells = 0; - Py_ssize_t __pyx_bshape_1_shells = 0; - Py_buffer __pyx_bstruct_right_edge; - Py_ssize_t __pyx_bstride_0_right_edge = 0; - Py_ssize_t __pyx_bshape_0_right_edge = 0; - Py_buffer __pyx_bstruct_left_edge; - Py_ssize_t __pyx_bstride_0_left_edge = 0; - Py_ssize_t __pyx_bshape_0_left_edge = 0; - 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_data; - Py_ssize_t __pyx_bstride_0_data = 0; - Py_ssize_t __pyx_bstride_1_data = 0; - Py_ssize_t __pyx_bstride_2_data = 0; - Py_ssize_t __pyx_bshape_0_data = 0; - Py_ssize_t __pyx_bshape_1_data = 0; - Py_ssize_t __pyx_bshape_2_data = 0; - Py_buffer __pyx_bstruct_u; - Py_ssize_t __pyx_bstride_0_u = 0; - Py_ssize_t __pyx_bshape_0_u = 0; - Py_buffer __pyx_bstruct_v; - Py_ssize_t __pyx_bstride_0_v = 0; - Py_ssize_t __pyx_bshape_0_v = 0; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - __pyx_t_5numpy_float64_t __pyx_t_6; - int __pyx_t_7; - __pyx_t_5numpy_float64_t __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; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - int __pyx_t_18; - int __pyx_t_19; - int __pyx_t_20; - int __pyx_t_21; - int __pyx_t_22; - int __pyx_t_23; - int __pyx_t_24; - int __pyx_t_25; - int __pyx_t_26; - int __pyx_t_27; - int __pyx_t_28; - int __pyx_t_29; - int __pyx_t_30; - int __pyx_t_31; - int __pyx_t_32; - int __pyx_t_33; - long __pyx_t_34; - long __pyx_t_35; - long __pyx_t_36; - long __pyx_t_37; - long __pyx_t_38; - long __pyx_t_39; - long __pyx_t_40; - long __pyx_t_41; - long __pyx_t_42; - int __pyx_t_43; - int __pyx_t_44; - PyObject *__pyx_t_45 = NULL; - PyObject *__pyx_t_46 = NULL; - int __pyx_t_47; - int __pyx_t_48; - int __pyx_t_49; - PyObject *__pyx_t_50 = NULL; - __pyx_t_5numpy_int64_t __pyx_t_51; - int __pyx_t_52; - int __pyx_t_53; - int __pyx_t_54; - int __pyx_t_55; - int __pyx_t_56; - int __pyx_t_57; - int __pyx_t_58; - int __pyx_t_59; - int __pyx_t_60; - int __pyx_t_61; - int __pyx_t_62; - int __pyx_t_63; - int __pyx_t_64; - int __pyx_t_65; - __pyx_t_5numpy_int64_t __pyx_t_66; - __pyx_t_5numpy_int64_t __pyx_t_67; - long __pyx_t_68; - __pyx_t_5numpy_int64_t __pyx_t_69; - int __pyx_t_70; - int __pyx_t_71; - int __pyx_t_72; - long __pyx_t_73; - int __pyx_t_74; - long __pyx_t_75; - int __pyx_t_76; - long __pyx_t_77; - int __pyx_t_78; - long __pyx_t_79; - int __pyx_t_80; - long __pyx_t_81; - int __pyx_t_82; - long __pyx_t_83; - int __pyx_t_84; - long __pyx_t_85; - int __pyx_t_86; - long __pyx_t_87; - int __pyx_t_88; - long __pyx_t_89; - int __pyx_t_90; - long __pyx_t_91; - int __pyx_t_92; - long __pyx_t_93; - int __pyx_t_94; - long __pyx_t_95; - __pyx_t_5numpy_int64_t __pyx_t_96; - __pyx_t_5numpy_int64_t __pyx_t_97; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__u,&__pyx_n_s__v,&__pyx_n_s__left_edge,&__pyx_n_s__right_edge,&__pyx_n_s__dx,&__pyx_n_s__nshells,&__pyx_n_s__ind,&__pyx_n_s__data,&__pyx_n_s__shells,&__pyx_n_s__image,0}; - __Pyx_RefNannySetupContext("integrate_ray"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__u); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__v); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("integrate_ray", 1, 10, 10, 1); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left_edge); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("integrate_ray", 1, 10, 10, 2); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right_edge); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("integrate_ray", 1, 10, 10, 3); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dx); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("integrate_ray", 1, 10, 10, 4); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nshells); - if (likely(values[5])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("integrate_ray", 1, 10, 10, 5); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 6: - values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ind); - if (likely(values[6])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("integrate_ray", 1, 10, 10, 6); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 7: - values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data); - if (likely(values[7])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("integrate_ray", 1, 10, 10, 7); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 8: - values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__shells); - if (likely(values[8])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("integrate_ray", 1, 10, 10, 8); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 9: - values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__image); - if (likely(values[9])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("integrate_ray", 1, 10, 10, 9); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "integrate_ray") < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_u = ((PyArrayObject *)values[0]); - __pyx_v_v = ((PyArrayObject *)values[1]); - __pyx_v_left_edge = ((PyArrayObject *)values[2]); - __pyx_v_right_edge = ((PyArrayObject *)values[3]); - __pyx_v_dx = ((PyArrayObject *)values[4]); - __pyx_v_nshells = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_nshells == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_ind = __Pyx_PyInt_AsInt(values[6]); if (unlikely((__pyx_v_ind == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_data = ((PyArrayObject *)values[7]); - __pyx_v_shells = ((PyArrayObject *)values[8]); - __pyx_v_image = ((PyArrayObject *)values[9]); - } else if (PyTuple_GET_SIZE(__pyx_args) != 10) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_u = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_v = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_left_edge = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_right_edge = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); - __pyx_v_dx = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); - __pyx_v_nshells = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_nshells == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_ind = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 6)); if (unlikely((__pyx_v_ind == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_data = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 7)); - __pyx_v_shells = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 8)); - __pyx_v_image = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 9)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("integrate_ray", 1, 10, 10, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.integrate_ray"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_u.buf = NULL; - __pyx_bstruct_v.buf = NULL; - __pyx_bstruct_left_edge.buf = NULL; - __pyx_bstruct_right_edge.buf = NULL; - __pyx_bstruct_dx.buf = NULL; - __pyx_bstruct_data.buf = NULL; - __pyx_bstruct_shells.buf = NULL; - __pyx_bstruct_image.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_u), __pyx_ptype_5numpy_ndarray, 1, "u", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left_edge), __pyx_ptype_5numpy_ndarray, 1, "left_edge", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right_edge), __pyx_ptype_5numpy_ndarray, 1, "right_edge", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 255; __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[4]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), __pyx_ptype_5numpy_ndarray, 1, "data", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shells), __pyx_ptype_5numpy_ndarray, 1, "shells", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_image), __pyx_ptype_5numpy_ndarray, 1, "image", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_u, (PyObject*)__pyx_v_u, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_u = __pyx_bstruct_u.strides[0]; - __pyx_bshape_0_u = __pyx_bstruct_u.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_v, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_v = __pyx_bstruct_v.strides[0]; - __pyx_bshape_0_v = __pyx_bstruct_v.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_left_edge, (PyObject*)__pyx_v_left_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_left_edge = __pyx_bstruct_left_edge.strides[0]; - __pyx_bshape_0_left_edge = __pyx_bstruct_left_edge.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_right_edge, (PyObject*)__pyx_v_right_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_right_edge = __pyx_bstruct_right_edge.strides[0]; - __pyx_bshape_0_right_edge = __pyx_bstruct_right_edge.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dx, (PyObject*)__pyx_v_dx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __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]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_data, (PyObject*)__pyx_v_data, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_data = __pyx_bstruct_data.strides[0]; __pyx_bstride_1_data = __pyx_bstruct_data.strides[1]; __pyx_bstride_2_data = __pyx_bstruct_data.strides[2]; - __pyx_bshape_0_data = __pyx_bstruct_data.shape[0]; __pyx_bshape_1_data = __pyx_bstruct_data.shape[1]; __pyx_bshape_2_data = __pyx_bstruct_data.shape[2]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_shells, (PyObject*)__pyx_v_shells, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_shells = __pyx_bstruct_shells.strides[0]; __pyx_bstride_1_shells = __pyx_bstruct_shells.strides[1]; - __pyx_bshape_0_shells = __pyx_bstruct_shells.shape[0]; __pyx_bshape_1_shells = __pyx_bstruct_shells.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_image, (PyObject*)__pyx_v_image, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_image = __pyx_bstruct_image.strides[0]; __pyx_bstride_1_image = __pyx_bstruct_image.strides[1]; - __pyx_bshape_0_image = __pyx_bstruct_image.shape[0]; __pyx_bshape_1_image = __pyx_bstruct_image.shape[1]; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":262 - * np.ndarray[np.float64_t, ndim=2] image): - * cdef int step[3], x, y, i, n - * cdef np.float64_t intersect_t = 1 # <<<<<<<<<<<<<< - * cdef np.float64_t dt_tolerance = 1e-6 - * cdef np.float64_t tl, tr, enter_t, exit_t - */ - __pyx_v_intersect_t = 1.0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":263 - * cdef int step[3], x, y, i, n - * cdef np.float64_t intersect_t = 1 - * cdef np.float64_t dt_tolerance = 1e-6 # <<<<<<<<<<<<<< - * cdef np.float64_t tl, tr, enter_t, exit_t - * cdef np.int64_t cur_ind[3] - */ - __pyx_v_dt_tolerance = 1e-6; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":271 - * cdef np.float64_t dt, dv - * cdef np.float64_t dist, alpha - * cdef np.float64_t one = 1.0 # <<<<<<<<<<<<<< - * cdef int dims[3] - * cdef np.float64_t rgba[4], temp_x, temp_y - */ - __pyx_v_one = 1.0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":274 - * cdef int dims[3] - * cdef np.float64_t rgba[4], temp_x, temp_y - * for i in range(3): # <<<<<<<<<<<<<< - * # As long as we're iterating, set some other stuff, too - * dims[i] = data.shape[i] - */ - for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":276 - * for i in range(3): - * # As long as we're iterating, set some other stuff, too - * dims[i] = data.shape[i] # <<<<<<<<<<<<<< - * if(v[i] < 0): step[i] = -1 - * else: step[i] = 1 - */ - (__pyx_v_dims[__pyx_v_i]) = (__pyx_v_data->dimensions[__pyx_v_i]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":277 - * # As long as we're iterating, set some other stuff, too - * dims[i] = data.shape[i] - * if(v[i] < 0): step[i] = -1 # <<<<<<<<<<<<<< - * else: step[i] = 1 - * x = (i+1)%3 - */ - __pyx_t_2 = __pyx_v_i; - __pyx_t_3 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_2, __pyx_bstride_0_v)) < 0.0); - if (__pyx_t_3) { - (__pyx_v_step[__pyx_v_i]) = -1; - goto __pyx_L8; - } - /*else*/ { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":278 - * dims[i] = data.shape[i] - * if(v[i] < 0): step[i] = -1 - * else: step[i] = 1 # <<<<<<<<<<<<<< - * x = (i+1)%3 - * y = (i+2)%3 - */ - (__pyx_v_step[__pyx_v_i]) = 1; - } - __pyx_L8:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":279 - * if(v[i] < 0): step[i] = -1 - * else: step[i] = 1 - * x = (i+1)%3 # <<<<<<<<<<<<<< - * y = (i+2)%3 - * tl = (left_edge[i] - u[i])/v[i] - */ - __pyx_v_x = __Pyx_mod_long((__pyx_v_i + 1), 3); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":280 - * else: step[i] = 1 - * x = (i+1)%3 - * y = (i+2)%3 # <<<<<<<<<<<<<< - * tl = (left_edge[i] - u[i])/v[i] - * tr = (right_edge[i] - u[i])/v[i] - */ - __pyx_v_y = __Pyx_mod_long((__pyx_v_i + 2), 3); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":281 - * x = (i+1)%3 - * y = (i+2)%3 - * tl = (left_edge[i] - u[i])/v[i] # <<<<<<<<<<<<<< - * tr = (right_edge[i] - u[i])/v[i] - * temp_x = (u[x] + tl*v[x]) - */ - __pyx_t_4 = __pyx_v_i; - __pyx_t_5 = __pyx_v_i; - __pyx_t_6 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_4, __pyx_bstride_0_left_edge)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_5, __pyx_bstride_0_u))); - __pyx_t_7 = __pyx_v_i; - __pyx_t_8 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_7, __pyx_bstride_0_v)); - if (unlikely(__pyx_t_8 == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_tl = (__pyx_t_6 / __pyx_t_8); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":282 - * y = (i+2)%3 - * tl = (left_edge[i] - u[i])/v[i] - * tr = (right_edge[i] - u[i])/v[i] # <<<<<<<<<<<<<< - * temp_x = (u[x] + tl*v[x]) - * temp_y = (u[y] + tl*v[y]) - */ - __pyx_t_9 = __pyx_v_i; - __pyx_t_10 = __pyx_v_i; - __pyx_t_8 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_9, __pyx_bstride_0_right_edge)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_10, __pyx_bstride_0_u))); - __pyx_t_11 = __pyx_v_i; - __pyx_t_6 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_11, __pyx_bstride_0_v)); - if (unlikely(__pyx_t_6 == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_tr = (__pyx_t_8 / __pyx_t_6); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":283 - * tl = (left_edge[i] - u[i])/v[i] - * tr = (right_edge[i] - u[i])/v[i] - * temp_x = (u[x] + tl*v[x]) # <<<<<<<<<<<<<< - * temp_y = (u[y] + tl*v[y]) - * if (left_edge[x] <= temp_x) and (temp_x <= right_edge[x]) and \ - */ - __pyx_t_12 = __pyx_v_x; - __pyx_t_13 = __pyx_v_x; - __pyx_v_temp_x = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_12, __pyx_bstride_0_u)) + (__pyx_v_tl * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_13, __pyx_bstride_0_v)))); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":284 - * tr = (right_edge[i] - u[i])/v[i] - * temp_x = (u[x] + tl*v[x]) - * temp_y = (u[y] + tl*v[y]) # <<<<<<<<<<<<<< - * if (left_edge[x] <= temp_x) and (temp_x <= right_edge[x]) and \ - * (left_edge[y] <= temp_y) and (temp_y <= right_edge[y]) and \ - */ - __pyx_t_14 = __pyx_v_y; - __pyx_t_15 = __pyx_v_y; - __pyx_v_temp_y = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_14, __pyx_bstride_0_u)) + (__pyx_v_tl * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_15, __pyx_bstride_0_v)))); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":285 - * temp_x = (u[x] + tl*v[x]) - * temp_y = (u[y] + tl*v[y]) - * if (left_edge[x] <= temp_x) and (temp_x <= right_edge[x]) and \ # <<<<<<<<<<<<<< - * (left_edge[y] <= temp_y) and (temp_y <= right_edge[y]) and \ - * (0.0 <= tl) and (tl < intersect_t): - */ - __pyx_t_16 = __pyx_v_x; - __pyx_t_3 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_16, __pyx_bstride_0_left_edge)) <= __pyx_v_temp_x); - if (__pyx_t_3) { - __pyx_t_17 = __pyx_v_x; - __pyx_t_18 = (__pyx_v_temp_x <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_17, __pyx_bstride_0_right_edge))); - if (__pyx_t_18) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":286 - * temp_y = (u[y] + tl*v[y]) - * if (left_edge[x] <= temp_x) and (temp_x <= right_edge[x]) and \ - * (left_edge[y] <= temp_y) and (temp_y <= right_edge[y]) and \ # <<<<<<<<<<<<<< - * (0.0 <= tl) and (tl < intersect_t): - * intersect_t = tl - */ - __pyx_t_19 = __pyx_v_y; - __pyx_t_20 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_19, __pyx_bstride_0_left_edge)) <= __pyx_v_temp_y); - if (__pyx_t_20) { - __pyx_t_21 = __pyx_v_y; - __pyx_t_22 = (__pyx_v_temp_y <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_21, __pyx_bstride_0_right_edge))); - if (__pyx_t_22) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":287 - * if (left_edge[x] <= temp_x) and (temp_x <= right_edge[x]) and \ - * (left_edge[y] <= temp_y) and (temp_y <= right_edge[y]) and \ - * (0.0 <= tl) and (tl < intersect_t): # <<<<<<<<<<<<<< - * intersect_t = tl - * temp_x = (u[x] + tr*v[x]) - */ - __pyx_t_23 = (0.0 <= __pyx_v_tl); - if (__pyx_t_23) { - __pyx_t_24 = (__pyx_v_tl < __pyx_v_intersect_t); - __pyx_t_25 = __pyx_t_24; - } else { - __pyx_t_25 = __pyx_t_23; - } - __pyx_t_23 = __pyx_t_25; - } else { - __pyx_t_23 = __pyx_t_22; - } - __pyx_t_22 = __pyx_t_23; - } else { - __pyx_t_22 = __pyx_t_20; - } - __pyx_t_20 = __pyx_t_22; - } else { - __pyx_t_20 = __pyx_t_18; - } - __pyx_t_18 = __pyx_t_20; - } else { - __pyx_t_18 = __pyx_t_3; - } - if (__pyx_t_18) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":288 - * (left_edge[y] <= temp_y) and (temp_y <= right_edge[y]) and \ - * (0.0 <= tl) and (tl < intersect_t): - * intersect_t = tl # <<<<<<<<<<<<<< - * temp_x = (u[x] + tr*v[x]) - * temp_y = (u[y] + tr*v[y]) - */ - __pyx_v_intersect_t = __pyx_v_tl; - goto __pyx_L9; - } - __pyx_L9:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":289 - * (0.0 <= tl) and (tl < intersect_t): - * intersect_t = tl - * temp_x = (u[x] + tr*v[x]) # <<<<<<<<<<<<<< - * temp_y = (u[y] + tr*v[y]) - * if (left_edge[x] <= temp_x) and (temp_x <= right_edge[x]) and \ - */ - __pyx_t_26 = __pyx_v_x; - __pyx_t_27 = __pyx_v_x; - __pyx_v_temp_x = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_26, __pyx_bstride_0_u)) + (__pyx_v_tr * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_27, __pyx_bstride_0_v)))); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":290 - * intersect_t = tl - * temp_x = (u[x] + tr*v[x]) - * temp_y = (u[y] + tr*v[y]) # <<<<<<<<<<<<<< - * if (left_edge[x] <= temp_x) and (temp_x <= right_edge[x]) and \ - * (left_edge[y] <= temp_y) and (temp_y <= right_edge[y]) and \ - */ - __pyx_t_28 = __pyx_v_y; - __pyx_t_29 = __pyx_v_y; - __pyx_v_temp_y = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_28, __pyx_bstride_0_u)) + (__pyx_v_tr * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_29, __pyx_bstride_0_v)))); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":291 - * temp_x = (u[x] + tr*v[x]) - * temp_y = (u[y] + tr*v[y]) - * if (left_edge[x] <= temp_x) and (temp_x <= right_edge[x]) and \ # <<<<<<<<<<<<<< - * (left_edge[y] <= temp_y) and (temp_y <= right_edge[y]) and \ - * (0.0 <= tr) and (tr < intersect_t): - */ - __pyx_t_30 = __pyx_v_x; - __pyx_t_18 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_30, __pyx_bstride_0_left_edge)) <= __pyx_v_temp_x); - if (__pyx_t_18) { - __pyx_t_31 = __pyx_v_x; - __pyx_t_3 = (__pyx_v_temp_x <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_31, __pyx_bstride_0_right_edge))); - if (__pyx_t_3) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":292 - * temp_y = (u[y] + tr*v[y]) - * if (left_edge[x] <= temp_x) and (temp_x <= right_edge[x]) and \ - * (left_edge[y] <= temp_y) and (temp_y <= right_edge[y]) and \ # <<<<<<<<<<<<<< - * (0.0 <= tr) and (tr < intersect_t): - * intersect_t = tr - */ - __pyx_t_32 = __pyx_v_y; - __pyx_t_20 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_32, __pyx_bstride_0_left_edge)) <= __pyx_v_temp_y); - if (__pyx_t_20) { - __pyx_t_33 = __pyx_v_y; - __pyx_t_22 = (__pyx_v_temp_y <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_33, __pyx_bstride_0_right_edge))); - if (__pyx_t_22) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":293 - * if (left_edge[x] <= temp_x) and (temp_x <= right_edge[x]) and \ - * (left_edge[y] <= temp_y) and (temp_y <= right_edge[y]) and \ - * (0.0 <= tr) and (tr < intersect_t): # <<<<<<<<<<<<<< - * intersect_t = tr - * # if fully enclosed - */ - __pyx_t_23 = (0.0 <= __pyx_v_tr); - if (__pyx_t_23) { - __pyx_t_25 = (__pyx_v_tr < __pyx_v_intersect_t); - __pyx_t_24 = __pyx_t_25; - } else { - __pyx_t_24 = __pyx_t_23; - } - __pyx_t_23 = __pyx_t_24; - } else { - __pyx_t_23 = __pyx_t_22; - } - __pyx_t_22 = __pyx_t_23; - } else { - __pyx_t_22 = __pyx_t_20; - } - __pyx_t_20 = __pyx_t_22; - } else { - __pyx_t_20 = __pyx_t_3; - } - __pyx_t_3 = __pyx_t_20; - } else { - __pyx_t_3 = __pyx_t_18; - } - if (__pyx_t_3) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":294 - * (left_edge[y] <= temp_y) and (temp_y <= right_edge[y]) and \ - * (0.0 <= tr) and (tr < intersect_t): - * intersect_t = tr # <<<<<<<<<<<<<< - * # if fully enclosed - * if (left_edge[0] <= u[0] <= right_edge[0]) and \ - */ - __pyx_v_intersect_t = __pyx_v_tr; - goto __pyx_L10; - } - __pyx_L10:; - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":296 - * intersect_t = tr - * # if fully enclosed - * if (left_edge[0] <= u[0] <= right_edge[0]) and \ # <<<<<<<<<<<<<< - * (left_edge[1] <= u[1] <= right_edge[1]) and \ - * (left_edge[2] <= u[2] <= right_edge[2]): - */ - __pyx_t_34 = 0; - __pyx_t_35 = 0; - __pyx_t_6 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_35, __pyx_bstride_0_u)); - __pyx_t_3 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_34, __pyx_bstride_0_left_edge)) <= __pyx_t_6); - if (__pyx_t_3) { - __pyx_t_36 = 0; - __pyx_t_3 = (__pyx_t_6 <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_36, __pyx_bstride_0_right_edge))); - } - if (__pyx_t_3) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":297 - * # if fully enclosed - * if (left_edge[0] <= u[0] <= right_edge[0]) and \ - * (left_edge[1] <= u[1] <= right_edge[1]) and \ # <<<<<<<<<<<<<< - * (left_edge[2] <= u[2] <= right_edge[2]): - * intersect_t = 0.0 - */ - __pyx_t_37 = 1; - __pyx_t_38 = 1; - __pyx_t_6 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_38, __pyx_bstride_0_u)); - __pyx_t_18 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_37, __pyx_bstride_0_left_edge)) <= __pyx_t_6); - if (__pyx_t_18) { - __pyx_t_39 = 1; - __pyx_t_18 = (__pyx_t_6 <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_39, __pyx_bstride_0_right_edge))); - } - if (__pyx_t_18) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":298 - * if (left_edge[0] <= u[0] <= right_edge[0]) and \ - * (left_edge[1] <= u[1] <= right_edge[1]) and \ - * (left_edge[2] <= u[2] <= right_edge[2]): # <<<<<<<<<<<<<< - * intersect_t = 0.0 - * if not (0 <= intersect_t <= 1): - */ - __pyx_t_40 = 2; - __pyx_t_41 = 2; - __pyx_t_6 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_41, __pyx_bstride_0_u)); - __pyx_t_20 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_40, __pyx_bstride_0_left_edge)) <= __pyx_t_6); - if (__pyx_t_20) { - __pyx_t_42 = 2; - __pyx_t_20 = (__pyx_t_6 <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_42, __pyx_bstride_0_right_edge))); - } - __pyx_t_22 = __pyx_t_20; - } else { - __pyx_t_22 = __pyx_t_18; - } - __pyx_t_18 = __pyx_t_22; - } else { - __pyx_t_18 = __pyx_t_3; - } - if (__pyx_t_18) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":299 - * (left_edge[1] <= u[1] <= right_edge[1]) and \ - * (left_edge[2] <= u[2] <= right_edge[2]): - * intersect_t = 0.0 # <<<<<<<<<<<<<< - * if not (0 <= intersect_t <= 1): - * #print "Returning: intersect_t ==", intersect_t - */ - __pyx_v_intersect_t = 0.0; - goto __pyx_L11; - } - __pyx_L11:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":300 - * (left_edge[2] <= u[2] <= right_edge[2]): - * intersect_t = 0.0 - * if not (0 <= intersect_t <= 1): # <<<<<<<<<<<<<< - * #print "Returning: intersect_t ==", intersect_t - * return - */ - __pyx_t_18 = (0.0 <= __pyx_v_intersect_t); - if (__pyx_t_18) { - __pyx_t_18 = (__pyx_v_intersect_t <= 1.0); - } - __pyx_t_3 = (!__pyx_t_18); - if (__pyx_t_3) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":302 - * if not (0 <= intersect_t <= 1): - * #print "Returning: intersect_t ==", intersect_t - * return # <<<<<<<<<<<<<< - * # Now get the indices of the intersection - * for i in range(3): intersect[i] = u[i] + intersect_t * v[i] - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - goto __pyx_L12; - } - __pyx_L12:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":304 - * return - * # Now get the indices of the intersection - * for i in range(3): intersect[i] = u[i] + intersect_t * v[i] # <<<<<<<<<<<<<< - * cdef int ncells = 0 - * for i in range(3): - */ - for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; - __pyx_t_43 = __pyx_v_i; - __pyx_t_44 = __pyx_v_i; - (__pyx_v_intersect[__pyx_v_i]) = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_43, __pyx_bstride_0_u)) + (__pyx_v_intersect_t * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_44, __pyx_bstride_0_v)))); - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":305 - * # Now get the indices of the intersection - * for i in range(3): intersect[i] = u[i] + intersect_t * v[i] - * cdef int ncells = 0 # <<<<<<<<<<<<<< - * for i in range(3): - * cur_ind[i] = np.floor((intersect[i] + 1e-8*dx[i] - left_edge[i])/dx[i]) - */ - __pyx_v_ncells = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":306 - * for i in range(3): intersect[i] = u[i] + intersect_t * v[i] - * cdef int ncells = 0 - * for i in range(3): # <<<<<<<<<<<<<< - * cur_ind[i] = np.floor((intersect[i] + 1e-8*dx[i] - left_edge[i])/dx[i]) - * tmax[i] = (((cur_ind[i]+step[i])*dx[i])+left_edge[i]-u[i])/v[i] - */ - for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":307 - * cdef int ncells = 0 - * for i in range(3): - * cur_ind[i] = np.floor((intersect[i] + 1e-8*dx[i] - left_edge[i])/dx[i]) # <<<<<<<<<<<<<< - * tmax[i] = (((cur_ind[i]+step[i])*dx[i])+left_edge[i]-u[i])/v[i] - * if cur_ind[i] == dims[i] and step[i] < 0: - */ - __pyx_t_45 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_45)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_45); - __pyx_t_46 = PyObject_GetAttr(__pyx_t_45, __pyx_n_s__floor); if (unlikely(!__pyx_t_46)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_46); - __Pyx_DECREF(__pyx_t_45); __pyx_t_45 = 0; - __pyx_t_47 = __pyx_v_i; - __pyx_t_48 = __pyx_v_i; - __pyx_t_6 = (((__pyx_v_intersect[__pyx_v_i]) + (1e-8 * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dx.buf, __pyx_t_47, __pyx_bstride_0_dx)))) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_48, __pyx_bstride_0_left_edge))); - __pyx_t_49 = __pyx_v_i; - __pyx_t_8 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dx.buf, __pyx_t_49, __pyx_bstride_0_dx)); - if (unlikely(__pyx_t_8 == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_45 = PyFloat_FromDouble((__pyx_t_6 / __pyx_t_8)); if (unlikely(!__pyx_t_45)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_45); - __pyx_t_50 = PyTuple_New(1); if (unlikely(!__pyx_t_50)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_50); - PyTuple_SET_ITEM(__pyx_t_50, 0, __pyx_t_45); - __Pyx_GIVEREF(__pyx_t_45); - __pyx_t_45 = 0; - __pyx_t_45 = PyObject_Call(__pyx_t_46, __pyx_t_50, NULL); if (unlikely(!__pyx_t_45)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_45); - __Pyx_DECREF(__pyx_t_46); __pyx_t_46 = 0; - __Pyx_DECREF(__pyx_t_50); __pyx_t_50 = 0; - __pyx_t_51 = __Pyx_PyInt_from_py_npy_int64(__pyx_t_45); if (unlikely((__pyx_t_51 == (npy_int64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_45); __pyx_t_45 = 0; - (__pyx_v_cur_ind[__pyx_v_i]) = __pyx_t_51; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":308 - * for i in range(3): - * cur_ind[i] = np.floor((intersect[i] + 1e-8*dx[i] - left_edge[i])/dx[i]) - * tmax[i] = (((cur_ind[i]+step[i])*dx[i])+left_edge[i]-u[i])/v[i] # <<<<<<<<<<<<<< - * if cur_ind[i] == dims[i] and step[i] < 0: - * cur_ind[i] = dims[i] - 1 - */ - __pyx_t_52 = __pyx_v_i; - __pyx_t_53 = __pyx_v_i; - __pyx_t_54 = __pyx_v_i; - __pyx_t_8 = (((((__pyx_v_cur_ind[__pyx_v_i]) + (__pyx_v_step[__pyx_v_i])) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dx.buf, __pyx_t_52, __pyx_bstride_0_dx))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_53, __pyx_bstride_0_left_edge))) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_54, __pyx_bstride_0_u))); - __pyx_t_55 = __pyx_v_i; - __pyx_t_6 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_55, __pyx_bstride_0_v)); - if (unlikely(__pyx_t_6 == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - (__pyx_v_tmax[__pyx_v_i]) = (__pyx_t_8 / __pyx_t_6); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":309 - * cur_ind[i] = np.floor((intersect[i] + 1e-8*dx[i] - left_edge[i])/dx[i]) - * tmax[i] = (((cur_ind[i]+step[i])*dx[i])+left_edge[i]-u[i])/v[i] - * if cur_ind[i] == dims[i] and step[i] < 0: # <<<<<<<<<<<<<< - * cur_ind[i] = dims[i] - 1 - * if step[i] > 0: tmax[i] = (((cur_ind[i]+1)*dx[i])+left_edge[i]-u[i])/v[i] - */ - __pyx_t_3 = ((__pyx_v_cur_ind[__pyx_v_i]) == (__pyx_v_dims[__pyx_v_i])); - if (__pyx_t_3) { - __pyx_t_18 = ((__pyx_v_step[__pyx_v_i]) < 0); - __pyx_t_22 = __pyx_t_18; - } else { - __pyx_t_22 = __pyx_t_3; - } - if (__pyx_t_22) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":310 - * tmax[i] = (((cur_ind[i]+step[i])*dx[i])+left_edge[i]-u[i])/v[i] - * if cur_ind[i] == dims[i] and step[i] < 0: - * cur_ind[i] = dims[i] - 1 # <<<<<<<<<<<<<< - * if step[i] > 0: tmax[i] = (((cur_ind[i]+1)*dx[i])+left_edge[i]-u[i])/v[i] - * if step[i] < 0: tmax[i] = (((cur_ind[i]+0)*dx[i])+left_edge[i]-u[i])/v[i] - */ - (__pyx_v_cur_ind[__pyx_v_i]) = ((__pyx_v_dims[__pyx_v_i]) - 1); - goto __pyx_L17; - } - __pyx_L17:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":311 - * if cur_ind[i] == dims[i] and step[i] < 0: - * cur_ind[i] = dims[i] - 1 - * if step[i] > 0: tmax[i] = (((cur_ind[i]+1)*dx[i])+left_edge[i]-u[i])/v[i] # <<<<<<<<<<<<<< - * if step[i] < 0: tmax[i] = (((cur_ind[i]+0)*dx[i])+left_edge[i]-u[i])/v[i] - * tdelta[i] = (dx[i]/v[i]) - */ - __pyx_t_22 = ((__pyx_v_step[__pyx_v_i]) > 0); - if (__pyx_t_22) { - __pyx_t_56 = __pyx_v_i; - __pyx_t_57 = __pyx_v_i; - __pyx_t_58 = __pyx_v_i; - __pyx_t_6 = (((((__pyx_v_cur_ind[__pyx_v_i]) + 1) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dx.buf, __pyx_t_56, __pyx_bstride_0_dx))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_57, __pyx_bstride_0_left_edge))) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_58, __pyx_bstride_0_u))); - __pyx_t_59 = __pyx_v_i; - __pyx_t_8 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_59, __pyx_bstride_0_v)); - if (unlikely(__pyx_t_8 == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - (__pyx_v_tmax[__pyx_v_i]) = (__pyx_t_6 / __pyx_t_8); - goto __pyx_L18; - } - __pyx_L18:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":312 - * cur_ind[i] = dims[i] - 1 - * if step[i] > 0: tmax[i] = (((cur_ind[i]+1)*dx[i])+left_edge[i]-u[i])/v[i] - * if step[i] < 0: tmax[i] = (((cur_ind[i]+0)*dx[i])+left_edge[i]-u[i])/v[i] # <<<<<<<<<<<<<< - * tdelta[i] = (dx[i]/v[i]) - * if tdelta[i] < 0: tdelta[i] *= -1 - */ - __pyx_t_22 = ((__pyx_v_step[__pyx_v_i]) < 0); - if (__pyx_t_22) { - __pyx_t_60 = __pyx_v_i; - __pyx_t_61 = __pyx_v_i; - __pyx_t_62 = __pyx_v_i; - __pyx_t_8 = (((((__pyx_v_cur_ind[__pyx_v_i]) + 0) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dx.buf, __pyx_t_60, __pyx_bstride_0_dx))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_61, __pyx_bstride_0_left_edge))) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_62, __pyx_bstride_0_u))); - __pyx_t_63 = __pyx_v_i; - __pyx_t_6 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_63, __pyx_bstride_0_v)); - if (unlikely(__pyx_t_6 == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - (__pyx_v_tmax[__pyx_v_i]) = (__pyx_t_8 / __pyx_t_6); - goto __pyx_L19; - } - __pyx_L19:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":313 - * if step[i] > 0: tmax[i] = (((cur_ind[i]+1)*dx[i])+left_edge[i]-u[i])/v[i] - * if step[i] < 0: tmax[i] = (((cur_ind[i]+0)*dx[i])+left_edge[i]-u[i])/v[i] - * tdelta[i] = (dx[i]/v[i]) # <<<<<<<<<<<<<< - * if tdelta[i] < 0: tdelta[i] *= -1 - * # The variable intersect contains the point we first pierce the grid - */ - __pyx_t_64 = __pyx_v_i; - __pyx_t_6 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dx.buf, __pyx_t_64, __pyx_bstride_0_dx)); - __pyx_t_65 = __pyx_v_i; - __pyx_t_8 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_65, __pyx_bstride_0_v)); - if (unlikely(__pyx_t_8 == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - (__pyx_v_tdelta[__pyx_v_i]) = (__pyx_t_6 / __pyx_t_8); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":314 - * if step[i] < 0: tmax[i] = (((cur_ind[i]+0)*dx[i])+left_edge[i]-u[i])/v[i] - * tdelta[i] = (dx[i]/v[i]) - * if tdelta[i] < 0: tdelta[i] *= -1 # <<<<<<<<<<<<<< - * # The variable intersect contains the point we first pierce the grid - * enter_t = intersect_t - */ - __pyx_t_22 = ((__pyx_v_tdelta[__pyx_v_i]) < 0.0); - if (__pyx_t_22) { - (__pyx_v_tdelta[__pyx_v_i]) *= -1.0; - goto __pyx_L20; - } - __pyx_L20:; - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":316 - * if tdelta[i] < 0: tdelta[i] *= -1 - * # The variable intersect contains the point we first pierce the grid - * enter_t = intersect_t # <<<<<<<<<<<<<< - * if (not (0 <= cur_ind[0] < dims[0])) or \ - * (not (0 <= cur_ind[1] < dims[1])) or \ - */ - __pyx_v_enter_t = __pyx_v_intersect_t; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":317 - * # The variable intersect contains the point we first pierce the grid - * enter_t = intersect_t - * if (not (0 <= cur_ind[0] < dims[0])) or \ # <<<<<<<<<<<<<< - * (not (0 <= cur_ind[1] < dims[1])) or \ - * (not (0 <= cur_ind[2] < dims[2])): - */ - __pyx_t_51 = (__pyx_v_cur_ind[0]); - __pyx_t_22 = (0 <= __pyx_t_51); - if (__pyx_t_22) { - __pyx_t_22 = (__pyx_t_51 < (__pyx_v_dims[0])); - } - __pyx_t_3 = (!__pyx_t_22); - if (!__pyx_t_3) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":318 - * enter_t = intersect_t - * if (not (0 <= cur_ind[0] < dims[0])) or \ - * (not (0 <= cur_ind[1] < dims[1])) or \ # <<<<<<<<<<<<<< - * (not (0 <= cur_ind[2] < dims[2])): - * #print "Returning: cur_ind", cur_ind[0], cur_ind[1], cur_ind[2] - */ - __pyx_t_51 = (__pyx_v_cur_ind[1]); - __pyx_t_22 = (0 <= __pyx_t_51); - if (__pyx_t_22) { - __pyx_t_22 = (__pyx_t_51 < (__pyx_v_dims[1])); - } - __pyx_t_18 = (!__pyx_t_22); - if (!__pyx_t_18) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":319 - * if (not (0 <= cur_ind[0] < dims[0])) or \ - * (not (0 <= cur_ind[1] < dims[1])) or \ - * (not (0 <= cur_ind[2] < dims[2])): # <<<<<<<<<<<<<< - * #print "Returning: cur_ind", cur_ind[0], cur_ind[1], cur_ind[2] - * #print " dims: ", dims[0], dims[1], dims[2] - */ - __pyx_t_51 = (__pyx_v_cur_ind[2]); - __pyx_t_22 = (0 <= __pyx_t_51); - if (__pyx_t_22) { - __pyx_t_22 = (__pyx_t_51 < (__pyx_v_dims[2])); - } - __pyx_t_20 = (!__pyx_t_22); - __pyx_t_22 = __pyx_t_20; - } else { - __pyx_t_22 = __pyx_t_18; - } - __pyx_t_18 = __pyx_t_22; - } else { - __pyx_t_18 = __pyx_t_3; - } - if (__pyx_t_18) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":326 - * #print " u :", u[0], u[1], u[2] - * # - * return # <<<<<<<<<<<<<< - * #print cur_ind[0], dims[0], cur_ind[1], dims[1], cur_ind[2], dims[2] - * dv = data[cur_ind[0], cur_ind[1], cur_ind[2]] - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - goto __pyx_L21; - } - __pyx_L21:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":328 - * return - * #print cur_ind[0], dims[0], cur_ind[1], dims[1], cur_ind[2], dims[2] - * dv = data[cur_ind[0], cur_ind[1], cur_ind[2]] # <<<<<<<<<<<<<< - * #dt = 1e300 - * while 1: - */ - __pyx_t_51 = (__pyx_v_cur_ind[0]); - __pyx_t_66 = (__pyx_v_cur_ind[1]); - __pyx_t_67 = (__pyx_v_cur_ind[2]); - __pyx_v_dv = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_data.buf, __pyx_t_51, __pyx_bstride_0_data, __pyx_t_66, __pyx_bstride_1_data, __pyx_t_67, __pyx_bstride_2_data)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":330 - * dv = data[cur_ind[0], cur_ind[1], cur_ind[2]] - * #dt = 1e300 - * while 1: # <<<<<<<<<<<<<< - * if image[ind,3] >= 1.0: break - * if (not (0 <= cur_ind[0] < dims[0])) or \ - */ - while (1) { - if (!1) break; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":331 - * #dt = 1e300 - * while 1: - * if image[ind,3] >= 1.0: break # <<<<<<<<<<<<<< - * if (not (0 <= cur_ind[0] < dims[0])) or \ - * (not (0 <= cur_ind[1] < dims[1])) or \ - */ - __pyx_t_1 = __pyx_v_ind; - __pyx_t_68 = 3; - __pyx_t_18 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_image.buf, __pyx_t_1, __pyx_bstride_0_image, __pyx_t_68, __pyx_bstride_1_image)) >= 1.0); - if (__pyx_t_18) { - goto __pyx_L23_break; - goto __pyx_L24; - } - __pyx_L24:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":332 - * while 1: - * if image[ind,3] >= 1.0: break - * if (not (0 <= cur_ind[0] < dims[0])) or \ # <<<<<<<<<<<<<< - * (not (0 <= cur_ind[1] < dims[1])) or \ - * (not (0 <= cur_ind[2] < dims[2])): - */ - __pyx_t_69 = (__pyx_v_cur_ind[0]); - __pyx_t_18 = (0 <= __pyx_t_69); - if (__pyx_t_18) { - __pyx_t_18 = (__pyx_t_69 < (__pyx_v_dims[0])); - } - __pyx_t_3 = (!__pyx_t_18); - if (!__pyx_t_3) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":333 - * if image[ind,3] >= 1.0: break - * if (not (0 <= cur_ind[0] < dims[0])) or \ - * (not (0 <= cur_ind[1] < dims[1])) or \ # <<<<<<<<<<<<<< - * (not (0 <= cur_ind[2] < dims[2])): - * break - */ - __pyx_t_69 = (__pyx_v_cur_ind[1]); - __pyx_t_18 = (0 <= __pyx_t_69); - if (__pyx_t_18) { - __pyx_t_18 = (__pyx_t_69 < (__pyx_v_dims[1])); - } - __pyx_t_22 = (!__pyx_t_18); - if (!__pyx_t_22) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":334 - * if (not (0 <= cur_ind[0] < dims[0])) or \ - * (not (0 <= cur_ind[1] < dims[1])) or \ - * (not (0 <= cur_ind[2] < dims[2])): # <<<<<<<<<<<<<< - * break - * # Do our transfer here - */ - __pyx_t_69 = (__pyx_v_cur_ind[2]); - __pyx_t_18 = (0 <= __pyx_t_69); - if (__pyx_t_18) { - __pyx_t_18 = (__pyx_t_69 < (__pyx_v_dims[2])); - } - __pyx_t_20 = (!__pyx_t_18); - __pyx_t_18 = __pyx_t_20; - } else { - __pyx_t_18 = __pyx_t_22; - } - __pyx_t_22 = __pyx_t_18; - } else { - __pyx_t_22 = __pyx_t_3; - } - if (__pyx_t_22) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":335 - * (not (0 <= cur_ind[1] < dims[1])) or \ - * (not (0 <= cur_ind[2] < dims[2])): - * break # <<<<<<<<<<<<<< - * # Do our transfer here - * for n in range(nshells): - */ - goto __pyx_L23_break; - goto __pyx_L25; - } - __pyx_L25:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":337 - * break - * # Do our transfer here - * for n in range(nshells): # <<<<<<<<<<<<<< - * dist = shells[n, 0] - dv - * if dist < shells[n,1]: - */ - __pyx_t_70 = __pyx_v_nshells; - for (__pyx_t_71 = 0; __pyx_t_71 < __pyx_t_70; __pyx_t_71+=1) { - __pyx_v_n = __pyx_t_71; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":338 - * # Do our transfer here - * for n in range(nshells): - * dist = shells[n, 0] - dv # <<<<<<<<<<<<<< - * if dist < shells[n,1]: - * dist = exp(-dist/8.0) - */ - __pyx_t_72 = __pyx_v_n; - __pyx_t_73 = 0; - __pyx_v_dist = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_shells.buf, __pyx_t_72, __pyx_bstride_0_shells, __pyx_t_73, __pyx_bstride_1_shells)) - __pyx_v_dv); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":339 - * for n in range(nshells): - * dist = shells[n, 0] - dv - * if dist < shells[n,1]: # <<<<<<<<<<<<<< - * dist = exp(-dist/8.0) - * alpha = (1.0 - shells[n,5])*shells[n,5]#*dt - */ - __pyx_t_74 = __pyx_v_n; - __pyx_t_75 = 1; - __pyx_t_22 = (__pyx_v_dist < (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_shells.buf, __pyx_t_74, __pyx_bstride_0_shells, __pyx_t_75, __pyx_bstride_1_shells))); - if (__pyx_t_22) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":340 - * dist = shells[n, 0] - dv - * if dist < shells[n,1]: - * dist = exp(-dist/8.0) # <<<<<<<<<<<<<< - * alpha = (1.0 - shells[n,5])*shells[n,5]#*dt - * image[ind,0] += alpha*shells[n,2]*dist - */ - __pyx_v_dist = exp(((-__pyx_v_dist) / 8.0)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":341 - * if dist < shells[n,1]: - * dist = exp(-dist/8.0) - * alpha = (1.0 - shells[n,5])*shells[n,5]#*dt # <<<<<<<<<<<<<< - * image[ind,0] += alpha*shells[n,2]*dist - * image[ind,1] += alpha*shells[n,3]*dist - */ - __pyx_t_76 = __pyx_v_n; - __pyx_t_77 = 5; - __pyx_t_78 = __pyx_v_n; - __pyx_t_79 = 5; - __pyx_v_alpha = ((1.0 - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_shells.buf, __pyx_t_76, __pyx_bstride_0_shells, __pyx_t_77, __pyx_bstride_1_shells))) * (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_shells.buf, __pyx_t_78, __pyx_bstride_0_shells, __pyx_t_79, __pyx_bstride_1_shells))); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":342 - * dist = exp(-dist/8.0) - * alpha = (1.0 - shells[n,5])*shells[n,5]#*dt - * image[ind,0] += alpha*shells[n,2]*dist # <<<<<<<<<<<<<< - * image[ind,1] += alpha*shells[n,3]*dist - * image[ind,2] += alpha*shells[n,4]*dist - */ - __pyx_t_80 = __pyx_v_n; - __pyx_t_81 = 2; - __pyx_t_82 = __pyx_v_ind; - __pyx_t_83 = 0; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_image.buf, __pyx_t_82, __pyx_bstride_0_image, __pyx_t_83, __pyx_bstride_1_image) += ((__pyx_v_alpha * (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_shells.buf, __pyx_t_80, __pyx_bstride_0_shells, __pyx_t_81, __pyx_bstride_1_shells))) * __pyx_v_dist); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":343 - * alpha = (1.0 - shells[n,5])*shells[n,5]#*dt - * image[ind,0] += alpha*shells[n,2]*dist - * image[ind,1] += alpha*shells[n,3]*dist # <<<<<<<<<<<<<< - * image[ind,2] += alpha*shells[n,4]*dist - * image[ind,3] += alpha*shells[n,5]*dist - */ - __pyx_t_84 = __pyx_v_n; - __pyx_t_85 = 3; - __pyx_t_86 = __pyx_v_ind; - __pyx_t_87 = 1; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_image.buf, __pyx_t_86, __pyx_bstride_0_image, __pyx_t_87, __pyx_bstride_1_image) += ((__pyx_v_alpha * (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_shells.buf, __pyx_t_84, __pyx_bstride_0_shells, __pyx_t_85, __pyx_bstride_1_shells))) * __pyx_v_dist); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":344 - * image[ind,0] += alpha*shells[n,2]*dist - * image[ind,1] += alpha*shells[n,3]*dist - * image[ind,2] += alpha*shells[n,4]*dist # <<<<<<<<<<<<<< - * image[ind,3] += alpha*shells[n,5]*dist - * #image[ind,i] += rgba[i]*dist*rgba[3]/dt - */ - __pyx_t_88 = __pyx_v_n; - __pyx_t_89 = 4; - __pyx_t_90 = __pyx_v_ind; - __pyx_t_91 = 2; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_image.buf, __pyx_t_90, __pyx_bstride_0_image, __pyx_t_91, __pyx_bstride_1_image) += ((__pyx_v_alpha * (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_shells.buf, __pyx_t_88, __pyx_bstride_0_shells, __pyx_t_89, __pyx_bstride_1_shells))) * __pyx_v_dist); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":345 - * image[ind,1] += alpha*shells[n,3]*dist - * image[ind,2] += alpha*shells[n,4]*dist - * image[ind,3] += alpha*shells[n,5]*dist # <<<<<<<<<<<<<< - * #image[ind,i] += rgba[i]*dist*rgba[3]/dt - * #print rgba[i], image[ind,i], dist, dt - */ - __pyx_t_92 = __pyx_v_n; - __pyx_t_93 = 5; - __pyx_t_94 = __pyx_v_ind; - __pyx_t_95 = 3; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_image.buf, __pyx_t_94, __pyx_bstride_0_image, __pyx_t_95, __pyx_bstride_1_image) += ((__pyx_v_alpha * (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_shells.buf, __pyx_t_92, __pyx_bstride_0_shells, __pyx_t_93, __pyx_bstride_1_shells))) * __pyx_v_dist); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":348 - * #image[ind,i] += rgba[i]*dist*rgba[3]/dt - * #print rgba[i], image[ind,i], dist, dt - * break # <<<<<<<<<<<<<< - * if (tmax[0] > 1.0) and (tmax[1] > 1.0) and (tmax[2] > 1.0): - * dt = 1.0 - enter_t - */ - goto __pyx_L27_break; - goto __pyx_L28; - } - __pyx_L28:; - } - __pyx_L27_break:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":349 - * #print rgba[i], image[ind,i], dist, dt - * break - * if (tmax[0] > 1.0) and (tmax[1] > 1.0) and (tmax[2] > 1.0): # <<<<<<<<<<<<<< - * dt = 1.0 - enter_t - * break - */ - __pyx_t_22 = ((__pyx_v_tmax[0]) > 1.0); - if (__pyx_t_22) { - __pyx_t_3 = ((__pyx_v_tmax[1]) > 1.0); - if (__pyx_t_3) { - __pyx_t_18 = ((__pyx_v_tmax[2]) > 1.0); - __pyx_t_20 = __pyx_t_18; - } else { - __pyx_t_20 = __pyx_t_3; - } - __pyx_t_3 = __pyx_t_20; - } else { - __pyx_t_3 = __pyx_t_22; - } - if (__pyx_t_3) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":350 - * break - * if (tmax[0] > 1.0) and (tmax[1] > 1.0) and (tmax[2] > 1.0): - * dt = 1.0 - enter_t # <<<<<<<<<<<<<< - * break - * if tmax[0] < tmax[1]: - */ - __pyx_v_dt = (1.0 - __pyx_v_enter_t); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":351 - * if (tmax[0] > 1.0) and (tmax[1] > 1.0) and (tmax[2] > 1.0): - * dt = 1.0 - enter_t - * break # <<<<<<<<<<<<<< - * if tmax[0] < tmax[1]: - * if tmax[0] < tmax[2]: - */ - goto __pyx_L23_break; - goto __pyx_L29; - } - __pyx_L29:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":352 - * dt = 1.0 - enter_t - * break - * if tmax[0] < tmax[1]: # <<<<<<<<<<<<<< - * if tmax[0] < tmax[2]: - * dt = tmax[0] - enter_t - */ - __pyx_t_3 = ((__pyx_v_tmax[0]) < (__pyx_v_tmax[1])); - if (__pyx_t_3) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":353 - * break - * if tmax[0] < tmax[1]: - * if tmax[0] < tmax[2]: # <<<<<<<<<<<<<< - * dt = tmax[0] - enter_t - * enter_t = tmax[0] - */ - __pyx_t_3 = ((__pyx_v_tmax[0]) < (__pyx_v_tmax[2])); - if (__pyx_t_3) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":354 - * if tmax[0] < tmax[1]: - * if tmax[0] < tmax[2]: - * dt = tmax[0] - enter_t # <<<<<<<<<<<<<< - * enter_t = tmax[0] - * tmax[0] += tdelta[0] - */ - __pyx_v_dt = ((__pyx_v_tmax[0]) - __pyx_v_enter_t); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":355 - * if tmax[0] < tmax[2]: - * dt = tmax[0] - enter_t - * enter_t = tmax[0] # <<<<<<<<<<<<<< - * tmax[0] += tdelta[0] - * cur_ind[0] += step[0] - */ - __pyx_v_enter_t = (__pyx_v_tmax[0]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":356 - * dt = tmax[0] - enter_t - * enter_t = tmax[0] - * tmax[0] += tdelta[0] # <<<<<<<<<<<<<< - * cur_ind[0] += step[0] - * else: - */ - (__pyx_v_tmax[0]) += (__pyx_v_tdelta[0]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":357 - * enter_t = tmax[0] - * tmax[0] += tdelta[0] - * cur_ind[0] += step[0] # <<<<<<<<<<<<<< - * else: - * dt = tmax[2] - enter_t - */ - (__pyx_v_cur_ind[0]) += (__pyx_v_step[0]); - goto __pyx_L31; - } - /*else*/ { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":359 - * cur_ind[0] += step[0] - * else: - * dt = tmax[2] - enter_t # <<<<<<<<<<<<<< - * enter_t = tmax[2] - * tmax[2] += tdelta[2] - */ - __pyx_v_dt = ((__pyx_v_tmax[2]) - __pyx_v_enter_t); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":360 - * else: - * dt = tmax[2] - enter_t - * enter_t = tmax[2] # <<<<<<<<<<<<<< - * tmax[2] += tdelta[2] - * cur_ind[2] += step[2] - */ - __pyx_v_enter_t = (__pyx_v_tmax[2]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":361 - * dt = tmax[2] - enter_t - * enter_t = tmax[2] - * tmax[2] += tdelta[2] # <<<<<<<<<<<<<< - * cur_ind[2] += step[2] - * else: - */ - (__pyx_v_tmax[2]) += (__pyx_v_tdelta[2]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":362 - * enter_t = tmax[2] - * tmax[2] += tdelta[2] - * cur_ind[2] += step[2] # <<<<<<<<<<<<<< - * else: - * if tmax[1] < tmax[2]: - */ - (__pyx_v_cur_ind[2]) += (__pyx_v_step[2]); - } - __pyx_L31:; - goto __pyx_L30; - } - /*else*/ { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":364 - * cur_ind[2] += step[2] - * else: - * if tmax[1] < tmax[2]: # <<<<<<<<<<<<<< - * dt = tmax[1] - enter_t - * enter_t = tmax[1] - */ - __pyx_t_3 = ((__pyx_v_tmax[1]) < (__pyx_v_tmax[2])); - if (__pyx_t_3) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":365 - * else: - * if tmax[1] < tmax[2]: - * dt = tmax[1] - enter_t # <<<<<<<<<<<<<< - * enter_t = tmax[1] - * tmax[1] += tdelta[1] - */ - __pyx_v_dt = ((__pyx_v_tmax[1]) - __pyx_v_enter_t); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":366 - * if tmax[1] < tmax[2]: - * dt = tmax[1] - enter_t - * enter_t = tmax[1] # <<<<<<<<<<<<<< - * tmax[1] += tdelta[1] - * cur_ind[1] += step[1] - */ - __pyx_v_enter_t = (__pyx_v_tmax[1]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":367 - * dt = tmax[1] - enter_t - * enter_t = tmax[1] - * tmax[1] += tdelta[1] # <<<<<<<<<<<<<< - * cur_ind[1] += step[1] - * else: - */ - (__pyx_v_tmax[1]) += (__pyx_v_tdelta[1]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":368 - * enter_t = tmax[1] - * tmax[1] += tdelta[1] - * cur_ind[1] += step[1] # <<<<<<<<<<<<<< - * else: - * dt = tmax[2] - enter_t - */ - (__pyx_v_cur_ind[1]) += (__pyx_v_step[1]); - goto __pyx_L32; - } - /*else*/ { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":370 - * cur_ind[1] += step[1] - * else: - * dt = tmax[2] - enter_t # <<<<<<<<<<<<<< - * enter_t = tmax[2] - * tmax[2] += tdelta[2] - */ - __pyx_v_dt = ((__pyx_v_tmax[2]) - __pyx_v_enter_t); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":371 - * else: - * dt = tmax[2] - enter_t - * enter_t = tmax[2] # <<<<<<<<<<<<<< - * tmax[2] += tdelta[2] - * cur_ind[2] += step[2] - */ - __pyx_v_enter_t = (__pyx_v_tmax[2]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":372 - * dt = tmax[2] - enter_t - * enter_t = tmax[2] - * tmax[2] += tdelta[2] # <<<<<<<<<<<<<< - * cur_ind[2] += step[2] - * dv = data[cur_ind[0], cur_ind[1], cur_ind[2]] - */ - (__pyx_v_tmax[2]) += (__pyx_v_tdelta[2]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":373 - * enter_t = tmax[2] - * tmax[2] += tdelta[2] - * cur_ind[2] += step[2] # <<<<<<<<<<<<<< - * dv = data[cur_ind[0], cur_ind[1], cur_ind[2]] - */ - (__pyx_v_cur_ind[2]) += (__pyx_v_step[2]); - } - __pyx_L32:; - } - __pyx_L30:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":374 - * tmax[2] += tdelta[2] - * cur_ind[2] += step[2] - * dv = data[cur_ind[0], cur_ind[1], cur_ind[2]] # <<<<<<<<<<<<<< - */ - __pyx_t_69 = (__pyx_v_cur_ind[0]); - __pyx_t_96 = (__pyx_v_cur_ind[1]); - __pyx_t_97 = (__pyx_v_cur_ind[2]); - __pyx_v_dv = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_data.buf, __pyx_t_69, __pyx_bstride_0_data, __pyx_t_96, __pyx_bstride_1_data, __pyx_t_97, __pyx_bstride_2_data)); - } - __pyx_L23_break:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_45); - __Pyx_XDECREF(__pyx_t_46); - __Pyx_XDECREF(__pyx_t_50); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_image); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_shells); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_right_edge); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edge); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dx); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_u); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_v); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.amr_utils.integrate_ray"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_image); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_shells); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_right_edge); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edge); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dx); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_u); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_v); - __pyx_L2:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":31 - * from stdlib cimport malloc, free, abs - * - * cdef inline int imax(int i0, int i1): # <<<<<<<<<<<<<< - * if i0 > i1: return i0 - * return i1 - */ - -static CYTHON_INLINE int __pyx_f_2yt_9amr_utils_imax(int __pyx_v_i0, int __pyx_v_i1) { - int __pyx_r; - int __pyx_t_1; - __Pyx_RefNannySetupContext("imax"); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":32 - * - * cdef inline int imax(int i0, int i1): - * if i0 > i1: return i0 # <<<<<<<<<<<<<< - * return i1 - * - */ - __pyx_t_1 = (__pyx_v_i0 > __pyx_v_i1); - if (__pyx_t_1) { - __pyx_r = __pyx_v_i0; - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":33 - * cdef inline int imax(int i0, int i1): - * if i0 > i1: return i0 - * return i1 # <<<<<<<<<<<<<< - * - * cdef inline np.float64_t fmax(np.float64_t f0, np.float64_t f1): - */ - __pyx_r = __pyx_v_i1; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":35 - * return i1 - * - * cdef inline np.float64_t fmax(np.float64_t f0, np.float64_t f1): # <<<<<<<<<<<<<< - * if f0 > f1: return f0 - * return f1 - */ - -static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9amr_utils_fmax(__pyx_t_5numpy_float64_t __pyx_v_f0, __pyx_t_5numpy_float64_t __pyx_v_f1) { - __pyx_t_5numpy_float64_t __pyx_r; - int __pyx_t_1; - __Pyx_RefNannySetupContext("fmax"); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":36 - * - * cdef inline np.float64_t fmax(np.float64_t f0, np.float64_t f1): - * if f0 > f1: return f0 # <<<<<<<<<<<<<< - * return f1 - * - */ - __pyx_t_1 = (__pyx_v_f0 > __pyx_v_f1); - if (__pyx_t_1) { - __pyx_r = __pyx_v_f0; - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":37 - * cdef inline np.float64_t fmax(np.float64_t f0, np.float64_t f1): - * if f0 > f1: return f0 - * return f1 # <<<<<<<<<<<<<< - * - * cdef inline int imin(int i0, int i1): - */ - __pyx_r = __pyx_v_f1; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":39 - * return f1 - * - * cdef inline int imin(int i0, int i1): # <<<<<<<<<<<<<< - * if i0 < i1: return i0 - * return i1 - */ - -static CYTHON_INLINE int __pyx_f_2yt_9amr_utils_imin(int __pyx_v_i0, int __pyx_v_i1) { - int __pyx_r; - int __pyx_t_1; - __Pyx_RefNannySetupContext("imin"); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":40 - * - * cdef inline int imin(int i0, int i1): - * if i0 < i1: return i0 # <<<<<<<<<<<<<< - * return i1 - * - */ - __pyx_t_1 = (__pyx_v_i0 < __pyx_v_i1); - if (__pyx_t_1) { - __pyx_r = __pyx_v_i0; - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":41 - * cdef inline int imin(int i0, int i1): - * if i0 < i1: return i0 - * return i1 # <<<<<<<<<<<<<< - * - * cdef inline np.float64_t fmin(np.float64_t f0, np.float64_t f1): - */ - __pyx_r = __pyx_v_i1; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":43 - * return i1 - * - * cdef inline np.float64_t fmin(np.float64_t f0, np.float64_t f1): # <<<<<<<<<<<<<< - * if f0 < f1: return f0 - * return f1 - */ - -static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9amr_utils_fmin(__pyx_t_5numpy_float64_t __pyx_v_f0, __pyx_t_5numpy_float64_t __pyx_v_f1) { - __pyx_t_5numpy_float64_t __pyx_r; - int __pyx_t_1; - __Pyx_RefNannySetupContext("fmin"); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":44 - * - * cdef inline np.float64_t fmin(np.float64_t f0, np.float64_t f1): - * if f0 < f1: return f0 # <<<<<<<<<<<<<< - * return f1 - * - */ - __pyx_t_1 = (__pyx_v_f0 < __pyx_v_f1); - if (__pyx_t_1) { - __pyx_r = __pyx_v_f0; - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":45 - * cdef inline np.float64_t fmin(np.float64_t f0, np.float64_t f1): - * if f0 < f1: return f0 - * return f1 # <<<<<<<<<<<<<< - * - * cdef inline int iclip(int i, int a, int b): - */ - __pyx_r = __pyx_v_f1; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":47 - * return f1 - * - * cdef inline int iclip(int i, int a, int b): # <<<<<<<<<<<<<< - * if i < a: return a - * if i > b: return b - */ - -static CYTHON_INLINE int __pyx_f_2yt_9amr_utils_iclip(int __pyx_v_i, int __pyx_v_a, int __pyx_v_b) { - int __pyx_r; - int __pyx_t_1; - __Pyx_RefNannySetupContext("iclip"); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":48 - * - * cdef inline int iclip(int i, int a, int b): - * if i < a: return a # <<<<<<<<<<<<<< - * if i > b: return b - * return i - */ - __pyx_t_1 = (__pyx_v_i < __pyx_v_a); - if (__pyx_t_1) { - __pyx_r = __pyx_v_a; - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":49 - * cdef inline int iclip(int i, int a, int b): - * if i < a: return a - * if i > b: return b # <<<<<<<<<<<<<< - * return i - * - */ - __pyx_t_1 = (__pyx_v_i > __pyx_v_b); - if (__pyx_t_1) { - __pyx_r = __pyx_v_b; - goto __pyx_L0; - goto __pyx_L4; - } - __pyx_L4:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":50 - * if i < a: return a - * if i > b: return b - * return i # <<<<<<<<<<<<<< - * - * cdef inline np.float64_t fclip(np.float64_t f, - */ - __pyx_r = __pyx_v_i; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":52 - * return i - * - * cdef inline np.float64_t fclip(np.float64_t f, # <<<<<<<<<<<<<< - * np.float64_t a, np.float64_t b): - * return fmin(fmax(f, a), b) - */ - -static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9amr_utils_fclip(__pyx_t_5numpy_float64_t __pyx_v_f, __pyx_t_5numpy_float64_t __pyx_v_a, __pyx_t_5numpy_float64_t __pyx_v_b) { - __pyx_t_5numpy_float64_t __pyx_r; - __Pyx_RefNannySetupContext("fclip"); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":54 - * cdef inline np.float64_t fclip(np.float64_t f, - * np.float64_t a, np.float64_t b): - * return fmin(fmax(f, a), b) # <<<<<<<<<<<<<< - * - * cdef extern from "math.h": - */ - __pyx_r = __pyx_f_2yt_9amr_utils_fmin(__pyx_f_2yt_9amr_utils_fmax(__pyx_v_f, __pyx_v_a), __pyx_v_b); - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":89 - * int pass_through - * - * cdef void FIT_initialize_table(FieldInterpolationTable *fit, int nbins, # <<<<<<<<<<<<<< - * np.float64_t *values, np.float64_t bounds1, np.float64_t bounds2, - * int field_id, int weight_field_id = -1, int weight_table_id = -1, - */ - -static void __pyx_f_2yt_9amr_utils_FIT_initialize_table(struct __pyx_t_2yt_9amr_utils_FieldInterpolationTable *__pyx_v_fit, int __pyx_v_nbins, __pyx_t_5numpy_float64_t *__pyx_v_values, __pyx_t_5numpy_float64_t __pyx_v_bounds1, __pyx_t_5numpy_float64_t __pyx_v_bounds2, int __pyx_v_field_id, struct __pyx_opt_args_2yt_9amr_utils_FIT_initialize_table *__pyx_optional_args) { - int __pyx_v_weight_field_id = ((int)-1); - int __pyx_v_weight_table_id = ((int)-1); - int __pyx_v_pass_through = ((int)0); - __pyx_t_5numpy_float64_t __pyx_t_1; - __Pyx_RefNannySetupContext("FIT_initialize_table"); - if (__pyx_optional_args) { - if (__pyx_optional_args->__pyx_n > 0) { - __pyx_v_weight_field_id = __pyx_optional_args->weight_field_id; - if (__pyx_optional_args->__pyx_n > 1) { - __pyx_v_weight_table_id = __pyx_optional_args->weight_table_id; - if (__pyx_optional_args->__pyx_n > 2) { - __pyx_v_pass_through = __pyx_optional_args->pass_through; - } - } - } - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":93 - * int field_id, int weight_field_id = -1, int weight_table_id = -1, - * int pass_through = 0): - * fit.bounds[0] = bounds1; fit.bounds[1] = bounds2 # <<<<<<<<<<<<<< - * fit.nbins = nbins - * fit.dbin = (fit.bounds[1] - fit.bounds[0])/fit.nbins - */ - (__pyx_v_fit->bounds[0]) = __pyx_v_bounds1; - (__pyx_v_fit->bounds[1]) = __pyx_v_bounds2; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":94 - * int pass_through = 0): - * fit.bounds[0] = bounds1; fit.bounds[1] = bounds2 - * fit.nbins = nbins # <<<<<<<<<<<<<< - * fit.dbin = (fit.bounds[1] - fit.bounds[0])/fit.nbins - * fit.idbin = 1.0/fit.dbin - */ - __pyx_v_fit->nbins = __pyx_v_nbins; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":95 - * fit.bounds[0] = bounds1; fit.bounds[1] = bounds2 - * fit.nbins = nbins - * fit.dbin = (fit.bounds[1] - fit.bounds[0])/fit.nbins # <<<<<<<<<<<<<< - * fit.idbin = 1.0/fit.dbin - * # Better not pull this out from under us, yo - */ - __pyx_t_1 = ((__pyx_v_fit->bounds[1]) - (__pyx_v_fit->bounds[0])); - if (unlikely(__pyx_v_fit->nbins == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_fit->dbin = (__pyx_t_1 / __pyx_v_fit->nbins); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":96 - * fit.nbins = nbins - * fit.dbin = (fit.bounds[1] - fit.bounds[0])/fit.nbins - * fit.idbin = 1.0/fit.dbin # <<<<<<<<<<<<<< - * # Better not pull this out from under us, yo - * fit.values = values - */ - if (unlikely(__pyx_v_fit->dbin == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_fit->idbin = (1.0 / __pyx_v_fit->dbin); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":98 - * fit.idbin = 1.0/fit.dbin - * # Better not pull this out from under us, yo - * fit.values = values # <<<<<<<<<<<<<< - * fit.field_id = field_id - * fit.weight_field_id = weight_field_id - */ - __pyx_v_fit->values = __pyx_v_values; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":99 - * # Better not pull this out from under us, yo - * fit.values = values - * fit.field_id = field_id # <<<<<<<<<<<<<< - * fit.weight_field_id = weight_field_id - * fit.weight_table_id = weight_table_id - */ - __pyx_v_fit->field_id = __pyx_v_field_id; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":100 - * fit.values = values - * fit.field_id = field_id - * fit.weight_field_id = weight_field_id # <<<<<<<<<<<<<< - * fit.weight_table_id = weight_table_id - * fit.pass_through = pass_through - */ - __pyx_v_fit->weight_field_id = __pyx_v_weight_field_id; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":101 - * fit.field_id = field_id - * fit.weight_field_id = weight_field_id - * fit.weight_table_id = weight_table_id # <<<<<<<<<<<<<< - * fit.pass_through = pass_through - * - */ - __pyx_v_fit->weight_table_id = __pyx_v_weight_table_id; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":102 - * fit.weight_field_id = weight_field_id - * fit.weight_table_id = weight_table_id - * fit.pass_through = pass_through # <<<<<<<<<<<<<< - * - * cdef np.float64_t FIT_get_value(FieldInterpolationTable *fit, - */ - __pyx_v_fit->pass_through = __pyx_v_pass_through; - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_WriteUnraisable("yt.amr_utils.FIT_initialize_table"); - __pyx_L0:; - __Pyx_RefNannyFinishContext(); -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":104 - * fit.pass_through = pass_through - * - * cdef np.float64_t FIT_get_value(FieldInterpolationTable *fit, # <<<<<<<<<<<<<< - * np.float64_t *dvs): - * cdef np.float64_t bv, dy, dd, tf - */ - -static __pyx_t_5numpy_float64_t __pyx_f_2yt_9amr_utils_FIT_get_value(struct __pyx_t_2yt_9amr_utils_FieldInterpolationTable *__pyx_v_fit, __pyx_t_5numpy_float64_t *__pyx_v_dvs) { - __pyx_t_5numpy_float64_t __pyx_v_bv; - __pyx_t_5numpy_float64_t __pyx_v_dy; - __pyx_t_5numpy_float64_t __pyx_v_dd; - int __pyx_v_bin_id; - __pyx_t_5numpy_float64_t __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - __Pyx_RefNannySetupContext("FIT_get_value"); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":108 - * cdef np.float64_t bv, dy, dd, tf - * cdef int bin_id - * if fit.pass_through == 1: return dvs[fit.field_id] # <<<<<<<<<<<<<< - * if dvs[fit.field_id] > fit.bounds[1] or dvs[fit.field_id] < fit.bounds[0]: return 0.0 - * bin_id = ((dvs[fit.field_id] - fit.bounds[0]) * fit.idbin) - */ - __pyx_t_1 = (__pyx_v_fit->pass_through == 1); - if (__pyx_t_1) { - __pyx_r = (__pyx_v_dvs[__pyx_v_fit->field_id]); - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":109 - * cdef int bin_id - * if fit.pass_through == 1: return dvs[fit.field_id] - * if dvs[fit.field_id] > fit.bounds[1] or dvs[fit.field_id] < fit.bounds[0]: return 0.0 # <<<<<<<<<<<<<< - * bin_id = ((dvs[fit.field_id] - fit.bounds[0]) * fit.idbin) - * dd = dvs[fit.field_id] - (fit.bounds[0] + bin_id * fit.dbin) # x - x0 - */ - __pyx_t_1 = ((__pyx_v_dvs[__pyx_v_fit->field_id]) > (__pyx_v_fit->bounds[1])); - if (!__pyx_t_1) { - __pyx_t_2 = ((__pyx_v_dvs[__pyx_v_fit->field_id]) < (__pyx_v_fit->bounds[0])); - __pyx_t_3 = __pyx_t_2; - } else { - __pyx_t_3 = __pyx_t_1; - } - if (__pyx_t_3) { - __pyx_r = 0.0; - goto __pyx_L0; - goto __pyx_L4; - } - __pyx_L4:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":110 - * if fit.pass_through == 1: return dvs[fit.field_id] - * if dvs[fit.field_id] > fit.bounds[1] or dvs[fit.field_id] < fit.bounds[0]: return 0.0 - * bin_id = ((dvs[fit.field_id] - fit.bounds[0]) * fit.idbin) # <<<<<<<<<<<<<< - * dd = dvs[fit.field_id] - (fit.bounds[0] + bin_id * fit.dbin) # x - x0 - * bv = fit.values[bin_id] - */ - __pyx_v_bin_id = ((int)(((__pyx_v_dvs[__pyx_v_fit->field_id]) - (__pyx_v_fit->bounds[0])) * __pyx_v_fit->idbin)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":111 - * if dvs[fit.field_id] > fit.bounds[1] or dvs[fit.field_id] < fit.bounds[0]: return 0.0 - * bin_id = ((dvs[fit.field_id] - fit.bounds[0]) * fit.idbin) - * dd = dvs[fit.field_id] - (fit.bounds[0] + bin_id * fit.dbin) # x - x0 # <<<<<<<<<<<<<< - * bv = fit.values[bin_id] - * dy = fit.values[bin_id + 1] - bv - */ - __pyx_v_dd = ((__pyx_v_dvs[__pyx_v_fit->field_id]) - ((__pyx_v_fit->bounds[0]) + (__pyx_v_bin_id * __pyx_v_fit->dbin))); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":112 - * bin_id = ((dvs[fit.field_id] - fit.bounds[0]) * fit.idbin) - * dd = dvs[fit.field_id] - (fit.bounds[0] + bin_id * fit.dbin) # x - x0 - * bv = fit.values[bin_id] # <<<<<<<<<<<<<< - * dy = fit.values[bin_id + 1] - bv - * if fit.weight_field_id != -1: - */ - __pyx_v_bv = (__pyx_v_fit->values[__pyx_v_bin_id]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":113 - * dd = dvs[fit.field_id] - (fit.bounds[0] + bin_id * fit.dbin) # x - x0 - * bv = fit.values[bin_id] - * dy = fit.values[bin_id + 1] - bv # <<<<<<<<<<<<<< - * if fit.weight_field_id != -1: - * return dvs[fit.weight_field_id] * (bv + dd*dy*fit.idbin) - */ - __pyx_v_dy = ((__pyx_v_fit->values[(__pyx_v_bin_id + 1)]) - __pyx_v_bv); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":114 - * bv = fit.values[bin_id] - * dy = fit.values[bin_id + 1] - bv - * if fit.weight_field_id != -1: # <<<<<<<<<<<<<< - * return dvs[fit.weight_field_id] * (bv + dd*dy*fit.idbin) - * return (bv + dd*dy*fit.idbin) - */ - __pyx_t_3 = (__pyx_v_fit->weight_field_id != -1); - if (__pyx_t_3) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":115 - * dy = fit.values[bin_id + 1] - bv - * if fit.weight_field_id != -1: - * return dvs[fit.weight_field_id] * (bv + dd*dy*fit.idbin) # <<<<<<<<<<<<<< - * return (bv + dd*dy*fit.idbin) - * - */ - __pyx_r = ((__pyx_v_dvs[__pyx_v_fit->weight_field_id]) * (__pyx_v_bv + ((__pyx_v_dd * __pyx_v_dy) * __pyx_v_fit->idbin))); - goto __pyx_L0; - goto __pyx_L5; - } - __pyx_L5:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":116 - * if fit.weight_field_id != -1: - * return dvs[fit.weight_field_id] * (bv + dd*dy*fit.idbin) - * return (bv + dd*dy*fit.idbin) # <<<<<<<<<<<<<< - * - * cdef class TransferFunctionProxy: - */ - __pyx_r = (__pyx_v_bv + ((__pyx_v_dd * __pyx_v_dy) * __pyx_v_fit->idbin)); - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":121 - * cdef int n_fields - * cdef int n_field_tables - * cdef public int ns # <<<<<<<<<<<<<< - * - * # These are the field tables and their affiliated storage. - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_2ns___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_2ns___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->ns); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("yt.amr_utils.TransferFunctionProxy.ns.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_2ns___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_2ns___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - int __pyx_t_1; - __Pyx_RefNannySetupContext("__set__"); - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->ns = __pyx_t_1; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("yt.amr_utils.TransferFunctionProxy.ns.__set__"); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":136 - * # We store a reference to the transfer function object and to the field - * # interpolation tables - * cdef public object tf_obj # <<<<<<<<<<<<<< - * cdef public object my_field_tables - * - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_6tf_obj___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_6tf_obj___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->tf_obj); - __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->tf_obj; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_6tf_obj___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_6tf_obj___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannySetupContext("__set__"); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->tf_obj); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->tf_obj); - ((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->tf_obj = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_6tf_obj___del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_6tf_obj___del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->tf_obj); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->tf_obj); - ((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->tf_obj = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":137 - * # interpolation tables - * cdef public object tf_obj - * cdef public object my_field_tables # <<<<<<<<<<<<<< - * - * def __cinit__(self, tf_obj): - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_15my_field_tables___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_15my_field_tables___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->my_field_tables); - __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->my_field_tables; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_15my_field_tables___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_15my_field_tables___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannySetupContext("__set__"); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->my_field_tables); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->my_field_tables); - ((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->my_field_tables = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_15my_field_tables___del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_15my_field_tables___del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->my_field_tables); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->my_field_tables); - ((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->my_field_tables = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":139 - * cdef public object my_field_tables - * - * def __cinit__(self, tf_obj): # <<<<<<<<<<<<<< - * # We have N fields. We have 6 channels. We have M field tables. - * # The idea is that we can have multiple channels corresponding to the - */ - -static int __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_tf_obj = 0; - int __pyx_v_i; - PyArrayObject *__pyx_v_temp; - Py_buffer __pyx_bstruct_temp; - Py_ssize_t __pyx_bstride_0_temp = 0; - Py_ssize_t __pyx_bshape_0_temp = 0; - int __pyx_r; - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyArrayObject *__pyx_t_5 = NULL; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - __pyx_t_5numpy_float64_t __pyx_t_10; - __pyx_t_5numpy_float64_t __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; - struct __pyx_opt_args_2yt_9amr_utils_FIT_initialize_table __pyx_t_15; - PyObject *__pyx_t_16 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tf_obj,0}; - __Pyx_RefNannySetupContext("__cinit__"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[1] = {0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tf_obj); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_tf_obj = values[0]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_tf_obj = PyTuple_GET_ITEM(__pyx_args, 0); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.TransferFunctionProxy.__cinit__"); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_v_temp = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_bstruct_temp.buf = NULL; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":150 - * cdef FieldInterpolationTable fit - * - * self.tf_obj = tf_obj # <<<<<<<<<<<<<< - * - * self.n_field_tables = tf_obj.n_field_tables - */ - __Pyx_INCREF(__pyx_v_tf_obj); - __Pyx_GIVEREF(__pyx_v_tf_obj); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->tf_obj); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->tf_obj); - ((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->tf_obj = __pyx_v_tf_obj; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":152 - * self.tf_obj = tf_obj - * - * self.n_field_tables = tf_obj.n_field_tables # <<<<<<<<<<<<<< - * for i in range(6): self.istorage[i] = 0.0 - * - */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__n_field_tables); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - ((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->n_field_tables = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":153 - * - * self.n_field_tables = tf_obj.n_field_tables - * for i in range(6): self.istorage[i] = 0.0 # <<<<<<<<<<<<<< - * - * self.my_field_tables = [] - */ - for (__pyx_t_2 = 0; __pyx_t_2 < 6; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; - (((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->istorage[__pyx_v_i]) = 0.0; - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":155 - * for i in range(6): self.istorage[i] = 0.0 - * - * self.my_field_tables = [] # <<<<<<<<<<<<<< - * for i in range(self.n_field_tables): - * temp = tf_obj.tables[i].y - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->my_field_tables); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->my_field_tables); - ((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->my_field_tables = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":156 - * - * self.my_field_tables = [] - * for i in range(self.n_field_tables): # <<<<<<<<<<<<<< - * temp = tf_obj.tables[i].y - * FIT_initialize_table(&self.field_tables[i], - */ - __pyx_t_2 = ((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->n_field_tables; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":157 - * self.my_field_tables = [] - * for i in range(self.n_field_tables): - * temp = tf_obj.tables[i].y # <<<<<<<<<<<<<< - * FIT_initialize_table(&self.field_tables[i], - * temp.shape[0], - */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__tables); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__y); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = ((PyArrayObject *)__pyx_t_1); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_temp); - __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_temp, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_6 < 0)) { - PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_temp, (PyObject*)__pyx_v_temp, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9); - } - } - __pyx_bstride_0_temp = __pyx_bstruct_temp.strides[0]; - __pyx_bshape_0_temp = __pyx_bstruct_temp.shape[0]; - if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_temp)); - __pyx_v_temp = ((PyArrayObject *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":161 - * temp.shape[0], - * temp.data, - * tf_obj.tables[i].x_bounds[0], # <<<<<<<<<<<<<< - * tf_obj.tables[i].x_bounds[1], - * tf_obj.field_ids[i], tf_obj.weight_field_ids[i], - */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__tables); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__x_bounds); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_10 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":162 - * temp.data, - * tf_obj.tables[i].x_bounds[0], - * tf_obj.tables[i].x_bounds[1], # <<<<<<<<<<<<<< - * tf_obj.field_ids[i], tf_obj.weight_field_ids[i], - * tf_obj.weight_table_ids[i], - */ - __pyx_t_4 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__tables); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__x_bounds); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_11 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":163 - * tf_obj.tables[i].x_bounds[0], - * tf_obj.tables[i].x_bounds[1], - * tf_obj.field_ids[i], tf_obj.weight_field_ids[i], # <<<<<<<<<<<<<< - * tf_obj.weight_table_ids[i], - * tf_obj.tables[i].pass_through) - */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__field_ids); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__weight_field_ids); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_12 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":164 - * tf_obj.tables[i].x_bounds[1], - * tf_obj.field_ids[i], tf_obj.weight_field_ids[i], - * tf_obj.weight_table_ids[i], # <<<<<<<<<<<<<< - * tf_obj.tables[i].pass_through) - * self.my_field_tables.append((tf_obj.tables[i], - */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__weight_table_ids); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":165 - * tf_obj.field_ids[i], tf_obj.weight_field_ids[i], - * tf_obj.weight_table_ids[i], - * tf_obj.tables[i].pass_through) # <<<<<<<<<<<<<< - * self.my_field_tables.append((tf_obj.tables[i], - * tf_obj.tables[i].y)) - */ - __pyx_t_4 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__tables); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__pass_through); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_14 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_15.__pyx_n = 3; - __pyx_t_15.weight_field_id = __pyx_t_12; - __pyx_t_15.weight_table_id = __pyx_t_13; - __pyx_t_15.pass_through = __pyx_t_14; - __pyx_f_2yt_9amr_utils_FIT_initialize_table((&(((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->field_tables[__pyx_v_i])), (__pyx_v_temp->dimensions[0]), ((__pyx_t_5numpy_float64_t *)__pyx_v_temp->data), __pyx_t_10, __pyx_t_11, __pyx_t_6, &__pyx_t_15); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":166 - * tf_obj.weight_table_ids[i], - * tf_obj.tables[i].pass_through) - * self.my_field_tables.append((tf_obj.tables[i], # <<<<<<<<<<<<<< - * tf_obj.tables[i].y)) - * self.field_tables[i].field_id = tf_obj.field_ids[i] - */ - __pyx_t_4 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__tables); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":167 - * tf_obj.tables[i].pass_through) - * self.my_field_tables.append((tf_obj.tables[i], - * tf_obj.tables[i].y)) # <<<<<<<<<<<<<< - * self.field_tables[i].field_id = tf_obj.field_ids[i] - * self.field_tables[i].weight_field_id = tf_obj.weight_field_ids[i] - */ - __pyx_t_4 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__tables); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_16 = __Pyx_GetItemInt(__pyx_t_4, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_16) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_GetAttr(__pyx_t_16, __pyx_n_s__y); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_16); - PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_1 = 0; - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Append(((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->my_field_tables, __pyx_t_16); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":168 - * self.my_field_tables.append((tf_obj.tables[i], - * tf_obj.tables[i].y)) - * self.field_tables[i].field_id = tf_obj.field_ids[i] # <<<<<<<<<<<<<< - * self.field_tables[i].weight_field_id = tf_obj.weight_field_ids[i] - * print "Field table", i, "corresponds to", - */ - __pyx_t_4 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__field_ids); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_16 = __Pyx_GetItemInt(__pyx_t_4, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_16) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_14 = __Pyx_PyInt_AsInt(__pyx_t_16); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - (((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->field_tables[__pyx_v_i]).field_id = __pyx_t_14; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":169 - * tf_obj.tables[i].y)) - * self.field_tables[i].field_id = tf_obj.field_ids[i] - * self.field_tables[i].weight_field_id = tf_obj.weight_field_ids[i] # <<<<<<<<<<<<<< - * print "Field table", i, "corresponds to", - * print self.field_tables[i].field_id, - */ - __pyx_t_16 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__weight_field_ids); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_16); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_16, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __pyx_t_14 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - (((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->field_tables[__pyx_v_i]).weight_field_id = __pyx_t_14; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":170 - * self.field_tables[i].field_id = tf_obj.field_ids[i] - * self.field_tables[i].weight_field_id = tf_obj.weight_field_ids[i] - * print "Field table", i, "corresponds to", # <<<<<<<<<<<<<< - * print self.field_tables[i].field_id, - * print "(Weighted with ", self.field_tables[i].weight_field_id, - */ - __pyx_t_4 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_16 = PyTuple_New(3); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_16); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_3)); - PyTuple_SET_ITEM(__pyx_t_16, 0, ((PyObject *)__pyx_kp_s_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3)); - PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_4)); - PyTuple_SET_ITEM(__pyx_t_16, 2, ((PyObject *)__pyx_kp_s_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4)); - __pyx_t_4 = 0; - if (__Pyx_Print(0, __pyx_t_16, 0) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":171 - * self.field_tables[i].weight_field_id = tf_obj.weight_field_ids[i] - * print "Field table", i, "corresponds to", - * print self.field_tables[i].field_id, # <<<<<<<<<<<<<< - * print "(Weighted with ", self.field_tables[i].weight_field_id, - * print ")" - */ - __pyx_t_16 = PyInt_FromLong((((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->field_tables[__pyx_v_i]).field_id); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_16); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_16); - __Pyx_GIVEREF(__pyx_t_16); - __pyx_t_16 = 0; - if (__Pyx_Print(0, __pyx_t_4, 0) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":172 - * print "Field table", i, "corresponds to", - * print self.field_tables[i].field_id, - * print "(Weighted with ", self.field_tables[i].weight_field_id, # <<<<<<<<<<<<<< - * print ")" - * - */ - __pyx_t_4 = PyInt_FromLong((((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->field_tables[__pyx_v_i]).weight_field_id); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_16); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_5)); - PyTuple_SET_ITEM(__pyx_t_16, 0, ((PyObject *)__pyx_kp_s_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5)); - PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - if (__Pyx_Print(0, __pyx_t_16, 0) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":173 - * print self.field_tables[i].field_id, - * print "(Weighted with ", self.field_tables[i].weight_field_id, - * print ")" # <<<<<<<<<<<<<< - * - * for i in range(6): - */ - if (__Pyx_PrintOne(0, ((PyObject *)__pyx_kp_s_6)) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":175 - * print ")" - * - * for i in range(6): # <<<<<<<<<<<<<< - * self.field_table_ids[i] = tf_obj.field_table_ids[i] - * print "Channel", i, "corresponds to", self.field_table_ids[i] - */ - for (__pyx_t_2 = 0; __pyx_t_2 < 6; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":176 - * - * for i in range(6): - * self.field_table_ids[i] = tf_obj.field_table_ids[i] # <<<<<<<<<<<<<< - * print "Channel", i, "corresponds to", self.field_table_ids[i] - * - */ - __pyx_t_16 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__field_table_ids); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_16); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_16, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - (((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->field_table_ids[__pyx_v_i]) = __pyx_t_3; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":177 - * for i in range(6): - * self.field_table_ids[i] = tf_obj.field_table_ids[i] - * print "Channel", i, "corresponds to", self.field_table_ids[i] # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) - */ - __pyx_t_4 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_16 = PyInt_FromLong((((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->field_table_ids[__pyx_v_i])); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_16); - __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_n_s__Channel)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__Channel)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Channel)); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_4)); - PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_kp_s_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4)); - PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_16); - __Pyx_GIVEREF(__pyx_t_16); - __pyx_t_4 = 0; - __pyx_t_16 = 0; - if (__Pyx_Print(0, __pyx_t_1, 1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_16); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_temp); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.amr_utils.TransferFunctionProxy.__cinit__"); - __pyx_r = -1; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_temp); - __pyx_L2:; - __Pyx_DECREF((PyObject *)__pyx_v_temp); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":181 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef void eval_transfer(self, np.float64_t dt, np.float64_t *dvs, # <<<<<<<<<<<<<< - * np.float64_t *rgba, np.float64_t *grad): - * cdef int i, fid, use - */ - -static void __pyx_f_2yt_9amr_utils_21TransferFunctionProxy_eval_transfer(struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *__pyx_v_self, __pyx_t_5numpy_float64_t __pyx_v_dt, __pyx_t_5numpy_float64_t *__pyx_v_dvs, __pyx_t_5numpy_float64_t *__pyx_v_rgba, __pyx_t_5numpy_float64_t *__pyx_v_grad) { - int __pyx_v_i; - int __pyx_v_fid; - __pyx_t_5numpy_float64_t __pyx_v_ta; - __pyx_t_5numpy_float64_t __pyx_v_trgba[6]; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - __Pyx_RefNannySetupContext("eval_transfer"); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":194 - * # use = 1 - * # break - * for i in range(self.n_field_tables): # <<<<<<<<<<<<<< - * self.istorage[i] = FIT_get_value(&self.field_tables[i], dvs) - * # We have to do this after the interpolation - */ - __pyx_t_1 = __pyx_v_self->n_field_tables; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":195 - * # break - * for i in range(self.n_field_tables): - * self.istorage[i] = FIT_get_value(&self.field_tables[i], dvs) # <<<<<<<<<<<<<< - * # We have to do this after the interpolation - * for i in range(self.n_field_tables): - */ - (__pyx_v_self->istorage[__pyx_v_i]) = __pyx_f_2yt_9amr_utils_FIT_get_value((&(__pyx_v_self->field_tables[__pyx_v_i])), __pyx_v_dvs); - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":197 - * self.istorage[i] = FIT_get_value(&self.field_tables[i], dvs) - * # We have to do this after the interpolation - * for i in range(self.n_field_tables): # <<<<<<<<<<<<<< - * fid = self.field_tables[i].weight_table_id - * if fid != -1: self.istorage[i] *= self.istorage[fid] - */ - __pyx_t_1 = __pyx_v_self->n_field_tables; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":198 - * # We have to do this after the interpolation - * for i in range(self.n_field_tables): - * fid = self.field_tables[i].weight_table_id # <<<<<<<<<<<<<< - * if fid != -1: self.istorage[i] *= self.istorage[fid] - * for i in range(6): - */ - __pyx_v_fid = (__pyx_v_self->field_tables[__pyx_v_i]).weight_table_id; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":199 - * for i in range(self.n_field_tables): - * fid = self.field_tables[i].weight_table_id - * if fid != -1: self.istorage[i] *= self.istorage[fid] # <<<<<<<<<<<<<< - * for i in range(6): - * trgba[i] = self.istorage[self.field_table_ids[i]] - */ - __pyx_t_3 = (__pyx_v_fid != -1); - if (__pyx_t_3) { - (__pyx_v_self->istorage[__pyx_v_i]) *= (__pyx_v_self->istorage[__pyx_v_fid]); - goto __pyx_L7; - } - __pyx_L7:; - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":200 - * fid = self.field_tables[i].weight_table_id - * if fid != -1: self.istorage[i] *= self.istorage[fid] - * for i in range(6): # <<<<<<<<<<<<<< - * trgba[i] = self.istorage[self.field_table_ids[i]] - * #print i, trgba[i], - */ - for (__pyx_t_1 = 0; __pyx_t_1 < 6; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":201 - * if fid != -1: self.istorage[i] *= self.istorage[fid] - * for i in range(6): - * trgba[i] = self.istorage[self.field_table_ids[i]] # <<<<<<<<<<<<<< - * #print i, trgba[i], - * #print - */ - (__pyx_v_trgba[__pyx_v_i]) = (__pyx_v_self->istorage[(__pyx_v_self->field_table_ids[__pyx_v_i])]); - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":211 - * # integration here: - * # I_{i+1} = ds * C_i + (1.0 - ds*alpha_i) * I_i - * for i in range(3): # <<<<<<<<<<<<<< - * # This is the new way: alpha corresponds to opacity of a given - * # slice. Previously it was ill-defined, but represented some - */ - for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":215 - * # slice. Previously it was ill-defined, but represented some - * # measure of emissivity. - * ta = fmax((1.0 - dt*trgba[i+3]), 0.0) # <<<<<<<<<<<<<< - * rgba[i ] = dt*trgba[i ] + ta * rgba[i ] - * #rgba[i+3] = dt*trgba[i+3] + ta * rgba[i+3] - */ - __pyx_v_ta = __pyx_f_2yt_9amr_utils_fmax((1.0 - (__pyx_v_dt * (__pyx_v_trgba[(__pyx_v_i + 3)]))), 0.0); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":216 - * # measure of emissivity. - * ta = fmax((1.0 - dt*trgba[i+3]), 0.0) - * rgba[i ] = dt*trgba[i ] + ta * rgba[i ] # <<<<<<<<<<<<<< - * #rgba[i+3] = dt*trgba[i+3] + ta * rgba[i+3] - * # This is the old way: - */ - (__pyx_v_rgba[__pyx_v_i]) = ((__pyx_v_dt * (__pyx_v_trgba[__pyx_v_i])) + (__pyx_v_ta * (__pyx_v_rgba[__pyx_v_i]))); - } - - __Pyx_RefNannyFinishContext(); -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":223 - * - * cdef class VectorPlane: - * cdef public object avp_pos, avp_dir, acenter, aimage # <<<<<<<<<<<<<< - * cdef np.float64_t *vp_pos, *vp_dir, *center, *image, - * cdef np.float64_t pdx, pdy, bounds[4] - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_pos___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_pos___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_pos); - __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_pos; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_pos___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_pos___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannySetupContext("__set__"); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_pos); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_pos); - ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_pos = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_pos___del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_pos___del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_pos); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_pos); - ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_pos = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_dir___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_dir___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_dir); - __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_dir; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_dir___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_dir___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannySetupContext("__set__"); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_dir); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_dir); - ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_dir = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_dir___del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_dir___del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_dir); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_dir); - ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_dir = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_2yt_9amr_utils_11VectorPlane_7acenter___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_11VectorPlane_7acenter___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->acenter); - __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->acenter; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_11VectorPlane_7acenter___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_11VectorPlane_7acenter___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannySetupContext("__set__"); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->acenter); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->acenter); - ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->acenter = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_11VectorPlane_7acenter___del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_11VectorPlane_7acenter___del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->acenter); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->acenter); - ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->acenter = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_2yt_9amr_utils_11VectorPlane_6aimage___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_11VectorPlane_6aimage___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->aimage); - __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->aimage; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_11VectorPlane_6aimage___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_11VectorPlane_6aimage___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannySetupContext("__set__"); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->aimage); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->aimage); - ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->aimage = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_11VectorPlane_6aimage___del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_11VectorPlane_6aimage___del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->aimage); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->aimage); - ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->aimage = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":230 - * cdef int im_strides[3] - * cdef int vd_strides[3] - * cdef public object ax_vec, ay_vec # <<<<<<<<<<<<<< - * cdef np.float64_t *x_vec, *y_vec - * - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_11VectorPlane_6ax_vec___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_11VectorPlane_6ax_vec___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ax_vec); - __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ax_vec; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_11VectorPlane_6ax_vec___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_11VectorPlane_6ax_vec___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannySetupContext("__set__"); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ax_vec); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ax_vec); - ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ax_vec = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_11VectorPlane_6ax_vec___del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_11VectorPlane_6ax_vec___del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ax_vec); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ax_vec); - ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ax_vec = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_2yt_9amr_utils_11VectorPlane_6ay_vec___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_11VectorPlane_6ay_vec___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ay_vec); - __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ay_vec; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_11VectorPlane_6ay_vec___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_11VectorPlane_6ay_vec___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannySetupContext("__set__"); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ay_vec); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ay_vec); - ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ay_vec = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_11VectorPlane_6ay_vec___del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_11VectorPlane_6ay_vec___del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ay_vec); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ay_vec); - ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ay_vec = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":233 - * cdef np.float64_t *x_vec, *y_vec - * - * def __cinit__(self, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t, ndim=3] vp_pos, - * np.ndarray vp_dir, - */ - -static int __pyx_pf_2yt_9amr_utils_11VectorPlane___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_11VectorPlane___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_vp_pos = 0; - PyArrayObject *__pyx_v_vp_dir = 0; - PyArrayObject *__pyx_v_center = 0; - PyObject *__pyx_v_bounds = 0; - PyArrayObject *__pyx_v_image = 0; - PyArrayObject *__pyx_v_x_vec = 0; - PyArrayObject *__pyx_v_y_vec = 0; - int __pyx_v_i; - Py_buffer __pyx_bstruct_center; - Py_ssize_t __pyx_bstride_0_center = 0; - Py_ssize_t __pyx_bshape_0_center = 0; - Py_buffer __pyx_bstruct_x_vec; - Py_ssize_t __pyx_bstride_0_x_vec = 0; - Py_ssize_t __pyx_bshape_0_x_vec = 0; - Py_buffer __pyx_bstruct_y_vec; - Py_ssize_t __pyx_bstride_0_y_vec = 0; - Py_ssize_t __pyx_bshape_0_y_vec = 0; - Py_buffer __pyx_bstruct_image; - Py_ssize_t __pyx_bstride_0_image = 0; - Py_ssize_t __pyx_bstride_1_image = 0; - Py_ssize_t __pyx_bstride_2_image = 0; - Py_ssize_t __pyx_bshape_0_image = 0; - Py_ssize_t __pyx_bshape_1_image = 0; - Py_ssize_t __pyx_bshape_2_image = 0; - Py_buffer __pyx_bstruct_vp_pos; - Py_ssize_t __pyx_bstride_0_vp_pos = 0; - Py_ssize_t __pyx_bstride_1_vp_pos = 0; - Py_ssize_t __pyx_bstride_2_vp_pos = 0; - Py_ssize_t __pyx_bshape_0_vp_pos = 0; - Py_ssize_t __pyx_bshape_1_vp_pos = 0; - Py_ssize_t __pyx_bshape_2_vp_pos = 0; - int __pyx_r; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - __pyx_t_5numpy_float64_t __pyx_t_3; - int __pyx_t_4; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vp_pos,&__pyx_n_s__vp_dir,&__pyx_n_s__center,&__pyx_n_s__bounds,&__pyx_n_s__image,&__pyx_n_s__x_vec,&__pyx_n_s__y_vec,0}; - __Pyx_RefNannySetupContext("__cinit__"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[7] = {0,0,0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__vp_pos); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__vp_dir); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 7, 7, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__center); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 7, 7, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bounds); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 7, 7, 3); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__image); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 7, 7, 4); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x_vec); - if (likely(values[5])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 7, 7, 5); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 6: - values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y_vec); - if (likely(values[6])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 7, 7, 6); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_vp_pos = ((PyArrayObject *)values[0]); - __pyx_v_vp_dir = ((PyArrayObject *)values[1]); - __pyx_v_center = ((PyArrayObject *)values[2]); - __pyx_v_bounds = values[3]; - __pyx_v_image = ((PyArrayObject *)values[4]); - __pyx_v_x_vec = ((PyArrayObject *)values[5]); - __pyx_v_y_vec = ((PyArrayObject *)values[6]); - } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_vp_pos = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_vp_dir = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_center = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_bounds = PyTuple_GET_ITEM(__pyx_args, 3); - __pyx_v_image = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); - __pyx_v_x_vec = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 5)); - __pyx_v_y_vec = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 6)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.VectorPlane.__cinit__"); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_vp_pos.buf = NULL; - __pyx_bstruct_center.buf = NULL; - __pyx_bstruct_image.buf = NULL; - __pyx_bstruct_x_vec.buf = NULL; - __pyx_bstruct_y_vec.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vp_pos), __pyx_ptype_5numpy_ndarray, 1, "vp_pos", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vp_dir), __pyx_ptype_5numpy_ndarray, 1, "vp_dir", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_center), __pyx_ptype_5numpy_ndarray, 1, "center", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_image), __pyx_ptype_5numpy_ndarray, 1, "image", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x_vec), __pyx_ptype_5numpy_ndarray, 1, "x_vec", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y_vec), __pyx_ptype_5numpy_ndarray, 1, "y_vec", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_vp_pos, (PyObject*)__pyx_v_vp_pos, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_vp_pos = __pyx_bstruct_vp_pos.strides[0]; __pyx_bstride_1_vp_pos = __pyx_bstruct_vp_pos.strides[1]; __pyx_bstride_2_vp_pos = __pyx_bstruct_vp_pos.strides[2]; - __pyx_bshape_0_vp_pos = __pyx_bstruct_vp_pos.shape[0]; __pyx_bshape_1_vp_pos = __pyx_bstruct_vp_pos.shape[1]; __pyx_bshape_2_vp_pos = __pyx_bstruct_vp_pos.shape[2]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_center, (PyObject*)__pyx_v_center, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_center = __pyx_bstruct_center.strides[0]; - __pyx_bshape_0_center = __pyx_bstruct_center.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_image, (PyObject*)__pyx_v_image, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_image = __pyx_bstruct_image.strides[0]; __pyx_bstride_1_image = __pyx_bstruct_image.strides[1]; __pyx_bstride_2_image = __pyx_bstruct_image.strides[2]; - __pyx_bshape_0_image = __pyx_bstruct_image.shape[0]; __pyx_bshape_1_image = __pyx_bstruct_image.shape[1]; __pyx_bshape_2_image = __pyx_bstruct_image.shape[2]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x_vec, (PyObject*)__pyx_v_x_vec, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_x_vec = __pyx_bstruct_x_vec.strides[0]; - __pyx_bshape_0_x_vec = __pyx_bstruct_x_vec.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_y_vec, (PyObject*)__pyx_v_y_vec, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_y_vec = __pyx_bstruct_y_vec.strides[0]; - __pyx_bshape_0_y_vec = __pyx_bstruct_y_vec.shape[0]; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":242 - * np.ndarray[np.float64_t, ndim=1] y_vec): - * cdef int i, j - * self.avp_pos = vp_pos # <<<<<<<<<<<<<< - * self.avp_dir = vp_dir - * self.acenter = center - */ - __Pyx_INCREF(((PyObject *)__pyx_v_vp_pos)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_vp_pos)); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_pos); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_pos); - ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_pos = ((PyObject *)__pyx_v_vp_pos); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":243 - * cdef int i, j - * self.avp_pos = vp_pos - * self.avp_dir = vp_dir # <<<<<<<<<<<<<< - * self.acenter = center - * self.aimage = image - */ - __Pyx_INCREF(((PyObject *)__pyx_v_vp_dir)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_vp_dir)); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_dir); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_dir); - ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_dir = ((PyObject *)__pyx_v_vp_dir); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":244 - * self.avp_pos = vp_pos - * self.avp_dir = vp_dir - * self.acenter = center # <<<<<<<<<<<<<< - * self.aimage = image - * self.ax_vec = x_vec - */ - __Pyx_INCREF(((PyObject *)__pyx_v_center)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_center)); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->acenter); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->acenter); - ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->acenter = ((PyObject *)__pyx_v_center); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":245 - * self.avp_dir = vp_dir - * self.acenter = center - * self.aimage = image # <<<<<<<<<<<<<< - * self.ax_vec = x_vec - * self.ay_vec = y_vec - */ - __Pyx_INCREF(((PyObject *)__pyx_v_image)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_image)); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->aimage); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->aimage); - ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->aimage = ((PyObject *)__pyx_v_image); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":246 - * self.acenter = center - * self.aimage = image - * self.ax_vec = x_vec # <<<<<<<<<<<<<< - * self.ay_vec = y_vec - * self.vp_pos = vp_pos.data - */ - __Pyx_INCREF(((PyObject *)__pyx_v_x_vec)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_x_vec)); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ax_vec); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ax_vec); - ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ax_vec = ((PyObject *)__pyx_v_x_vec); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":247 - * self.aimage = image - * self.ax_vec = x_vec - * self.ay_vec = y_vec # <<<<<<<<<<<<<< - * self.vp_pos = vp_pos.data - * self.vp_dir = vp_dir.data - */ - __Pyx_INCREF(((PyObject *)__pyx_v_y_vec)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_y_vec)); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ay_vec); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ay_vec); - ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ay_vec = ((PyObject *)__pyx_v_y_vec); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":248 - * self.ax_vec = x_vec - * self.ay_vec = y_vec - * self.vp_pos = vp_pos.data # <<<<<<<<<<<<<< - * self.vp_dir = vp_dir.data - * self.center = center.data - */ - ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->vp_pos = ((__pyx_t_5numpy_float64_t *)__pyx_v_vp_pos->data); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":249 - * self.ay_vec = y_vec - * self.vp_pos = vp_pos.data - * self.vp_dir = vp_dir.data # <<<<<<<<<<<<<< - * self.center = center.data - * self.image = image.data - */ - ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->vp_dir = ((__pyx_t_5numpy_float64_t *)__pyx_v_vp_dir->data); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":250 - * self.vp_pos = vp_pos.data - * self.vp_dir = vp_dir.data - * self.center = center.data # <<<<<<<<<<<<<< - * self.image = image.data - * self.x_vec = x_vec.data - */ - ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->center = ((__pyx_t_5numpy_float64_t *)__pyx_v_center->data); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":251 - * self.vp_dir = vp_dir.data - * self.center = center.data - * self.image = image.data # <<<<<<<<<<<<<< - * self.x_vec = x_vec.data - * self.y_vec = y_vec.data - */ - ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->image = ((__pyx_t_5numpy_float64_t *)__pyx_v_image->data); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":252 - * self.center = center.data - * self.image = image.data - * self.x_vec = x_vec.data # <<<<<<<<<<<<<< - * self.y_vec = y_vec.data - * self.nv[0] = vp_pos.shape[0] - */ - ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->x_vec = ((__pyx_t_5numpy_float64_t *)__pyx_v_x_vec->data); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":253 - * self.image = image.data - * self.x_vec = x_vec.data - * self.y_vec = y_vec.data # <<<<<<<<<<<<<< - * self.nv[0] = vp_pos.shape[0] - * self.nv[1] = vp_pos.shape[1] - */ - ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->y_vec = ((__pyx_t_5numpy_float64_t *)__pyx_v_y_vec->data); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":254 - * self.x_vec = x_vec.data - * self.y_vec = y_vec.data - * self.nv[0] = vp_pos.shape[0] # <<<<<<<<<<<<<< - * self.nv[1] = vp_pos.shape[1] - * for i in range(4): self.bounds[i] = bounds[i] - */ - (((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->nv[0]) = (__pyx_v_vp_pos->dimensions[0]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":255 - * self.y_vec = y_vec.data - * self.nv[0] = vp_pos.shape[0] - * self.nv[1] = vp_pos.shape[1] # <<<<<<<<<<<<<< - * for i in range(4): self.bounds[i] = bounds[i] - * self.pdx = (self.bounds[1] - self.bounds[0])/self.nv[0] - */ - (((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->nv[1]) = (__pyx_v_vp_pos->dimensions[1]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":256 - * self.nv[0] = vp_pos.shape[0] - * self.nv[1] = vp_pos.shape[1] - * for i in range(4): self.bounds[i] = bounds[i] # <<<<<<<<<<<<<< - * self.pdx = (self.bounds[1] - self.bounds[0])/self.nv[0] - * self.pdy = (self.bounds[3] - self.bounds[2])/self.nv[1] - */ - for (__pyx_t_1 = 0; __pyx_t_1 < 4; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_bounds, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - (((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->bounds[__pyx_v_i]) = __pyx_t_3; - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":257 - * self.nv[1] = vp_pos.shape[1] - * for i in range(4): self.bounds[i] = bounds[i] - * self.pdx = (self.bounds[1] - self.bounds[0])/self.nv[0] # <<<<<<<<<<<<<< - * self.pdy = (self.bounds[3] - self.bounds[2])/self.nv[1] - * for i in range(3): - */ - __pyx_t_3 = ((((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->bounds[1]) - (((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->bounds[0])); - __pyx_t_1 = (((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->nv[0]); - if (unlikely(__pyx_t_1 == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->pdx = (__pyx_t_3 / __pyx_t_1); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":258 - * for i in range(4): self.bounds[i] = bounds[i] - * self.pdx = (self.bounds[1] - self.bounds[0])/self.nv[0] - * self.pdy = (self.bounds[3] - self.bounds[2])/self.nv[1] # <<<<<<<<<<<<<< - * for i in range(3): - * self.vp_strides[i] = vp_pos.strides[i] / 8 - */ - __pyx_t_3 = ((((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->bounds[3]) - (((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->bounds[2])); - __pyx_t_1 = (((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->nv[1]); - if (unlikely(__pyx_t_1 == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->pdy = (__pyx_t_3 / __pyx_t_1); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":259 - * self.pdx = (self.bounds[1] - self.bounds[0])/self.nv[0] - * self.pdy = (self.bounds[3] - self.bounds[2])/self.nv[1] - * for i in range(3): # <<<<<<<<<<<<<< - * self.vp_strides[i] = vp_pos.strides[i] / 8 - * self.im_strides[i] = image.strides[i] / 8 - */ - for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":260 - * self.pdy = (self.bounds[3] - self.bounds[2])/self.nv[1] - * for i in range(3): - * self.vp_strides[i] = vp_pos.strides[i] / 8 # <<<<<<<<<<<<<< - * self.im_strides[i] = image.strides[i] / 8 - * if vp_dir.ndim > 1: - */ - (((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->vp_strides[__pyx_v_i]) = __Pyx_div_long((__pyx_v_vp_pos->strides[__pyx_v_i]), 8); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":261 - * for i in range(3): - * self.vp_strides[i] = vp_pos.strides[i] / 8 - * self.im_strides[i] = image.strides[i] / 8 # <<<<<<<<<<<<<< - * if vp_dir.ndim > 1: - * for i in range(3): - */ - (((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->im_strides[__pyx_v_i]) = __Pyx_div_long((__pyx_v_image->strides[__pyx_v_i]), 8); - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":262 - * self.vp_strides[i] = vp_pos.strides[i] / 8 - * self.im_strides[i] = image.strides[i] / 8 - * if vp_dir.ndim > 1: # <<<<<<<<<<<<<< - * for i in range(3): - * self.vd_strides[i] = vp_dir.strides[i] / 8 - */ - __pyx_t_4 = (__pyx_v_vp_dir->nd > 1); - if (__pyx_t_4) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":263 - * self.im_strides[i] = image.strides[i] / 8 - * if vp_dir.ndim > 1: - * for i in range(3): # <<<<<<<<<<<<<< - * self.vd_strides[i] = vp_dir.strides[i] / 8 - * else: - */ - for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":264 - * if vp_dir.ndim > 1: - * for i in range(3): - * self.vd_strides[i] = vp_dir.strides[i] / 8 # <<<<<<<<<<<<<< - * else: - * self.vd_strides[0] = self.vd_strides[1] = self.vd_strides[2] = -1 - */ - (((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->vd_strides[__pyx_v_i]) = __Pyx_div_long((__pyx_v_vp_dir->strides[__pyx_v_i]), 8); - } - goto __pyx_L10; - } - /*else*/ { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":266 - * self.vd_strides[i] = vp_dir.strides[i] / 8 - * else: - * self.vd_strides[0] = self.vd_strides[1] = self.vd_strides[2] = -1 # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) - */ - (((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->vd_strides[0]) = -1; - (((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->vd_strides[1]) = -1; - (((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->vd_strides[2]) = -1; - } - __pyx_L10:; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_center); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_vec); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y_vec); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_image); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_vp_pos); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.amr_utils.VectorPlane.__cinit__"); - __pyx_r = -1; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_center); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_vec); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y_vec); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_image); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_vp_pos); - __pyx_L2:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":270 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef void get_start_stop(self, np.float64_t *ex, int *rv): # <<<<<<<<<<<<<< - * # Extrema need to be re-centered - * cdef np.float64_t cx, cy - */ - -static void __pyx_f_2yt_9amr_utils_11VectorPlane_get_start_stop(struct __pyx_obj_2yt_9amr_utils_VectorPlane *__pyx_v_self, __pyx_t_5numpy_float64_t *__pyx_v_ex, int *__pyx_v_rv) { - __pyx_t_5numpy_float64_t __pyx_v_cx; - __pyx_t_5numpy_float64_t __pyx_v_cy; - int __pyx_v_i; - int __pyx_t_1; - __pyx_t_5numpy_float64_t __pyx_t_2; - __Pyx_RefNannySetupContext("get_start_stop"); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":274 - * cdef np.float64_t cx, cy - * cdef int i - * cx = cy = 0.0 # <<<<<<<<<<<<<< - * for i in range(3): - * cx += self.center[i] * self.x_vec[i] - */ - __pyx_v_cx = 0.0; - __pyx_v_cy = 0.0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":275 - * cdef int i - * cx = cy = 0.0 - * for i in range(3): # <<<<<<<<<<<<<< - * cx += self.center[i] * self.x_vec[i] - * cy += self.center[i] * self.y_vec[i] - */ - for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":276 - * cx = cy = 0.0 - * for i in range(3): - * cx += self.center[i] * self.x_vec[i] # <<<<<<<<<<<<<< - * cy += self.center[i] * self.y_vec[i] - * rv[0] = lrint((ex[0] - cx - self.bounds[0])/self.pdx) - */ - __pyx_v_cx += ((__pyx_v_self->center[__pyx_v_i]) * (__pyx_v_self->x_vec[__pyx_v_i])); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":277 - * for i in range(3): - * cx += self.center[i] * self.x_vec[i] - * cy += self.center[i] * self.y_vec[i] # <<<<<<<<<<<<<< - * rv[0] = lrint((ex[0] - cx - self.bounds[0])/self.pdx) - * rv[1] = rv[0] + lrint((ex[1] - ex[0])/self.pdx) - */ - __pyx_v_cy += ((__pyx_v_self->center[__pyx_v_i]) * (__pyx_v_self->y_vec[__pyx_v_i])); - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":278 - * cx += self.center[i] * self.x_vec[i] - * cy += self.center[i] * self.y_vec[i] - * rv[0] = lrint((ex[0] - cx - self.bounds[0])/self.pdx) # <<<<<<<<<<<<<< - * rv[1] = rv[0] + lrint((ex[1] - ex[0])/self.pdx) - * rv[2] = lrint((ex[2] - cy - self.bounds[2])/self.pdy) - */ - __pyx_t_2 = (((__pyx_v_ex[0]) - __pyx_v_cx) - (__pyx_v_self->bounds[0])); - if (unlikely(__pyx_v_self->pdx == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - (__pyx_v_rv[0]) = lrint((__pyx_t_2 / __pyx_v_self->pdx)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":279 - * cy += self.center[i] * self.y_vec[i] - * rv[0] = lrint((ex[0] - cx - self.bounds[0])/self.pdx) - * rv[1] = rv[0] + lrint((ex[1] - ex[0])/self.pdx) # <<<<<<<<<<<<<< - * rv[2] = lrint((ex[2] - cy - self.bounds[2])/self.pdy) - * rv[3] = rv[2] + lrint((ex[3] - ex[2])/self.pdy) - */ - __pyx_t_2 = ((__pyx_v_ex[1]) - (__pyx_v_ex[0])); - if (unlikely(__pyx_v_self->pdx == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - (__pyx_v_rv[1]) = ((__pyx_v_rv[0]) + lrint((__pyx_t_2 / __pyx_v_self->pdx))); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":280 - * rv[0] = lrint((ex[0] - cx - self.bounds[0])/self.pdx) - * rv[1] = rv[0] + lrint((ex[1] - ex[0])/self.pdx) - * rv[2] = lrint((ex[2] - cy - self.bounds[2])/self.pdy) # <<<<<<<<<<<<<< - * rv[3] = rv[2] + lrint((ex[3] - ex[2])/self.pdy) - * - */ - __pyx_t_2 = (((__pyx_v_ex[2]) - __pyx_v_cy) - (__pyx_v_self->bounds[2])); - if (unlikely(__pyx_v_self->pdy == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - (__pyx_v_rv[2]) = lrint((__pyx_t_2 / __pyx_v_self->pdy)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":281 - * rv[1] = rv[0] + lrint((ex[1] - ex[0])/self.pdx) - * rv[2] = lrint((ex[2] - cy - self.bounds[2])/self.pdy) - * rv[3] = rv[2] + lrint((ex[3] - ex[2])/self.pdy) # <<<<<<<<<<<<<< - * - * cdef inline void copy_into(self, np.float64_t *fv, np.float64_t *tv, - */ - __pyx_t_2 = ((__pyx_v_ex[3]) - (__pyx_v_ex[2])); - if (unlikely(__pyx_v_self->pdy == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - (__pyx_v_rv[3]) = ((__pyx_v_rv[2]) + lrint((__pyx_t_2 / __pyx_v_self->pdy))); - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_WriteUnraisable("yt.amr_utils.VectorPlane.get_start_stop"); - __pyx_L0:; - __Pyx_RefNannyFinishContext(); -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":283 - * rv[3] = rv[2] + lrint((ex[3] - ex[2])/self.pdy) - * - * cdef inline void copy_into(self, np.float64_t *fv, np.float64_t *tv, # <<<<<<<<<<<<<< - * int i, int j, int nk, int strides[3]): - * # We know the first two dimensions of our from-vector, and our - */ - -static CYTHON_INLINE void __pyx_f_2yt_9amr_utils_11VectorPlane_copy_into(struct __pyx_obj_2yt_9amr_utils_VectorPlane *__pyx_v_self, __pyx_t_5numpy_float64_t *__pyx_v_fv, __pyx_t_5numpy_float64_t *__pyx_v_tv, int __pyx_v_i, int __pyx_v_j, int __pyx_v_nk, int *__pyx_v_strides) { - int __pyx_v_k; - int __pyx_v_offset; - int __pyx_t_1; - int __pyx_t_2; - __Pyx_RefNannySetupContext("copy_into"); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":288 - * # to-vector is flat and 'ni' long - * cdef int k - * cdef int offset = strides[0] * i + strides[1] * j # <<<<<<<<<<<<<< - * for k in range(nk): - * tv[k] = fv[offset + k] - */ - __pyx_v_offset = (((__pyx_v_strides[0]) * __pyx_v_i) + ((__pyx_v_strides[1]) * __pyx_v_j)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":289 - * cdef int k - * cdef int offset = strides[0] * i + strides[1] * j - * for k in range(nk): # <<<<<<<<<<<<<< - * tv[k] = fv[offset + k] - * - */ - __pyx_t_1 = __pyx_v_nk; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_k = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":290 - * cdef int offset = strides[0] * i + strides[1] * j - * for k in range(nk): - * tv[k] = fv[offset + k] # <<<<<<<<<<<<<< - * - * cdef inline void copy_back(self, np.float64_t *fv, np.float64_t *tv, - */ - (__pyx_v_tv[__pyx_v_k]) = (__pyx_v_fv[(__pyx_v_offset + __pyx_v_k)]); - } - - __Pyx_RefNannyFinishContext(); -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":292 - * tv[k] = fv[offset + k] - * - * cdef inline void copy_back(self, np.float64_t *fv, np.float64_t *tv, # <<<<<<<<<<<<<< - * int i, int j, int nk, int strides[3]): - * cdef int k - */ - -static CYTHON_INLINE void __pyx_f_2yt_9amr_utils_11VectorPlane_copy_back(struct __pyx_obj_2yt_9amr_utils_VectorPlane *__pyx_v_self, __pyx_t_5numpy_float64_t *__pyx_v_fv, __pyx_t_5numpy_float64_t *__pyx_v_tv, int __pyx_v_i, int __pyx_v_j, int __pyx_v_nk, int *__pyx_v_strides) { - int __pyx_v_k; - int __pyx_v_offset; - int __pyx_t_1; - int __pyx_t_2; - __Pyx_RefNannySetupContext("copy_back"); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":295 - * int i, int j, int nk, int strides[3]): - * cdef int k - * cdef int offset = strides[0] * i + strides[1] * j # <<<<<<<<<<<<<< - * for k in range(nk): - * tv[offset + k] = fv[k] - */ - __pyx_v_offset = (((__pyx_v_strides[0]) * __pyx_v_i) + ((__pyx_v_strides[1]) * __pyx_v_j)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":296 - * cdef int k - * cdef int offset = strides[0] * i + strides[1] * j - * for k in range(nk): # <<<<<<<<<<<<<< - * tv[offset + k] = fv[k] - * - */ - __pyx_t_1 = __pyx_v_nk; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_k = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":297 - * cdef int offset = strides[0] * i + strides[1] * j - * for k in range(nk): - * tv[offset + k] = fv[k] # <<<<<<<<<<<<<< - * - * cdef class PartitionedGrid: - */ - (__pyx_v_tv[(__pyx_v_offset + __pyx_v_k)]) = (__pyx_v_fv[__pyx_v_k]); - } - - __Pyx_RefNannyFinishContext(); -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":300 - * - * cdef class PartitionedGrid: - * cdef public object my_data # <<<<<<<<<<<<<< - * cdef public object LeftEdge - * cdef public object RightEdge - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_15PartitionedGrid_7my_data___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_15PartitionedGrid_7my_data___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->my_data); - __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->my_data; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid_7my_data___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid_7my_data___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannySetupContext("__set__"); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->my_data); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->my_data); - ((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->my_data = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid_7my_data___del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid_7my_data___del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->my_data); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->my_data); - ((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->my_data = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":301 - * cdef class PartitionedGrid: - * cdef public object my_data - * cdef public object LeftEdge # <<<<<<<<<<<<<< - * cdef public object RightEdge - * cdef np.float64_t *data[6] - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_15PartitionedGrid_8LeftEdge___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_15PartitionedGrid_8LeftEdge___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->LeftEdge); - __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->LeftEdge; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid_8LeftEdge___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid_8LeftEdge___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannySetupContext("__set__"); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->LeftEdge); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->LeftEdge); - ((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->LeftEdge = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid_8LeftEdge___del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid_8LeftEdge___del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->LeftEdge); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->LeftEdge); - ((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->LeftEdge = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":302 - * cdef public object my_data - * cdef public object LeftEdge - * cdef public object RightEdge # <<<<<<<<<<<<<< - * cdef np.float64_t *data[6] - * cdef np.float64_t dvs[6] - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_15PartitionedGrid_9RightEdge___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_15PartitionedGrid_9RightEdge___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->RightEdge); - __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->RightEdge; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid_9RightEdge___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid_9RightEdge___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannySetupContext("__set__"); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->RightEdge); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->RightEdge); - ((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->RightEdge = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid_9RightEdge___del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid_9RightEdge___del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->RightEdge); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->RightEdge); - ((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->RightEdge = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":310 - * cdef np.float64_t idds[3] - * cdef int dims[3] - * cdef public int parent_grid_id # <<<<<<<<<<<<<< - * cdef public int n_fields - * - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_15PartitionedGrid_14parent_grid_id___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_15PartitionedGrid_14parent_grid_id___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->parent_grid_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("yt.amr_utils.PartitionedGrid.parent_grid_id.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid_14parent_grid_id___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid_14parent_grid_id___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - int __pyx_t_1; - __Pyx_RefNannySetupContext("__set__"); - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->parent_grid_id = __pyx_t_1; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("yt.amr_utils.PartitionedGrid.parent_grid_id.__set__"); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":311 - * cdef int dims[3] - * cdef public int parent_grid_id - * cdef public int n_fields # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_15PartitionedGrid_8n_fields___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_15PartitionedGrid_8n_fields___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->n_fields); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("yt.amr_utils.PartitionedGrid.n_fields.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid_8n_fields___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid_8n_fields___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - int __pyx_t_1; - __Pyx_RefNannySetupContext("__set__"); - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->n_fields = __pyx_t_1; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("yt.amr_utils.PartitionedGrid.n_fields.__set__"); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":315 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * def __cinit__(self, # <<<<<<<<<<<<<< - * int parent_grid_id, int n_fields, data, - * np.ndarray[np.float64_t, ndim=1] left_edge, - */ - -static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_parent_grid_id; - int __pyx_v_n_fields; - PyObject *__pyx_v_data = 0; - PyArrayObject *__pyx_v_left_edge = 0; - PyArrayObject *__pyx_v_right_edge = 0; - PyArrayObject *__pyx_v_dims = 0; - int __pyx_v_i; - PyArrayObject *__pyx_v_tdata; - Py_buffer __pyx_bstruct_tdata; - Py_ssize_t __pyx_bstride_0_tdata = 0; - Py_ssize_t __pyx_bstride_1_tdata = 0; - Py_ssize_t __pyx_bstride_2_tdata = 0; - Py_ssize_t __pyx_bshape_0_tdata = 0; - Py_ssize_t __pyx_bshape_1_tdata = 0; - Py_ssize_t __pyx_bshape_2_tdata = 0; - Py_buffer __pyx_bstruct_right_edge; - Py_ssize_t __pyx_bstride_0_right_edge = 0; - Py_ssize_t __pyx_bshape_0_right_edge = 0; - Py_buffer __pyx_bstruct_dims; - Py_ssize_t __pyx_bstride_0_dims = 0; - Py_ssize_t __pyx_bshape_0_dims = 0; - Py_buffer __pyx_bstruct_left_edge; - Py_ssize_t __pyx_bstride_0_left_edge = 0; - Py_ssize_t __pyx_bshape_0_left_edge = 0; - int __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - __pyx_t_5numpy_float64_t __pyx_t_5; - int __pyx_t_6; - __pyx_t_5numpy_int64_t __pyx_t_7; - int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - PyArrayObject *__pyx_t_10 = NULL; - int __pyx_t_11; - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - PyObject *__pyx_t_14 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__parent_grid_id,&__pyx_n_s__n_fields,&__pyx_n_s__data,&__pyx_n_s__left_edge,&__pyx_n_s__right_edge,&__pyx_n_s__dims,0}; - __Pyx_RefNannySetupContext("__cinit__"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[6] = {0,0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parent_grid_id); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_fields); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left_edge); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 3); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right_edge); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 4); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dims); - if (likely(values[5])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 5); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_parent_grid_id = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_parent_grid_id == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_n_fields = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_n_fields == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_data = values[2]; - __pyx_v_left_edge = ((PyArrayObject *)values[3]); - __pyx_v_right_edge = ((PyArrayObject *)values[4]); - __pyx_v_dims = ((PyArrayObject *)values[5]); - } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_parent_grid_id = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_parent_grid_id == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_n_fields = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_n_fields == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_data = PyTuple_GET_ITEM(__pyx_args, 2); - __pyx_v_left_edge = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); - __pyx_v_right_edge = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); - __pyx_v_dims = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 5)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.PartitionedGrid.__cinit__"); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_v_tdata = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_bstruct_tdata.buf = NULL; - __pyx_bstruct_left_edge.buf = NULL; - __pyx_bstruct_right_edge.buf = NULL; - __pyx_bstruct_dims.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left_edge), __pyx_ptype_5numpy_ndarray, 1, "left_edge", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right_edge), __pyx_ptype_5numpy_ndarray, 1, "right_edge", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dims), __pyx_ptype_5numpy_ndarray, 1, "dims", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_left_edge, (PyObject*)__pyx_v_left_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_left_edge = __pyx_bstruct_left_edge.strides[0]; - __pyx_bshape_0_left_edge = __pyx_bstruct_left_edge.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_right_edge, (PyObject*)__pyx_v_right_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_right_edge = __pyx_bstruct_right_edge.strides[0]; - __pyx_bshape_0_right_edge = __pyx_bstruct_right_edge.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dims, (PyObject*)__pyx_v_dims, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_dims = __pyx_bstruct_dims.strides[0]; - __pyx_bshape_0_dims = __pyx_bstruct_dims.shape[0]; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":323 - * cdef int i, j, k, size - * cdef np.ndarray[np.float64_t, ndim=3] tdata - * self.parent_grid_id = parent_grid_id # <<<<<<<<<<<<<< - * self.LeftEdge = left_edge - * self.RightEdge = right_edge - */ - ((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->parent_grid_id = __pyx_v_parent_grid_id; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":324 - * cdef np.ndarray[np.float64_t, ndim=3] tdata - * self.parent_grid_id = parent_grid_id - * self.LeftEdge = left_edge # <<<<<<<<<<<<<< - * self.RightEdge = right_edge - * for i in range(3): - */ - __Pyx_INCREF(((PyObject *)__pyx_v_left_edge)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_left_edge)); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->LeftEdge); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->LeftEdge); - ((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->LeftEdge = ((PyObject *)__pyx_v_left_edge); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":325 - * self.parent_grid_id = parent_grid_id - * self.LeftEdge = left_edge - * self.RightEdge = right_edge # <<<<<<<<<<<<<< - * for i in range(3): - * self.left_edge[i] = left_edge[i] - */ - __Pyx_INCREF(((PyObject *)__pyx_v_right_edge)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_right_edge)); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->RightEdge); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->RightEdge); - ((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->RightEdge = ((PyObject *)__pyx_v_right_edge); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":326 - * self.LeftEdge = left_edge - * self.RightEdge = right_edge - * for i in range(3): # <<<<<<<<<<<<<< - * self.left_edge[i] = left_edge[i] - * self.right_edge[i] = right_edge[i] - */ - for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":327 - * self.RightEdge = right_edge - * for i in range(3): - * self.left_edge[i] = left_edge[i] # <<<<<<<<<<<<<< - * self.right_edge[i] = right_edge[i] - * self.dims[i] = dims[i] - */ - __pyx_t_2 = __pyx_v_i; - (((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->left_edge[__pyx_v_i]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_2, __pyx_bstride_0_left_edge)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":328 - * for i in range(3): - * self.left_edge[i] = left_edge[i] - * self.right_edge[i] = right_edge[i] # <<<<<<<<<<<<<< - * self.dims[i] = dims[i] - * self.dds[i] = (self.right_edge[i] - self.left_edge[i])/dims[i] - */ - __pyx_t_3 = __pyx_v_i; - (((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->right_edge[__pyx_v_i]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_3, __pyx_bstride_0_right_edge)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":329 - * self.left_edge[i] = left_edge[i] - * self.right_edge[i] = right_edge[i] - * self.dims[i] = dims[i] # <<<<<<<<<<<<<< - * self.dds[i] = (self.right_edge[i] - self.left_edge[i])/dims[i] - * self.idds[i] = 1.0/self.dds[i] - */ - __pyx_t_4 = __pyx_v_i; - (((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->dims[__pyx_v_i]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_dims.buf, __pyx_t_4, __pyx_bstride_0_dims)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":330 - * self.right_edge[i] = right_edge[i] - * self.dims[i] = dims[i] - * self.dds[i] = (self.right_edge[i] - self.left_edge[i])/dims[i] # <<<<<<<<<<<<<< - * self.idds[i] = 1.0/self.dds[i] - * self.my_data = data - */ - __pyx_t_5 = ((((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->right_edge[__pyx_v_i]) - (((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->left_edge[__pyx_v_i])); - __pyx_t_6 = __pyx_v_i; - __pyx_t_7 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_dims.buf, __pyx_t_6, __pyx_bstride_0_dims)); - if (unlikely(__pyx_t_7 == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - (((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->dds[__pyx_v_i]) = (__pyx_t_5 / __pyx_t_7); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":331 - * self.dims[i] = dims[i] - * self.dds[i] = (self.right_edge[i] - self.left_edge[i])/dims[i] - * self.idds[i] = 1.0/self.dds[i] # <<<<<<<<<<<<<< - * self.my_data = data - * self.n_fields = n_fields - */ - __pyx_t_5 = (((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->dds[__pyx_v_i]); - if (unlikely(__pyx_t_5 == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - (((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->idds[__pyx_v_i]) = (1.0 / __pyx_t_5); - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":332 - * self.dds[i] = (self.right_edge[i] - self.left_edge[i])/dims[i] - * self.idds[i] = 1.0/self.dds[i] - * self.my_data = data # <<<<<<<<<<<<<< - * self.n_fields = n_fields - * for i in range(n_fields): - */ - __Pyx_INCREF(__pyx_v_data); - __Pyx_GIVEREF(__pyx_v_data); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->my_data); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->my_data); - ((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->my_data = __pyx_v_data; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":333 - * self.idds[i] = 1.0/self.dds[i] - * self.my_data = data - * self.n_fields = n_fields # <<<<<<<<<<<<<< - * for i in range(n_fields): - * tdata = data[i] - */ - ((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->n_fields = __pyx_v_n_fields; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":334 - * self.my_data = data - * self.n_fields = n_fields - * for i in range(n_fields): # <<<<<<<<<<<<<< - * tdata = data[i] - * self.data[i] = tdata.data - */ - __pyx_t_1 = __pyx_v_n_fields; - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_1; __pyx_t_8+=1) { - __pyx_v_i = __pyx_t_8; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":335 - * self.n_fields = n_fields - * for i in range(n_fields): - * tdata = data[i] # <<<<<<<<<<<<<< - * self.data[i] = tdata.data - * - */ - __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_data, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_10 = ((PyArrayObject *)__pyx_t_9); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_tdata); - __pyx_t_11 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_tdata, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack); - if (unlikely(__pyx_t_11 < 0)) { - PyErr_Fetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_tdata, (PyObject*)__pyx_v_tdata, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_12, __pyx_t_13, __pyx_t_14); - } - } - __pyx_bstride_0_tdata = __pyx_bstruct_tdata.strides[0]; __pyx_bstride_1_tdata = __pyx_bstruct_tdata.strides[1]; __pyx_bstride_2_tdata = __pyx_bstruct_tdata.strides[2]; - __pyx_bshape_0_tdata = __pyx_bstruct_tdata.shape[0]; __pyx_bshape_1_tdata = __pyx_bstruct_tdata.shape[1]; __pyx_bshape_2_tdata = __pyx_bstruct_tdata.shape[2]; - if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_10 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_tdata)); - __pyx_v_tdata = ((PyArrayObject *)__pyx_t_9); - __pyx_t_9 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":336 - * for i in range(n_fields): - * tdata = data[i] - * self.data[i] = tdata.data # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) - */ - (((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->data[__pyx_v_i]) = ((__pyx_t_5numpy_float64_t *)__pyx_v_tdata->data); - } - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_9); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_tdata); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_right_edge); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dims); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edge); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.amr_utils.PartitionedGrid.__cinit__"); - __pyx_r = -1; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_tdata); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_right_edge); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dims); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edge); - __pyx_L2:; - __Pyx_DECREF((PyObject *)__pyx_v_tdata); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":340 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * def cast_plane(self, TransferFunctionProxy tf, VectorPlane vp): # <<<<<<<<<<<<<< - * # This routine will iterate over all of the vectors and cast each in - * # turn. Might benefit from a more sophisticated intersection check, - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_15PartitionedGrid_cast_plane(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_15PartitionedGrid_cast_plane(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *__pyx_v_tf = 0; - struct __pyx_obj_2yt_9amr_utils_VectorPlane *__pyx_v_vp = 0; - int __pyx_v_vi; - int __pyx_v_vj; - int __pyx_v_hit; - int __pyx_v_iter[4]; - __pyx_t_5numpy_float64_t __pyx_v_v_pos[3]; - __pyx_t_5numpy_float64_t __pyx_v_v_dir[3]; - __pyx_t_5numpy_float64_t __pyx_v_rgba[6]; - __pyx_t_5numpy_float64_t __pyx_v_extrema[4]; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tf,&__pyx_n_s__vp,0}; - __Pyx_RefNannySetupContext("cast_plane"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tf); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__vp); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("cast_plane", 1, 2, 2, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "cast_plane") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_tf = ((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)values[0]); - __pyx_v_vp = ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)values[1]); - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_tf = ((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_vp = ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)PyTuple_GET_ITEM(__pyx_args, 1)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("cast_plane", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.PartitionedGrid.cast_plane"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tf), __pyx_ptype_2yt_9amr_utils_TransferFunctionProxy, 1, "tf", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vp), __pyx_ptype_2yt_9amr_utils_VectorPlane, 1, "vp", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":347 - * cdef int iter[4] - * cdef np.float64_t v_pos[3], v_dir[3], rgba[6], extrema[4] - * hit = 0 # <<<<<<<<<<<<<< - * self.calculate_extent(vp, extrema) - * vp.get_start_stop(extrema, iter) - */ - __pyx_v_hit = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":348 - * cdef np.float64_t v_pos[3], v_dir[3], rgba[6], extrema[4] - * hit = 0 - * self.calculate_extent(vp, extrema) # <<<<<<<<<<<<<< - * vp.get_start_stop(extrema, iter) - * iter[0] = iclip(iter[0], 0, vp.nv[0]) - */ - ((struct __pyx_vtabstruct_2yt_9amr_utils_PartitionedGrid *)((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->__pyx_vtab)->calculate_extent(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self), __pyx_v_vp, __pyx_v_extrema); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":349 - * hit = 0 - * self.calculate_extent(vp, extrema) - * vp.get_start_stop(extrema, iter) # <<<<<<<<<<<<<< - * iter[0] = iclip(iter[0], 0, vp.nv[0]) - * iter[1] = iclip(iter[1], 0, vp.nv[0]) - */ - ((struct __pyx_vtabstruct_2yt_9amr_utils_VectorPlane *)__pyx_v_vp->__pyx_vtab)->get_start_stop(__pyx_v_vp, __pyx_v_extrema, __pyx_v_iter); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":350 - * self.calculate_extent(vp, extrema) - * vp.get_start_stop(extrema, iter) - * iter[0] = iclip(iter[0], 0, vp.nv[0]) # <<<<<<<<<<<<<< - * iter[1] = iclip(iter[1], 0, vp.nv[0]) - * iter[2] = iclip(iter[2], 0, vp.nv[1]) - */ - (__pyx_v_iter[0]) = __pyx_f_2yt_9amr_utils_iclip((__pyx_v_iter[0]), 0, (__pyx_v_vp->nv[0])); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":351 - * vp.get_start_stop(extrema, iter) - * iter[0] = iclip(iter[0], 0, vp.nv[0]) - * iter[1] = iclip(iter[1], 0, vp.nv[0]) # <<<<<<<<<<<<<< - * iter[2] = iclip(iter[2], 0, vp.nv[1]) - * iter[3] = iclip(iter[3], 0, vp.nv[1]) - */ - (__pyx_v_iter[1]) = __pyx_f_2yt_9amr_utils_iclip((__pyx_v_iter[1]), 0, (__pyx_v_vp->nv[0])); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":352 - * iter[0] = iclip(iter[0], 0, vp.nv[0]) - * iter[1] = iclip(iter[1], 0, vp.nv[0]) - * iter[2] = iclip(iter[2], 0, vp.nv[1]) # <<<<<<<<<<<<<< - * iter[3] = iclip(iter[3], 0, vp.nv[1]) - * if vp.vd_strides[0] == -1: - */ - (__pyx_v_iter[2]) = __pyx_f_2yt_9amr_utils_iclip((__pyx_v_iter[2]), 0, (__pyx_v_vp->nv[1])); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":353 - * iter[1] = iclip(iter[1], 0, vp.nv[0]) - * iter[2] = iclip(iter[2], 0, vp.nv[1]) - * iter[3] = iclip(iter[3], 0, vp.nv[1]) # <<<<<<<<<<<<<< - * if vp.vd_strides[0] == -1: - * for vi in range(iter[0], iter[1]): - */ - (__pyx_v_iter[3]) = __pyx_f_2yt_9amr_utils_iclip((__pyx_v_iter[3]), 0, (__pyx_v_vp->nv[1])); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":354 - * iter[2] = iclip(iter[2], 0, vp.nv[1]) - * iter[3] = iclip(iter[3], 0, vp.nv[1]) - * if vp.vd_strides[0] == -1: # <<<<<<<<<<<<<< - * for vi in range(iter[0], iter[1]): - * for vj in range(iter[2], iter[3]): - */ - __pyx_t_1 = ((__pyx_v_vp->vd_strides[0]) == -1); - if (__pyx_t_1) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":355 - * iter[3] = iclip(iter[3], 0, vp.nv[1]) - * if vp.vd_strides[0] == -1: - * for vi in range(iter[0], iter[1]): # <<<<<<<<<<<<<< - * for vj in range(iter[2], iter[3]): - * vp.copy_into(vp.vp_pos, v_pos, vi, vj, 3, vp.vp_strides) - */ - __pyx_t_2 = (__pyx_v_iter[1]); - for (__pyx_t_3 = (__pyx_v_iter[0]); __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_vi = __pyx_t_3; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":356 - * if vp.vd_strides[0] == -1: - * for vi in range(iter[0], iter[1]): - * for vj in range(iter[2], iter[3]): # <<<<<<<<<<<<<< - * vp.copy_into(vp.vp_pos, v_pos, vi, vj, 3, vp.vp_strides) - * vp.copy_into(vp.image, rgba, vi, vj, 3, vp.im_strides) - */ - __pyx_t_4 = (__pyx_v_iter[3]); - for (__pyx_t_5 = (__pyx_v_iter[2]); __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_vj = __pyx_t_5; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":357 - * for vi in range(iter[0], iter[1]): - * for vj in range(iter[2], iter[3]): - * vp.copy_into(vp.vp_pos, v_pos, vi, vj, 3, vp.vp_strides) # <<<<<<<<<<<<<< - * vp.copy_into(vp.image, rgba, vi, vj, 3, vp.im_strides) - * self.integrate_ray(v_pos, vp.vp_dir, rgba, tf) - */ - ((struct __pyx_vtabstruct_2yt_9amr_utils_VectorPlane *)__pyx_v_vp->__pyx_vtab)->copy_into(__pyx_v_vp, __pyx_v_vp->vp_pos, __pyx_v_v_pos, __pyx_v_vi, __pyx_v_vj, 3, __pyx_v_vp->vp_strides); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":358 - * for vj in range(iter[2], iter[3]): - * vp.copy_into(vp.vp_pos, v_pos, vi, vj, 3, vp.vp_strides) - * vp.copy_into(vp.image, rgba, vi, vj, 3, vp.im_strides) # <<<<<<<<<<<<<< - * self.integrate_ray(v_pos, vp.vp_dir, rgba, tf) - * vp.copy_back(rgba, vp.image, vi, vj, 3, vp.im_strides) - */ - ((struct __pyx_vtabstruct_2yt_9amr_utils_VectorPlane *)__pyx_v_vp->__pyx_vtab)->copy_into(__pyx_v_vp, __pyx_v_vp->image, __pyx_v_rgba, __pyx_v_vi, __pyx_v_vj, 3, __pyx_v_vp->im_strides); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":359 - * vp.copy_into(vp.vp_pos, v_pos, vi, vj, 3, vp.vp_strides) - * vp.copy_into(vp.image, rgba, vi, vj, 3, vp.im_strides) - * self.integrate_ray(v_pos, vp.vp_dir, rgba, tf) # <<<<<<<<<<<<<< - * vp.copy_back(rgba, vp.image, vi, vj, 3, vp.im_strides) - * else: - */ - ((struct __pyx_vtabstruct_2yt_9amr_utils_PartitionedGrid *)((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->__pyx_vtab)->integrate_ray(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self), __pyx_v_v_pos, __pyx_v_vp->vp_dir, __pyx_v_rgba, __pyx_v_tf); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":360 - * vp.copy_into(vp.image, rgba, vi, vj, 3, vp.im_strides) - * self.integrate_ray(v_pos, vp.vp_dir, rgba, tf) - * vp.copy_back(rgba, vp.image, vi, vj, 3, vp.im_strides) # <<<<<<<<<<<<<< - * else: - * # If we do not have an orthographic projection, we have to cast all - */ - ((struct __pyx_vtabstruct_2yt_9amr_utils_VectorPlane *)__pyx_v_vp->__pyx_vtab)->copy_back(__pyx_v_vp, __pyx_v_rgba, __pyx_v_vp->image, __pyx_v_vi, __pyx_v_vj, 3, __pyx_v_vp->im_strides); - } - } - goto __pyx_L6; - } - /*else*/ { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":364 - * # If we do not have an orthographic projection, we have to cast all - * # our rays (until we can get an extrema calculation...) - * for vi in range(vp.nv[0]): # <<<<<<<<<<<<<< - * for vj in range(vp.nv[1]): - * vp.copy_into(vp.vp_pos, v_pos, vi, vj, 3, vp.vp_strides) - */ - __pyx_t_2 = (__pyx_v_vp->nv[0]); - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_vi = __pyx_t_3; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":365 - * # our rays (until we can get an extrema calculation...) - * for vi in range(vp.nv[0]): - * for vj in range(vp.nv[1]): # <<<<<<<<<<<<<< - * vp.copy_into(vp.vp_pos, v_pos, vi, vj, 3, vp.vp_strides) - * vp.copy_into(vp.image, rgba, vi, vj, 3, vp.im_strides) - */ - __pyx_t_4 = (__pyx_v_vp->nv[1]); - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_vj = __pyx_t_5; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":366 - * for vi in range(vp.nv[0]): - * for vj in range(vp.nv[1]): - * vp.copy_into(vp.vp_pos, v_pos, vi, vj, 3, vp.vp_strides) # <<<<<<<<<<<<<< - * vp.copy_into(vp.image, rgba, vi, vj, 3, vp.im_strides) - * vp.copy_into(vp.vp_dir, v_dir, vi, vj, 3, vp.vd_strides) - */ - ((struct __pyx_vtabstruct_2yt_9amr_utils_VectorPlane *)__pyx_v_vp->__pyx_vtab)->copy_into(__pyx_v_vp, __pyx_v_vp->vp_pos, __pyx_v_v_pos, __pyx_v_vi, __pyx_v_vj, 3, __pyx_v_vp->vp_strides); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":367 - * for vj in range(vp.nv[1]): - * vp.copy_into(vp.vp_pos, v_pos, vi, vj, 3, vp.vp_strides) - * vp.copy_into(vp.image, rgba, vi, vj, 3, vp.im_strides) # <<<<<<<<<<<<<< - * vp.copy_into(vp.vp_dir, v_dir, vi, vj, 3, vp.vd_strides) - * self.integrate_ray(v_pos, v_dir, rgba, tf) - */ - ((struct __pyx_vtabstruct_2yt_9amr_utils_VectorPlane *)__pyx_v_vp->__pyx_vtab)->copy_into(__pyx_v_vp, __pyx_v_vp->image, __pyx_v_rgba, __pyx_v_vi, __pyx_v_vj, 3, __pyx_v_vp->im_strides); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":368 - * vp.copy_into(vp.vp_pos, v_pos, vi, vj, 3, vp.vp_strides) - * vp.copy_into(vp.image, rgba, vi, vj, 3, vp.im_strides) - * vp.copy_into(vp.vp_dir, v_dir, vi, vj, 3, vp.vd_strides) # <<<<<<<<<<<<<< - * self.integrate_ray(v_pos, v_dir, rgba, tf) - * vp.copy_back(rgba, vp.image, vi, vj, 3, vp.im_strides) - */ - ((struct __pyx_vtabstruct_2yt_9amr_utils_VectorPlane *)__pyx_v_vp->__pyx_vtab)->copy_into(__pyx_v_vp, __pyx_v_vp->vp_dir, __pyx_v_v_dir, __pyx_v_vi, __pyx_v_vj, 3, __pyx_v_vp->vd_strides); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":369 - * vp.copy_into(vp.image, rgba, vi, vj, 3, vp.im_strides) - * vp.copy_into(vp.vp_dir, v_dir, vi, vj, 3, vp.vd_strides) - * self.integrate_ray(v_pos, v_dir, rgba, tf) # <<<<<<<<<<<<<< - * vp.copy_back(rgba, vp.image, vi, vj, 3, vp.im_strides) - * return hit - */ - ((struct __pyx_vtabstruct_2yt_9amr_utils_PartitionedGrid *)((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->__pyx_vtab)->integrate_ray(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self), __pyx_v_v_pos, __pyx_v_v_dir, __pyx_v_rgba, __pyx_v_tf); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":370 - * vp.copy_into(vp.vp_dir, v_dir, vi, vj, 3, vp.vd_strides) - * self.integrate_ray(v_pos, v_dir, rgba, tf) - * vp.copy_back(rgba, vp.image, vi, vj, 3, vp.im_strides) # <<<<<<<<<<<<<< - * return hit - * - */ - ((struct __pyx_vtabstruct_2yt_9amr_utils_VectorPlane *)__pyx_v_vp->__pyx_vtab)->copy_back(__pyx_v_vp, __pyx_v_rgba, __pyx_v_vp->image, __pyx_v_vi, __pyx_v_vj, 3, __pyx_v_vp->im_strides); - } - } - } - __pyx_L6:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":371 - * self.integrate_ray(v_pos, v_dir, rgba, tf) - * vp.copy_back(rgba, vp.image, vi, vj, 3, vp.im_strides) - * return hit # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = PyInt_FromLong(__pyx_v_hit); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("yt.amr_utils.PartitionedGrid.cast_plane"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":375 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef void calculate_extent(self, VectorPlane vp, # <<<<<<<<<<<<<< - * np.float64_t extrema[4]): - * # We do this for all eight corners - */ - -static void __pyx_f_2yt_9amr_utils_15PartitionedGrid_calculate_extent(struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *__pyx_v_self, struct __pyx_obj_2yt_9amr_utils_VectorPlane *__pyx_v_vp, __pyx_t_5numpy_float64_t *__pyx_v_extrema) { - __pyx_t_5numpy_float64_t *__pyx_v_edges[2]; - __pyx_t_5numpy_float64_t __pyx_v_temp; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - double __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - __Pyx_RefNannySetupContext("calculate_extent"); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":379 - * # We do this for all eight corners - * cdef np.float64_t *edges[2], temp - * edges[0] = self.left_edge # <<<<<<<<<<<<<< - * edges[1] = self.right_edge - * extrema[0] = extrema[2] = 1e300; extrema[1] = extrema[3] = -1e300 - */ - (__pyx_v_edges[0]) = __pyx_v_self->left_edge; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":380 - * cdef np.float64_t *edges[2], temp - * edges[0] = self.left_edge - * edges[1] = self.right_edge # <<<<<<<<<<<<<< - * extrema[0] = extrema[2] = 1e300; extrema[1] = extrema[3] = -1e300 - * cdef int i, j, k - */ - (__pyx_v_edges[1]) = __pyx_v_self->right_edge; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":381 - * edges[0] = self.left_edge - * edges[1] = self.right_edge - * extrema[0] = extrema[2] = 1e300; extrema[1] = extrema[3] = -1e300 # <<<<<<<<<<<<<< - * cdef int i, j, k - * for i in range(2): - */ - (__pyx_v_extrema[0]) = 1e300; - (__pyx_v_extrema[2]) = 1e300; - __pyx_t_1 = (-1e300); - (__pyx_v_extrema[1]) = __pyx_t_1; - (__pyx_v_extrema[3]) = __pyx_t_1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":383 - * extrema[0] = extrema[2] = 1e300; extrema[1] = extrema[3] = -1e300 - * cdef int i, j, k - * for i in range(2): # <<<<<<<<<<<<<< - * for j in range(2): - * for k in range(2): - */ - for (__pyx_t_2 = 0; __pyx_t_2 < 2; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":384 - * cdef int i, j, k - * for i in range(2): - * for j in range(2): # <<<<<<<<<<<<<< - * for k in range(2): - * # This should rotate it into the vector plane - */ - for (__pyx_t_3 = 0; __pyx_t_3 < 2; __pyx_t_3+=1) { - __pyx_v_j = __pyx_t_3; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":385 - * for i in range(2): - * for j in range(2): - * for k in range(2): # <<<<<<<<<<<<<< - * # This should rotate it into the vector plane - * temp = edges[i][0] * vp.x_vec[0] - */ - for (__pyx_t_4 = 0; __pyx_t_4 < 2; __pyx_t_4+=1) { - __pyx_v_k = __pyx_t_4; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":387 - * for k in range(2): - * # This should rotate it into the vector plane - * temp = edges[i][0] * vp.x_vec[0] # <<<<<<<<<<<<<< - * temp += edges[j][1] * vp.x_vec[1] - * temp += edges[k][2] * vp.x_vec[2] - */ - __pyx_v_temp = (((__pyx_v_edges[__pyx_v_i])[0]) * (__pyx_v_vp->x_vec[0])); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":388 - * # This should rotate it into the vector plane - * temp = edges[i][0] * vp.x_vec[0] - * temp += edges[j][1] * vp.x_vec[1] # <<<<<<<<<<<<<< - * temp += edges[k][2] * vp.x_vec[2] - * if temp < extrema[0]: extrema[0] = temp - */ - __pyx_v_temp += (((__pyx_v_edges[__pyx_v_j])[1]) * (__pyx_v_vp->x_vec[1])); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":389 - * temp = edges[i][0] * vp.x_vec[0] - * temp += edges[j][1] * vp.x_vec[1] - * temp += edges[k][2] * vp.x_vec[2] # <<<<<<<<<<<<<< - * if temp < extrema[0]: extrema[0] = temp - * if temp > extrema[1]: extrema[1] = temp - */ - __pyx_v_temp += (((__pyx_v_edges[__pyx_v_k])[2]) * (__pyx_v_vp->x_vec[2])); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":390 - * temp += edges[j][1] * vp.x_vec[1] - * temp += edges[k][2] * vp.x_vec[2] - * if temp < extrema[0]: extrema[0] = temp # <<<<<<<<<<<<<< - * if temp > extrema[1]: extrema[1] = temp - * temp = edges[i][0] * vp.y_vec[0] - */ - __pyx_t_5 = (__pyx_v_temp < (__pyx_v_extrema[0])); - if (__pyx_t_5) { - (__pyx_v_extrema[0]) = __pyx_v_temp; - goto __pyx_L9; - } - __pyx_L9:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":391 - * temp += edges[k][2] * vp.x_vec[2] - * if temp < extrema[0]: extrema[0] = temp - * if temp > extrema[1]: extrema[1] = temp # <<<<<<<<<<<<<< - * temp = edges[i][0] * vp.y_vec[0] - * temp += edges[j][1] * vp.y_vec[1] - */ - __pyx_t_5 = (__pyx_v_temp > (__pyx_v_extrema[1])); - if (__pyx_t_5) { - (__pyx_v_extrema[1]) = __pyx_v_temp; - goto __pyx_L10; - } - __pyx_L10:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":392 - * if temp < extrema[0]: extrema[0] = temp - * if temp > extrema[1]: extrema[1] = temp - * temp = edges[i][0] * vp.y_vec[0] # <<<<<<<<<<<<<< - * temp += edges[j][1] * vp.y_vec[1] - * temp += edges[k][2] * vp.y_vec[2] - */ - __pyx_v_temp = (((__pyx_v_edges[__pyx_v_i])[0]) * (__pyx_v_vp->y_vec[0])); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":393 - * if temp > extrema[1]: extrema[1] = temp - * temp = edges[i][0] * vp.y_vec[0] - * temp += edges[j][1] * vp.y_vec[1] # <<<<<<<<<<<<<< - * temp += edges[k][2] * vp.y_vec[2] - * if temp < extrema[2]: extrema[2] = temp - */ - __pyx_v_temp += (((__pyx_v_edges[__pyx_v_j])[1]) * (__pyx_v_vp->y_vec[1])); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":394 - * temp = edges[i][0] * vp.y_vec[0] - * temp += edges[j][1] * vp.y_vec[1] - * temp += edges[k][2] * vp.y_vec[2] # <<<<<<<<<<<<<< - * if temp < extrema[2]: extrema[2] = temp - * if temp > extrema[3]: extrema[3] = temp - */ - __pyx_v_temp += (((__pyx_v_edges[__pyx_v_k])[2]) * (__pyx_v_vp->y_vec[2])); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":395 - * temp += edges[j][1] * vp.y_vec[1] - * temp += edges[k][2] * vp.y_vec[2] - * if temp < extrema[2]: extrema[2] = temp # <<<<<<<<<<<<<< - * if temp > extrema[3]: extrema[3] = temp - * #print extrema[0], extrema[1], extrema[2], extrema[3] - */ - __pyx_t_5 = (__pyx_v_temp < (__pyx_v_extrema[2])); - if (__pyx_t_5) { - (__pyx_v_extrema[2]) = __pyx_v_temp; - goto __pyx_L11; - } - __pyx_L11:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":396 - * temp += edges[k][2] * vp.y_vec[2] - * if temp < extrema[2]: extrema[2] = temp - * if temp > extrema[3]: extrema[3] = temp # <<<<<<<<<<<<<< - * #print extrema[0], extrema[1], extrema[2], extrema[3] - * - */ - __pyx_t_5 = (__pyx_v_temp > (__pyx_v_extrema[3])); - if (__pyx_t_5) { - (__pyx_v_extrema[3]) = __pyx_v_temp; - goto __pyx_L12; - } - __pyx_L12:; - } - } - } - - __Pyx_RefNannyFinishContext(); -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":401 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef int integrate_ray(self, np.float64_t v_pos[3], # <<<<<<<<<<<<<< - * np.float64_t v_dir[3], - * np.float64_t rgba[4], - */ - -static int __pyx_f_2yt_9amr_utils_15PartitionedGrid_integrate_ray(struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *__pyx_v_self, __pyx_t_5numpy_float64_t *__pyx_v_v_pos, __pyx_t_5numpy_float64_t *__pyx_v_v_dir, __pyx_t_5numpy_float64_t *__pyx_v_rgba, struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *__pyx_v_tf) { - int __pyx_v_cur_ind[3]; - int __pyx_v_step[3]; - int __pyx_v_x; - int __pyx_v_y; - int __pyx_v_i; - int __pyx_v_hit; - int __pyx_v_direction; - __pyx_t_5numpy_float64_t __pyx_v_intersect_t; - __pyx_t_5numpy_float64_t __pyx_v_iv_dir[3]; - __pyx_t_5numpy_float64_t __pyx_v_intersect[3]; - __pyx_t_5numpy_float64_t __pyx_v_tmax[3]; - __pyx_t_5numpy_float64_t __pyx_v_tdelta[3]; - __pyx_t_5numpy_float64_t __pyx_v_enter_t; - __pyx_t_5numpy_float64_t __pyx_v_exit_t; - __pyx_t_5numpy_float64_t __pyx_v_tr; - __pyx_t_5numpy_float64_t __pyx_v_tl; - __pyx_t_5numpy_float64_t __pyx_v_temp_x; - __pyx_t_5numpy_float64_t __pyx_v_temp_y; - int __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - __pyx_t_5numpy_float64_t __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - __Pyx_RefNannySetupContext("integrate_ray"); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":406 - * TransferFunctionProxy tf): - * cdef int cur_ind[3], step[3], x, y, i, n, flat_ind, hit, direction - * cdef np.float64_t intersect_t = 1.0 # <<<<<<<<<<<<<< - * cdef np.float64_t iv_dir[3] - * cdef np.float64_t intersect[3], tmax[3], tdelta[3] - */ - __pyx_v_intersect_t = 1.0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":411 - * cdef np.float64_t enter_t, dist, alpha, dt, exit_t - * cdef np.float64_t tr, tl, temp_x, temp_y, dv - * for i in range(3): # <<<<<<<<<<<<<< - * if (v_dir[i] < 0): - * step[i] = -1 - */ - for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":412 - * cdef np.float64_t tr, tl, temp_x, temp_y, dv - * for i in range(3): - * if (v_dir[i] < 0): # <<<<<<<<<<<<<< - * step[i] = -1 - * elif (v_dir[i] == 0): - */ - __pyx_t_2 = ((__pyx_v_v_dir[__pyx_v_i]) < 0.0); - if (__pyx_t_2) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":413 - * for i in range(3): - * if (v_dir[i] < 0): - * step[i] = -1 # <<<<<<<<<<<<<< - * elif (v_dir[i] == 0): - * step[i] = 1 - */ - (__pyx_v_step[__pyx_v_i]) = -1; - goto __pyx_L5; - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":414 - * if (v_dir[i] < 0): - * step[i] = -1 - * elif (v_dir[i] == 0): # <<<<<<<<<<<<<< - * step[i] = 1 - * tmax[i] = 1e60 - */ - __pyx_t_2 = ((__pyx_v_v_dir[__pyx_v_i]) == 0.0); - if (__pyx_t_2) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":415 - * step[i] = -1 - * elif (v_dir[i] == 0): - * step[i] = 1 # <<<<<<<<<<<<<< - * tmax[i] = 1e60 - * iv_dir[i] = 1e60 - */ - (__pyx_v_step[__pyx_v_i]) = 1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":416 - * elif (v_dir[i] == 0): - * step[i] = 1 - * tmax[i] = 1e60 # <<<<<<<<<<<<<< - * iv_dir[i] = 1e60 - * tdelta[i] = 1e-60 - */ - (__pyx_v_tmax[__pyx_v_i]) = 1e60; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":417 - * step[i] = 1 - * tmax[i] = 1e60 - * iv_dir[i] = 1e60 # <<<<<<<<<<<<<< - * tdelta[i] = 1e-60 - * continue - */ - (__pyx_v_iv_dir[__pyx_v_i]) = 1e60; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":418 - * tmax[i] = 1e60 - * iv_dir[i] = 1e60 - * tdelta[i] = 1e-60 # <<<<<<<<<<<<<< - * continue - * else: - */ - (__pyx_v_tdelta[__pyx_v_i]) = 1e-60; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":419 - * iv_dir[i] = 1e60 - * tdelta[i] = 1e-60 - * continue # <<<<<<<<<<<<<< - * else: - * step[i] = 1 - */ - goto __pyx_L3_continue; - goto __pyx_L5; - } - /*else*/ { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":421 - * continue - * else: - * step[i] = 1 # <<<<<<<<<<<<<< - * x = (i+1) % 3 - * y = (i+2) % 3 - */ - (__pyx_v_step[__pyx_v_i]) = 1; - } - __pyx_L5:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":422 - * else: - * step[i] = 1 - * x = (i+1) % 3 # <<<<<<<<<<<<<< - * y = (i+2) % 3 - * iv_dir[i] = 1.0/v_dir[i] - */ - __pyx_v_x = __Pyx_mod_long((__pyx_v_i + 1), 3); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":423 - * step[i] = 1 - * x = (i+1) % 3 - * y = (i+2) % 3 # <<<<<<<<<<<<<< - * iv_dir[i] = 1.0/v_dir[i] - * tl = (self.left_edge[i] - v_pos[i])*iv_dir[i] - */ - __pyx_v_y = __Pyx_mod_long((__pyx_v_i + 2), 3); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":424 - * x = (i+1) % 3 - * y = (i+2) % 3 - * iv_dir[i] = 1.0/v_dir[i] # <<<<<<<<<<<<<< - * tl = (self.left_edge[i] - v_pos[i])*iv_dir[i] - * temp_x = (v_pos[x] + tl*v_dir[x]) - */ - __pyx_t_3 = (__pyx_v_v_dir[__pyx_v_i]); - if (unlikely(__pyx_t_3 == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - (__pyx_v_iv_dir[__pyx_v_i]) = (1.0 / __pyx_t_3); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":425 - * y = (i+2) % 3 - * iv_dir[i] = 1.0/v_dir[i] - * tl = (self.left_edge[i] - v_pos[i])*iv_dir[i] # <<<<<<<<<<<<<< - * temp_x = (v_pos[x] + tl*v_dir[x]) - * temp_y = (v_pos[y] + tl*v_dir[y]) - */ - __pyx_v_tl = (((__pyx_v_self->left_edge[__pyx_v_i]) - (__pyx_v_v_pos[__pyx_v_i])) * (__pyx_v_iv_dir[__pyx_v_i])); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":426 - * iv_dir[i] = 1.0/v_dir[i] - * tl = (self.left_edge[i] - v_pos[i])*iv_dir[i] - * temp_x = (v_pos[x] + tl*v_dir[x]) # <<<<<<<<<<<<<< - * temp_y = (v_pos[y] + tl*v_dir[y]) - * if self.left_edge[x] <= temp_x and temp_x <= self.right_edge[x] and \ - */ - __pyx_v_temp_x = ((__pyx_v_v_pos[__pyx_v_x]) + (__pyx_v_tl * (__pyx_v_v_dir[__pyx_v_x]))); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":427 - * tl = (self.left_edge[i] - v_pos[i])*iv_dir[i] - * temp_x = (v_pos[x] + tl*v_dir[x]) - * temp_y = (v_pos[y] + tl*v_dir[y]) # <<<<<<<<<<<<<< - * if self.left_edge[x] <= temp_x and temp_x <= self.right_edge[x] and \ - * self.left_edge[y] <= temp_y and temp_y <= self.right_edge[y] and \ - */ - __pyx_v_temp_y = ((__pyx_v_v_pos[__pyx_v_y]) + (__pyx_v_tl * (__pyx_v_v_dir[__pyx_v_y]))); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":428 - * temp_x = (v_pos[x] + tl*v_dir[x]) - * temp_y = (v_pos[y] + tl*v_dir[y]) - * if self.left_edge[x] <= temp_x and temp_x <= self.right_edge[x] and \ # <<<<<<<<<<<<<< - * self.left_edge[y] <= temp_y and temp_y <= self.right_edge[y] and \ - * 0.0 <= tl and tl < intersect_t: - */ - __pyx_t_2 = ((__pyx_v_self->left_edge[__pyx_v_x]) <= __pyx_v_temp_x); - if (__pyx_t_2) { - __pyx_t_4 = (__pyx_v_temp_x <= (__pyx_v_self->right_edge[__pyx_v_x])); - if (__pyx_t_4) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":429 - * temp_y = (v_pos[y] + tl*v_dir[y]) - * if self.left_edge[x] <= temp_x and temp_x <= self.right_edge[x] and \ - * self.left_edge[y] <= temp_y and temp_y <= self.right_edge[y] and \ # <<<<<<<<<<<<<< - * 0.0 <= tl and tl < intersect_t: - * direction = i - */ - __pyx_t_5 = ((__pyx_v_self->left_edge[__pyx_v_y]) <= __pyx_v_temp_y); - if (__pyx_t_5) { - __pyx_t_6 = (__pyx_v_temp_y <= (__pyx_v_self->right_edge[__pyx_v_y])); - if (__pyx_t_6) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":430 - * if self.left_edge[x] <= temp_x and temp_x <= self.right_edge[x] and \ - * self.left_edge[y] <= temp_y and temp_y <= self.right_edge[y] and \ - * 0.0 <= tl and tl < intersect_t: # <<<<<<<<<<<<<< - * direction = i - * intersect_t = tl - */ - __pyx_t_7 = (0.0 <= __pyx_v_tl); - if (__pyx_t_7) { - __pyx_t_8 = (__pyx_v_tl < __pyx_v_intersect_t); - __pyx_t_9 = __pyx_t_8; - } else { - __pyx_t_9 = __pyx_t_7; - } - __pyx_t_7 = __pyx_t_9; - } else { - __pyx_t_7 = __pyx_t_6; - } - __pyx_t_6 = __pyx_t_7; - } else { - __pyx_t_6 = __pyx_t_5; - } - __pyx_t_5 = __pyx_t_6; - } else { - __pyx_t_5 = __pyx_t_4; - } - __pyx_t_4 = __pyx_t_5; - } else { - __pyx_t_4 = __pyx_t_2; - } - if (__pyx_t_4) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":431 - * self.left_edge[y] <= temp_y and temp_y <= self.right_edge[y] and \ - * 0.0 <= tl and tl < intersect_t: - * direction = i # <<<<<<<<<<<<<< - * intersect_t = tl - * tr = (self.right_edge[i] - v_pos[i])*iv_dir[i] - */ - __pyx_v_direction = __pyx_v_i; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":432 - * 0.0 <= tl and tl < intersect_t: - * direction = i - * intersect_t = tl # <<<<<<<<<<<<<< - * tr = (self.right_edge[i] - v_pos[i])*iv_dir[i] - * temp_x = (v_pos[x] + tr*v_dir[x]) - */ - __pyx_v_intersect_t = __pyx_v_tl; - goto __pyx_L6; - } - __pyx_L6:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":433 - * direction = i - * intersect_t = tl - * tr = (self.right_edge[i] - v_pos[i])*iv_dir[i] # <<<<<<<<<<<<<< - * temp_x = (v_pos[x] + tr*v_dir[x]) - * temp_y = (v_pos[y] + tr*v_dir[y]) - */ - __pyx_v_tr = (((__pyx_v_self->right_edge[__pyx_v_i]) - (__pyx_v_v_pos[__pyx_v_i])) * (__pyx_v_iv_dir[__pyx_v_i])); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":434 - * intersect_t = tl - * tr = (self.right_edge[i] - v_pos[i])*iv_dir[i] - * temp_x = (v_pos[x] + tr*v_dir[x]) # <<<<<<<<<<<<<< - * temp_y = (v_pos[y] + tr*v_dir[y]) - * if self.left_edge[x] <= temp_x and temp_x <= self.right_edge[x] and \ - */ - __pyx_v_temp_x = ((__pyx_v_v_pos[__pyx_v_x]) + (__pyx_v_tr * (__pyx_v_v_dir[__pyx_v_x]))); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":435 - * tr = (self.right_edge[i] - v_pos[i])*iv_dir[i] - * temp_x = (v_pos[x] + tr*v_dir[x]) - * temp_y = (v_pos[y] + tr*v_dir[y]) # <<<<<<<<<<<<<< - * if self.left_edge[x] <= temp_x and temp_x <= self.right_edge[x] and \ - * self.left_edge[y] <= temp_y and temp_y <= self.right_edge[y] and \ - */ - __pyx_v_temp_y = ((__pyx_v_v_pos[__pyx_v_y]) + (__pyx_v_tr * (__pyx_v_v_dir[__pyx_v_y]))); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":436 - * temp_x = (v_pos[x] + tr*v_dir[x]) - * temp_y = (v_pos[y] + tr*v_dir[y]) - * if self.left_edge[x] <= temp_x and temp_x <= self.right_edge[x] and \ # <<<<<<<<<<<<<< - * self.left_edge[y] <= temp_y and temp_y <= self.right_edge[y] and \ - * 0.0 <= tr and tr < intersect_t: - */ - __pyx_t_4 = ((__pyx_v_self->left_edge[__pyx_v_x]) <= __pyx_v_temp_x); - if (__pyx_t_4) { - __pyx_t_2 = (__pyx_v_temp_x <= (__pyx_v_self->right_edge[__pyx_v_x])); - if (__pyx_t_2) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":437 - * temp_y = (v_pos[y] + tr*v_dir[y]) - * if self.left_edge[x] <= temp_x and temp_x <= self.right_edge[x] and \ - * self.left_edge[y] <= temp_y and temp_y <= self.right_edge[y] and \ # <<<<<<<<<<<<<< - * 0.0 <= tr and tr < intersect_t: - * direction = i - */ - __pyx_t_5 = ((__pyx_v_self->left_edge[__pyx_v_y]) <= __pyx_v_temp_y); - if (__pyx_t_5) { - __pyx_t_6 = (__pyx_v_temp_y <= (__pyx_v_self->right_edge[__pyx_v_y])); - if (__pyx_t_6) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":438 - * if self.left_edge[x] <= temp_x and temp_x <= self.right_edge[x] and \ - * self.left_edge[y] <= temp_y and temp_y <= self.right_edge[y] and \ - * 0.0 <= tr and tr < intersect_t: # <<<<<<<<<<<<<< - * direction = i - * intersect_t = tr - */ - __pyx_t_7 = (0.0 <= __pyx_v_tr); - if (__pyx_t_7) { - __pyx_t_9 = (__pyx_v_tr < __pyx_v_intersect_t); - __pyx_t_8 = __pyx_t_9; - } else { - __pyx_t_8 = __pyx_t_7; - } - __pyx_t_7 = __pyx_t_8; - } else { - __pyx_t_7 = __pyx_t_6; - } - __pyx_t_6 = __pyx_t_7; - } else { - __pyx_t_6 = __pyx_t_5; - } - __pyx_t_5 = __pyx_t_6; - } else { - __pyx_t_5 = __pyx_t_2; - } - __pyx_t_2 = __pyx_t_5; - } else { - __pyx_t_2 = __pyx_t_4; - } - if (__pyx_t_2) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":439 - * self.left_edge[y] <= temp_y and temp_y <= self.right_edge[y] and \ - * 0.0 <= tr and tr < intersect_t: - * direction = i # <<<<<<<<<<<<<< - * intersect_t = tr - * if self.left_edge[0] <= v_pos[0] and v_pos[0] <= self.right_edge[0] and \ - */ - __pyx_v_direction = __pyx_v_i; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":440 - * 0.0 <= tr and tr < intersect_t: - * direction = i - * intersect_t = tr # <<<<<<<<<<<<<< - * if self.left_edge[0] <= v_pos[0] and v_pos[0] <= self.right_edge[0] and \ - * self.left_edge[1] <= v_pos[1] and v_pos[1] <= self.right_edge[1] and \ - */ - __pyx_v_intersect_t = __pyx_v_tr; - goto __pyx_L7; - } - __pyx_L7:; - __pyx_L3_continue:; - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":441 - * direction = i - * intersect_t = tr - * if self.left_edge[0] <= v_pos[0] and v_pos[0] <= self.right_edge[0] and \ # <<<<<<<<<<<<<< - * self.left_edge[1] <= v_pos[1] and v_pos[1] <= self.right_edge[1] and \ - * self.left_edge[2] <= v_pos[2] and v_pos[2] <= self.right_edge[2]: - */ - __pyx_t_2 = ((__pyx_v_self->left_edge[0]) <= (__pyx_v_v_pos[0])); - if (__pyx_t_2) { - __pyx_t_4 = ((__pyx_v_v_pos[0]) <= (__pyx_v_self->right_edge[0])); - if (__pyx_t_4) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":442 - * intersect_t = tr - * if self.left_edge[0] <= v_pos[0] and v_pos[0] <= self.right_edge[0] and \ - * self.left_edge[1] <= v_pos[1] and v_pos[1] <= self.right_edge[1] and \ # <<<<<<<<<<<<<< - * self.left_edge[2] <= v_pos[2] and v_pos[2] <= self.right_edge[2]: - * intersect_t = 0.0 - */ - __pyx_t_5 = ((__pyx_v_self->left_edge[1]) <= (__pyx_v_v_pos[1])); - if (__pyx_t_5) { - __pyx_t_6 = ((__pyx_v_v_pos[1]) <= (__pyx_v_self->right_edge[1])); - if (__pyx_t_6) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":443 - * if self.left_edge[0] <= v_pos[0] and v_pos[0] <= self.right_edge[0] and \ - * self.left_edge[1] <= v_pos[1] and v_pos[1] <= self.right_edge[1] and \ - * self.left_edge[2] <= v_pos[2] and v_pos[2] <= self.right_edge[2]: # <<<<<<<<<<<<<< - * intersect_t = 0.0 - * if not ((0.0 <= intersect_t) and (intersect_t < 1.0)): return 0 - */ - __pyx_t_7 = ((__pyx_v_self->left_edge[2]) <= (__pyx_v_v_pos[2])); - if (__pyx_t_7) { - __pyx_t_8 = ((__pyx_v_v_pos[2]) <= (__pyx_v_self->right_edge[2])); - __pyx_t_9 = __pyx_t_8; - } else { - __pyx_t_9 = __pyx_t_7; - } - __pyx_t_7 = __pyx_t_9; - } else { - __pyx_t_7 = __pyx_t_6; - } - __pyx_t_6 = __pyx_t_7; - } else { - __pyx_t_6 = __pyx_t_5; - } - __pyx_t_5 = __pyx_t_6; - } else { - __pyx_t_5 = __pyx_t_4; - } - __pyx_t_4 = __pyx_t_5; - } else { - __pyx_t_4 = __pyx_t_2; - } - if (__pyx_t_4) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":444 - * self.left_edge[1] <= v_pos[1] and v_pos[1] <= self.right_edge[1] and \ - * self.left_edge[2] <= v_pos[2] and v_pos[2] <= self.right_edge[2]: - * intersect_t = 0.0 # <<<<<<<<<<<<<< - * if not ((0.0 <= intersect_t) and (intersect_t < 1.0)): return 0 - * for i in range(3): - */ - __pyx_v_intersect_t = 0.0; - goto __pyx_L8; - } - __pyx_L8:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":445 - * self.left_edge[2] <= v_pos[2] and v_pos[2] <= self.right_edge[2]: - * intersect_t = 0.0 - * if not ((0.0 <= intersect_t) and (intersect_t < 1.0)): return 0 # <<<<<<<<<<<<<< - * for i in range(3): - * intersect[i] = v_pos[i] + intersect_t * v_dir[i] - */ - __pyx_t_4 = (0.0 <= __pyx_v_intersect_t); - if (__pyx_t_4) { - __pyx_t_2 = (__pyx_v_intersect_t < 1.0); - __pyx_t_5 = __pyx_t_2; - } else { - __pyx_t_5 = __pyx_t_4; - } - __pyx_t_4 = (!__pyx_t_5); - if (__pyx_t_4) { - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L9; - } - __pyx_L9:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":446 - * intersect_t = 0.0 - * if not ((0.0 <= intersect_t) and (intersect_t < 1.0)): return 0 - * for i in range(3): # <<<<<<<<<<<<<< - * intersect[i] = v_pos[i] + intersect_t * v_dir[i] - * cur_ind[i] = floor((intersect[i] + - */ - for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":447 - * if not ((0.0 <= intersect_t) and (intersect_t < 1.0)): return 0 - * for i in range(3): - * intersect[i] = v_pos[i] + intersect_t * v_dir[i] # <<<<<<<<<<<<<< - * cur_ind[i] = floor((intersect[i] + - * step[i]*1e-8*self.dds[i] - - */ - (__pyx_v_intersect[__pyx_v_i]) = ((__pyx_v_v_pos[__pyx_v_i]) + (__pyx_v_intersect_t * (__pyx_v_v_dir[__pyx_v_i]))); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":448 - * for i in range(3): - * intersect[i] = v_pos[i] + intersect_t * v_dir[i] - * cur_ind[i] = floor((intersect[i] + # <<<<<<<<<<<<<< - * step[i]*1e-8*self.dds[i] - - * self.left_edge[i])*self.idds[i]) - */ - (__pyx_v_cur_ind[__pyx_v_i]) = ((int)floor(((((__pyx_v_intersect[__pyx_v_i]) + (((__pyx_v_step[__pyx_v_i]) * 1e-8) * (__pyx_v_self->dds[__pyx_v_i]))) - (__pyx_v_self->left_edge[__pyx_v_i])) * (__pyx_v_self->idds[__pyx_v_i])))); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":451 - * step[i]*1e-8*self.dds[i] - - * self.left_edge[i])*self.idds[i]) - * tmax[i] = (((cur_ind[i]+step[i])*self.dds[i])+ # <<<<<<<<<<<<<< - * self.left_edge[i]-v_pos[i])*iv_dir[i] - * # This deals with the asymmetry in having our indices refer to the - */ - (__pyx_v_tmax[__pyx_v_i]) = ((((((__pyx_v_cur_ind[__pyx_v_i]) + (__pyx_v_step[__pyx_v_i])) * (__pyx_v_self->dds[__pyx_v_i])) + (__pyx_v_self->left_edge[__pyx_v_i])) - (__pyx_v_v_pos[__pyx_v_i])) * (__pyx_v_iv_dir[__pyx_v_i])); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":456 - * # left edge of a cell, but the right edge of the brick being one - * # extra zone out. - * if cur_ind[i] == self.dims[i] and step[i] < 0: # <<<<<<<<<<<<<< - * cur_ind[i] = self.dims[i] - 1 - * if cur_ind[i] < 0 or cur_ind[i] >= self.dims[i]: return 0 - */ - __pyx_t_4 = ((__pyx_v_cur_ind[__pyx_v_i]) == (__pyx_v_self->dims[__pyx_v_i])); - if (__pyx_t_4) { - __pyx_t_5 = ((__pyx_v_step[__pyx_v_i]) < 0); - __pyx_t_2 = __pyx_t_5; - } else { - __pyx_t_2 = __pyx_t_4; - } - if (__pyx_t_2) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":457 - * # extra zone out. - * if cur_ind[i] == self.dims[i] and step[i] < 0: - * cur_ind[i] = self.dims[i] - 1 # <<<<<<<<<<<<<< - * if cur_ind[i] < 0 or cur_ind[i] >= self.dims[i]: return 0 - * if step[i] > 0: - */ - (__pyx_v_cur_ind[__pyx_v_i]) = ((__pyx_v_self->dims[__pyx_v_i]) - 1); - goto __pyx_L12; - } - __pyx_L12:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":458 - * if cur_ind[i] == self.dims[i] and step[i] < 0: - * cur_ind[i] = self.dims[i] - 1 - * if cur_ind[i] < 0 or cur_ind[i] >= self.dims[i]: return 0 # <<<<<<<<<<<<<< - * if step[i] > 0: - * tmax[i] = (((cur_ind[i]+1)*self.dds[i]) - */ - __pyx_t_2 = ((__pyx_v_cur_ind[__pyx_v_i]) < 0); - if (!__pyx_t_2) { - __pyx_t_4 = ((__pyx_v_cur_ind[__pyx_v_i]) >= (__pyx_v_self->dims[__pyx_v_i])); - __pyx_t_5 = __pyx_t_4; - } else { - __pyx_t_5 = __pyx_t_2; - } - if (__pyx_t_5) { - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L13; - } - __pyx_L13:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":459 - * cur_ind[i] = self.dims[i] - 1 - * if cur_ind[i] < 0 or cur_ind[i] >= self.dims[i]: return 0 - * if step[i] > 0: # <<<<<<<<<<<<<< - * tmax[i] = (((cur_ind[i]+1)*self.dds[i]) - * +self.left_edge[i]-v_pos[i])*iv_dir[i] - */ - __pyx_t_5 = ((__pyx_v_step[__pyx_v_i]) > 0); - if (__pyx_t_5) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":460 - * if cur_ind[i] < 0 or cur_ind[i] >= self.dims[i]: return 0 - * if step[i] > 0: - * tmax[i] = (((cur_ind[i]+1)*self.dds[i]) # <<<<<<<<<<<<<< - * +self.left_edge[i]-v_pos[i])*iv_dir[i] - * if step[i] < 0: - */ - (__pyx_v_tmax[__pyx_v_i]) = ((((((__pyx_v_cur_ind[__pyx_v_i]) + 1) * (__pyx_v_self->dds[__pyx_v_i])) + (__pyx_v_self->left_edge[__pyx_v_i])) - (__pyx_v_v_pos[__pyx_v_i])) * (__pyx_v_iv_dir[__pyx_v_i])); - goto __pyx_L14; - } - __pyx_L14:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":462 - * tmax[i] = (((cur_ind[i]+1)*self.dds[i]) - * +self.left_edge[i]-v_pos[i])*iv_dir[i] - * if step[i] < 0: # <<<<<<<<<<<<<< - * tmax[i] = (((cur_ind[i]+0)*self.dds[i]) - * +self.left_edge[i]-v_pos[i])*iv_dir[i] - */ - __pyx_t_5 = ((__pyx_v_step[__pyx_v_i]) < 0); - if (__pyx_t_5) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":463 - * +self.left_edge[i]-v_pos[i])*iv_dir[i] - * if step[i] < 0: - * tmax[i] = (((cur_ind[i]+0)*self.dds[i]) # <<<<<<<<<<<<<< - * +self.left_edge[i]-v_pos[i])*iv_dir[i] - * tdelta[i] = (self.dds[i]*iv_dir[i]) - */ - (__pyx_v_tmax[__pyx_v_i]) = ((((((__pyx_v_cur_ind[__pyx_v_i]) + 0) * (__pyx_v_self->dds[__pyx_v_i])) + (__pyx_v_self->left_edge[__pyx_v_i])) - (__pyx_v_v_pos[__pyx_v_i])) * (__pyx_v_iv_dir[__pyx_v_i])); - goto __pyx_L15; - } - __pyx_L15:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":465 - * tmax[i] = (((cur_ind[i]+0)*self.dds[i]) - * +self.left_edge[i]-v_pos[i])*iv_dir[i] - * tdelta[i] = (self.dds[i]*iv_dir[i]) # <<<<<<<<<<<<<< - * if tdelta[i] < 0: tdelta[i] *= -1 - * # We have to jumpstart our calculation - */ - (__pyx_v_tdelta[__pyx_v_i]) = ((__pyx_v_self->dds[__pyx_v_i]) * (__pyx_v_iv_dir[__pyx_v_i])); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":466 - * +self.left_edge[i]-v_pos[i])*iv_dir[i] - * tdelta[i] = (self.dds[i]*iv_dir[i]) - * if tdelta[i] < 0: tdelta[i] *= -1 # <<<<<<<<<<<<<< - * # We have to jumpstart our calculation - * enter_t = intersect_t - */ - __pyx_t_5 = ((__pyx_v_tdelta[__pyx_v_i]) < 0.0); - if (__pyx_t_5) { - (__pyx_v_tdelta[__pyx_v_i]) *= -1.0; - goto __pyx_L16; - } - __pyx_L16:; - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":468 - * if tdelta[i] < 0: tdelta[i] *= -1 - * # We have to jumpstart our calculation - * enter_t = intersect_t # <<<<<<<<<<<<<< - * while 1: - * # dims here is one less than the dimensions of the data, - */ - __pyx_v_enter_t = __pyx_v_intersect_t; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":469 - * # We have to jumpstart our calculation - * enter_t = intersect_t - * while 1: # <<<<<<<<<<<<<< - * # dims here is one less than the dimensions of the data, - * # but we are tracing on the grid, not on the data... - */ - while (1) { - if (!1) break; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":472 - * # dims here is one less than the dimensions of the data, - * # but we are tracing on the grid, not on the data... - * if (not (0 <= cur_ind[0] < self.dims[0])) or \ # <<<<<<<<<<<<<< - * (not (0 <= cur_ind[1] < self.dims[1])) or \ - * (not (0 <= cur_ind[2] < self.dims[2])): - */ - __pyx_t_1 = (__pyx_v_cur_ind[0]); - __pyx_t_5 = (0 <= __pyx_t_1); - if (__pyx_t_5) { - __pyx_t_5 = (__pyx_t_1 < (__pyx_v_self->dims[0])); - } - __pyx_t_2 = (!__pyx_t_5); - if (!__pyx_t_2) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":473 - * # but we are tracing on the grid, not on the data... - * if (not (0 <= cur_ind[0] < self.dims[0])) or \ - * (not (0 <= cur_ind[1] < self.dims[1])) or \ # <<<<<<<<<<<<<< - * (not (0 <= cur_ind[2] < self.dims[2])): - * break - */ - __pyx_t_1 = (__pyx_v_cur_ind[1]); - __pyx_t_5 = (0 <= __pyx_t_1); - if (__pyx_t_5) { - __pyx_t_5 = (__pyx_t_1 < (__pyx_v_self->dims[1])); - } - __pyx_t_4 = (!__pyx_t_5); - if (!__pyx_t_4) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":474 - * if (not (0 <= cur_ind[0] < self.dims[0])) or \ - * (not (0 <= cur_ind[1] < self.dims[1])) or \ - * (not (0 <= cur_ind[2] < self.dims[2])): # <<<<<<<<<<<<<< - * break - * hit += 1 - */ - __pyx_t_1 = (__pyx_v_cur_ind[2]); - __pyx_t_5 = (0 <= __pyx_t_1); - if (__pyx_t_5) { - __pyx_t_5 = (__pyx_t_1 < (__pyx_v_self->dims[2])); - } - __pyx_t_6 = (!__pyx_t_5); - __pyx_t_5 = __pyx_t_6; - } else { - __pyx_t_5 = __pyx_t_4; - } - __pyx_t_4 = __pyx_t_5; - } else { - __pyx_t_4 = __pyx_t_2; - } - if (__pyx_t_4) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":475 - * (not (0 <= cur_ind[1] < self.dims[1])) or \ - * (not (0 <= cur_ind[2] < self.dims[2])): - * break # <<<<<<<<<<<<<< - * hit += 1 - * if tmax[0] < tmax[1]: - */ - goto __pyx_L18_break; - goto __pyx_L19; - } - __pyx_L19:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":476 - * (not (0 <= cur_ind[2] < self.dims[2])): - * break - * hit += 1 # <<<<<<<<<<<<<< - * if tmax[0] < tmax[1]: - * if tmax[0] < tmax[2]: - */ - __pyx_v_hit += 1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":477 - * break - * hit += 1 - * if tmax[0] < tmax[1]: # <<<<<<<<<<<<<< - * if tmax[0] < tmax[2]: - * exit_t = fmin(tmax[0], 1.0) - */ - __pyx_t_4 = ((__pyx_v_tmax[0]) < (__pyx_v_tmax[1])); - if (__pyx_t_4) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":478 - * hit += 1 - * if tmax[0] < tmax[1]: - * if tmax[0] < tmax[2]: # <<<<<<<<<<<<<< - * exit_t = fmin(tmax[0], 1.0) - * self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, - */ - __pyx_t_4 = ((__pyx_v_tmax[0]) < (__pyx_v_tmax[2])); - if (__pyx_t_4) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":479 - * if tmax[0] < tmax[1]: - * if tmax[0] < tmax[2]: - * exit_t = fmin(tmax[0], 1.0) # <<<<<<<<<<<<<< - * self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, - * rgba, tf) - */ - __pyx_v_exit_t = __pyx_f_2yt_9amr_utils_fmin((__pyx_v_tmax[0]), 1.0); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":481 - * exit_t = fmin(tmax[0], 1.0) - * self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, - * rgba, tf) # <<<<<<<<<<<<<< - * cur_ind[0] += step[0] - * enter_t = tmax[0] - */ - ((struct __pyx_vtabstruct_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self->__pyx_vtab)->sample_values(__pyx_v_self, __pyx_v_v_pos, __pyx_v_v_dir, __pyx_v_enter_t, __pyx_v_exit_t, __pyx_v_cur_ind, __pyx_v_rgba, __pyx_v_tf); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":482 - * self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, - * rgba, tf) - * cur_ind[0] += step[0] # <<<<<<<<<<<<<< - * enter_t = tmax[0] - * tmax[0] += tdelta[0] - */ - (__pyx_v_cur_ind[0]) += (__pyx_v_step[0]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":483 - * rgba, tf) - * cur_ind[0] += step[0] - * enter_t = tmax[0] # <<<<<<<<<<<<<< - * tmax[0] += tdelta[0] - * else: - */ - __pyx_v_enter_t = (__pyx_v_tmax[0]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":484 - * cur_ind[0] += step[0] - * enter_t = tmax[0] - * tmax[0] += tdelta[0] # <<<<<<<<<<<<<< - * else: - * exit_t = fmin(tmax[2], 1.0) - */ - (__pyx_v_tmax[0]) += (__pyx_v_tdelta[0]); - goto __pyx_L21; - } - /*else*/ { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":486 - * tmax[0] += tdelta[0] - * else: - * exit_t = fmin(tmax[2], 1.0) # <<<<<<<<<<<<<< - * self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, - * rgba, tf) - */ - __pyx_v_exit_t = __pyx_f_2yt_9amr_utils_fmin((__pyx_v_tmax[2]), 1.0); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":488 - * exit_t = fmin(tmax[2], 1.0) - * self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, - * rgba, tf) # <<<<<<<<<<<<<< - * cur_ind[2] += step[2] - * enter_t = tmax[2] - */ - ((struct __pyx_vtabstruct_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self->__pyx_vtab)->sample_values(__pyx_v_self, __pyx_v_v_pos, __pyx_v_v_dir, __pyx_v_enter_t, __pyx_v_exit_t, __pyx_v_cur_ind, __pyx_v_rgba, __pyx_v_tf); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":489 - * self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, - * rgba, tf) - * cur_ind[2] += step[2] # <<<<<<<<<<<<<< - * enter_t = tmax[2] - * tmax[2] += tdelta[2] - */ - (__pyx_v_cur_ind[2]) += (__pyx_v_step[2]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":490 - * rgba, tf) - * cur_ind[2] += step[2] - * enter_t = tmax[2] # <<<<<<<<<<<<<< - * tmax[2] += tdelta[2] - * else: - */ - __pyx_v_enter_t = (__pyx_v_tmax[2]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":491 - * cur_ind[2] += step[2] - * enter_t = tmax[2] - * tmax[2] += tdelta[2] # <<<<<<<<<<<<<< - * else: - * if tmax[1] < tmax[2]: - */ - (__pyx_v_tmax[2]) += (__pyx_v_tdelta[2]); - } - __pyx_L21:; - goto __pyx_L20; - } - /*else*/ { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":493 - * tmax[2] += tdelta[2] - * else: - * if tmax[1] < tmax[2]: # <<<<<<<<<<<<<< - * exit_t = fmin(tmax[1], 1.0) - * self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, - */ - __pyx_t_4 = ((__pyx_v_tmax[1]) < (__pyx_v_tmax[2])); - if (__pyx_t_4) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":494 - * else: - * if tmax[1] < tmax[2]: - * exit_t = fmin(tmax[1], 1.0) # <<<<<<<<<<<<<< - * self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, - * rgba, tf) - */ - __pyx_v_exit_t = __pyx_f_2yt_9amr_utils_fmin((__pyx_v_tmax[1]), 1.0); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":496 - * exit_t = fmin(tmax[1], 1.0) - * self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, - * rgba, tf) # <<<<<<<<<<<<<< - * cur_ind[1] += step[1] - * enter_t = tmax[1] - */ - ((struct __pyx_vtabstruct_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self->__pyx_vtab)->sample_values(__pyx_v_self, __pyx_v_v_pos, __pyx_v_v_dir, __pyx_v_enter_t, __pyx_v_exit_t, __pyx_v_cur_ind, __pyx_v_rgba, __pyx_v_tf); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":497 - * self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, - * rgba, tf) - * cur_ind[1] += step[1] # <<<<<<<<<<<<<< - * enter_t = tmax[1] - * tmax[1] += tdelta[1] - */ - (__pyx_v_cur_ind[1]) += (__pyx_v_step[1]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":498 - * rgba, tf) - * cur_ind[1] += step[1] - * enter_t = tmax[1] # <<<<<<<<<<<<<< - * tmax[1] += tdelta[1] - * else: - */ - __pyx_v_enter_t = (__pyx_v_tmax[1]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":499 - * cur_ind[1] += step[1] - * enter_t = tmax[1] - * tmax[1] += tdelta[1] # <<<<<<<<<<<<<< - * else: - * exit_t = fmin(tmax[2], 1.0) - */ - (__pyx_v_tmax[1]) += (__pyx_v_tdelta[1]); - goto __pyx_L22; - } - /*else*/ { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":501 - * tmax[1] += tdelta[1] - * else: - * exit_t = fmin(tmax[2], 1.0) # <<<<<<<<<<<<<< - * self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, - * rgba, tf) - */ - __pyx_v_exit_t = __pyx_f_2yt_9amr_utils_fmin((__pyx_v_tmax[2]), 1.0); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":503 - * exit_t = fmin(tmax[2], 1.0) - * self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, - * rgba, tf) # <<<<<<<<<<<<<< - * cur_ind[2] += step[2] - * enter_t = tmax[2] - */ - ((struct __pyx_vtabstruct_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self->__pyx_vtab)->sample_values(__pyx_v_self, __pyx_v_v_pos, __pyx_v_v_dir, __pyx_v_enter_t, __pyx_v_exit_t, __pyx_v_cur_ind, __pyx_v_rgba, __pyx_v_tf); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":504 - * self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, - * rgba, tf) - * cur_ind[2] += step[2] # <<<<<<<<<<<<<< - * enter_t = tmax[2] - * tmax[2] += tdelta[2] - */ - (__pyx_v_cur_ind[2]) += (__pyx_v_step[2]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":505 - * rgba, tf) - * cur_ind[2] += step[2] - * enter_t = tmax[2] # <<<<<<<<<<<<<< - * tmax[2] += tdelta[2] - * if enter_t > 1.0: break - */ - __pyx_v_enter_t = (__pyx_v_tmax[2]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":506 - * cur_ind[2] += step[2] - * enter_t = tmax[2] - * tmax[2] += tdelta[2] # <<<<<<<<<<<<<< - * if enter_t > 1.0: break - * return hit - */ - (__pyx_v_tmax[2]) += (__pyx_v_tdelta[2]); - } - __pyx_L22:; - } - __pyx_L20:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":507 - * enter_t = tmax[2] - * tmax[2] += tdelta[2] - * if enter_t > 1.0: break # <<<<<<<<<<<<<< - * return hit - * - */ - __pyx_t_4 = (__pyx_v_enter_t > 1.0); - if (__pyx_t_4) { - goto __pyx_L18_break; - goto __pyx_L23; - } - __pyx_L23:; - } - __pyx_L18_break:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":508 - * tmax[2] += tdelta[2] - * if enter_t > 1.0: break - * return hit # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) - */ - __pyx_r = __pyx_v_hit; - goto __pyx_L0; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_WriteUnraisable("yt.amr_utils.PartitionedGrid.integrate_ray"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":512 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef void sample_values(self, # <<<<<<<<<<<<<< - * np.float64_t v_pos[3], - * np.float64_t v_dir[3], - */ - -static void __pyx_f_2yt_9amr_utils_15PartitionedGrid_sample_values(struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *__pyx_v_self, __pyx_t_5numpy_float64_t *__pyx_v_v_pos, __pyx_t_5numpy_float64_t *__pyx_v_v_dir, __pyx_t_5numpy_float64_t __pyx_v_enter_t, __pyx_t_5numpy_float64_t __pyx_v_exit_t, int *__pyx_v_ci, __pyx_t_5numpy_float64_t *__pyx_v_rgba, struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *__pyx_v_tf) { - __pyx_t_5numpy_float64_t __pyx_v_dp[3]; - __pyx_t_5numpy_float64_t __pyx_v_temp; - __pyx_t_5numpy_float64_t __pyx_v_dt; - __pyx_t_5numpy_float64_t __pyx_v_grad[3]; - __pyx_t_5numpy_float64_t __pyx_v_ds[3]; - int __pyx_v_dti; - int __pyx_v_i; - int __pyx_v_offset; - __pyx_t_5numpy_float64_t __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - __Pyx_RefNannySetupContext("sample_values"); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":522 - * cdef np.float64_t cp[3], dp[3], temp, dt, t, dv - * cdef np.float64_t grad[3], ds[3] - * grad[0] = grad[1] = grad[2] = 0.0 # <<<<<<<<<<<<<< - * cdef int dti, i - * dt = (exit_t - enter_t) / tf.ns # 4 samples should be dt=0.25 - */ - (__pyx_v_grad[0]) = 0.0; - (__pyx_v_grad[1]) = 0.0; - (__pyx_v_grad[2]) = 0.0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":524 - * grad[0] = grad[1] = grad[2] = 0.0 - * cdef int dti, i - * dt = (exit_t - enter_t) / tf.ns # 4 samples should be dt=0.25 # <<<<<<<<<<<<<< - * cdef int offset = ci[0] * (self.dims[1] + 1) * (self.dims[2] + 1) \ - * + ci[1] * (self.dims[2] + 1) + ci[2] - */ - __pyx_t_1 = (__pyx_v_exit_t - __pyx_v_enter_t); - if (unlikely(__pyx_v_tf->ns == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_dt = (__pyx_t_1 / __pyx_v_tf->ns); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":526 - * dt = (exit_t - enter_t) / tf.ns # 4 samples should be dt=0.25 - * cdef int offset = ci[0] * (self.dims[1] + 1) * (self.dims[2] + 1) \ - * + ci[1] * (self.dims[2] + 1) + ci[2] # <<<<<<<<<<<<<< - * for i in range(3): - * # temp is the left edge of the current cell - */ - __pyx_v_offset = (((((__pyx_v_ci[0]) * ((__pyx_v_self->dims[1]) + 1)) * ((__pyx_v_self->dims[2]) + 1)) + ((__pyx_v_ci[1]) * ((__pyx_v_self->dims[2]) + 1))) + (__pyx_v_ci[2])); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":527 - * cdef int offset = ci[0] * (self.dims[1] + 1) * (self.dims[2] + 1) \ - * + ci[1] * (self.dims[2] + 1) + ci[2] - * for i in range(3): # <<<<<<<<<<<<<< - * # temp is the left edge of the current cell - * temp = ci[i] * self.dds[i] + self.left_edge[i] - */ - for (__pyx_t_2 = 0; __pyx_t_2 < 3; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":529 - * for i in range(3): - * # temp is the left edge of the current cell - * temp = ci[i] * self.dds[i] + self.left_edge[i] # <<<<<<<<<<<<<< - * # this gets us dp as the current first sample position - * dp[i] = (enter_t + 0.5 * dt) * v_dir[i] + v_pos[i] - temp - */ - __pyx_v_temp = (((__pyx_v_ci[__pyx_v_i]) * (__pyx_v_self->dds[__pyx_v_i])) + (__pyx_v_self->left_edge[__pyx_v_i])); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":531 - * temp = ci[i] * self.dds[i] + self.left_edge[i] - * # this gets us dp as the current first sample position - * dp[i] = (enter_t + 0.5 * dt) * v_dir[i] + v_pos[i] - temp # <<<<<<<<<<<<<< - * dp[i] *= self.idds[i] - * ds[i] = v_dir[i] * self.idds[i] * dt - */ - (__pyx_v_dp[__pyx_v_i]) = ((((__pyx_v_enter_t + (0.5 * __pyx_v_dt)) * (__pyx_v_v_dir[__pyx_v_i])) + (__pyx_v_v_pos[__pyx_v_i])) - __pyx_v_temp); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":532 - * # this gets us dp as the current first sample position - * dp[i] = (enter_t + 0.5 * dt) * v_dir[i] + v_pos[i] - temp - * dp[i] *= self.idds[i] # <<<<<<<<<<<<<< - * ds[i] = v_dir[i] * self.idds[i] * dt - * for dti in range(tf.ns): - */ - (__pyx_v_dp[__pyx_v_i]) *= (__pyx_v_self->idds[__pyx_v_i]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":533 - * dp[i] = (enter_t + 0.5 * dt) * v_dir[i] + v_pos[i] - temp - * dp[i] *= self.idds[i] - * ds[i] = v_dir[i] * self.idds[i] * dt # <<<<<<<<<<<<<< - * for dti in range(tf.ns): - * for i in range(self.n_fields): - */ - (__pyx_v_ds[__pyx_v_i]) = (((__pyx_v_v_dir[__pyx_v_i]) * (__pyx_v_self->idds[__pyx_v_i])) * __pyx_v_dt); - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":534 - * dp[i] *= self.idds[i] - * ds[i] = v_dir[i] * self.idds[i] * dt - * for dti in range(tf.ns): # <<<<<<<<<<<<<< - * for i in range(self.n_fields): - * self.dvs[i] = offset_interpolate(self.dims, dp, self.data[i] + offset) - */ - __pyx_t_2 = __pyx_v_tf->ns; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_dti = __pyx_t_3; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":535 - * ds[i] = v_dir[i] * self.idds[i] * dt - * for dti in range(tf.ns): - * for i in range(self.n_fields): # <<<<<<<<<<<<<< - * self.dvs[i] = offset_interpolate(self.dims, dp, self.data[i] + offset) - * #if (dv < tf.x_bounds[0]) or (dv > tf.x_bounds[1]): - */ - __pyx_t_4 = __pyx_v_self->n_fields; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_i = __pyx_t_5; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":536 - * for dti in range(tf.ns): - * for i in range(self.n_fields): - * self.dvs[i] = offset_interpolate(self.dims, dp, self.data[i] + offset) # <<<<<<<<<<<<<< - * #if (dv < tf.x_bounds[0]) or (dv > tf.x_bounds[1]): - * # continue - */ - (__pyx_v_self->dvs[__pyx_v_i]) = offset_interpolate(__pyx_v_self->dims, __pyx_v_dp, ((__pyx_v_self->data[__pyx_v_i]) + __pyx_v_offset)); - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":539 - * #if (dv < tf.x_bounds[0]) or (dv > tf.x_bounds[1]): - * # continue - * for i in range(3): # <<<<<<<<<<<<<< - * dp[i] += ds[i] - * tf.eval_transfer(dt, self.dvs, rgba, grad) - */ - for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":540 - * # continue - * for i in range(3): - * dp[i] += ds[i] # <<<<<<<<<<<<<< - * tf.eval_transfer(dt, self.dvs, rgba, grad) - * - */ - (__pyx_v_dp[__pyx_v_i]) += (__pyx_v_ds[__pyx_v_i]); - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":541 - * for i in range(3): - * dp[i] += ds[i] - * tf.eval_transfer(dt, self.dvs, rgba, grad) # <<<<<<<<<<<<<< - * - * cdef class GridFace: - */ - ((struct __pyx_vtabstruct_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_tf->__pyx_vtab)->eval_transfer(__pyx_v_tf, __pyx_v_dt, __pyx_v_self->dvs, __pyx_v_rgba, __pyx_v_grad); - } - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_WriteUnraisable("yt.amr_utils.PartitionedGrid.sample_values"); - __pyx_L0:; - __Pyx_RefNannyFinishContext(); -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":545 - * cdef class GridFace: - * cdef int direction - * cdef public np.float64_t coord # <<<<<<<<<<<<<< - * cdef np.float64_t left_edge[3] - * cdef np.float64_t right_edge[3] - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_8GridFace_5coord___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_8GridFace_5coord___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_2yt_9amr_utils_GridFace *)__pyx_v_self)->coord); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("yt.amr_utils.GridFace.coord.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_8GridFace_5coord___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_8GridFace_5coord___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __pyx_t_5numpy_float64_t __pyx_t_1; - __Pyx_RefNannySetupContext("__set__"); - __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_obj_2yt_9amr_utils_GridFace *)__pyx_v_self)->coord = __pyx_t_1; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("yt.amr_utils.GridFace.coord.__set__"); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":551 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * def __init__(self, grid, int direction, int left): # <<<<<<<<<<<<<< - * self.direction = direction - * if left == 1: - */ - -static int __pyx_pf_2yt_9amr_utils_8GridFace___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_8GridFace___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_grid = 0; - int __pyx_v_direction; - int __pyx_v_left; - int __pyx_v_i; - int __pyx_r; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __pyx_t_5numpy_float64_t __pyx_t_4; - int __pyx_t_5; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__grid,&__pyx_n_s__direction,&__pyx_n_s__left,0}; - __Pyx_RefNannySetupContext("__init__"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[3] = {0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__direction); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_grid = values[0]; - __pyx_v_direction = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_direction == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_left = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_left == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_grid = PyTuple_GET_ITEM(__pyx_args, 0); - __pyx_v_direction = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_direction == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_left = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_left == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.GridFace.__init__"); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":552 - * @cython.wraparound(False) - * def __init__(self, grid, int direction, int left): - * self.direction = direction # <<<<<<<<<<<<<< - * if left == 1: - * self.coord = grid.LeftEdge[direction] - */ - ((struct __pyx_obj_2yt_9amr_utils_GridFace *)__pyx_v_self)->direction = __pyx_v_direction; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":553 - * def __init__(self, grid, int direction, int left): - * self.direction = direction - * if left == 1: # <<<<<<<<<<<<<< - * self.coord = grid.LeftEdge[direction] - * else: - */ - __pyx_t_1 = (__pyx_v_left == 1); - if (__pyx_t_1) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":554 - * self.direction = direction - * if left == 1: - * self.coord = grid.LeftEdge[direction] # <<<<<<<<<<<<<< - * else: - * self.coord = grid.RightEdge[direction] - */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_grid, __pyx_n_s__LeftEdge); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, __pyx_v_direction, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - ((struct __pyx_obj_2yt_9amr_utils_GridFace *)__pyx_v_self)->coord = __pyx_t_4; - goto __pyx_L6; - } - /*else*/ { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":556 - * self.coord = grid.LeftEdge[direction] - * else: - * self.coord = grid.RightEdge[direction] # <<<<<<<<<<<<<< - * cdef int i - * for i in range(3): - */ - __pyx_t_3 = PyObject_GetAttr(__pyx_v_grid, __pyx_n_s__RightEdge); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, __pyx_v_direction, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - ((struct __pyx_obj_2yt_9amr_utils_GridFace *)__pyx_v_self)->coord = __pyx_t_4; - } - __pyx_L6:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":558 - * self.coord = grid.RightEdge[direction] - * cdef int i - * for i in range(3): # <<<<<<<<<<<<<< - * self.left_edge[i] = grid.LeftEdge[i] - * self.right_edge[i] = grid.RightEdge[i] - */ - for (__pyx_t_5 = 0; __pyx_t_5 < 3; __pyx_t_5+=1) { - __pyx_v_i = __pyx_t_5; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":559 - * cdef int i - * for i in range(3): - * self.left_edge[i] = grid.LeftEdge[i] # <<<<<<<<<<<<<< - * self.right_edge[i] = grid.RightEdge[i] - * self.left_edge[direction] = self.right_edge[direction] = self.coord - */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_grid, __pyx_n_s__LeftEdge); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - (((struct __pyx_obj_2yt_9amr_utils_GridFace *)__pyx_v_self)->left_edge[__pyx_v_i]) = __pyx_t_4; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":560 - * for i in range(3): - * self.left_edge[i] = grid.LeftEdge[i] - * self.right_edge[i] = grid.RightEdge[i] # <<<<<<<<<<<<<< - * self.left_edge[direction] = self.right_edge[direction] = self.coord - * - */ - __pyx_t_3 = PyObject_GetAttr(__pyx_v_grid, __pyx_n_s__RightEdge); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - (((struct __pyx_obj_2yt_9amr_utils_GridFace *)__pyx_v_self)->right_edge[__pyx_v_i]) = __pyx_t_4; - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":561 - * self.left_edge[i] = grid.LeftEdge[i] - * self.right_edge[i] = grid.RightEdge[i] - * self.left_edge[direction] = self.right_edge[direction] = self.coord # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) - */ - (((struct __pyx_obj_2yt_9amr_utils_GridFace *)__pyx_v_self)->left_edge[__pyx_v_direction]) = ((struct __pyx_obj_2yt_9amr_utils_GridFace *)__pyx_v_self)->coord; - (((struct __pyx_obj_2yt_9amr_utils_GridFace *)__pyx_v_self)->right_edge[__pyx_v_direction]) = ((struct __pyx_obj_2yt_9amr_utils_GridFace *)__pyx_v_self)->coord; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("yt.amr_utils.GridFace.__init__"); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":565 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef int proj_overlap(self, np.float64_t *left_edge, np.float64_t *right_edge): # <<<<<<<<<<<<<< - * cdef int xax, yax - * xax = (self.direction + 1) % 3 - */ - -static int __pyx_f_2yt_9amr_utils_8GridFace_proj_overlap(struct __pyx_obj_2yt_9amr_utils_GridFace *__pyx_v_self, __pyx_t_5numpy_float64_t *__pyx_v_left_edge, __pyx_t_5numpy_float64_t *__pyx_v_right_edge) { - int __pyx_v_xax; - int __pyx_v_yax; - int __pyx_r; - int __pyx_t_1; - __Pyx_RefNannySetupContext("proj_overlap"); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":567 - * cdef int proj_overlap(self, np.float64_t *left_edge, np.float64_t *right_edge): - * cdef int xax, yax - * xax = (self.direction + 1) % 3 # <<<<<<<<<<<<<< - * yax = (self.direction + 2) % 3 - * if left_edge[xax] >= self.right_edge[xax]: return 0 - */ - __pyx_v_xax = __Pyx_mod_long((__pyx_v_self->direction + 1), 3); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":568 - * cdef int xax, yax - * xax = (self.direction + 1) % 3 - * yax = (self.direction + 2) % 3 # <<<<<<<<<<<<<< - * if left_edge[xax] >= self.right_edge[xax]: return 0 - * if right_edge[xax] <= self.left_edge[xax]: return 0 - */ - __pyx_v_yax = __Pyx_mod_long((__pyx_v_self->direction + 2), 3); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":569 - * xax = (self.direction + 1) % 3 - * yax = (self.direction + 2) % 3 - * if left_edge[xax] >= self.right_edge[xax]: return 0 # <<<<<<<<<<<<<< - * if right_edge[xax] <= self.left_edge[xax]: return 0 - * if left_edge[yax] >= self.right_edge[yax]: return 0 - */ - __pyx_t_1 = ((__pyx_v_left_edge[__pyx_v_xax]) >= (__pyx_v_self->right_edge[__pyx_v_xax])); - if (__pyx_t_1) { - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":570 - * yax = (self.direction + 2) % 3 - * if left_edge[xax] >= self.right_edge[xax]: return 0 - * if right_edge[xax] <= self.left_edge[xax]: return 0 # <<<<<<<<<<<<<< - * if left_edge[yax] >= self.right_edge[yax]: return 0 - * if right_edge[yax] <= self.left_edge[yax]: return 0 - */ - __pyx_t_1 = ((__pyx_v_right_edge[__pyx_v_xax]) <= (__pyx_v_self->left_edge[__pyx_v_xax])); - if (__pyx_t_1) { - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L4; - } - __pyx_L4:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":571 - * if left_edge[xax] >= self.right_edge[xax]: return 0 - * if right_edge[xax] <= self.left_edge[xax]: return 0 - * if left_edge[yax] >= self.right_edge[yax]: return 0 # <<<<<<<<<<<<<< - * if right_edge[yax] <= self.left_edge[yax]: return 0 - * return 1 - */ - __pyx_t_1 = ((__pyx_v_left_edge[__pyx_v_yax]) >= (__pyx_v_self->right_edge[__pyx_v_yax])); - if (__pyx_t_1) { - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L5; - } - __pyx_L5:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":572 - * if right_edge[xax] <= self.left_edge[xax]: return 0 - * if left_edge[yax] >= self.right_edge[yax]: return 0 - * if right_edge[yax] <= self.left_edge[yax]: return 0 # <<<<<<<<<<<<<< - * return 1 - * - */ - __pyx_t_1 = ((__pyx_v_right_edge[__pyx_v_yax]) <= (__pyx_v_self->left_edge[__pyx_v_yax])); - if (__pyx_t_1) { - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L6; - } - __pyx_L6:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":573 - * if left_edge[yax] >= self.right_edge[yax]: return 0 - * if right_edge[yax] <= self.left_edge[yax]: return 0 - * return 1 # <<<<<<<<<<<<<< - * - * cdef class ProtoPrism: - */ - __pyx_r = 1; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":578 - * cdef np.float64_t left_edge[3] - * cdef np.float64_t right_edge[3] - * cdef public object LeftEdge # <<<<<<<<<<<<<< - * cdef public object RightEdge - * cdef public object subgrid_faces - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_10ProtoPrism_8LeftEdge___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_10ProtoPrism_8LeftEdge___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->LeftEdge); - __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->LeftEdge; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_10ProtoPrism_8LeftEdge___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_10ProtoPrism_8LeftEdge___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannySetupContext("__set__"); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->LeftEdge); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->LeftEdge); - ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->LeftEdge = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_10ProtoPrism_8LeftEdge___del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_10ProtoPrism_8LeftEdge___del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->LeftEdge); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->LeftEdge); - ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->LeftEdge = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":579 - * cdef np.float64_t right_edge[3] - * cdef public object LeftEdge - * cdef public object RightEdge # <<<<<<<<<<<<<< - * cdef public object subgrid_faces - * cdef public int parent_grid_id - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_10ProtoPrism_9RightEdge___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_10ProtoPrism_9RightEdge___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->RightEdge); - __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->RightEdge; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_10ProtoPrism_9RightEdge___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_10ProtoPrism_9RightEdge___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannySetupContext("__set__"); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->RightEdge); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->RightEdge); - ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->RightEdge = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_10ProtoPrism_9RightEdge___del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_10ProtoPrism_9RightEdge___del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->RightEdge); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->RightEdge); - ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->RightEdge = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":580 - * cdef public object LeftEdge - * cdef public object RightEdge - * cdef public object subgrid_faces # <<<<<<<<<<<<<< - * cdef public int parent_grid_id - * def __cinit__(self, int parent_grid_id, - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_10ProtoPrism_13subgrid_faces___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_10ProtoPrism_13subgrid_faces___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->subgrid_faces); - __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->subgrid_faces; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_10ProtoPrism_13subgrid_faces___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_10ProtoPrism_13subgrid_faces___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannySetupContext("__set__"); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->subgrid_faces); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->subgrid_faces); - ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->subgrid_faces = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_10ProtoPrism_13subgrid_faces___del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_10ProtoPrism_13subgrid_faces___del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->subgrid_faces); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->subgrid_faces); - ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->subgrid_faces = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":581 - * cdef public object RightEdge - * cdef public object subgrid_faces - * cdef public int parent_grid_id # <<<<<<<<<<<<<< - * def __cinit__(self, int parent_grid_id, - * np.ndarray[np.float64_t, ndim=1] left_edge, - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_10ProtoPrism_14parent_grid_id___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_10ProtoPrism_14parent_grid_id___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->parent_grid_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("yt.amr_utils.ProtoPrism.parent_grid_id.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_9amr_utils_10ProtoPrism_14parent_grid_id___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_10ProtoPrism_14parent_grid_id___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - int __pyx_t_1; - __Pyx_RefNannySetupContext("__set__"); - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->parent_grid_id = __pyx_t_1; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("yt.amr_utils.ProtoPrism.parent_grid_id.__set__"); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":582 - * cdef public object subgrid_faces - * cdef public int parent_grid_id - * def __cinit__(self, int parent_grid_id, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t, ndim=1] left_edge, - * np.ndarray[np.float64_t, ndim=1] right_edge, - */ - -static int __pyx_pf_2yt_9amr_utils_10ProtoPrism___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_10ProtoPrism___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_parent_grid_id; - PyArrayObject *__pyx_v_left_edge = 0; - PyArrayObject *__pyx_v_right_edge = 0; - PyObject *__pyx_v_subgrid_faces = 0; - int __pyx_v_i; - Py_buffer __pyx_bstruct_right_edge; - Py_ssize_t __pyx_bstride_0_right_edge = 0; - Py_ssize_t __pyx_bshape_0_right_edge = 0; - Py_buffer __pyx_bstruct_left_edge; - Py_ssize_t __pyx_bstride_0_left_edge = 0; - Py_ssize_t __pyx_bshape_0_left_edge = 0; - int __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__parent_grid_id,&__pyx_n_s__left_edge,&__pyx_n_s__right_edge,&__pyx_n_s__subgrid_faces,0}; - __Pyx_RefNannySetupContext("__cinit__"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[4] = {0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parent_grid_id); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left_edge); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right_edge); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__subgrid_faces); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 3); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_parent_grid_id = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_parent_grid_id == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_left_edge = ((PyArrayObject *)values[1]); - __pyx_v_right_edge = ((PyArrayObject *)values[2]); - __pyx_v_subgrid_faces = values[3]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_parent_grid_id = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_parent_grid_id == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_left_edge = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_right_edge = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_subgrid_faces = PyTuple_GET_ITEM(__pyx_args, 3); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.ProtoPrism.__cinit__"); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_left_edge.buf = NULL; - __pyx_bstruct_right_edge.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left_edge), __pyx_ptype_5numpy_ndarray, 1, "left_edge", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right_edge), __pyx_ptype_5numpy_ndarray, 1, "right_edge", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_left_edge, (PyObject*)__pyx_v_left_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_left_edge = __pyx_bstruct_left_edge.strides[0]; - __pyx_bshape_0_left_edge = __pyx_bstruct_left_edge.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_right_edge, (PyObject*)__pyx_v_right_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_right_edge = __pyx_bstruct_right_edge.strides[0]; - __pyx_bshape_0_right_edge = __pyx_bstruct_right_edge.shape[0]; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":586 - * np.ndarray[np.float64_t, ndim=1] right_edge, - * subgrid_faces): - * self.parent_grid_id = parent_grid_id # <<<<<<<<<<<<<< - * cdef int i - * self.LeftEdge = left_edge - */ - ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->parent_grid_id = __pyx_v_parent_grid_id; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":588 - * self.parent_grid_id = parent_grid_id - * cdef int i - * self.LeftEdge = left_edge # <<<<<<<<<<<<<< - * self.RightEdge = right_edge - * for i in range(3): - */ - __Pyx_INCREF(((PyObject *)__pyx_v_left_edge)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_left_edge)); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->LeftEdge); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->LeftEdge); - ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->LeftEdge = ((PyObject *)__pyx_v_left_edge); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":589 - * cdef int i - * self.LeftEdge = left_edge - * self.RightEdge = right_edge # <<<<<<<<<<<<<< - * for i in range(3): - * self.left_edge[i] = left_edge[i] - */ - __Pyx_INCREF(((PyObject *)__pyx_v_right_edge)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_right_edge)); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->RightEdge); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->RightEdge); - ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->RightEdge = ((PyObject *)__pyx_v_right_edge); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":590 - * self.LeftEdge = left_edge - * self.RightEdge = right_edge - * for i in range(3): # <<<<<<<<<<<<<< - * self.left_edge[i] = left_edge[i] - * self.right_edge[i] = right_edge[i] - */ - for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":591 - * self.RightEdge = right_edge - * for i in range(3): - * self.left_edge[i] = left_edge[i] # <<<<<<<<<<<<<< - * self.right_edge[i] = right_edge[i] - * self.subgrid_faces = subgrid_faces - */ - __pyx_t_2 = __pyx_v_i; - __pyx_t_3 = -1; - if (__pyx_t_2 < 0) { - __pyx_t_2 += __pyx_bshape_0_left_edge; - if (unlikely(__pyx_t_2 < 0)) __pyx_t_3 = 0; - } else if (unlikely(__pyx_t_2 >= __pyx_bshape_0_left_edge)) __pyx_t_3 = 0; - if (unlikely(__pyx_t_3 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_3); - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - (((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->left_edge[__pyx_v_i]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_2, __pyx_bstride_0_left_edge)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":592 - * for i in range(3): - * self.left_edge[i] = left_edge[i] - * self.right_edge[i] = right_edge[i] # <<<<<<<<<<<<<< - * self.subgrid_faces = subgrid_faces - * - */ - __pyx_t_3 = __pyx_v_i; - __pyx_t_4 = -1; - if (__pyx_t_3 < 0) { - __pyx_t_3 += __pyx_bshape_0_right_edge; - if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 0; - } else if (unlikely(__pyx_t_3 >= __pyx_bshape_0_right_edge)) __pyx_t_4 = 0; - if (unlikely(__pyx_t_4 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_4); - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - (((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->right_edge[__pyx_v_i]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_3, __pyx_bstride_0_right_edge)); - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":593 - * self.left_edge[i] = left_edge[i] - * self.right_edge[i] = right_edge[i] - * self.subgrid_faces = subgrid_faces # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) - */ - __Pyx_INCREF(__pyx_v_subgrid_faces); - __Pyx_GIVEREF(__pyx_v_subgrid_faces); - __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->subgrid_faces); - __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->subgrid_faces); - ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->subgrid_faces = __pyx_v_subgrid_faces; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_right_edge); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edge); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.amr_utils.ProtoPrism.__cinit__"); - __pyx_r = -1; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_right_edge); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edge); - __pyx_L2:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":597 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * def sweep(self, int direction = 0, int stack = 0): # <<<<<<<<<<<<<< - * cdef int i - * cdef GridFace face - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_10ProtoPrism_sweep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_10ProtoPrism_sweep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_direction; - int __pyx_v_stack; - int __pyx_v_i; - struct __pyx_obj_2yt_9amr_utils_GridFace *__pyx_v_face; - __pyx_t_5numpy_float64_t __pyx_v_proto_split[3]; - PyObject *__pyx_v_left; - PyObject *__pyx_v_right; - PyObject *__pyx_v_LC; - PyObject *__pyx_v_RC; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__direction,&__pyx_n_s__stack,0}; - __Pyx_RefNannySetupContext("sweep"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - if (kw_args > 1) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__direction); - if (unlikely(value)) { values[0] = value; kw_args--; } - } - case 1: - if (kw_args > 1) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stack); - if (unlikely(value)) { values[1] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sweep") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - if (values[0]) { - __pyx_v_direction = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_direction == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_direction = ((int)0); - } - if (values[1]) { - __pyx_v_stack = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_stack == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_stack = ((int)0); - } - } else { - __pyx_v_direction = ((int)0); - __pyx_v_stack = ((int)0); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: __pyx_v_stack = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_stack == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 1: __pyx_v_direction = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_direction == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sweep", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.ProtoPrism.sweep"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_v_face = ((struct __pyx_obj_2yt_9amr_utils_GridFace *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_left = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_right = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_LC = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_RC = Py_None; __Pyx_INCREF(Py_None); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":601 - * cdef GridFace face - * cdef np.float64_t proto_split[3] - * for i in range(3): proto_split[i] = self.right_edge[i] # <<<<<<<<<<<<<< - * for face in self.subgrid_faces[direction]: - * proto_split[direction] = face.coord - */ - for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; - (__pyx_v_proto_split[__pyx_v_i]) = (((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->right_edge[__pyx_v_i]); - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":602 - * cdef np.float64_t proto_split[3] - * for i in range(3): proto_split[i] = self.right_edge[i] - * for face in self.subgrid_faces[direction]: # <<<<<<<<<<<<<< - * proto_split[direction] = face.coord - * if proto_split[direction] <= self.left_edge[direction]: - */ - __pyx_t_3 = __Pyx_GetItemInt(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->subgrid_faces, __pyx_v_direction, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_2 = 0; __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); - } else { - __pyx_t_2 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - for (;;) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break; - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; - } else if (likely(PyTuple_CheckExact(__pyx_t_4))) { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; - } else { - __pyx_t_3 = PyIter_Next(__pyx_t_4); - if (!__pyx_t_3) { - if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_2yt_9amr_utils_GridFace))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_face)); - __pyx_v_face = ((struct __pyx_obj_2yt_9amr_utils_GridFace *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":603 - * for i in range(3): proto_split[i] = self.right_edge[i] - * for face in self.subgrid_faces[direction]: - * proto_split[direction] = face.coord # <<<<<<<<<<<<<< - * if proto_split[direction] <= self.left_edge[direction]: - * continue - */ - (__pyx_v_proto_split[__pyx_v_direction]) = __pyx_v_face->coord; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":604 - * for face in self.subgrid_faces[direction]: - * proto_split[direction] = face.coord - * if proto_split[direction] <= self.left_edge[direction]: # <<<<<<<<<<<<<< - * continue - * if proto_split[direction] == self.right_edge[direction]: - */ - __pyx_t_5 = ((__pyx_v_proto_split[__pyx_v_direction]) <= (((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->left_edge[__pyx_v_direction])); - if (__pyx_t_5) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":605 - * proto_split[direction] = face.coord - * if proto_split[direction] <= self.left_edge[direction]: - * continue # <<<<<<<<<<<<<< - * if proto_split[direction] == self.right_edge[direction]: - * if stack == 2: return [self] - */ - goto __pyx_L8_continue; - goto __pyx_L10; - } - __pyx_L10:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":606 - * if proto_split[direction] <= self.left_edge[direction]: - * continue - * if proto_split[direction] == self.right_edge[direction]: # <<<<<<<<<<<<<< - * if stack == 2: return [self] - * return self.sweep((direction + 1) % 3, stack + 1) - */ - __pyx_t_5 = ((__pyx_v_proto_split[__pyx_v_direction]) == (((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->right_edge[__pyx_v_direction])); - if (__pyx_t_5) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":607 - * continue - * if proto_split[direction] == self.right_edge[direction]: - * if stack == 2: return [self] # <<<<<<<<<<<<<< - * return self.sweep((direction + 1) % 3, stack + 1) - * if face.proj_overlap(self.left_edge, proto_split) == 1: - */ - __pyx_t_5 = (__pyx_v_stack == 2); - if (__pyx_t_5) { - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_INCREF(__pyx_v_self); - PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); - __pyx_r = ((PyObject *)__pyx_t_3); - __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L0; - goto __pyx_L12; - } - __pyx_L12:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":608 - * if proto_split[direction] == self.right_edge[direction]: - * if stack == 2: return [self] - * return self.sweep((direction + 1) % 3, stack + 1) # <<<<<<<<<<<<<< - * if face.proj_overlap(self.left_edge, proto_split) == 1: - * left, right = self.split(proto_split, direction) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__sweep); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyInt_FromLong(__Pyx_mod_long((__pyx_v_direction + 1), 3)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyInt_FromLong((__pyx_v_stack + 1)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - __pyx_t_6 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_r = __pyx_t_7; - __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L0; - goto __pyx_L11; - } - __pyx_L11:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":609 - * if stack == 2: return [self] - * return self.sweep((direction + 1) % 3, stack + 1) - * if face.proj_overlap(self.left_edge, proto_split) == 1: # <<<<<<<<<<<<<< - * left, right = self.split(proto_split, direction) - * LC = left.sweep((direction + 1) % 3) - */ - __pyx_t_5 = (((struct __pyx_vtabstruct_2yt_9amr_utils_GridFace *)__pyx_v_face->__pyx_vtab)->proj_overlap(__pyx_v_face, ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->left_edge, __pyx_v_proto_split) == 1); - if (__pyx_t_5) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":610 - * return self.sweep((direction + 1) % 3, stack + 1) - * if face.proj_overlap(self.left_edge, proto_split) == 1: - * left, right = self.split(proto_split, direction) # <<<<<<<<<<<<<< - * LC = left.sweep((direction + 1) % 3) - * RC = right.sweep(direction) - */ - __pyx_t_7 = ((struct __pyx_vtabstruct_2yt_9amr_utils_ProtoPrism *)((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->__pyx_vtab)->split(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self), __pyx_v_proto_split, __pyx_v_direction); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - if (PyTuple_CheckExact(__pyx_t_7) && likely(PyTuple_GET_SIZE(__pyx_t_7) == 2)) { - PyObject* tuple = __pyx_t_7; - __pyx_t_8 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_8); - __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_v_left); - __pyx_v_left = __pyx_t_8; - __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_v_right); - __pyx_v_right = __pyx_t_3; - __pyx_t_3 = 0; - } else { - __pyx_t_6 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_8 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_EndUnpack(__pyx_t_6, 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_v_left); - __pyx_v_left = __pyx_t_8; - __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_v_right); - __pyx_v_right = __pyx_t_3; - __pyx_t_3 = 0; - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":611 - * if face.proj_overlap(self.left_edge, proto_split) == 1: - * left, right = self.split(proto_split, direction) - * LC = left.sweep((direction + 1) % 3) # <<<<<<<<<<<<<< - * RC = right.sweep(direction) - * return LC + RC - */ - __pyx_t_7 = PyObject_GetAttr(__pyx_v_left, __pyx_n_s__sweep); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = PyInt_FromLong(__Pyx_mod_long((__pyx_v_direction + 1), 3)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_7, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_v_LC); - __pyx_v_LC = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":612 - * left, right = self.split(proto_split, direction) - * LC = left.sweep((direction + 1) % 3) - * RC = right.sweep(direction) # <<<<<<<<<<<<<< - * return LC + RC - * raise RuntimeError - */ - __pyx_t_3 = PyObject_GetAttr(__pyx_v_right, __pyx_n_s__sweep); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = PyInt_FromLong(__pyx_v_direction); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_v_RC); - __pyx_v_RC = __pyx_t_8; - __pyx_t_8 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":613 - * LC = left.sweep((direction + 1) % 3) - * RC = right.sweep(direction) - * return LC + RC # <<<<<<<<<<<<<< - * raise RuntimeError - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_8 = PyNumber_Add(__pyx_v_LC, __pyx_v_RC); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_r = __pyx_t_8; - __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L0; - goto __pyx_L13; - } - __pyx_L13:; - __pyx_L8_continue:; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":614 - * RC = right.sweep(direction) - * return LC + RC - * raise RuntimeError # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) - */ - __Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0); - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("yt.amr_utils.ProtoPrism.sweep"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_face); - __Pyx_DECREF(__pyx_v_left); - __Pyx_DECREF(__pyx_v_right); - __Pyx_DECREF(__pyx_v_LC); - __Pyx_DECREF(__pyx_v_RC); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":618 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef object split(self, np.float64_t *sp, int direction): # <<<<<<<<<<<<<< - * cdef int i - * cdef np.ndarray split_left = self.LeftEdge.copy() - */ - -static PyObject *__pyx_f_2yt_9amr_utils_10ProtoPrism_split(struct __pyx_obj_2yt_9amr_utils_ProtoPrism *__pyx_v_self, __pyx_t_5numpy_float64_t *__pyx_v_sp, int __pyx_v_direction) { - int __pyx_v_i; - PyArrayObject *__pyx_v_split_left = 0; - PyArrayObject *__pyx_v_split_right = 0; - struct __pyx_obj_2yt_9amr_utils_ProtoPrism *__pyx_v_left; - struct __pyx_obj_2yt_9amr_utils_ProtoPrism *__pyx_v_right; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - __Pyx_RefNannySetupContext("split"); - __pyx_v_left = ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_right = ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)Py_None); __Pyx_INCREF(Py_None); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":620 - * cdef object split(self, np.float64_t *sp, int direction): - * cdef int i - * cdef np.ndarray split_left = self.LeftEdge.copy() # <<<<<<<<<<<<<< - * cdef np.ndarray split_right = self.RightEdge.copy() - * - */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self->LeftEdge, __pyx_n_s__copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_split_left = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":621 - * cdef int i - * cdef np.ndarray split_left = self.LeftEdge.copy() - * cdef np.ndarray split_right = self.RightEdge.copy() # <<<<<<<<<<<<<< - * - * for i in range(3): split_left[i] = self.right_edge[i] - */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_self->RightEdge, __pyx_n_s__copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_split_right = ((PyArrayObject *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":623 - * cdef np.ndarray split_right = self.RightEdge.copy() - * - * for i in range(3): split_left[i] = self.right_edge[i] # <<<<<<<<<<<<<< - * split_left[direction] = sp[direction] - * left = ProtoPrism(self.parent_grid_id, self.LeftEdge, split_left, - */ - for (__pyx_t_3 = 0; __pyx_t_3 < 3; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; - __pyx_t_1 = PyFloat_FromDouble((__pyx_v_self->right_edge[__pyx_v_i])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_split_left), __pyx_v_i, __pyx_t_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":624 - * - * for i in range(3): split_left[i] = self.right_edge[i] - * split_left[direction] = sp[direction] # <<<<<<<<<<<<<< - * left = ProtoPrism(self.parent_grid_id, self.LeftEdge, split_left, - * self.subgrid_faces) - */ - __pyx_t_1 = PyFloat_FromDouble((__pyx_v_sp[__pyx_v_direction])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_split_left), __pyx_v_direction, __pyx_t_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":625 - * for i in range(3): split_left[i] = self.right_edge[i] - * split_left[direction] = sp[direction] - * left = ProtoPrism(self.parent_grid_id, self.LeftEdge, split_left, # <<<<<<<<<<<<<< - * self.subgrid_faces) - * - */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->parent_grid_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":626 - * split_left[direction] = sp[direction] - * left = ProtoPrism(self.parent_grid_id, self.LeftEdge, split_left, - * self.subgrid_faces) # <<<<<<<<<<<<<< - * - * for i in range(3): split_right[i] = self.left_edge[i] - */ - __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_self->LeftEdge); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_self->LeftEdge); - __Pyx_GIVEREF(__pyx_v_self->LeftEdge); - __Pyx_INCREF(((PyObject *)__pyx_v_split_left)); - PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_split_left)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_split_left)); - __Pyx_INCREF(__pyx_v_self->subgrid_faces); - PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_self->subgrid_faces); - __Pyx_GIVEREF(__pyx_v_self->subgrid_faces); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2yt_9amr_utils_ProtoPrism)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_left)); - __pyx_v_left = ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":628 - * self.subgrid_faces) - * - * for i in range(3): split_right[i] = self.left_edge[i] # <<<<<<<<<<<<<< - * split_right[direction] = sp[direction] - * right = ProtoPrism(self.parent_grid_id, split_right, self.RightEdge, - */ - for (__pyx_t_3 = 0; __pyx_t_3 < 3; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; - __pyx_t_1 = PyFloat_FromDouble((__pyx_v_self->left_edge[__pyx_v_i])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_split_right), __pyx_v_i, __pyx_t_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":629 - * - * for i in range(3): split_right[i] = self.left_edge[i] - * split_right[direction] = sp[direction] # <<<<<<<<<<<<<< - * right = ProtoPrism(self.parent_grid_id, split_right, self.RightEdge, - * self.subgrid_faces) - */ - __pyx_t_1 = PyFloat_FromDouble((__pyx_v_sp[__pyx_v_direction])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_split_right), __pyx_v_direction, __pyx_t_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":630 - * for i in range(3): split_right[i] = self.left_edge[i] - * split_right[direction] = sp[direction] - * right = ProtoPrism(self.parent_grid_id, split_right, self.RightEdge, # <<<<<<<<<<<<<< - * self.subgrid_faces) - * - */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->parent_grid_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":631 - * split_right[direction] = sp[direction] - * right = ProtoPrism(self.parent_grid_id, split_right, self.RightEdge, - * self.subgrid_faces) # <<<<<<<<<<<<<< - * - * return (left, right) - */ - __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_v_split_right)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_split_right)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_split_right)); - __Pyx_INCREF(__pyx_v_self->RightEdge); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_self->RightEdge); - __Pyx_GIVEREF(__pyx_v_self->RightEdge); - __Pyx_INCREF(__pyx_v_self->subgrid_faces); - PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_self->subgrid_faces); - __Pyx_GIVEREF(__pyx_v_self->subgrid_faces); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2yt_9amr_utils_ProtoPrism)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_right)); - __pyx_v_right = ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":633 - * self.subgrid_faces) - * - * return (left, right) # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_v_left)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_left)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_left)); - __Pyx_INCREF(((PyObject *)__pyx_v_right)); - PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_right)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_right)); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("yt.amr_utils.ProtoPrism.split"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_split_left); - __Pyx_XDECREF((PyObject *)__pyx_v_split_right); - __Pyx_DECREF((PyObject *)__pyx_v_left); - __Pyx_DECREF((PyObject *)__pyx_v_right); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":637 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * def get_brick(self, np.ndarray[np.float64_t, ndim=1] grid_left_edge, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t, ndim=1] grid_dds, - * child_mask): - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_10ProtoPrism_get_brick(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_10ProtoPrism_get_brick(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_grid_left_edge = 0; - PyArrayObject *__pyx_v_grid_dds = 0; - PyObject *__pyx_v_child_mask = 0; - int __pyx_v_li[3]; - int __pyx_v_ri[3]; - int __pyx_v_idims[3]; - int __pyx_v_i; - PyArrayObject *__pyx_v_dims = 0; - Py_buffer __pyx_bstruct_grid_dds; - Py_ssize_t __pyx_bstride_0_grid_dds = 0; - Py_ssize_t __pyx_bshape_0_grid_dds = 0; - Py_buffer __pyx_bstruct_dims; - Py_ssize_t __pyx_bstride_0_dims = 0; - Py_ssize_t __pyx_bshape_0_dims = 0; - Py_buffer __pyx_bstruct_grid_left_edge; - Py_ssize_t __pyx_bstride_0_grid_left_edge = 0; - Py_ssize_t __pyx_bshape_0_grid_left_edge = 0; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - int __pyx_t_2; - __pyx_t_5numpy_float64_t __pyx_t_3; - int __pyx_t_4; - __pyx_t_5numpy_float64_t __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - int __pyx_t_12; - PyArrayObject *__pyx_t_13 = NULL; - int __pyx_t_14; - PyObject *__pyx_t_15 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__grid_left_edge,&__pyx_n_s__grid_dds,&__pyx_n_s__child_mask,0}; - __Pyx_RefNannySetupContext("get_brick"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[3] = {0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid_left_edge); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid_dds); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("get_brick", 1, 3, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__child_mask); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("get_brick", 1, 3, 3, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "get_brick") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_grid_left_edge = ((PyArrayObject *)values[0]); - __pyx_v_grid_dds = ((PyArrayObject *)values[1]); - __pyx_v_child_mask = values[2]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_grid_left_edge = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_grid_dds = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_child_mask = PyTuple_GET_ITEM(__pyx_args, 2); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("get_brick", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.ProtoPrism.get_brick"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_dims.buf = NULL; - __pyx_bstruct_grid_left_edge.buf = NULL; - __pyx_bstruct_grid_dds.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grid_left_edge), __pyx_ptype_5numpy_ndarray, 1, "grid_left_edge", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grid_dds), __pyx_ptype_5numpy_ndarray, 1, "grid_dds", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_grid_left_edge, (PyObject*)__pyx_v_grid_left_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_grid_left_edge = __pyx_bstruct_grid_left_edge.strides[0]; - __pyx_bshape_0_grid_left_edge = __pyx_bstruct_grid_left_edge.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_grid_dds, (PyObject*)__pyx_v_grid_dds, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_grid_dds = __pyx_bstruct_grid_dds.strides[0]; - __pyx_bshape_0_grid_dds = __pyx_bstruct_grid_dds.shape[0]; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":644 - * cdef PartitionedGrid PG - * cdef int li[3], ri[3], idims[3], i - * for i in range(3): # <<<<<<<<<<<<<< - * li[i] = lrint((self.left_edge[i] - grid_left_edge[i])/grid_dds[i]) - * ri[i] = lrint((self.right_edge[i] - grid_left_edge[i])/grid_dds[i]) - */ - for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":645 - * cdef int li[3], ri[3], idims[3], i - * for i in range(3): - * li[i] = lrint((self.left_edge[i] - grid_left_edge[i])/grid_dds[i]) # <<<<<<<<<<<<<< - * ri[i] = lrint((self.right_edge[i] - grid_left_edge[i])/grid_dds[i]) - * idims[i] = ri[i] - li[i] - */ - __pyx_t_2 = __pyx_v_i; - __pyx_t_3 = ((((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->left_edge[__pyx_v_i]) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_grid_left_edge.buf, __pyx_t_2, __pyx_bstride_0_grid_left_edge))); - __pyx_t_4 = __pyx_v_i; - __pyx_t_5 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_grid_dds.buf, __pyx_t_4, __pyx_bstride_0_grid_dds)); - if (unlikely(__pyx_t_5 == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - (__pyx_v_li[__pyx_v_i]) = lrint((__pyx_t_3 / __pyx_t_5)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":646 - * for i in range(3): - * li[i] = lrint((self.left_edge[i] - grid_left_edge[i])/grid_dds[i]) - * ri[i] = lrint((self.right_edge[i] - grid_left_edge[i])/grid_dds[i]) # <<<<<<<<<<<<<< - * idims[i] = ri[i] - li[i] - * if child_mask[li[0], li[1], li[2]] == 0: return [] - */ - __pyx_t_6 = __pyx_v_i; - __pyx_t_5 = ((((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->right_edge[__pyx_v_i]) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_grid_left_edge.buf, __pyx_t_6, __pyx_bstride_0_grid_left_edge))); - __pyx_t_7 = __pyx_v_i; - __pyx_t_3 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_grid_dds.buf, __pyx_t_7, __pyx_bstride_0_grid_dds)); - if (unlikely(__pyx_t_3 == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - (__pyx_v_ri[__pyx_v_i]) = lrint((__pyx_t_5 / __pyx_t_3)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":647 - * li[i] = lrint((self.left_edge[i] - grid_left_edge[i])/grid_dds[i]) - * ri[i] = lrint((self.right_edge[i] - grid_left_edge[i])/grid_dds[i]) - * idims[i] = ri[i] - li[i] # <<<<<<<<<<<<<< - * if child_mask[li[0], li[1], li[2]] == 0: return [] - * cdef np.ndarray[np.int64_t, ndim=1] dims = np.empty(3, dtype='int64') - */ - (__pyx_v_idims[__pyx_v_i]) = ((__pyx_v_ri[__pyx_v_i]) - (__pyx_v_li[__pyx_v_i])); - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":648 - * ri[i] = lrint((self.right_edge[i] - grid_left_edge[i])/grid_dds[i]) - * idims[i] = ri[i] - li[i] - * if child_mask[li[0], li[1], li[2]] == 0: return [] # <<<<<<<<<<<<<< - * cdef np.ndarray[np.int64_t, ndim=1] dims = np.empty(3, dtype='int64') - * for i in range(3): - */ - __pyx_t_8 = PyInt_FromLong((__pyx_v_li[0])); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyInt_FromLong((__pyx_v_li[1])); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = PyInt_FromLong((__pyx_v_li[2])); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_9); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_10); - __pyx_t_8 = 0; - __pyx_t_9 = 0; - __pyx_t_10 = 0; - __pyx_t_10 = PyObject_GetItem(__pyx_v_child_mask, __pyx_t_11); if (!__pyx_t_10) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = PyObject_RichCompare(__pyx_t_10, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (__pyx_t_12) { - __Pyx_XDECREF(__pyx_r); - __pyx_t_11 = PyList_New(0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_11)); - __pyx_r = ((PyObject *)__pyx_t_11); - __pyx_t_11 = 0; - goto __pyx_L0; - goto __pyx_L8; - } - __pyx_L8:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":649 - * idims[i] = ri[i] - li[i] - * if child_mask[li[0], li[1], li[2]] == 0: return [] - * cdef np.ndarray[np.int64_t, ndim=1] dims = np.empty(3, dtype='int64') # <<<<<<<<<<<<<< - * for i in range(3): - * dims[i] = idims[i] - */ - __pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_10 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__empty); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __Pyx_INCREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_9)); - if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__int64)) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = PyEval_CallObjectWithKeywords(__pyx_t_10, __pyx_t_11, ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_13 = ((PyArrayObject *)__pyx_t_8); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dims, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_dims = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_dims.buf = NULL; - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_dims = __pyx_bstruct_dims.strides[0]; - __pyx_bshape_0_dims = __pyx_bstruct_dims.shape[0]; - } - } - __pyx_t_13 = 0; - __pyx_v_dims = ((PyArrayObject *)__pyx_t_8); - __pyx_t_8 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":650 - * if child_mask[li[0], li[1], li[2]] == 0: return [] - * cdef np.ndarray[np.int64_t, ndim=1] dims = np.empty(3, dtype='int64') - * for i in range(3): # <<<<<<<<<<<<<< - * dims[i] = idims[i] - * #cdef np.ndarray[np.float64_t, ndim=3] new_data - */ - for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":651 - * cdef np.ndarray[np.int64_t, ndim=1] dims = np.empty(3, dtype='int64') - * for i in range(3): - * dims[i] = idims[i] # <<<<<<<<<<<<<< - * #cdef np.ndarray[np.float64_t, ndim=3] new_data - * #new_data = data[li[0]:ri[0]+1,li[1]:ri[1]+1,li[2]:ri[2]+1].copy() - */ - __pyx_t_14 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_dims.buf, __pyx_t_14, __pyx_bstride_0_dims) = (__pyx_v_idims[__pyx_v_i]); - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":656 - * #PG = PartitionedGrid(self.parent_grid_id, new_data, - * # self.LeftEdge, self.RightEdge, dims) - * return ((li[0], ri[0]), (li[1], ri[1]), (li[2], ri[2]), dims) # <<<<<<<<<<<<<< - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_8 = PyInt_FromLong((__pyx_v_li[0])); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyInt_FromLong((__pyx_v_ri[0])); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_9); - __Pyx_GIVEREF(__pyx_t_9); - __pyx_t_8 = 0; - __pyx_t_9 = 0; - __pyx_t_9 = PyInt_FromLong((__pyx_v_li[1])); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = PyInt_FromLong((__pyx_v_ri[1])); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - __pyx_t_9 = 0; - __pyx_t_8 = 0; - __pyx_t_8 = PyInt_FromLong((__pyx_v_li[2])); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyInt_FromLong((__pyx_v_ri[2])); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_9); - __Pyx_GIVEREF(__pyx_t_9); - __pyx_t_8 = 0; - __pyx_t_9 = 0; - __pyx_t_9 = PyTuple_New(4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_11); - __Pyx_GIVEREF(__pyx_t_11); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_15); - __Pyx_GIVEREF(__pyx_t_15); - __Pyx_INCREF(((PyObject *)__pyx_v_dims)); - PyTuple_SET_ITEM(__pyx_t_9, 3, ((PyObject *)__pyx_v_dims)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_dims)); - __pyx_t_11 = 0; - __pyx_t_10 = 0; - __pyx_t_15 = 0; - __pyx_r = __pyx_t_9; - __pyx_t_9 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_XDECREF(__pyx_t_15); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_dds); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dims); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_left_edge); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.amr_utils.ProtoPrism.get_brick"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_dds); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dims); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_left_edge); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_dims); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":28 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * def CICDeposit_3(np.ndarray[np.float64_t, ndim=1] posx, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t, ndim=1] posy, - * np.ndarray[np.float64_t, ndim=1] posz, - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_CICDeposit_3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_CICDeposit_3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_posx = 0; - PyArrayObject *__pyx_v_posy = 0; - PyArrayObject *__pyx_v_posz = 0; - PyArrayObject *__pyx_v_mass = 0; - __pyx_t_5numpy_int64_t __pyx_v_npositions; - PyArrayObject *__pyx_v_field = 0; - PyArrayObject *__pyx_v_leftEdge = 0; - PyArrayObject *__pyx_v_gridDimension = 0; - __pyx_t_5numpy_float64_t __pyx_v_cellSize; - int __pyx_v_i1; - int __pyx_v_j1; - int __pyx_v_k1; - int __pyx_v_n; - double __pyx_v_xpos; - double __pyx_v_ypos; - double __pyx_v_zpos; - double __pyx_v_fact; - double __pyx_v_edge0; - double __pyx_v_edge1; - double __pyx_v_edge2; - double __pyx_v_le0; - double __pyx_v_le1; - double __pyx_v_le2; - float __pyx_v_dx; - float __pyx_v_dy; - float __pyx_v_dz; - float __pyx_v_dx2; - float __pyx_v_dy2; - float __pyx_v_dz2; - Py_buffer __pyx_bstruct_field; - Py_ssize_t __pyx_bstride_0_field = 0; - Py_ssize_t __pyx_bstride_1_field = 0; - Py_ssize_t __pyx_bstride_2_field = 0; - Py_ssize_t __pyx_bshape_0_field = 0; - Py_ssize_t __pyx_bshape_1_field = 0; - Py_ssize_t __pyx_bshape_2_field = 0; - Py_buffer __pyx_bstruct_leftEdge; - Py_ssize_t __pyx_bstride_0_leftEdge = 0; - Py_ssize_t __pyx_bshape_0_leftEdge = 0; - Py_buffer __pyx_bstruct_posz; - Py_ssize_t __pyx_bstride_0_posz = 0; - Py_ssize_t __pyx_bshape_0_posz = 0; - Py_buffer __pyx_bstruct_posx; - Py_ssize_t __pyx_bstride_0_posx = 0; - Py_ssize_t __pyx_bshape_0_posx = 0; - Py_buffer __pyx_bstruct_posy; - Py_ssize_t __pyx_bstride_0_posy = 0; - Py_ssize_t __pyx_bshape_0_posy = 0; - Py_buffer __pyx_bstruct_gridDimension; - Py_ssize_t __pyx_bstride_0_gridDimension = 0; - Py_ssize_t __pyx_bshape_0_gridDimension = 0; - Py_buffer __pyx_bstruct_mass; - Py_ssize_t __pyx_bstride_0_mass = 0; - Py_ssize_t __pyx_bshape_0_mass = 0; - PyObject *__pyx_r = NULL; - long __pyx_t_1; - long __pyx_t_2; - long __pyx_t_3; - long __pyx_t_4; - long __pyx_t_5; - long __pyx_t_6; - __pyx_t_5numpy_int64_t __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; - long __pyx_t_13; - long __pyx_t_14; - long __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - long __pyx_t_18; - long __pyx_t_19; - int __pyx_t_20; - long __pyx_t_21; - int __pyx_t_22; - long __pyx_t_23; - int __pyx_t_24; - int __pyx_t_25; - int __pyx_t_26; - long __pyx_t_27; - int __pyx_t_28; - long __pyx_t_29; - long __pyx_t_30; - int __pyx_t_31; - int __pyx_t_32; - int __pyx_t_33; - long __pyx_t_34; - int __pyx_t_35; - int __pyx_t_36; - long __pyx_t_37; - int __pyx_t_38; - int __pyx_t_39; - int __pyx_t_40; - int __pyx_t_41; - int __pyx_t_42; - int __pyx_t_43; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__posx,&__pyx_n_s__posy,&__pyx_n_s__posz,&__pyx_n_s__mass,&__pyx_n_s__npositions,&__pyx_n_s__field,&__pyx_n_s__leftEdge,&__pyx_n_s__gridDimension,&__pyx_n_s__cellSize,0}; - __Pyx_RefNannySetupContext("CICDeposit_3"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__posx); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__posy); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("CICDeposit_3", 1, 9, 9, 1); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__posz); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("CICDeposit_3", 1, 9, 9, 2); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mass); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("CICDeposit_3", 1, 9, 9, 3); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__npositions); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("CICDeposit_3", 1, 9, 9, 4); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__field); - if (likely(values[5])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("CICDeposit_3", 1, 9, 9, 5); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 6: - values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__leftEdge); - if (likely(values[6])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("CICDeposit_3", 1, 9, 9, 6); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 7: - values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__gridDimension); - if (likely(values[7])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("CICDeposit_3", 1, 9, 9, 7); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 8: - values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__cellSize); - if (likely(values[8])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("CICDeposit_3", 1, 9, 9, 8); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "CICDeposit_3") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_posx = ((PyArrayObject *)values[0]); - __pyx_v_posy = ((PyArrayObject *)values[1]); - __pyx_v_posz = ((PyArrayObject *)values[2]); - __pyx_v_mass = ((PyArrayObject *)values[3]); - __pyx_v_npositions = __Pyx_PyInt_from_py_npy_int64(values[4]); if (unlikely((__pyx_v_npositions == (npy_int64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_field = ((PyArrayObject *)values[5]); - __pyx_v_leftEdge = ((PyArrayObject *)values[6]); - __pyx_v_gridDimension = ((PyArrayObject *)values[7]); - __pyx_v_cellSize = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_cellSize == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 9) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_posx = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_posy = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_posz = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_mass = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); - __pyx_v_npositions = __Pyx_PyInt_from_py_npy_int64(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_npositions == (npy_int64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_field = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 5)); - __pyx_v_leftEdge = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 6)); - __pyx_v_gridDimension = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 7)); - __pyx_v_cellSize = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 8)); if (unlikely((__pyx_v_cellSize == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("CICDeposit_3", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.CICDeposit_3"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_posx.buf = NULL; - __pyx_bstruct_posy.buf = NULL; - __pyx_bstruct_posz.buf = NULL; - __pyx_bstruct_mass.buf = NULL; - __pyx_bstruct_field.buf = NULL; - __pyx_bstruct_leftEdge.buf = NULL; - __pyx_bstruct_gridDimension.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_posx), __pyx_ptype_5numpy_ndarray, 1, "posx", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_posy), __pyx_ptype_5numpy_ndarray, 1, "posy", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_posz), __pyx_ptype_5numpy_ndarray, 1, "posz", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mass), __pyx_ptype_5numpy_ndarray, 1, "mass", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_field), __pyx_ptype_5numpy_ndarray, 1, "field", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_leftEdge), __pyx_ptype_5numpy_ndarray, 1, "leftEdge", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gridDimension), __pyx_ptype_5numpy_ndarray, 1, "gridDimension", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_posx, (PyObject*)__pyx_v_posx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_posx = __pyx_bstruct_posx.strides[0]; - __pyx_bshape_0_posx = __pyx_bstruct_posx.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_posy, (PyObject*)__pyx_v_posy, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_posy = __pyx_bstruct_posy.strides[0]; - __pyx_bshape_0_posy = __pyx_bstruct_posy.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_posz, (PyObject*)__pyx_v_posz, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_posz = __pyx_bstruct_posz.strides[0]; - __pyx_bshape_0_posz = __pyx_bstruct_posz.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_mass, (PyObject*)__pyx_v_mass, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_mass = __pyx_bstruct_mass.strides[0]; - __pyx_bshape_0_mass = __pyx_bstruct_mass.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_field, (PyObject*)__pyx_v_field, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_field = __pyx_bstruct_field.strides[0]; __pyx_bstride_1_field = __pyx_bstruct_field.strides[1]; __pyx_bstride_2_field = __pyx_bstruct_field.strides[2]; - __pyx_bshape_0_field = __pyx_bstruct_field.shape[0]; __pyx_bshape_1_field = __pyx_bstruct_field.shape[1]; __pyx_bshape_2_field = __pyx_bstruct_field.shape[2]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_leftEdge, (PyObject*)__pyx_v_leftEdge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_leftEdge = __pyx_bstruct_leftEdge.strides[0]; - __pyx_bshape_0_leftEdge = __pyx_bstruct_leftEdge.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_gridDimension, (PyObject*)__pyx_v_gridDimension, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_gridDimension = __pyx_bstruct_gridDimension.strides[0]; - __pyx_bshape_0_gridDimension = __pyx_bstruct_gridDimension.shape[0]; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":44 - * cdef float dx, dy, dz, dx2, dy2, dz2 - * - * edge0 = ( gridDimension[0]) - 0.5001 # <<<<<<<<<<<<<< - * edge1 = ( gridDimension[1]) - 0.5001 - * edge2 = ( gridDimension[2]) - 0.5001 - */ - __pyx_t_1 = 0; - __pyx_v_edge0 = (((float)(*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_gridDimension.buf, __pyx_t_1, __pyx_bstride_0_gridDimension))) - 0.5001); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":45 - * - * edge0 = ( gridDimension[0]) - 0.5001 - * edge1 = ( gridDimension[1]) - 0.5001 # <<<<<<<<<<<<<< - * edge2 = ( gridDimension[2]) - 0.5001 - * fact = 1.0 / cellSize - */ - __pyx_t_2 = 1; - __pyx_v_edge1 = (((float)(*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_gridDimension.buf, __pyx_t_2, __pyx_bstride_0_gridDimension))) - 0.5001); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":46 - * edge0 = ( gridDimension[0]) - 0.5001 - * edge1 = ( gridDimension[1]) - 0.5001 - * edge2 = ( gridDimension[2]) - 0.5001 # <<<<<<<<<<<<<< - * fact = 1.0 / cellSize - * - */ - __pyx_t_3 = 2; - __pyx_v_edge2 = (((float)(*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_gridDimension.buf, __pyx_t_3, __pyx_bstride_0_gridDimension))) - 0.5001); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":47 - * edge1 = ( gridDimension[1]) - 0.5001 - * edge2 = ( gridDimension[2]) - 0.5001 - * fact = 1.0 / cellSize # <<<<<<<<<<<<<< - * - * le0 = leftEdge[0] - */ - if (unlikely(__pyx_v_cellSize == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_fact = (1.0 / __pyx_v_cellSize); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":49 - * fact = 1.0 / cellSize - * - * le0 = leftEdge[0] # <<<<<<<<<<<<<< - * le1 = leftEdge[1] - * le2 = leftEdge[2] - */ - __pyx_t_4 = 0; - __pyx_v_le0 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_leftEdge.buf, __pyx_t_4, __pyx_bstride_0_leftEdge)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":50 - * - * le0 = leftEdge[0] - * le1 = leftEdge[1] # <<<<<<<<<<<<<< - * le2 = leftEdge[2] - * - */ - __pyx_t_5 = 1; - __pyx_v_le1 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_leftEdge.buf, __pyx_t_5, __pyx_bstride_0_leftEdge)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":51 - * le0 = leftEdge[0] - * le1 = leftEdge[1] - * le2 = leftEdge[2] # <<<<<<<<<<<<<< - * - * for n in range(npositions): - */ - __pyx_t_6 = 2; - __pyx_v_le2 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_leftEdge.buf, __pyx_t_6, __pyx_bstride_0_leftEdge)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":53 - * le2 = leftEdge[2] - * - * for n in range(npositions): # <<<<<<<<<<<<<< - * - * # Compute the position of the central cell - */ - __pyx_t_7 = __pyx_v_npositions; - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { - __pyx_v_n = __pyx_t_8; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":56 - * - * # Compute the position of the central cell - * xpos = fmin(fmax((posx[n] - le0)*fact, 0.5001), edge0) # <<<<<<<<<<<<<< - * ypos = fmin(fmax((posy[n] - le1)*fact, 0.5001), edge1) - * zpos = fmin(fmax((posz[n] - le2)*fact, 0.5001), edge2) - */ - __pyx_t_9 = __pyx_v_n; - __pyx_v_xpos = __pyx_f_2yt_9amr_utils_fmin(__pyx_f_2yt_9amr_utils_fmax((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_posx.buf, __pyx_t_9, __pyx_bstride_0_posx)) - __pyx_v_le0) * __pyx_v_fact), 0.5001), __pyx_v_edge0); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":57 - * # Compute the position of the central cell - * xpos = fmin(fmax((posx[n] - le0)*fact, 0.5001), edge0) - * ypos = fmin(fmax((posy[n] - le1)*fact, 0.5001), edge1) # <<<<<<<<<<<<<< - * zpos = fmin(fmax((posz[n] - le2)*fact, 0.5001), edge2) - * - */ - __pyx_t_10 = __pyx_v_n; - __pyx_v_ypos = __pyx_f_2yt_9amr_utils_fmin(__pyx_f_2yt_9amr_utils_fmax((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_posy.buf, __pyx_t_10, __pyx_bstride_0_posy)) - __pyx_v_le1) * __pyx_v_fact), 0.5001), __pyx_v_edge1); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":58 - * xpos = fmin(fmax((posx[n] - le0)*fact, 0.5001), edge0) - * ypos = fmin(fmax((posy[n] - le1)*fact, 0.5001), edge1) - * zpos = fmin(fmax((posz[n] - le2)*fact, 0.5001), edge2) # <<<<<<<<<<<<<< - * - * i1 = (xpos + 0.5) - */ - __pyx_t_11 = __pyx_v_n; - __pyx_v_zpos = __pyx_f_2yt_9amr_utils_fmin(__pyx_f_2yt_9amr_utils_fmax((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_posz.buf, __pyx_t_11, __pyx_bstride_0_posz)) - __pyx_v_le2) * __pyx_v_fact), 0.5001), __pyx_v_edge2); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":60 - * zpos = fmin(fmax((posz[n] - le2)*fact, 0.5001), edge2) - * - * i1 = (xpos + 0.5) # <<<<<<<<<<<<<< - * j1 = (ypos + 0.5) - * k1 = (zpos + 0.5) - */ - __pyx_v_i1 = ((int)(__pyx_v_xpos + 0.5)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":61 - * - * i1 = (xpos + 0.5) - * j1 = (ypos + 0.5) # <<<<<<<<<<<<<< - * k1 = (zpos + 0.5) - * - */ - __pyx_v_j1 = ((int)(__pyx_v_ypos + 0.5)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":62 - * i1 = (xpos + 0.5) - * j1 = (ypos + 0.5) - * k1 = (zpos + 0.5) # <<<<<<<<<<<<<< - * - * # Compute the weights - */ - __pyx_v_k1 = ((int)(__pyx_v_zpos + 0.5)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":65 - * - * # Compute the weights - * dx = ( i1) + 0.5 - xpos # <<<<<<<<<<<<<< - * dy = ( j1) + 0.5 - ypos - * dz = ( k1) + 0.5 - zpos - */ - __pyx_v_dx = ((((float)__pyx_v_i1) + 0.5) - __pyx_v_xpos); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":66 - * # Compute the weights - * dx = ( i1) + 0.5 - xpos - * dy = ( j1) + 0.5 - ypos # <<<<<<<<<<<<<< - * dz = ( k1) + 0.5 - zpos - * dx2 = 1.0 - dx - */ - __pyx_v_dy = ((((float)__pyx_v_j1) + 0.5) - __pyx_v_ypos); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":67 - * dx = ( i1) + 0.5 - xpos - * dy = ( j1) + 0.5 - ypos - * dz = ( k1) + 0.5 - zpos # <<<<<<<<<<<<<< - * dx2 = 1.0 - dx - * dy2 = 1.0 - dy - */ - __pyx_v_dz = ((((float)__pyx_v_k1) + 0.5) - __pyx_v_zpos); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":68 - * dy = ( j1) + 0.5 - ypos - * dz = ( k1) + 0.5 - zpos - * dx2 = 1.0 - dx # <<<<<<<<<<<<<< - * dy2 = 1.0 - dy - * dz2 = 1.0 - dz - */ - __pyx_v_dx2 = (1.0 - __pyx_v_dx); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":69 - * dz = ( k1) + 0.5 - zpos - * dx2 = 1.0 - dx - * dy2 = 1.0 - dy # <<<<<<<<<<<<<< - * dz2 = 1.0 - dz - * - */ - __pyx_v_dy2 = (1.0 - __pyx_v_dy); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":70 - * dx2 = 1.0 - dx - * dy2 = 1.0 - dy - * dz2 = 1.0 - dz # <<<<<<<<<<<<<< - * - * # Interpolate from field into sumfield - */ - __pyx_v_dz2 = (1.0 - __pyx_v_dz); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":73 - * - * # Interpolate from field into sumfield - * field[i1-1,j1-1,k1-1] += mass[n] * dx * dy * dz # <<<<<<<<<<<<<< - * field[i1 ,j1-1,k1-1] += mass[n] * dx2 * dy * dz - * field[i1-1,j1 ,k1-1] += mass[n] * dx * dy2 * dz - */ - __pyx_t_12 = __pyx_v_n; - __pyx_t_13 = (__pyx_v_i1 - 1); - __pyx_t_14 = (__pyx_v_j1 - 1); - __pyx_t_15 = (__pyx_v_k1 - 1); - *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_field.buf, __pyx_t_13, __pyx_bstride_0_field, __pyx_t_14, __pyx_bstride_1_field, __pyx_t_15, __pyx_bstride_2_field) += ((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_mass.buf, __pyx_t_12, __pyx_bstride_0_mass)) * __pyx_v_dx) * __pyx_v_dy) * __pyx_v_dz); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":74 - * # Interpolate from field into sumfield - * field[i1-1,j1-1,k1-1] += mass[n] * dx * dy * dz - * field[i1 ,j1-1,k1-1] += mass[n] * dx2 * dy * dz # <<<<<<<<<<<<<< - * field[i1-1,j1 ,k1-1] += mass[n] * dx * dy2 * dz - * field[i1 ,j1 ,k1-1] += mass[n] * dx2 * dy2 * dz - */ - __pyx_t_16 = __pyx_v_n; - __pyx_t_17 = __pyx_v_i1; - __pyx_t_18 = (__pyx_v_j1 - 1); - __pyx_t_19 = (__pyx_v_k1 - 1); - *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_field.buf, __pyx_t_17, __pyx_bstride_0_field, __pyx_t_18, __pyx_bstride_1_field, __pyx_t_19, __pyx_bstride_2_field) += ((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_mass.buf, __pyx_t_16, __pyx_bstride_0_mass)) * __pyx_v_dx2) * __pyx_v_dy) * __pyx_v_dz); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":75 - * field[i1-1,j1-1,k1-1] += mass[n] * dx * dy * dz - * field[i1 ,j1-1,k1-1] += mass[n] * dx2 * dy * dz - * field[i1-1,j1 ,k1-1] += mass[n] * dx * dy2 * dz # <<<<<<<<<<<<<< - * field[i1 ,j1 ,k1-1] += mass[n] * dx2 * dy2 * dz - * field[i1-1,j1-1,k1 ] += mass[n] * dx * dy * dz2 - */ - __pyx_t_20 = __pyx_v_n; - __pyx_t_21 = (__pyx_v_i1 - 1); - __pyx_t_22 = __pyx_v_j1; - __pyx_t_23 = (__pyx_v_k1 - 1); - *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_field.buf, __pyx_t_21, __pyx_bstride_0_field, __pyx_t_22, __pyx_bstride_1_field, __pyx_t_23, __pyx_bstride_2_field) += ((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_mass.buf, __pyx_t_20, __pyx_bstride_0_mass)) * __pyx_v_dx) * __pyx_v_dy2) * __pyx_v_dz); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":76 - * field[i1 ,j1-1,k1-1] += mass[n] * dx2 * dy * dz - * field[i1-1,j1 ,k1-1] += mass[n] * dx * dy2 * dz - * field[i1 ,j1 ,k1-1] += mass[n] * dx2 * dy2 * dz # <<<<<<<<<<<<<< - * field[i1-1,j1-1,k1 ] += mass[n] * dx * dy * dz2 - * field[i1 ,j1-1,k1 ] += mass[n] * dx2 * dy * dz2 - */ - __pyx_t_24 = __pyx_v_n; - __pyx_t_25 = __pyx_v_i1; - __pyx_t_26 = __pyx_v_j1; - __pyx_t_27 = (__pyx_v_k1 - 1); - *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_field.buf, __pyx_t_25, __pyx_bstride_0_field, __pyx_t_26, __pyx_bstride_1_field, __pyx_t_27, __pyx_bstride_2_field) += ((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_mass.buf, __pyx_t_24, __pyx_bstride_0_mass)) * __pyx_v_dx2) * __pyx_v_dy2) * __pyx_v_dz); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":77 - * field[i1-1,j1 ,k1-1] += mass[n] * dx * dy2 * dz - * field[i1 ,j1 ,k1-1] += mass[n] * dx2 * dy2 * dz - * field[i1-1,j1-1,k1 ] += mass[n] * dx * dy * dz2 # <<<<<<<<<<<<<< - * field[i1 ,j1-1,k1 ] += mass[n] * dx2 * dy * dz2 - * field[i1-1,j1 ,k1 ] += mass[n] * dx * dy2 * dz2 - */ - __pyx_t_28 = __pyx_v_n; - __pyx_t_29 = (__pyx_v_i1 - 1); - __pyx_t_30 = (__pyx_v_j1 - 1); - __pyx_t_31 = __pyx_v_k1; - *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_field.buf, __pyx_t_29, __pyx_bstride_0_field, __pyx_t_30, __pyx_bstride_1_field, __pyx_t_31, __pyx_bstride_2_field) += ((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_mass.buf, __pyx_t_28, __pyx_bstride_0_mass)) * __pyx_v_dx) * __pyx_v_dy) * __pyx_v_dz2); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":78 - * field[i1 ,j1 ,k1-1] += mass[n] * dx2 * dy2 * dz - * field[i1-1,j1-1,k1 ] += mass[n] * dx * dy * dz2 - * field[i1 ,j1-1,k1 ] += mass[n] * dx2 * dy * dz2 # <<<<<<<<<<<<<< - * field[i1-1,j1 ,k1 ] += mass[n] * dx * dy2 * dz2 - * field[i1 ,j1 ,k1 ] += mass[n] * dx2 * dy2 * dz2 - */ - __pyx_t_32 = __pyx_v_n; - __pyx_t_33 = __pyx_v_i1; - __pyx_t_34 = (__pyx_v_j1 - 1); - __pyx_t_35 = __pyx_v_k1; - *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_field.buf, __pyx_t_33, __pyx_bstride_0_field, __pyx_t_34, __pyx_bstride_1_field, __pyx_t_35, __pyx_bstride_2_field) += ((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_mass.buf, __pyx_t_32, __pyx_bstride_0_mass)) * __pyx_v_dx2) * __pyx_v_dy) * __pyx_v_dz2); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":79 - * field[i1-1,j1-1,k1 ] += mass[n] * dx * dy * dz2 - * field[i1 ,j1-1,k1 ] += mass[n] * dx2 * dy * dz2 - * field[i1-1,j1 ,k1 ] += mass[n] * dx * dy2 * dz2 # <<<<<<<<<<<<<< - * field[i1 ,j1 ,k1 ] += mass[n] * dx2 * dy2 * dz2 - */ - __pyx_t_36 = __pyx_v_n; - __pyx_t_37 = (__pyx_v_i1 - 1); - __pyx_t_38 = __pyx_v_j1; - __pyx_t_39 = __pyx_v_k1; - *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_field.buf, __pyx_t_37, __pyx_bstride_0_field, __pyx_t_38, __pyx_bstride_1_field, __pyx_t_39, __pyx_bstride_2_field) += ((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_mass.buf, __pyx_t_36, __pyx_bstride_0_mass)) * __pyx_v_dx) * __pyx_v_dy2) * __pyx_v_dz2); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":80 - * field[i1 ,j1-1,k1 ] += mass[n] * dx2 * dy * dz2 - * field[i1-1,j1 ,k1 ] += mass[n] * dx * dy2 * dz2 - * field[i1 ,j1 ,k1 ] += mass[n] * dx2 * dy2 * dz2 # <<<<<<<<<<<<<< - */ - __pyx_t_40 = __pyx_v_n; - __pyx_t_41 = __pyx_v_i1; - __pyx_t_42 = __pyx_v_j1; - __pyx_t_43 = __pyx_v_k1; - *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_field.buf, __pyx_t_41, __pyx_bstride_0_field, __pyx_t_42, __pyx_bstride_1_field, __pyx_t_43, __pyx_bstride_2_field) += ((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_mass.buf, __pyx_t_40, __pyx_bstride_0_mass)) * __pyx_v_dx2) * __pyx_v_dy2) * __pyx_v_dz2); - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_field); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_leftEdge); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_posz); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_posx); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_posy); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_gridDimension); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mass); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.amr_utils.CICDeposit_3"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_field); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_leftEdge); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_posz); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_posx); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_posy); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_gridDimension); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mass); - __pyx_L2:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":33 - * double fabs(double x) - * - * cdef inline np.int64_t i64max(np.int64_t i0, np.int64_t i1): # <<<<<<<<<<<<<< - * if i0 > i1: return i0 - * return i1 - */ - -static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_9amr_utils_i64max(__pyx_t_5numpy_int64_t __pyx_v_i0, __pyx_t_5numpy_int64_t __pyx_v_i1) { - __pyx_t_5numpy_int64_t __pyx_r; - int __pyx_t_1; - __Pyx_RefNannySetupContext("i64max"); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":34 - * - * cdef inline np.int64_t i64max(np.int64_t i0, np.int64_t i1): - * if i0 > i1: return i0 # <<<<<<<<<<<<<< - * return i1 - * - */ - __pyx_t_1 = (__pyx_v_i0 > __pyx_v_i1); - if (__pyx_t_1) { - __pyx_r = __pyx_v_i0; - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":35 - * cdef inline np.int64_t i64max(np.int64_t i0, np.int64_t i1): - * if i0 > i1: return i0 - * return i1 # <<<<<<<<<<<<<< - * - * cdef inline np.int64_t i64min(np.int64_t i0, np.int64_t i1): - */ - __pyx_r = __pyx_v_i1; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":37 - * return i1 - * - * cdef inline np.int64_t i64min(np.int64_t i0, np.int64_t i1): # <<<<<<<<<<<<<< - * if i0 < i1: return i0 - * return i1 - */ - -static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_9amr_utils_i64min(__pyx_t_5numpy_int64_t __pyx_v_i0, __pyx_t_5numpy_int64_t __pyx_v_i1) { - __pyx_t_5numpy_int64_t __pyx_r; - int __pyx_t_1; - __Pyx_RefNannySetupContext("i64min"); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":38 - * - * cdef inline np.int64_t i64min(np.int64_t i0, np.int64_t i1): - * if i0 < i1: return i0 # <<<<<<<<<<<<<< - * return i1 - * - */ - __pyx_t_1 = (__pyx_v_i0 < __pyx_v_i1); - if (__pyx_t_1) { - __pyx_r = __pyx_v_i0; - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":39 - * cdef inline np.int64_t i64min(np.int64_t i0, np.int64_t i1): - * if i0 < i1: return i0 - * return i1 # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) - */ - __pyx_r = __pyx_v_i1; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":42 - * - * @cython.boundscheck(False) - * def construct_boundary_relationships( # <<<<<<<<<<<<<< - * np.ndarray[dtype=np.int64_t, ndim=3] contour_ids): - * # We only look at the boundary and one cell in - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_construct_boundary_relationships(PyObject *__pyx_self, PyObject *__pyx_v_contour_ids); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_construct_boundary_relationships(PyObject *__pyx_self, PyObject *__pyx_v_contour_ids) { - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_nx; - int __pyx_v_ny; - int __pyx_v_nz; - int __pyx_v_offset_i; - int __pyx_v_offset_j; - int __pyx_v_oi; - int __pyx_v_oj; - __pyx_t_5numpy_int64_t __pyx_v_c1; - __pyx_t_5numpy_int64_t __pyx_v_c2; - PyObject *__pyx_v_tree; - Py_buffer __pyx_bstruct_contour_ids; - Py_ssize_t __pyx_bstride_0_contour_ids = 0; - Py_ssize_t __pyx_bstride_1_contour_ids = 0; - Py_ssize_t __pyx_bstride_2_contour_ids = 0; - Py_ssize_t __pyx_bshape_0_contour_ids = 0; - Py_ssize_t __pyx_bshape_1_contour_ids = 0; - Py_ssize_t __pyx_bshape_2_contour_ids = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - long __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; - long __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - PyObject *__pyx_t_17 = NULL; - PyObject *__pyx_t_18 = NULL; - int __pyx_t_19; - long __pyx_t_20; - int __pyx_t_21; - long __pyx_t_22; - int __pyx_t_23; - int __pyx_t_24; - int __pyx_t_25; - long __pyx_t_26; - int __pyx_t_27; - int __pyx_t_28; - long __pyx_t_29; - int __pyx_t_30; - int __pyx_t_31; - long __pyx_t_32; - int __pyx_t_33; - int __pyx_t_34; - long __pyx_t_35; - int __pyx_t_36; - int __pyx_t_37; - int __pyx_t_38; - long __pyx_t_39; - int __pyx_t_40; - int __pyx_t_41; - long __pyx_t_42; - int __pyx_t_43; - int __pyx_t_44; - long __pyx_t_45; - int __pyx_t_46; - int __pyx_t_47; - long __pyx_t_48; - int __pyx_t_49; - __Pyx_RefNannySetupContext("construct_boundary_relationships"); - __pyx_self = __pyx_self; - __pyx_v_tree = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_bstruct_contour_ids.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_contour_ids), __pyx_ptype_5numpy_ndarray, 1, "contour_ids", 0))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_contour_ids, (PyObject*)__pyx_v_contour_ids, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_contour_ids = __pyx_bstruct_contour_ids.strides[0]; __pyx_bstride_1_contour_ids = __pyx_bstruct_contour_ids.strides[1]; __pyx_bstride_2_contour_ids = __pyx_bstruct_contour_ids.strides[2]; - __pyx_bshape_0_contour_ids = __pyx_bstruct_contour_ids.shape[0]; __pyx_bshape_1_contour_ids = __pyx_bstruct_contour_ids.shape[1]; __pyx_bshape_2_contour_ids = __pyx_bstruct_contour_ids.shape[2]; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":47 - * cdef int i, j, nx, ny, nz, offset_i, offset_j, oi, oj - * cdef np.int64_t c1, c2 - * tree = [] # <<<<<<<<<<<<<< - * nx = contour_ids.shape[0] - * ny = contour_ids.shape[1] - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(((PyObject *)__pyx_v_tree)); - __pyx_v_tree = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":48 - * cdef np.int64_t c1, c2 - * tree = [] - * nx = contour_ids.shape[0] # <<<<<<<<<<<<<< - * ny = contour_ids.shape[1] - * nz = contour_ids.shape[2] - */ - __pyx_v_nx = (((PyArrayObject *)__pyx_v_contour_ids)->dimensions[0]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":49 - * tree = [] - * nx = contour_ids.shape[0] - * ny = contour_ids.shape[1] # <<<<<<<<<<<<<< - * nz = contour_ids.shape[2] - * # First x-pass - */ - __pyx_v_ny = (((PyArrayObject *)__pyx_v_contour_ids)->dimensions[1]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":50 - * nx = contour_ids.shape[0] - * ny = contour_ids.shape[1] - * nz = contour_ids.shape[2] # <<<<<<<<<<<<<< - * # First x-pass - * for i in range(ny): - */ - __pyx_v_nz = (((PyArrayObject *)__pyx_v_contour_ids)->dimensions[2]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":52 - * nz = contour_ids.shape[2] - * # First x-pass - * for i in range(ny): # <<<<<<<<<<<<<< - * for j in range(nz): - * for offset_i in range(3): - */ - __pyx_t_2 = __pyx_v_ny; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":53 - * # First x-pass - * for i in range(ny): - * for j in range(nz): # <<<<<<<<<<<<<< - * for offset_i in range(3): - * oi = offset_i - 1 - */ - __pyx_t_4 = __pyx_v_nz; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_j = __pyx_t_5; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":54 - * for i in range(ny): - * for j in range(nz): - * for offset_i in range(3): # <<<<<<<<<<<<<< - * oi = offset_i - 1 - * if i == 0 and oi == -1: continue - */ - for (__pyx_t_6 = 0; __pyx_t_6 < 3; __pyx_t_6+=1) { - __pyx_v_offset_i = __pyx_t_6; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":55 - * for j in range(nz): - * for offset_i in range(3): - * oi = offset_i - 1 # <<<<<<<<<<<<<< - * if i == 0 and oi == -1: continue - * if i == ny - 1 and oj == 1: continue - */ - __pyx_v_oi = (__pyx_v_offset_i - 1); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":56 - * for offset_i in range(3): - * oi = offset_i - 1 - * if i == 0 and oi == -1: continue # <<<<<<<<<<<<<< - * if i == ny - 1 and oj == 1: continue - * for offset_j in range(3): - */ - __pyx_t_7 = (__pyx_v_i == 0); - if (__pyx_t_7) { - __pyx_t_8 = (__pyx_v_oi == -1); - __pyx_t_9 = __pyx_t_8; - } else { - __pyx_t_9 = __pyx_t_7; - } - if (__pyx_t_9) { - goto __pyx_L9_continue; - goto __pyx_L11; - } - __pyx_L11:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":57 - * oi = offset_i - 1 - * if i == 0 and oi == -1: continue - * if i == ny - 1 and oj == 1: continue # <<<<<<<<<<<<<< - * for offset_j in range(3): - * oj = offset_j - 1 - */ - __pyx_t_9 = (__pyx_v_i == (__pyx_v_ny - 1)); - if (__pyx_t_9) { - __pyx_t_7 = (__pyx_v_oj == 1); - __pyx_t_8 = __pyx_t_7; - } else { - __pyx_t_8 = __pyx_t_9; - } - if (__pyx_t_8) { - goto __pyx_L9_continue; - goto __pyx_L12; - } - __pyx_L12:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":58 - * if i == 0 and oi == -1: continue - * if i == ny - 1 and oj == 1: continue - * for offset_j in range(3): # <<<<<<<<<<<<<< - * oj = offset_j - 1 - * if j == 0 and oj == -1: continue - */ - for (__pyx_t_10 = 0; __pyx_t_10 < 3; __pyx_t_10+=1) { - __pyx_v_offset_j = __pyx_t_10; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":59 - * if i == ny - 1 and oj == 1: continue - * for offset_j in range(3): - * oj = offset_j - 1 # <<<<<<<<<<<<<< - * if j == 0 and oj == -1: continue - * if j == nz - 1 and oj == 1: continue - */ - __pyx_v_oj = (__pyx_v_offset_j - 1); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":60 - * for offset_j in range(3): - * oj = offset_j - 1 - * if j == 0 and oj == -1: continue # <<<<<<<<<<<<<< - * if j == nz - 1 and oj == 1: continue - * c1 = contour_ids[0, i, j] - */ - __pyx_t_8 = (__pyx_v_j == 0); - if (__pyx_t_8) { - __pyx_t_9 = (__pyx_v_oj == -1); - __pyx_t_7 = __pyx_t_9; - } else { - __pyx_t_7 = __pyx_t_8; - } - if (__pyx_t_7) { - goto __pyx_L13_continue; - goto __pyx_L15; - } - __pyx_L15:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":61 - * oj = offset_j - 1 - * if j == 0 and oj == -1: continue - * if j == nz - 1 and oj == 1: continue # <<<<<<<<<<<<<< - * c1 = contour_ids[0, i, j] - * c2 = contour_ids[1, i + oi, j + oj] - */ - __pyx_t_7 = (__pyx_v_j == (__pyx_v_nz - 1)); - if (__pyx_t_7) { - __pyx_t_8 = (__pyx_v_oj == 1); - __pyx_t_9 = __pyx_t_8; - } else { - __pyx_t_9 = __pyx_t_7; - } - if (__pyx_t_9) { - goto __pyx_L13_continue; - goto __pyx_L16; - } - __pyx_L16:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":62 - * if j == 0 and oj == -1: continue - * if j == nz - 1 and oj == 1: continue - * c1 = contour_ids[0, i, j] # <<<<<<<<<<<<<< - * c2 = contour_ids[1, i + oi, j + oj] - * if c1 > -1 and c2 > -1: - */ - __pyx_t_11 = 0; - __pyx_t_12 = __pyx_v_i; - __pyx_t_13 = __pyx_v_j; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_bshape_0_contour_ids; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_bshape_1_contour_ids; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_bshape_2_contour_ids; - __pyx_v_c1 = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_contour_ids.buf, __pyx_t_11, __pyx_bstride_0_contour_ids, __pyx_t_12, __pyx_bstride_1_contour_ids, __pyx_t_13, __pyx_bstride_2_contour_ids)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":63 - * if j == nz - 1 and oj == 1: continue - * c1 = contour_ids[0, i, j] - * c2 = contour_ids[1, i + oi, j + oj] # <<<<<<<<<<<<<< - * if c1 > -1 and c2 > -1: - * tree.append((i64max(c1,c2), i64min(c1,c2))) - */ - __pyx_t_14 = 1; - __pyx_t_15 = (__pyx_v_i + __pyx_v_oi); - __pyx_t_16 = (__pyx_v_j + __pyx_v_oj); - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_0_contour_ids; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_1_contour_ids; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_bshape_2_contour_ids; - __pyx_v_c2 = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_contour_ids.buf, __pyx_t_14, __pyx_bstride_0_contour_ids, __pyx_t_15, __pyx_bstride_1_contour_ids, __pyx_t_16, __pyx_bstride_2_contour_ids)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":64 - * c1 = contour_ids[0, i, j] - * c2 = contour_ids[1, i + oi, j + oj] - * if c1 > -1 and c2 > -1: # <<<<<<<<<<<<<< - * tree.append((i64max(c1,c2), i64min(c1,c2))) - * c1 = contour_ids[nx-1, i, j] - */ - __pyx_t_9 = (__pyx_v_c1 > -1); - if (__pyx_t_9) { - __pyx_t_7 = (__pyx_v_c2 > -1); - __pyx_t_8 = __pyx_t_7; - } else { - __pyx_t_8 = __pyx_t_9; - } - if (__pyx_t_8) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":65 - * c2 = contour_ids[1, i + oi, j + oj] - * if c1 > -1 and c2 > -1: - * tree.append((i64max(c1,c2), i64min(c1,c2))) # <<<<<<<<<<<<<< - * c1 = contour_ids[nx-1, i, j] - * c2 = contour_ids[nx-2, i + oi, j + oj] - */ - if (unlikely(__pyx_v_tree == Py_None)) { - PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_1 = __Pyx_PyInt_to_py_npy_int64(__pyx_f_2yt_9amr_utils_i64max(__pyx_v_c1, __pyx_v_c2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_17 = __Pyx_PyInt_to_py_npy_int64(__pyx_f_2yt_9amr_utils_i64min(__pyx_v_c1, __pyx_v_c2)); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_17); - __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_17); - __Pyx_GIVEREF(__pyx_t_17); - __pyx_t_1 = 0; - __pyx_t_17 = 0; - __pyx_t_19 = PyList_Append(((PyObject *)__pyx_v_tree), __pyx_t_18); if (unlikely(__pyx_t_19 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - goto __pyx_L17; - } - __pyx_L17:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":66 - * if c1 > -1 and c2 > -1: - * tree.append((i64max(c1,c2), i64min(c1,c2))) - * c1 = contour_ids[nx-1, i, j] # <<<<<<<<<<<<<< - * c2 = contour_ids[nx-2, i + oi, j + oj] - * if c1 > -1 and c2 > -1: - */ - __pyx_t_20 = (__pyx_v_nx - 1); - __pyx_t_19 = __pyx_v_i; - __pyx_t_21 = __pyx_v_j; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_bshape_0_contour_ids; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_bshape_1_contour_ids; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_bshape_2_contour_ids; - __pyx_v_c1 = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_contour_ids.buf, __pyx_t_20, __pyx_bstride_0_contour_ids, __pyx_t_19, __pyx_bstride_1_contour_ids, __pyx_t_21, __pyx_bstride_2_contour_ids)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":67 - * tree.append((i64max(c1,c2), i64min(c1,c2))) - * c1 = contour_ids[nx-1, i, j] - * c2 = contour_ids[nx-2, i + oi, j + oj] # <<<<<<<<<<<<<< - * if c1 > -1 and c2 > -1: - * tree.append((i64max(c1,c2), i64min(c1,c2))) - */ - __pyx_t_22 = (__pyx_v_nx - 2); - __pyx_t_23 = (__pyx_v_i + __pyx_v_oi); - __pyx_t_24 = (__pyx_v_j + __pyx_v_oj); - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_bshape_0_contour_ids; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_bshape_1_contour_ids; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_bshape_2_contour_ids; - __pyx_v_c2 = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_contour_ids.buf, __pyx_t_22, __pyx_bstride_0_contour_ids, __pyx_t_23, __pyx_bstride_1_contour_ids, __pyx_t_24, __pyx_bstride_2_contour_ids)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":68 - * c1 = contour_ids[nx-1, i, j] - * c2 = contour_ids[nx-2, i + oi, j + oj] - * if c1 > -1 and c2 > -1: # <<<<<<<<<<<<<< - * tree.append((i64max(c1,c2), i64min(c1,c2))) - * # Now y-pass - */ - __pyx_t_8 = (__pyx_v_c1 > -1); - if (__pyx_t_8) { - __pyx_t_9 = (__pyx_v_c2 > -1); - __pyx_t_7 = __pyx_t_9; - } else { - __pyx_t_7 = __pyx_t_8; - } - if (__pyx_t_7) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":69 - * c2 = contour_ids[nx-2, i + oi, j + oj] - * if c1 > -1 and c2 > -1: - * tree.append((i64max(c1,c2), i64min(c1,c2))) # <<<<<<<<<<<<<< - * # Now y-pass - * for i in range(nx): - */ - if (unlikely(__pyx_v_tree == Py_None)) { - PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_18 = __Pyx_PyInt_to_py_npy_int64(__pyx_f_2yt_9amr_utils_i64max(__pyx_v_c1, __pyx_v_c2)); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_17 = __Pyx_PyInt_to_py_npy_int64(__pyx_f_2yt_9amr_utils_i64min(__pyx_v_c1, __pyx_v_c2)); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_17); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_18); - __Pyx_GIVEREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_17); - __Pyx_GIVEREF(__pyx_t_17); - __pyx_t_18 = 0; - __pyx_t_17 = 0; - __pyx_t_25 = PyList_Append(((PyObject *)__pyx_v_tree), __pyx_t_1); if (unlikely(__pyx_t_25 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L18; - } - __pyx_L18:; - __pyx_L13_continue:; - } - __pyx_L9_continue:; - } - } - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":71 - * tree.append((i64max(c1,c2), i64min(c1,c2))) - * # Now y-pass - * for i in range(nx): # <<<<<<<<<<<<<< - * for j in range(nz): - * for offset_i in range(3): - */ - __pyx_t_2 = __pyx_v_nx; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":72 - * # Now y-pass - * for i in range(nx): - * for j in range(nz): # <<<<<<<<<<<<<< - * for offset_i in range(3): - * oi = offset_i - 1 - */ - __pyx_t_4 = __pyx_v_nz; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_j = __pyx_t_5; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":73 - * for i in range(nx): - * for j in range(nz): - * for offset_i in range(3): # <<<<<<<<<<<<<< - * oi = offset_i - 1 - * if i == 0 and oi == -1: continue - */ - for (__pyx_t_6 = 0; __pyx_t_6 < 3; __pyx_t_6+=1) { - __pyx_v_offset_i = __pyx_t_6; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":74 - * for j in range(nz): - * for offset_i in range(3): - * oi = offset_i - 1 # <<<<<<<<<<<<<< - * if i == 0 and oi == -1: continue - * if i == nx - 1 and oj == 1: continue - */ - __pyx_v_oi = (__pyx_v_offset_i - 1); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":75 - * for offset_i in range(3): - * oi = offset_i - 1 - * if i == 0 and oi == -1: continue # <<<<<<<<<<<<<< - * if i == nx - 1 and oj == 1: continue - * for offset_j in range(3): - */ - __pyx_t_7 = (__pyx_v_i == 0); - if (__pyx_t_7) { - __pyx_t_8 = (__pyx_v_oi == -1); - __pyx_t_9 = __pyx_t_8; - } else { - __pyx_t_9 = __pyx_t_7; - } - if (__pyx_t_9) { - goto __pyx_L23_continue; - goto __pyx_L25; - } - __pyx_L25:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":76 - * oi = offset_i - 1 - * if i == 0 and oi == -1: continue - * if i == nx - 1 and oj == 1: continue # <<<<<<<<<<<<<< - * for offset_j in range(3): - * oj = offset_j - 1 - */ - __pyx_t_9 = (__pyx_v_i == (__pyx_v_nx - 1)); - if (__pyx_t_9) { - __pyx_t_7 = (__pyx_v_oj == 1); - __pyx_t_8 = __pyx_t_7; - } else { - __pyx_t_8 = __pyx_t_9; - } - if (__pyx_t_8) { - goto __pyx_L23_continue; - goto __pyx_L26; - } - __pyx_L26:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":77 - * if i == 0 and oi == -1: continue - * if i == nx - 1 and oj == 1: continue - * for offset_j in range(3): # <<<<<<<<<<<<<< - * oj = offset_j - 1 - * if j == 0 and oj == -1: continue - */ - for (__pyx_t_10 = 0; __pyx_t_10 < 3; __pyx_t_10+=1) { - __pyx_v_offset_j = __pyx_t_10; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":78 - * if i == nx - 1 and oj == 1: continue - * for offset_j in range(3): - * oj = offset_j - 1 # <<<<<<<<<<<<<< - * if j == 0 and oj == -1: continue - * if j == nz - 1 and oj == 1: continue - */ - __pyx_v_oj = (__pyx_v_offset_j - 1); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":79 - * for offset_j in range(3): - * oj = offset_j - 1 - * if j == 0 and oj == -1: continue # <<<<<<<<<<<<<< - * if j == nz - 1 and oj == 1: continue - * c1 = contour_ids[i, 0, j] - */ - __pyx_t_8 = (__pyx_v_j == 0); - if (__pyx_t_8) { - __pyx_t_9 = (__pyx_v_oj == -1); - __pyx_t_7 = __pyx_t_9; - } else { - __pyx_t_7 = __pyx_t_8; - } - if (__pyx_t_7) { - goto __pyx_L27_continue; - goto __pyx_L29; - } - __pyx_L29:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":80 - * oj = offset_j - 1 - * if j == 0 and oj == -1: continue - * if j == nz - 1 and oj == 1: continue # <<<<<<<<<<<<<< - * c1 = contour_ids[i, 0, j] - * c2 = contour_ids[i + oi, 1, j + oj] - */ - __pyx_t_7 = (__pyx_v_j == (__pyx_v_nz - 1)); - if (__pyx_t_7) { - __pyx_t_8 = (__pyx_v_oj == 1); - __pyx_t_9 = __pyx_t_8; - } else { - __pyx_t_9 = __pyx_t_7; - } - if (__pyx_t_9) { - goto __pyx_L27_continue; - goto __pyx_L30; - } - __pyx_L30:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":81 - * if j == 0 and oj == -1: continue - * if j == nz - 1 and oj == 1: continue - * c1 = contour_ids[i, 0, j] # <<<<<<<<<<<<<< - * c2 = contour_ids[i + oi, 1, j + oj] - * if c1 > -1 and c2 > -1: - */ - __pyx_t_25 = __pyx_v_i; - __pyx_t_26 = 0; - __pyx_t_27 = __pyx_v_j; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_bshape_0_contour_ids; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_bshape_1_contour_ids; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_bshape_2_contour_ids; - __pyx_v_c1 = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_contour_ids.buf, __pyx_t_25, __pyx_bstride_0_contour_ids, __pyx_t_26, __pyx_bstride_1_contour_ids, __pyx_t_27, __pyx_bstride_2_contour_ids)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":82 - * if j == nz - 1 and oj == 1: continue - * c1 = contour_ids[i, 0, j] - * c2 = contour_ids[i + oi, 1, j + oj] # <<<<<<<<<<<<<< - * if c1 > -1 and c2 > -1: - * tree.append((i64max(c1,c2), i64min(c1,c2))) - */ - __pyx_t_28 = (__pyx_v_i + __pyx_v_oi); - __pyx_t_29 = 1; - __pyx_t_30 = (__pyx_v_j + __pyx_v_oj); - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_bshape_0_contour_ids; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_bshape_1_contour_ids; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_bshape_2_contour_ids; - __pyx_v_c2 = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_contour_ids.buf, __pyx_t_28, __pyx_bstride_0_contour_ids, __pyx_t_29, __pyx_bstride_1_contour_ids, __pyx_t_30, __pyx_bstride_2_contour_ids)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":83 - * c1 = contour_ids[i, 0, j] - * c2 = contour_ids[i + oi, 1, j + oj] - * if c1 > -1 and c2 > -1: # <<<<<<<<<<<<<< - * tree.append((i64max(c1,c2), i64min(c1,c2))) - * c1 = contour_ids[i, ny-1, j] - */ - __pyx_t_9 = (__pyx_v_c1 > -1); - if (__pyx_t_9) { - __pyx_t_7 = (__pyx_v_c2 > -1); - __pyx_t_8 = __pyx_t_7; - } else { - __pyx_t_8 = __pyx_t_9; - } - if (__pyx_t_8) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":84 - * c2 = contour_ids[i + oi, 1, j + oj] - * if c1 > -1 and c2 > -1: - * tree.append((i64max(c1,c2), i64min(c1,c2))) # <<<<<<<<<<<<<< - * c1 = contour_ids[i, ny-1, j] - * c2 = contour_ids[i + oi, ny-2, j + oj] - */ - if (unlikely(__pyx_v_tree == Py_None)) { - PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_1 = __Pyx_PyInt_to_py_npy_int64(__pyx_f_2yt_9amr_utils_i64max(__pyx_v_c1, __pyx_v_c2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_17 = __Pyx_PyInt_to_py_npy_int64(__pyx_f_2yt_9amr_utils_i64min(__pyx_v_c1, __pyx_v_c2)); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_17); - __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_17); - __Pyx_GIVEREF(__pyx_t_17); - __pyx_t_1 = 0; - __pyx_t_17 = 0; - __pyx_t_31 = PyList_Append(((PyObject *)__pyx_v_tree), __pyx_t_18); if (unlikely(__pyx_t_31 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - goto __pyx_L31; - } - __pyx_L31:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":85 - * if c1 > -1 and c2 > -1: - * tree.append((i64max(c1,c2), i64min(c1,c2))) - * c1 = contour_ids[i, ny-1, j] # <<<<<<<<<<<<<< - * c2 = contour_ids[i + oi, ny-2, j + oj] - * if c1 > -1 and c2 > -1: - */ - __pyx_t_31 = __pyx_v_i; - __pyx_t_32 = (__pyx_v_ny - 1); - __pyx_t_33 = __pyx_v_j; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_bshape_0_contour_ids; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_bshape_1_contour_ids; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_bshape_2_contour_ids; - __pyx_v_c1 = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_contour_ids.buf, __pyx_t_31, __pyx_bstride_0_contour_ids, __pyx_t_32, __pyx_bstride_1_contour_ids, __pyx_t_33, __pyx_bstride_2_contour_ids)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":86 - * tree.append((i64max(c1,c2), i64min(c1,c2))) - * c1 = contour_ids[i, ny-1, j] - * c2 = contour_ids[i + oi, ny-2, j + oj] # <<<<<<<<<<<<<< - * if c1 > -1 and c2 > -1: - * tree.append((i64max(c1,c2), i64min(c1,c2))) - */ - __pyx_t_34 = (__pyx_v_i + __pyx_v_oi); - __pyx_t_35 = (__pyx_v_ny - 2); - __pyx_t_36 = (__pyx_v_j + __pyx_v_oj); - if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_bshape_0_contour_ids; - if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_bshape_1_contour_ids; - if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_bshape_2_contour_ids; - __pyx_v_c2 = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_contour_ids.buf, __pyx_t_34, __pyx_bstride_0_contour_ids, __pyx_t_35, __pyx_bstride_1_contour_ids, __pyx_t_36, __pyx_bstride_2_contour_ids)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":87 - * c1 = contour_ids[i, ny-1, j] - * c2 = contour_ids[i + oi, ny-2, j + oj] - * if c1 > -1 and c2 > -1: # <<<<<<<<<<<<<< - * tree.append((i64max(c1,c2), i64min(c1,c2))) - * for i in range(nx): - */ - __pyx_t_8 = (__pyx_v_c1 > -1); - if (__pyx_t_8) { - __pyx_t_9 = (__pyx_v_c2 > -1); - __pyx_t_7 = __pyx_t_9; - } else { - __pyx_t_7 = __pyx_t_8; - } - if (__pyx_t_7) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":88 - * c2 = contour_ids[i + oi, ny-2, j + oj] - * if c1 > -1 and c2 > -1: - * tree.append((i64max(c1,c2), i64min(c1,c2))) # <<<<<<<<<<<<<< - * for i in range(nx): - * for j in range(ny): - */ - if (unlikely(__pyx_v_tree == Py_None)) { - PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_18 = __Pyx_PyInt_to_py_npy_int64(__pyx_f_2yt_9amr_utils_i64max(__pyx_v_c1, __pyx_v_c2)); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_17 = __Pyx_PyInt_to_py_npy_int64(__pyx_f_2yt_9amr_utils_i64min(__pyx_v_c1, __pyx_v_c2)); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_17); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_18); - __Pyx_GIVEREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_17); - __Pyx_GIVEREF(__pyx_t_17); - __pyx_t_18 = 0; - __pyx_t_17 = 0; - __pyx_t_37 = PyList_Append(((PyObject *)__pyx_v_tree), __pyx_t_1); if (unlikely(__pyx_t_37 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L32; - } - __pyx_L32:; - __pyx_L27_continue:; - } - __pyx_L23_continue:; - } - } - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":89 - * if c1 > -1 and c2 > -1: - * tree.append((i64max(c1,c2), i64min(c1,c2))) - * for i in range(nx): # <<<<<<<<<<<<<< - * for j in range(ny): - * for offset_i in range(3): - */ - __pyx_t_2 = __pyx_v_nx; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":90 - * tree.append((i64max(c1,c2), i64min(c1,c2))) - * for i in range(nx): - * for j in range(ny): # <<<<<<<<<<<<<< - * for offset_i in range(3): - * oi = offset_i - 1 - */ - __pyx_t_4 = __pyx_v_ny; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_j = __pyx_t_5; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":91 - * for i in range(nx): - * for j in range(ny): - * for offset_i in range(3): # <<<<<<<<<<<<<< - * oi = offset_i - 1 - * if i == 0 and oi == -1: continue - */ - for (__pyx_t_6 = 0; __pyx_t_6 < 3; __pyx_t_6+=1) { - __pyx_v_offset_i = __pyx_t_6; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":92 - * for j in range(ny): - * for offset_i in range(3): - * oi = offset_i - 1 # <<<<<<<<<<<<<< - * if i == 0 and oi == -1: continue - * if i == nx - 1 and oj == 1: continue - */ - __pyx_v_oi = (__pyx_v_offset_i - 1); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":93 - * for offset_i in range(3): - * oi = offset_i - 1 - * if i == 0 and oi == -1: continue # <<<<<<<<<<<<<< - * if i == nx - 1 and oj == 1: continue - * for offset_j in range(3): - */ - __pyx_t_7 = (__pyx_v_i == 0); - if (__pyx_t_7) { - __pyx_t_8 = (__pyx_v_oi == -1); - __pyx_t_9 = __pyx_t_8; - } else { - __pyx_t_9 = __pyx_t_7; - } - if (__pyx_t_9) { - goto __pyx_L37_continue; - goto __pyx_L39; - } - __pyx_L39:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":94 - * oi = offset_i - 1 - * if i == 0 and oi == -1: continue - * if i == nx - 1 and oj == 1: continue # <<<<<<<<<<<<<< - * for offset_j in range(3): - * oj = offset_j - 1 - */ - __pyx_t_9 = (__pyx_v_i == (__pyx_v_nx - 1)); - if (__pyx_t_9) { - __pyx_t_7 = (__pyx_v_oj == 1); - __pyx_t_8 = __pyx_t_7; - } else { - __pyx_t_8 = __pyx_t_9; - } - if (__pyx_t_8) { - goto __pyx_L37_continue; - goto __pyx_L40; - } - __pyx_L40:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":95 - * if i == 0 and oi == -1: continue - * if i == nx - 1 and oj == 1: continue - * for offset_j in range(3): # <<<<<<<<<<<<<< - * oj = offset_j - 1 - * if j == 0 and oj == -1: continue - */ - for (__pyx_t_10 = 0; __pyx_t_10 < 3; __pyx_t_10+=1) { - __pyx_v_offset_j = __pyx_t_10; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":96 - * if i == nx - 1 and oj == 1: continue - * for offset_j in range(3): - * oj = offset_j - 1 # <<<<<<<<<<<<<< - * if j == 0 and oj == -1: continue - * if j == ny - 1 and oj == 1: continue - */ - __pyx_v_oj = (__pyx_v_offset_j - 1); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":97 - * for offset_j in range(3): - * oj = offset_j - 1 - * if j == 0 and oj == -1: continue # <<<<<<<<<<<<<< - * if j == ny - 1 and oj == 1: continue - * c1 = contour_ids[i, j, 0] - */ - __pyx_t_8 = (__pyx_v_j == 0); - if (__pyx_t_8) { - __pyx_t_9 = (__pyx_v_oj == -1); - __pyx_t_7 = __pyx_t_9; - } else { - __pyx_t_7 = __pyx_t_8; - } - if (__pyx_t_7) { - goto __pyx_L41_continue; - goto __pyx_L43; - } - __pyx_L43:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":98 - * oj = offset_j - 1 - * if j == 0 and oj == -1: continue - * if j == ny - 1 and oj == 1: continue # <<<<<<<<<<<<<< - * c1 = contour_ids[i, j, 0] - * c2 = contour_ids[i + oi, j + oj, 1] - */ - __pyx_t_7 = (__pyx_v_j == (__pyx_v_ny - 1)); - if (__pyx_t_7) { - __pyx_t_8 = (__pyx_v_oj == 1); - __pyx_t_9 = __pyx_t_8; - } else { - __pyx_t_9 = __pyx_t_7; - } - if (__pyx_t_9) { - goto __pyx_L41_continue; - goto __pyx_L44; - } - __pyx_L44:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":99 - * if j == 0 and oj == -1: continue - * if j == ny - 1 and oj == 1: continue - * c1 = contour_ids[i, j, 0] # <<<<<<<<<<<<<< - * c2 = contour_ids[i + oi, j + oj, 1] - * if c1 > -1 and c2 > -1: - */ - __pyx_t_37 = __pyx_v_i; - __pyx_t_38 = __pyx_v_j; - __pyx_t_39 = 0; - if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_bshape_0_contour_ids; - if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_bshape_1_contour_ids; - if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_bshape_2_contour_ids; - __pyx_v_c1 = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_contour_ids.buf, __pyx_t_37, __pyx_bstride_0_contour_ids, __pyx_t_38, __pyx_bstride_1_contour_ids, __pyx_t_39, __pyx_bstride_2_contour_ids)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":100 - * if j == ny - 1 and oj == 1: continue - * c1 = contour_ids[i, j, 0] - * c2 = contour_ids[i + oi, j + oj, 1] # <<<<<<<<<<<<<< - * if c1 > -1 and c2 > -1: - * tree.append((i64max(c1,c2), i64min(c1,c2))) - */ - __pyx_t_40 = (__pyx_v_i + __pyx_v_oi); - __pyx_t_41 = (__pyx_v_j + __pyx_v_oj); - __pyx_t_42 = 1; - if (__pyx_t_40 < 0) __pyx_t_40 += __pyx_bshape_0_contour_ids; - if (__pyx_t_41 < 0) __pyx_t_41 += __pyx_bshape_1_contour_ids; - if (__pyx_t_42 < 0) __pyx_t_42 += __pyx_bshape_2_contour_ids; - __pyx_v_c2 = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_contour_ids.buf, __pyx_t_40, __pyx_bstride_0_contour_ids, __pyx_t_41, __pyx_bstride_1_contour_ids, __pyx_t_42, __pyx_bstride_2_contour_ids)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":101 - * c1 = contour_ids[i, j, 0] - * c2 = contour_ids[i + oi, j + oj, 1] - * if c1 > -1 and c2 > -1: # <<<<<<<<<<<<<< - * tree.append((i64max(c1,c2), i64min(c1,c2))) - * c1 = contour_ids[i, j, nz-1] - */ - __pyx_t_9 = (__pyx_v_c1 > -1); - if (__pyx_t_9) { - __pyx_t_7 = (__pyx_v_c2 > -1); - __pyx_t_8 = __pyx_t_7; - } else { - __pyx_t_8 = __pyx_t_9; - } - if (__pyx_t_8) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":102 - * c2 = contour_ids[i + oi, j + oj, 1] - * if c1 > -1 and c2 > -1: - * tree.append((i64max(c1,c2), i64min(c1,c2))) # <<<<<<<<<<<<<< - * c1 = contour_ids[i, j, nz-1] - * c2 = contour_ids[i + oi, j + oj, nz-2] - */ - if (unlikely(__pyx_v_tree == Py_None)) { - PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_1 = __Pyx_PyInt_to_py_npy_int64(__pyx_f_2yt_9amr_utils_i64max(__pyx_v_c1, __pyx_v_c2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_17 = __Pyx_PyInt_to_py_npy_int64(__pyx_f_2yt_9amr_utils_i64min(__pyx_v_c1, __pyx_v_c2)); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_17); - __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_17); - __Pyx_GIVEREF(__pyx_t_17); - __pyx_t_1 = 0; - __pyx_t_17 = 0; - __pyx_t_43 = PyList_Append(((PyObject *)__pyx_v_tree), __pyx_t_18); if (unlikely(__pyx_t_43 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - goto __pyx_L45; - } - __pyx_L45:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":103 - * if c1 > -1 and c2 > -1: - * tree.append((i64max(c1,c2), i64min(c1,c2))) - * c1 = contour_ids[i, j, nz-1] # <<<<<<<<<<<<<< - * c2 = contour_ids[i + oi, j + oj, nz-2] - * if c1 > -1 and c2 > -1: - */ - __pyx_t_43 = __pyx_v_i; - __pyx_t_44 = __pyx_v_j; - __pyx_t_45 = (__pyx_v_nz - 1); - if (__pyx_t_43 < 0) __pyx_t_43 += __pyx_bshape_0_contour_ids; - if (__pyx_t_44 < 0) __pyx_t_44 += __pyx_bshape_1_contour_ids; - if (__pyx_t_45 < 0) __pyx_t_45 += __pyx_bshape_2_contour_ids; - __pyx_v_c1 = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_contour_ids.buf, __pyx_t_43, __pyx_bstride_0_contour_ids, __pyx_t_44, __pyx_bstride_1_contour_ids, __pyx_t_45, __pyx_bstride_2_contour_ids)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":104 - * tree.append((i64max(c1,c2), i64min(c1,c2))) - * c1 = contour_ids[i, j, nz-1] - * c2 = contour_ids[i + oi, j + oj, nz-2] # <<<<<<<<<<<<<< - * if c1 > -1 and c2 > -1: - * tree.append((i64max(c1,c2), i64min(c1,c2))) - */ - __pyx_t_46 = (__pyx_v_i + __pyx_v_oi); - __pyx_t_47 = (__pyx_v_j + __pyx_v_oj); - __pyx_t_48 = (__pyx_v_nz - 2); - if (__pyx_t_46 < 0) __pyx_t_46 += __pyx_bshape_0_contour_ids; - if (__pyx_t_47 < 0) __pyx_t_47 += __pyx_bshape_1_contour_ids; - if (__pyx_t_48 < 0) __pyx_t_48 += __pyx_bshape_2_contour_ids; - __pyx_v_c2 = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_contour_ids.buf, __pyx_t_46, __pyx_bstride_0_contour_ids, __pyx_t_47, __pyx_bstride_1_contour_ids, __pyx_t_48, __pyx_bstride_2_contour_ids)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":105 - * c1 = contour_ids[i, j, nz-1] - * c2 = contour_ids[i + oi, j + oj, nz-2] - * if c1 > -1 and c2 > -1: # <<<<<<<<<<<<<< - * tree.append((i64max(c1,c2), i64min(c1,c2))) - * return tree - */ - __pyx_t_8 = (__pyx_v_c1 > -1); - if (__pyx_t_8) { - __pyx_t_9 = (__pyx_v_c2 > -1); - __pyx_t_7 = __pyx_t_9; - } else { - __pyx_t_7 = __pyx_t_8; - } - if (__pyx_t_7) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":106 - * c2 = contour_ids[i + oi, j + oj, nz-2] - * if c1 > -1 and c2 > -1: - * tree.append((i64max(c1,c2), i64min(c1,c2))) # <<<<<<<<<<<<<< - * return tree - * - */ - if (unlikely(__pyx_v_tree == Py_None)) { - PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_18 = __Pyx_PyInt_to_py_npy_int64(__pyx_f_2yt_9amr_utils_i64max(__pyx_v_c1, __pyx_v_c2)); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_17 = __Pyx_PyInt_to_py_npy_int64(__pyx_f_2yt_9amr_utils_i64min(__pyx_v_c1, __pyx_v_c2)); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_17); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_18); - __Pyx_GIVEREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_17); - __Pyx_GIVEREF(__pyx_t_17); - __pyx_t_18 = 0; - __pyx_t_17 = 0; - __pyx_t_49 = PyList_Append(((PyObject *)__pyx_v_tree), __pyx_t_1); if (unlikely(__pyx_t_49 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L46; - } - __pyx_L46:; - __pyx_L41_continue:; - } - __pyx_L37_continue:; - } - } - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":107 - * if c1 > -1 and c2 > -1: - * tree.append((i64max(c1,c2), i64min(c1,c2))) - * return tree # <<<<<<<<<<<<<< - * - * cdef inline int are_neighbors( - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_tree)); - __pyx_r = ((PyObject *)__pyx_v_tree); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_17); - __Pyx_XDECREF(__pyx_t_18); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_contour_ids); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.amr_utils.construct_boundary_relationships"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_contour_ids); - __pyx_L2:; - __Pyx_DECREF(__pyx_v_tree); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":109 - * return tree - * - * cdef inline int are_neighbors( # <<<<<<<<<<<<<< - * np.float64_t x1, np.float64_t y1, np.float64_t z1, - * np.float64_t dx1, np.float64_t dy1, np.float64_t dz1, - */ - -static CYTHON_INLINE int __pyx_f_2yt_9amr_utils_are_neighbors(__pyx_t_5numpy_float64_t __pyx_v_x1, __pyx_t_5numpy_float64_t __pyx_v_y1, __pyx_t_5numpy_float64_t __pyx_v_z1, __pyx_t_5numpy_float64_t __pyx_v_dx1, __pyx_t_5numpy_float64_t __pyx_v_dy1, __pyx_t_5numpy_float64_t __pyx_v_dz1, __pyx_t_5numpy_float64_t __pyx_v_x2, __pyx_t_5numpy_float64_t __pyx_v_y2, __pyx_t_5numpy_float64_t __pyx_v_z2, __pyx_t_5numpy_float64_t __pyx_v_dx2, __pyx_t_5numpy_float64_t __pyx_v_dy2, __pyx_t_5numpy_float64_t __pyx_v_dz2) { - int __pyx_r; - int __pyx_t_1; - __Pyx_RefNannySetupContext("are_neighbors"); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":116 - * ): - * # We assume an epsilon of 1e-15 - * if fabs(x1-x2) > 0.5*(dx1+dx2): return 0 # <<<<<<<<<<<<<< - * if fabs(y1-y2) > 0.5*(dy1+dy2): return 0 - * if fabs(z1-z2) > 0.5*(dz1+dz2): return 0 - */ - __pyx_t_1 = (fabs((__pyx_v_x1 - __pyx_v_x2)) > (0.5 * (__pyx_v_dx1 + __pyx_v_dx2))); - if (__pyx_t_1) { - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":117 - * # We assume an epsilon of 1e-15 - * if fabs(x1-x2) > 0.5*(dx1+dx2): return 0 - * if fabs(y1-y2) > 0.5*(dy1+dy2): return 0 # <<<<<<<<<<<<<< - * if fabs(z1-z2) > 0.5*(dz1+dz2): return 0 - * return 1 - */ - __pyx_t_1 = (fabs((__pyx_v_y1 - __pyx_v_y2)) > (0.5 * (__pyx_v_dy1 + __pyx_v_dy2))); - if (__pyx_t_1) { - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L4; - } - __pyx_L4:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":118 - * if fabs(x1-x2) > 0.5*(dx1+dx2): return 0 - * if fabs(y1-y2) > 0.5*(dy1+dy2): return 0 - * if fabs(z1-z2) > 0.5*(dz1+dz2): return 0 # <<<<<<<<<<<<<< - * return 1 - * - */ - __pyx_t_1 = (fabs((__pyx_v_z1 - __pyx_v_z2)) > (0.5 * (__pyx_v_dz1 + __pyx_v_dz2))); - if (__pyx_t_1) { - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L5; - } - __pyx_L5:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":119 - * if fabs(y1-y2) > 0.5*(dy1+dy2): return 0 - * if fabs(z1-z2) > 0.5*(dz1+dz2): return 0 - * return 1 # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) - */ - __pyx_r = 1; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":123 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * def identify_field_neighbors( # <<<<<<<<<<<<<< - * np.ndarray[dtype=np.float64_t, ndim=1] field, - * np.ndarray[dtype=np.float64_t, ndim=1] x, - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_identify_field_neighbors(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_identify_field_neighbors(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_field = 0; - PyArrayObject *__pyx_v_x = 0; - PyArrayObject *__pyx_v_y = 0; - PyArrayObject *__pyx_v_z = 0; - PyArrayObject *__pyx_v_dx = 0; - PyArrayObject *__pyx_v_dy = 0; - PyArrayObject *__pyx_v_dz = 0; - int __pyx_v_outer; - int __pyx_v_inner; - int __pyx_v_N; - int __pyx_v_added; - __pyx_t_5numpy_float64_t __pyx_v_x1; - __pyx_t_5numpy_float64_t __pyx_v_y1; - __pyx_t_5numpy_float64_t __pyx_v_z1; - __pyx_t_5numpy_float64_t __pyx_v_dx1; - __pyx_t_5numpy_float64_t __pyx_v_dy1; - __pyx_t_5numpy_float64_t __pyx_v_dz1; - PyObject *__pyx_v_joins; - PyObject *__pyx_v_this_joins; - Py_buffer __pyx_bstruct_field; - Py_ssize_t __pyx_bstride_0_field = 0; - Py_ssize_t __pyx_bshape_0_field = 0; - Py_buffer __pyx_bstruct_dz; - Py_ssize_t __pyx_bstride_0_dz = 0; - Py_ssize_t __pyx_bshape_0_dz = 0; - 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_dy; - Py_ssize_t __pyx_bstride_0_dy = 0; - Py_ssize_t __pyx_bshape_0_dy = 0; - Py_buffer __pyx_bstruct_y; - Py_ssize_t __pyx_bstride_0_y = 0; - Py_ssize_t __pyx_bshape_0_y = 0; - Py_buffer __pyx_bstruct_x; - Py_ssize_t __pyx_bstride_0_x = 0; - Py_ssize_t __pyx_bshape_0_x = 0; - Py_buffer __pyx_bstruct_z; - Py_ssize_t __pyx_bstride_0_z = 0; - Py_ssize_t __pyx_bshape_0_z = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - 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; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - int __pyx_t_18; - int __pyx_t_19; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__field,&__pyx_n_s__x,&__pyx_n_s__y,&__pyx_n_s__z,&__pyx_n_s__dx,&__pyx_n_s__dy,&__pyx_n_s__dz,0}; - __Pyx_RefNannySetupContext("identify_field_neighbors"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[7] = {0,0,0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__field); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("identify_field_neighbors", 1, 7, 7, 1); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("identify_field_neighbors", 1, 7, 7, 2); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__z); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("identify_field_neighbors", 1, 7, 7, 3); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dx); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("identify_field_neighbors", 1, 7, 7, 4); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dy); - if (likely(values[5])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("identify_field_neighbors", 1, 7, 7, 5); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 6: - values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dz); - if (likely(values[6])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("identify_field_neighbors", 1, 7, 7, 6); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "identify_field_neighbors") < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_field = ((PyArrayObject *)values[0]); - __pyx_v_x = ((PyArrayObject *)values[1]); - __pyx_v_y = ((PyArrayObject *)values[2]); - __pyx_v_z = ((PyArrayObject *)values[3]); - __pyx_v_dx = ((PyArrayObject *)values[4]); - __pyx_v_dy = ((PyArrayObject *)values[5]); - __pyx_v_dz = ((PyArrayObject *)values[6]); - } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_field = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_x = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_y = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_z = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); - __pyx_v_dx = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); - __pyx_v_dy = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 5)); - __pyx_v_dz = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 6)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("identify_field_neighbors", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.identify_field_neighbors"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_v_joins = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_this_joins = Py_None; __Pyx_INCREF(Py_None); - __pyx_bstruct_field.buf = NULL; - __pyx_bstruct_x.buf = NULL; - __pyx_bstruct_y.buf = NULL; - __pyx_bstruct_z.buf = NULL; - __pyx_bstruct_dx.buf = NULL; - __pyx_bstruct_dy.buf = NULL; - __pyx_bstruct_dz.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_field), __pyx_ptype_5numpy_ndarray, 1, "field", 0))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_z), __pyx_ptype_5numpy_ndarray, 1, "z", 0))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 127; __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[6]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dy), __pyx_ptype_5numpy_ndarray, 1, "dy", 0))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dz), __pyx_ptype_5numpy_ndarray, 1, "dz", 0))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_field, (PyObject*)__pyx_v_field, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_field = __pyx_bstruct_field.strides[0]; - __pyx_bshape_0_field = __pyx_bstruct_field.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_x = __pyx_bstruct_x.strides[0]; - __pyx_bshape_0_x = __pyx_bstruct_x.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_y, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_y = __pyx_bstruct_y.strides[0]; - __pyx_bshape_0_y = __pyx_bstruct_y.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_z, (PyObject*)__pyx_v_z, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_z = __pyx_bstruct_z.strides[0]; - __pyx_bshape_0_z = __pyx_bstruct_z.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dx, (PyObject*)__pyx_v_dx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 123; __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]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dy, (PyObject*)__pyx_v_dy, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_dy = __pyx_bstruct_dy.strides[0]; - __pyx_bshape_0_dy = __pyx_bstruct_dy.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dz, (PyObject*)__pyx_v_dz, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_dz = __pyx_bstruct_dz.strides[0]; - __pyx_bshape_0_dz = __pyx_bstruct_dz.shape[0]; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":135 - * cdef int outer, inner, N, added - * cdef np.float64_t x1, y1, z1, dx1, dy1, dz1 - * N = field.shape[0] # <<<<<<<<<<<<<< - * #cdef np.ndarray[dtype=np.object_t] joins - * joins = [[] for outer in range(N)] - */ - __pyx_v_N = (__pyx_v_field->dimensions[0]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":137 - * N = field.shape[0] - * #cdef np.ndarray[dtype=np.object_t] joins - * joins = [[] for outer in range(N)] # <<<<<<<<<<<<<< - * #joins = np.empty(N, dtype='object') - * for outer in range(N): - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = __pyx_v_N; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_outer = __pyx_t_3; - __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - } - __Pyx_INCREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(((PyObject *)__pyx_v_joins)); - __pyx_v_joins = __pyx_t_1; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":139 - * joins = [[] for outer in range(N)] - * #joins = np.empty(N, dtype='object') - * for outer in range(N): # <<<<<<<<<<<<<< - * if (outer % 10000) == 0: print outer, N - * x1 = x[outer] - */ - __pyx_t_2 = __pyx_v_N; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_outer = __pyx_t_3; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":140 - * #joins = np.empty(N, dtype='object') - * for outer in range(N): - * if (outer % 10000) == 0: print outer, N # <<<<<<<<<<<<<< - * x1 = x[outer] - * y1 = y[outer] - */ - __pyx_t_5 = (__Pyx_mod_long(__pyx_v_outer, 10000) == 0); - if (__pyx_t_5) { - __pyx_t_1 = PyInt_FromLong(__pyx_v_outer); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyInt_FromLong(__pyx_v_N); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_1 = 0; - __pyx_t_4 = 0; - if (__Pyx_Print(0, __pyx_t_6, 1) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - goto __pyx_L10; - } - __pyx_L10:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":141 - * for outer in range(N): - * if (outer % 10000) == 0: print outer, N - * x1 = x[outer] # <<<<<<<<<<<<<< - * y1 = y[outer] - * z1 = z[outer] - */ - __pyx_t_7 = __pyx_v_outer; - __pyx_v_x1 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x.buf, __pyx_t_7, __pyx_bstride_0_x)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":142 - * if (outer % 10000) == 0: print outer, N - * x1 = x[outer] - * y1 = y[outer] # <<<<<<<<<<<<<< - * z1 = z[outer] - * dx1 = dx[outer] - */ - __pyx_t_8 = __pyx_v_outer; - __pyx_v_y1 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y.buf, __pyx_t_8, __pyx_bstride_0_y)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":143 - * x1 = x[outer] - * y1 = y[outer] - * z1 = z[outer] # <<<<<<<<<<<<<< - * dx1 = dx[outer] - * dy1 = dy[outer] - */ - __pyx_t_9 = __pyx_v_outer; - __pyx_v_z1 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_z.buf, __pyx_t_9, __pyx_bstride_0_z)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":144 - * y1 = y[outer] - * z1 = z[outer] - * dx1 = dx[outer] # <<<<<<<<<<<<<< - * dy1 = dy[outer] - * dz1 = dz[outer] - */ - __pyx_t_10 = __pyx_v_outer; - __pyx_v_dx1 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dx.buf, __pyx_t_10, __pyx_bstride_0_dx)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":145 - * z1 = z[outer] - * dx1 = dx[outer] - * dy1 = dy[outer] # <<<<<<<<<<<<<< - * dz1 = dz[outer] - * this_joins = joins[outer] - */ - __pyx_t_11 = __pyx_v_outer; - __pyx_v_dy1 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dy.buf, __pyx_t_11, __pyx_bstride_0_dy)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":146 - * dx1 = dx[outer] - * dy1 = dy[outer] - * dz1 = dz[outer] # <<<<<<<<<<<<<< - * this_joins = joins[outer] - * added = 0 - */ - __pyx_t_12 = __pyx_v_outer; - __pyx_v_dz1 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dz.buf, __pyx_t_12, __pyx_bstride_0_dz)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":147 - * dy1 = dy[outer] - * dz1 = dz[outer] - * this_joins = joins[outer] # <<<<<<<<<<<<<< - * added = 0 - * # Go in reverse order - */ - __pyx_t_6 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_joins), __pyx_v_outer, sizeof(int), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_v_this_joins); - __pyx_v_this_joins = __pyx_t_6; - __pyx_t_6 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":148 - * dz1 = dz[outer] - * this_joins = joins[outer] - * added = 0 # <<<<<<<<<<<<<< - * # Go in reverse order - * for inner in range(outer, 0, -1): - */ - __pyx_v_added = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":150 - * added = 0 - * # Go in reverse order - * for inner in range(outer, 0, -1): # <<<<<<<<<<<<<< - * if not are_neighbors(x1, y1, z1, dx1, dy1, dz1, - * x[inner], y[inner], z[inner], - */ - for (__pyx_t_13 = __pyx_v_outer; __pyx_t_13 > 0; __pyx_t_13-=1) { - __pyx_v_inner = __pyx_t_13; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":152 - * for inner in range(outer, 0, -1): - * if not are_neighbors(x1, y1, z1, dx1, dy1, dz1, - * x[inner], y[inner], z[inner], # <<<<<<<<<<<<<< - * dx[inner], dy[inner], dz[inner]): - * continue - */ - __pyx_t_14 = __pyx_v_inner; - __pyx_t_15 = __pyx_v_inner; - __pyx_t_16 = __pyx_v_inner; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":153 - * if not are_neighbors(x1, y1, z1, dx1, dy1, dz1, - * x[inner], y[inner], z[inner], - * dx[inner], dy[inner], dz[inner]): # <<<<<<<<<<<<<< - * continue - * # Hot dog, we have a weiner! - */ - __pyx_t_17 = __pyx_v_inner; - __pyx_t_18 = __pyx_v_inner; - __pyx_t_19 = __pyx_v_inner; - __pyx_t_5 = (!__pyx_f_2yt_9amr_utils_are_neighbors(__pyx_v_x1, __pyx_v_y1, __pyx_v_z1, __pyx_v_dx1, __pyx_v_dy1, __pyx_v_dz1, (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x.buf, __pyx_t_14, __pyx_bstride_0_x)), (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y.buf, __pyx_t_15, __pyx_bstride_0_y)), (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_z.buf, __pyx_t_16, __pyx_bstride_0_z)), (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dx.buf, __pyx_t_17, __pyx_bstride_0_dx)), (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dy.buf, __pyx_t_18, __pyx_bstride_0_dy)), (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dz.buf, __pyx_t_19, __pyx_bstride_0_dz)))); - if (__pyx_t_5) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":154 - * x[inner], y[inner], z[inner], - * dx[inner], dy[inner], dz[inner]): - * continue # <<<<<<<<<<<<<< - * # Hot dog, we have a weiner! - * this_joins.append(inner) - */ - goto __pyx_L11_continue; - goto __pyx_L13; - } - __pyx_L13:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":156 - * continue - * # Hot dog, we have a weiner! - * this_joins.append(inner) # <<<<<<<<<<<<<< - * added += 1 - * if added == 26: break - */ - __pyx_t_6 = PyInt_FromLong(__pyx_v_inner); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = __Pyx_PyObject_Append(__pyx_v_this_joins, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":157 - * # Hot dog, we have a weiner! - * this_joins.append(inner) - * added += 1 # <<<<<<<<<<<<<< - * if added == 26: break - * return joins - */ - __pyx_v_added += 1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":158 - * this_joins.append(inner) - * added += 1 - * if added == 26: break # <<<<<<<<<<<<<< - * return joins - * - */ - __pyx_t_5 = (__pyx_v_added == 26); - if (__pyx_t_5) { - goto __pyx_L12_break; - goto __pyx_L14; - } - __pyx_L14:; - __pyx_L11_continue:; - } - __pyx_L12_break:; - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":159 - * added += 1 - * if added == 26: break - * return joins # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_joins)); - __pyx_r = ((PyObject *)__pyx_v_joins); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_6); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_field); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dz); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dx); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dy); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_z); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.amr_utils.identify_field_neighbors"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_field); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dz); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dx); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dy); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_z); - __pyx_L2:; - __Pyx_DECREF(__pyx_v_joins); - __Pyx_DECREF(__pyx_v_this_joins); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":163 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * def extract_identified_contours(int max_ind, joins): # <<<<<<<<<<<<<< - * cdef int i - * contours = [] - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_extract_identified_contours(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_extract_identified_contours(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_max_ind; - PyObject *__pyx_v_joins = 0; - int __pyx_v_i; - PyObject *__pyx_v_contours; - PyObject *__pyx_v_proto_contour; - PyObject *__pyx_v_j; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - long __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - Py_ssize_t __pyx_t_6; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__max_ind,&__pyx_n_s__joins,0}; - __Pyx_RefNannySetupContext("extract_identified_contours"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_ind); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__joins); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("extract_identified_contours", 1, 2, 2, 1); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "extract_identified_contours") < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_max_ind = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_max_ind == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_joins = values[1]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_max_ind = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_max_ind == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_joins = PyTuple_GET_ITEM(__pyx_args, 1); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("extract_identified_contours", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.extract_identified_contours"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_v_contours = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_proto_contour = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_j = Py_None; __Pyx_INCREF(Py_None); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":165 - * def extract_identified_contours(int max_ind, joins): - * cdef int i - * contours = [] # <<<<<<<<<<<<<< - * for i in range(max_ind + 1): # +1 to get to the max_ind itself - * contours.append(set([i])) - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(((PyObject *)__pyx_v_contours)); - __pyx_v_contours = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":166 - * cdef int i - * contours = [] - * for i in range(max_ind + 1): # +1 to get to the max_ind itself # <<<<<<<<<<<<<< - * contours.append(set([i])) - * if len(joins[i]) == 0: - */ - __pyx_t_2 = (__pyx_v_max_ind + 1); - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":167 - * contours = [] - * for i in range(max_ind + 1): # +1 to get to the max_ind itself - * contours.append(set([i])) # <<<<<<<<<<<<<< - * if len(joins[i]) == 0: - * continue - */ - if (unlikely(__pyx_v_contours == Py_None)) { - PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_1 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)&PySet_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = PyList_Append(((PyObject *)__pyx_v_contours), __pyx_t_4); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":168 - * for i in range(max_ind + 1): # +1 to get to the max_ind itself - * contours.append(set([i])) - * if len(joins[i]) == 0: # <<<<<<<<<<<<<< - * continue - * proto_contour = [i] - */ - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_joins, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_7 = (__pyx_t_6 == 0); - if (__pyx_t_7) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":169 - * contours.append(set([i])) - * if len(joins[i]) == 0: - * continue # <<<<<<<<<<<<<< - * proto_contour = [i] - * for j in joins[i]: - */ - goto __pyx_L6_continue; - goto __pyx_L8; - } - __pyx_L8:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":170 - * if len(joins[i]) == 0: - * continue - * proto_contour = [i] # <<<<<<<<<<<<<< - * for j in joins[i]: - * proto_contour += contours[j] - */ - __pyx_t_4 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_v_proto_contour); - __pyx_v_proto_contour = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":171 - * continue - * proto_contour = [i] - * for j in joins[i]: # <<<<<<<<<<<<<< - * proto_contour += contours[j] - * proto_contour = set(proto_contour) - */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_joins, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_6 = 0; __pyx_t_4 = __pyx_t_1; __Pyx_INCREF(__pyx_t_4); - } else { - __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break; - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; - } else if (likely(PyTuple_CheckExact(__pyx_t_4))) { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; - } else { - __pyx_t_1 = PyIter_Next(__pyx_t_4); - if (!__pyx_t_1) { - if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_DECREF(__pyx_v_j); - __pyx_v_j = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":172 - * proto_contour = [i] - * for j in joins[i]: - * proto_contour += contours[j] # <<<<<<<<<<<<<< - * proto_contour = set(proto_contour) - * for j in proto_contour: - */ - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_contours), __pyx_v_j); if (!__pyx_t_1) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = PyNumber_InPlaceAdd(__pyx_v_proto_contour, __pyx_t_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_proto_contour); - __pyx_v_proto_contour = __pyx_t_8; - __pyx_t_8 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":173 - * for j in joins[i]: - * proto_contour += contours[j] - * proto_contour = set(proto_contour) # <<<<<<<<<<<<<< - * for j in proto_contour: - * contours[j] = proto_contour - */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_proto_contour); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_proto_contour); - __Pyx_GIVEREF(__pyx_v_proto_contour); - __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)&PySet_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_v_proto_contour); - __pyx_v_proto_contour = __pyx_t_8; - __pyx_t_8 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":174 - * proto_contour += contours[j] - * proto_contour = set(proto_contour) - * for j in proto_contour: # <<<<<<<<<<<<<< - * contours[j] = proto_contour - * return contours - */ - if (PyList_CheckExact(__pyx_v_proto_contour) || PyTuple_CheckExact(__pyx_v_proto_contour)) { - __pyx_t_6 = 0; __pyx_t_8 = __pyx_v_proto_contour; __Pyx_INCREF(__pyx_t_8); - } else { - __pyx_t_6 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_proto_contour); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - } - for (;;) { - if (likely(PyList_CheckExact(__pyx_t_8))) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_8)) break; - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; - } else if (likely(PyTuple_CheckExact(__pyx_t_8))) { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_8)) break; - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; - } else { - __pyx_t_4 = PyIter_Next(__pyx_t_8); - if (!__pyx_t_4) { - if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_DECREF(__pyx_v_j); - __pyx_v_j = __pyx_t_4; - __pyx_t_4 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":175 - * proto_contour = set(proto_contour) - * for j in proto_contour: - * contours[j] = proto_contour # <<<<<<<<<<<<<< - * return contours - */ - if (PyObject_SetItem(((PyObject *)__pyx_v_contours), __pyx_v_j, __pyx_v_proto_contour) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_L6_continue:; - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":176 - * for j in proto_contour: - * contours[j] = proto_contour - * return contours # <<<<<<<<<<<<<< - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_contours)); - __pyx_r = ((PyObject *)__pyx_v_contours); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("yt.amr_utils.extract_identified_contours"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF(__pyx_v_contours); - __Pyx_DECREF(__pyx_v_proto_contour); - __Pyx_DECREF(__pyx_v_j); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":102 - * png_structp *png_ptr_ptr, png_infop *info_ptr_ptr) - * - * def write_png(np.ndarray[np.uint8_t, ndim=3] buffer, # <<<<<<<<<<<<<< - * char *filename, int dpi=100): - * - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_write_png(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_write_png(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_buffer = 0; - char *__pyx_v_filename; - int __pyx_v_dpi; - png_byte *__pyx_v_pix_buffer; - int __pyx_v_width; - int __pyx_v_height; - FILE *__pyx_v_fileobj; - png_bytep *__pyx_v_row_pointers; - png_structp __pyx_v_png_ptr; - png_infop __pyx_v_info_ptr; - png_color_8 __pyx_v_sig_bit; - png_uint_32 __pyx_v_row; - size_t __pyx_v_dots_per_meter; - Py_buffer __pyx_bstruct_buffer; - Py_ssize_t __pyx_bstride_0_buffer = 0; - Py_ssize_t __pyx_bstride_1_buffer = 0; - Py_ssize_t __pyx_bstride_2_buffer = 0; - Py_ssize_t __pyx_bshape_0_buffer = 0; - Py_ssize_t __pyx_bshape_1_buffer = 0; - Py_ssize_t __pyx_bshape_2_buffer = 0; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - png_uint_32 __pyx_t_2; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__filename,&__pyx_n_s__dpi,0}; - __Pyx_RefNannySetupContext("write_png"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[3] = {0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("write_png", 0, 2, 3, 1); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dpi); - if (unlikely(value)) { values[2] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "write_png") < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_buffer = ((PyArrayObject *)values[0]); - __pyx_v_filename = PyBytes_AsString(values[1]); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - if (values[2]) { - __pyx_v_dpi = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_dpi == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_dpi = ((int)100); - } - } else { - __pyx_v_dpi = ((int)100); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: - __pyx_v_dpi = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_dpi == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 2: - __pyx_v_filename = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_buffer = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - break; - default: goto __pyx_L5_argtuple_error; - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("write_png", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.write_png"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_buffer.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_buffer), __pyx_ptype_5numpy_ndarray, 1, "buffer", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_buffer, (PyObject*)__pyx_v_buffer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_buffer = __pyx_bstruct_buffer.strides[0]; __pyx_bstride_1_buffer = __pyx_bstruct_buffer.strides[1]; __pyx_bstride_2_buffer = __pyx_bstruct_buffer.strides[2]; - __pyx_bshape_0_buffer = __pyx_bstruct_buffer.shape[0]; __pyx_bshape_1_buffer = __pyx_bstruct_buffer.shape[1]; __pyx_bshape_2_buffer = __pyx_bstruct_buffer.shape[2]; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":106 - * - * # This is something of a translation of the matplotlib _png module - * cdef png_byte *pix_buffer = buffer.data # <<<<<<<<<<<<<< - * cdef int width = buffer.shape[1] - * cdef int height = buffer.shape[0] - */ - __pyx_v_pix_buffer = ((png_byte *)__pyx_v_buffer->data); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":107 - * # This is something of a translation of the matplotlib _png module - * cdef png_byte *pix_buffer = buffer.data - * cdef int width = buffer.shape[1] # <<<<<<<<<<<<<< - * cdef int height = buffer.shape[0] - * - */ - __pyx_v_width = (__pyx_v_buffer->dimensions[1]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":108 - * cdef png_byte *pix_buffer = buffer.data - * cdef int width = buffer.shape[1] - * cdef int height = buffer.shape[0] # <<<<<<<<<<<<<< - * - * cdef FILE* fileobj = fopen(filename, "wb") - */ - __pyx_v_height = (__pyx_v_buffer->dimensions[0]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":110 - * cdef int height = buffer.shape[0] - * - * cdef FILE* fileobj = fopen(filename, "wb") # <<<<<<<<<<<<<< - * cdef png_bytep *row_pointers - * cdef png_structp png_ptr - */ - __pyx_v_fileobj = fopen(__pyx_v_filename, __pyx_k__wb); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":118 - * cdef png_uint_32 row - * - * row_pointers = alloca(sizeof(png_bytep) * height) # <<<<<<<<<<<<<< - * - * for row in range(height): - */ - __pyx_v_row_pointers = ((png_bytep *)alloca(((sizeof(png_bytep)) * __pyx_v_height))); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":120 - * row_pointers = alloca(sizeof(png_bytep) * height) - * - * for row in range(height): # <<<<<<<<<<<<<< - * row_pointers[row] = pix_buffer + row * width * 4 - * png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL) - */ - __pyx_t_1 = __pyx_v_height; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_row = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":121 - * - * for row in range(height): - * row_pointers[row] = pix_buffer + row * width * 4 # <<<<<<<<<<<<<< - * png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL) - * info_ptr = png_create_info_struct(png_ptr) - */ - (__pyx_v_row_pointers[__pyx_v_row]) = (__pyx_v_pix_buffer + ((__pyx_v_row * __pyx_v_width) * 4)); - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":122 - * for row in range(height): - * row_pointers[row] = pix_buffer + row * width * 4 - * png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL) # <<<<<<<<<<<<<< - * info_ptr = png_create_info_struct(png_ptr) - * - */ - __pyx_v_png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":123 - * row_pointers[row] = pix_buffer + row * width * 4 - * png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL) - * info_ptr = png_create_info_struct(png_ptr) # <<<<<<<<<<<<<< - * - * # Um we are ignoring setjmp sorry guys - */ - __pyx_v_info_ptr = png_create_info_struct(__pyx_v_png_ptr); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":127 - * # Um we are ignoring setjmp sorry guys - * - * png_init_io(png_ptr, fileobj) # <<<<<<<<<<<<<< - * - * png_set_IHDR(png_ptr, info_ptr, width, height, 8, - */ - png_init_io(__pyx_v_png_ptr, __pyx_v_fileobj); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":131 - * png_set_IHDR(png_ptr, info_ptr, width, height, 8, - * PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE, - * PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE) # <<<<<<<<<<<<<< - * - * cdef size_t dots_per_meter = (dpi / (2.54 / 100.0)) - */ - png_set_IHDR(__pyx_v_png_ptr, __pyx_v_info_ptr, __pyx_v_width, __pyx_v_height, 8, PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":133 - * PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE) - * - * cdef size_t dots_per_meter = (dpi / (2.54 / 100.0)) # <<<<<<<<<<<<<< - * png_set_pHYs(png_ptr, info_ptr, dots_per_meter, dots_per_meter, - * PNG_RESOLUTION_METER) - */ - __pyx_v_dots_per_meter = ((size_t)(__pyx_v_dpi / (2.54 / 100.0))); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":135 - * cdef size_t dots_per_meter = (dpi / (2.54 / 100.0)) - * png_set_pHYs(png_ptr, info_ptr, dots_per_meter, dots_per_meter, - * PNG_RESOLUTION_METER) # <<<<<<<<<<<<<< - * - * sig_bit.gray = 0 - */ - png_set_pHYs(__pyx_v_png_ptr, __pyx_v_info_ptr, __pyx_v_dots_per_meter, __pyx_v_dots_per_meter, PNG_RESOLUTION_METER); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":137 - * PNG_RESOLUTION_METER) - * - * sig_bit.gray = 0 # <<<<<<<<<<<<<< - * sig_bit.red = sig_bit.green = sig_bit.blue = sig_bit.alpha = 8 - * - */ - __pyx_v_sig_bit.gray = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":138 - * - * sig_bit.gray = 0 - * sig_bit.red = sig_bit.green = sig_bit.blue = sig_bit.alpha = 8 # <<<<<<<<<<<<<< - * - * png_set_sBIT(png_ptr, info_ptr, &sig_bit) - */ - __pyx_v_sig_bit.red = 8; - __pyx_v_sig_bit.green = 8; - __pyx_v_sig_bit.blue = 8; - __pyx_v_sig_bit.alpha = 8; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":140 - * sig_bit.red = sig_bit.green = sig_bit.blue = sig_bit.alpha = 8 - * - * png_set_sBIT(png_ptr, info_ptr, &sig_bit) # <<<<<<<<<<<<<< - * - * png_write_info(png_ptr, info_ptr) - */ - png_set_sBIT(__pyx_v_png_ptr, __pyx_v_info_ptr, (&__pyx_v_sig_bit)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":142 - * png_set_sBIT(png_ptr, info_ptr, &sig_bit) - * - * png_write_info(png_ptr, info_ptr) # <<<<<<<<<<<<<< - * png_write_image(png_ptr, row_pointers) - * png_write_end(png_ptr, info_ptr) - */ - png_write_info(__pyx_v_png_ptr, __pyx_v_info_ptr); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":143 - * - * png_write_info(png_ptr, info_ptr) - * png_write_image(png_ptr, row_pointers) # <<<<<<<<<<<<<< - * png_write_end(png_ptr, info_ptr) - * - */ - png_write_image(__pyx_v_png_ptr, __pyx_v_row_pointers); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":144 - * png_write_info(png_ptr, info_ptr) - * png_write_image(png_ptr, row_pointers) - * png_write_end(png_ptr, info_ptr) # <<<<<<<<<<<<<< - * - * fclose(fileobj) - */ - png_write_end(__pyx_v_png_ptr, __pyx_v_info_ptr); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":146 - * png_write_end(png_ptr, info_ptr) - * - * fclose(fileobj) # <<<<<<<<<<<<<< - * png_destroy_write_struct(&png_ptr, &info_ptr) - * - */ - fclose(__pyx_v_fileobj); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":147 - * - * fclose(fileobj) - * png_destroy_write_struct(&png_ptr, &info_ptr) # <<<<<<<<<<<<<< - * - * def add_points_to_image( - */ - png_destroy_write_struct((&__pyx_v_png_ptr), (&__pyx_v_info_ptr)); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_buffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.amr_utils.write_png"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_buffer); - __pyx_L2:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":149 - * png_destroy_write_struct(&png_ptr, &info_ptr) - * - * def add_points_to_image( # <<<<<<<<<<<<<< - * np.ndarray[np.uint8_t, ndim=3] buffer, - * np.ndarray[np.float64_t, ndim=1] px, - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_add_points_to_image(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_add_points_to_image(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_buffer = 0; - PyArrayObject *__pyx_v_px = 0; - PyArrayObject *__pyx_v_py = 0; - __pyx_t_5numpy_float64_t __pyx_v_pv; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - int __pyx_v_pi; - int __pyx_v_np; - int __pyx_v_xs; - int __pyx_v_ys; - int __pyx_v_v; - Py_buffer __pyx_bstruct_buffer; - Py_ssize_t __pyx_bstride_0_buffer = 0; - Py_ssize_t __pyx_bstride_1_buffer = 0; - Py_ssize_t __pyx_bstride_2_buffer = 0; - Py_ssize_t __pyx_bshape_0_buffer = 0; - Py_ssize_t __pyx_bshape_1_buffer = 0; - Py_ssize_t __pyx_bshape_2_buffer = 0; - Py_buffer __pyx_bstruct_px; - Py_ssize_t __pyx_bstride_0_px = 0; - Py_ssize_t __pyx_bshape_0_px = 0; - Py_buffer __pyx_bstruct_py; - Py_ssize_t __pyx_bstride_0_py = 0; - Py_ssize_t __pyx_bshape_0_py = 0; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - 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; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__px,&__pyx_n_s__py,&__pyx_n_s__pv,0}; - __Pyx_RefNannySetupContext("add_points_to_image"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[4] = {0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__px); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("add_points_to_image", 1, 4, 4, 1); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__py); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("add_points_to_image", 1, 4, 4, 2); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pv); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("add_points_to_image", 1, 4, 4, 3); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "add_points_to_image") < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_buffer = ((PyArrayObject *)values[0]); - __pyx_v_px = ((PyArrayObject *)values[1]); - __pyx_v_py = ((PyArrayObject *)values[2]); - __pyx_v_pv = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_pv == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_buffer = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_px = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_py = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_pv = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_pv == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("add_points_to_image", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.add_points_to_image"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_buffer.buf = NULL; - __pyx_bstruct_px.buf = NULL; - __pyx_bstruct_py.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_buffer), __pyx_ptype_5numpy_ndarray, 1, "buffer", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_px), __pyx_ptype_5numpy_ndarray, 1, "px", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_py), __pyx_ptype_5numpy_ndarray, 1, "py", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_buffer, (PyObject*)__pyx_v_buffer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_buffer = __pyx_bstruct_buffer.strides[0]; __pyx_bstride_1_buffer = __pyx_bstruct_buffer.strides[1]; __pyx_bstride_2_buffer = __pyx_bstruct_buffer.strides[2]; - __pyx_bshape_0_buffer = __pyx_bstruct_buffer.shape[0]; __pyx_bshape_1_buffer = __pyx_bstruct_buffer.shape[1]; __pyx_bshape_2_buffer = __pyx_bstruct_buffer.shape[2]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_px, (PyObject*)__pyx_v_px, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_px = __pyx_bstruct_px.strides[0]; - __pyx_bshape_0_px = __pyx_bstruct_px.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_py, (PyObject*)__pyx_v_py, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_py = __pyx_bstruct_py.strides[0]; - __pyx_bshape_0_py = __pyx_bstruct_py.shape[0]; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":155 - * np.float64_t pv): - * cdef int i, j, k, pi - * cdef int np = px.shape[0] # <<<<<<<<<<<<<< - * cdef int xs = buffer.shape[0] - * cdef int ys = buffer.shape[1] - */ - __pyx_v_np = (__pyx_v_px->dimensions[0]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":156 - * cdef int i, j, k, pi - * cdef int np = px.shape[0] - * cdef int xs = buffer.shape[0] # <<<<<<<<<<<<<< - * cdef int ys = buffer.shape[1] - * cdef int v - */ - __pyx_v_xs = (__pyx_v_buffer->dimensions[0]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":157 - * cdef int np = px.shape[0] - * cdef int xs = buffer.shape[0] - * cdef int ys = buffer.shape[1] # <<<<<<<<<<<<<< - * cdef int v - * v = iclip((pv * 255), 0, 255) - */ - __pyx_v_ys = (__pyx_v_buffer->dimensions[1]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":159 - * cdef int ys = buffer.shape[1] - * cdef int v - * v = iclip((pv * 255), 0, 255) # <<<<<<<<<<<<<< - * for pi in range(np): - * j = (xs * px[pi]) - */ - __pyx_v_v = __pyx_f_2yt_9amr_utils_iclip(((int)(__pyx_v_pv * 255.0)), 0, 255); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":160 - * cdef int v - * v = iclip((pv * 255), 0, 255) - * for pi in range(np): # <<<<<<<<<<<<<< - * j = (xs * px[pi]) - * i = (ys * py[pi]) - */ - __pyx_t_1 = __pyx_v_np; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_pi = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":161 - * v = iclip((pv * 255), 0, 255) - * for pi in range(np): - * j = (xs * px[pi]) # <<<<<<<<<<<<<< - * i = (ys * py[pi]) - * for k in range(3): - */ - __pyx_t_3 = __pyx_v_pi; - __pyx_t_4 = -1; - if (__pyx_t_3 < 0) { - __pyx_t_3 += __pyx_bshape_0_px; - if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 0; - } else if (unlikely(__pyx_t_3 >= __pyx_bshape_0_px)) __pyx_t_4 = 0; - if (unlikely(__pyx_t_4 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_4); - {__pyx_filename = __pyx_f[7]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_j = ((int)(__pyx_v_xs * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_px.buf, __pyx_t_3, __pyx_bstride_0_px)))); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":162 - * for pi in range(np): - * j = (xs * px[pi]) - * i = (ys * py[pi]) # <<<<<<<<<<<<<< - * for k in range(3): - * buffer[i, j, k] = 0 - */ - __pyx_t_4 = __pyx_v_pi; - __pyx_t_5 = -1; - if (__pyx_t_4 < 0) { - __pyx_t_4 += __pyx_bshape_0_py; - if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0; - } else if (unlikely(__pyx_t_4 >= __pyx_bshape_0_py)) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - {__pyx_filename = __pyx_f[7]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_i = ((int)(__pyx_v_ys * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_py.buf, __pyx_t_4, __pyx_bstride_0_py)))); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":163 - * j = (xs * px[pi]) - * i = (ys * py[pi]) - * for k in range(3): # <<<<<<<<<<<<<< - * buffer[i, j, k] = 0 - * return - */ - for (__pyx_t_5 = 0; __pyx_t_5 < 3; __pyx_t_5+=1) { - __pyx_v_k = __pyx_t_5; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":164 - * i = (ys * py[pi]) - * for k in range(3): - * buffer[i, j, k] = 0 # <<<<<<<<<<<<<< - * return - * for i in range(xs): - */ - __pyx_t_6 = __pyx_v_i; - __pyx_t_7 = __pyx_v_j; - __pyx_t_8 = __pyx_v_k; - __pyx_t_9 = -1; - if (__pyx_t_6 < 0) { - __pyx_t_6 += __pyx_bshape_0_buffer; - if (unlikely(__pyx_t_6 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_6 >= __pyx_bshape_0_buffer)) __pyx_t_9 = 0; - if (__pyx_t_7 < 0) { - __pyx_t_7 += __pyx_bshape_1_buffer; - if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 1; - } else if (unlikely(__pyx_t_7 >= __pyx_bshape_1_buffer)) __pyx_t_9 = 1; - if (__pyx_t_8 < 0) { - __pyx_t_8 += __pyx_bshape_2_buffer; - if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 2; - } else if (unlikely(__pyx_t_8 >= __pyx_bshape_2_buffer)) __pyx_t_9 = 2; - if (unlikely(__pyx_t_9 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_9); - {__pyx_filename = __pyx_f[7]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_uint8_t *, __pyx_bstruct_buffer.buf, __pyx_t_6, __pyx_bstride_0_buffer, __pyx_t_7, __pyx_bstride_1_buffer, __pyx_t_8, __pyx_bstride_2_buffer) = 0; - } - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":165 - * for k in range(3): - * buffer[i, j, k] = 0 - * return # <<<<<<<<<<<<<< - * for i in range(xs): - * for j in range(ys): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":166 - * buffer[i, j, k] = 0 - * return - * for i in range(xs): # <<<<<<<<<<<<<< - * for j in range(ys): - * for k in range(3): - */ - __pyx_t_1 = __pyx_v_xs; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":167 - * return - * for i in range(xs): - * for j in range(ys): # <<<<<<<<<<<<<< - * for k in range(3): - * v = buffer[i, j, k] - */ - __pyx_t_5 = __pyx_v_ys; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_5; __pyx_t_9+=1) { - __pyx_v_j = __pyx_t_9; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":168 - * for i in range(xs): - * for j in range(ys): - * for k in range(3): # <<<<<<<<<<<<<< - * v = buffer[i, j, k] - * buffer[i, j, k] = iclip(v, 0, 255) - */ - for (__pyx_t_10 = 0; __pyx_t_10 < 3; __pyx_t_10+=1) { - __pyx_v_k = __pyx_t_10; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":169 - * for j in range(ys): - * for k in range(3): - * v = buffer[i, j, k] # <<<<<<<<<<<<<< - * buffer[i, j, k] = iclip(v, 0, 255) - */ - __pyx_t_11 = __pyx_v_i; - __pyx_t_12 = __pyx_v_j; - __pyx_t_13 = __pyx_v_k; - __pyx_t_14 = -1; - if (__pyx_t_11 < 0) { - __pyx_t_11 += __pyx_bshape_0_buffer; - if (unlikely(__pyx_t_11 < 0)) __pyx_t_14 = 0; - } else if (unlikely(__pyx_t_11 >= __pyx_bshape_0_buffer)) __pyx_t_14 = 0; - if (__pyx_t_12 < 0) { - __pyx_t_12 += __pyx_bshape_1_buffer; - if (unlikely(__pyx_t_12 < 0)) __pyx_t_14 = 1; - } else if (unlikely(__pyx_t_12 >= __pyx_bshape_1_buffer)) __pyx_t_14 = 1; - if (__pyx_t_13 < 0) { - __pyx_t_13 += __pyx_bshape_2_buffer; - if (unlikely(__pyx_t_13 < 0)) __pyx_t_14 = 2; - } else if (unlikely(__pyx_t_13 >= __pyx_bshape_2_buffer)) __pyx_t_14 = 2; - if (unlikely(__pyx_t_14 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_14); - {__pyx_filename = __pyx_f[7]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_v = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_uint8_t *, __pyx_bstruct_buffer.buf, __pyx_t_11, __pyx_bstride_0_buffer, __pyx_t_12, __pyx_bstride_1_buffer, __pyx_t_13, __pyx_bstride_2_buffer)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":170 - * for k in range(3): - * v = buffer[i, j, k] - * buffer[i, j, k] = iclip(v, 0, 255) # <<<<<<<<<<<<<< - */ - __pyx_t_14 = __pyx_v_i; - __pyx_t_15 = __pyx_v_j; - __pyx_t_16 = __pyx_v_k; - __pyx_t_17 = -1; - if (__pyx_t_14 < 0) { - __pyx_t_14 += __pyx_bshape_0_buffer; - if (unlikely(__pyx_t_14 < 0)) __pyx_t_17 = 0; - } else if (unlikely(__pyx_t_14 >= __pyx_bshape_0_buffer)) __pyx_t_17 = 0; - if (__pyx_t_15 < 0) { - __pyx_t_15 += __pyx_bshape_1_buffer; - if (unlikely(__pyx_t_15 < 0)) __pyx_t_17 = 1; - } else if (unlikely(__pyx_t_15 >= __pyx_bshape_1_buffer)) __pyx_t_17 = 1; - if (__pyx_t_16 < 0) { - __pyx_t_16 += __pyx_bshape_2_buffer; - if (unlikely(__pyx_t_16 < 0)) __pyx_t_17 = 2; - } else if (unlikely(__pyx_t_16 >= __pyx_bshape_2_buffer)) __pyx_t_17 = 2; - if (unlikely(__pyx_t_17 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_17); - {__pyx_filename = __pyx_f[7]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_uint8_t *, __pyx_bstruct_buffer.buf, __pyx_t_14, __pyx_bstride_0_buffer, __pyx_t_15, __pyx_bstride_1_buffer, __pyx_t_16, __pyx_bstride_2_buffer) = __pyx_f_2yt_9amr_utils_iclip(__pyx_v_v, 0, 255); - } - } - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_buffer); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_px); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_py); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.amr_utils.add_points_to_image"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_buffer); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_px); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_py); - __pyx_L2:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":42 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * def read_tiger_section( # <<<<<<<<<<<<<< - * char *fn, - * np.ndarray[np.int64_t, ndim=1] slab_start, - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_read_tiger_section(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_read_tiger_section(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - char *__pyx_v_fn; - PyArrayObject *__pyx_v_slab_start = 0; - PyArrayObject *__pyx_v_slab_size = 0; - PyArrayObject *__pyx_v_root_size = 0; - int __pyx_v_offset; - int __pyx_v_strides[3]; - __pyx_t_5numpy_int64_t __pyx_v_i; - __pyx_t_5numpy_int64_t __pyx_v_j; - PyArrayObject *__pyx_v_buffer = 0; - FILE *__pyx_v_f; - __pyx_t_5numpy_int64_t __pyx_v_pos; - __pyx_t_5numpy_int64_t __pyx_v_moff; - float *__pyx_v_data; - Py_buffer __pyx_bstruct_slab_size; - Py_ssize_t __pyx_bstride_0_slab_size = 0; - Py_ssize_t __pyx_bshape_0_slab_size = 0; - Py_buffer __pyx_bstruct_slab_start; - Py_ssize_t __pyx_bstride_0_slab_start = 0; - Py_ssize_t __pyx_bshape_0_slab_start = 0; - Py_buffer __pyx_bstruct_root_size; - Py_ssize_t __pyx_bstride_0_root_size = 0; - Py_ssize_t __pyx_bshape_0_root_size = 0; - PyObject *__pyx_r = NULL; - long __pyx_t_1; - long __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - long __pyx_t_7; - __pyx_t_5numpy_int64_t __pyx_t_8; - __pyx_t_5numpy_int64_t __pyx_t_9; - long __pyx_t_10; - __pyx_t_5numpy_int64_t __pyx_t_11; - __pyx_t_5numpy_int64_t __pyx_t_12; - long __pyx_t_13; - long __pyx_t_14; - long __pyx_t_15; - long __pyx_t_16; - long __pyx_t_17; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fn,&__pyx_n_s__slab_start,&__pyx_n_s__slab_size,&__pyx_n_s__root_size,&__pyx_n_s__offset,0}; - __Pyx_RefNannySetupContext("read_tiger_section"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[5] = {0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fn); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__slab_start); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("read_tiger_section", 0, 4, 5, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__slab_size); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("read_tiger_section", 0, 4, 5, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__root_size); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("read_tiger_section", 0, 4, 5, 3); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__offset); - if (unlikely(value)) { values[4] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "read_tiger_section") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_fn = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_fn) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_slab_start = ((PyArrayObject *)values[1]); - __pyx_v_slab_size = ((PyArrayObject *)values[2]); - __pyx_v_root_size = ((PyArrayObject *)values[3]); - if (values[4]) { - __pyx_v_offset = __Pyx_PyInt_AsInt(values[4]); if (unlikely((__pyx_v_offset == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_offset = ((int)36); - } - } else { - __pyx_v_offset = ((int)36); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: - __pyx_v_offset = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_offset == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 4: - __pyx_v_root_size = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); - __pyx_v_slab_size = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_slab_start = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_fn = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_fn) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - break; - default: goto __pyx_L5_argtuple_error; - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("read_tiger_section", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.read_tiger_section"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_slab_start.buf = NULL; - __pyx_bstruct_slab_size.buf = NULL; - __pyx_bstruct_root_size.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slab_start), __pyx_ptype_5numpy_ndarray, 1, "slab_start", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slab_size), __pyx_ptype_5numpy_ndarray, 1, "slab_size", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_root_size), __pyx_ptype_5numpy_ndarray, 1, "root_size", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_slab_start, (PyObject*)__pyx_v_slab_start, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_slab_start = __pyx_bstruct_slab_start.strides[0]; - __pyx_bshape_0_slab_start = __pyx_bstruct_slab_start.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_slab_size, (PyObject*)__pyx_v_slab_size, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_slab_size = __pyx_bstruct_slab_size.strides[0]; - __pyx_bshape_0_slab_size = __pyx_bstruct_slab_size.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_root_size, (PyObject*)__pyx_v_root_size, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_root_size = __pyx_bstruct_root_size.strides[0]; - __pyx_bshape_0_root_size = __pyx_bstruct_root_size.shape[0]; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":49 - * int offset = 36): - * cdef int strides[3] - * strides[0] = 1 # <<<<<<<<<<<<<< - * strides[1] = root_size[0] * strides[0] - * strides[2] = strides[1] * root_size[1] + 2 - */ - (__pyx_v_strides[0]) = 1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":50 - * cdef int strides[3] - * strides[0] = 1 - * strides[1] = root_size[0] * strides[0] # <<<<<<<<<<<<<< - * strides[2] = strides[1] * root_size[1] + 2 - * cdef np.int64_t i, j, k - */ - __pyx_t_1 = 0; - (__pyx_v_strides[1]) = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_root_size.buf, __pyx_t_1, __pyx_bstride_0_root_size)) * (__pyx_v_strides[0])); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":51 - * strides[0] = 1 - * strides[1] = root_size[0] * strides[0] - * strides[2] = strides[1] * root_size[1] + 2 # <<<<<<<<<<<<<< - * cdef np.int64_t i, j, k - * cdef np.ndarray buffer = np.zeros(slab_size, dtype='float32', order='F') - */ - __pyx_t_2 = 1; - (__pyx_v_strides[2]) = (((__pyx_v_strides[1]) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_root_size.buf, __pyx_t_2, __pyx_bstride_0_root_size))) + 2); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":53 - * strides[2] = strides[1] * root_size[1] + 2 - * cdef np.int64_t i, j, k - * cdef np.ndarray buffer = np.zeros(slab_size, dtype='float32', order='F') # <<<<<<<<<<<<<< - * cdef FILE *f = fopen(fn, "rb") - * #for i in range(3): offset += strides[i] * slab_start[i] - */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_v_slab_size)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_slab_size)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_slab_size)); - __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float32)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__F)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_4, __pyx_t_3, ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_buffer = ((PyArrayObject *)__pyx_t_6); - __pyx_t_6 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":54 - * cdef np.int64_t i, j, k - * cdef np.ndarray buffer = np.zeros(slab_size, dtype='float32', order='F') - * cdef FILE *f = fopen(fn, "rb") # <<<<<<<<<<<<<< - * #for i in range(3): offset += strides[i] * slab_start[i] - * cdef np.int64_t pos = 0 - */ - __pyx_v_f = fopen(__pyx_v_fn, __pyx_k__rb); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":56 - * cdef FILE *f = fopen(fn, "rb") - * #for i in range(3): offset += strides[i] * slab_start[i] - * cdef np.int64_t pos = 0 # <<<<<<<<<<<<<< - * cdef np.int64_t moff = 0 - * cdef float *data = buffer.data - */ - __pyx_v_pos = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":57 - * #for i in range(3): offset += strides[i] * slab_start[i] - * cdef np.int64_t pos = 0 - * cdef np.int64_t moff = 0 # <<<<<<<<<<<<<< - * cdef float *data = buffer.data - * fseek(f, offset, 0) - */ - __pyx_v_moff = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":58 - * cdef np.int64_t pos = 0 - * cdef np.int64_t moff = 0 - * cdef float *data = buffer.data # <<<<<<<<<<<<<< - * fseek(f, offset, 0) - * # If anybody wants to convert this loop to a SEEK_CUR, that'd be great. - */ - __pyx_v_data = ((float *)__pyx_v_buffer->data); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":59 - * cdef np.int64_t moff = 0 - * cdef float *data = buffer.data - * fseek(f, offset, 0) # <<<<<<<<<<<<<< - * # If anybody wants to convert this loop to a SEEK_CUR, that'd be great. - * for i in range(slab_size[2]): - */ - fseek(__pyx_v_f, __pyx_v_offset, 0); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":61 - * fseek(f, offset, 0) - * # If anybody wants to convert this loop to a SEEK_CUR, that'd be great. - * for i in range(slab_size[2]): # <<<<<<<<<<<<<< - * for j in range(slab_size[1]): - * moff = (slab_start[0] ) * strides[0] \ - */ - __pyx_t_7 = 2; - __pyx_t_8 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_slab_size.buf, __pyx_t_7, __pyx_bstride_0_slab_size)); - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":62 - * # If anybody wants to convert this loop to a SEEK_CUR, that'd be great. - * for i in range(slab_size[2]): - * for j in range(slab_size[1]): # <<<<<<<<<<<<<< - * moff = (slab_start[0] ) * strides[0] \ - * + (slab_start[1] + j) * strides[1] \ - */ - __pyx_t_10 = 1; - __pyx_t_11 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_slab_size.buf, __pyx_t_10, __pyx_bstride_0_slab_size)); - for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { - __pyx_v_j = __pyx_t_12; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":63 - * for i in range(slab_size[2]): - * for j in range(slab_size[1]): - * moff = (slab_start[0] ) * strides[0] \ # <<<<<<<<<<<<<< - * + (slab_start[1] + j) * strides[1] \ - * + (slab_start[2] + i) * strides[2] - */ - __pyx_t_13 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":64 - * for j in range(slab_size[1]): - * moff = (slab_start[0] ) * strides[0] \ - * + (slab_start[1] + j) * strides[1] \ # <<<<<<<<<<<<<< - * + (slab_start[2] + i) * strides[2] - * #print offset + 4 * moff, pos - */ - __pyx_t_14 = 1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":65 - * moff = (slab_start[0] ) * strides[0] \ - * + (slab_start[1] + j) * strides[1] \ - * + (slab_start[2] + i) * strides[2] # <<<<<<<<<<<<<< - * #print offset + 4 * moff, pos - * fseek(f, offset + 4 * moff, SEEK_SET) - */ - __pyx_t_15 = 2; - __pyx_v_moff = ((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_slab_start.buf, __pyx_t_13, __pyx_bstride_0_slab_start)) * (__pyx_v_strides[0])) + (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_slab_start.buf, __pyx_t_14, __pyx_bstride_0_slab_start)) + __pyx_v_j) * (__pyx_v_strides[1]))) + (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_slab_start.buf, __pyx_t_15, __pyx_bstride_0_slab_start)) + __pyx_v_i) * (__pyx_v_strides[2]))); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":67 - * + (slab_start[2] + i) * strides[2] - * #print offset + 4 * moff, pos - * fseek(f, offset + 4 * moff, SEEK_SET) # <<<<<<<<<<<<<< - * fread( (data + pos), 4, slab_size[0], f) - * pos += slab_size[0] - */ - fseek(__pyx_v_f, (__pyx_v_offset + (4 * __pyx_v_moff)), SEEK_SET); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":68 - * #print offset + 4 * moff, pos - * fseek(f, offset + 4 * moff, SEEK_SET) - * fread( (data + pos), 4, slab_size[0], f) # <<<<<<<<<<<<<< - * pos += slab_size[0] - * return buffer - */ - __pyx_t_16 = 0; - fread(((void *)(__pyx_v_data + __pyx_v_pos)), 4, (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_slab_size.buf, __pyx_t_16, __pyx_bstride_0_slab_size)), __pyx_v_f); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":69 - * fseek(f, offset + 4 * moff, SEEK_SET) - * fread( (data + pos), 4, slab_size[0], f) - * pos += slab_size[0] # <<<<<<<<<<<<<< - * return buffer - */ - __pyx_t_17 = 0; - __pyx_v_pos += (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_slab_size.buf, __pyx_t_17, __pyx_bstride_0_slab_size)); - } - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":70 - * fread( (data + pos), 4, slab_size[0], f) - * pos += slab_size[0] - * return buffer # <<<<<<<<<<<<<< - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_buffer)); - __pyx_r = ((PyObject *)__pyx_v_buffer); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_slab_size); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_slab_start); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_root_size); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.amr_utils.read_tiger_section"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_slab_size); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_slab_start); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_root_size); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_buffer); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":47 - * QuadTreeNode *children[2][2] - * - * cdef void QTN_add_value(QuadTreeNode *self, # <<<<<<<<<<<<<< - * np.float64_t *val, np.float64_t weight_val): - * cdef int i - */ - -static void __pyx_f_2yt_9amr_utils_QTN_add_value(struct __pyx_t_2yt_9amr_utils_QuadTreeNode *__pyx_v_self, __pyx_t_5numpy_float64_t *__pyx_v_val, __pyx_t_5numpy_float64_t __pyx_v_weight_val) { - int __pyx_v_i; - int __pyx_t_1; - int __pyx_t_2; - __Pyx_RefNannySetupContext("QTN_add_value"); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":50 - * np.float64_t *val, np.float64_t weight_val): - * cdef int i - * for i in range(self.nvals): # <<<<<<<<<<<<<< - * self.val[i] += val[i] - * self.weight_val += weight_val - */ - __pyx_t_1 = __pyx_v_self->nvals; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":51 - * cdef int i - * for i in range(self.nvals): - * self.val[i] += val[i] # <<<<<<<<<<<<<< - * self.weight_val += weight_val - * - */ - (__pyx_v_self->val[__pyx_v_i]) += (__pyx_v_val[__pyx_v_i]); - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":52 - * for i in range(self.nvals): - * self.val[i] += val[i] - * self.weight_val += weight_val # <<<<<<<<<<<<<< - * - * cdef void QTN_refine(QuadTreeNode *self): - */ - __pyx_v_self->weight_val += __pyx_v_weight_val; - - __Pyx_RefNannyFinishContext(); -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":54 - * self.weight_val += weight_val - * - * cdef void QTN_refine(QuadTreeNode *self): # <<<<<<<<<<<<<< - * cdef int i, j, i1, j1 - * cdef np.int64_t npos[2] - */ - -static void __pyx_f_2yt_9amr_utils_QTN_refine(struct __pyx_t_2yt_9amr_utils_QuadTreeNode *__pyx_v_self) { - int __pyx_v_i; - int __pyx_v_j; - __pyx_t_5numpy_int64_t __pyx_v_npos[2]; - int __pyx_t_1; - int __pyx_t_2; - __Pyx_RefNannySetupContext("QTN_refine"); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":58 - * cdef np.int64_t npos[2] - * cdef QuadTreeNode *node - * for i in range(2): # <<<<<<<<<<<<<< - * npos[0] = self.pos[0] * 2 + i - * for j in range(2): - */ - for (__pyx_t_1 = 0; __pyx_t_1 < 2; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":59 - * cdef QuadTreeNode *node - * for i in range(2): - * npos[0] = self.pos[0] * 2 + i # <<<<<<<<<<<<<< - * for j in range(2): - * npos[1] = self.pos[1] * 2 + j - */ - (__pyx_v_npos[0]) = (((__pyx_v_self->pos[0]) * 2) + __pyx_v_i); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":60 - * for i in range(2): - * npos[0] = self.pos[0] * 2 + i - * for j in range(2): # <<<<<<<<<<<<<< - * npos[1] = self.pos[1] * 2 + j - * # We have to be careful with allocation... - */ - for (__pyx_t_2 = 0; __pyx_t_2 < 2; __pyx_t_2+=1) { - __pyx_v_j = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":61 - * npos[0] = self.pos[0] * 2 + i - * for j in range(2): - * npos[1] = self.pos[1] * 2 + j # <<<<<<<<<<<<<< - * # We have to be careful with allocation... - * self.children[i][j] = QTN_initialize( - */ - (__pyx_v_npos[1]) = (((__pyx_v_self->pos[1]) * 2) + __pyx_v_j); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":63 - * npos[1] = self.pos[1] * 2 + j - * # We have to be careful with allocation... - * self.children[i][j] = QTN_initialize( # <<<<<<<<<<<<<< - * npos, - * self.nvals, self.val, self.weight_val, - */ - ((__pyx_v_self->children[__pyx_v_i])[__pyx_v_j]) = __pyx_f_2yt_9amr_utils_QTN_initialize(__pyx_v_npos, __pyx_v_self->nvals, __pyx_v_self->val, __pyx_v_self->weight_val, (__pyx_v_self->level + 1)); - } - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":67 - * self.nvals, self.val, self.weight_val, - * self.level + 1) - * for i in range(self.nvals): self.val[i] = 0.0 # <<<<<<<<<<<<<< - * self.weight_val = 0.0 - * - */ - __pyx_t_1 = __pyx_v_self->nvals; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; - (__pyx_v_self->val[__pyx_v_i]) = 0.0; - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":68 - * self.level + 1) - * for i in range(self.nvals): self.val[i] = 0.0 - * self.weight_val = 0.0 # <<<<<<<<<<<<<< - * - * cdef QuadTreeNode *QTN_initialize(np.int64_t pos[2], int nvals, - */ - __pyx_v_self->weight_val = 0.0; - - __Pyx_RefNannyFinishContext(); -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":70 - * self.weight_val = 0.0 - * - * cdef QuadTreeNode *QTN_initialize(np.int64_t pos[2], int nvals, # <<<<<<<<<<<<<< - * np.float64_t *val, np.float64_t weight_val, - * int level): - */ - -static struct __pyx_t_2yt_9amr_utils_QuadTreeNode *__pyx_f_2yt_9amr_utils_QTN_initialize(__pyx_t_5numpy_int64_t *__pyx_v_pos, int __pyx_v_nvals, __pyx_t_5numpy_float64_t *__pyx_v_val, __pyx_t_5numpy_float64_t __pyx_v_weight_val, int __pyx_v_level) { - struct __pyx_t_2yt_9amr_utils_QuadTreeNode *__pyx_v_node; - int __pyx_v_i; - int __pyx_v_j; - struct __pyx_t_2yt_9amr_utils_QuadTreeNode *__pyx_r; - int __pyx_t_1; - int __pyx_t_2; - __Pyx_RefNannySetupContext("QTN_initialize"); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":75 - * cdef QuadTreeNode *node - * cdef int i, j - * node = malloc(sizeof(QuadTreeNode)) # <<<<<<<<<<<<<< - * node.pos[0] = pos[0] - * node.pos[1] = pos[1] - */ - __pyx_v_node = ((struct __pyx_t_2yt_9amr_utils_QuadTreeNode *)malloc((sizeof(struct __pyx_t_2yt_9amr_utils_QuadTreeNode)))); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":76 - * cdef int i, j - * node = malloc(sizeof(QuadTreeNode)) - * node.pos[0] = pos[0] # <<<<<<<<<<<<<< - * node.pos[1] = pos[1] - * node.nvals = nvals - */ - (__pyx_v_node->pos[0]) = (__pyx_v_pos[0]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":77 - * node = malloc(sizeof(QuadTreeNode)) - * node.pos[0] = pos[0] - * node.pos[1] = pos[1] # <<<<<<<<<<<<<< - * node.nvals = nvals - * node.val = malloc( - */ - (__pyx_v_node->pos[1]) = (__pyx_v_pos[1]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":78 - * node.pos[0] = pos[0] - * node.pos[1] = pos[1] - * node.nvals = nvals # <<<<<<<<<<<<<< - * node.val = malloc( - * nvals * sizeof(np.float64_t)) - */ - __pyx_v_node->nvals = __pyx_v_nvals; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":79 - * node.pos[1] = pos[1] - * node.nvals = nvals - * node.val = malloc( # <<<<<<<<<<<<<< - * nvals * sizeof(np.float64_t)) - * for i in range(nvals): - */ - __pyx_v_node->val = ((__pyx_t_5numpy_float64_t *)malloc((__pyx_v_nvals * (sizeof(__pyx_t_5numpy_float64_t))))); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":81 - * node.val = malloc( - * nvals * sizeof(np.float64_t)) - * for i in range(nvals): # <<<<<<<<<<<<<< - * node.val[i] = val[i] - * node.weight_val = weight_val - */ - __pyx_t_1 = __pyx_v_nvals; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":82 - * nvals * sizeof(np.float64_t)) - * for i in range(nvals): - * node.val[i] = val[i] # <<<<<<<<<<<<<< - * node.weight_val = weight_val - * for i in range(2): - */ - (__pyx_v_node->val[__pyx_v_i]) = (__pyx_v_val[__pyx_v_i]); - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":83 - * for i in range(nvals): - * node.val[i] = val[i] - * node.weight_val = weight_val # <<<<<<<<<<<<<< - * for i in range(2): - * for j in range(2): - */ - __pyx_v_node->weight_val = __pyx_v_weight_val; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":84 - * node.val[i] = val[i] - * node.weight_val = weight_val - * for i in range(2): # <<<<<<<<<<<<<< - * for j in range(2): - * node.children[i][j] = NULL - */ - for (__pyx_t_1 = 0; __pyx_t_1 < 2; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":85 - * node.weight_val = weight_val - * for i in range(2): - * for j in range(2): # <<<<<<<<<<<<<< - * node.children[i][j] = NULL - * node.level = level - */ - for (__pyx_t_2 = 0; __pyx_t_2 < 2; __pyx_t_2+=1) { - __pyx_v_j = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":86 - * for i in range(2): - * for j in range(2): - * node.children[i][j] = NULL # <<<<<<<<<<<<<< - * node.level = level - * return node - */ - ((__pyx_v_node->children[__pyx_v_i])[__pyx_v_j]) = NULL; - } - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":87 - * for j in range(2): - * node.children[i][j] = NULL - * node.level = level # <<<<<<<<<<<<<< - * return node - * - */ - __pyx_v_node->level = __pyx_v_level; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":88 - * node.children[i][j] = NULL - * node.level = level - * return node # <<<<<<<<<<<<<< - * - * cdef void QTN_free(QuadTreeNode *node): - */ - __pyx_r = __pyx_v_node; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":90 - * return node - * - * cdef void QTN_free(QuadTreeNode *node): # <<<<<<<<<<<<<< - * cdef int i, j - * for i in range(2): - */ - -static void __pyx_f_2yt_9amr_utils_QTN_free(struct __pyx_t_2yt_9amr_utils_QuadTreeNode *__pyx_v_node) { - int __pyx_v_i; - int __pyx_v_j; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - __Pyx_RefNannySetupContext("QTN_free"); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":92 - * cdef void QTN_free(QuadTreeNode *node): - * cdef int i, j - * for i in range(2): # <<<<<<<<<<<<<< - * for j in range(2): - * if node.children[i][j] == NULL: continue - */ - for (__pyx_t_1 = 0; __pyx_t_1 < 2; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":93 - * cdef int i, j - * for i in range(2): - * for j in range(2): # <<<<<<<<<<<<<< - * if node.children[i][j] == NULL: continue - * QTN_free(node.children[i][j]) - */ - for (__pyx_t_2 = 0; __pyx_t_2 < 2; __pyx_t_2+=1) { - __pyx_v_j = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":94 - * for i in range(2): - * for j in range(2): - * if node.children[i][j] == NULL: continue # <<<<<<<<<<<<<< - * QTN_free(node.children[i][j]) - * free(node.val) - */ - __pyx_t_3 = (((__pyx_v_node->children[__pyx_v_i])[__pyx_v_j]) == NULL); - if (__pyx_t_3) { - goto __pyx_L5_continue; - goto __pyx_L7; - } - __pyx_L7:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":95 - * for j in range(2): - * if node.children[i][j] == NULL: continue - * QTN_free(node.children[i][j]) # <<<<<<<<<<<<<< - * free(node.val) - * free(node) - */ - __pyx_f_2yt_9amr_utils_QTN_free(((__pyx_v_node->children[__pyx_v_i])[__pyx_v_j])); - __pyx_L5_continue:; - } - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":96 - * if node.children[i][j] == NULL: continue - * QTN_free(node.children[i][j]) - * free(node.val) # <<<<<<<<<<<<<< - * free(node) - * - */ - free(__pyx_v_node->val); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":97 - * QTN_free(node.children[i][j]) - * free(node.val) - * free(node) # <<<<<<<<<<<<<< - * - * cdef class QuadTree: - */ - free(__pyx_v_node); - - __Pyx_RefNannyFinishContext(); -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":105 - * cdef np.int64_t top_grid_dims[2] - * - * def __cinit__(self, np.ndarray[np.int64_t, ndim=1] top_grid_dims, # <<<<<<<<<<<<<< - * int nvals): - * cdef int i, j - */ - -static int __pyx_pf_2yt_9amr_utils_8QuadTree___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_2yt_9amr_utils_8QuadTree___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_top_grid_dims = 0; - int __pyx_v_nvals; - int __pyx_v_i; - int __pyx_v_j; - __pyx_t_5numpy_int64_t __pyx_v_pos[2]; - __pyx_t_5numpy_float64_t *__pyx_v_vals; - __pyx_t_5numpy_float64_t __pyx_v_weight_val; - Py_buffer __pyx_bstruct_top_grid_dims; - Py_ssize_t __pyx_bstride_0_top_grid_dims = 0; - Py_ssize_t __pyx_bshape_0_top_grid_dims = 0; - int __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - long __pyx_t_3; - long __pyx_t_4; - long __pyx_t_5; - long __pyx_t_6; - __pyx_t_5numpy_int64_t __pyx_t_7; - long __pyx_t_8; - long __pyx_t_9; - __pyx_t_5numpy_int64_t __pyx_t_10; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__top_grid_dims,&__pyx_n_s__nvals,0}; - __Pyx_RefNannySetupContext("__cinit__"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__top_grid_dims); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nvals); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_top_grid_dims = ((PyArrayObject *)values[0]); - __pyx_v_nvals = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_nvals == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_top_grid_dims = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_nvals = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_nvals == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.QuadTree.__cinit__"); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_top_grid_dims.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_top_grid_dims), __pyx_ptype_5numpy_ndarray, 1, "top_grid_dims", 0))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_top_grid_dims, (PyObject*)__pyx_v_top_grid_dims, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_top_grid_dims = __pyx_bstruct_top_grid_dims.strides[0]; - __pyx_bshape_0_top_grid_dims = __pyx_bstruct_top_grid_dims.shape[0]; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":111 - * cdef np.int64_t pos[2] - * cdef np.float64_t *vals = alloca( - * sizeof(np.float64_t)*nvals) # <<<<<<<<<<<<<< - * cdef np.float64_t weight_val = 0.0 - * self.nvals = nvals - */ - __pyx_v_vals = ((__pyx_t_5numpy_float64_t *)alloca(((sizeof(__pyx_t_5numpy_float64_t)) * __pyx_v_nvals))); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":112 - * cdef np.float64_t *vals = alloca( - * sizeof(np.float64_t)*nvals) - * cdef np.float64_t weight_val = 0.0 # <<<<<<<<<<<<<< - * self.nvals = nvals - * for i in range(nvals): vals[i] = 0.0 - */ - __pyx_v_weight_val = 0.0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":113 - * sizeof(np.float64_t)*nvals) - * cdef np.float64_t weight_val = 0.0 - * self.nvals = nvals # <<<<<<<<<<<<<< - * for i in range(nvals): vals[i] = 0.0 - * - */ - ((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->nvals = __pyx_v_nvals; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":114 - * cdef np.float64_t weight_val = 0.0 - * self.nvals = nvals - * for i in range(nvals): vals[i] = 0.0 # <<<<<<<<<<<<<< - * - * self.top_grid_dims[0] = top_grid_dims[0] - */ - __pyx_t_1 = __pyx_v_nvals; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; - (__pyx_v_vals[__pyx_v_i]) = 0.0; - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":116 - * for i in range(nvals): vals[i] = 0.0 - * - * self.top_grid_dims[0] = top_grid_dims[0] # <<<<<<<<<<<<<< - * self.top_grid_dims[1] = top_grid_dims[1] - * - */ - __pyx_t_3 = 0; - __pyx_t_1 = -1; - if (__pyx_t_3 < 0) { - __pyx_t_3 += __pyx_bshape_0_top_grid_dims; - if (unlikely(__pyx_t_3 < 0)) __pyx_t_1 = 0; - } else if (unlikely(__pyx_t_3 >= __pyx_bshape_0_top_grid_dims)) __pyx_t_1 = 0; - if (unlikely(__pyx_t_1 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_1); - {__pyx_filename = __pyx_f[9]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - (((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->top_grid_dims[0]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_top_grid_dims.buf, __pyx_t_3, __pyx_bstride_0_top_grid_dims)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":117 - * - * self.top_grid_dims[0] = top_grid_dims[0] - * self.top_grid_dims[1] = top_grid_dims[1] # <<<<<<<<<<<<<< - * - * # This wouldn't be necessary if we did bitshifting... - */ - __pyx_t_4 = 1; - __pyx_t_1 = -1; - if (__pyx_t_4 < 0) { - __pyx_t_4 += __pyx_bshape_0_top_grid_dims; - if (unlikely(__pyx_t_4 < 0)) __pyx_t_1 = 0; - } else if (unlikely(__pyx_t_4 >= __pyx_bshape_0_top_grid_dims)) __pyx_t_1 = 0; - if (unlikely(__pyx_t_1 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_1); - {__pyx_filename = __pyx_f[9]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - (((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->top_grid_dims[1]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_top_grid_dims.buf, __pyx_t_4, __pyx_bstride_0_top_grid_dims)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":120 - * - * # This wouldn't be necessary if we did bitshifting... - * for i in range(80): # <<<<<<<<<<<<<< - * self.po2[i] = 2**i - * self.root_nodes = \ - */ - for (__pyx_t_1 = 0; __pyx_t_1 < 80; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":121 - * # This wouldn't be necessary if we did bitshifting... - * for i in range(80): - * self.po2[i] = 2**i # <<<<<<<<<<<<<< - * self.root_nodes = \ - * malloc(sizeof(QuadTreeNode **) * top_grid_dims[0]) - */ - (((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->po2[__pyx_v_i]) = __Pyx_pow_long(2, __pyx_v_i); - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":123 - * self.po2[i] = 2**i - * self.root_nodes = \ - * malloc(sizeof(QuadTreeNode **) * top_grid_dims[0]) # <<<<<<<<<<<<<< - * - * # We initialize our root values to 0.0. - */ - __pyx_t_5 = 0; - __pyx_t_1 = -1; - if (__pyx_t_5 < 0) { - __pyx_t_5 += __pyx_bshape_0_top_grid_dims; - if (unlikely(__pyx_t_5 < 0)) __pyx_t_1 = 0; - } else if (unlikely(__pyx_t_5 >= __pyx_bshape_0_top_grid_dims)) __pyx_t_1 = 0; - if (unlikely(__pyx_t_1 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_1); - {__pyx_filename = __pyx_f[9]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":122 - * for i in range(80): - * self.po2[i] = 2**i - * self.root_nodes = \ # <<<<<<<<<<<<<< - * malloc(sizeof(QuadTreeNode **) * top_grid_dims[0]) - * - */ - ((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->root_nodes = ((struct __pyx_t_2yt_9amr_utils_QuadTreeNode ***)malloc(((sizeof(struct __pyx_t_2yt_9amr_utils_QuadTreeNode **)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_top_grid_dims.buf, __pyx_t_5, __pyx_bstride_0_top_grid_dims))))); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":126 - * - * # We initialize our root values to 0.0. - * for i in range(top_grid_dims[0]): # <<<<<<<<<<<<<< - * pos[0] = i - * self.root_nodes[i] = \ - */ - __pyx_t_6 = 0; - __pyx_t_1 = -1; - if (__pyx_t_6 < 0) { - __pyx_t_6 += __pyx_bshape_0_top_grid_dims; - if (unlikely(__pyx_t_6 < 0)) __pyx_t_1 = 0; - } else if (unlikely(__pyx_t_6 >= __pyx_bshape_0_top_grid_dims)) __pyx_t_1 = 0; - if (unlikely(__pyx_t_1 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_1); - {__pyx_filename = __pyx_f[9]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_7 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_top_grid_dims.buf, __pyx_t_6, __pyx_bstride_0_top_grid_dims)); - for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_7; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":127 - * # We initialize our root values to 0.0. - * for i in range(top_grid_dims[0]): - * pos[0] = i # <<<<<<<<<<<<<< - * self.root_nodes[i] = \ - * malloc(sizeof(QuadTreeNode *) * top_grid_dims[1]) - */ - (__pyx_v_pos[0]) = __pyx_v_i; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":129 - * pos[0] = i - * self.root_nodes[i] = \ - * malloc(sizeof(QuadTreeNode *) * top_grid_dims[1]) # <<<<<<<<<<<<<< - * for j in range(top_grid_dims[1]): - * pos[1] = j - */ - __pyx_t_8 = 1; - __pyx_t_2 = -1; - if (__pyx_t_8 < 0) { - __pyx_t_8 += __pyx_bshape_0_top_grid_dims; - if (unlikely(__pyx_t_8 < 0)) __pyx_t_2 = 0; - } else if (unlikely(__pyx_t_8 >= __pyx_bshape_0_top_grid_dims)) __pyx_t_2 = 0; - if (unlikely(__pyx_t_2 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_2); - {__pyx_filename = __pyx_f[9]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":128 - * for i in range(top_grid_dims[0]): - * pos[0] = i - * self.root_nodes[i] = \ # <<<<<<<<<<<<<< - * malloc(sizeof(QuadTreeNode *) * top_grid_dims[1]) - * for j in range(top_grid_dims[1]): - */ - (((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->root_nodes[__pyx_v_i]) = ((struct __pyx_t_2yt_9amr_utils_QuadTreeNode **)malloc(((sizeof(struct __pyx_t_2yt_9amr_utils_QuadTreeNode *)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_top_grid_dims.buf, __pyx_t_8, __pyx_bstride_0_top_grid_dims))))); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":130 - * self.root_nodes[i] = \ - * malloc(sizeof(QuadTreeNode *) * top_grid_dims[1]) - * for j in range(top_grid_dims[1]): # <<<<<<<<<<<<<< - * pos[1] = j - * self.root_nodes[i][j] = QTN_initialize( - */ - __pyx_t_9 = 1; - __pyx_t_2 = -1; - if (__pyx_t_9 < 0) { - __pyx_t_9 += __pyx_bshape_0_top_grid_dims; - if (unlikely(__pyx_t_9 < 0)) __pyx_t_2 = 0; - } else if (unlikely(__pyx_t_9 >= __pyx_bshape_0_top_grid_dims)) __pyx_t_2 = 0; - if (unlikely(__pyx_t_2 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_2); - {__pyx_filename = __pyx_f[9]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_10 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_top_grid_dims.buf, __pyx_t_9, __pyx_bstride_0_top_grid_dims)); - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_10; __pyx_t_2+=1) { - __pyx_v_j = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":131 - * malloc(sizeof(QuadTreeNode *) * top_grid_dims[1]) - * for j in range(top_grid_dims[1]): - * pos[1] = j # <<<<<<<<<<<<<< - * self.root_nodes[i][j] = QTN_initialize( - * pos, nvals, vals, weight_val, 0) - */ - (__pyx_v_pos[1]) = __pyx_v_j; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":132 - * for j in range(top_grid_dims[1]): - * pos[1] = j - * self.root_nodes[i][j] = QTN_initialize( # <<<<<<<<<<<<<< - * pos, nvals, vals, weight_val, 0) - * - */ - ((((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->root_nodes[__pyx_v_i])[__pyx_v_j]) = __pyx_f_2yt_9amr_utils_QTN_initialize(__pyx_v_pos, __pyx_v_nvals, __pyx_v_vals, __pyx_v_weight_val, 0); - } - } - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_top_grid_dims); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.amr_utils.QuadTree.__cinit__"); - __pyx_r = -1; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_top_grid_dims); - __pyx_L2:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":135 - * pos, nvals, vals, weight_val, 0) - * - * cdef void add_to_position(self, # <<<<<<<<<<<<<< - * int level, np.int64_t pos[2], - * np.float64_t *val, - */ - -static void __pyx_f_2yt_9amr_utils_8QuadTree_add_to_position(struct __pyx_obj_2yt_9amr_utils_QuadTree *__pyx_v_self, int __pyx_v_level, __pyx_t_5numpy_int64_t *__pyx_v_pos, __pyx_t_5numpy_float64_t *__pyx_v_val, __pyx_t_5numpy_float64_t __pyx_v_weight_val) { - int __pyx_v_i; - int __pyx_v_j; - struct __pyx_t_2yt_9amr_utils_QuadTreeNode *__pyx_v_node; - __pyx_t_5numpy_int64_t __pyx_v_fac; - PyObject *__pyx_v_L; - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - Py_ssize_t __pyx_t_6; - __Pyx_RefNannySetupContext("add_to_position"); - __pyx_v_L = Py_None; __Pyx_INCREF(Py_None); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":141 - * cdef int i, j - * cdef QuadTreeNode *node - * node = self.find_on_root_level(pos, level) # <<<<<<<<<<<<<< - * cdef np.int64_t fac - * for L in range(level): - */ - __pyx_v_node = ((struct __pyx_vtabstruct_2yt_9amr_utils_QuadTree *)__pyx_v_self->__pyx_vtab)->find_on_root_level(__pyx_v_self, __pyx_v_pos, __pyx_v_level); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":143 - * node = self.find_on_root_level(pos, level) - * cdef np.int64_t fac - * for L in range(level): # <<<<<<<<<<<<<< - * if node.children[0][0] == NULL: - * QTN_refine(node) - */ - __pyx_t_2 = PyInt_FromLong(__pyx_v_level); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_builtin_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) { - __pyx_t_1 = 0; __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); - } else { - __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - for (;;) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break; - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++; - } else if (likely(PyTuple_CheckExact(__pyx_t_3))) { - if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++; - } else { - __pyx_t_2 = PyIter_Next(__pyx_t_3); - if (!__pyx_t_2) { - if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_DECREF(__pyx_v_L); - __pyx_v_L = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":144 - * cdef np.int64_t fac - * for L in range(level): - * if node.children[0][0] == NULL: # <<<<<<<<<<<<<< - * QTN_refine(node) - * # Maybe we should use bitwise operators? - */ - __pyx_t_4 = (((__pyx_v_node->children[0])[0]) == NULL); - if (__pyx_t_4) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":145 - * for L in range(level): - * if node.children[0][0] == NULL: - * QTN_refine(node) # <<<<<<<<<<<<<< - * # Maybe we should use bitwise operators? - * fac = self.po2[level - L - 1] - */ - __pyx_f_2yt_9amr_utils_QTN_refine(__pyx_v_node); - goto __pyx_L5; - } - __pyx_L5:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":147 - * QTN_refine(node) - * # Maybe we should use bitwise operators? - * fac = self.po2[level - L - 1] # <<<<<<<<<<<<<< - * i = (pos[0] >= fac*(2*node.pos[0]+1)) - * j = (pos[1] >= fac*(2*node.pos[1]+1)) - */ - __pyx_t_2 = PyInt_FromLong(__pyx_v_level); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyNumber_Subtract(__pyx_t_2, __pyx_v_L); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Subtract(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_fac = (__pyx_v_self->po2[__pyx_t_6]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":148 - * # Maybe we should use bitwise operators? - * fac = self.po2[level - L - 1] - * i = (pos[0] >= fac*(2*node.pos[0]+1)) # <<<<<<<<<<<<<< - * j = (pos[1] >= fac*(2*node.pos[1]+1)) - * node = node.children[i][j] - */ - __pyx_v_i = ((__pyx_v_pos[0]) >= (__pyx_v_fac * ((2 * (__pyx_v_node->pos[0])) + 1))); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":149 - * fac = self.po2[level - L - 1] - * i = (pos[0] >= fac*(2*node.pos[0]+1)) - * j = (pos[1] >= fac*(2*node.pos[1]+1)) # <<<<<<<<<<<<<< - * node = node.children[i][j] - * QTN_add_value(node, val, weight_val) - */ - __pyx_v_j = ((__pyx_v_pos[1]) >= (__pyx_v_fac * ((2 * (__pyx_v_node->pos[1])) + 1))); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":150 - * i = (pos[0] >= fac*(2*node.pos[0]+1)) - * j = (pos[1] >= fac*(2*node.pos[1]+1)) - * node = node.children[i][j] # <<<<<<<<<<<<<< - * QTN_add_value(node, val, weight_val) - * - */ - __pyx_v_node = ((__pyx_v_node->children[__pyx_v_i])[__pyx_v_j]); - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":151 - * j = (pos[1] >= fac*(2*node.pos[1]+1)) - * node = node.children[i][j] - * QTN_add_value(node, val, weight_val) # <<<<<<<<<<<<<< - * - * cdef QuadTreeNode *find_on_root_level(self, np.int64_t pos[2], int level): - */ - __pyx_f_2yt_9amr_utils_QTN_add_value(__pyx_v_node, __pyx_v_val, __pyx_v_weight_val); - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_WriteUnraisable("yt.amr_utils.QuadTree.add_to_position"); - __pyx_L0:; - __Pyx_DECREF(__pyx_v_L); - __Pyx_RefNannyFinishContext(); -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":153 - * QTN_add_value(node, val, weight_val) - * - * cdef QuadTreeNode *find_on_root_level(self, np.int64_t pos[2], int level): # <<<<<<<<<<<<<< - * # We need this because the root level won't just have four children - * # So we find on the root level, then we traverse the tree. - */ - -static struct __pyx_t_2yt_9amr_utils_QuadTreeNode *__pyx_f_2yt_9amr_utils_8QuadTree_find_on_root_level(struct __pyx_obj_2yt_9amr_utils_QuadTree *__pyx_v_self, __pyx_t_5numpy_int64_t *__pyx_v_pos, int __pyx_v_level) { - __pyx_t_5numpy_int64_t __pyx_v_i; - __pyx_t_5numpy_int64_t __pyx_v_j; - struct __pyx_t_2yt_9amr_utils_QuadTreeNode *__pyx_r; - __pyx_t_5numpy_int64_t __pyx_t_1; - __pyx_t_5numpy_int64_t __pyx_t_2; - __Pyx_RefNannySetupContext("find_on_root_level"); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":157 - * # So we find on the root level, then we traverse the tree. - * cdef np.int64_t i, j - * i = (pos[0] / self.po2[level]) # <<<<<<<<<<<<<< - * j = (pos[1] / self.po2[level]) - * return self.root_nodes[i][j] - */ - __pyx_t_1 = (__pyx_v_pos[0]); - __pyx_t_2 = (__pyx_v_self->po2[__pyx_v_level]); - if (unlikely(__pyx_t_2 == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - {__pyx_filename = __pyx_f[9]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - else if (sizeof(__pyx_t_5numpy_int64_t) == sizeof(long) && unlikely(__pyx_t_2 == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_1))) { - PyErr_Format(PyExc_OverflowError, "value too large to perform division"); - {__pyx_filename = __pyx_f[9]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_i = __Pyx_div___pyx_t_5numpy_int64_t(__pyx_t_1, __pyx_t_2); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":158 - * cdef np.int64_t i, j - * i = (pos[0] / self.po2[level]) - * j = (pos[1] / self.po2[level]) # <<<<<<<<<<<<<< - * return self.root_nodes[i][j] - * - */ - __pyx_t_2 = (__pyx_v_pos[1]); - __pyx_t_1 = (__pyx_v_self->po2[__pyx_v_level]); - if (unlikely(__pyx_t_1 == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - {__pyx_filename = __pyx_f[9]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - else if (sizeof(__pyx_t_5numpy_int64_t) == sizeof(long) && unlikely(__pyx_t_1 == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_2))) { - PyErr_Format(PyExc_OverflowError, "value too large to perform division"); - {__pyx_filename = __pyx_f[9]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_j = __Pyx_div___pyx_t_5numpy_int64_t(__pyx_t_2, __pyx_t_1); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":159 - * i = (pos[0] / self.po2[level]) - * j = (pos[1] / self.po2[level]) - * return self.root_nodes[i][j] # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = ((__pyx_v_self->root_nodes[__pyx_v_i])[__pyx_v_j]); - goto __pyx_L0; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_WriteUnraisable("yt.amr_utils.QuadTree.find_on_root_level"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":164 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * def add_array_to_tree(self, int level, # <<<<<<<<<<<<<< - * np.ndarray[np.int64_t, ndim=1] pxs, - * np.ndarray[np.int64_t, ndim=1] pys, - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_8QuadTree_add_array_to_tree(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_8QuadTree_add_array_to_tree(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_level; - PyArrayObject *__pyx_v_pxs = 0; - PyArrayObject *__pyx_v_pys = 0; - PyArrayObject *__pyx_v_pvals = 0; - PyArrayObject *__pyx_v_pweight_vals = 0; - int __pyx_v_np; - int __pyx_v_p; - __pyx_t_5numpy_float64_t *__pyx_v_vals; - __pyx_t_5numpy_float64_t *__pyx_v_data; - __pyx_t_5numpy_int64_t __pyx_v_pos[2]; - Py_buffer __pyx_bstruct_pweight_vals; - Py_ssize_t __pyx_bstride_0_pweight_vals = 0; - Py_ssize_t __pyx_bshape_0_pweight_vals = 0; - Py_buffer __pyx_bstruct_pxs; - Py_ssize_t __pyx_bstride_0_pxs = 0; - Py_ssize_t __pyx_bshape_0_pxs = 0; - Py_buffer __pyx_bstruct_pvals; - Py_ssize_t __pyx_bstride_0_pvals = 0; - Py_ssize_t __pyx_bstride_1_pvals = 0; - Py_ssize_t __pyx_bshape_0_pvals = 0; - Py_ssize_t __pyx_bshape_1_pvals = 0; - Py_buffer __pyx_bstruct_pys; - Py_ssize_t __pyx_bstride_0_pys = 0; - Py_ssize_t __pyx_bshape_0_pys = 0; - PyObject *__pyx_r = NULL; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__level,&__pyx_n_s__pxs,&__pyx_n_s__pys,&__pyx_n_s__pvals,&__pyx_n_s__pweight_vals,0}; - __Pyx_RefNannySetupContext("add_array_to_tree"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[5] = {0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__level); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pxs); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("add_array_to_tree", 1, 5, 5, 1); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pys); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("add_array_to_tree", 1, 5, 5, 2); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pvals); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("add_array_to_tree", 1, 5, 5, 3); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pweight_vals); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("add_array_to_tree", 1, 5, 5, 4); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "add_array_to_tree") < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_level = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_pxs = ((PyArrayObject *)values[1]); - __pyx_v_pys = ((PyArrayObject *)values[2]); - __pyx_v_pvals = ((PyArrayObject *)values[3]); - __pyx_v_pweight_vals = ((PyArrayObject *)values[4]); - } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_level = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_pxs = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_pys = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_pvals = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); - __pyx_v_pweight_vals = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("add_array_to_tree", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.QuadTree.add_array_to_tree"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_pxs.buf = NULL; - __pyx_bstruct_pys.buf = NULL; - __pyx_bstruct_pvals.buf = NULL; - __pyx_bstruct_pweight_vals.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pxs), __pyx_ptype_5numpy_ndarray, 1, "pxs", 0))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pys), __pyx_ptype_5numpy_ndarray, 1, "pys", 0))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pvals), __pyx_ptype_5numpy_ndarray, 1, "pvals", 0))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pweight_vals), __pyx_ptype_5numpy_ndarray, 1, "pweight_vals", 0))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_pxs, (PyObject*)__pyx_v_pxs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_pxs = __pyx_bstruct_pxs.strides[0]; - __pyx_bshape_0_pxs = __pyx_bstruct_pxs.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_pys, (PyObject*)__pyx_v_pys, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_pys = __pyx_bstruct_pys.strides[0]; - __pyx_bshape_0_pys = __pyx_bstruct_pys.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_pvals, (PyObject*)__pyx_v_pvals, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_pvals = __pyx_bstruct_pvals.strides[0]; __pyx_bstride_1_pvals = __pyx_bstruct_pvals.strides[1]; - __pyx_bshape_0_pvals = __pyx_bstruct_pvals.shape[0]; __pyx_bshape_1_pvals = __pyx_bstruct_pvals.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_pweight_vals, (PyObject*)__pyx_v_pweight_vals, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_pweight_vals = __pyx_bstruct_pweight_vals.strides[0]; - __pyx_bshape_0_pweight_vals = __pyx_bstruct_pweight_vals.shape[0]; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":169 - * np.ndarray[np.float64_t, ndim=2] pvals, - * np.ndarray[np.float64_t, ndim=1] pweight_vals): - * cdef int np = pxs.shape[0] # <<<<<<<<<<<<<< - * cdef int p - * cdef cnp.float64_t *vals - */ - __pyx_v_np = (__pyx_v_pxs->dimensions[0]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":172 - * cdef int p - * cdef cnp.float64_t *vals - * cdef cnp.float64_t *data = pvals.data # <<<<<<<<<<<<<< - * cdef cnp.int64_t pos[2] - * for p in range(np): - */ - __pyx_v_data = ((__pyx_t_5numpy_float64_t *)__pyx_v_pvals->data); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":174 - * cdef cnp.float64_t *data = pvals.data - * cdef cnp.int64_t pos[2] - * for p in range(np): # <<<<<<<<<<<<<< - * vals = data + self.nvals*p - * pos[0] = pxs[p] - */ - __pyx_t_1 = __pyx_v_np; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_p = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":175 - * cdef cnp.int64_t pos[2] - * for p in range(np): - * vals = data + self.nvals*p # <<<<<<<<<<<<<< - * pos[0] = pxs[p] - * pos[1] = pys[p] - */ - __pyx_v_vals = (__pyx_v_data + (((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->nvals * __pyx_v_p)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":176 - * for p in range(np): - * vals = data + self.nvals*p - * pos[0] = pxs[p] # <<<<<<<<<<<<<< - * pos[1] = pys[p] - * self.add_to_position(level, pos, vals, pweight_vals[p]) - */ - __pyx_t_3 = __pyx_v_p; - (__pyx_v_pos[0]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_pxs.buf, __pyx_t_3, __pyx_bstride_0_pxs)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":177 - * vals = data + self.nvals*p - * pos[0] = pxs[p] - * pos[1] = pys[p] # <<<<<<<<<<<<<< - * self.add_to_position(level, pos, vals, pweight_vals[p]) - * - */ - __pyx_t_4 = __pyx_v_p; - (__pyx_v_pos[1]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_pys.buf, __pyx_t_4, __pyx_bstride_0_pys)); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":178 - * pos[0] = pxs[p] - * pos[1] = pys[p] - * self.add_to_position(level, pos, vals, pweight_vals[p]) # <<<<<<<<<<<<<< - * - * def add_grid_to_tree(self, int level, - */ - __pyx_t_5 = __pyx_v_p; - ((struct __pyx_vtabstruct_2yt_9amr_utils_QuadTree *)((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->__pyx_vtab)->add_to_position(((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self), __pyx_v_level, __pyx_v_pos, __pyx_v_vals, (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_pweight_vals.buf, __pyx_t_5, __pyx_bstride_0_pweight_vals))); - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_pweight_vals); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_pxs); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_pvals); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_pys); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.amr_utils.QuadTree.add_array_to_tree"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_pweight_vals); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_pxs); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_pvals); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_pys); - __pyx_L2:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":180 - * self.add_to_position(level, pos, vals, pweight_vals[p]) - * - * def add_grid_to_tree(self, int level, # <<<<<<<<<<<<<< - * np.ndarray[np.int64_t, ndim=1] start_index, - * np.ndarray[np.float64_t, ndim=2] pvals, - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_8QuadTree_add_grid_to_tree(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_8QuadTree_add_grid_to_tree(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_level; - PyArrayObject *__pyx_v_start_index = 0; - PyArrayObject *__pyx_v_pvals = 0; - PyArrayObject *__pyx_v_wvals = 0; - PyArrayObject *__pyx_v_cm = 0; - Py_buffer __pyx_bstruct_cm; - Py_ssize_t __pyx_bstride_0_cm = 0; - Py_ssize_t __pyx_bstride_1_cm = 0; - Py_ssize_t __pyx_bshape_0_cm = 0; - Py_ssize_t __pyx_bshape_1_cm = 0; - Py_buffer __pyx_bstruct_pvals; - Py_ssize_t __pyx_bstride_0_pvals = 0; - Py_ssize_t __pyx_bstride_1_pvals = 0; - Py_ssize_t __pyx_bshape_0_pvals = 0; - Py_ssize_t __pyx_bshape_1_pvals = 0; - Py_buffer __pyx_bstruct_wvals; - Py_ssize_t __pyx_bstride_0_wvals = 0; - Py_ssize_t __pyx_bstride_1_wvals = 0; - Py_ssize_t __pyx_bshape_0_wvals = 0; - Py_ssize_t __pyx_bshape_1_wvals = 0; - Py_buffer __pyx_bstruct_start_index; - Py_ssize_t __pyx_bstride_0_start_index = 0; - Py_ssize_t __pyx_bshape_0_start_index = 0; - PyObject *__pyx_r = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__level,&__pyx_n_s__start_index,&__pyx_n_s__pvals,&__pyx_n_s__wvals,&__pyx_n_s__cm,0}; - __Pyx_RefNannySetupContext("add_grid_to_tree"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[5] = {0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__level); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start_index); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("add_grid_to_tree", 1, 5, 5, 1); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pvals); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("add_grid_to_tree", 1, 5, 5, 2); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__wvals); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("add_grid_to_tree", 1, 5, 5, 3); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__cm); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("add_grid_to_tree", 1, 5, 5, 4); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "add_grid_to_tree") < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_level = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_start_index = ((PyArrayObject *)values[1]); - __pyx_v_pvals = ((PyArrayObject *)values[2]); - __pyx_v_wvals = ((PyArrayObject *)values[3]); - __pyx_v_cm = ((PyArrayObject *)values[4]); - } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_level = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_start_index = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_pvals = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_wvals = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); - __pyx_v_cm = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("add_grid_to_tree", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.QuadTree.add_grid_to_tree"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_start_index.buf = NULL; - __pyx_bstruct_pvals.buf = NULL; - __pyx_bstruct_wvals.buf = NULL; - __pyx_bstruct_cm.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_start_index), __pyx_ptype_5numpy_ndarray, 1, "start_index", 0))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pvals), __pyx_ptype_5numpy_ndarray, 1, "pvals", 0))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_wvals), __pyx_ptype_5numpy_ndarray, 1, "wvals", 0))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_cm), __pyx_ptype_5numpy_ndarray, 1, "cm", 0))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_start_index, (PyObject*)__pyx_v_start_index, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_start_index = __pyx_bstruct_start_index.strides[0]; - __pyx_bshape_0_start_index = __pyx_bstruct_start_index.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_pvals, (PyObject*)__pyx_v_pvals, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_pvals = __pyx_bstruct_pvals.strides[0]; __pyx_bstride_1_pvals = __pyx_bstruct_pvals.strides[1]; - __pyx_bshape_0_pvals = __pyx_bstruct_pvals.shape[0]; __pyx_bshape_1_pvals = __pyx_bstruct_pvals.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_wvals, (PyObject*)__pyx_v_wvals, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_wvals = __pyx_bstruct_wvals.strides[0]; __pyx_bstride_1_wvals = __pyx_bstruct_wvals.strides[1]; - __pyx_bshape_0_wvals = __pyx_bstruct_wvals.shape[0]; __pyx_bshape_1_wvals = __pyx_bstruct_wvals.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_cm, (PyObject*)__pyx_v_cm, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_cm = __pyx_bstruct_cm.strides[0]; __pyx_bstride_1_cm = __pyx_bstruct_cm.strides[1]; - __pyx_bshape_0_cm = __pyx_bstruct_cm.shape[0]; __pyx_bshape_1_cm = __pyx_bstruct_cm.shape[1]; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cm); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_pvals); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_wvals); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_start_index); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.amr_utils.QuadTree.add_grid_to_tree"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cm); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_pvals); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_wvals); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_start_index); - __pyx_L2:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":189 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * def get_all_from_level(self, int level, int count_only = 0): # <<<<<<<<<<<<<< - * cdef int i, j - * cdef int total = 0 - */ - -static PyObject *__pyx_pf_2yt_9amr_utils_8QuadTree_get_all_from_level(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_2yt_9amr_utils_8QuadTree_get_all_from_level(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_level; - int __pyx_v_count_only; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_total; - PyObject *__pyx_v_vals; - PyArrayObject *__pyx_v_npos; - PyArrayObject *__pyx_v_nvals; - PyArrayObject *__pyx_v_nwvals; - __pyx_t_5numpy_int64_t __pyx_v_curpos; - __pyx_t_5numpy_int64_t *__pyx_v_pdata; - __pyx_t_5numpy_float64_t *__pyx_v_vdata; - __pyx_t_5numpy_float64_t *__pyx_v_wdata; - Py_buffer __pyx_bstruct_nwvals; - Py_ssize_t __pyx_bstride_0_nwvals = 0; - Py_ssize_t __pyx_bshape_0_nwvals = 0; - Py_buffer __pyx_bstruct_nvals; - Py_ssize_t __pyx_bstride_0_nvals = 0; - Py_ssize_t __pyx_bstride_1_nvals = 0; - Py_ssize_t __pyx_bshape_0_nvals = 0; - Py_ssize_t __pyx_bshape_1_nvals = 0; - Py_buffer __pyx_bstruct_npos; - Py_ssize_t __pyx_bstride_0_npos = 0; - Py_ssize_t __pyx_bstride_1_npos = 0; - Py_ssize_t __pyx_bshape_0_npos = 0; - Py_ssize_t __pyx_bshape_1_npos = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __pyx_t_5numpy_int64_t __pyx_t_2; - int __pyx_t_3; - __pyx_t_5numpy_int64_t __pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyArrayObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - PyArrayObject *__pyx_t_13 = NULL; - PyArrayObject *__pyx_t_14 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__level,&__pyx_n_s__count_only,0}; - __Pyx_RefNannySetupContext("get_all_from_level"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__level); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (kw_args > 1) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__count_only); - if (unlikely(value)) { values[1] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "get_all_from_level") < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_level = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - if (values[1]) { - __pyx_v_count_only = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_count_only == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_count_only = ((int)0); - } - } else { - __pyx_v_count_only = ((int)0); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: __pyx_v_count_only = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_count_only == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 1: __pyx_v_level = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - break; - default: goto __pyx_L5_argtuple_error; - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("get_all_from_level", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.amr_utils.QuadTree.get_all_from_level"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_v_vals = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_npos = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_nvals = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_nwvals = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_bstruct_npos.buf = NULL; - __pyx_bstruct_nvals.buf = NULL; - __pyx_bstruct_nwvals.buf = NULL; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":191 - * def get_all_from_level(self, int level, int count_only = 0): - * cdef int i, j - * cdef int total = 0 # <<<<<<<<<<<<<< - * vals = [] - * for i in range(self.top_grid_dims[0]): - */ - __pyx_v_total = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":192 - * cdef int i, j - * cdef int total = 0 - * vals = [] # <<<<<<<<<<<<<< - * for i in range(self.top_grid_dims[0]): - * for j in range(self.top_grid_dims[1]): - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(((PyObject *)__pyx_v_vals)); - __pyx_v_vals = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":193 - * cdef int total = 0 - * vals = [] - * for i in range(self.top_grid_dims[0]): # <<<<<<<<<<<<<< - * for j in range(self.top_grid_dims[1]): - * total += self.count_at_level(self.root_nodes[i][j], level) - */ - __pyx_t_2 = (((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->top_grid_dims[0]); - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":194 - * vals = [] - * for i in range(self.top_grid_dims[0]): - * for j in range(self.top_grid_dims[1]): # <<<<<<<<<<<<<< - * total += self.count_at_level(self.root_nodes[i][j], level) - * if count_only: return total - */ - __pyx_t_4 = (((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->top_grid_dims[1]); - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_j = __pyx_t_5; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":195 - * for i in range(self.top_grid_dims[0]): - * for j in range(self.top_grid_dims[1]): - * total += self.count_at_level(self.root_nodes[i][j], level) # <<<<<<<<<<<<<< - * if count_only: return total - * # Allocate our array - */ - __pyx_v_total += ((struct __pyx_vtabstruct_2yt_9amr_utils_QuadTree *)((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->__pyx_vtab)->count_at_level(((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self), ((((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->root_nodes[__pyx_v_i])[__pyx_v_j]), __pyx_v_level); - } - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":196 - * for j in range(self.top_grid_dims[1]): - * total += self.count_at_level(self.root_nodes[i][j], level) - * if count_only: return total # <<<<<<<<<<<<<< - * # Allocate our array - * cdef np.ndarray[np.int64_t, ndim=2] npos - */ - if (__pyx_v_count_only) { - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(__pyx_v_total); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - goto __pyx_L10; - } - __pyx_L10:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":201 - * cdef np.ndarray[np.float64_t, ndim=2] nvals - * cdef np.ndarray[np.float64_t, ndim=1] nwvals - * npos = np.zeros( (total, 2), dtype='int64') # <<<<<<<<<<<<<< - * nvals = np.zeros( (total, self.nvals), dtype='float64') - * nwvals = np.zeros( total, dtype='float64') - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(__pyx_v_total); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(__pyx_int_2); - PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_int_2); - __Pyx_GIVEREF(__pyx_int_2); - __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_7)); - if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__int64)) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = PyEval_CallObjectWithKeywords(__pyx_t_6, __pyx_t_1, ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_9 = ((PyArrayObject *)__pyx_t_8); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_npos); - __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_npos, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); - if (unlikely(__pyx_t_3 < 0)) { - PyErr_Fetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_npos, (PyObject*)__pyx_v_npos, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_10, __pyx_t_11, __pyx_t_12); - } - } - __pyx_bstride_0_npos = __pyx_bstruct_npos.strides[0]; __pyx_bstride_1_npos = __pyx_bstruct_npos.strides[1]; - __pyx_bshape_0_npos = __pyx_bstruct_npos.shape[0]; __pyx_bshape_1_npos = __pyx_bstruct_npos.shape[1]; - if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_9 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_npos)); - __pyx_v_npos = ((PyArrayObject *)__pyx_t_8); - __pyx_t_8 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":202 - * cdef np.ndarray[np.float64_t, ndim=1] nwvals - * npos = np.zeros( (total, 2), dtype='int64') - * nvals = np.zeros( (total, self.nvals), dtype='float64') # <<<<<<<<<<<<<< - * nwvals = np.zeros( total, dtype='float64') - * cdef np.int64_t curpos = 0 - */ - __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__zeros); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyInt_FromLong(__pyx_v_total); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->nvals); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_8 = 0; - __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = PyEval_CallObjectWithKeywords(__pyx_t_7, __pyx_t_1, ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_13 = ((PyArrayObject *)__pyx_t_8); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_nvals); - __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_nvals, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); - if (unlikely(__pyx_t_3 < 0)) { - PyErr_Fetch(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_nvals, (PyObject*)__pyx_v_nvals, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_12, __pyx_t_11, __pyx_t_10); - } - } - __pyx_bstride_0_nvals = __pyx_bstruct_nvals.strides[0]; __pyx_bstride_1_nvals = __pyx_bstruct_nvals.strides[1]; - __pyx_bshape_0_nvals = __pyx_bstruct_nvals.shape[0]; __pyx_bshape_1_nvals = __pyx_bstruct_nvals.shape[1]; - if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_13 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_nvals)); - __pyx_v_nvals = ((PyArrayObject *)__pyx_t_8); - __pyx_t_8 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":203 - * npos = np.zeros( (total, 2), dtype='int64') - * nvals = np.zeros( (total, self.nvals), dtype='float64') - * nwvals = np.zeros( total, dtype='float64') # <<<<<<<<<<<<<< - * cdef np.int64_t curpos = 0 - * cdef np.int64_t *pdata = npos.data - */ - __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__zeros); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyInt_FromLong(__pyx_v_total); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_8)); - if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = PyEval_CallObjectWithKeywords(__pyx_t_6, __pyx_t_1, ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_14 = ((PyArrayObject *)__pyx_t_7); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_nwvals); - __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_nwvals, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_3 < 0)) { - PyErr_Fetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_nwvals, (PyObject*)__pyx_v_nwvals, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_10, __pyx_t_11, __pyx_t_12); - } - } - __pyx_bstride_0_nwvals = __pyx_bstruct_nwvals.strides[0]; - __pyx_bshape_0_nwvals = __pyx_bstruct_nwvals.shape[0]; - if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_14 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_nwvals)); - __pyx_v_nwvals = ((PyArrayObject *)__pyx_t_7); - __pyx_t_7 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":204 - * nvals = np.zeros( (total, self.nvals), dtype='float64') - * nwvals = np.zeros( total, dtype='float64') - * cdef np.int64_t curpos = 0 # <<<<<<<<<<<<<< - * cdef np.int64_t *pdata = npos.data - * cdef np.float64_t *vdata = nvals.data - */ - __pyx_v_curpos = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":205 - * nwvals = np.zeros( total, dtype='float64') - * cdef np.int64_t curpos = 0 - * cdef np.int64_t *pdata = npos.data # <<<<<<<<<<<<<< - * cdef np.float64_t *vdata = nvals.data - * cdef np.float64_t *wdata = nwvals.data - */ - __pyx_v_pdata = ((__pyx_t_5numpy_int64_t *)__pyx_v_npos->data); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":206 - * cdef np.int64_t curpos = 0 - * cdef np.int64_t *pdata = npos.data - * cdef np.float64_t *vdata = nvals.data # <<<<<<<<<<<<<< - * cdef np.float64_t *wdata = nwvals.data - * for i in range(self.top_grid_dims[0]): - */ - __pyx_v_vdata = ((__pyx_t_5numpy_float64_t *)__pyx_v_nvals->data); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":207 - * cdef np.int64_t *pdata = npos.data - * cdef np.float64_t *vdata = nvals.data - * cdef np.float64_t *wdata = nwvals.data # <<<<<<<<<<<<<< - * for i in range(self.top_grid_dims[0]): - * for j in range(self.top_grid_dims[1]): - */ - __pyx_v_wdata = ((__pyx_t_5numpy_float64_t *)__pyx_v_nwvals->data); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":208 - * cdef np.float64_t *vdata = nvals.data - * cdef np.float64_t *wdata = nwvals.data - * for i in range(self.top_grid_dims[0]): # <<<<<<<<<<<<<< - * for j in range(self.top_grid_dims[1]): - * curpos += self.fill_from_level(self.root_nodes[i][j], - */ - __pyx_t_2 = (((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->top_grid_dims[0]); - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":209 - * cdef np.float64_t *wdata = nwvals.data - * for i in range(self.top_grid_dims[0]): - * for j in range(self.top_grid_dims[1]): # <<<<<<<<<<<<<< - * curpos += self.fill_from_level(self.root_nodes[i][j], - * level, curpos, pdata, vdata, wdata) - */ - __pyx_t_4 = (((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->top_grid_dims[1]); - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_j = __pyx_t_5; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":211 - * for j in range(self.top_grid_dims[1]): - * curpos += self.fill_from_level(self.root_nodes[i][j], - * level, curpos, pdata, vdata, wdata) # <<<<<<<<<<<<<< - * return npos, nvals, nwvals - * - */ - __pyx_v_curpos += ((struct __pyx_vtabstruct_2yt_9amr_utils_QuadTree *)((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->__pyx_vtab)->fill_from_level(((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self), ((((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->root_nodes[__pyx_v_i])[__pyx_v_j]), __pyx_v_level, __pyx_v_curpos, __pyx_v_pdata, __pyx_v_vdata, __pyx_v_wdata); - } - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":212 - * curpos += self.fill_from_level(self.root_nodes[i][j], - * level, curpos, pdata, vdata, wdata) - * return npos, nvals, nwvals # <<<<<<<<<<<<<< - * - * cdef int count_at_level(self, QuadTreeNode *node, int level): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_INCREF(((PyObject *)__pyx_v_npos)); - PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_npos)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_npos)); - __Pyx_INCREF(((PyObject *)__pyx_v_nvals)); - PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_v_nvals)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_nvals)); - __Pyx_INCREF(((PyObject *)__pyx_v_nwvals)); - PyTuple_SET_ITEM(__pyx_t_7, 2, ((PyObject *)__pyx_v_nwvals)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_nwvals)); - __pyx_r = __pyx_t_7; - __pyx_t_7 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_nwvals); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_nvals); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_npos); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.amr_utils.QuadTree.get_all_from_level"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_nwvals); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_nvals); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_npos); - __pyx_L2:; - __Pyx_DECREF(__pyx_v_vals); - __Pyx_DECREF((PyObject *)__pyx_v_npos); - __Pyx_DECREF((PyObject *)__pyx_v_nvals); - __Pyx_DECREF((PyObject *)__pyx_v_nwvals); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":214 - * return npos, nvals, nwvals - * - * cdef int count_at_level(self, QuadTreeNode *node, int level): # <<<<<<<<<<<<<< - * cdef int i, j - * # We only really return a non-zero, calculated value if we are at the - */ - -static int __pyx_f_2yt_9amr_utils_8QuadTree_count_at_level(struct __pyx_obj_2yt_9amr_utils_QuadTree *__pyx_v_self, struct __pyx_t_2yt_9amr_utils_QuadTreeNode *__pyx_v_node, int __pyx_v_level) { - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_count; - int __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - __Pyx_RefNannySetupContext("count_at_level"); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":218 - * # We only really return a non-zero, calculated value if we are at the - * # level in question. - * if node.level == level: # <<<<<<<<<<<<<< - * # We return 1 if there are no finer points at this level and zero - * # if there are - */ - __pyx_t_1 = (__pyx_v_node->level == __pyx_v_level); - if (__pyx_t_1) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":221 - * # We return 1 if there are no finer points at this level and zero - * # if there are - * return (node.children[0][0] == NULL) # <<<<<<<<<<<<<< - * if node.children[0][0] == NULL: return 0 - * cdef int count = 0 - */ - __pyx_r = (((__pyx_v_node->children[0])[0]) == NULL); - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":222 - * # if there are - * return (node.children[0][0] == NULL) - * if node.children[0][0] == NULL: return 0 # <<<<<<<<<<<<<< - * cdef int count = 0 - * for i in range(2): - */ - __pyx_t_1 = (((__pyx_v_node->children[0])[0]) == NULL); - if (__pyx_t_1) { - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L4; - } - __pyx_L4:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":223 - * return (node.children[0][0] == NULL) - * if node.children[0][0] == NULL: return 0 - * cdef int count = 0 # <<<<<<<<<<<<<< - * for i in range(2): - * for j in range(2): - */ - __pyx_v_count = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":224 - * if node.children[0][0] == NULL: return 0 - * cdef int count = 0 - * for i in range(2): # <<<<<<<<<<<<<< - * for j in range(2): - * count += self.count_at_level(node.children[i][j], level) - */ - for (__pyx_t_2 = 0; __pyx_t_2 < 2; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":225 - * cdef int count = 0 - * for i in range(2): - * for j in range(2): # <<<<<<<<<<<<<< - * count += self.count_at_level(node.children[i][j], level) - * return count - */ - for (__pyx_t_3 = 0; __pyx_t_3 < 2; __pyx_t_3+=1) { - __pyx_v_j = __pyx_t_3; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":226 - * for i in range(2): - * for j in range(2): - * count += self.count_at_level(node.children[i][j], level) # <<<<<<<<<<<<<< - * return count - * - */ - __pyx_v_count += ((struct __pyx_vtabstruct_2yt_9amr_utils_QuadTree *)__pyx_v_self->__pyx_vtab)->count_at_level(__pyx_v_self, ((__pyx_v_node->children[__pyx_v_i])[__pyx_v_j]), __pyx_v_level); - } - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":227 - * for j in range(2): - * count += self.count_at_level(node.children[i][j], level) - * return count # <<<<<<<<<<<<<< - * - * cdef int fill_from_level(self, QuadTreeNode *node, int level, - */ - __pyx_r = __pyx_v_count; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":229 - * return count - * - * cdef int fill_from_level(self, QuadTreeNode *node, int level, # <<<<<<<<<<<<<< - * np.int64_t curpos, - * np.int64_t *pdata, - */ - -static int __pyx_f_2yt_9amr_utils_8QuadTree_fill_from_level(struct __pyx_obj_2yt_9amr_utils_QuadTree *__pyx_v_self, struct __pyx_t_2yt_9amr_utils_QuadTreeNode *__pyx_v_node, int __pyx_v_level, __pyx_t_5numpy_int64_t __pyx_v_curpos, __pyx_t_5numpy_int64_t *__pyx_v_pdata, __pyx_t_5numpy_float64_t *__pyx_v_vdata, __pyx_t_5numpy_float64_t *__pyx_v_wdata) { - int __pyx_v_i; - int __pyx_v_j; - __pyx_t_5numpy_int64_t __pyx_v_added; - int __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - __Pyx_RefNannySetupContext("fill_from_level"); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":235 - * np.float64_t *wdata): - * cdef int i, j - * if node.level == level: # <<<<<<<<<<<<<< - * if node.children[0][0] != NULL: return 0 - * for i in range(self.nvals): - */ - __pyx_t_1 = (__pyx_v_node->level == __pyx_v_level); - if (__pyx_t_1) { - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":236 - * cdef int i, j - * if node.level == level: - * if node.children[0][0] != NULL: return 0 # <<<<<<<<<<<<<< - * for i in range(self.nvals): - * vdata[self.nvals * curpos + i] = node.val[i] - */ - __pyx_t_1 = (((__pyx_v_node->children[0])[0]) != NULL); - if (__pyx_t_1) { - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L4; - } - __pyx_L4:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":237 - * if node.level == level: - * if node.children[0][0] != NULL: return 0 - * for i in range(self.nvals): # <<<<<<<<<<<<<< - * vdata[self.nvals * curpos + i] = node.val[i] - * wdata[curpos] = node.weight_val - */ - __pyx_t_2 = __pyx_v_self->nvals; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":238 - * if node.children[0][0] != NULL: return 0 - * for i in range(self.nvals): - * vdata[self.nvals * curpos + i] = node.val[i] # <<<<<<<<<<<<<< - * wdata[curpos] = node.weight_val - * pdata[curpos * 2] = node.pos[0] - */ - (__pyx_v_vdata[((__pyx_v_self->nvals * __pyx_v_curpos) + __pyx_v_i)]) = (__pyx_v_node->val[__pyx_v_i]); - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":239 - * for i in range(self.nvals): - * vdata[self.nvals * curpos + i] = node.val[i] - * wdata[curpos] = node.weight_val # <<<<<<<<<<<<<< - * pdata[curpos * 2] = node.pos[0] - * pdata[curpos * 2 + 1] = node.pos[1] - */ - (__pyx_v_wdata[__pyx_v_curpos]) = __pyx_v_node->weight_val; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":240 - * vdata[self.nvals * curpos + i] = node.val[i] - * wdata[curpos] = node.weight_val - * pdata[curpos * 2] = node.pos[0] # <<<<<<<<<<<<<< - * pdata[curpos * 2 + 1] = node.pos[1] - * return 1 - */ - (__pyx_v_pdata[(__pyx_v_curpos * 2)]) = (__pyx_v_node->pos[0]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":241 - * wdata[curpos] = node.weight_val - * pdata[curpos * 2] = node.pos[0] - * pdata[curpos * 2 + 1] = node.pos[1] # <<<<<<<<<<<<<< - * return 1 - * if node.children[0][0] == NULL: return 0 - */ - (__pyx_v_pdata[((__pyx_v_curpos * 2) + 1)]) = (__pyx_v_node->pos[1]); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":242 - * pdata[curpos * 2] = node.pos[0] - * pdata[curpos * 2 + 1] = node.pos[1] - * return 1 # <<<<<<<<<<<<<< - * if node.children[0][0] == NULL: return 0 - * cdef np.int64_t added = 0 - */ - __pyx_r = 1; - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":243 - * pdata[curpos * 2 + 1] = node.pos[1] - * return 1 - * if node.children[0][0] == NULL: return 0 # <<<<<<<<<<<<<< - * cdef np.int64_t added = 0 - * for i in range(2): - */ - __pyx_t_1 = (((__pyx_v_node->children[0])[0]) == NULL); - if (__pyx_t_1) { - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L7; - } - __pyx_L7:; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":244 - * return 1 - * if node.children[0][0] == NULL: return 0 - * cdef np.int64_t added = 0 # <<<<<<<<<<<<<< - * for i in range(2): - * for j in range(2): - */ - __pyx_v_added = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":245 - * if node.children[0][0] == NULL: return 0 - * cdef np.int64_t added = 0 - * for i in range(2): # <<<<<<<<<<<<<< - * for j in range(2): - * added += self.fill_from_level(node.children[i][j], - */ - for (__pyx_t_2 = 0; __pyx_t_2 < 2; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":246 - * cdef np.int64_t added = 0 - * for i in range(2): - * for j in range(2): # <<<<<<<<<<<<<< - * added += self.fill_from_level(node.children[i][j], - * level, curpos + added, pdata, vdata, wdata) - */ - for (__pyx_t_3 = 0; __pyx_t_3 < 2; __pyx_t_3+=1) { - __pyx_v_j = __pyx_t_3; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":248 - * for j in range(2): - * added += self.fill_from_level(node.children[i][j], - * level, curpos + added, pdata, vdata, wdata) # <<<<<<<<<<<<<< - * return added - * - */ - __pyx_v_added += ((struct __pyx_vtabstruct_2yt_9amr_utils_QuadTree *)__pyx_v_self->__pyx_vtab)->fill_from_level(__pyx_v_self, ((__pyx_v_node->children[__pyx_v_i])[__pyx_v_j]), __pyx_v_level, (__pyx_v_curpos + __pyx_v_added), __pyx_v_pdata, __pyx_v_vdata, __pyx_v_wdata); - } - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":249 - * added += self.fill_from_level(node.children[i][j], - * level, curpos + added, pdata, vdata, wdata) - * return added # <<<<<<<<<<<<<< - * - * def __dealloc__(self): - */ - __pyx_r = __pyx_v_added; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":251 - * return added - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * cdef int i, j - * for i in range(self.top_grid_dims[0]): - */ - -static void __pyx_pf_2yt_9amr_utils_8QuadTree___dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pf_2yt_9amr_utils_8QuadTree___dealloc__(PyObject *__pyx_v_self) { - int __pyx_v_i; - int __pyx_v_j; - __pyx_t_5numpy_int64_t __pyx_t_1; - int __pyx_t_2; - __pyx_t_5numpy_int64_t __pyx_t_3; - int __pyx_t_4; - __Pyx_RefNannySetupContext("__dealloc__"); - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":253 - * def __dealloc__(self): - * cdef int i, j - * for i in range(self.top_grid_dims[0]): # <<<<<<<<<<<<<< - * for j in range(self.top_grid_dims[1]): - * QTN_free(self.root_nodes[i][j]) - */ - __pyx_t_1 = (((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->top_grid_dims[0]); - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":254 - * cdef int i, j - * for i in range(self.top_grid_dims[0]): - * for j in range(self.top_grid_dims[1]): # <<<<<<<<<<<<<< - * QTN_free(self.root_nodes[i][j]) - * free(self.root_nodes[i]) - */ - __pyx_t_3 = (((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->top_grid_dims[1]); - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_j = __pyx_t_4; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":255 - * for i in range(self.top_grid_dims[0]): - * for j in range(self.top_grid_dims[1]): - * QTN_free(self.root_nodes[i][j]) # <<<<<<<<<<<<<< - * free(self.root_nodes[i]) - * free(self.root_nodes) - */ - __pyx_f_2yt_9amr_utils_QTN_free(((((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->root_nodes[__pyx_v_i])[__pyx_v_j])); - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":256 - * for j in range(self.top_grid_dims[1]): - * QTN_free(self.root_nodes[i][j]) - * free(self.root_nodes[i]) # <<<<<<<<<<<<<< - * free(self.root_nodes) - */ - free((((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->root_nodes[__pyx_v_i])); - } - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":257 - * QTN_free(self.root_nodes[i][j]) - * free(self.root_nodes[i]) - * free(self.root_nodes) # <<<<<<<<<<<<<< - */ - free(((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->root_nodes); - - __Pyx_RefNannyFinishContext(); -} - -/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":188 - * # experimental exception made for __getbuffer__ and __releasebuffer__ - * # -- the details of this may change. - * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< - * # This implementation of getbuffer is geared towards Cython - * # requirements, and does not yet fullfill the PEP. - */ - -static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_v_copy_shape; - int __pyx_v_i; - int __pyx_v_ndim; - int __pyx_v_endian_detector; - int __pyx_v_little_endian; - int __pyx_v_t; - char *__pyx_v_f; - PyArray_Descr *__pyx_v_descr = 0; - int __pyx_v_offset; - int __pyx_v_hasfields; - int __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - char *__pyx_t_9; - __Pyx_RefNannySetupContext("__getbuffer__"); - if (__pyx_v_info == NULL) return 0; - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":194 - * # of flags - * cdef int copy_shape, i, ndim - * cdef int endian_detector = 1 # <<<<<<<<<<<<<< - * cdef bint little_endian = ((&endian_detector)[0] != 0) - * - */ - __pyx_v_endian_detector = 1; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":195 - * cdef int copy_shape, i, ndim - * cdef int endian_detector = 1 - * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< - * - * ndim = PyArray_NDIM(self) - */ - __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":197 - * cdef bint little_endian = ((&endian_detector)[0] != 0) - * - * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< - * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - */ - __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":199 - * ndim = PyArray_NDIM(self) - * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< - * copy_shape = 1 - * else: - */ - __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); - if (__pyx_t_1) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":200 - * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * copy_shape = 1 # <<<<<<<<<<<<<< - * else: - * copy_shape = 0 - */ - __pyx_v_copy_shape = 1; - goto __pyx_L5; - } - /*else*/ { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":202 - * copy_shape = 1 - * else: - * copy_shape = 0 # <<<<<<<<<<<<<< - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - */ - __pyx_v_copy_shape = 0; - } - __pyx_L5:; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":204 - * copy_shape = 0 - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError(u"ndarray is not C contiguous") - */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); - if (__pyx_t_1) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":205 - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< - * raise ValueError(u"ndarray is not C contiguous") - * - */ - __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); - __pyx_t_3 = __pyx_t_2; - } else { - __pyx_t_3 = __pyx_t_1; - } - if (__pyx_t_3) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":206 - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_7)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_7)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_7)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[10]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; - } - __pyx_L6:; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":208 - * raise ValueError(u"ndarray is not C contiguous") - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError(u"ndarray is not Fortran contiguous") - */ - __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); - if (__pyx_t_3) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":209 - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< - * raise ValueError(u"ndarray is not Fortran contiguous") - * - */ - __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); - __pyx_t_2 = __pyx_t_1; - } else { - __pyx_t_2 = __pyx_t_3; - } - if (__pyx_t_2) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":210 - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< - * - * info.buf = PyArray_DATA(self) - */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_8)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_8)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8)); - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[10]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; - } - __pyx_L7:; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":212 - * raise ValueError(u"ndarray is not Fortran contiguous") - * - * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< - * info.ndim = ndim - * if copy_shape: - */ - __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":213 - * - * info.buf = PyArray_DATA(self) - * info.ndim = ndim # <<<<<<<<<<<<<< - * if copy_shape: - * # Allocate new buffer for strides and shape info. This is allocated - */ - __pyx_v_info->ndim = __pyx_v_ndim; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":214 - * info.buf = PyArray_DATA(self) - * info.ndim = ndim - * if copy_shape: # <<<<<<<<<<<<<< - * # Allocate new buffer for strides and shape info. This is allocated - * # as one block, strides first. - */ - if (__pyx_v_copy_shape) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":217 - * # Allocate new buffer for strides and shape info. This is allocated - * # as one block, strides first. - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< - * info.shape = info.strides + ndim - * for i in range(ndim): - */ - __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2))); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":218 - * # as one block, strides first. - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) - * info.shape = info.strides + ndim # <<<<<<<<<<<<<< - * for i in range(ndim): - * info.strides[i] = PyArray_STRIDES(self)[i] - */ - __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":219 - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) - * info.shape = info.strides + ndim - * for i in range(ndim): # <<<<<<<<<<<<<< - * info.strides[i] = PyArray_STRIDES(self)[i] - * info.shape[i] = PyArray_DIMS(self)[i] - */ - __pyx_t_6 = __pyx_v_ndim; - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_i = __pyx_t_7; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":220 - * info.shape = info.strides + ndim - * for i in range(ndim): - * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< - * info.shape[i] = PyArray_DIMS(self)[i] - * else: - */ - (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":221 - * for i in range(ndim): - * info.strides[i] = PyArray_STRIDES(self)[i] - * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< - * else: - * info.strides = PyArray_STRIDES(self) - */ - (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); - } - goto __pyx_L8; - } - /*else*/ { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":223 - * info.shape[i] = PyArray_DIMS(self)[i] - * else: - * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< - * info.shape = PyArray_DIMS(self) - * info.suboffsets = NULL - */ - __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":224 - * else: - * info.strides = PyArray_STRIDES(self) - * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< - * info.suboffsets = NULL - * info.itemsize = PyArray_ITEMSIZE(self) - */ - __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); - } - __pyx_L8:; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":225 - * info.strides = PyArray_STRIDES(self) - * info.shape = PyArray_DIMS(self) - * info.suboffsets = NULL # <<<<<<<<<<<<<< - * info.itemsize = PyArray_ITEMSIZE(self) - * info.readonly = not PyArray_ISWRITEABLE(self) - */ - __pyx_v_info->suboffsets = NULL; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":226 - * info.shape = PyArray_DIMS(self) - * info.suboffsets = NULL - * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< - * info.readonly = not PyArray_ISWRITEABLE(self) - * - */ - __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":227 - * info.suboffsets = NULL - * info.itemsize = PyArray_ITEMSIZE(self) - * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< - * - * cdef int t - */ - __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":230 - * - * cdef int t - * cdef char* f = NULL # <<<<<<<<<<<<<< - * cdef dtype descr = self.descr - * cdef list stack - */ - __pyx_v_f = NULL; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":231 - * cdef int t - * cdef char* f = NULL - * cdef dtype descr = self.descr # <<<<<<<<<<<<<< - * cdef list stack - * cdef int offset - */ - __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); - __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":235 - * cdef int offset - * - * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< - * - * if not hasfields and not copy_shape: - */ - __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":237 - * cdef bint hasfields = PyDataType_HASFIELDS(descr) - * - * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< - * # do not call releasebuffer - * info.obj = None - */ - __pyx_t_2 = (!__pyx_v_hasfields); - if (__pyx_t_2) { - __pyx_t_3 = (!__pyx_v_copy_shape); - __pyx_t_1 = __pyx_t_3; - } else { - __pyx_t_1 = __pyx_t_2; - } - if (__pyx_t_1) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":239 - * if not hasfields and not copy_shape: - * # do not call releasebuffer - * info.obj = None # <<<<<<<<<<<<<< - * else: - * # need to call releasebuffer - */ - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = Py_None; - goto __pyx_L11; - } - /*else*/ { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":242 - * else: - * # need to call releasebuffer - * info.obj = self # <<<<<<<<<<<<<< - * - * if not hasfields: - */ - __Pyx_INCREF(__pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = __pyx_v_self; - } - __pyx_L11:; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":244 - * info.obj = self - * - * if not hasfields: # <<<<<<<<<<<<<< - * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or - */ - __pyx_t_1 = (!__pyx_v_hasfields); - if (__pyx_t_1) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":245 - * - * if not hasfields: - * t = descr.type_num # <<<<<<<<<<<<<< - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): - */ - __pyx_v_t = __pyx_v_descr->type_num; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":246 - * if not hasfields: - * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == '<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - */ - __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); - if (__pyx_t_1) { - __pyx_t_2 = __pyx_v_little_endian; - } else { - __pyx_t_2 = __pyx_t_1; - } - if (!__pyx_t_2) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":247 - * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< - * raise ValueError(u"Non-native byte order not supported") - * if t == NPY_BYTE: f = "b" - */ - __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); - if (__pyx_t_1) { - __pyx_t_3 = (!__pyx_v_little_endian); - __pyx_t_8 = __pyx_t_3; - } else { - __pyx_t_8 = __pyx_t_1; - } - __pyx_t_1 = __pyx_t_8; - } else { - __pyx_t_1 = __pyx_t_2; - } - if (__pyx_t_1) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":248 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< - * if t == NPY_BYTE: f = "b" - * elif t == NPY_UBYTE: f = "B" - */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_9)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_9)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_9)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[10]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L13; - } - __pyx_L13:; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":249 - * (descr.byteorder == '<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< - * elif t == NPY_UBYTE: f = "B" - * elif t == NPY_SHORT: f = "h" - */ - __pyx_t_1 = (__pyx_v_t == NPY_BYTE); - if (__pyx_t_1) { - __pyx_v_f = __pyx_k__b; - goto __pyx_L14; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":250 - * raise ValueError(u"Non-native byte order not supported") - * if t == NPY_BYTE: f = "b" - * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< - * elif t == NPY_SHORT: f = "h" - * elif t == NPY_USHORT: f = "H" - */ - __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); - if (__pyx_t_1) { - __pyx_v_f = __pyx_k__B; - goto __pyx_L14; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":251 - * if t == NPY_BYTE: f = "b" - * elif t == NPY_UBYTE: f = "B" - * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< - * elif t == NPY_USHORT: f = "H" - * elif t == NPY_INT: f = "i" - */ - __pyx_t_1 = (__pyx_v_t == NPY_SHORT); - if (__pyx_t_1) { - __pyx_v_f = __pyx_k__h; - goto __pyx_L14; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":252 - * elif t == NPY_UBYTE: f = "B" - * elif t == NPY_SHORT: f = "h" - * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< - * elif t == NPY_INT: f = "i" - * elif t == NPY_UINT: f = "I" - */ - __pyx_t_1 = (__pyx_v_t == NPY_USHORT); - if (__pyx_t_1) { - __pyx_v_f = __pyx_k__H; - goto __pyx_L14; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":253 - * elif t == NPY_SHORT: f = "h" - * elif t == NPY_USHORT: f = "H" - * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< - * elif t == NPY_UINT: f = "I" - * elif t == NPY_LONG: f = "l" - */ - __pyx_t_1 = (__pyx_v_t == NPY_INT); - if (__pyx_t_1) { - __pyx_v_f = __pyx_k__i; - goto __pyx_L14; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":254 - * elif t == NPY_USHORT: f = "H" - * elif t == NPY_INT: f = "i" - * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< - * elif t == NPY_LONG: f = "l" - * elif t == NPY_ULONG: f = "L" - */ - __pyx_t_1 = (__pyx_v_t == NPY_UINT); - if (__pyx_t_1) { - __pyx_v_f = __pyx_k__I; - goto __pyx_L14; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":255 - * elif t == NPY_INT: f = "i" - * elif t == NPY_UINT: f = "I" - * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< - * elif t == NPY_ULONG: f = "L" - * elif t == NPY_LONGLONG: f = "q" - */ - __pyx_t_1 = (__pyx_v_t == NPY_LONG); - if (__pyx_t_1) { - __pyx_v_f = __pyx_k__l; - goto __pyx_L14; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":256 - * elif t == NPY_UINT: f = "I" - * elif t == NPY_LONG: f = "l" - * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< - * elif t == NPY_LONGLONG: f = "q" - * elif t == NPY_ULONGLONG: f = "Q" - */ - __pyx_t_1 = (__pyx_v_t == NPY_ULONG); - if (__pyx_t_1) { - __pyx_v_f = __pyx_k__L; - goto __pyx_L14; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":257 - * elif t == NPY_LONG: f = "l" - * elif t == NPY_ULONG: f = "L" - * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< - * elif t == NPY_ULONGLONG: f = "Q" - * elif t == NPY_FLOAT: f = "f" - */ - __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); - if (__pyx_t_1) { - __pyx_v_f = __pyx_k__q; - goto __pyx_L14; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":258 - * elif t == NPY_ULONG: f = "L" - * elif t == NPY_LONGLONG: f = "q" - * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< - * elif t == NPY_FLOAT: f = "f" - * elif t == NPY_DOUBLE: f = "d" - */ - __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); - if (__pyx_t_1) { - __pyx_v_f = __pyx_k__Q; - goto __pyx_L14; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":259 - * elif t == NPY_LONGLONG: f = "q" - * elif t == NPY_ULONGLONG: f = "Q" - * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< - * elif t == NPY_DOUBLE: f = "d" - * elif t == NPY_LONGDOUBLE: f = "g" - */ - __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); - if (__pyx_t_1) { - __pyx_v_f = __pyx_k__f; - goto __pyx_L14; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":260 - * elif t == NPY_ULONGLONG: f = "Q" - * elif t == NPY_FLOAT: f = "f" - * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< - * elif t == NPY_LONGDOUBLE: f = "g" - * elif t == NPY_CFLOAT: f = "Zf" - */ - __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); - if (__pyx_t_1) { - __pyx_v_f = __pyx_k__d; - goto __pyx_L14; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":261 - * elif t == NPY_FLOAT: f = "f" - * elif t == NPY_DOUBLE: f = "d" - * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< - * elif t == NPY_CFLOAT: f = "Zf" - * elif t == NPY_CDOUBLE: f = "Zd" - */ - __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); - if (__pyx_t_1) { - __pyx_v_f = __pyx_k__g; - goto __pyx_L14; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":262 - * elif t == NPY_DOUBLE: f = "d" - * elif t == NPY_LONGDOUBLE: f = "g" - * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< - * elif t == NPY_CDOUBLE: f = "Zd" - * elif t == NPY_CLONGDOUBLE: f = "Zg" - */ - __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); - if (__pyx_t_1) { - __pyx_v_f = __pyx_k__Zf; - goto __pyx_L14; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":263 - * elif t == NPY_LONGDOUBLE: f = "g" - * elif t == NPY_CFLOAT: f = "Zf" - * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< - * elif t == NPY_CLONGDOUBLE: f = "Zg" - * elif t == NPY_OBJECT: f = "O" - */ - __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); - if (__pyx_t_1) { - __pyx_v_f = __pyx_k__Zd; - goto __pyx_L14; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":264 - * elif t == NPY_CFLOAT: f = "Zf" - * elif t == NPY_CDOUBLE: f = "Zd" - * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< - * elif t == NPY_OBJECT: f = "O" - * else: - */ - __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); - if (__pyx_t_1) { - __pyx_v_f = __pyx_k__Zg; - goto __pyx_L14; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":265 - * elif t == NPY_CDOUBLE: f = "Zd" - * elif t == NPY_CLONGDOUBLE: f = "Zg" - * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - */ - __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); - if (__pyx_t_1) { - __pyx_v_f = __pyx_k__O; - goto __pyx_L14; - } - /*else*/ { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":267 - * elif t == NPY_OBJECT: f = "O" - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< - * info.format = f - * return - */ - __pyx_t_5 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_10), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[10]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_L14:; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":268 - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - * info.format = f # <<<<<<<<<<<<<< - * return - * else: - */ - __pyx_v_info->format = __pyx_v_f; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":269 - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - * info.format = f - * return # <<<<<<<<<<<<<< - * else: - * info.format = stdlib.malloc(_buffer_format_string_len) - */ - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L12; - } - /*else*/ { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":271 - * return - * else: - * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< - * info.format[0] = '^' # Native data types, manual alignment - * offset = 0 - */ - __pyx_v_info->format = ((char *)malloc(255)); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":272 - * else: - * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< - * offset = 0 - * f = _util_dtypestring(descr, info.format + 1, - */ - (__pyx_v_info->format[0]) = '^'; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":273 - * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment - * offset = 0 # <<<<<<<<<<<<<< - * f = _util_dtypestring(descr, info.format + 1, - * info.format + _buffer_format_string_len, - */ - __pyx_v_offset = 0; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":276 - * f = _util_dtypestring(descr, info.format + 1, - * info.format + _buffer_format_string_len, - * &offset) # <<<<<<<<<<<<<< - * f[0] = 0 # Terminate format string - * - */ - __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_9; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":277 - * info.format + _buffer_format_string_len, - * &offset) - * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< - * - * def __releasebuffer__(ndarray self, Py_buffer* info): - */ - (__pyx_v_f[0]) = 0; - } - __pyx_L12:; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("numpy.ndarray.__getbuffer__"); - __pyx_r = -1; - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; - goto __pyx_L2; - __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { - __Pyx_GOTREF(Py_None); - __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; - } - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_descr); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":279 - * f[0] = 0 # Terminate format string - * - * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) - */ - -static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { - int __pyx_t_1; - __Pyx_RefNannySetupContext("__releasebuffer__"); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":280 - * - * def __releasebuffer__(ndarray self, Py_buffer* info): - * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - */ - __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); - if (__pyx_t_1) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":281 - * def __releasebuffer__(ndarray self, Py_buffer* info): - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) # <<<<<<<<<<<<<< - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * stdlib.free(info.strides) - */ - free(__pyx_v_info->format); - goto __pyx_L5; - } - __pyx_L5:; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":282 - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< - * stdlib.free(info.strides) - * # info.shape was stored after info.strides in the same block - */ - __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); - if (__pyx_t_1) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":283 - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * stdlib.free(info.strides) # <<<<<<<<<<<<<< - * # info.shape was stored after info.strides in the same block - * - */ - free(__pyx_v_info->strides); - goto __pyx_L6; - } - __pyx_L6:; - - __Pyx_RefNannyFinishContext(); -} - -/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":756 - * ctypedef npy_cdouble complex_t - * - * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(1, a) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":757 - * - * cdef inline object PyArray_MultiIterNew1(a): - * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew2(a, b): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":759 - * return PyArray_MultiIterNew(1, a) - * - * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(2, a, b) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":760 - * - * cdef inline object PyArray_MultiIterNew2(a, b): - * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":762 - * return PyArray_MultiIterNew(2, a, b) - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(3, a, b, c) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":763 - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): - * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":765 - * return PyArray_MultiIterNew(3, a, b, c) - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(4, a, b, c, d) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":766 - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): - * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":768 - * return PyArray_MultiIterNew(4, a, b, c, d) - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(5, a, b, c, d, e) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":769 - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): - * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< - * - * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":771 - * return PyArray_MultiIterNew(5, a, b, c, d, e) - * - * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< - * # Recursive utility function used in __getbuffer__ to get format - * # string. The new location in the format string is returned. - */ - -static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { - PyArray_Descr *__pyx_v_child; - int __pyx_v_endian_detector; - int __pyx_v_little_endian; - PyObject *__pyx_v_fields; - PyObject *__pyx_v_childname; - PyObject *__pyx_v_new_offset; - PyObject *__pyx_v_t; - char *__pyx_r; - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - char *__pyx_t_10; - __Pyx_RefNannySetupContext("_util_dtypestring"); - __pyx_v_child = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_fields = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_childname = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_t = Py_None; __Pyx_INCREF(Py_None); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":778 - * cdef int delta_offset - * cdef tuple i - * cdef int endian_detector = 1 # <<<<<<<<<<<<<< - * cdef bint little_endian = ((&endian_detector)[0] != 0) - * cdef tuple fields - */ - __pyx_v_endian_detector = 1; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":779 - * cdef tuple i - * cdef int endian_detector = 1 - * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< - * cdef tuple fields - * - */ - __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":782 - * cdef tuple fields - * - * for childname in descr.names: # <<<<<<<<<<<<<< - * fields = descr.fields[childname] - * child, new_offset = fields - */ - if (likely(((PyObject *)__pyx_v_descr->names) != Py_None)) { - __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_2); - } else { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[10]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - for (;;) { - if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; - __Pyx_DECREF(__pyx_v_childname); - __pyx_v_childname = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":783 - * - * for childname in descr.names: - * fields = descr.fields[childname] # <<<<<<<<<<<<<< - * child, new_offset = fields - * - */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_fields)); - __pyx_v_fields = ((PyObject *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":784 - * for childname in descr.names: - * fields = descr.fields[childname] - * child, new_offset = fields # <<<<<<<<<<<<<< - * - * if (end - f) - (new_offset - offset[0]) < 15: - */ - if (likely(((PyObject *)__pyx_v_fields) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_fields)) == 2)) { - PyObject* tuple = ((PyObject *)__pyx_v_fields); - __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_v_child)); - __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); - __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_v_new_offset); - __pyx_v_new_offset = __pyx_t_4; - __pyx_t_4 = 0; - } else { - __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); - {__pyx_filename = __pyx_f[10]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":786 - * child, new_offset = fields - * - * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") - * - */ - __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":787 - * - * if (end - f) - (new_offset - offset[0]) < 15: - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< - * - * if ((child.byteorder == '>' and little_endian) or - */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_11)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_11)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11)); - __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[10]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; - } - __pyx_L5:; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":789 - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") - * - * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == '<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - */ - __pyx_t_6 = (__pyx_v_child->byteorder == '>'); - if (__pyx_t_6) { - __pyx_t_7 = __pyx_v_little_endian; - } else { - __pyx_t_7 = __pyx_t_6; - } - if (!__pyx_t_7) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":790 - * - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< - * raise ValueError(u"Non-native byte order not supported") - * # One could encode it in the format string and have Cython - */ - __pyx_t_6 = (__pyx_v_child->byteorder == '<'); - if (__pyx_t_6) { - __pyx_t_8 = (!__pyx_v_little_endian); - __pyx_t_9 = __pyx_t_8; - } else { - __pyx_t_9 = __pyx_t_6; - } - __pyx_t_6 = __pyx_t_9; - } else { - __pyx_t_6 = __pyx_t_7; - } - if (__pyx_t_6) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":791 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< - * # One could encode it in the format string and have Cython - * # complain instead, BUT: < and > in format strings also imply - */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_9)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_9)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_9)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[10]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; - } - __pyx_L6:; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":801 - * - * # Output padding bytes - * while offset[0] < new_offset: # <<<<<<<<<<<<<< - * f[0] = 120 # "x"; pad byte - * f += 1 - */ - while (1) { - __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_6) break; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":802 - * # Output padding bytes - * while offset[0] < new_offset: - * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< - * f += 1 - * offset[0] += 1 - */ - (__pyx_v_f[0]) = 120; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":803 - * while offset[0] < new_offset: - * f[0] = 120 # "x"; pad byte - * f += 1 # <<<<<<<<<<<<<< - * offset[0] += 1 - * - */ - __pyx_v_f += 1; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":804 - * f[0] = 120 # "x"; pad byte - * f += 1 - * offset[0] += 1 # <<<<<<<<<<<<<< - * - * offset[0] += child.itemsize - */ - (__pyx_v_offset[0]) += 1; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":806 - * offset[0] += 1 - * - * offset[0] += child.itemsize # <<<<<<<<<<<<<< - * - * if not PyDataType_HASFIELDS(child): - */ - (__pyx_v_offset[0]) += __pyx_v_child->elsize; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":808 - * offset[0] += child.itemsize - * - * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< - * t = child.type_num - * if end - f < 5: - */ - __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); - if (__pyx_t_6) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":809 - * - * if not PyDataType_HASFIELDS(child): - * t = child.type_num # <<<<<<<<<<<<<< - * if end - f < 5: - * raise RuntimeError(u"Format string allocated too short.") - */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_v_t); - __pyx_v_t = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":810 - * if not PyDataType_HASFIELDS(child): - * t = child.type_num - * if end - f < 5: # <<<<<<<<<<<<<< - * raise RuntimeError(u"Format string allocated too short.") - * - */ - __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); - if (__pyx_t_6) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":811 - * t = child.type_num - * if end - f < 5: - * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< - * - * # Until ticket #99 is fixed, use integers to avoid warnings - */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_12)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_12)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_12)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[10]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; - } - __pyx_L10:; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":814 - * - * # Until ticket #99 is fixed, use integers to avoid warnings - * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" - */ - __pyx_t_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 98; - goto __pyx_L11; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":815 - * # Until ticket #99 is fixed, use integers to avoid warnings - * if t == NPY_BYTE: f[0] = 98 #"b" - * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" - */ - __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 66; - goto __pyx_L11; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":816 - * if t == NPY_BYTE: f[0] = 98 #"b" - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" - */ - __pyx_t_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 104; - goto __pyx_L11; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":817 - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" - */ - __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 72; - goto __pyx_L11; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":818 - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" - */ - __pyx_t_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 105; - goto __pyx_L11; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":819 - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" - */ - __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 73; - goto __pyx_L11; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":820 - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - */ - __pyx_t_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 108; - goto __pyx_L11; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":821 - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - */ - __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 76; - goto __pyx_L11; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":822 - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" - */ - __pyx_t_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 113; - goto __pyx_L11; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":823 - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - */ - __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 81; - goto __pyx_L11; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":824 - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - */ - __pyx_t_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 102; - goto __pyx_L11; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":825 - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - */ - __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 100; - goto __pyx_L11; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":826 - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - */ - __pyx_t_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 103; - goto __pyx_L11; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":827 - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg - */ - __pyx_t_3 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 90; - (__pyx_v_f[1]) = 102; - __pyx_v_f += 1; - goto __pyx_L11; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":828 - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg - * elif t == NPY_OBJECT: f[0] = 79 #"O" - */ - __pyx_t_5 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 90; - (__pyx_v_f[1]) = 100; - __pyx_v_f += 1; - goto __pyx_L11; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":829 - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< - * elif t == NPY_OBJECT: f[0] = 79 #"O" - * else: - */ - __pyx_t_3 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 90; - (__pyx_v_f[1]) = 103; - __pyx_v_f += 1; - goto __pyx_L11; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":830 - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg - * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - */ - __pyx_t_5 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 79; - goto __pyx_L11; - } - /*else*/ { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":832 - * elif t == NPY_OBJECT: f[0] = 79 #"O" - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< - * f += 1 - * else: - */ - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_10), __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[10]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_L11:; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":833 - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - * f += 1 # <<<<<<<<<<<<<< - * else: - * # Cython ignores struct boundary information ("T{...}"), - */ - __pyx_v_f += 1; - goto __pyx_L9; - } - /*else*/ { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":837 - * # Cython ignores struct boundary information ("T{...}"), - * # so don't output it - * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< - * return f - * - */ - __pyx_t_10 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_10; - } - __pyx_L9:; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":838 - * # so don't output it - * f = _util_dtypestring(child, f, end, offset) - * return f # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_f; - goto __pyx_L0; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("numpy._util_dtypestring"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_child); - __Pyx_DECREF(__pyx_v_fields); - __Pyx_DECREF(__pyx_v_childname); - __Pyx_DECREF(__pyx_v_new_offset); - __Pyx_DECREF(__pyx_v_t); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":953 - * - * - * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< - * cdef PyObject* baseptr - * if base is None: - */ - -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { - PyObject *__pyx_v_baseptr; - int __pyx_t_1; - __Pyx_RefNannySetupContext("set_array_base"); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":955 - * cdef inline void set_array_base(ndarray arr, object base): - * cdef PyObject* baseptr - * if base is None: # <<<<<<<<<<<<<< - * baseptr = NULL - * else: - */ - __pyx_t_1 = (__pyx_v_base == Py_None); - if (__pyx_t_1) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":956 - * cdef PyObject* baseptr - * if base is None: - * baseptr = NULL # <<<<<<<<<<<<<< - * else: - * Py_INCREF(base) # important to do this before decref below! - */ - __pyx_v_baseptr = NULL; - goto __pyx_L3; - } - /*else*/ { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":958 - * baseptr = NULL - * else: - * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< - * baseptr = base - * Py_XDECREF(arr.base) - */ - Py_INCREF(__pyx_v_base); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":959 - * else: - * Py_INCREF(base) # important to do this before decref below! - * baseptr = base # <<<<<<<<<<<<<< - * Py_XDECREF(arr.base) - * arr.base = baseptr - */ - __pyx_v_baseptr = ((PyObject *)__pyx_v_base); - } - __pyx_L3:; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":960 - * Py_INCREF(base) # important to do this before decref below! - * baseptr = base - * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< - * arr.base = baseptr - * - */ - Py_XDECREF(__pyx_v_arr->base); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":961 - * baseptr = base - * Py_XDECREF(arr.base) - * arr.base = baseptr # <<<<<<<<<<<<<< - * - * cdef inline object get_array_base(ndarray arr): - */ - __pyx_v_arr->base = __pyx_v_baseptr; - - __Pyx_RefNannyFinishContext(); -} - -/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":963 - * arr.base = baseptr - * - * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * if arr.base is NULL: - * return None - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { - PyObject *__pyx_r = NULL; - int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base"); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":964 - * - * cdef inline object get_array_base(ndarray arr): - * if arr.base is NULL: # <<<<<<<<<<<<<< - * return None - * else: - */ - __pyx_t_1 = (__pyx_v_arr->base == NULL); - if (__pyx_t_1) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":965 - * cdef inline object get_array_base(ndarray arr): - * if arr.base is NULL: - * return None # <<<<<<<<<<<<<< - * else: - * return arr.base - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_None); - __pyx_r = Py_None; - goto __pyx_L0; - goto __pyx_L3; - } - /*else*/ { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":967 - * return None - * else: - * return arr.base # <<<<<<<<<<<<<< - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); - __pyx_r = ((PyObject *)__pyx_v_arr->base); - goto __pyx_L0; - } - __pyx_L3:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_tp_new_2yt_9amr_utils_position(PyTypeObject *t, PyObject *a, PyObject *k) { - PyObject *o = (*t->tp_alloc)(t, 0); - if (!o) return 0; - if (__pyx_pf_2yt_9amr_utils_8position___cinit__(o, __pyx_empty_tuple, NULL) < 0) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_2yt_9amr_utils_position(PyObject *o) { - (*Py_TYPE(o)->tp_free)(o); -} - -static PyObject *__pyx_getprop_2yt_9amr_utils_8position_output_pos(PyObject *o, void *x) { - return __pyx_pf_2yt_9amr_utils_8position_10output_pos___get__(o); -} - -static int __pyx_setprop_2yt_9amr_utils_8position_output_pos(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_2yt_9amr_utils_8position_10output_pos___set__(o, v); - } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; - } -} - -static PyObject *__pyx_getprop_2yt_9amr_utils_8position_refined_pos(PyObject *o, void *x) { - return __pyx_pf_2yt_9amr_utils_8position_11refined_pos___get__(o); -} - -static int __pyx_setprop_2yt_9amr_utils_8position_refined_pos(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_2yt_9amr_utils_8position_11refined_pos___set__(o, v); - } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; - } -} - -static PyMethodDef __pyx_methods_2yt_9amr_utils_position[] = { - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_2yt_9amr_utils_position[] = { - {(char *)"output_pos", __pyx_getprop_2yt_9amr_utils_8position_output_pos, __pyx_setprop_2yt_9amr_utils_8position_output_pos, 0, 0}, - {(char *)"refined_pos", __pyx_getprop_2yt_9amr_utils_8position_refined_pos, __pyx_setprop_2yt_9amr_utils_8position_refined_pos, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_position = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION >= 3 - 0, /*reserved*/ - #else - 0, /*nb_long*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_position = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_position = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_position = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -PyTypeObject __pyx_type_2yt_9amr_utils_position = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("yt.amr_utils.position"), /*tp_name*/ - sizeof(struct __pyx_obj_2yt_9amr_utils_position), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_2yt_9amr_utils_position, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION >= 3 - 0, /*reserved*/ - #else - 0, /*tp_compare*/ - #endif - 0, /*tp_repr*/ - &__pyx_tp_as_number_position, /*tp_as_number*/ - &__pyx_tp_as_sequence_position, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_position, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_position, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/ - 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_2yt_9amr_utils_position, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_2yt_9amr_utils_position, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_2yt_9amr_utils_position, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static PyObject *__pyx_tp_new_2yt_9amr_utils_OctreeGrid(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_2yt_9amr_utils_OctreeGrid *p; - PyObject *o = (*t->tp_alloc)(t, 0); - if (!o) return 0; - p = ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)o); - p->child_indices = Py_None; Py_INCREF(Py_None); - p->fields = Py_None; Py_INCREF(Py_None); - p->left_edges = Py_None; Py_INCREF(Py_None); - p->dimensions = Py_None; Py_INCREF(Py_None); - p->dx = Py_None; Py_INCREF(Py_None); - if (__pyx_pf_2yt_9amr_utils_10OctreeGrid___cinit__(o, a, k) < 0) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_2yt_9amr_utils_OctreeGrid(PyObject *o) { - struct __pyx_obj_2yt_9amr_utils_OctreeGrid *p = (struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)o; - Py_XDECREF(p->child_indices); - Py_XDECREF(p->fields); - Py_XDECREF(p->left_edges); - Py_XDECREF(p->dimensions); - Py_XDECREF(p->dx); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_2yt_9amr_utils_OctreeGrid(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_2yt_9amr_utils_OctreeGrid *p = (struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)o; - if (p->child_indices) { - e = (*v)(p->child_indices, a); if (e) return e; - } - if (p->fields) { - e = (*v)(p->fields, a); if (e) return e; - } - if (p->left_edges) { - e = (*v)(p->left_edges, a); if (e) return e; - } - if (p->dimensions) { - e = (*v)(p->dimensions, a); if (e) return e; - } - if (p->dx) { - e = (*v)(p->dx, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_2yt_9amr_utils_OctreeGrid(PyObject *o) { - struct __pyx_obj_2yt_9amr_utils_OctreeGrid *p = (struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)o; - PyObject* tmp; - tmp = ((PyObject*)p->child_indices); - p->child_indices = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->fields); - p->fields = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->left_edges); - p->left_edges = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->dimensions); - p->dimensions = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->dx); - p->dx = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyObject *__pyx_getprop_2yt_9amr_utils_10OctreeGrid_child_indices(PyObject *o, void *x) { - return __pyx_pf_2yt_9amr_utils_10OctreeGrid_13child_indices___get__(o); -} - -static int __pyx_setprop_2yt_9amr_utils_10OctreeGrid_child_indices(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_2yt_9amr_utils_10OctreeGrid_13child_indices___set__(o, v); - } - else { - return __pyx_pf_2yt_9amr_utils_10OctreeGrid_13child_indices___del__(o); - } -} - -static PyObject *__pyx_getprop_2yt_9amr_utils_10OctreeGrid_fields(PyObject *o, void *x) { - return __pyx_pf_2yt_9amr_utils_10OctreeGrid_6fields___get__(o); -} - -static int __pyx_setprop_2yt_9amr_utils_10OctreeGrid_fields(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_2yt_9amr_utils_10OctreeGrid_6fields___set__(o, v); - } - else { - return __pyx_pf_2yt_9amr_utils_10OctreeGrid_6fields___del__(o); - } -} - -static PyObject *__pyx_getprop_2yt_9amr_utils_10OctreeGrid_left_edges(PyObject *o, void *x) { - return __pyx_pf_2yt_9amr_utils_10OctreeGrid_10left_edges___get__(o); -} - -static int __pyx_setprop_2yt_9amr_utils_10OctreeGrid_left_edges(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_2yt_9amr_utils_10OctreeGrid_10left_edges___set__(o, v); - } - else { - return __pyx_pf_2yt_9amr_utils_10OctreeGrid_10left_edges___del__(o); - } -} - -static PyObject *__pyx_getprop_2yt_9amr_utils_10OctreeGrid_dimensions(PyObject *o, void *x) { - return __pyx_pf_2yt_9amr_utils_10OctreeGrid_10dimensions___get__(o); -} - -static int __pyx_setprop_2yt_9amr_utils_10OctreeGrid_dimensions(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_2yt_9amr_utils_10OctreeGrid_10dimensions___set__(o, v); - } - else { - return __pyx_pf_2yt_9amr_utils_10OctreeGrid_10dimensions___del__(o); - } -} - -static PyObject *__pyx_getprop_2yt_9amr_utils_10OctreeGrid_dx(PyObject *o, void *x) { - return __pyx_pf_2yt_9amr_utils_10OctreeGrid_2dx___get__(o); -} - -static int __pyx_setprop_2yt_9amr_utils_10OctreeGrid_dx(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_2yt_9amr_utils_10OctreeGrid_2dx___set__(o, v); - } - else { - return __pyx_pf_2yt_9amr_utils_10OctreeGrid_2dx___del__(o); - } -} - -static PyObject *__pyx_getprop_2yt_9amr_utils_10OctreeGrid_level(PyObject *o, void *x) { - return __pyx_pf_2yt_9amr_utils_10OctreeGrid_5level___get__(o); -} - -static int __pyx_setprop_2yt_9amr_utils_10OctreeGrid_level(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_2yt_9amr_utils_10OctreeGrid_5level___set__(o, v); - } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; - } -} - -static PyMethodDef __pyx_methods_2yt_9amr_utils_OctreeGrid[] = { - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_2yt_9amr_utils_OctreeGrid[] = { - {(char *)"child_indices", __pyx_getprop_2yt_9amr_utils_10OctreeGrid_child_indices, __pyx_setprop_2yt_9amr_utils_10OctreeGrid_child_indices, 0, 0}, - {(char *)"fields", __pyx_getprop_2yt_9amr_utils_10OctreeGrid_fields, __pyx_setprop_2yt_9amr_utils_10OctreeGrid_fields, 0, 0}, - {(char *)"left_edges", __pyx_getprop_2yt_9amr_utils_10OctreeGrid_left_edges, __pyx_setprop_2yt_9amr_utils_10OctreeGrid_left_edges, 0, 0}, - {(char *)"dimensions", __pyx_getprop_2yt_9amr_utils_10OctreeGrid_dimensions, __pyx_setprop_2yt_9amr_utils_10OctreeGrid_dimensions, 0, 0}, - {(char *)"dx", __pyx_getprop_2yt_9amr_utils_10OctreeGrid_dx, __pyx_setprop_2yt_9amr_utils_10OctreeGrid_dx, 0, 0}, - {(char *)"level", __pyx_getprop_2yt_9amr_utils_10OctreeGrid_level, __pyx_setprop_2yt_9amr_utils_10OctreeGrid_level, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_OctreeGrid = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION >= 3 - 0, /*reserved*/ - #else - 0, /*nb_long*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_OctreeGrid = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_OctreeGrid = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_OctreeGrid = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -PyTypeObject __pyx_type_2yt_9amr_utils_OctreeGrid = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("yt.amr_utils.OctreeGrid"), /*tp_name*/ - sizeof(struct __pyx_obj_2yt_9amr_utils_OctreeGrid), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_2yt_9amr_utils_OctreeGrid, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION >= 3 - 0, /*reserved*/ - #else - 0, /*tp_compare*/ - #endif - 0, /*tp_repr*/ - &__pyx_tp_as_number_OctreeGrid, /*tp_as_number*/ - &__pyx_tp_as_sequence_OctreeGrid, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_OctreeGrid, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_OctreeGrid, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_2yt_9amr_utils_OctreeGrid, /*tp_traverse*/ - __pyx_tp_clear_2yt_9amr_utils_OctreeGrid, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_2yt_9amr_utils_OctreeGrid, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_2yt_9amr_utils_OctreeGrid, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_2yt_9amr_utils_OctreeGrid, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static PyObject *__pyx_tp_new_2yt_9amr_utils_OctreeGridList(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_2yt_9amr_utils_OctreeGridList *p; - PyObject *o = (*t->tp_alloc)(t, 0); - if (!o) return 0; - p = ((struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)o); - p->grids = Py_None; Py_INCREF(Py_None); - if (__pyx_pf_2yt_9amr_utils_14OctreeGridList___cinit__(o, a, k) < 0) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_2yt_9amr_utils_OctreeGridList(PyObject *o) { - struct __pyx_obj_2yt_9amr_utils_OctreeGridList *p = (struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)o; - Py_XDECREF(p->grids); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_2yt_9amr_utils_OctreeGridList(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_2yt_9amr_utils_OctreeGridList *p = (struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)o; - if (p->grids) { - e = (*v)(p->grids, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_2yt_9amr_utils_OctreeGridList(PyObject *o) { - struct __pyx_obj_2yt_9amr_utils_OctreeGridList *p = (struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)o; - PyObject* tmp; - tmp = ((PyObject*)p->grids); - p->grids = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} -static PyObject *__pyx_sq_item_2yt_9amr_utils_OctreeGridList(PyObject *o, Py_ssize_t i) { - PyObject *r; - PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; - r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); - Py_DECREF(x); - return r; -} - -static PyObject *__pyx_getprop_2yt_9amr_utils_14OctreeGridList_grids(PyObject *o, void *x) { - return __pyx_pf_2yt_9amr_utils_14OctreeGridList_5grids___get__(o); -} - -static int __pyx_setprop_2yt_9amr_utils_14OctreeGridList_grids(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_2yt_9amr_utils_14OctreeGridList_5grids___set__(o, v); - } - else { - return __pyx_pf_2yt_9amr_utils_14OctreeGridList_5grids___del__(o); - } -} - -static PyMethodDef __pyx_methods_2yt_9amr_utils_OctreeGridList[] = { - {__Pyx_NAMESTR("__getitem__"), (PyCFunction)__pyx_pf_2yt_9amr_utils_14OctreeGridList___getitem__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_2yt_9amr_utils_OctreeGridList[] = { - {(char *)"grids", __pyx_getprop_2yt_9amr_utils_14OctreeGridList_grids, __pyx_setprop_2yt_9amr_utils_14OctreeGridList_grids, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_OctreeGridList = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION >= 3 - 0, /*reserved*/ - #else - 0, /*nb_long*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_OctreeGridList = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item_2yt_9amr_utils_OctreeGridList, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_OctreeGridList = { - 0, /*mp_length*/ - __pyx_pf_2yt_9amr_utils_14OctreeGridList___getitem__, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_OctreeGridList = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -PyTypeObject __pyx_type_2yt_9amr_utils_OctreeGridList = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("yt.amr_utils.OctreeGridList"), /*tp_name*/ - sizeof(struct __pyx_obj_2yt_9amr_utils_OctreeGridList), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_2yt_9amr_utils_OctreeGridList, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION >= 3 - 0, /*reserved*/ - #else - 0, /*tp_compare*/ - #endif - 0, /*tp_repr*/ - &__pyx_tp_as_number_OctreeGridList, /*tp_as_number*/ - &__pyx_tp_as_sequence_OctreeGridList, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_OctreeGridList, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_OctreeGridList, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_2yt_9amr_utils_OctreeGridList, /*tp_traverse*/ - __pyx_tp_clear_2yt_9amr_utils_OctreeGridList, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_2yt_9amr_utils_OctreeGridList, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_2yt_9amr_utils_OctreeGridList, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_2yt_9amr_utils_OctreeGridList, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_2yt_9amr_utils_VectorPlane __pyx_vtable_2yt_9amr_utils_VectorPlane; - -static PyObject *__pyx_tp_new_2yt_9amr_utils_VectorPlane(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_2yt_9amr_utils_VectorPlane *p; - PyObject *o = (*t->tp_alloc)(t, 0); - if (!o) return 0; - p = ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)o); - p->__pyx_vtab = __pyx_vtabptr_2yt_9amr_utils_VectorPlane; - p->avp_pos = Py_None; Py_INCREF(Py_None); - p->avp_dir = Py_None; Py_INCREF(Py_None); - p->acenter = Py_None; Py_INCREF(Py_None); - p->aimage = Py_None; Py_INCREF(Py_None); - p->ax_vec = Py_None; Py_INCREF(Py_None); - p->ay_vec = Py_None; Py_INCREF(Py_None); - if (__pyx_pf_2yt_9amr_utils_11VectorPlane___cinit__(o, a, k) < 0) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_2yt_9amr_utils_VectorPlane(PyObject *o) { - struct __pyx_obj_2yt_9amr_utils_VectorPlane *p = (struct __pyx_obj_2yt_9amr_utils_VectorPlane *)o; - Py_XDECREF(p->avp_pos); - Py_XDECREF(p->avp_dir); - Py_XDECREF(p->acenter); - Py_XDECREF(p->aimage); - Py_XDECREF(p->ax_vec); - Py_XDECREF(p->ay_vec); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_2yt_9amr_utils_VectorPlane(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_2yt_9amr_utils_VectorPlane *p = (struct __pyx_obj_2yt_9amr_utils_VectorPlane *)o; - if (p->avp_pos) { - e = (*v)(p->avp_pos, a); if (e) return e; - } - if (p->avp_dir) { - e = (*v)(p->avp_dir, a); if (e) return e; - } - if (p->acenter) { - e = (*v)(p->acenter, a); if (e) return e; - } - if (p->aimage) { - e = (*v)(p->aimage, a); if (e) return e; - } - if (p->ax_vec) { - e = (*v)(p->ax_vec, a); if (e) return e; - } - if (p->ay_vec) { - e = (*v)(p->ay_vec, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_2yt_9amr_utils_VectorPlane(PyObject *o) { - struct __pyx_obj_2yt_9amr_utils_VectorPlane *p = (struct __pyx_obj_2yt_9amr_utils_VectorPlane *)o; - PyObject* tmp; - tmp = ((PyObject*)p->avp_pos); - p->avp_pos = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->avp_dir); - p->avp_dir = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->acenter); - p->acenter = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->aimage); - p->aimage = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->ax_vec); - p->ax_vec = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->ay_vec); - p->ay_vec = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyObject *__pyx_getprop_2yt_9amr_utils_11VectorPlane_avp_pos(PyObject *o, void *x) { - return __pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_pos___get__(o); -} - -static int __pyx_setprop_2yt_9amr_utils_11VectorPlane_avp_pos(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_pos___set__(o, v); - } - else { - return __pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_pos___del__(o); - } -} - -static PyObject *__pyx_getprop_2yt_9amr_utils_11VectorPlane_avp_dir(PyObject *o, void *x) { - return __pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_dir___get__(o); -} - -static int __pyx_setprop_2yt_9amr_utils_11VectorPlane_avp_dir(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_dir___set__(o, v); - } - else { - return __pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_dir___del__(o); - } -} - -static PyObject *__pyx_getprop_2yt_9amr_utils_11VectorPlane_acenter(PyObject *o, void *x) { - return __pyx_pf_2yt_9amr_utils_11VectorPlane_7acenter___get__(o); -} - -static int __pyx_setprop_2yt_9amr_utils_11VectorPlane_acenter(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_2yt_9amr_utils_11VectorPlane_7acenter___set__(o, v); - } - else { - return __pyx_pf_2yt_9amr_utils_11VectorPlane_7acenter___del__(o); - } -} - -static PyObject *__pyx_getprop_2yt_9amr_utils_11VectorPlane_aimage(PyObject *o, void *x) { - return __pyx_pf_2yt_9amr_utils_11VectorPlane_6aimage___get__(o); -} - -static int __pyx_setprop_2yt_9amr_utils_11VectorPlane_aimage(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_2yt_9amr_utils_11VectorPlane_6aimage___set__(o, v); - } - else { - return __pyx_pf_2yt_9amr_utils_11VectorPlane_6aimage___del__(o); - } -} - -static PyObject *__pyx_getprop_2yt_9amr_utils_11VectorPlane_ax_vec(PyObject *o, void *x) { - return __pyx_pf_2yt_9amr_utils_11VectorPlane_6ax_vec___get__(o); -} - -static int __pyx_setprop_2yt_9amr_utils_11VectorPlane_ax_vec(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_2yt_9amr_utils_11VectorPlane_6ax_vec___set__(o, v); - } - else { - return __pyx_pf_2yt_9amr_utils_11VectorPlane_6ax_vec___del__(o); - } -} - -static PyObject *__pyx_getprop_2yt_9amr_utils_11VectorPlane_ay_vec(PyObject *o, void *x) { - return __pyx_pf_2yt_9amr_utils_11VectorPlane_6ay_vec___get__(o); -} - -static int __pyx_setprop_2yt_9amr_utils_11VectorPlane_ay_vec(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_2yt_9amr_utils_11VectorPlane_6ay_vec___set__(o, v); - } - else { - return __pyx_pf_2yt_9amr_utils_11VectorPlane_6ay_vec___del__(o); - } -} - -static PyMethodDef __pyx_methods_2yt_9amr_utils_VectorPlane[] = { - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_2yt_9amr_utils_VectorPlane[] = { - {(char *)"avp_pos", __pyx_getprop_2yt_9amr_utils_11VectorPlane_avp_pos, __pyx_setprop_2yt_9amr_utils_11VectorPlane_avp_pos, 0, 0}, - {(char *)"avp_dir", __pyx_getprop_2yt_9amr_utils_11VectorPlane_avp_dir, __pyx_setprop_2yt_9amr_utils_11VectorPlane_avp_dir, 0, 0}, - {(char *)"acenter", __pyx_getprop_2yt_9amr_utils_11VectorPlane_acenter, __pyx_setprop_2yt_9amr_utils_11VectorPlane_acenter, 0, 0}, - {(char *)"aimage", __pyx_getprop_2yt_9amr_utils_11VectorPlane_aimage, __pyx_setprop_2yt_9amr_utils_11VectorPlane_aimage, 0, 0}, - {(char *)"ax_vec", __pyx_getprop_2yt_9amr_utils_11VectorPlane_ax_vec, __pyx_setprop_2yt_9amr_utils_11VectorPlane_ax_vec, 0, 0}, - {(char *)"ay_vec", __pyx_getprop_2yt_9amr_utils_11VectorPlane_ay_vec, __pyx_setprop_2yt_9amr_utils_11VectorPlane_ay_vec, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_VectorPlane = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION >= 3 - 0, /*reserved*/ - #else - 0, /*nb_long*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_VectorPlane = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_VectorPlane = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_VectorPlane = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -PyTypeObject __pyx_type_2yt_9amr_utils_VectorPlane = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("yt.amr_utils.VectorPlane"), /*tp_name*/ - sizeof(struct __pyx_obj_2yt_9amr_utils_VectorPlane), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_2yt_9amr_utils_VectorPlane, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION >= 3 - 0, /*reserved*/ - #else - 0, /*tp_compare*/ - #endif - 0, /*tp_repr*/ - &__pyx_tp_as_number_VectorPlane, /*tp_as_number*/ - &__pyx_tp_as_sequence_VectorPlane, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_VectorPlane, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_VectorPlane, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_2yt_9amr_utils_VectorPlane, /*tp_traverse*/ - __pyx_tp_clear_2yt_9amr_utils_VectorPlane, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_2yt_9amr_utils_VectorPlane, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_2yt_9amr_utils_VectorPlane, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_2yt_9amr_utils_VectorPlane, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_2yt_9amr_utils_TransferFunctionProxy __pyx_vtable_2yt_9amr_utils_TransferFunctionProxy; - -static PyObject *__pyx_tp_new_2yt_9amr_utils_TransferFunctionProxy(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *p; - PyObject *o = (*t->tp_alloc)(t, 0); - if (!o) return 0; - p = ((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)o); - p->__pyx_vtab = __pyx_vtabptr_2yt_9amr_utils_TransferFunctionProxy; - p->tf_obj = Py_None; Py_INCREF(Py_None); - p->my_field_tables = Py_None; Py_INCREF(Py_None); - if (__pyx_pf_2yt_9amr_utils_21TransferFunctionProxy___cinit__(o, a, k) < 0) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_2yt_9amr_utils_TransferFunctionProxy(PyObject *o) { - struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *p = (struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)o; - Py_XDECREF(p->tf_obj); - Py_XDECREF(p->my_field_tables); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_2yt_9amr_utils_TransferFunctionProxy(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *p = (struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)o; - if (p->tf_obj) { - e = (*v)(p->tf_obj, a); if (e) return e; - } - if (p->my_field_tables) { - e = (*v)(p->my_field_tables, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_2yt_9amr_utils_TransferFunctionProxy(PyObject *o) { - struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *p = (struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)o; - PyObject* tmp; - tmp = ((PyObject*)p->tf_obj); - p->tf_obj = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->my_field_tables); - p->my_field_tables = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyObject *__pyx_getprop_2yt_9amr_utils_21TransferFunctionProxy_ns(PyObject *o, void *x) { - return __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_2ns___get__(o); -} - -static int __pyx_setprop_2yt_9amr_utils_21TransferFunctionProxy_ns(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_2ns___set__(o, v); - } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; - } -} - -static PyObject *__pyx_getprop_2yt_9amr_utils_21TransferFunctionProxy_tf_obj(PyObject *o, void *x) { - return __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_6tf_obj___get__(o); -} - -static int __pyx_setprop_2yt_9amr_utils_21TransferFunctionProxy_tf_obj(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_6tf_obj___set__(o, v); - } - else { - return __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_6tf_obj___del__(o); - } -} - -static PyObject *__pyx_getprop_2yt_9amr_utils_21TransferFunctionProxy_my_field_tables(PyObject *o, void *x) { - return __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_15my_field_tables___get__(o); -} - -static int __pyx_setprop_2yt_9amr_utils_21TransferFunctionProxy_my_field_tables(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_15my_field_tables___set__(o, v); - } - else { - return __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_15my_field_tables___del__(o); - } -} - -static PyMethodDef __pyx_methods_2yt_9amr_utils_TransferFunctionProxy[] = { - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_2yt_9amr_utils_TransferFunctionProxy[] = { - {(char *)"ns", __pyx_getprop_2yt_9amr_utils_21TransferFunctionProxy_ns, __pyx_setprop_2yt_9amr_utils_21TransferFunctionProxy_ns, 0, 0}, - {(char *)"tf_obj", __pyx_getprop_2yt_9amr_utils_21TransferFunctionProxy_tf_obj, __pyx_setprop_2yt_9amr_utils_21TransferFunctionProxy_tf_obj, 0, 0}, - {(char *)"my_field_tables", __pyx_getprop_2yt_9amr_utils_21TransferFunctionProxy_my_field_tables, __pyx_setprop_2yt_9amr_utils_21TransferFunctionProxy_my_field_tables, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_TransferFunctionProxy = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION >= 3 - 0, /*reserved*/ - #else - 0, /*nb_long*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_TransferFunctionProxy = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_TransferFunctionProxy = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_TransferFunctionProxy = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -PyTypeObject __pyx_type_2yt_9amr_utils_TransferFunctionProxy = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("yt.amr_utils.TransferFunctionProxy"), /*tp_name*/ - sizeof(struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_2yt_9amr_utils_TransferFunctionProxy, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION >= 3 - 0, /*reserved*/ - #else - 0, /*tp_compare*/ - #endif - 0, /*tp_repr*/ - &__pyx_tp_as_number_TransferFunctionProxy, /*tp_as_number*/ - &__pyx_tp_as_sequence_TransferFunctionProxy, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_TransferFunctionProxy, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_TransferFunctionProxy, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_2yt_9amr_utils_TransferFunctionProxy, /*tp_traverse*/ - __pyx_tp_clear_2yt_9amr_utils_TransferFunctionProxy, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_2yt_9amr_utils_TransferFunctionProxy, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_2yt_9amr_utils_TransferFunctionProxy, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_2yt_9amr_utils_TransferFunctionProxy, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_2yt_9amr_utils_PartitionedGrid __pyx_vtable_2yt_9amr_utils_PartitionedGrid; - -static PyObject *__pyx_tp_new_2yt_9amr_utils_PartitionedGrid(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *p; - PyObject *o = (*t->tp_alloc)(t, 0); - if (!o) return 0; - p = ((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)o); - p->__pyx_vtab = __pyx_vtabptr_2yt_9amr_utils_PartitionedGrid; - p->my_data = Py_None; Py_INCREF(Py_None); - p->LeftEdge = Py_None; Py_INCREF(Py_None); - p->RightEdge = Py_None; Py_INCREF(Py_None); - if (__pyx_pf_2yt_9amr_utils_15PartitionedGrid___cinit__(o, a, k) < 0) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_2yt_9amr_utils_PartitionedGrid(PyObject *o) { - struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *p = (struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)o; - Py_XDECREF(p->my_data); - Py_XDECREF(p->LeftEdge); - Py_XDECREF(p->RightEdge); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_2yt_9amr_utils_PartitionedGrid(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *p = (struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)o; - if (p->my_data) { - e = (*v)(p->my_data, a); if (e) return e; - } - if (p->LeftEdge) { - e = (*v)(p->LeftEdge, a); if (e) return e; - } - if (p->RightEdge) { - e = (*v)(p->RightEdge, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_2yt_9amr_utils_PartitionedGrid(PyObject *o) { - struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *p = (struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)o; - PyObject* tmp; - tmp = ((PyObject*)p->my_data); - p->my_data = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->LeftEdge); - p->LeftEdge = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->RightEdge); - p->RightEdge = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyObject *__pyx_getprop_2yt_9amr_utils_15PartitionedGrid_my_data(PyObject *o, void *x) { - return __pyx_pf_2yt_9amr_utils_15PartitionedGrid_7my_data___get__(o); -} - -static int __pyx_setprop_2yt_9amr_utils_15PartitionedGrid_my_data(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_2yt_9amr_utils_15PartitionedGrid_7my_data___set__(o, v); - } - else { - return __pyx_pf_2yt_9amr_utils_15PartitionedGrid_7my_data___del__(o); - } -} - -static PyObject *__pyx_getprop_2yt_9amr_utils_15PartitionedGrid_LeftEdge(PyObject *o, void *x) { - return __pyx_pf_2yt_9amr_utils_15PartitionedGrid_8LeftEdge___get__(o); -} - -static int __pyx_setprop_2yt_9amr_utils_15PartitionedGrid_LeftEdge(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_2yt_9amr_utils_15PartitionedGrid_8LeftEdge___set__(o, v); - } - else { - return __pyx_pf_2yt_9amr_utils_15PartitionedGrid_8LeftEdge___del__(o); - } -} - -static PyObject *__pyx_getprop_2yt_9amr_utils_15PartitionedGrid_RightEdge(PyObject *o, void *x) { - return __pyx_pf_2yt_9amr_utils_15PartitionedGrid_9RightEdge___get__(o); -} - -static int __pyx_setprop_2yt_9amr_utils_15PartitionedGrid_RightEdge(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_2yt_9amr_utils_15PartitionedGrid_9RightEdge___set__(o, v); - } - else { - return __pyx_pf_2yt_9amr_utils_15PartitionedGrid_9RightEdge___del__(o); - } -} - -static PyObject *__pyx_getprop_2yt_9amr_utils_15PartitionedGrid_parent_grid_id(PyObject *o, void *x) { - return __pyx_pf_2yt_9amr_utils_15PartitionedGrid_14parent_grid_id___get__(o); -} - -static int __pyx_setprop_2yt_9amr_utils_15PartitionedGrid_parent_grid_id(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_2yt_9amr_utils_15PartitionedGrid_14parent_grid_id___set__(o, v); - } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; - } -} - -static PyObject *__pyx_getprop_2yt_9amr_utils_15PartitionedGrid_n_fields(PyObject *o, void *x) { - return __pyx_pf_2yt_9amr_utils_15PartitionedGrid_8n_fields___get__(o); -} - -static int __pyx_setprop_2yt_9amr_utils_15PartitionedGrid_n_fields(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_2yt_9amr_utils_15PartitionedGrid_8n_fields___set__(o, v); - } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; - } -} - -static PyMethodDef __pyx_methods_2yt_9amr_utils_PartitionedGrid[] = { - {__Pyx_NAMESTR("cast_plane"), (PyCFunction)__pyx_pf_2yt_9amr_utils_15PartitionedGrid_cast_plane, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_2yt_9amr_utils_PartitionedGrid[] = { - {(char *)"my_data", __pyx_getprop_2yt_9amr_utils_15PartitionedGrid_my_data, __pyx_setprop_2yt_9amr_utils_15PartitionedGrid_my_data, 0, 0}, - {(char *)"LeftEdge", __pyx_getprop_2yt_9amr_utils_15PartitionedGrid_LeftEdge, __pyx_setprop_2yt_9amr_utils_15PartitionedGrid_LeftEdge, 0, 0}, - {(char *)"RightEdge", __pyx_getprop_2yt_9amr_utils_15PartitionedGrid_RightEdge, __pyx_setprop_2yt_9amr_utils_15PartitionedGrid_RightEdge, 0, 0}, - {(char *)"parent_grid_id", __pyx_getprop_2yt_9amr_utils_15PartitionedGrid_parent_grid_id, __pyx_setprop_2yt_9amr_utils_15PartitionedGrid_parent_grid_id, 0, 0}, - {(char *)"n_fields", __pyx_getprop_2yt_9amr_utils_15PartitionedGrid_n_fields, __pyx_setprop_2yt_9amr_utils_15PartitionedGrid_n_fields, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_PartitionedGrid = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION >= 3 - 0, /*reserved*/ - #else - 0, /*nb_long*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_PartitionedGrid = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_PartitionedGrid = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_PartitionedGrid = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -PyTypeObject __pyx_type_2yt_9amr_utils_PartitionedGrid = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("yt.amr_utils.PartitionedGrid"), /*tp_name*/ - sizeof(struct __pyx_obj_2yt_9amr_utils_PartitionedGrid), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_2yt_9amr_utils_PartitionedGrid, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION >= 3 - 0, /*reserved*/ - #else - 0, /*tp_compare*/ - #endif - 0, /*tp_repr*/ - &__pyx_tp_as_number_PartitionedGrid, /*tp_as_number*/ - &__pyx_tp_as_sequence_PartitionedGrid, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_PartitionedGrid, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_PartitionedGrid, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_2yt_9amr_utils_PartitionedGrid, /*tp_traverse*/ - __pyx_tp_clear_2yt_9amr_utils_PartitionedGrid, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_2yt_9amr_utils_PartitionedGrid, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_2yt_9amr_utils_PartitionedGrid, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_2yt_9amr_utils_PartitionedGrid, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_2yt_9amr_utils_GridFace __pyx_vtable_2yt_9amr_utils_GridFace; - -static PyObject *__pyx_tp_new_2yt_9amr_utils_GridFace(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_2yt_9amr_utils_GridFace *p; - PyObject *o = (*t->tp_alloc)(t, 0); - if (!o) return 0; - p = ((struct __pyx_obj_2yt_9amr_utils_GridFace *)o); - p->__pyx_vtab = __pyx_vtabptr_2yt_9amr_utils_GridFace; - return o; -} - -static void __pyx_tp_dealloc_2yt_9amr_utils_GridFace(PyObject *o) { - (*Py_TYPE(o)->tp_free)(o); -} - -static PyObject *__pyx_getprop_2yt_9amr_utils_8GridFace_coord(PyObject *o, void *x) { - return __pyx_pf_2yt_9amr_utils_8GridFace_5coord___get__(o); -} - -static int __pyx_setprop_2yt_9amr_utils_8GridFace_coord(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_2yt_9amr_utils_8GridFace_5coord___set__(o, v); - } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; - } -} - -static PyMethodDef __pyx_methods_2yt_9amr_utils_GridFace[] = { - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_2yt_9amr_utils_GridFace[] = { - {(char *)"coord", __pyx_getprop_2yt_9amr_utils_8GridFace_coord, __pyx_setprop_2yt_9amr_utils_8GridFace_coord, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_GridFace = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION >= 3 - 0, /*reserved*/ - #else - 0, /*nb_long*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_GridFace = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_GridFace = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_GridFace = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -PyTypeObject __pyx_type_2yt_9amr_utils_GridFace = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("yt.amr_utils.GridFace"), /*tp_name*/ - sizeof(struct __pyx_obj_2yt_9amr_utils_GridFace), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_2yt_9amr_utils_GridFace, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION >= 3 - 0, /*reserved*/ - #else - 0, /*tp_compare*/ - #endif - 0, /*tp_repr*/ - &__pyx_tp_as_number_GridFace, /*tp_as_number*/ - &__pyx_tp_as_sequence_GridFace, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_GridFace, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_GridFace, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/ - 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_2yt_9amr_utils_GridFace, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_2yt_9amr_utils_GridFace, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_pf_2yt_9amr_utils_8GridFace___init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_2yt_9amr_utils_GridFace, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_2yt_9amr_utils_ProtoPrism __pyx_vtable_2yt_9amr_utils_ProtoPrism; - -static PyObject *__pyx_tp_new_2yt_9amr_utils_ProtoPrism(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_2yt_9amr_utils_ProtoPrism *p; - PyObject *o = (*t->tp_alloc)(t, 0); - if (!o) return 0; - p = ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)o); - p->__pyx_vtab = __pyx_vtabptr_2yt_9amr_utils_ProtoPrism; - p->LeftEdge = Py_None; Py_INCREF(Py_None); - p->RightEdge = Py_None; Py_INCREF(Py_None); - p->subgrid_faces = Py_None; Py_INCREF(Py_None); - if (__pyx_pf_2yt_9amr_utils_10ProtoPrism___cinit__(o, a, k) < 0) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_2yt_9amr_utils_ProtoPrism(PyObject *o) { - struct __pyx_obj_2yt_9amr_utils_ProtoPrism *p = (struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)o; - Py_XDECREF(p->LeftEdge); - Py_XDECREF(p->RightEdge); - Py_XDECREF(p->subgrid_faces); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_2yt_9amr_utils_ProtoPrism(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_2yt_9amr_utils_ProtoPrism *p = (struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)o; - if (p->LeftEdge) { - e = (*v)(p->LeftEdge, a); if (e) return e; - } - if (p->RightEdge) { - e = (*v)(p->RightEdge, a); if (e) return e; - } - if (p->subgrid_faces) { - e = (*v)(p->subgrid_faces, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_2yt_9amr_utils_ProtoPrism(PyObject *o) { - struct __pyx_obj_2yt_9amr_utils_ProtoPrism *p = (struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)o; - PyObject* tmp; - tmp = ((PyObject*)p->LeftEdge); - p->LeftEdge = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->RightEdge); - p->RightEdge = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->subgrid_faces); - p->subgrid_faces = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyObject *__pyx_getprop_2yt_9amr_utils_10ProtoPrism_LeftEdge(PyObject *o, void *x) { - return __pyx_pf_2yt_9amr_utils_10ProtoPrism_8LeftEdge___get__(o); -} - -static int __pyx_setprop_2yt_9amr_utils_10ProtoPrism_LeftEdge(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_2yt_9amr_utils_10ProtoPrism_8LeftEdge___set__(o, v); - } - else { - return __pyx_pf_2yt_9amr_utils_10ProtoPrism_8LeftEdge___del__(o); - } -} - -static PyObject *__pyx_getprop_2yt_9amr_utils_10ProtoPrism_RightEdge(PyObject *o, void *x) { - return __pyx_pf_2yt_9amr_utils_10ProtoPrism_9RightEdge___get__(o); -} - -static int __pyx_setprop_2yt_9amr_utils_10ProtoPrism_RightEdge(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_2yt_9amr_utils_10ProtoPrism_9RightEdge___set__(o, v); - } - else { - return __pyx_pf_2yt_9amr_utils_10ProtoPrism_9RightEdge___del__(o); - } -} - -static PyObject *__pyx_getprop_2yt_9amr_utils_10ProtoPrism_subgrid_faces(PyObject *o, void *x) { - return __pyx_pf_2yt_9amr_utils_10ProtoPrism_13subgrid_faces___get__(o); -} - -static int __pyx_setprop_2yt_9amr_utils_10ProtoPrism_subgrid_faces(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_2yt_9amr_utils_10ProtoPrism_13subgrid_faces___set__(o, v); - } - else { - return __pyx_pf_2yt_9amr_utils_10ProtoPrism_13subgrid_faces___del__(o); - } -} - -static PyObject *__pyx_getprop_2yt_9amr_utils_10ProtoPrism_parent_grid_id(PyObject *o, void *x) { - return __pyx_pf_2yt_9amr_utils_10ProtoPrism_14parent_grid_id___get__(o); -} - -static int __pyx_setprop_2yt_9amr_utils_10ProtoPrism_parent_grid_id(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_2yt_9amr_utils_10ProtoPrism_14parent_grid_id___set__(o, v); - } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; - } -} - -static PyMethodDef __pyx_methods_2yt_9amr_utils_ProtoPrism[] = { - {__Pyx_NAMESTR("sweep"), (PyCFunction)__pyx_pf_2yt_9amr_utils_10ProtoPrism_sweep, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_brick"), (PyCFunction)__pyx_pf_2yt_9amr_utils_10ProtoPrism_get_brick, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_2yt_9amr_utils_ProtoPrism[] = { - {(char *)"LeftEdge", __pyx_getprop_2yt_9amr_utils_10ProtoPrism_LeftEdge, __pyx_setprop_2yt_9amr_utils_10ProtoPrism_LeftEdge, 0, 0}, - {(char *)"RightEdge", __pyx_getprop_2yt_9amr_utils_10ProtoPrism_RightEdge, __pyx_setprop_2yt_9amr_utils_10ProtoPrism_RightEdge, 0, 0}, - {(char *)"subgrid_faces", __pyx_getprop_2yt_9amr_utils_10ProtoPrism_subgrid_faces, __pyx_setprop_2yt_9amr_utils_10ProtoPrism_subgrid_faces, 0, 0}, - {(char *)"parent_grid_id", __pyx_getprop_2yt_9amr_utils_10ProtoPrism_parent_grid_id, __pyx_setprop_2yt_9amr_utils_10ProtoPrism_parent_grid_id, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_ProtoPrism = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION >= 3 - 0, /*reserved*/ - #else - 0, /*nb_long*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_ProtoPrism = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_ProtoPrism = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_ProtoPrism = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -PyTypeObject __pyx_type_2yt_9amr_utils_ProtoPrism = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("yt.amr_utils.ProtoPrism"), /*tp_name*/ - sizeof(struct __pyx_obj_2yt_9amr_utils_ProtoPrism), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_2yt_9amr_utils_ProtoPrism, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION >= 3 - 0, /*reserved*/ - #else - 0, /*tp_compare*/ - #endif - 0, /*tp_repr*/ - &__pyx_tp_as_number_ProtoPrism, /*tp_as_number*/ - &__pyx_tp_as_sequence_ProtoPrism, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_ProtoPrism, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_ProtoPrism, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_2yt_9amr_utils_ProtoPrism, /*tp_traverse*/ - __pyx_tp_clear_2yt_9amr_utils_ProtoPrism, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_2yt_9amr_utils_ProtoPrism, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_2yt_9amr_utils_ProtoPrism, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_2yt_9amr_utils_ProtoPrism, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_2yt_9amr_utils_QuadTree __pyx_vtable_2yt_9amr_utils_QuadTree; - -static PyObject *__pyx_tp_new_2yt_9amr_utils_QuadTree(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_2yt_9amr_utils_QuadTree *p; - PyObject *o = (*t->tp_alloc)(t, 0); - if (!o) return 0; - p = ((struct __pyx_obj_2yt_9amr_utils_QuadTree *)o); - p->__pyx_vtab = __pyx_vtabptr_2yt_9amr_utils_QuadTree; - if (__pyx_pf_2yt_9amr_utils_8QuadTree___cinit__(o, a, k) < 0) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_2yt_9amr_utils_QuadTree(PyObject *o) { - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pf_2yt_9amr_utils_8QuadTree___dealloc__(o); - if (PyErr_Occurred()) PyErr_WriteUnraisable(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); - } - (*Py_TYPE(o)->tp_free)(o); -} - -static PyMethodDef __pyx_methods_2yt_9amr_utils_QuadTree[] = { - {__Pyx_NAMESTR("add_array_to_tree"), (PyCFunction)__pyx_pf_2yt_9amr_utils_8QuadTree_add_array_to_tree, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("add_grid_to_tree"), (PyCFunction)__pyx_pf_2yt_9amr_utils_8QuadTree_add_grid_to_tree, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_all_from_level"), (PyCFunction)__pyx_pf_2yt_9amr_utils_8QuadTree_get_all_from_level, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_QuadTree = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION >= 3 - 0, /*reserved*/ - #else - 0, /*nb_long*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_QuadTree = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_QuadTree = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_QuadTree = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -PyTypeObject __pyx_type_2yt_9amr_utils_QuadTree = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("yt.amr_utils.QuadTree"), /*tp_name*/ - sizeof(struct __pyx_obj_2yt_9amr_utils_QuadTree), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_2yt_9amr_utils_QuadTree, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION >= 3 - 0, /*reserved*/ - #else - 0, /*tp_compare*/ - #endif - 0, /*tp_repr*/ - &__pyx_tp_as_number_QuadTree, /*tp_as_number*/ - &__pyx_tp_as_sequence_QuadTree, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_QuadTree, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_QuadTree, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/ - 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_2yt_9amr_utils_QuadTree, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_2yt_9amr_utils_QuadTree, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static PyMethodDef __pyx_methods[] = { - {__Pyx_NAMESTR("RecurseOctreeDepthFirst"), (PyCFunction)__pyx_pf_2yt_9amr_utils_RecurseOctreeDepthFirst, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("RecurseOctreeByLevels"), (PyCFunction)__pyx_pf_2yt_9amr_utils_RecurseOctreeByLevels, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("UnilinearlyInterpolate"), (PyCFunction)__pyx_pf_2yt_9amr_utils_UnilinearlyInterpolate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("BilinearlyInterpolate"), (PyCFunction)__pyx_pf_2yt_9amr_utils_BilinearlyInterpolate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("TrilinearlyInterpolate"), (PyCFunction)__pyx_pf_2yt_9amr_utils_TrilinearlyInterpolate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("planar_points_in_volume"), (PyCFunction)__pyx_pf_2yt_9amr_utils_planar_points_in_volume, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("grid_points_in_volume"), (PyCFunction)__pyx_pf_2yt_9amr_utils_grid_points_in_volume, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("find_grids_in_inclined_box"), (PyCFunction)__pyx_pf_2yt_9amr_utils_find_grids_in_inclined_box, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("Transfer3D"), (PyCFunction)__pyx_pf_2yt_9amr_utils_Transfer3D, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2yt_9amr_utils_Transfer3D)}, - {__Pyx_NAMESTR("TransferShells"), (PyCFunction)__pyx_pf_2yt_9amr_utils_TransferShells, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2yt_9amr_utils_TransferShells)}, - {__Pyx_NAMESTR("Transfer1D"), (PyCFunction)__pyx_pf_2yt_9amr_utils_Transfer1D, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("VoxelTraversal"), (PyCFunction)__pyx_pf_2yt_9amr_utils_VoxelTraversal, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("PlaneVoxelIntegration"), (PyCFunction)__pyx_pf_2yt_9amr_utils_PlaneVoxelIntegration, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("integrate_ray"), (PyCFunction)__pyx_pf_2yt_9amr_utils_integrate_ray, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("CICDeposit_3"), (PyCFunction)__pyx_pf_2yt_9amr_utils_CICDeposit_3, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("construct_boundary_relationships"), (PyCFunction)__pyx_pf_2yt_9amr_utils_construct_boundary_relationships, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("identify_field_neighbors"), (PyCFunction)__pyx_pf_2yt_9amr_utils_identify_field_neighbors, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("extract_identified_contours"), (PyCFunction)__pyx_pf_2yt_9amr_utils_extract_identified_contours, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_png"), (PyCFunction)__pyx_pf_2yt_9amr_utils_write_png, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("add_points_to_image"), (PyCFunction)__pyx_pf_2yt_9amr_utils_add_points_to_image, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read_tiger_section"), (PyCFunction)__pyx_pf_2yt_9amr_utils_read_tiger_section, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {0, 0, 0, 0} -}; - -#if PY_MAJOR_VERSION >= 3 -static struct PyModuleDef __pyx_moduledef = { - PyModuleDef_HEAD_INIT, - __Pyx_NAMESTR("amr_utils"), - __Pyx_DOCSTR(__pyx_k_13), /* m_doc */ - -1, /* m_size */ - __pyx_methods /* m_methods */, - NULL, /* m_reload */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; -#endif - -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_n_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 1}, - {&__pyx_kp_u_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 1, 0, 0}, - {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0}, - {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0, 0}, - {&__pyx_kp_u_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 1, 0, 0}, - {&__pyx_kp_u_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 1, 0, 0}, - {&__pyx_n_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 1}, - {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, - {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, - {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0}, - {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0}, - {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, - {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0}, - {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0}, - {&__pyx_n_s__Channel, __pyx_k__Channel, sizeof(__pyx_k__Channel), 0, 0, 1, 1}, - {&__pyx_n_s__F, __pyx_k__F, sizeof(__pyx_k__F), 0, 0, 1, 1}, - {&__pyx_n_s__LeftEdge, __pyx_k__LeftEdge, sizeof(__pyx_k__LeftEdge), 0, 0, 1, 1}, - {&__pyx_n_s__RightEdge, __pyx_k__RightEdge, sizeof(__pyx_k__RightEdge), 0, 0, 1, 1}, - {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, - {&__pyx_n_s__Transfer3D, __pyx_k__Transfer3D, sizeof(__pyx_k__Transfer3D), 0, 0, 1, 1}, - {&__pyx_n_s__TransferShells, __pyx_k__TransferShells, sizeof(__pyx_k__TransferShells), 0, 0, 1, 1}, - {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, - {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, - {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, - {&__pyx_n_s__a, __pyx_k__a, sizeof(__pyx_k__a), 0, 0, 1, 1}, - {&__pyx_n_s__acenter, __pyx_k__acenter, sizeof(__pyx_k__acenter), 0, 0, 1, 1}, - {&__pyx_n_s__add_to_position, __pyx_k__add_to_position, sizeof(__pyx_k__add_to_position), 0, 0, 1, 1}, - {&__pyx_n_s__aimage, __pyx_k__aimage, sizeof(__pyx_k__aimage), 0, 0, 1, 1}, - {&__pyx_n_s__alpha, __pyx_k__alpha, sizeof(__pyx_k__alpha), 0, 0, 1, 1}, - {&__pyx_n_s__avp_dir, __pyx_k__avp_dir, sizeof(__pyx_k__avp_dir), 0, 0, 1, 1}, - {&__pyx_n_s__avp_pos, __pyx_k__avp_pos, sizeof(__pyx_k__avp_pos), 0, 0, 1, 1}, - {&__pyx_n_s__ax_vec, __pyx_k__ax_vec, sizeof(__pyx_k__ax_vec), 0, 0, 1, 1}, - {&__pyx_n_s__ay_vec, __pyx_k__ay_vec, sizeof(__pyx_k__ay_vec), 0, 0, 1, 1}, - {&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1}, - {&__pyx_n_s__blue, __pyx_k__blue, sizeof(__pyx_k__blue), 0, 0, 1, 1}, - {&__pyx_n_s__bounds, __pyx_k__bounds, sizeof(__pyx_k__bounds), 0, 0, 1, 1}, - {&__pyx_n_s__box_center, __pyx_k__box_center, sizeof(__pyx_k__box_center), 0, 0, 1, 1}, - {&__pyx_n_s__box_lengths, __pyx_k__box_lengths, sizeof(__pyx_k__box_lengths), 0, 0, 1, 1}, - {&__pyx_n_s__box_origin, __pyx_k__box_origin, sizeof(__pyx_k__box_origin), 0, 0, 1, 1}, - {&__pyx_n_s__box_vectors, __pyx_k__box_vectors, sizeof(__pyx_k__box_vectors), 0, 0, 1, 1}, - {&__pyx_n_s__break_first, __pyx_k__break_first, sizeof(__pyx_k__break_first), 0, 0, 1, 1}, - {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1}, - {&__pyx_n_s__buffer, __pyx_k__buffer, sizeof(__pyx_k__buffer), 0, 0, 1, 1}, - {&__pyx_n_s__byteorder, __pyx_k__byteorder, sizeof(__pyx_k__byteorder), 0, 0, 1, 1}, - {&__pyx_n_s__calculate_extent, __pyx_k__calculate_extent, sizeof(__pyx_k__calculate_extent), 0, 0, 1, 1}, - {&__pyx_n_s__cellSize, __pyx_k__cellSize, sizeof(__pyx_k__cellSize), 0, 0, 1, 1}, - {&__pyx_n_s__center, __pyx_k__center, sizeof(__pyx_k__center), 0, 0, 1, 1}, - {&__pyx_n_s__child_indices, __pyx_k__child_indices, sizeof(__pyx_k__child_indices), 0, 0, 1, 1}, - {&__pyx_n_s__child_mask, __pyx_k__child_mask, sizeof(__pyx_k__child_mask), 0, 0, 1, 1}, - {&__pyx_n_s__children, __pyx_k__children, sizeof(__pyx_k__children), 0, 0, 1, 1}, - {&__pyx_n_s__cm, __pyx_k__cm, sizeof(__pyx_k__cm), 0, 0, 1, 1}, - {&__pyx_n_s__coord, __pyx_k__coord, sizeof(__pyx_k__coord), 0, 0, 1, 1}, - {&__pyx_n_s__copy, __pyx_k__copy, sizeof(__pyx_k__copy), 0, 0, 1, 1}, - {&__pyx_n_s__copy_back, __pyx_k__copy_back, sizeof(__pyx_k__copy_back), 0, 0, 1, 1}, - {&__pyx_n_s__copy_into, __pyx_k__copy_into, sizeof(__pyx_k__copy_into), 0, 0, 1, 1}, - {&__pyx_n_s__corners, __pyx_k__corners, sizeof(__pyx_k__corners), 0, 0, 1, 1}, - {&__pyx_n_s__count_at_level, __pyx_k__count_at_level, sizeof(__pyx_k__count_at_level), 0, 0, 1, 1}, - {&__pyx_n_s__count_only, __pyx_k__count_only, sizeof(__pyx_k__count_only), 0, 0, 1, 1}, - {&__pyx_n_s__curpos, __pyx_k__curpos, sizeof(__pyx_k__curpos), 0, 0, 1, 1}, - {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1}, - {&__pyx_n_s__dbin, __pyx_k__dbin, sizeof(__pyx_k__dbin), 0, 0, 1, 1}, - {&__pyx_n_s__dds, __pyx_k__dds, sizeof(__pyx_k__dds), 0, 0, 1, 1}, - {&__pyx_n_s__descr, __pyx_k__descr, sizeof(__pyx_k__descr), 0, 0, 1, 1}, - {&__pyx_n_s__dimensions, __pyx_k__dimensions, sizeof(__pyx_k__dimensions), 0, 0, 1, 1}, - {&__pyx_n_s__dims, __pyx_k__dims, sizeof(__pyx_k__dims), 0, 0, 1, 1}, - {&__pyx_n_s__direction, __pyx_k__direction, sizeof(__pyx_k__direction), 0, 0, 1, 1}, - {&__pyx_n_s__dpi, __pyx_k__dpi, sizeof(__pyx_k__dpi), 0, 0, 1, 1}, - {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, - {&__pyx_n_s__dvs, __pyx_k__dvs, sizeof(__pyx_k__dvs), 0, 0, 1, 1}, - {&__pyx_n_s__dx, __pyx_k__dx, sizeof(__pyx_k__dx), 0, 0, 1, 1}, - {&__pyx_n_s__dy, __pyx_k__dy, sizeof(__pyx_k__dy), 0, 0, 1, 1}, - {&__pyx_n_s__dz, __pyx_k__dz, sizeof(__pyx_k__dz), 0, 0, 1, 1}, - {&__pyx_n_s__e, __pyx_k__e, sizeof(__pyx_k__e), 0, 0, 1, 1}, - {&__pyx_n_s__empty, __pyx_k__empty, sizeof(__pyx_k__empty), 0, 0, 1, 1}, - {&__pyx_n_s__eval_transfer, __pyx_k__eval_transfer, sizeof(__pyx_k__eval_transfer), 0, 0, 1, 1}, - {&__pyx_n_s__field, __pyx_k__field, sizeof(__pyx_k__field), 0, 0, 1, 1}, - {&__pyx_n_s__field_id, __pyx_k__field_id, sizeof(__pyx_k__field_id), 0, 0, 1, 1}, - {&__pyx_n_s__field_ids, __pyx_k__field_ids, sizeof(__pyx_k__field_ids), 0, 0, 1, 1}, - {&__pyx_n_s__field_table_ids, __pyx_k__field_table_ids, sizeof(__pyx_k__field_table_ids), 0, 0, 1, 1}, - {&__pyx_n_s__field_tables, __pyx_k__field_tables, sizeof(__pyx_k__field_tables), 0, 0, 1, 1}, - {&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1}, - {&__pyx_n_s__filename, __pyx_k__filename, sizeof(__pyx_k__filename), 0, 0, 1, 1}, - {&__pyx_n_s__fill_from_level, __pyx_k__fill_from_level, sizeof(__pyx_k__fill_from_level), 0, 0, 1, 1}, - {&__pyx_n_s__find_on_root_level, __pyx_k__find_on_root_level, sizeof(__pyx_k__find_on_root_level), 0, 0, 1, 1}, - {&__pyx_n_s__float32, __pyx_k__float32, sizeof(__pyx_k__float32), 0, 0, 1, 1}, - {&__pyx_n_s__float64, __pyx_k__float64, sizeof(__pyx_k__float64), 0, 0, 1, 1}, - {&__pyx_n_s__floor, __pyx_k__floor, sizeof(__pyx_k__floor), 0, 0, 1, 1}, - {&__pyx_n_s__fn, __pyx_k__fn, sizeof(__pyx_k__fn), 0, 0, 1, 1}, - {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1}, - {&__pyx_n_s__genealogy, __pyx_k__genealogy, sizeof(__pyx_k__genealogy), 0, 0, 1, 1}, - {&__pyx_n_s__get_start_stop, __pyx_k__get_start_stop, sizeof(__pyx_k__get_start_stop), 0, 0, 1, 1}, - {&__pyx_n_s__gi, __pyx_k__gi, sizeof(__pyx_k__gi), 0, 0, 1, 1}, - {&__pyx_n_s__gray, __pyx_k__gray, sizeof(__pyx_k__gray), 0, 0, 1, 1}, - {&__pyx_n_s__green, __pyx_k__green, sizeof(__pyx_k__green), 0, 0, 1, 1}, - {&__pyx_n_s__grid, __pyx_k__grid, sizeof(__pyx_k__grid), 0, 0, 1, 1}, - {&__pyx_n_s__gridDimension, __pyx_k__gridDimension, sizeof(__pyx_k__gridDimension), 0, 0, 1, 1}, - {&__pyx_n_s__grid_dds, __pyx_k__grid_dds, sizeof(__pyx_k__grid_dds), 0, 0, 1, 1}, - {&__pyx_n_s__grid_dt, __pyx_k__grid_dt, sizeof(__pyx_k__grid_dt), 0, 0, 1, 1}, - {&__pyx_n_s__grid_left_edge, __pyx_k__grid_left_edge, sizeof(__pyx_k__grid_left_edge), 0, 0, 1, 1}, - {&__pyx_n_s__grid_left_edges, __pyx_k__grid_left_edges, sizeof(__pyx_k__grid_left_edges), 0, 0, 1, 1}, - {&__pyx_n_s__grid_mask, __pyx_k__grid_mask, sizeof(__pyx_k__grid_mask), 0, 0, 1, 1}, - {&__pyx_n_s__grid_right_edge, __pyx_k__grid_right_edge, sizeof(__pyx_k__grid_right_edge), 0, 0, 1, 1}, - {&__pyx_n_s__grid_right_edges, __pyx_k__grid_right_edges, sizeof(__pyx_k__grid_right_edges), 0, 0, 1, 1}, - {&__pyx_n_s__grid_t, __pyx_k__grid_t, sizeof(__pyx_k__grid_t), 0, 0, 1, 1}, - {&__pyx_n_s__grids, __pyx_k__grids, sizeof(__pyx_k__grids), 0, 0, 1, 1}, - {&__pyx_n_s__i_f, __pyx_k__i_f, sizeof(__pyx_k__i_f), 0, 0, 1, 1}, - {&__pyx_n_s__i_i, __pyx_k__i_i, sizeof(__pyx_k__i_i), 0, 0, 1, 1}, - {&__pyx_n_s__i_s, __pyx_k__i_s, sizeof(__pyx_k__i_s), 0, 0, 1, 1}, - {&__pyx_n_s__idbin, __pyx_k__idbin, sizeof(__pyx_k__idbin), 0, 0, 1, 1}, - {&__pyx_n_s__idds, __pyx_k__idds, sizeof(__pyx_k__idds), 0, 0, 1, 1}, - {&__pyx_n_s__im_strides, __pyx_k__im_strides, sizeof(__pyx_k__im_strides), 0, 0, 1, 1}, - {&__pyx_n_s__image, __pyx_k__image, sizeof(__pyx_k__image), 0, 0, 1, 1}, - {&__pyx_n_s__imax, __pyx_k__imax, sizeof(__pyx_k__imax), 0, 0, 1, 1}, - {&__pyx_n_s__imin, __pyx_k__imin, sizeof(__pyx_k__imin), 0, 0, 1, 1}, - {&__pyx_n_s__ind, __pyx_k__ind, sizeof(__pyx_k__ind), 0, 0, 1, 1}, - {&__pyx_n_s__int32, __pyx_k__int32, sizeof(__pyx_k__int32), 0, 0, 1, 1}, - {&__pyx_n_s__int64, __pyx_k__int64, sizeof(__pyx_k__int64), 0, 0, 1, 1}, - {&__pyx_n_s__int8, __pyx_k__int8, sizeof(__pyx_k__int8), 0, 0, 1, 1}, - {&__pyx_n_s__integrate_ray, __pyx_k__integrate_ray, sizeof(__pyx_k__integrate_ray), 0, 0, 1, 1}, - {&__pyx_n_s__istorage, __pyx_k__istorage, sizeof(__pyx_k__istorage), 0, 0, 1, 1}, - {&__pyx_n_s__istride, __pyx_k__istride, sizeof(__pyx_k__istride), 0, 0, 1, 1}, - {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1}, - {&__pyx_n_s__j_f, __pyx_k__j_f, sizeof(__pyx_k__j_f), 0, 0, 1, 1}, - {&__pyx_n_s__j_i, __pyx_k__j_i, sizeof(__pyx_k__j_i), 0, 0, 1, 1}, - {&__pyx_n_s__jmax, __pyx_k__jmax, sizeof(__pyx_k__jmax), 0, 0, 1, 1}, - {&__pyx_n_s__jmin, __pyx_k__jmin, sizeof(__pyx_k__jmin), 0, 0, 1, 1}, - {&__pyx_n_s__joins, __pyx_k__joins, sizeof(__pyx_k__joins), 0, 0, 1, 1}, - {&__pyx_n_s__jstride, __pyx_k__jstride, sizeof(__pyx_k__jstride), 0, 0, 1, 1}, - {&__pyx_n_s__k_f, __pyx_k__k_f, sizeof(__pyx_k__k_f), 0, 0, 1, 1}, - {&__pyx_n_s__k_i, __pyx_k__k_i, sizeof(__pyx_k__k_i), 0, 0, 1, 1}, - {&__pyx_n_s__kmax, __pyx_k__kmax, sizeof(__pyx_k__kmax), 0, 0, 1, 1}, - {&__pyx_n_s__kmin, __pyx_k__kmin, sizeof(__pyx_k__kmin), 0, 0, 1, 1}, - {&__pyx_n_s__left, __pyx_k__left, sizeof(__pyx_k__left), 0, 0, 1, 1}, - {&__pyx_n_s__leftEdge, __pyx_k__leftEdge, sizeof(__pyx_k__leftEdge), 0, 0, 1, 1}, - {&__pyx_n_s__left_edge, __pyx_k__left_edge, sizeof(__pyx_k__left_edge), 0, 0, 1, 1}, - {&__pyx_n_s__left_edges, __pyx_k__left_edges, sizeof(__pyx_k__left_edges), 0, 0, 1, 1}, - {&__pyx_n_s__level, __pyx_k__level, sizeof(__pyx_k__level), 0, 0, 1, 1}, - {&__pyx_n_s__mask, __pyx_k__mask, sizeof(__pyx_k__mask), 0, 0, 1, 1}, - {&__pyx_n_s__mass, __pyx_k__mass, sizeof(__pyx_k__mass), 0, 0, 1, 1}, - {&__pyx_n_s__max_ind, __pyx_k__max_ind, sizeof(__pyx_k__max_ind), 0, 0, 1, 1}, - {&__pyx_n_s__my_data, __pyx_k__my_data, sizeof(__pyx_k__my_data), 0, 0, 1, 1}, - {&__pyx_n_s__my_field_tables, __pyx_k__my_field_tables, sizeof(__pyx_k__my_field_tables), 0, 0, 1, 1}, - {&__pyx_n_s__n_field_tables, __pyx_k__n_field_tables, sizeof(__pyx_k__n_field_tables), 0, 0, 1, 1}, - {&__pyx_n_s__n_fields, __pyx_k__n_fields, sizeof(__pyx_k__n_fields), 0, 0, 1, 1}, - {&__pyx_n_s__names, __pyx_k__names, sizeof(__pyx_k__names), 0, 0, 1, 1}, - {&__pyx_n_s__nbins, __pyx_k__nbins, sizeof(__pyx_k__nbins), 0, 0, 1, 1}, - {&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1}, - {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, - {&__pyx_n_s__npositions, __pyx_k__npositions, sizeof(__pyx_k__npositions), 0, 0, 1, 1}, - {&__pyx_n_s__ns, __pyx_k__ns, sizeof(__pyx_k__ns), 0, 0, 1, 1}, - {&__pyx_n_s__nshells, __pyx_k__nshells, sizeof(__pyx_k__nshells), 0, 0, 1, 1}, - {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, - {&__pyx_n_s__nv, __pyx_k__nv, sizeof(__pyx_k__nv), 0, 0, 1, 1}, - {&__pyx_n_s__nvals, __pyx_k__nvals, sizeof(__pyx_k__nvals), 0, 0, 1, 1}, - {&__pyx_n_s__o_s, __pyx_k__o_s, sizeof(__pyx_k__o_s), 0, 0, 1, 1}, - {&__pyx_n_s__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1}, - {&__pyx_n_s__offset, __pyx_k__offset, sizeof(__pyx_k__offset), 0, 0, 1, 1}, - {&__pyx_n_s__order, __pyx_k__order, sizeof(__pyx_k__order), 0, 0, 1, 1}, - {&__pyx_n_s__output, __pyx_k__output, sizeof(__pyx_k__output), 0, 0, 1, 1}, - {&__pyx_n_s__output_pos, __pyx_k__output_pos, sizeof(__pyx_k__output_pos), 0, 0, 1, 1}, - {&__pyx_n_s__parent_grid_id, __pyx_k__parent_grid_id, sizeof(__pyx_k__parent_grid_id), 0, 0, 1, 1}, - {&__pyx_n_s__pass_through, __pyx_k__pass_through, sizeof(__pyx_k__pass_through), 0, 0, 1, 1}, - {&__pyx_n_s__pdx, __pyx_k__pdx, sizeof(__pyx_k__pdx), 0, 0, 1, 1}, - {&__pyx_n_s__pdy, __pyx_k__pdy, sizeof(__pyx_k__pdy), 0, 0, 1, 1}, - {&__pyx_n_s__pmask, __pyx_k__pmask, sizeof(__pyx_k__pmask), 0, 0, 1, 1}, - {&__pyx_n_s__po2, __pyx_k__po2, sizeof(__pyx_k__po2), 0, 0, 1, 1}, - {&__pyx_n_s__points, __pyx_k__points, sizeof(__pyx_k__points), 0, 0, 1, 1}, - {&__pyx_n_s__pos, __pyx_k__pos, sizeof(__pyx_k__pos), 0, 0, 1, 1}, - {&__pyx_n_s__posx, __pyx_k__posx, sizeof(__pyx_k__posx), 0, 0, 1, 1}, - {&__pyx_n_s__posy, __pyx_k__posy, sizeof(__pyx_k__posy), 0, 0, 1, 1}, - {&__pyx_n_s__posz, __pyx_k__posz, sizeof(__pyx_k__posz), 0, 0, 1, 1}, - {&__pyx_n_s__proj_overlap, __pyx_k__proj_overlap, sizeof(__pyx_k__proj_overlap), 0, 0, 1, 1}, - {&__pyx_n_s__pv, __pyx_k__pv, sizeof(__pyx_k__pv), 0, 0, 1, 1}, - {&__pyx_n_s__pvals, __pyx_k__pvals, sizeof(__pyx_k__pvals), 0, 0, 1, 1}, - {&__pyx_n_s__pweight_vals, __pyx_k__pweight_vals, sizeof(__pyx_k__pweight_vals), 0, 0, 1, 1}, - {&__pyx_n_s__px, __pyx_k__px, sizeof(__pyx_k__px), 0, 0, 1, 1}, - {&__pyx_n_s__pxs, __pyx_k__pxs, sizeof(__pyx_k__pxs), 0, 0, 1, 1}, - {&__pyx_n_s__py, __pyx_k__py, sizeof(__pyx_k__py), 0, 0, 1, 1}, - {&__pyx_n_s__pys, __pyx_k__pys, sizeof(__pyx_k__pys), 0, 0, 1, 1}, - {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, - {&__pyx_n_s__readonly, __pyx_k__readonly, sizeof(__pyx_k__readonly), 0, 0, 1, 1}, - {&__pyx_n_s__red, __pyx_k__red, sizeof(__pyx_k__red), 0, 0, 1, 1}, - {&__pyx_n_s__refined, __pyx_k__refined, sizeof(__pyx_k__refined), 0, 0, 1, 1}, - {&__pyx_n_s__refined_pos, __pyx_k__refined_pos, sizeof(__pyx_k__refined_pos), 0, 0, 1, 1}, - {&__pyx_n_s__right_edge, __pyx_k__right_edge, sizeof(__pyx_k__right_edge), 0, 0, 1, 1}, - {&__pyx_n_s__root_nodes, __pyx_k__root_nodes, sizeof(__pyx_k__root_nodes), 0, 0, 1, 1}, - {&__pyx_n_s__root_size, __pyx_k__root_size, sizeof(__pyx_k__root_size), 0, 0, 1, 1}, - {&__pyx_n_s__rot_mat, __pyx_k__rot_mat, sizeof(__pyx_k__rot_mat), 0, 0, 1, 1}, - {&__pyx_n_s__sample_values, __pyx_k__sample_values, sizeof(__pyx_k__sample_values), 0, 0, 1, 1}, - {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, - {&__pyx_n_s__shells, __pyx_k__shells, sizeof(__pyx_k__shells), 0, 0, 1, 1}, - {&__pyx_n_s__slab_size, __pyx_k__slab_size, sizeof(__pyx_k__slab_size), 0, 0, 1, 1}, - {&__pyx_n_s__slab_start, __pyx_k__slab_start, sizeof(__pyx_k__slab_start), 0, 0, 1, 1}, - {&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 0, 0, 1, 1}, - {&__pyx_n_s__stack, __pyx_k__stack, sizeof(__pyx_k__stack), 0, 0, 1, 1}, - {&__pyx_n_s__start_index, __pyx_k__start_index, sizeof(__pyx_k__start_index), 0, 0, 1, 1}, - {&__pyx_n_s__strides, __pyx_k__strides, sizeof(__pyx_k__strides), 0, 0, 1, 1}, - {&__pyx_n_s__subgrid_faces, __pyx_k__subgrid_faces, sizeof(__pyx_k__subgrid_faces), 0, 0, 1, 1}, - {&__pyx_n_s__suboffsets, __pyx_k__suboffsets, sizeof(__pyx_k__suboffsets), 0, 0, 1, 1}, - {&__pyx_n_s__sweep, __pyx_k__sweep, sizeof(__pyx_k__sweep), 0, 0, 1, 1}, - {&__pyx_n_s__table, __pyx_k__table, sizeof(__pyx_k__table), 0, 0, 1, 1}, - {&__pyx_n_s__tables, __pyx_k__tables, sizeof(__pyx_k__tables), 0, 0, 1, 1}, - {&__pyx_n_s__tf, __pyx_k__tf, sizeof(__pyx_k__tf), 0, 0, 1, 1}, - {&__pyx_n_s__tf_obj, __pyx_k__tf_obj, sizeof(__pyx_k__tf_obj), 0, 0, 1, 1}, - {&__pyx_n_s__top_grid_dims, __pyx_k__top_grid_dims, sizeof(__pyx_k__top_grid_dims), 0, 0, 1, 1}, - {&__pyx_n_s__type_num, __pyx_k__type_num, sizeof(__pyx_k__type_num), 0, 0, 1, 1}, - {&__pyx_n_s__u, __pyx_k__u, sizeof(__pyx_k__u), 0, 0, 1, 1}, - {&__pyx_n_s__ug, __pyx_k__ug, sizeof(__pyx_k__ug), 0, 0, 1, 1}, - {&__pyx_n_s__v, __pyx_k__v, sizeof(__pyx_k__v), 0, 0, 1, 1}, - {&__pyx_n_s__val, __pyx_k__val, sizeof(__pyx_k__val), 0, 0, 1, 1}, - {&__pyx_n_s__values, __pyx_k__values, sizeof(__pyx_k__values), 0, 0, 1, 1}, - {&__pyx_n_s__vd_strides, __pyx_k__vd_strides, sizeof(__pyx_k__vd_strides), 0, 0, 1, 1}, - {&__pyx_n_s__vp, __pyx_k__vp, sizeof(__pyx_k__vp), 0, 0, 1, 1}, - {&__pyx_n_s__vp_dir, __pyx_k__vp_dir, sizeof(__pyx_k__vp_dir), 0, 0, 1, 1}, - {&__pyx_n_s__vp_pos, __pyx_k__vp_pos, sizeof(__pyx_k__vp_pos), 0, 0, 1, 1}, - {&__pyx_n_s__vp_strides, __pyx_k__vp_strides, sizeof(__pyx_k__vp_strides), 0, 0, 1, 1}, - {&__pyx_n_s__weight_field_id, __pyx_k__weight_field_id, sizeof(__pyx_k__weight_field_id), 0, 0, 1, 1}, - {&__pyx_n_s__weight_field_ids, __pyx_k__weight_field_ids, sizeof(__pyx_k__weight_field_ids), 0, 0, 1, 1}, - {&__pyx_n_s__weight_table_id, __pyx_k__weight_table_id, sizeof(__pyx_k__weight_table_id), 0, 0, 1, 1}, - {&__pyx_n_s__weight_table_ids, __pyx_k__weight_table_ids, sizeof(__pyx_k__weight_table_ids), 0, 0, 1, 1}, - {&__pyx_n_s__weight_val, __pyx_k__weight_val, sizeof(__pyx_k__weight_val), 0, 0, 1, 1}, - {&__pyx_n_s__wvals, __pyx_k__wvals, sizeof(__pyx_k__wvals), 0, 0, 1, 1}, - {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1}, - {&__pyx_n_s__x_bins, __pyx_k__x_bins, sizeof(__pyx_k__x_bins), 0, 0, 1, 1}, - {&__pyx_n_s__x_bounds, __pyx_k__x_bounds, sizeof(__pyx_k__x_bounds), 0, 0, 1, 1}, - {&__pyx_n_s__x_is, __pyx_k__x_is, sizeof(__pyx_k__x_is), 0, 0, 1, 1}, - {&__pyx_n_s__x_vals, __pyx_k__x_vals, sizeof(__pyx_k__x_vals), 0, 0, 1, 1}, - {&__pyx_n_s__x_vec, __pyx_k__x_vec, sizeof(__pyx_k__x_vec), 0, 0, 1, 1}, - {&__pyx_n_s__xrange, __pyx_k__xrange, sizeof(__pyx_k__xrange), 0, 0, 1, 1}, - {&__pyx_n_s__y, __pyx_k__y, sizeof(__pyx_k__y), 0, 0, 1, 1}, - {&__pyx_n_s__y_bins, __pyx_k__y_bins, sizeof(__pyx_k__y_bins), 0, 0, 1, 1}, - {&__pyx_n_s__y_is, __pyx_k__y_is, sizeof(__pyx_k__y_is), 0, 0, 1, 1}, - {&__pyx_n_s__y_vals, __pyx_k__y_vals, sizeof(__pyx_k__y_vals), 0, 0, 1, 1}, - {&__pyx_n_s__y_vec, __pyx_k__y_vec, sizeof(__pyx_k__y_vec), 0, 0, 1, 1}, - {&__pyx_n_s__z, __pyx_k__z, sizeof(__pyx_k__z), 0, 0, 1, 1}, - {&__pyx_n_s__z_bins, __pyx_k__z_bins, sizeof(__pyx_k__z_bins), 0, 0, 1, 1}, - {&__pyx_n_s__z_is, __pyx_k__z_is, sizeof(__pyx_k__z_is), 0, 0, 1, 1}, - {&__pyx_n_s__z_vals, __pyx_k__z_vals, sizeof(__pyx_k__z_vals), 0, 0, 1, 1}, - {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; -static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #if PY_MAJOR_VERSION >= 3 - __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - return 0; - __pyx_L1_error:; - return -1; -} - -static int __Pyx_InitGlobals(void) { - #if PY_VERSION_HEX < 0x02040000 - if (unlikely(__Pyx_Py23SetsImport() < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[11]; __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[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - return 0; - __pyx_L1_error:; - return -1; -} - -#if PY_MAJOR_VERSION < 3 -PyMODINIT_FUNC initamr_utils(void); /*proto*/ -PyMODINIT_FUNC initamr_utils(void) -#else -PyMODINIT_FUNC PyInit_amr_utils(void); /*proto*/ -PyMODINIT_FUNC PyInit_amr_utils(void) -#endif -{ - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - #if CYTHON_REFNANNY - void* __pyx_refnanny = NULL; - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); - if (!__Pyx_RefNanny) { - PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); - } - __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_amr_utils(void)", __LINE__, __FILE__); - #endif - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #ifdef __pyx_binding_PyCFunctionType_USED - if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - /*--- Library function declarations ---*/ - /*--- Threads initialization code ---*/ - #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - #ifdef WITH_THREAD /* Python build with threading support? */ - PyEval_InitThreads(); - #endif - #endif - /*--- Module creation code ---*/ - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("amr_utils"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_13), 0, PYTHON_API_VERSION); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (!__pyx_m) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - #if PY_MAJOR_VERSION < 3 - Py_INCREF(__pyx_m); - #endif - __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); - if (!__pyx_b) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - /*--- Initialize various global constants etc. ---*/ - if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_module_is_main_yt__amr_utils) { - if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - } - /*--- Builtin init code ---*/ - if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /*--- Global init code ---*/ - /*--- Function export code ---*/ - /*--- Type init code ---*/ - if (PyType_Ready(&__pyx_type_2yt_9amr_utils_position) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "position", (PyObject *)&__pyx_type_2yt_9amr_utils_position) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_2yt_9amr_utils_position = &__pyx_type_2yt_9amr_utils_position; - if (PyType_Ready(&__pyx_type_2yt_9amr_utils_OctreeGrid) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "OctreeGrid", (PyObject *)&__pyx_type_2yt_9amr_utils_OctreeGrid) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_2yt_9amr_utils_OctreeGrid = &__pyx_type_2yt_9amr_utils_OctreeGrid; - if (PyType_Ready(&__pyx_type_2yt_9amr_utils_OctreeGridList) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "OctreeGridList", (PyObject *)&__pyx_type_2yt_9amr_utils_OctreeGridList) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_2yt_9amr_utils_OctreeGridList = &__pyx_type_2yt_9amr_utils_OctreeGridList; - __pyx_vtabptr_2yt_9amr_utils_VectorPlane = &__pyx_vtable_2yt_9amr_utils_VectorPlane; - #if PY_MAJOR_VERSION >= 3 - __pyx_vtable_2yt_9amr_utils_VectorPlane.get_start_stop = (void (*)(struct __pyx_obj_2yt_9amr_utils_VectorPlane *, __pyx_t_5numpy_float64_t *, int *))__pyx_f_2yt_9amr_utils_11VectorPlane_get_start_stop; - __pyx_vtable_2yt_9amr_utils_VectorPlane.copy_into = (void (*)(struct __pyx_obj_2yt_9amr_utils_VectorPlane *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, int, int, int, int *))__pyx_f_2yt_9amr_utils_11VectorPlane_copy_into; - __pyx_vtable_2yt_9amr_utils_VectorPlane.copy_back = (void (*)(struct __pyx_obj_2yt_9amr_utils_VectorPlane *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, int, int, int, int *))__pyx_f_2yt_9amr_utils_11VectorPlane_copy_back; - #else - *(void(**)(void))&__pyx_vtable_2yt_9amr_utils_VectorPlane.get_start_stop = (void(*)(void))__pyx_f_2yt_9amr_utils_11VectorPlane_get_start_stop; - *(void(**)(void))&__pyx_vtable_2yt_9amr_utils_VectorPlane.copy_into = (void(*)(void))__pyx_f_2yt_9amr_utils_11VectorPlane_copy_into; - *(void(**)(void))&__pyx_vtable_2yt_9amr_utils_VectorPlane.copy_back = (void(*)(void))__pyx_f_2yt_9amr_utils_11VectorPlane_copy_back; - #endif - if (PyType_Ready(&__pyx_type_2yt_9amr_utils_VectorPlane) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_2yt_9amr_utils_VectorPlane.tp_dict, __pyx_vtabptr_2yt_9amr_utils_VectorPlane) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "VectorPlane", (PyObject *)&__pyx_type_2yt_9amr_utils_VectorPlane) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_2yt_9amr_utils_VectorPlane = &__pyx_type_2yt_9amr_utils_VectorPlane; - __pyx_vtabptr_2yt_9amr_utils_TransferFunctionProxy = &__pyx_vtable_2yt_9amr_utils_TransferFunctionProxy; - #if PY_MAJOR_VERSION >= 3 - __pyx_vtable_2yt_9amr_utils_TransferFunctionProxy.eval_transfer = (void (*)(struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *))__pyx_f_2yt_9amr_utils_21TransferFunctionProxy_eval_transfer; - #else - *(void(**)(void))&__pyx_vtable_2yt_9amr_utils_TransferFunctionProxy.eval_transfer = (void(*)(void))__pyx_f_2yt_9amr_utils_21TransferFunctionProxy_eval_transfer; - #endif - if (PyType_Ready(&__pyx_type_2yt_9amr_utils_TransferFunctionProxy) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_2yt_9amr_utils_TransferFunctionProxy.tp_dict, __pyx_vtabptr_2yt_9amr_utils_TransferFunctionProxy) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "TransferFunctionProxy", (PyObject *)&__pyx_type_2yt_9amr_utils_TransferFunctionProxy) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_2yt_9amr_utils_TransferFunctionProxy = &__pyx_type_2yt_9amr_utils_TransferFunctionProxy; - __pyx_vtabptr_2yt_9amr_utils_PartitionedGrid = &__pyx_vtable_2yt_9amr_utils_PartitionedGrid; - #if PY_MAJOR_VERSION >= 3 - __pyx_vtable_2yt_9amr_utils_PartitionedGrid.calculate_extent = (void (*)(struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *, struct __pyx_obj_2yt_9amr_utils_VectorPlane *, __pyx_t_5numpy_float64_t *))__pyx_f_2yt_9amr_utils_15PartitionedGrid_calculate_extent; - __pyx_vtable_2yt_9amr_utils_PartitionedGrid.integrate_ray = (int (*)(struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *))__pyx_f_2yt_9amr_utils_15PartitionedGrid_integrate_ray; - __pyx_vtable_2yt_9amr_utils_PartitionedGrid.sample_values = (void (*)(struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, int *, __pyx_t_5numpy_float64_t *, struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *))__pyx_f_2yt_9amr_utils_15PartitionedGrid_sample_values; - #else - *(void(**)(void))&__pyx_vtable_2yt_9amr_utils_PartitionedGrid.calculate_extent = (void(*)(void))__pyx_f_2yt_9amr_utils_15PartitionedGrid_calculate_extent; - *(void(**)(void))&__pyx_vtable_2yt_9amr_utils_PartitionedGrid.integrate_ray = (void(*)(void))__pyx_f_2yt_9amr_utils_15PartitionedGrid_integrate_ray; - *(void(**)(void))&__pyx_vtable_2yt_9amr_utils_PartitionedGrid.sample_values = (void(*)(void))__pyx_f_2yt_9amr_utils_15PartitionedGrid_sample_values; - #endif - if (PyType_Ready(&__pyx_type_2yt_9amr_utils_PartitionedGrid) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_2yt_9amr_utils_PartitionedGrid.tp_dict, __pyx_vtabptr_2yt_9amr_utils_PartitionedGrid) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "PartitionedGrid", (PyObject *)&__pyx_type_2yt_9amr_utils_PartitionedGrid) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_2yt_9amr_utils_PartitionedGrid = &__pyx_type_2yt_9amr_utils_PartitionedGrid; - __pyx_vtabptr_2yt_9amr_utils_GridFace = &__pyx_vtable_2yt_9amr_utils_GridFace; - #if PY_MAJOR_VERSION >= 3 - __pyx_vtable_2yt_9amr_utils_GridFace.proj_overlap = (int (*)(struct __pyx_obj_2yt_9amr_utils_GridFace *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *))__pyx_f_2yt_9amr_utils_8GridFace_proj_overlap; - #else - *(void(**)(void))&__pyx_vtable_2yt_9amr_utils_GridFace.proj_overlap = (void(*)(void))__pyx_f_2yt_9amr_utils_8GridFace_proj_overlap; - #endif - if (PyType_Ready(&__pyx_type_2yt_9amr_utils_GridFace) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_2yt_9amr_utils_GridFace.tp_dict, __pyx_vtabptr_2yt_9amr_utils_GridFace) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "GridFace", (PyObject *)&__pyx_type_2yt_9amr_utils_GridFace) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_2yt_9amr_utils_GridFace = &__pyx_type_2yt_9amr_utils_GridFace; - __pyx_vtabptr_2yt_9amr_utils_ProtoPrism = &__pyx_vtable_2yt_9amr_utils_ProtoPrism; - #if PY_MAJOR_VERSION >= 3 - __pyx_vtable_2yt_9amr_utils_ProtoPrism.split = (PyObject *(*)(struct __pyx_obj_2yt_9amr_utils_ProtoPrism *, __pyx_t_5numpy_float64_t *, int))__pyx_f_2yt_9amr_utils_10ProtoPrism_split; - #else - *(void(**)(void))&__pyx_vtable_2yt_9amr_utils_ProtoPrism.split = (void(*)(void))__pyx_f_2yt_9amr_utils_10ProtoPrism_split; - #endif - if (PyType_Ready(&__pyx_type_2yt_9amr_utils_ProtoPrism) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_2yt_9amr_utils_ProtoPrism.tp_dict, __pyx_vtabptr_2yt_9amr_utils_ProtoPrism) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "ProtoPrism", (PyObject *)&__pyx_type_2yt_9amr_utils_ProtoPrism) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_2yt_9amr_utils_ProtoPrism = &__pyx_type_2yt_9amr_utils_ProtoPrism; - __pyx_vtabptr_2yt_9amr_utils_QuadTree = &__pyx_vtable_2yt_9amr_utils_QuadTree; - #if PY_MAJOR_VERSION >= 3 - __pyx_vtable_2yt_9amr_utils_QuadTree.add_to_position = (void (*)(struct __pyx_obj_2yt_9amr_utils_QuadTree *, int, __pyx_t_5numpy_int64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t))__pyx_f_2yt_9amr_utils_8QuadTree_add_to_position; - __pyx_vtable_2yt_9amr_utils_QuadTree.find_on_root_level = (struct __pyx_t_2yt_9amr_utils_QuadTreeNode *(*)(struct __pyx_obj_2yt_9amr_utils_QuadTree *, __pyx_t_5numpy_int64_t *, int))__pyx_f_2yt_9amr_utils_8QuadTree_find_on_root_level; - __pyx_vtable_2yt_9amr_utils_QuadTree.count_at_level = (int (*)(struct __pyx_obj_2yt_9amr_utils_QuadTree *, struct __pyx_t_2yt_9amr_utils_QuadTreeNode *, int))__pyx_f_2yt_9amr_utils_8QuadTree_count_at_level; - __pyx_vtable_2yt_9amr_utils_QuadTree.fill_from_level = (int (*)(struct __pyx_obj_2yt_9amr_utils_QuadTree *, struct __pyx_t_2yt_9amr_utils_QuadTreeNode *, int, __pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *))__pyx_f_2yt_9amr_utils_8QuadTree_fill_from_level; - #else - *(void(**)(void))&__pyx_vtable_2yt_9amr_utils_QuadTree.add_to_position = (void(*)(void))__pyx_f_2yt_9amr_utils_8QuadTree_add_to_position; - *(void(**)(void))&__pyx_vtable_2yt_9amr_utils_QuadTree.find_on_root_level = (void(*)(void))__pyx_f_2yt_9amr_utils_8QuadTree_find_on_root_level; - *(void(**)(void))&__pyx_vtable_2yt_9amr_utils_QuadTree.count_at_level = (void(*)(void))__pyx_f_2yt_9amr_utils_8QuadTree_count_at_level; - *(void(**)(void))&__pyx_vtable_2yt_9amr_utils_QuadTree.fill_from_level = (void(*)(void))__pyx_f_2yt_9amr_utils_8QuadTree_fill_from_level; - #endif - if (PyType_Ready(&__pyx_type_2yt_9amr_utils_QuadTree) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_2yt_9amr_utils_QuadTree.tp_dict, __pyx_vtabptr_2yt_9amr_utils_QuadTree) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "QuadTree", (PyObject *)&__pyx_type_2yt_9amr_utils_QuadTree) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_2yt_9amr_utils_QuadTree = &__pyx_type_2yt_9amr_utils_QuadTree; - /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /*--- Function import code ---*/ - /*--- Execution code ---*/ - - /* "/Users/matthewturk/yt/yt/yt/amr_utils.pyx":32 - * - * # Set up some imports - * import numpy as np # <<<<<<<<<<<<<< - * cimport numpy as np - * cimport cython - */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":26 - * """ - * - * import numpy as np # <<<<<<<<<<<<<< - * cimport numpy as np - * cimport cython - */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":1 - * """ # <<<<<<<<<<<<<< - * Simple interpolators - * - */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":27 - * - * - * import numpy as np # <<<<<<<<<<<<<< - * cimport numpy as np - * cimport cython - */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":26 - * """ - * - * import numpy as np # <<<<<<<<<<<<<< - * cimport numpy as np - * cimport cython - */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":1 - * """ # <<<<<<<<<<<<<< - * Simple integrators for the radiative transfer equation - * - */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":26 - * """ - * - * import numpy as np # <<<<<<<<<<<<<< - * cimport numpy as np - * cimport cython - */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":1 - * """ # <<<<<<<<<<<<<< - * A light interface to libpng - * - */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":26 - * """ - * - * import numpy as np # <<<<<<<<<<<<<< - * cimport numpy as np - * cimport cython - */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":27 - * - * - * import numpy as np # <<<<<<<<<<<<<< - * cimport numpy as np - * # Double up here for def'd functions - */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/amr_utils.pyx":1 - * """ # <<<<<<<<<<<<<< - * Container file to hold all our Cython routines. This is to avoid problems with - * static linking. - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Transfer3D); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_14), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TransferShells); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_15), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":963 - * arr.base = baseptr - * - * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * if arr.base is NULL: - * return None - */ - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - if (__pyx_m) { - __Pyx_AddTraceback("init yt.amr_utils"); - Py_DECREF(__pyx_m); __pyx_m = 0; - } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init yt.amr_utils"); - } - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - #if PY_MAJOR_VERSION < 3 - return; - #else - return __pyx_m; - #endif -} - -/* Runtime support code */ - -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_RaiseArgtupleInvalid( - const char* func_name, - int exact, - Py_ssize_t num_min, - Py_ssize_t num_max, - Py_ssize_t num_found) -{ - Py_ssize_t num_expected; - const char *number, *more_or_less; - - if (num_found < num_min) { - num_expected = num_min; - more_or_less = "at least"; - } else { - num_expected = num_max; - more_or_less = "at most"; - } - if (exact) { - more_or_less = "exactly"; - } - number = (num_expected == 1) ? "" : "s"; - PyErr_Format(PyExc_TypeError, - #if PY_VERSION_HEX < 0x02050000 - "%s() takes %s %d positional argument%s (%d given)", - #else - "%s() takes %s %zd positional argument%s (%zd given)", - #endif - func_name, more_or_less, num_expected, number, num_found); -} - -static CYTHON_INLINE 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_CheckExact(key)) && unlikely(!PyString_Check(key))) - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) - #endif - goto invalid_keyword_type; - } - if ((!kw_allowed) && unlikely(key)) - goto invalid_keyword; - return 1; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%s() keywords must be strings", function_name); - return 0; -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%s() got an unexpected keyword argument '%s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif - return 0; -} - -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AS_STRING(kw_name)); - #endif -} - -static int __Pyx_ParseOptionalKeywords( - PyObject *kwds, - PyObject **argnames[], - PyObject *kwds2, - PyObject *values[], - Py_ssize_t num_pos_args, - const char* function_name) -{ - PyObject *key = 0, *value = 0; - Py_ssize_t pos = 0; - PyObject*** name; - PyObject*** first_kw_arg = argnames + num_pos_args; - - while (PyDict_Next(kwds, &pos, &key, &value)) { - name = first_kw_arg; - while (*name && (**name != key)) name++; - if (*name) { - values[name-argnames] = value; - } else { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; - } else { - for (name = first_kw_arg; *name; name++) { - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) break; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) break; - #endif - } - if (*name) { - values[name-argnames] = value; - } else { - /* unexpected keyword found */ - for (name=argnames; name != first_kw_arg; name++) { - if (**name == key) goto arg_passed_twice; - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) goto arg_passed_twice; - #endif - } - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; - } - } - } - } - } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, **name); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%s() got an unexpected keyword argument '%s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - return -1; -} - -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact) -{ - if (!type) { - PyErr_Format(PyExc_SystemError, "Missing type object"); - return 0; - } - if (none_allowed && obj == Py_None) return 1; - else if (exact) { - if (Py_TYPE(obj) == type) return 1; - } - else { - if (PyObject_TypeCheck(obj, type)) return 1; - } - PyErr_Format(PyExc_TypeError, - "Argument '%s' has incorrect type (expected %s, got %s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); - return 0; -} - -static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { - unsigned int n = 1; - return *(unsigned char*)(&n) != 0; -} - -typedef struct { - __Pyx_StructField root; - __Pyx_BufFmt_StackElem* head; - size_t fmt_offset; - int new_count, enc_count; - int is_complex; - char enc_type; - char packmode; -} __Pyx_BufFmt_Context; - -static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, - __Pyx_BufFmt_StackElem* stack, - __Pyx_TypeInfo* type) { - stack[0].field = &ctx->root; - stack[0].parent_offset = 0; - ctx->root.type = type; - ctx->root.name = "buffer dtype"; - ctx->root.offset = 0; - ctx->head = stack; - ctx->head->field = &ctx->root; - ctx->fmt_offset = 0; - ctx->head->parent_offset = 0; - ctx->packmode = '@'; - ctx->new_count = 1; - ctx->enc_count = 0; - ctx->enc_type = 0; - ctx->is_complex = 0; - while (type->typegroup == 'S') { - ++ctx->head; - ctx->head->field = type->fields; - ctx->head->parent_offset = 0; - type = type->fields->type; - } -} - -static int __Pyx_BufFmt_ParseNumber(const char** ts) { - int count; - const char* t = *ts; - if (*t < '0' || *t > '9') { - return -1; - } else { - count = *t++ - '0'; - while (*t >= '0' && *t < '9') { - count *= 10; - count += *t++ - '0'; - } - } - *ts = t; - return count; -} - -static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { - char msg[] = {ch, 0}; - PyErr_Format(PyExc_ValueError, "Unexpected format string character: '%s'", msg); -} - -static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { - switch (ch) { - case 'b': return "'char'"; - case 'B': return "'unsigned char'"; - case 'h': return "'short'"; - case 'H': return "'unsigned short'"; - case 'i': return "'int'"; - case 'I': return "'unsigned int'"; - case 'l': return "'long'"; - case 'L': return "'unsigned long'"; - case 'q': return "'long long'"; - case 'Q': return "'unsigned long long'"; - case 'f': return (is_complex ? "'complex float'" : "'float'"); - case 'd': return (is_complex ? "'complex double'" : "'double'"); - case 'g': return (is_complex ? "'complex long double'" : "'long double'"); - case 'T': return "a struct"; - case 'O': return "Python object"; - case 'P': return "a pointer"; - case 0: return "end"; - default: return "unparseable format string"; - } -} - -static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { - switch (ch) { - case '?': case 'c': case 'b': case 'B': return 1; - case 'h': case 'H': return 2; - case 'i': case 'I': case 'l': case 'L': return 4; - case 'q': case 'Q': return 8; - case 'f': return (is_complex ? 8 : 4); - case 'd': return (is_complex ? 16 : 8); - case 'g': { - PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); - return 0; - } - case 'O': case 'P': return sizeof(void*); - default: - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; - } -} - -static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { - switch (ch) { - case 'c': case 'b': case 'B': return 1; - case 'h': case 'H': return sizeof(short); - case 'i': case 'I': return sizeof(int); - case 'l': case 'L': return sizeof(long); - #ifdef HAVE_LONG_LONG - case 'q': case 'Q': return sizeof(PY_LONG_LONG); - #endif - case 'f': return sizeof(float) * (is_complex ? 2 : 1); - case 'd': return sizeof(double) * (is_complex ? 2 : 1); - case 'g': return sizeof(long double) * (is_complex ? 2 : 1); - case 'O': case 'P': return sizeof(void*); - default: { - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; - } - } -} - -typedef struct { char c; short x; } __Pyx_st_short; -typedef struct { char c; int x; } __Pyx_st_int; -typedef struct { char c; long x; } __Pyx_st_long; -typedef struct { char c; float x; } __Pyx_st_float; -typedef struct { char c; double x; } __Pyx_st_double; -typedef struct { char c; long double x; } __Pyx_st_longdouble; -typedef struct { char c; void *x; } __Pyx_st_void_p; -#ifdef HAVE_LONG_LONG -typedef struct { char c; PY_LONG_LONG x; } __Pyx_s_long_long; -#endif - -static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { - switch (ch) { - case '?': case 'c': case 'b': case 'B': return 1; - case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); - case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); - case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); -#ifdef HAVE_LONG_LONG - case 'q': case 'Q': return sizeof(__Pyx_s_long_long) - sizeof(PY_LONG_LONG); -#endif - case 'f': return sizeof(__Pyx_st_float) - sizeof(float); - case 'd': return sizeof(__Pyx_st_double) - sizeof(double); - case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); - case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); - default: - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; - } -} - -static size_t __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { - switch (ch) { - case 'c': case 'b': case 'h': case 'i': case 'l': case 'q': return 'I'; - case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U'; - case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R'); - case 'O': return 'O'; - case 'P': return 'P'; - default: { - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; - } - } -} - -static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { - if (ctx->head == NULL || ctx->head->field == &ctx->root) { - const char* expected; - const char* quote; - if (ctx->head == NULL) { - expected = "end"; - quote = ""; - } else { - expected = ctx->head->field->type->name; - quote = "'"; - } - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch, expected %s%s%s but got %s", - quote, expected, quote, - __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); - } else { - __Pyx_StructField* field = ctx->head->field; - __Pyx_StructField* parent = (ctx->head - 1)->field; - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", - field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), - parent->type->name, field->name); - } -} - -static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { - char group; - size_t size, offset; - if (ctx->enc_type == 0) return 0; - group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); - do { - __Pyx_StructField* field = ctx->head->field; - __Pyx_TypeInfo* type = field->type; - - if (ctx->packmode == '@' || ctx->packmode == '^') { - size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); - } else { - size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); - } - if (ctx->packmode == '@') { - int align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); - int align_mod_offset; - if (align_at == 0) return -1; - align_mod_offset = ctx->fmt_offset % align_at; - if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; - } - - if (type->size != size || type->typegroup != group) { - if (type->typegroup == 'C' && type->fields != NULL) { - /* special case -- treat as struct rather than complex number */ - size_t parent_offset = ctx->head->parent_offset + field->offset; - ++ctx->head; - ctx->head->field = type->fields; - ctx->head->parent_offset = parent_offset; - continue; - } - - __Pyx_BufFmt_RaiseExpected(ctx); - return -1; - } - - offset = ctx->head->parent_offset + field->offset; - if (ctx->fmt_offset != offset) { - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch; next field is at offset %"PY_FORMAT_SIZE_T"d " - "but %"PY_FORMAT_SIZE_T"d expected", ctx->fmt_offset, offset); - return -1; - } - - ctx->fmt_offset += size; - - --ctx->enc_count; /* Consume from buffer string */ - - /* Done checking, move to next field, pushing or popping struct stack if needed */ - while (1) { - if (field == &ctx->root) { - ctx->head = NULL; - if (ctx->enc_count != 0) { - __Pyx_BufFmt_RaiseExpected(ctx); - return -1; - } - break; /* breaks both loops as ctx->enc_count == 0 */ - } - ctx->head->field = ++field; - if (field->type == NULL) { - --ctx->head; - field = ctx->head->field; - continue; - } else if (field->type->typegroup == 'S') { - size_t parent_offset = ctx->head->parent_offset + field->offset; - if (field->type->fields->type == NULL) continue; /* empty struct */ - field = field->type->fields; - ++ctx->head; - ctx->head->field = field; - ctx->head->parent_offset = parent_offset; - break; - } else { - break; - } - } - } while (ctx->enc_count); - ctx->enc_type = 0; - ctx->is_complex = 0; - return 0; -} - -static int __Pyx_BufFmt_FirstPack(__Pyx_BufFmt_Context* ctx) { - if (ctx->enc_type != 0 || ctx->packmode != '@') { - PyErr_SetString(PyExc_ValueError, "Buffer packing mode currently only allowed at beginning of format string (this is a defect)"); - return -1; - } - return 0; -} - -static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { - int got_Z = 0; - while (1) { - switch(*ts) { - case 0: - if (ctx->enc_type != 0 && ctx->head == NULL) { - __Pyx_BufFmt_RaiseExpected(ctx); - return NULL; - } - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - if (ctx->head != NULL) { - __Pyx_BufFmt_RaiseExpected(ctx); - return NULL; - } - return ts; - case ' ': - case 10: - case 13: - ++ts; - break; - case '<': - if (!__Pyx_IsLittleEndian()) { - PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); - return NULL; - } - if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL; - ctx->packmode = '='; - ++ts; - break; - case '>': - case '!': - if (__Pyx_IsLittleEndian()) { - PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); - return NULL; - } - if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL; - ctx->packmode = '='; - ++ts; - break; - case '=': - case '@': - case '^': - if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL; - ctx->packmode = *ts++; - break; - case 'T': /* substruct */ - { - int i; - const char* ts_after_sub; - int struct_count = ctx->new_count; - ctx->new_count = 1; - ++ts; - if (*ts != '{') { - PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); - return NULL; - } - ++ts; - ts_after_sub = ts; - for (i = 0; i != struct_count; ++i) { - ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); - if (!ts_after_sub) return NULL; - } - ts = ts_after_sub; - } - break; - case '}': /* end of substruct; either repeat or move on */ - ++ts; - return ts; - case 'x': - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->fmt_offset += ctx->new_count; - ctx->new_count = 1; - ctx->enc_count = 0; - ctx->enc_type = 0; - ++ts; - break; - case 'Z': - got_Z = 1; - ++ts; - if (*ts != 'f' && *ts != 'd' && *ts != 'g') { - __Pyx_BufFmt_RaiseUnexpectedChar('Z'); - return NULL; - } /* fall through */ - case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': - case 'l': case 'L': case 'q': case 'Q': - case 'f': case 'd': case 'g': - case 'O': - if (ctx->enc_type == *ts && got_Z == ctx->is_complex) { - /* Continue pooling same type */ - ctx->enc_count += ctx->new_count; - } else { - /* New type */ - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->enc_count = ctx->new_count; - ctx->enc_type = *ts; - ctx->is_complex = got_Z; - } - ++ts; - ctx->new_count = 1; - got_Z = 0; - break; - default: - { - ctx->new_count = __Pyx_BufFmt_ParseNumber(&ts); - if (ctx->new_count == -1) { /* First char was not a digit */ - char msg[2] = { *ts, 0 }; - PyErr_Format(PyExc_ValueError, - "Does not understand character buffer dtype format string ('%s')", msg); - return NULL; - } - } - - } - } -} - -static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { - buf->buf = NULL; - buf->obj = NULL; - buf->strides = __Pyx_zeros; - buf->shape = __Pyx_zeros; - buf->suboffsets = __Pyx_minusones; -} - -static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) { - if (obj == Py_None) { - __Pyx_ZeroBuffer(buf); - return 0; - } - buf->buf = NULL; - if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail; - if (buf->ndim != nd) { - PyErr_Format(PyExc_ValueError, - "Buffer has wrong number of dimensions (expected %d, got %d)", - nd, buf->ndim); - goto fail; - } - if (!cast) { - __Pyx_BufFmt_Context ctx; - __Pyx_BufFmt_Init(&ctx, stack, dtype); - if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; - } - if ((unsigned)buf->itemsize != dtype->size) { - PyErr_Format(PyExc_ValueError, - "Item size of buffer (%"PY_FORMAT_SIZE_T"d byte%s) does not match size of '%s' (%"PY_FORMAT_SIZE_T"d byte%s)", - buf->itemsize, (buf->itemsize > 1) ? "s" : "", - dtype->name, - dtype->size, (dtype->size > 1) ? "s" : ""); - goto fail; - } - if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; - return 0; -fail:; - __Pyx_ZeroBuffer(buf); - return -1; -} - -static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { - if (info->buf == NULL) return; - if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; - __Pyx_ReleaseBuffer(info); -} - -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); - - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} - -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { - PyThreadState *tstate = PyThreadState_GET(); - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} - - - -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (unlikely(!type)) { - PyErr_Format(PyExc_SystemError, "Missing type object"); - return 0; - } - if (likely(PyObject_TypeCheck(obj, type))) - return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", - Py_TYPE(obj)->tp_name, type->tp_name); - return 0; -} - -static void __Pyx_RaiseBufferFallbackError(void) { - PyErr_Format(PyExc_ValueError, - "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!"); -} - -static void __Pyx_RaiseBufferIndexError(int axis) { - PyErr_Format(PyExc_IndexError, - "Out of bounds on buffer access (axis %d)", axis); -} - - -static CYTHON_INLINE long __Pyx_mod_long(long a, long b) { - long r = a % b; - r += ((r != 0) & ((r ^ b) < 0)) * b; - return r; -} - -static CYTHON_INLINE long __Pyx_div_long(long a, long b) { - long q = a / b; - long r = a - q*b; - q -= ((r != 0) & ((r ^ b) < 0)); - return q; -} - -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { - PyErr_Format(PyExc_ValueError, - #if PY_VERSION_HEX < 0x02050000 - "need more than %d value%s to unpack", (int)index, - #else - "need more than %zd value%s to unpack", index, - #endif - (index == 1) ? "" : "s"); -} - -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { - PyErr_Format(PyExc_ValueError, - #if PY_VERSION_HEX < 0x02050000 - "too many values to unpack (expected %d)", (int)expected); - #else - "too many values to unpack (expected %zd)", expected); - #endif -} - -static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { - PyObject *item; - if (!(item = PyIter_Next(iter))) { - if (!PyErr_Occurred()) { - __Pyx_RaiseNeedMoreValuesError(index); - } - } - return item; -} - -static int __Pyx_EndUnpack(PyObject *iter, Py_ssize_t expected) { - PyObject *item; - if ((item = PyIter_Next(iter))) { - Py_DECREF(item); - __Pyx_RaiseTooManyValuesError(expected); - return -1; - } - else if (!PyErr_Occurred()) - return 0; - else - return -1; -} - - -static CYTHON_INLINE __pyx_t_5numpy_int64_t __Pyx_div___pyx_t_5numpy_int64_t(__pyx_t_5numpy_int64_t a, __pyx_t_5numpy_int64_t b) { - __pyx_t_5numpy_int64_t q = a / b; - __pyx_t_5numpy_int64_t r = a - q*b; - q -= ((r != 0) & ((r ^ b) < 0)); - return q; -} - -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); -} - -static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { - if (t == Py_None) { - __Pyx_RaiseNoneNotIterableError(); - } else if (PyTuple_GET_SIZE(t) < index) { - __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); - } else { - __Pyx_RaiseTooManyValuesError(index); - } -} - -#if PY_MAJOR_VERSION < 3 -static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { - #if PY_VERSION_HEX >= 0x02060000 - if (Py_TYPE(obj)->tp_flags & Py_TPFLAGS_HAVE_NEWBUFFER) - return PyObject_GetBuffer(obj, view, flags); - #endif - if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pf_5numpy_7ndarray___getbuffer__(obj, view, flags); - else { - PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); - return -1; - } -} - -static void __Pyx_ReleaseBuffer(Py_buffer *view) { - PyObject* obj = view->obj; - if (obj) { -if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pf_5numpy_7ndarray___releasebuffer__(obj, view); - Py_DECREF(obj); - view->obj = NULL; - } -} - -#endif - -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { - PyObject *py_import = 0; - PyObject *empty_list = 0; - PyObject *module = 0; - PyObject *global_dict = 0; - PyObject *empty_dict = 0; - PyObject *list; - py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); - if (!py_import) - goto bad; - if (from_list) - list = from_list; - else { - empty_list = PyList_New(0); - if (!empty_list) - goto bad; - list = empty_list; - } - global_dict = PyModule_GetDict(__pyx_m); - if (!global_dict) - goto bad; - empty_dict = PyDict_New(); - if (!empty_dict) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, NULL); -bad: - Py_XDECREF(empty_list); - Py_XDECREF(py_import); - Py_XDECREF(empty_dict); - return module; -} - -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp val) { - const npy_intp neg_one = (npy_intp)-1, const_zero = (npy_intp)0; - const int is_unsigned = const_zero < neg_one; - if ((sizeof(npy_intp) == sizeof(char)) || - (sizeof(npy_intp) == sizeof(short))) { - return PyInt_FromLong((long)val); - } else if ((sizeof(npy_intp) == sizeof(int)) || - (sizeof(npy_intp) == sizeof(long))) { - if (is_unsigned) - return PyLong_FromUnsignedLong((unsigned long)val); - else - return PyInt_FromLong((long)val); - } else if (sizeof(npy_intp) == sizeof(PY_LONG_LONG)) { - if (is_unsigned) - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); - else - return PyLong_FromLongLong((PY_LONG_LONG)val); - } else { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - return _PyLong_FromByteArray(bytes, sizeof(npy_intp), - little, !is_unsigned); - } -} - -static CYTHON_INLINE npy_int32 __Pyx_PyInt_from_py_npy_int32(PyObject* x) { - const npy_int32 neg_one = (npy_int32)-1, const_zero = (npy_int32)0; - const int is_unsigned = const_zero < neg_one; - if (sizeof(npy_int32) == sizeof(char)) { - if (is_unsigned) - return (npy_int32)__Pyx_PyInt_AsUnsignedChar(x); - else - return (npy_int32)__Pyx_PyInt_AsSignedChar(x); - } else if (sizeof(npy_int32) == sizeof(short)) { - if (is_unsigned) - return (npy_int32)__Pyx_PyInt_AsUnsignedShort(x); - else - return (npy_int32)__Pyx_PyInt_AsSignedShort(x); - } else if (sizeof(npy_int32) == sizeof(int)) { - if (is_unsigned) - return (npy_int32)__Pyx_PyInt_AsUnsignedInt(x); - else - return (npy_int32)__Pyx_PyInt_AsSignedInt(x); - } else if (sizeof(npy_int32) == sizeof(long)) { - if (is_unsigned) - return (npy_int32)__Pyx_PyInt_AsUnsignedLong(x); - else - return (npy_int32)__Pyx_PyInt_AsSignedLong(x); - } else if (sizeof(npy_int32) == sizeof(PY_LONG_LONG)) { - if (is_unsigned) - return (npy_int32)__Pyx_PyInt_AsUnsignedLongLong(x); - else - return (npy_int32)__Pyx_PyInt_AsSignedLongLong(x); - } else { - npy_int32 val; - PyObject *v = __Pyx_PyNumber_Int(x); - #if PY_VERSION_HEX < 0x03000000 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } - return (npy_int32)-1; - } -} - -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int32(npy_int32 val) { - const npy_int32 neg_one = (npy_int32)-1, const_zero = (npy_int32)0; - const int is_unsigned = const_zero < neg_one; - if ((sizeof(npy_int32) == sizeof(char)) || - (sizeof(npy_int32) == sizeof(short))) { - return PyInt_FromLong((long)val); - } else if ((sizeof(npy_int32) == sizeof(int)) || - (sizeof(npy_int32) == sizeof(long))) { - if (is_unsigned) - return PyLong_FromUnsignedLong((unsigned long)val); - else - return PyInt_FromLong((long)val); - } else if (sizeof(npy_int32) == sizeof(PY_LONG_LONG)) { - if (is_unsigned) - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); - else - return PyLong_FromLongLong((PY_LONG_LONG)val); - } else { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - return _PyLong_FromByteArray(bytes, sizeof(npy_int32), - little, !is_unsigned); - } -} - -#if PY_MAJOR_VERSION < 3 -static PyObject *__Pyx_GetStdout(void) { - PyObject *f = PySys_GetObject((char *)"stdout"); - if (!f) { - PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout"); - } - return f; -} - -static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) { - PyObject* v; - int i; - - if (!f) { - if (!(f = __Pyx_GetStdout())) - return -1; - } - for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) { - if (PyFile_SoftSpace(f, 1)) { - if (PyFile_WriteString(" ", f) < 0) - return -1; - } - v = PyTuple_GET_ITEM(arg_tuple, i); - if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0) - return -1; - if (PyString_Check(v)) { - char *s = PyString_AsString(v); - Py_ssize_t len = PyString_Size(v); - if (len > 0 && - isspace(Py_CHARMASK(s[len-1])) && - s[len-1] != ' ') - PyFile_SoftSpace(f, 0); - } - } - if (newline) { - if (PyFile_WriteString("\n", f) < 0) - return -1; - PyFile_SoftSpace(f, 0); - } - return 0; -} - -#else /* Python 3 has a print function */ - -static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { - PyObject* kwargs = 0; - PyObject* result = 0; - PyObject* end_string; - if (unlikely(!__pyx_print)) { - __pyx_print = __Pyx_GetAttrString(__pyx_b, "print"); - if (!__pyx_print) - return -1; - } - if (stream) { - kwargs = PyDict_New(); - if (unlikely(!kwargs)) - return -1; - if (unlikely(PyDict_SetItemString(kwargs, "file", stream) < 0)) - goto bad; - if (!newline) { - end_string = PyUnicode_FromStringAndSize(" ", 1); - if (unlikely(!end_string)) - goto bad; - if (PyDict_SetItemString(kwargs, "end", end_string) < 0) { - Py_DECREF(end_string); - goto bad; - } - Py_DECREF(end_string); - } - } else if (!newline) { - if (unlikely(!__pyx_print_kwargs)) { - __pyx_print_kwargs = PyDict_New(); - if (unlikely(!__pyx_print_kwargs)) - return -1; - end_string = PyUnicode_FromStringAndSize(" ", 1); - if (unlikely(!end_string)) - return -1; - if (PyDict_SetItemString(__pyx_print_kwargs, "end", end_string) < 0) { - Py_DECREF(end_string); - return -1; - } - Py_DECREF(end_string); - } - kwargs = __pyx_print_kwargs; - } - result = PyObject_Call(__pyx_print, arg_tuple, kwargs); - if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs)) - Py_DECREF(kwargs); - if (!result) - return -1; - Py_DECREF(result); - return 0; -bad: - if (kwargs != __pyx_print_kwargs) - Py_XDECREF(kwargs); - return -1; -} - -#endif - -static CYTHON_INLINE npy_int64 __Pyx_PyInt_from_py_npy_int64(PyObject* x) { - const npy_int64 neg_one = (npy_int64)-1, const_zero = (npy_int64)0; - const int is_unsigned = const_zero < neg_one; - if (sizeof(npy_int64) == sizeof(char)) { - if (is_unsigned) - return (npy_int64)__Pyx_PyInt_AsUnsignedChar(x); - else - return (npy_int64)__Pyx_PyInt_AsSignedChar(x); - } else if (sizeof(npy_int64) == sizeof(short)) { - if (is_unsigned) - return (npy_int64)__Pyx_PyInt_AsUnsignedShort(x); - else - return (npy_int64)__Pyx_PyInt_AsSignedShort(x); - } else if (sizeof(npy_int64) == sizeof(int)) { - if (is_unsigned) - return (npy_int64)__Pyx_PyInt_AsUnsignedInt(x); - else - return (npy_int64)__Pyx_PyInt_AsSignedInt(x); - } else if (sizeof(npy_int64) == sizeof(long)) { - if (is_unsigned) - return (npy_int64)__Pyx_PyInt_AsUnsignedLong(x); - else - return (npy_int64)__Pyx_PyInt_AsSignedLong(x); - } else if (sizeof(npy_int64) == sizeof(PY_LONG_LONG)) { - if (is_unsigned) - return (npy_int64)__Pyx_PyInt_AsUnsignedLongLong(x); - else - return (npy_int64)__Pyx_PyInt_AsSignedLongLong(x); - } else { - npy_int64 val; - PyObject *v = __Pyx_PyNumber_Int(x); - #if PY_VERSION_HEX < 0x03000000 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } - return (npy_int64)-1; - } -} - -#if PY_MAJOR_VERSION < 3 - -static int __Pyx_PrintOne(PyObject* f, PyObject *o) { - if (!f) { - if (!(f = __Pyx_GetStdout())) - return -1; - } - if (PyFile_SoftSpace(f, 0)) { - if (PyFile_WriteString(" ", f) < 0) - return -1; - } - if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0) - return -1; - if (PyFile_WriteString("\n", f) < 0) - return -1; - return 0; - /* the line below is just to avoid compiler - * compiler warnings about unused functions */ - return __Pyx_Print(f, NULL, 0); -} - -#else /* Python 3 has a print function */ - -static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { - int res; - PyObject* arg_tuple = PyTuple_New(1); - if (unlikely(!arg_tuple)) - return -1; - Py_INCREF(o); - PyTuple_SET_ITEM(arg_tuple, 0, o); - res = __Pyx_Print(stream, arg_tuple, 1); - Py_DECREF(arg_tuple); - return res; -} - -#endif - -#if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { - Py_XINCREF(type); - Py_XINCREF(value); - Py_XINCREF(tb); - /* First, check the traceback argument, replacing None with NULL. */ - if (tb == Py_None) { - Py_DECREF(tb); - tb = 0; - } - else if (tb != NULL && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - /* Next, replace a missing value with None */ - if (value == NULL) { - value = Py_None; - Py_INCREF(value); - } - #if PY_VERSION_HEX < 0x02050000 - if (!PyClass_Check(type)) - #else - if (!PyType_Check(type)) - #endif - { - /* Raising an instance. The value should be a dummy. */ - if (value != Py_None) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; - } - /* Normalize to raise , */ - Py_DECREF(value); - value = type; - #if PY_VERSION_HEX < 0x02050000 - if (PyInstance_Check(type)) { - type = (PyObject*) ((PyInstanceObject*)type)->in_class; - Py_INCREF(type); - } - else { - type = 0; - PyErr_SetString(PyExc_TypeError, - "raise: exception must be an old-style class or instance"); - goto raise_error; - } - #else - type = (PyObject*) Py_TYPE(type); - Py_INCREF(type); - if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; - } - #endif - } - - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; -} - -#else /* Python 3+ */ - -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto bad; - } - if (value == Py_None) - value = 0; - - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto bad; - } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (!PyExceptionClass_Check(type)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } - - PyErr_SetObject(type, value); - - if (tb) { - PyThreadState *tstate = PyThreadState_GET(); - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); - } - } - -bad: - return; -} -#endif - -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int64(npy_int64 val) { - const npy_int64 neg_one = (npy_int64)-1, const_zero = (npy_int64)0; - const int is_unsigned = const_zero < neg_one; - if ((sizeof(npy_int64) == sizeof(char)) || - (sizeof(npy_int64) == sizeof(short))) { - return PyInt_FromLong((long)val); - } else if ((sizeof(npy_int64) == sizeof(int)) || - (sizeof(npy_int64) == sizeof(long))) { - if (is_unsigned) - return PyLong_FromUnsignedLong((unsigned long)val); - else - return PyInt_FromLong((long)val); - } else if (sizeof(npy_int64) == sizeof(PY_LONG_LONG)) { - if (is_unsigned) - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); - else - return PyLong_FromLongLong((PY_LONG_LONG)val); - } else { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - return _PyLong_FromByteArray(bytes, sizeof(npy_int64), - little, !is_unsigned); - } -} - -static CYTHON_INLINE png_uint_32 __Pyx_PyInt_from_py_png_uint_32(PyObject* x) { - const png_uint_32 neg_one = (png_uint_32)-1, const_zero = (png_uint_32)0; - const int is_unsigned = const_zero < neg_one; - if (sizeof(png_uint_32) == sizeof(char)) { - if (is_unsigned) - return (png_uint_32)__Pyx_PyInt_AsUnsignedChar(x); - else - return (png_uint_32)__Pyx_PyInt_AsSignedChar(x); - } else if (sizeof(png_uint_32) == sizeof(short)) { - if (is_unsigned) - return (png_uint_32)__Pyx_PyInt_AsUnsignedShort(x); - else - return (png_uint_32)__Pyx_PyInt_AsSignedShort(x); - } else if (sizeof(png_uint_32) == sizeof(int)) { - if (is_unsigned) - return (png_uint_32)__Pyx_PyInt_AsUnsignedInt(x); - else - return (png_uint_32)__Pyx_PyInt_AsSignedInt(x); - } else if (sizeof(png_uint_32) == sizeof(long)) { - if (is_unsigned) - return (png_uint_32)__Pyx_PyInt_AsUnsignedLong(x); - else - return (png_uint_32)__Pyx_PyInt_AsSignedLong(x); - } else if (sizeof(png_uint_32) == sizeof(PY_LONG_LONG)) { - if (is_unsigned) - return (png_uint_32)__Pyx_PyInt_AsUnsignedLongLong(x); - else - return (png_uint_32)__Pyx_PyInt_AsSignedLongLong(x); - } else { - png_uint_32 val; - PyObject *v = __Pyx_PyNumber_Int(x); - #if PY_VERSION_HEX < 0x03000000 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } - return (png_uint_32)-1; - } -} - -static CYTHON_INLINE long __Pyx_pow_long(long b, long e) { - long t = b; - switch (e) { - case 3: - t *= b; - case 2: - t *= b; - case 1: - return t; - case 0: - return 1; - } - if (unlikely(e<0)) return 0; - t = 1; - while (likely(e)) { - t *= (b * (e&1)) | ((~e)&1); /* 1 or b */ - b *= b; - e >>= 1; - } - return t; -} - -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - return ::std::complex< float >(x, y); - } - #else - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - return x + y*(__pyx_t_float_complex)_Complex_I; - } - #endif -#else - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - __pyx_t_float_complex z; - z.real = x; - z.imag = y; - return z; - } -#endif - -#if CYTHON_CCOMPLEX -#else - static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { - return (a.real == b.real) && (a.imag == b.imag); - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - z.real = a.real + b.real; - z.imag = a.imag + b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - z.real = a.real - b.real; - z.imag = a.imag - b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - z.real = a.real * b.real - a.imag * b.imag; - z.imag = a.real * b.imag + a.imag * b.real; - return z; - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - float denom = b.real * b.real + b.imag * b.imag; - z.real = (a.real * b.real + a.imag * b.imag) / denom; - z.imag = (a.imag * b.real - a.real * b.imag) / denom; - return z; - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { - __pyx_t_float_complex z; - z.real = -a.real; - z.imag = -a.imag; - return z; - } - static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { - return (a.real == 0) && (a.imag == 0); - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { - __pyx_t_float_complex z; - z.real = a.real; - z.imag = -a.imag; - return z; - } -/* - static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { -#if HAVE_HYPOT - return hypotf(z.real, z.imag); -#else - return sqrtf(z.real*z.real + z.imag*z.imag); -#endif - } -*/ -#endif - -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - return ::std::complex< double >(x, y); - } - #else - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - return x + y*(__pyx_t_double_complex)_Complex_I; - } - #endif -#else - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - __pyx_t_double_complex z; - z.real = x; - z.imag = y; - return z; - } -#endif - -#if CYTHON_CCOMPLEX -#else - static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { - return (a.real == b.real) && (a.imag == b.imag); - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - z.real = a.real + b.real; - z.imag = a.imag + b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - z.real = a.real - b.real; - z.imag = a.imag - b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - z.real = a.real * b.real - a.imag * b.imag; - z.imag = a.real * b.imag + a.imag * b.real; - return z; - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - double denom = b.real * b.real + b.imag * b.imag; - z.real = (a.real * b.real + a.imag * b.imag) / denom; - z.imag = (a.imag * b.real - a.real * b.imag) / denom; - return z; - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { - __pyx_t_double_complex z; - z.real = -a.real; - z.imag = -a.imag; - return z; - } - static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { - return (a.real == 0) && (a.imag == 0); - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { - __pyx_t_double_complex z; - z.real = a.real; - z.imag = -a.imag; - return z; - } -/* - static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { -#if HAVE_HYPOT - return hypot(z.real, z.imag); -#else - return sqrt(z.real*z.real + z.imag*z.imag); -#endif - } -*/ -#endif - -static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { - const unsigned char neg_one = (unsigned char)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(unsigned char) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(unsigned char)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to unsigned char" : - "value too large to convert to unsigned char"); - } - return (unsigned char)-1; - } - return (unsigned char)val; - } - return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); -} - -static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { - const unsigned short neg_one = (unsigned short)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(unsigned short) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(unsigned short)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to unsigned short" : - "value too large to convert to unsigned short"); - } - return (unsigned short)-1; - } - return (unsigned short)val; - } - return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); -} - -static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { - const unsigned int neg_one = (unsigned int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(unsigned int) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(unsigned int)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to unsigned int" : - "value too large to convert to unsigned int"); - } - return (unsigned int)-1; - } - return (unsigned int)val; - } - return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); -} - -static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { - const char neg_one = (char)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(char) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(char)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to char" : - "value too large to convert to char"); - } - return (char)-1; - } - return (char)val; - } - return (char)__Pyx_PyInt_AsLong(x); -} - -static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { - const short neg_one = (short)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(short) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(short)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to short" : - "value too large to convert to short"); - } - return (short)-1; - } - return (short)val; - } - return (short)__Pyx_PyInt_AsLong(x); -} - -static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { - const int neg_one = (int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(int) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(int)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to int" : - "value too large to convert to int"); - } - return (int)-1; - } - return (int)val; - } - return (int)__Pyx_PyInt_AsLong(x); -} - -static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { - const signed char neg_one = (signed char)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(signed char) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(signed char)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to signed char" : - "value too large to convert to signed char"); - } - return (signed char)-1; - } - return (signed char)val; - } - return (signed char)__Pyx_PyInt_AsSignedLong(x); -} - -static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { - const signed short neg_one = (signed short)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(signed short) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(signed short)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to signed short" : - "value too large to convert to signed short"); - } - return (signed short)-1; - } - return (signed short)val; - } - return (signed short)__Pyx_PyInt_AsSignedLong(x); -} - -static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { - const signed int neg_one = (signed int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(signed int) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(signed int)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to signed int" : - "value too large to convert to signed int"); - } - return (signed int)-1; - } - return (signed int)val; - } - return (signed int)__Pyx_PyInt_AsSignedLong(x); -} - -static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { - const int neg_one = (int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(int) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(int)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to int" : - "value too large to convert to int"); - } - return (int)-1; - } - return (int)val; - } - return (int)__Pyx_PyInt_AsLong(x); -} - -static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { - const unsigned long neg_one = (unsigned long)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; -#if PY_VERSION_HEX < 0x03000000 - if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned long"); - return (unsigned long)-1; - } - return (unsigned long)val; - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned long"); - return (unsigned long)-1; - } - return PyLong_AsUnsignedLong(x); - } else { - return PyLong_AsLong(x); - } - } else { - unsigned long val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (unsigned long)-1; - val = __Pyx_PyInt_AsUnsignedLong(tmp); - Py_DECREF(tmp); - return val; - } -} - -static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { - const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; -#if PY_VERSION_HEX < 0x03000000 - if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned PY_LONG_LONG"); - return (unsigned PY_LONG_LONG)-1; - } - return (unsigned PY_LONG_LONG)val; - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned PY_LONG_LONG"); - return (unsigned PY_LONG_LONG)-1; - } - return PyLong_AsUnsignedLongLong(x); - } else { - return PyLong_AsLongLong(x); - } - } else { - unsigned PY_LONG_LONG val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (unsigned PY_LONG_LONG)-1; - val = __Pyx_PyInt_AsUnsignedLongLong(tmp); - Py_DECREF(tmp); - return val; - } -} - -static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { - const long neg_one = (long)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; -#if PY_VERSION_HEX < 0x03000000 - if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long)-1; - } - return (long)val; - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long)-1; - } - return PyLong_AsUnsignedLong(x); - } else { - return PyLong_AsLong(x); - } - } else { - long val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (long)-1; - val = __Pyx_PyInt_AsLong(tmp); - Py_DECREF(tmp); - return val; - } -} - -static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { - const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; -#if PY_VERSION_HEX < 0x03000000 - if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to PY_LONG_LONG"); - return (PY_LONG_LONG)-1; - } - return (PY_LONG_LONG)val; - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to PY_LONG_LONG"); - return (PY_LONG_LONG)-1; - } - return PyLong_AsUnsignedLongLong(x); - } else { - return PyLong_AsLongLong(x); - } - } else { - PY_LONG_LONG val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (PY_LONG_LONG)-1; - val = __Pyx_PyInt_AsLongLong(tmp); - Py_DECREF(tmp); - return val; - } -} - -static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { - const signed long neg_one = (signed long)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; -#if PY_VERSION_HEX < 0x03000000 - if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed long"); - return (signed long)-1; - } - return (signed long)val; - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed long"); - return (signed long)-1; - } - return PyLong_AsUnsignedLong(x); - } else { - return PyLong_AsLong(x); - } - } else { - signed long val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (signed long)-1; - val = __Pyx_PyInt_AsSignedLong(tmp); - Py_DECREF(tmp); - return val; - } -} - -static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { - const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; -#if PY_VERSION_HEX < 0x03000000 - if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed PY_LONG_LONG"); - return (signed PY_LONG_LONG)-1; - } - return (signed PY_LONG_LONG)val; - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed PY_LONG_LONG"); - return (signed PY_LONG_LONG)-1; - } - return PyLong_AsUnsignedLongLong(x); - } else { - return PyLong_AsLongLong(x); - } - } else { - signed PY_LONG_LONG val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (signed PY_LONG_LONG)-1; - val = __Pyx_PyInt_AsSignedLongLong(tmp); - Py_DECREF(tmp); - return val; - } -} - -static void __Pyx_WriteUnraisable(const char *name) { - PyObject *old_exc, *old_val, *old_tb; - PyObject *ctx; - __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); - #if PY_MAJOR_VERSION < 3 - ctx = PyString_FromString(name); - #else - ctx = PyUnicode_FromString(name); - #endif - __Pyx_ErrRestore(old_exc, old_val, old_tb); - if (!ctx) { - PyErr_WriteUnraisable(Py_None); - } else { - PyErr_WriteUnraisable(ctx); - Py_DECREF(ctx); - } -} - -static int __Pyx_SetVtable(PyObject *dict, void *vtable) { -#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) - PyObject *ob = PyCapsule_New(vtable, 0, 0); -#else - PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); -#endif - if (!ob) - goto bad; - if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0) - goto bad; - Py_DECREF(ob); - return 0; -bad: - Py_XDECREF(ob); - return -1; -} - -#ifndef __PYX_HAVE_RT_ImportType -#define __PYX_HAVE_RT_ImportType -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, - long size, int strict) -{ - PyObject *py_module = 0; - PyObject *result = 0; - PyObject *py_name = 0; - char warning[200]; - - py_module = __Pyx_ImportModule(module_name); - if (!py_module) - goto bad; - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(class_name); - #else - py_name = PyUnicode_FromString(class_name); - #endif - if (!py_name) - goto bad; - result = PyObject_GetAttr(py_module, py_name); - Py_DECREF(py_name); - py_name = 0; - Py_DECREF(py_module); - py_module = 0; - if (!result) - goto bad; - if (!PyType_Check(result)) { - PyErr_Format(PyExc_TypeError, - "%s.%s is not a type object", - module_name, class_name); - goto bad; - } - if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) { - PyOS_snprintf(warning, sizeof(warning), - "%s.%s size changed, may indicate binary incompatibility", - module_name, class_name); - #if PY_VERSION_HEX < 0x02050000 - PyErr_Warn(NULL, warning); - #else - PyErr_WarnEx(NULL, warning, 0); - #endif - } - else if (((PyTypeObject *)result)->tp_basicsize != size) { - PyErr_Format(PyExc_ValueError, - "%s.%s has the wrong size, try recompiling", - module_name, class_name); - goto bad; - } - return (PyTypeObject *)result; -bad: - Py_XDECREF(py_module); - Py_XDECREF(result); - return 0; -} -#endif - -#ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(name); - #else - py_name = PyUnicode_FromString(name); - #endif - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; -} -#endif - -#include "compile.h" -#include "frameobject.h" -#include "traceback.h" - -static void __Pyx_AddTraceback(const char *funcname) { - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; - PyObject *py_globals = 0; - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(__pyx_filename); - #else - py_srcfile = PyUnicode_FromString(__pyx_filename); - #endif - if (!py_srcfile) goto bad; - if (__pyx_clineno) { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); - #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); - #endif - } - else { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); - #endif - } - if (!py_funcname) goto bad; - py_globals = PyModule_GetDict(__pyx_m); - if (!py_globals) goto bad; - py_code = PyCode_New( - 0, /*int argcount,*/ - #if PY_MAJOR_VERSION >= 3 - 0, /*int kwonlyargcount,*/ - #endif - 0, /*int nlocals,*/ - 0, /*int stacksize,*/ - 0, /*int flags,*/ - __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ - py_srcfile, /*PyObject *filename,*/ - py_funcname, /*PyObject *name,*/ - __pyx_lineno, /*int firstlineno,*/ - __pyx_empty_bytes /*PyObject *lnotab*/ - ); - if (!py_code) goto bad; - py_frame = PyFrame_New( - PyThreadState_GET(), /*PyThreadState *tstate,*/ - py_code, /*PyCodeObject *code,*/ - py_globals, /*PyObject *globals,*/ - 0 /*PyObject *locals*/ - ); - if (!py_frame) goto bad; - py_frame->f_lineno = __pyx_lineno; - PyTraceBack_Here(py_frame); -bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); - Py_XDECREF(py_code); - Py_XDECREF(py_frame); -} - -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { - while (t->p) { - #if PY_MAJOR_VERSION < 3 - if (t->is_unicode) { - *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); - } else if (t->intern) { - *t->p = PyString_InternFromString(t->s); - } else { - *t->p = PyString_FromStringAndSize(t->s, t->n - 1); - } - #else /* Python 3+ has unicode identifiers */ - if (t->is_unicode | t->is_str) { - if (t->intern) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->encoding) { - *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); - } else { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); - } - } else { - *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); - } - #endif - if (!*t->p) - return -1; - ++t; - } - return 0; -} - -/* Type Conversion Functions */ - -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { - int is_true = x == Py_True; - if (is_true | (x == Py_False) | (x == Py_None)) return is_true; - else return PyObject_IsTrue(x); -} - -static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { - PyNumberMethods *m; - const char *name = NULL; - PyObject *res = NULL; -#if PY_VERSION_HEX < 0x03000000 - if (PyInt_Check(x) || PyLong_Check(x)) -#else - if (PyLong_Check(x)) -#endif - return Py_INCREF(x), x; - m = Py_TYPE(x)->tp_as_number; -#if PY_VERSION_HEX < 0x03000000 - if (m && m->nb_int) { - name = "int"; - res = PyNumber_Int(x); - } - else if (m && m->nb_long) { - name = "long"; - res = PyNumber_Long(x); - } -#else - if (m && m->nb_int) { - name = "int"; - res = PyNumber_Long(x); - } -#endif - if (res) { -#if PY_VERSION_HEX < 0x03000000 - if (!PyInt_Check(res) && !PyLong_Check(res)) { -#else - if (!PyLong_Check(res)) { -#endif - PyErr_Format(PyExc_TypeError, - "__%s__ returned non-%s (type %.200s)", - name, name, Py_TYPE(res)->tp_name); - Py_DECREF(res); - return NULL; - } - } - else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, - "an integer is required"); - } - return res; -} - -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { - Py_ssize_t ival; - PyObject* x = PyNumber_Index(b); - if (!x) return -1; - ival = PyInt_AsSsize_t(x); - Py_DECREF(x); - return ival; -} - -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { -#if PY_VERSION_HEX < 0x02050000 - if (ival <= LONG_MAX) - return PyInt_FromLong((long)ival); - else { - unsigned char *bytes = (unsigned char *) &ival; - int one = 1; int little = (int)*(unsigned char*)&one; - return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); - } -#else - return PyInt_FromSize_t(ival); -#endif -} - -static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { - unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); - if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { - return (size_t)-1; - } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to size_t"); - return (size_t)-1; - } - return (size_t)val; -} - - -#endif /* Py_PYTHON_H */ diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/amr_utils.pyx --- a/yt/amr_utils.pyx Wed Aug 25 18:03:39 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -""" -Container file to hold all our Cython routines. This is to avoid problems with -static linking. - -Author: Matthew Turk -Affiliation: KIPAC/SLAC/Stanford -Homepage: http://yt.enzotools.org/ -License: - Copyright (C) 2008 Matthew Turk. All Rights Reserved. - - This file is part of yt. - - yt is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -""" - -#cython embedsignature=True -#cython cdivision=True -#cython always_allow_keywords=True - -# Set up some imports -import numpy as np -cimport numpy as np -cimport cython - -# We include all of our files - -include "_amr_utils/DepthFirstOctree.pyx" -include "_amr_utils/Interpolators.pyx" -include "_amr_utils/PointsInVolume.pyx" -include "_amr_utils/RayIntegrators.pyx" -include "_amr_utils/VolumeIntegrator.pyx" -include "_amr_utils/CICDeposit.pyx" -include "_amr_utils/ContourFinding.pyx" -include "_amr_utils/png_writer.pyx" -include "_amr_utils/fortran_reader.pyx" -include "_amr_utils/QuadTree.pyx" diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/data_objects/setup.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yt/data_objects/setup.py Thu Aug 26 10:24:41 2010 -0600 @@ -0,0 +1,12 @@ +#!/usr/bin/env python +import setuptools +import os, sys, os.path + +import os.path + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + config = Configuration('data_objects',parent_package,top_path) + config.make_config_py() # installs __config__.py + config.make_svn_version_py() + return config diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/exceptions.py --- a/yt/exceptions.py Wed Aug 25 18:03:39 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -""" -This is a library of yt-defined exceptions - -Author: Matthew Turk -Affiliation: KIPAC/SLAC/Stanford -Homepage: http://yt.enzotools.org/ -License: - Copyright (C) 2009 Matthew Turk. All Rights Reserved. - - This file is part of yt. - - yt is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -""" - -# We don't need to import 'exceptions' -#import exceptions - -class YTException(Exception): - def __init__(self, pf = None): - Exception.__init__(self) - self.pf = pf - -# Data access exceptions: - -class YTSphereTooSmall(YTException): - def __init__(self, pf, radius, smallest_cell): - YTException.__init__(self, pf) - self.radius = radius - self.smallest_cell = smallest_cell - - def __str__(self): - return "%0.5e < %0.5e" % (self.radius, self.smallest_cell) diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/frontends/chombo/setup.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yt/frontends/chombo/setup.py Thu Aug 26 10:24:41 2010 -0600 @@ -0,0 +1,12 @@ +#!/usr/bin/env python +import setuptools +import os, sys, os.path + +import os.path + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + config = Configuration('chombo',parent_package,top_path) + config.make_config_py() # installs __config__.py + config.make_svn_version_py() + return config diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/frontends/enzo/setup.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yt/frontends/enzo/setup.py Thu Aug 26 10:24:41 2010 -0600 @@ -0,0 +1,12 @@ +#!/usr/bin/env python +import setuptools +import os, sys, os.path + +import os.path + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + config = Configuration('enzo',parent_package,top_path) + config.make_config_py() # installs __config__.py + config.make_svn_version_py() + return config diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/frontends/flash/setup.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yt/frontends/flash/setup.py Thu Aug 26 10:24:41 2010 -0600 @@ -0,0 +1,12 @@ +#!/usr/bin/env python +import setuptools +import os, sys, os.path + +import os.path + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + config = Configuration('flash',parent_package,top_path) + config.make_config_py() # installs __config__.py + config.make_svn_version_py() + return config diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/frontends/gadget/setup.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yt/frontends/gadget/setup.py Thu Aug 26 10:24:41 2010 -0600 @@ -0,0 +1,12 @@ +#!/usr/bin/env python +import setuptools +import os, sys, os.path + +import os.path + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + config = Configuration('gadget',parent_package,top_path) + config.make_config_py() # installs __config__.py + config.make_svn_version_py() + return config diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/frontends/orion/setup.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yt/frontends/orion/setup.py Thu Aug 26 10:24:41 2010 -0600 @@ -0,0 +1,12 @@ +#!/usr/bin/env python +import setuptools +import os, sys, os.path + +import os.path + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + config = Configuration('orion',parent_package,top_path) + config.make_config_py() # installs __config__.py + config.make_svn_version_py() + return config diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/frontends/ramses/ramses_reader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yt/frontends/ramses/ramses_reader.cpp Thu Aug 26 10:24:41 2010 -0600 @@ -0,0 +1,11701 @@ +/* Generated by Cython 0.13.beta0 on Tue Aug 10 15:34:03 2010 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else + +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif + +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif + +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif + +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif + +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#endif + +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) PyInt_AsLong(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#endif + +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#endif + +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif + +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif + +#ifndef PySet_CheckExact +# define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif + +#ifdef __cplusplus +#define __PYX_EXTERN_C extern "C" +#else +#define __PYX_EXTERN_C extern +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE_API__yt__ramses_reader +#include "stdlib.h" +#include "stdio.h" +#include "numpy/arrayobject.h" +#include "numpy/ufuncobject.h" +#include +#include +#include "string" +#include "RAMSES_typedefs.h" +#include "RAMSES_info.hh" +#include "RAMSES_amr_data.hh" + +/* inline attribute */ +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif + +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || defined(__INTEL_COMPILER) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + + +/* Type Conversion Predeclarations */ + +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) + +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) + + +#ifdef __GNUC__ +/* Test for GCC > 2.95 */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) +#define likely(x) __builtin_expect(!!(x), 1) +#define unlikely(x) __builtin_expect(!!(x), 0) +#else /* __GNUC__ > 2 ... */ +#define likely(x) (x) +#define unlikely(x) (x) +#endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ +#define likely(x) (x) +#define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +#if !defined(CYTHON_CCOMPLEX) + #if defined(__cplusplus) + #define CYTHON_CCOMPLEX 1 + #elif defined(_Complex_I) + #define CYTHON_CCOMPLEX 1 + #else + #define CYTHON_CCOMPLEX 0 + #endif +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #include + #else + #include + #endif +#endif + +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj +#endif + +static const char *__pyx_f[] = { + "ramses_reader.pyx", + "numpy.pxd", +}; + +typedef npy_int8 __pyx_t_5numpy_int8_t; + +typedef npy_int16 __pyx_t_5numpy_int16_t; + +typedef npy_int32 __pyx_t_5numpy_int32_t; + +typedef npy_int64 __pyx_t_5numpy_int64_t; + +typedef npy_uint8 __pyx_t_5numpy_uint8_t; + +typedef npy_uint16 __pyx_t_5numpy_uint16_t; + +typedef npy_uint32 __pyx_t_5numpy_uint32_t; + +typedef npy_uint64 __pyx_t_5numpy_uint64_t; + +typedef npy_float32 __pyx_t_5numpy_float32_t; + +typedef npy_float64 __pyx_t_5numpy_float64_t; + +typedef npy_long __pyx_t_5numpy_int_t; + +typedef npy_longlong __pyx_t_5numpy_long_t; + +typedef npy_intp __pyx_t_5numpy_intp_t; + +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +typedef npy_ulong __pyx_t_5numpy_uint_t; + +typedef npy_ulonglong __pyx_t_5numpy_ulong_t; + +typedef npy_double __pyx_t_5numpy_float_t; + +typedef npy_double __pyx_t_5numpy_double_t; + +typedef npy_longdouble __pyx_t_5numpy_longdouble_t; + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< float > __pyx_t_float_complex; + #else + typedef float _Complex __pyx_t_float_complex; + #endif +#else + typedef struct { float real, imag; } __pyx_t_float_complex; +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< double > __pyx_t_double_complex; + #else + typedef double _Complex __pyx_t_double_complex; + #endif +#else + typedef struct { double real, imag; } __pyx_t_double_complex; +#endif + +/* Type declarations */ + +typedef npy_cfloat __pyx_t_5numpy_cfloat_t; + +typedef npy_cdouble __pyx_t_5numpy_cdouble_t; + +typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; + +typedef npy_cdouble __pyx_t_5numpy_complex_t; + +/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":370 + * vector[vector[double]] m_var_array + * + * cdef class RAMSES_tree_proxy: # <<<<<<<<<<<<<< + * cdef string *snapshot_name + * cdef snapshot *rsnap + */ + +struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy { + PyObject_HEAD + std::string *snapshot_name; + RAMSES::snapshot *rsnap; + RAMSES::AMR::RAMSES_tree **trees; + RAMSES::HYDRO::RAMSES_hydro_data ***hydro_datas; + int *loaded; + PyObject *field_ind; + PyObject *field_names; + int ndomains; + int nfields; +}; + +/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":659 + * return to_fill + * + * cdef class ProtoSubgrid: # <<<<<<<<<<<<<< + * cdef np.int64_t *signature[3] + * cdef np.int64_t left_edge[3] + */ + +struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid { + PyObject_HEAD + __pyx_t_5numpy_int64_t *signature[3]; + __pyx_t_5numpy_int64_t left_edge[3]; + __pyx_t_5numpy_int64_t right_edge[3]; + __pyx_t_5numpy_int64_t dimensions[3]; + __pyx_t_5numpy_float64_t efficiency; + PyObject *sigs; + PyObject *grid_file_locations; + PyObject *dd; +}; + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); + end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; + } + #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) +#else + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) +#endif /* CYTHON_REFNANNY */ +#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) +#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) { + if (likely(PyList_CheckExact(L))) { + if (PyList_Append(L, x) < 0) return NULL; + Py_INCREF(Py_None); + return Py_None; /* this is just to have an accurate signature */ + } + else { + PyObject *r, *m; + m = __Pyx_GetAttrString(L, "append"); + if (!m) return NULL; + r = PyObject_CallFunctionObjArgs(m, x, NULL); + Py_DECREF(m); + return r; + } +} + + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} + + +#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_List_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + + +#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { + PyObject *r; + if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { + r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { + r = PySequence_GetItem(o, i); + } + else { + r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); + } + return r; +} + +#define __Pyx_SetItemInt(o, i, v, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_SetItemInt_Fast(o, i, v) : \ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) + +static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { + int r; + if (!j) return -1; + r = PyObject_SetItem(o, j, v); + Py_DECREF(j); + return r; +} + +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v) { + if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { + Py_INCREF(v); + Py_DECREF(PyList_GET_ITEM(o, i)); + PyList_SET_ITEM(o, i, v); + return 1; + } + else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && (likely(i >= 0))) + return PySequence_SetItem(o, i, v); + else { + PyObject *j = PyInt_FromSsize_t(i); + return __Pyx_SetItemInt_Generic(o, j, v); + } +} + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); /*proto*/ + +/* Run-time type information about structs used with buffers */ +struct __Pyx_StructField_; + +typedef struct { + const char* name; /* for error messages only */ + struct __Pyx_StructField_* fields; + size_t size; /* sizeof(type) */ + char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */ +} __Pyx_TypeInfo; + +typedef struct __Pyx_StructField_ { + __Pyx_TypeInfo* type; + const char* name; + size_t offset; +} __Pyx_StructField; + +typedef struct { + __Pyx_StructField* field; + size_t parent_offset; +} __Pyx_BufFmt_StackElem; + + +static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); +static void __Pyx_RaiseBufferIndexError(int axis); /*proto*/ +#define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1) + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ +#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) + +static void __Pyx_RaiseBufferFallbackError(void); /*proto*/ + +static CYTHON_INLINE int __Pyx_div_int(int, int); /* proto */ + +#define UNARY_NEG_WOULD_OVERFLOW(x) (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) +#define __Pyx_BufPtrStrided3d(type, buf, i0, s0, i1, s1, i2, s2) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2) + +static CYTHON_INLINE __pyx_t_5numpy_int64_t __Pyx_div___pyx_t_5numpy_int64_t(__pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t); /* proto */ + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ +#if PY_MAJOR_VERSION < 3 +static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); +static void __Pyx_ReleaseBuffer(Py_buffer *view); +#else +#define __Pyx_GetBuffer PyObject_GetBuffer +#define __Pyx_ReleaseBuffer PyBuffer_Release +#endif + +Py_ssize_t __Pyx_zeros[] = {0, 0, 0}; +Py_ssize_t __Pyx_minusones[] = {-1, -1, -1}; + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ + +static int __Pyx_Print(PyObject*, PyObject *, int); /*proto*/ +#if PY_MAJOR_VERSION >= 3 +static PyObject* __pyx_print = 0; +static PyObject* __pyx_print_kwargs = 0; +#endif + +static CYTHON_INLINE long __Pyx_pow_long(long, long); /* proto */ + +static CYTHON_INLINE npy_int64 __Pyx_PyInt_from_py_npy_int64(PyObject *); + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int64(npy_int64); + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #define __Pyx_CREAL(z) ((z).real()) + #define __Pyx_CIMAG(z) ((z).imag()) + #else + #define __Pyx_CREAL(z) (__real__(z)) + #define __Pyx_CIMAG(z) (__imag__(z)) + #endif +#else + #define __Pyx_CREAL(z) ((z).real) + #define __Pyx_CIMAG(z) ((z).imag) +#endif + +#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX + #define __Pyx_SET_CREAL(z,x) ((z).real(x)) + #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) +#else + #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) + #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) +#endif + +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eqf(a, b) ((a)==(b)) + #define __Pyx_c_sumf(a, b) ((a)+(b)) + #define __Pyx_c_difff(a, b) ((a)-(b)) + #define __Pyx_c_prodf(a, b) ((a)*(b)) + #define __Pyx_c_quotf(a, b) ((a)/(b)) + #define __Pyx_c_negf(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zerof(z) ((z)==(float)0) + #define __Pyx_c_conjf(z) (::std::conj(z)) + /*#define __Pyx_c_absf(z) (::std::abs(z))*/ + #else + #define __Pyx_c_is_zerof(z) ((z)==0) + #define __Pyx_c_conjf(z) (conjf(z)) + /*#define __Pyx_c_absf(z) (cabsf(z))*/ + #endif +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); + /*static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);*/ +#endif + +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eq(a, b) ((a)==(b)) + #define __Pyx_c_sum(a, b) ((a)+(b)) + #define __Pyx_c_diff(a, b) ((a)-(b)) + #define __Pyx_c_prod(a, b) ((a)*(b)) + #define __Pyx_c_quot(a, b) ((a)/(b)) + #define __Pyx_c_neg(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero(z) ((z)==(double)0) + #define __Pyx_c_conj(z) (::std::conj(z)) + /*#define __Pyx_c_abs(z) (::std::abs(z))*/ + #else + #define __Pyx_c_is_zero(z) ((z)==0) + #define __Pyx_c_conj(z) (conj(z)) + /*#define __Pyx_c_abs(z) (cabs(z))*/ + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); + /*static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);*/ +#endif + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/ + +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ + +static void __Pyx_AddTraceback(const char *funcname); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ +/* Module declarations from libc.stdlib */ + +/* Module declarations from cpython.buffer */ + +/* Module declarations from cpython.ref */ + +/* Module declarations from libc.stdio */ + +/* Module declarations from cpython.object */ + +/* Module declarations from numpy */ + +/* Module declarations from numpy */ + +static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; +static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; +static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; +static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; +static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ +/* Module declarations from cython */ + +/* Module declarations from yt.ramses_reader */ + +static PyTypeObject *__pyx_ptype_2yt_13ramses_reader_RAMSES_tree_proxy = 0; +static PyTypeObject *__pyx_ptype_2yt_13ramses_reader_ProtoSubgrid = 0; +static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_13ramses_reader_i64max(__pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t); /*proto*/ +static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_13ramses_reader_i64min(__pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t); /*proto*/ +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t = { "float64_t", NULL, sizeof(__pyx_t_5numpy_float64_t), 'R' }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t = { "int32_t", NULL, sizeof(__pyx_t_5numpy_int32_t), 'I' }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t = { "int64_t", NULL, sizeof(__pyx_t_5numpy_int64_t), 'I' }; +#define __Pyx_MODULE_NAME "yt.ramses_reader" +int __pyx_module_is_main_yt__ramses_reader = 0; + +/* Implementation of yt.ramses_reader */ +static PyObject *__pyx_builtin_range; +static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_RuntimeError; +static char __pyx_k_1[] = "READING FROM DISK"; +static char __pyx_k_2[] = "get_absolute_position"; +static char __pyx_k_3[] = "ndarray is not C contiguous"; +static char __pyx_k_4[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_5[] = "Non-native byte order not supported"; +static char __pyx_k_6[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_7[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_8[] = "Format string allocated too short."; +static char __pyx_k_9[] = "\nWrapping code for Oliver Hahn's RamsesRead++\n\nAuthor: Matthew Turk \nAffiliation: UCSD\nAuthor: Oliver Hahn \nAffiliation: KIPAC / Stanford\nHomepage: http://yt.enzotools.org/\nLicense:\n Copyright (C) 2010 Matthew Turk. All Rights Reserved.\n\n This file is part of yt.\n\n yt is free software; you can redistribute it and/or modify\n it under the terms of the GNU General Public License as published by\n the Free Software Foundation; either version 3 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see .\n"; +static char __pyx_k__B[] = "B"; +static char __pyx_k__F[] = "F"; +static char __pyx_k__H[] = "H"; +static char __pyx_k__I[] = "I"; +static char __pyx_k__L[] = "L"; +static char __pyx_k__O[] = "O"; +static char __pyx_k__Q[] = "Q"; +static char __pyx_k__b[] = "b"; +static char __pyx_k__d[] = "d"; +static char __pyx_k__f[] = "f"; +static char __pyx_k__g[] = "g"; +static char __pyx_k__h[] = "h"; +static char __pyx_k__i[] = "i"; +static char __pyx_k__l[] = "l"; +static char __pyx_k__q[] = "q"; +static char __pyx_k__x[] = "x"; +static char __pyx_k__y[] = "y"; +static char __pyx_k__z[] = "z"; +static char __pyx_k__H0[] = "H0"; +static char __pyx_k__Zd[] = "Zd"; +static char __pyx_k__Zf[] = "Zf"; +static char __pyx_k__Zg[] = "Zg"; +static char __pyx_k__dd[] = "dd"; +static char __pyx_k__fn[] = "fn"; +static char __pyx_k__np[] = "np"; +static char __pyx_k__zc[] = "zc"; +static char __pyx_k__zs[] = "zs"; +static char __pyx_k__buf[] = "buf"; +static char __pyx_k__end[] = "end"; +static char __pyx_k__obj[] = "obj"; +static char __pyx_k__aexp[] = "aexp"; +static char __pyx_k__base[] = "base"; +static char __pyx_k__data[] = "data"; +static char __pyx_k__ncpu[] = "ncpu"; +static char __pyx_k__ndim[] = "ndim"; +static char __pyx_k__next[] = "next"; +static char __pyx_k__ones[] = "ones"; +static char __pyx_k__read[] = "read"; +static char __pyx_k__sigs[] = "sigs"; +static char __pyx_k__size[] = "size"; +static char __pyx_k__time[] = "time"; +static char __pyx_k__begin[] = "begin"; +static char __pyx_k__c_str[] = "c_str"; +static char __pyx_k__descr[] = "descr"; +static char __pyx_k__dtype[] = "dtype"; +static char __pyx_k__empty[] = "empty"; +static char __pyx_k__field[] = "field"; +static char __pyx_k__int64[] = "int64"; +static char __pyx_k__level[] = "level"; +static char __pyx_k__names[] = "names"; +static char __pyx_k__numpy[] = "numpy"; +static char __pyx_k__order[] = "order"; +static char __pyx_k__range[] = "range"; +static char __pyx_k__rsnap[] = "rsnap"; +static char __pyx_k__shape[] = "shape"; +static char __pyx_k__trees[] = "trees"; +static char __pyx_k__zeros[] = "zeros"; +static char __pyx_k__boxlen[] = "boxlen"; +static char __pyx_k__domain[] = "domain"; +static char __pyx_k__fields[] = "fields"; +static char __pyx_k__filled[] = "filled"; +static char __pyx_k__format[] = "format"; +static char __pyx_k__loaded[] = "loaded"; +static char __pyx_k__unit_d[] = "unit_d"; +static char __pyx_k__unit_l[] = "unit_l"; +static char __pyx_k__unit_t[] = "unit_t"; +static char __pyx_k__argsort[] = "argsort"; +static char __pyx_k__float64[] = "float64"; +static char __pyx_k__grid_id[] = "grid_id"; +static char __pyx_k__m_nvars[] = "m_nvars"; +static char __pyx_k__nfields[] = "nfields"; +static char __pyx_k__omega_b[] = "omega_b"; +static char __pyx_k__omega_k[] = "omega_k"; +static char __pyx_k__omega_l[] = "omega_l"; +static char __pyx_k__omega_m[] = "omega_m"; +static char __pyx_k__strides[] = "strides"; +static char __pyx_k__varname[] = "varname"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__itemsize[] = "itemsize"; +static char __pyx_k__levelmax[] = "levelmax"; +static char __pyx_k__levelmin[] = "levelmin"; +static char __pyx_k__m_header[] = "m_header"; +static char __pyx_k__ndomains[] = "ndomains"; +static char __pyx_k__ngridmax[] = "ngridmax"; +static char __pyx_k__readonly[] = "readonly"; +static char __pyx_k__type_num[] = "type_num"; +static char __pyx_k__byteorder[] = "byteorder"; +static char __pyx_k__field_ind[] = "field_ind"; +static char __pyx_k__grid_dims[] = "grid_dims"; +static char __pyx_k__is_finest[] = "is_finest"; +static char __pyx_k__left_edge[] = "left_edge"; +static char __pyx_k__signature[] = "signature"; +static char __pyx_k__ValueError[] = "ValueError"; +static char __pyx_k__child_mask[] = "child_mask"; +static char __pyx_k__dimensions[] = "dimensions"; +static char __pyx_k__efficiency[] = "efficiency"; +static char __pyx_k__get_parent[] = "get_parent"; +static char __pyx_k__left_edges[] = "left_edges"; +static char __pyx_k__left_index[] = "left_index"; +static char __pyx_k__m_maxlevel[] = "m_maxlevel"; +static char __pyx_k__m_varnames[] = "m_varnames"; +static char __pyx_k__ref_factor[] = "ref_factor"; +static char __pyx_k__right_edge[] = "right_edge"; +static char __pyx_k__suboffsets[] = "suboffsets"; +static char __pyx_k__field_names[] = "field_names"; +static char __pyx_k__grid_levels[] = "grid_levels"; +static char __pyx_k__hydro_datas[] = "hydro_datas"; +static char __pyx_k__m_var_array[] = "m_var_array"; +static char __pyx_k__right_edges[] = "right_edges"; +static char __pyx_k__start_index[] = "start_index"; +static char __pyx_k__RuntimeError[] = "RuntimeError"; +static char __pyx_k__domain_index[] = "domain_index"; +static char __pyx_k__m_AMR_levels[] = "m_AMR_levels"; +static char __pyx_k__nstep_coarse[] = "nstep_coarse"; +static char __pyx_k__ensure_loaded[] = "ensure_loaded"; +static char __pyx_k__snapshot_name[] = "snapshot_name"; +static char __pyx_k__grid_dimensions[] = "grid_dimensions"; +static char __pyx_k__grid_pos_double[] = "grid_pos_double"; +static char __pyx_k__component_grid_info[] = "component_grid_info"; +static char __pyx_k__grid_file_locations[] = "grid_file_locations"; +static PyObject *__pyx_kp_s_1; +static PyObject *__pyx_n_s_2; +static PyObject *__pyx_kp_u_3; +static PyObject *__pyx_kp_u_4; +static PyObject *__pyx_kp_u_5; +static PyObject *__pyx_kp_u_6; +static PyObject *__pyx_kp_u_7; +static PyObject *__pyx_kp_u_8; +static PyObject *__pyx_n_s__F; +static PyObject *__pyx_n_s__H0; +static PyObject *__pyx_n_s__RuntimeError; +static PyObject *__pyx_n_s__ValueError; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__aexp; +static PyObject *__pyx_n_s__argsort; +static PyObject *__pyx_n_s__base; +static PyObject *__pyx_n_s__begin; +static PyObject *__pyx_n_s__boxlen; +static PyObject *__pyx_n_s__buf; +static PyObject *__pyx_n_s__byteorder; +static PyObject *__pyx_n_s__c_str; +static PyObject *__pyx_n_s__child_mask; +static PyObject *__pyx_n_s__component_grid_info; +static PyObject *__pyx_n_s__data; +static PyObject *__pyx_n_s__dd; +static PyObject *__pyx_n_s__descr; +static PyObject *__pyx_n_s__dimensions; +static PyObject *__pyx_n_s__domain; +static PyObject *__pyx_n_s__domain_index; +static PyObject *__pyx_n_s__dtype; +static PyObject *__pyx_n_s__efficiency; +static PyObject *__pyx_n_s__empty; +static PyObject *__pyx_n_s__end; +static PyObject *__pyx_n_s__ensure_loaded; +static PyObject *__pyx_n_s__field; +static PyObject *__pyx_n_s__field_ind; +static PyObject *__pyx_n_s__field_names; +static PyObject *__pyx_n_s__fields; +static PyObject *__pyx_n_s__filled; +static PyObject *__pyx_n_s__float64; +static PyObject *__pyx_n_s__fn; +static PyObject *__pyx_n_s__format; +static PyObject *__pyx_n_s__get_parent; +static PyObject *__pyx_n_s__grid_dimensions; +static PyObject *__pyx_n_s__grid_dims; +static PyObject *__pyx_n_s__grid_file_locations; +static PyObject *__pyx_n_s__grid_id; +static PyObject *__pyx_n_s__grid_levels; +static PyObject *__pyx_n_s__grid_pos_double; +static PyObject *__pyx_n_s__hydro_datas; +static PyObject *__pyx_n_s__int64; +static PyObject *__pyx_n_s__is_finest; +static PyObject *__pyx_n_s__itemsize; +static PyObject *__pyx_n_s__left_edge; +static PyObject *__pyx_n_s__left_edges; +static PyObject *__pyx_n_s__left_index; +static PyObject *__pyx_n_s__level; +static PyObject *__pyx_n_s__levelmax; +static PyObject *__pyx_n_s__levelmin; +static PyObject *__pyx_n_s__loaded; +static PyObject *__pyx_n_s__m_AMR_levels; +static PyObject *__pyx_n_s__m_header; +static PyObject *__pyx_n_s__m_maxlevel; +static PyObject *__pyx_n_s__m_nvars; +static PyObject *__pyx_n_s__m_var_array; +static PyObject *__pyx_n_s__m_varnames; +static PyObject *__pyx_n_s__names; +static PyObject *__pyx_n_s__ncpu; +static PyObject *__pyx_n_s__ndim; +static PyObject *__pyx_n_s__ndomains; +static PyObject *__pyx_n_s__next; +static PyObject *__pyx_n_s__nfields; +static PyObject *__pyx_n_s__ngridmax; +static PyObject *__pyx_n_s__np; +static PyObject *__pyx_n_s__nstep_coarse; +static PyObject *__pyx_n_s__numpy; +static PyObject *__pyx_n_s__obj; +static PyObject *__pyx_n_s__omega_b; +static PyObject *__pyx_n_s__omega_k; +static PyObject *__pyx_n_s__omega_l; +static PyObject *__pyx_n_s__omega_m; +static PyObject *__pyx_n_s__ones; +static PyObject *__pyx_n_s__order; +static PyObject *__pyx_n_s__range; +static PyObject *__pyx_n_s__read; +static PyObject *__pyx_n_s__readonly; +static PyObject *__pyx_n_s__ref_factor; +static PyObject *__pyx_n_s__right_edge; +static PyObject *__pyx_n_s__right_edges; +static PyObject *__pyx_n_s__rsnap; +static PyObject *__pyx_n_s__shape; +static PyObject *__pyx_n_s__signature; +static PyObject *__pyx_n_s__sigs; +static PyObject *__pyx_n_s__size; +static PyObject *__pyx_n_s__snapshot_name; +static PyObject *__pyx_n_s__start_index; +static PyObject *__pyx_n_s__strides; +static PyObject *__pyx_n_s__suboffsets; +static PyObject *__pyx_n_s__time; +static PyObject *__pyx_n_s__trees; +static PyObject *__pyx_n_s__type_num; +static PyObject *__pyx_n_s__unit_d; +static PyObject *__pyx_n_s__unit_l; +static PyObject *__pyx_n_s__unit_t; +static PyObject *__pyx_n_s__varname; +static PyObject *__pyx_n_s__x; +static PyObject *__pyx_n_s__y; +static PyObject *__pyx_n_s__z; +static PyObject *__pyx_n_s__zc; +static PyObject *__pyx_n_s__zeros; +static PyObject *__pyx_n_s__zs; +static PyObject *__pyx_int_0; +static PyObject *__pyx_int_2; +static PyObject *__pyx_int_3; +static PyObject *__pyx_int_neg_1; +static PyObject *__pyx_int_15; + +/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":36 + * cimport cython + * + * cdef inline np.int64_t i64max(np.int64_t i0, np.int64_t i1): # <<<<<<<<<<<<<< + * if i0 > i1: return i0 + * return i1 + */ + +static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_13ramses_reader_i64max(__pyx_t_5numpy_int64_t __pyx_v_i0, __pyx_t_5numpy_int64_t __pyx_v_i1) { + __pyx_t_5numpy_int64_t __pyx_r; + int __pyx_t_1; + __Pyx_RefNannySetupContext("i64max"); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":37 + * + * cdef inline np.int64_t i64max(np.int64_t i0, np.int64_t i1): + * if i0 > i1: return i0 # <<<<<<<<<<<<<< + * return i1 + * + */ + __pyx_t_1 = (__pyx_v_i0 > __pyx_v_i1); + if (__pyx_t_1) { + __pyx_r = __pyx_v_i0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":38 + * cdef inline np.int64_t i64max(np.int64_t i0, np.int64_t i1): + * if i0 > i1: return i0 + * return i1 # <<<<<<<<<<<<<< + * + * cdef inline np.int64_t i64min(np.int64_t i0, np.int64_t i1): + */ + __pyx_r = __pyx_v_i1; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":40 + * return i1 + * + * cdef inline np.int64_t i64min(np.int64_t i0, np.int64_t i1): # <<<<<<<<<<<<<< + * if i0 < i1: return i0 + * return i1 + */ + +static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_13ramses_reader_i64min(__pyx_t_5numpy_int64_t __pyx_v_i0, __pyx_t_5numpy_int64_t __pyx_v_i1) { + __pyx_t_5numpy_int64_t __pyx_r; + int __pyx_t_1; + __Pyx_RefNannySetupContext("i64min"); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":41 + * + * cdef inline np.int64_t i64min(np.int64_t i0, np.int64_t i1): + * if i0 < i1: return i0 # <<<<<<<<<<<<<< + * return i1 + * + */ + __pyx_t_1 = (__pyx_v_i0 < __pyx_v_i1); + if (__pyx_t_1) { + __pyx_r = __pyx_v_i0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":42 + * cdef inline np.int64_t i64min(np.int64_t i0, np.int64_t i1): + * if i0 < i1: return i0 + * return i1 # <<<<<<<<<<<<<< + * + * cdef extern from "" namespace "std": + */ + __pyx_r = __pyx_v_i1; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":379 + * cdef int *loaded + * + * cdef public object field_ind # <<<<<<<<<<<<<< + * cdef public object field_names + * + */ + +static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_9field_ind___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_9field_ind___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_ind); + __pyx_r = ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_ind; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_9field_ind___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_9field_ind___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_ind); + __Pyx_DECREF(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_ind); + ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_ind = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_9field_ind___del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_9field_ind___del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_ind); + __Pyx_DECREF(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_ind); + ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_ind = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":380 + * + * cdef public object field_ind + * cdef public object field_names # <<<<<<<<<<<<<< + * + * # We will store this here so that we have a record, independent of the + */ + +static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_11field_names___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_11field_names___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_names); + __pyx_r = ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_names; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_11field_names___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_11field_names___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_names); + __Pyx_DECREF(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_names); + ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_names = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_11field_names___del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_11field_names___del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_names); + __Pyx_DECREF(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_names); + ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_names = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":386 + * cdef int ndomains, nfields + * + * def __cinit__(self, char *fn): # <<<<<<<<<<<<<< + * cdef int idomain, ifield, ii + * cdef RAMSES_tree *local_tree + */ + +static int __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + char *__pyx_v_fn; + int __pyx_v_idomain; + int __pyx_v_ifield; + int __pyx_v_ii; + RAMSES::AMR::RAMSES_tree *__pyx_v_local_tree; + RAMSES::HYDRO::RAMSES_hydro_data *__pyx_v_local_hydro_data; + std::string *__pyx_v_field_name; + int __pyx_r; + long __pyx_t_1; + int __pyx_t_2; + unsigned int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fn,0}; + __Pyx_RefNannySetupContext("__cinit__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[1] = {0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fn); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_fn = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_fn) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_fn = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_fn) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.ramses_reader.RAMSES_tree_proxy.__cinit__"); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":390 + * cdef RAMSES_tree *local_tree + * cdef RAMSES_hydro_data *local_hydro_data + * self.snapshot_name = new string(fn) # <<<<<<<<<<<<<< + * self.rsnap = new snapshot(deref(self.snapshot_name), version3) + * # We now have to get our field names to fill our array + */ + ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->snapshot_name = new std::string(__pyx_v_fn); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":391 + * cdef RAMSES_hydro_data *local_hydro_data + * self.snapshot_name = new string(fn) + * self.rsnap = new snapshot(deref(self.snapshot_name), version3) # <<<<<<<<<<<<<< + * # We now have to get our field names to fill our array + * self.trees = \ + */ + ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap = new RAMSES::snapshot((*((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->snapshot_name), RAMSES::version3); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":393 + * self.rsnap = new snapshot(deref(self.snapshot_name), version3) + * # We now have to get our field names to fill our array + * self.trees = \ # <<<<<<<<<<<<<< + * malloc(sizeof(RAMSES_tree*) * self.rsnap.m_header.ncpu) + * self.hydro_datas = \ + */ + ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->trees = ((RAMSES::AMR::RAMSES_tree **)malloc(((sizeof(RAMSES::AMR::RAMSES_tree *)) * ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.ncpu))); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":395 + * self.trees = \ + * malloc(sizeof(RAMSES_tree*) * self.rsnap.m_header.ncpu) + * self.hydro_datas = \ # <<<<<<<<<<<<<< + * malloc(sizeof(RAMSES_hydro_data**) * self.rsnap.m_header.ncpu) + * self.ndomains = self.rsnap.m_header.ncpu + */ + ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->hydro_datas = ((RAMSES::HYDRO::RAMSES_hydro_data ***)malloc(((sizeof(RAMSES::HYDRO::RAMSES_hydro_data **)) * ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.ncpu))); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":397 + * self.hydro_datas = \ + * malloc(sizeof(RAMSES_hydro_data**) * self.rsnap.m_header.ncpu) + * self.ndomains = self.rsnap.m_header.ncpu # <<<<<<<<<<<<<< + * #for ii in range(self.ndomains): self.trees[ii] = NULL + * for idomain in range(1, self.rsnap.m_header.ncpu + 1): + */ + ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->ndomains = ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.ncpu; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":399 + * self.ndomains = self.rsnap.m_header.ncpu + * #for ii in range(self.ndomains): self.trees[ii] = NULL + * for idomain in range(1, self.rsnap.m_header.ncpu + 1): # <<<<<<<<<<<<<< + * local_tree = new RAMSES_tree(deref(self.rsnap), idomain, + * self.rsnap.m_header.levelmax, 0) + */ + __pyx_t_1 = (((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.ncpu + 1); + for (__pyx_t_2 = 1; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_idomain = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":401 + * for idomain in range(1, self.rsnap.m_header.ncpu + 1): + * local_tree = new RAMSES_tree(deref(self.rsnap), idomain, + * self.rsnap.m_header.levelmax, 0) # <<<<<<<<<<<<<< + * local_tree.read() + * local_hydro_data = new RAMSES_hydro_data(deref(local_tree)) + */ + __pyx_v_local_tree = new RAMSES::AMR::RAMSES_tree((*((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap), __pyx_v_idomain, ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.levelmax, 0); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":402 + * local_tree = new RAMSES_tree(deref(self.rsnap), idomain, + * self.rsnap.m_header.levelmax, 0) + * local_tree.read() # <<<<<<<<<<<<<< + * local_hydro_data = new RAMSES_hydro_data(deref(local_tree)) + * self.hydro_datas[idomain - 1] = \ + */ + __pyx_v_local_tree->read(); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":403 + * self.rsnap.m_header.levelmax, 0) + * local_tree.read() + * local_hydro_data = new RAMSES_hydro_data(deref(local_tree)) # <<<<<<<<<<<<<< + * self.hydro_datas[idomain - 1] = \ + * malloc(sizeof(RAMSES_hydro_data*) * local_hydro_data.m_nvars) + */ + __pyx_v_local_hydro_data = new RAMSES::HYDRO::RAMSES_hydro_data((*__pyx_v_local_tree)); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":404 + * local_tree.read() + * local_hydro_data = new RAMSES_hydro_data(deref(local_tree)) + * self.hydro_datas[idomain - 1] = \ # <<<<<<<<<<<<<< + * malloc(sizeof(RAMSES_hydro_data*) * local_hydro_data.m_nvars) + * del local_hydro_data + */ + (((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->hydro_datas[(__pyx_v_idomain - 1)]) = ((RAMSES::HYDRO::RAMSES_hydro_data **)malloc(((sizeof(RAMSES::HYDRO::RAMSES_hydro_data *)) * __pyx_v_local_hydro_data->m_nvars))); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":406 + * self.hydro_datas[idomain - 1] = \ + * malloc(sizeof(RAMSES_hydro_data*) * local_hydro_data.m_nvars) + * del local_hydro_data # <<<<<<<<<<<<<< + * for ii in range(local_hydro_data.m_nvars): + * self.hydro_datas[idomain - 1][ii] = \ + */ + delete __pyx_v_local_hydro_data; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":407 + * malloc(sizeof(RAMSES_hydro_data*) * local_hydro_data.m_nvars) + * del local_hydro_data + * for ii in range(local_hydro_data.m_nvars): # <<<<<<<<<<<<<< + * self.hydro_datas[idomain - 1][ii] = \ + * new RAMSES_hydro_data(deref(local_tree)) + */ + __pyx_t_3 = __pyx_v_local_hydro_data->m_nvars; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_ii = __pyx_t_4; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":408 + * del local_hydro_data + * for ii in range(local_hydro_data.m_nvars): + * self.hydro_datas[idomain - 1][ii] = \ # <<<<<<<<<<<<<< + * new RAMSES_hydro_data(deref(local_tree)) + * self.trees[idomain - 1] = local_tree + */ + ((((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->hydro_datas[(__pyx_v_idomain - 1)])[__pyx_v_ii]) = new RAMSES::HYDRO::RAMSES_hydro_data((*__pyx_v_local_tree)); + } + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":410 + * self.hydro_datas[idomain - 1][ii] = \ + * new RAMSES_hydro_data(deref(local_tree)) + * self.trees[idomain - 1] = local_tree # <<<<<<<<<<<<<< + * # We do not delete anything + * # Only once, we read all the field names + */ + (((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->trees[(__pyx_v_idomain - 1)]) = __pyx_v_local_tree; + } + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":413 + * # We do not delete anything + * # Only once, we read all the field names + * self.nfields = local_hydro_data.m_nvars # <<<<<<<<<<<<<< + * cdef string *field_name + * self.field_names = [] + */ + ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->nfields = __pyx_v_local_hydro_data->m_nvars; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":415 + * self.nfields = local_hydro_data.m_nvars + * cdef string *field_name + * self.field_names = [] # <<<<<<<<<<<<<< + * self.field_ind = {} + * self.loaded = malloc(sizeof(int) * local_hydro_data.m_nvars) + */ + __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_names); + __Pyx_DECREF(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_names); + ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_names = ((PyObject *)__pyx_t_5); + __pyx_t_5 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":416 + * cdef string *field_name + * self.field_names = [] + * self.field_ind = {} # <<<<<<<<<<<<<< + * self.loaded = malloc(sizeof(int) * local_hydro_data.m_nvars) + * for ifield in range(local_hydro_data.m_nvars): + */ + __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_ind); + __Pyx_DECREF(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_ind); + ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_ind = ((PyObject *)__pyx_t_5); + __pyx_t_5 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":417 + * self.field_names = [] + * self.field_ind = {} + * self.loaded = malloc(sizeof(int) * local_hydro_data.m_nvars) # <<<<<<<<<<<<<< + * for ifield in range(local_hydro_data.m_nvars): + * field_name = &(local_hydro_data.m_varnames[ifield]) + */ + ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->loaded = ((int *)malloc(((sizeof(int)) * __pyx_v_local_hydro_data->m_nvars))); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":418 + * self.field_ind = {} + * self.loaded = malloc(sizeof(int) * local_hydro_data.m_nvars) + * for ifield in range(local_hydro_data.m_nvars): # <<<<<<<<<<<<<< + * field_name = &(local_hydro_data.m_varnames[ifield]) + * # Does this leak? + */ + __pyx_t_3 = __pyx_v_local_hydro_data->m_nvars; + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2+=1) { + __pyx_v_ifield = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":419 + * self.loaded = malloc(sizeof(int) * local_hydro_data.m_nvars) + * for ifield in range(local_hydro_data.m_nvars): + * field_name = &(local_hydro_data.m_varnames[ifield]) # <<<<<<<<<<<<<< + * # Does this leak? + * self.field_names.append(field_name.c_str()) + */ + __pyx_v_field_name = (&(__pyx_v_local_hydro_data->m_varnames[__pyx_v_ifield])); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":421 + * field_name = &(local_hydro_data.m_varnames[ifield]) + * # Does this leak? + * self.field_names.append(field_name.c_str()) # <<<<<<<<<<<<<< + * self.field_ind[self.field_names[-1]] = ifield + * self.loaded[ifield] = 0 + */ + __pyx_t_5 = PyBytes_FromString(__pyx_v_field_name->c_str()); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_6 = __Pyx_PyObject_Append(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_names, ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":422 + * # Does this leak? + * self.field_names.append(field_name.c_str()) + * self.field_ind[self.field_names[-1]] = ifield # <<<<<<<<<<<<<< + * self.loaded[ifield] = 0 + * # This all needs to be cleaned up in the deallocator + */ + __pyx_t_6 = PyInt_FromLong(__pyx_v_ifield); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = __Pyx_GetItemInt(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_names, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (PyObject_SetItem(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_ind, __pyx_t_5, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":423 + * self.field_names.append(field_name.c_str()) + * self.field_ind[self.field_names[-1]] = ifield + * self.loaded[ifield] = 0 # <<<<<<<<<<<<<< + * # This all needs to be cleaned up in the deallocator + * + */ + (((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->loaded[__pyx_v_ifield]) = 0; + } + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("yt.ramses_reader.RAMSES_tree_proxy.__cinit__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":426 + * # This all needs to be cleaned up in the deallocator + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * cdef int idomain, ifield + * for idomain in range(self.ndomains): + */ + +static void __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy___dealloc__(PyObject *__pyx_v_self) { + int __pyx_v_idomain; + int __pyx_v_ifield; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + __Pyx_RefNannySetupContext("__dealloc__"); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":428 + * def __dealloc__(self): + * cdef int idomain, ifield + * for idomain in range(self.ndomains): # <<<<<<<<<<<<<< + * for ifield in range(self.nfields): + * if self.hydro_datas[idomain][ifield] != NULL: + */ + __pyx_t_1 = ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->ndomains; + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_idomain = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":429 + * cdef int idomain, ifield + * for idomain in range(self.ndomains): + * for ifield in range(self.nfields): # <<<<<<<<<<<<<< + * if self.hydro_datas[idomain][ifield] != NULL: + * del self.hydro_datas[idomain][ifield] + */ + __pyx_t_3 = ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->nfields; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_ifield = __pyx_t_4; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":430 + * for idomain in range(self.ndomains): + * for ifield in range(self.nfields): + * if self.hydro_datas[idomain][ifield] != NULL: # <<<<<<<<<<<<<< + * del self.hydro_datas[idomain][ifield] + * if self.trees[idomain] != NULL: + */ + __pyx_t_5 = (((((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->hydro_datas[__pyx_v_idomain])[__pyx_v_ifield]) != NULL); + if (__pyx_t_5) { + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":431 + * for ifield in range(self.nfields): + * if self.hydro_datas[idomain][ifield] != NULL: + * del self.hydro_datas[idomain][ifield] # <<<<<<<<<<<<<< + * if self.trees[idomain] != NULL: + * del self.trees[idomain] + */ + delete ((((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->hydro_datas[__pyx_v_idomain])[__pyx_v_ifield]); + goto __pyx_L9; + } + __pyx_L9:; + } + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":432 + * if self.hydro_datas[idomain][ifield] != NULL: + * del self.hydro_datas[idomain][ifield] + * if self.trees[idomain] != NULL: # <<<<<<<<<<<<<< + * del self.trees[idomain] + * free(self.hydro_datas[idomain]) + */ + __pyx_t_5 = ((((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->trees[__pyx_v_idomain]) != NULL); + if (__pyx_t_5) { + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":433 + * del self.hydro_datas[idomain][ifield] + * if self.trees[idomain] != NULL: + * del self.trees[idomain] # <<<<<<<<<<<<<< + * free(self.hydro_datas[idomain]) + * free(self.trees) + */ + delete (((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->trees[__pyx_v_idomain]); + goto __pyx_L10; + } + __pyx_L10:; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":434 + * if self.trees[idomain] != NULL: + * del self.trees[idomain] + * free(self.hydro_datas[idomain]) # <<<<<<<<<<<<<< + * free(self.trees) + * free(self.hydro_datas) + */ + free((((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->hydro_datas[__pyx_v_idomain])); + } + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":435 + * del self.trees[idomain] + * free(self.hydro_datas[idomain]) + * free(self.trees) # <<<<<<<<<<<<<< + * free(self.hydro_datas) + * free(self.loaded) + */ + free(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->trees); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":436 + * free(self.hydro_datas[idomain]) + * free(self.trees) + * free(self.hydro_datas) # <<<<<<<<<<<<<< + * free(self.loaded) + * if self.snapshot_name != NULL: del self.snapshot_name + */ + free(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->hydro_datas); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":437 + * free(self.trees) + * free(self.hydro_datas) + * free(self.loaded) # <<<<<<<<<<<<<< + * if self.snapshot_name != NULL: del self.snapshot_name + * if self.rsnap != NULL: del self.rsnap + */ + free(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->loaded); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":438 + * free(self.hydro_datas) + * free(self.loaded) + * if self.snapshot_name != NULL: del self.snapshot_name # <<<<<<<<<<<<<< + * if self.rsnap != NULL: del self.rsnap + * + */ + __pyx_t_5 = (((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->snapshot_name != NULL); + if (__pyx_t_5) { + delete ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->snapshot_name; + goto __pyx_L11; + } + __pyx_L11:; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":439 + * free(self.loaded) + * if self.snapshot_name != NULL: del self.snapshot_name + * if self.rsnap != NULL: del self.rsnap # <<<<<<<<<<<<<< + * + * def count_zones(self): + */ + __pyx_t_5 = (((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap != NULL); + if (__pyx_t_5) { + delete ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap; + goto __pyx_L12; + } + __pyx_L12:; + + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":441 + * if self.rsnap != NULL: del self.rsnap + * + * def count_zones(self): # <<<<<<<<<<<<<< + * # We need to do simulation domains here + * + */ + +static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_count_zones(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_count_zones(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + unsigned int __pyx_v_idomain; + unsigned int __pyx_v_ilevel; + RAMSES::AMR::RAMSES_tree *__pyx_v_local_tree; + RAMSES::HYDRO::RAMSES_hydro_data *__pyx_v_local_hydro_data; + RAMSES::AMR::RAMSES_level *__pyx_v_local_level; + PyObject *__pyx_v_cell_count; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + long __pyx_t_2; + unsigned int __pyx_t_3; + int __pyx_t_4; + long __pyx_t_5; + unsigned int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + __Pyx_RefNannySetupContext("count_zones"); + __pyx_v_cell_count = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":451 + * # All the loop-local pointers must be declared up here + * + * cell_count = [] # <<<<<<<<<<<<<< + * for ilevel in range(self.rsnap.m_header.levelmax + 1): + * cell_count.append(0) + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_v_cell_count)); + __pyx_v_cell_count = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":452 + * + * cell_count = [] + * for ilevel in range(self.rsnap.m_header.levelmax + 1): # <<<<<<<<<<<<<< + * cell_count.append(0) + * for idomain in range(1, self.rsnap.m_header.ncpu + 1): + */ + __pyx_t_2 = (((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.levelmax + 1); + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_ilevel = __pyx_t_3; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":453 + * cell_count = [] + * for ilevel in range(self.rsnap.m_header.levelmax + 1): + * cell_count.append(0) # <<<<<<<<<<<<<< + * for idomain in range(1, self.rsnap.m_header.ncpu + 1): + * local_tree = new RAMSES_tree(deref(self.rsnap), idomain, + */ + if (unlikely(__pyx_v_cell_count == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = PyList_Append(((PyObject *)__pyx_v_cell_count), __pyx_int_0); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":454 + * for ilevel in range(self.rsnap.m_header.levelmax + 1): + * cell_count.append(0) + * for idomain in range(1, self.rsnap.m_header.ncpu + 1): # <<<<<<<<<<<<<< + * local_tree = new RAMSES_tree(deref(self.rsnap), idomain, + * self.rsnap.m_header.levelmax, 0) + */ + __pyx_t_2 = (((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.ncpu + 1); + for (__pyx_t_3 = 1; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_idomain = __pyx_t_3; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":456 + * for idomain in range(1, self.rsnap.m_header.ncpu + 1): + * local_tree = new RAMSES_tree(deref(self.rsnap), idomain, + * self.rsnap.m_header.levelmax, 0) # <<<<<<<<<<<<<< + * local_tree.read() + * local_hydro_data = new RAMSES_hydro_data(deref(local_tree)) + */ + __pyx_v_local_tree = new RAMSES::AMR::RAMSES_tree((*((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap), __pyx_v_idomain, ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.levelmax, 0); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":457 + * local_tree = new RAMSES_tree(deref(self.rsnap), idomain, + * self.rsnap.m_header.levelmax, 0) + * local_tree.read() # <<<<<<<<<<<<<< + * local_hydro_data = new RAMSES_hydro_data(deref(local_tree)) + * for ilevel in range(local_tree.m_maxlevel + 1): + */ + __pyx_v_local_tree->read(); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":458 + * self.rsnap.m_header.levelmax, 0) + * local_tree.read() + * local_hydro_data = new RAMSES_hydro_data(deref(local_tree)) # <<<<<<<<<<<<<< + * for ilevel in range(local_tree.m_maxlevel + 1): + * local_level = &local_tree.m_AMR_levels[ilevel] + */ + __pyx_v_local_hydro_data = new RAMSES::HYDRO::RAMSES_hydro_data((*__pyx_v_local_tree)); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":459 + * local_tree.read() + * local_hydro_data = new RAMSES_hydro_data(deref(local_tree)) + * for ilevel in range(local_tree.m_maxlevel + 1): # <<<<<<<<<<<<<< + * local_level = &local_tree.m_AMR_levels[ilevel] + * cell_count[ilevel] += local_level.size() + */ + __pyx_t_5 = (__pyx_v_local_tree->m_maxlevel + 1); + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_ilevel = __pyx_t_6; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":460 + * local_hydro_data = new RAMSES_hydro_data(deref(local_tree)) + * for ilevel in range(local_tree.m_maxlevel + 1): + * local_level = &local_tree.m_AMR_levels[ilevel] # <<<<<<<<<<<<<< + * cell_count[ilevel] += local_level.size() + * del local_tree, local_hydro_data + */ + __pyx_v_local_level = (&(__pyx_v_local_tree->m_AMR_levels[__pyx_v_ilevel])); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":461 + * for ilevel in range(local_tree.m_maxlevel + 1): + * local_level = &local_tree.m_AMR_levels[ilevel] + * cell_count[ilevel] += local_level.size() # <<<<<<<<<<<<<< + * del local_tree, local_hydro_data + * + */ + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_local_level->size()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_cell_count), __pyx_v_ilevel, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyNumber_InPlaceAdd(__pyx_t_7, __pyx_t_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_cell_count), __pyx_v_ilevel, __pyx_t_8, sizeof(unsigned int)+1, PyLong_FromUnsignedLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":462 + * local_level = &local_tree.m_AMR_levels[ilevel] + * cell_count[ilevel] += local_level.size() + * del local_tree, local_hydro_data # <<<<<<<<<<<<<< + * + * return cell_count + */ + delete __pyx_v_local_tree; + delete __pyx_v_local_hydro_data; + } + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":464 + * del local_tree, local_hydro_data + * + * return cell_count # <<<<<<<<<<<<<< + * + * def ensure_loaded(self, char *varname, int domain_index): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_cell_count)); + __pyx_r = ((PyObject *)__pyx_v_cell_count); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("yt.ramses_reader.RAMSES_tree_proxy.count_zones"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_cell_count); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":466 + * return cell_count + * + * def ensure_loaded(self, char *varname, int domain_index): # <<<<<<<<<<<<<< + * # this domain_index must be zero-indexed + * cdef int varindex = self.field_ind[varname] + */ + +static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_ensure_loaded(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_ensure_loaded(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + char *__pyx_v_varname; + int __pyx_v_domain_index; + int __pyx_v_varindex; + std::string *__pyx_v_field_name; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__varname,&__pyx_n_s__domain_index,0}; + __Pyx_RefNannySetupContext("ensure_loaded"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__varname); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__domain_index); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("ensure_loaded", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "ensure_loaded") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_varname = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_varname) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_domain_index = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_domain_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_varname = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_varname) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_domain_index = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_domain_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("ensure_loaded", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.ramses_reader.RAMSES_tree_proxy.ensure_loaded"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":468 + * def ensure_loaded(self, char *varname, int domain_index): + * # this domain_index must be zero-indexed + * cdef int varindex = self.field_ind[varname] # <<<<<<<<<<<<<< + * cdef string *field_name = new string(varname) + * if self.loaded[varindex] == 1: return + */ + __pyx_t_1 = PyBytes_FromString(__pyx_v_varname); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyObject_GetItem(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_ind, ((PyObject *)__pyx_t_1)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_varindex = __pyx_t_3; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":469 + * # this domain_index must be zero-indexed + * cdef int varindex = self.field_ind[varname] + * cdef string *field_name = new string(varname) # <<<<<<<<<<<<<< + * if self.loaded[varindex] == 1: return + * print "READING FROM DISK", varname + */ + __pyx_v_field_name = new std::string(__pyx_v_varname); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":470 + * cdef int varindex = self.field_ind[varname] + * cdef string *field_name = new string(varname) + * if self.loaded[varindex] == 1: return # <<<<<<<<<<<<<< + * print "READING FROM DISK", varname + * self.hydro_datas[domain_index][varindex].read(deref(field_name)) + */ + __pyx_t_4 = ((((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->loaded[__pyx_v_varindex]) == 1); + if (__pyx_t_4) { + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":471 + * cdef string *field_name = new string(varname) + * if self.loaded[varindex] == 1: return + * print "READING FROM DISK", varname # <<<<<<<<<<<<<< + * self.hydro_datas[domain_index][varindex].read(deref(field_name)) + * self.loaded[varindex] = 1 + */ + __pyx_t_2 = PyBytes_FromString(__pyx_v_varname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + if (__Pyx_Print(0, __pyx_t_1, 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":472 + * if self.loaded[varindex] == 1: return + * print "READING FROM DISK", varname + * self.hydro_datas[domain_index][varindex].read(deref(field_name)) # <<<<<<<<<<<<<< + * self.loaded[varindex] = 1 + * del field_name + */ + ((((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->hydro_datas[__pyx_v_domain_index])[__pyx_v_varindex])->read((*__pyx_v_field_name)); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":473 + * print "READING FROM DISK", varname + * self.hydro_datas[domain_index][varindex].read(deref(field_name)) + * self.loaded[varindex] = 1 # <<<<<<<<<<<<<< + * del field_name + * + */ + (((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->loaded[__pyx_v_varindex]) = 1; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":474 + * self.hydro_datas[domain_index][varindex].read(deref(field_name)) + * self.loaded[varindex] = 1 + * del field_name # <<<<<<<<<<<<<< + * + * def clear_tree(self, char *varname, int domain_index): + */ + delete __pyx_v_field_name; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("yt.ramses_reader.RAMSES_tree_proxy.ensure_loaded"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":476 + * del field_name + * + * def clear_tree(self, char *varname, int domain_index): # <<<<<<<<<<<<<< + * # this domain_index must be zero-indexed + * # We delete and re-create + */ + +static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_clear_tree(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_clear_tree(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + char *__pyx_v_varname; + int __pyx_v_domain_index; + int __pyx_v_varindex; + std::string *__pyx_v_field_name; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__varname,&__pyx_n_s__domain_index,0}; + __Pyx_RefNannySetupContext("clear_tree"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__varname); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__domain_index); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("clear_tree", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "clear_tree") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_varname = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_varname) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_domain_index = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_domain_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_varname = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_varname) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_domain_index = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_domain_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("clear_tree", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.ramses_reader.RAMSES_tree_proxy.clear_tree"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":479 + * # this domain_index must be zero-indexed + * # We delete and re-create + * cdef int varindex = self.field_ind[varname] # <<<<<<<<<<<<<< + * cdef string *field_name = new string(varname) + * if self.loaded[varindex] == 0: return + */ + __pyx_t_1 = PyBytes_FromString(__pyx_v_varname); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyObject_GetItem(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_ind, ((PyObject *)__pyx_t_1)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_varindex = __pyx_t_3; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":480 + * # We delete and re-create + * cdef int varindex = self.field_ind[varname] + * cdef string *field_name = new string(varname) # <<<<<<<<<<<<<< + * if self.loaded[varindex] == 0: return + * del self.hydro_datas[domain_index][varindex] + */ + __pyx_v_field_name = new std::string(__pyx_v_varname); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":481 + * cdef int varindex = self.field_ind[varname] + * cdef string *field_name = new string(varname) + * if self.loaded[varindex] == 0: return # <<<<<<<<<<<<<< + * del self.hydro_datas[domain_index][varindex] + * self.hydro_datas[domain_index - 1][varindex] = \ + */ + __pyx_t_4 = ((((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->loaded[__pyx_v_varindex]) == 0); + if (__pyx_t_4) { + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":482 + * cdef string *field_name = new string(varname) + * if self.loaded[varindex] == 0: return + * del self.hydro_datas[domain_index][varindex] # <<<<<<<<<<<<<< + * self.hydro_datas[domain_index - 1][varindex] = \ + * new RAMSES_hydro_data(deref(self.trees[domain_index])) + */ + delete ((((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->hydro_datas[__pyx_v_domain_index])[__pyx_v_varindex]); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":483 + * if self.loaded[varindex] == 0: return + * del self.hydro_datas[domain_index][varindex] + * self.hydro_datas[domain_index - 1][varindex] = \ # <<<<<<<<<<<<<< + * new RAMSES_hydro_data(deref(self.trees[domain_index])) + * self.loaded[varindex] = 0 + */ + ((((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->hydro_datas[(__pyx_v_domain_index - 1)])[__pyx_v_varindex]) = new RAMSES::HYDRO::RAMSES_hydro_data((*(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->trees[__pyx_v_domain_index]))); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":485 + * self.hydro_datas[domain_index - 1][varindex] = \ + * new RAMSES_hydro_data(deref(self.trees[domain_index])) + * self.loaded[varindex] = 0 # <<<<<<<<<<<<<< + * del field_name + * + */ + (((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->loaded[__pyx_v_varindex]) = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":486 + * new RAMSES_hydro_data(deref(self.trees[domain_index])) + * self.loaded[varindex] = 0 + * del field_name # <<<<<<<<<<<<<< + * + * def get_file_info(self): + */ + delete __pyx_v_field_name; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("yt.ramses_reader.RAMSES_tree_proxy.clear_tree"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":488 + * del field_name + * + * def get_file_info(self): # <<<<<<<<<<<<<< + * header_info = {} + * header_info["ncpu"] = self.rsnap.m_header.ncpu + */ + +static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_get_file_info(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_get_file_info(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_v_header_info; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("get_file_info"); + __pyx_v_header_info = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":489 + * + * def get_file_info(self): + * header_info = {} # <<<<<<<<<<<<<< + * header_info["ncpu"] = self.rsnap.m_header.ncpu + * header_info["ndim"] = self.rsnap.m_header.ndim + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_v_header_info)); + __pyx_v_header_info = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":490 + * def get_file_info(self): + * header_info = {} + * header_info["ncpu"] = self.rsnap.m_header.ncpu # <<<<<<<<<<<<<< + * header_info["ndim"] = self.rsnap.m_header.ndim + * header_info["levelmin"] = self.rsnap.m_header.levelmin + */ + __pyx_t_1 = PyLong_FromUnsignedLong(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.ncpu); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(((PyObject *)__pyx_v_header_info), ((PyObject *)__pyx_n_s__ncpu), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":491 + * header_info = {} + * header_info["ncpu"] = self.rsnap.m_header.ncpu + * header_info["ndim"] = self.rsnap.m_header.ndim # <<<<<<<<<<<<<< + * header_info["levelmin"] = self.rsnap.m_header.levelmin + * header_info["levelmax"] = self.rsnap.m_header.levelmax + */ + __pyx_t_1 = PyLong_FromUnsignedLong(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(((PyObject *)__pyx_v_header_info), ((PyObject *)__pyx_n_s__ndim), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":492 + * header_info["ncpu"] = self.rsnap.m_header.ncpu + * header_info["ndim"] = self.rsnap.m_header.ndim + * header_info["levelmin"] = self.rsnap.m_header.levelmin # <<<<<<<<<<<<<< + * header_info["levelmax"] = self.rsnap.m_header.levelmax + * header_info["ngridmax"] = self.rsnap.m_header.ngridmax + */ + __pyx_t_1 = PyLong_FromUnsignedLong(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.levelmin); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(((PyObject *)__pyx_v_header_info), ((PyObject *)__pyx_n_s__levelmin), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":493 + * header_info["ndim"] = self.rsnap.m_header.ndim + * header_info["levelmin"] = self.rsnap.m_header.levelmin + * header_info["levelmax"] = self.rsnap.m_header.levelmax # <<<<<<<<<<<<<< + * header_info["ngridmax"] = self.rsnap.m_header.ngridmax + * header_info["nstep_coarse"] = self.rsnap.m_header.nstep_coarse + */ + __pyx_t_1 = PyLong_FromUnsignedLong(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.levelmax); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(((PyObject *)__pyx_v_header_info), ((PyObject *)__pyx_n_s__levelmax), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":494 + * header_info["levelmin"] = self.rsnap.m_header.levelmin + * header_info["levelmax"] = self.rsnap.m_header.levelmax + * header_info["ngridmax"] = self.rsnap.m_header.ngridmax # <<<<<<<<<<<<<< + * header_info["nstep_coarse"] = self.rsnap.m_header.nstep_coarse + * header_info["boxlen"] = self.rsnap.m_header.boxlen + */ + __pyx_t_1 = PyLong_FromUnsignedLong(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.ngridmax); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(((PyObject *)__pyx_v_header_info), ((PyObject *)__pyx_n_s__ngridmax), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":495 + * header_info["levelmax"] = self.rsnap.m_header.levelmax + * header_info["ngridmax"] = self.rsnap.m_header.ngridmax + * header_info["nstep_coarse"] = self.rsnap.m_header.nstep_coarse # <<<<<<<<<<<<<< + * header_info["boxlen"] = self.rsnap.m_header.boxlen + * header_info["time"] = self.rsnap.m_header.time + */ + __pyx_t_1 = PyLong_FromUnsignedLong(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.nstep_coarse); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(((PyObject *)__pyx_v_header_info), ((PyObject *)__pyx_n_s__nstep_coarse), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":496 + * header_info["ngridmax"] = self.rsnap.m_header.ngridmax + * header_info["nstep_coarse"] = self.rsnap.m_header.nstep_coarse + * header_info["boxlen"] = self.rsnap.m_header.boxlen # <<<<<<<<<<<<<< + * header_info["time"] = self.rsnap.m_header.time + * header_info["aexp"] = self.rsnap.m_header.aexp + */ + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.boxlen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(((PyObject *)__pyx_v_header_info), ((PyObject *)__pyx_n_s__boxlen), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":497 + * header_info["nstep_coarse"] = self.rsnap.m_header.nstep_coarse + * header_info["boxlen"] = self.rsnap.m_header.boxlen + * header_info["time"] = self.rsnap.m_header.time # <<<<<<<<<<<<<< + * header_info["aexp"] = self.rsnap.m_header.aexp + * header_info["H0"] = self.rsnap.m_header.H0 + */ + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.time); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(((PyObject *)__pyx_v_header_info), ((PyObject *)__pyx_n_s__time), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":498 + * header_info["boxlen"] = self.rsnap.m_header.boxlen + * header_info["time"] = self.rsnap.m_header.time + * header_info["aexp"] = self.rsnap.m_header.aexp # <<<<<<<<<<<<<< + * header_info["H0"] = self.rsnap.m_header.H0 + * header_info["omega_m"] = self.rsnap.m_header.omega_m + */ + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.aexp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(((PyObject *)__pyx_v_header_info), ((PyObject *)__pyx_n_s__aexp), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":499 + * header_info["time"] = self.rsnap.m_header.time + * header_info["aexp"] = self.rsnap.m_header.aexp + * header_info["H0"] = self.rsnap.m_header.H0 # <<<<<<<<<<<<<< + * header_info["omega_m"] = self.rsnap.m_header.omega_m + * header_info["omega_l"] = self.rsnap.m_header.omega_l + */ + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.H0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(((PyObject *)__pyx_v_header_info), ((PyObject *)__pyx_n_s__H0), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":500 + * header_info["aexp"] = self.rsnap.m_header.aexp + * header_info["H0"] = self.rsnap.m_header.H0 + * header_info["omega_m"] = self.rsnap.m_header.omega_m # <<<<<<<<<<<<<< + * header_info["omega_l"] = self.rsnap.m_header.omega_l + * header_info["omega_k"] = self.rsnap.m_header.omega_k + */ + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.omega_m); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(((PyObject *)__pyx_v_header_info), ((PyObject *)__pyx_n_s__omega_m), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":501 + * header_info["H0"] = self.rsnap.m_header.H0 + * header_info["omega_m"] = self.rsnap.m_header.omega_m + * header_info["omega_l"] = self.rsnap.m_header.omega_l # <<<<<<<<<<<<<< + * header_info["omega_k"] = self.rsnap.m_header.omega_k + * header_info["omega_b"] = self.rsnap.m_header.omega_b + */ + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.omega_l); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(((PyObject *)__pyx_v_header_info), ((PyObject *)__pyx_n_s__omega_l), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":502 + * header_info["omega_m"] = self.rsnap.m_header.omega_m + * header_info["omega_l"] = self.rsnap.m_header.omega_l + * header_info["omega_k"] = self.rsnap.m_header.omega_k # <<<<<<<<<<<<<< + * header_info["omega_b"] = self.rsnap.m_header.omega_b + * header_info["unit_l"] = self.rsnap.m_header.unit_l + */ + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.omega_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(((PyObject *)__pyx_v_header_info), ((PyObject *)__pyx_n_s__omega_k), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":503 + * header_info["omega_l"] = self.rsnap.m_header.omega_l + * header_info["omega_k"] = self.rsnap.m_header.omega_k + * header_info["omega_b"] = self.rsnap.m_header.omega_b # <<<<<<<<<<<<<< + * header_info["unit_l"] = self.rsnap.m_header.unit_l + * header_info["unit_d"] = self.rsnap.m_header.unit_d + */ + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.omega_b); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(((PyObject *)__pyx_v_header_info), ((PyObject *)__pyx_n_s__omega_b), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":504 + * header_info["omega_k"] = self.rsnap.m_header.omega_k + * header_info["omega_b"] = self.rsnap.m_header.omega_b + * header_info["unit_l"] = self.rsnap.m_header.unit_l # <<<<<<<<<<<<<< + * header_info["unit_d"] = self.rsnap.m_header.unit_d + * header_info["unit_t"] = self.rsnap.m_header.unit_t + */ + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.unit_l); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(((PyObject *)__pyx_v_header_info), ((PyObject *)__pyx_n_s__unit_l), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":505 + * header_info["omega_b"] = self.rsnap.m_header.omega_b + * header_info["unit_l"] = self.rsnap.m_header.unit_l + * header_info["unit_d"] = self.rsnap.m_header.unit_d # <<<<<<<<<<<<<< + * header_info["unit_t"] = self.rsnap.m_header.unit_t + * return header_info + */ + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.unit_d); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(((PyObject *)__pyx_v_header_info), ((PyObject *)__pyx_n_s__unit_d), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":506 + * header_info["unit_l"] = self.rsnap.m_header.unit_l + * header_info["unit_d"] = self.rsnap.m_header.unit_d + * header_info["unit_t"] = self.rsnap.m_header.unit_t # <<<<<<<<<<<<<< + * return header_info + * + */ + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.unit_t); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(((PyObject *)__pyx_v_header_info), ((PyObject *)__pyx_n_s__unit_t), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":507 + * header_info["unit_d"] = self.rsnap.m_header.unit_d + * header_info["unit_t"] = self.rsnap.m_header.unit_t + * return header_info # <<<<<<<<<<<<<< + * + * def fill_hierarchy_arrays(self, + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_header_info)); + __pyx_r = ((PyObject *)__pyx_v_header_info); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("yt.ramses_reader.RAMSES_tree_proxy.get_file_info"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_header_info); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":509 + * return header_info + * + * def fill_hierarchy_arrays(self, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t, ndim=2] left_edges, + * np.ndarray[np.float64_t, ndim=2] right_edges, + */ + +static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_fill_hierarchy_arrays(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_fill_hierarchy_arrays(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_left_edges = 0; + PyArrayObject *__pyx_v_right_edges = 0; + PyArrayObject *__pyx_v_grid_levels = 0; + PyArrayObject *__pyx_v_grid_file_locations = 0; + PyArrayObject *__pyx_v_child_mask = 0; + unsigned int __pyx_v_idomain; + unsigned int __pyx_v_ilevel; + RAMSES::AMR::RAMSES_tree *__pyx_v_local_tree; + RAMSES::HYDRO::RAMSES_hydro_data *__pyx_v_local_hydro_data; + RAMSES::AMR::RAMSES_tree::iterator __pyx_v_grid_it; + RAMSES::AMR::RAMSES_tree::iterator __pyx_v_grid_end; + RAMSES::AMR::RAMSES_tree::iterator __pyx_v_father_it; + RAMSES::AMR::vec __pyx_v_gvec; + int __pyx_v_grid_ind; + unsigned int __pyx_v_parent_ind; + int __pyx_v_ci; + double __pyx_v_grid_half_width; + __pyx_t_5numpy_int32_t __pyx_v_rr; + PyObject *__pyx_v_cell_count; + PyObject *__pyx_v_level_cell_counts; + Py_buffer __pyx_bstruct_right_edges; + Py_ssize_t __pyx_bstride_0_right_edges = 0; + Py_ssize_t __pyx_bstride_1_right_edges = 0; + Py_ssize_t __pyx_bshape_0_right_edges = 0; + Py_ssize_t __pyx_bshape_1_right_edges = 0; + Py_buffer __pyx_bstruct_grid_levels; + Py_ssize_t __pyx_bstride_0_grid_levels = 0; + Py_ssize_t __pyx_bstride_1_grid_levels = 0; + Py_ssize_t __pyx_bshape_0_grid_levels = 0; + Py_ssize_t __pyx_bshape_1_grid_levels = 0; + Py_buffer __pyx_bstruct_grid_file_locations; + Py_ssize_t __pyx_bstride_0_grid_file_locations = 0; + Py_ssize_t __pyx_bstride_1_grid_file_locations = 0; + Py_ssize_t __pyx_bshape_0_grid_file_locations = 0; + Py_ssize_t __pyx_bshape_1_grid_file_locations = 0; + Py_buffer __pyx_bstruct_child_mask; + Py_ssize_t __pyx_bstride_0_child_mask = 0; + Py_ssize_t __pyx_bstride_1_child_mask = 0; + Py_ssize_t __pyx_bshape_0_child_mask = 0; + Py_ssize_t __pyx_bshape_1_child_mask = 0; + Py_buffer __pyx_bstruct_left_edges; + Py_ssize_t __pyx_bstride_0_left_edges = 0; + Py_ssize_t __pyx_bstride_1_left_edges = 0; + Py_ssize_t __pyx_bshape_0_left_edges = 0; + Py_ssize_t __pyx_bshape_1_left_edges = 0; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + long __pyx_t_2; + unsigned int __pyx_t_3; + long __pyx_t_4; + unsigned int __pyx_t_5; + long __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + long __pyx_t_10; + int __pyx_t_11; + long __pyx_t_12; + int __pyx_t_13; + long __pyx_t_14; + int __pyx_t_15; + long __pyx_t_16; + int __pyx_t_17; + long __pyx_t_18; + int __pyx_t_19; + long __pyx_t_20; + int __pyx_t_21; + long __pyx_t_22; + int __pyx_t_23; + PyObject *__pyx_t_24 = NULL; + PyObject *__pyx_t_25 = NULL; + __pyx_t_5numpy_int64_t __pyx_t_26; + long __pyx_t_27; + int __pyx_t_28; + long __pyx_t_29; + int __pyx_t_30; + long __pyx_t_31; + int __pyx_t_32; + int __pyx_t_33; + int __pyx_t_34; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__left_edges,&__pyx_n_s__right_edges,&__pyx_n_s__grid_levels,&__pyx_n_s__grid_file_locations,&__pyx_n_s__child_mask,0}; + __Pyx_RefNannySetupContext("fill_hierarchy_arrays"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[5] = {0,0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left_edges); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right_edges); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("fill_hierarchy_arrays", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid_levels); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("fill_hierarchy_arrays", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid_file_locations); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("fill_hierarchy_arrays", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__child_mask); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("fill_hierarchy_arrays", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "fill_hierarchy_arrays") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_left_edges = ((PyArrayObject *)values[0]); + __pyx_v_right_edges = ((PyArrayObject *)values[1]); + __pyx_v_grid_levels = ((PyArrayObject *)values[2]); + __pyx_v_grid_file_locations = ((PyArrayObject *)values[3]); + __pyx_v_child_mask = ((PyArrayObject *)values[4]); + } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_left_edges = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); + __pyx_v_right_edges = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); + __pyx_v_grid_levels = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); + __pyx_v_grid_file_locations = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); + __pyx_v_child_mask = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("fill_hierarchy_arrays", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.ramses_reader.RAMSES_tree_proxy.fill_hierarchy_arrays"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_cell_count = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_level_cell_counts = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_bstruct_left_edges.buf = NULL; + __pyx_bstruct_right_edges.buf = NULL; + __pyx_bstruct_grid_levels.buf = NULL; + __pyx_bstruct_grid_file_locations.buf = NULL; + __pyx_bstruct_child_mask.buf = NULL; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left_edges), __pyx_ptype_5numpy_ndarray, 1, "left_edges", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right_edges), __pyx_ptype_5numpy_ndarray, 1, "right_edges", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grid_levels), __pyx_ptype_5numpy_ndarray, 1, "grid_levels", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grid_file_locations), __pyx_ptype_5numpy_ndarray, 1, "grid_file_locations", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_child_mask), __pyx_ptype_5numpy_ndarray, 1, "child_mask", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_left_edges, (PyObject*)__pyx_v_left_edges, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_left_edges = __pyx_bstruct_left_edges.strides[0]; __pyx_bstride_1_left_edges = __pyx_bstruct_left_edges.strides[1]; + __pyx_bshape_0_left_edges = __pyx_bstruct_left_edges.shape[0]; __pyx_bshape_1_left_edges = __pyx_bstruct_left_edges.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_right_edges, (PyObject*)__pyx_v_right_edges, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_right_edges = __pyx_bstruct_right_edges.strides[0]; __pyx_bstride_1_right_edges = __pyx_bstruct_right_edges.strides[1]; + __pyx_bshape_0_right_edges = __pyx_bstruct_right_edges.shape[0]; __pyx_bshape_1_right_edges = __pyx_bstruct_right_edges.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_grid_levels, (PyObject*)__pyx_v_grid_levels, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_grid_levels = __pyx_bstruct_grid_levels.strides[0]; __pyx_bstride_1_grid_levels = __pyx_bstruct_grid_levels.strides[1]; + __pyx_bshape_0_grid_levels = __pyx_bstruct_grid_levels.shape[0]; __pyx_bshape_1_grid_levels = __pyx_bstruct_grid_levels.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_grid_file_locations, (PyObject*)__pyx_v_grid_file_locations, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_grid_file_locations = __pyx_bstruct_grid_file_locations.strides[0]; __pyx_bstride_1_grid_file_locations = __pyx_bstruct_grid_file_locations.strides[1]; + __pyx_bshape_0_grid_file_locations = __pyx_bstruct_grid_file_locations.shape[0]; __pyx_bshape_1_grid_file_locations = __pyx_bstruct_grid_file_locations.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_child_mask, (PyObject*)__pyx_v_child_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_child_mask = __pyx_bstruct_child_mask.strides[0]; __pyx_bstride_1_child_mask = __pyx_bstruct_child_mask.strides[1]; + __pyx_bshape_0_child_mask = __pyx_bstruct_child_mask.shape[0]; __pyx_bshape_1_child_mask = __pyx_bstruct_child_mask.shape[1]; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":526 + * cdef tree_iterator grid_it, grid_end, father_it + * cdef vec[double] gvec + * cdef int grid_ind = 0 # <<<<<<<<<<<<<< + * cdef unsigned parent_ind + * cdef bint ci + */ + __pyx_v_grid_ind = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":533 + * + * cdef np.int32_t rr + * cell_count = [] # <<<<<<<<<<<<<< + * level_cell_counts = {} + * for idomain in range(1, self.rsnap.m_header.ncpu + 1): + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_v_cell_count)); + __pyx_v_cell_count = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":534 + * cdef np.int32_t rr + * cell_count = [] + * level_cell_counts = {} # <<<<<<<<<<<<<< + * for idomain in range(1, self.rsnap.m_header.ncpu + 1): + * local_tree = new RAMSES_tree(deref(self.rsnap), idomain, + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_v_level_cell_counts)); + __pyx_v_level_cell_counts = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":535 + * cell_count = [] + * level_cell_counts = {} + * for idomain in range(1, self.rsnap.m_header.ncpu + 1): # <<<<<<<<<<<<<< + * local_tree = new RAMSES_tree(deref(self.rsnap), idomain, + * self.rsnap.m_header.levelmax, 0) + */ + __pyx_t_2 = (((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.ncpu + 1); + for (__pyx_t_3 = 1; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_idomain = __pyx_t_3; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":537 + * for idomain in range(1, self.rsnap.m_header.ncpu + 1): + * local_tree = new RAMSES_tree(deref(self.rsnap), idomain, + * self.rsnap.m_header.levelmax, 0) # <<<<<<<<<<<<<< + * local_tree.read() + * local_hydro_data = new RAMSES_hydro_data(deref(local_tree)) + */ + __pyx_v_local_tree = new RAMSES::AMR::RAMSES_tree((*((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap), __pyx_v_idomain, ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.levelmax, 0); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":538 + * local_tree = new RAMSES_tree(deref(self.rsnap), idomain, + * self.rsnap.m_header.levelmax, 0) + * local_tree.read() # <<<<<<<<<<<<<< + * local_hydro_data = new RAMSES_hydro_data(deref(local_tree)) + * for ilevel in range(local_tree.m_maxlevel + 1): + */ + __pyx_v_local_tree->read(); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":539 + * self.rsnap.m_header.levelmax, 0) + * local_tree.read() + * local_hydro_data = new RAMSES_hydro_data(deref(local_tree)) # <<<<<<<<<<<<<< + * for ilevel in range(local_tree.m_maxlevel + 1): + * # this gets overwritten for every domain, which is okay + */ + __pyx_v_local_hydro_data = new RAMSES::HYDRO::RAMSES_hydro_data((*__pyx_v_local_tree)); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":540 + * local_tree.read() + * local_hydro_data = new RAMSES_hydro_data(deref(local_tree)) + * for ilevel in range(local_tree.m_maxlevel + 1): # <<<<<<<<<<<<<< + * # this gets overwritten for every domain, which is okay + * level_cell_counts[ilevel] = grid_ind + */ + __pyx_t_4 = (__pyx_v_local_tree->m_maxlevel + 1); + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_ilevel = __pyx_t_5; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":542 + * for ilevel in range(local_tree.m_maxlevel + 1): + * # this gets overwritten for every domain, which is okay + * level_cell_counts[ilevel] = grid_ind # <<<<<<<<<<<<<< + * grid_half_width = self.rsnap.m_header.boxlen / (2**(ilevel + 1)) + * grid_it = local_tree.begin(ilevel) + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_grid_ind); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_level_cell_counts), __pyx_v_ilevel, __pyx_t_1, sizeof(unsigned int)+1, PyLong_FromUnsignedLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":543 + * # this gets overwritten for every domain, which is okay + * level_cell_counts[ilevel] = grid_ind + * grid_half_width = self.rsnap.m_header.boxlen / (2**(ilevel + 1)) # <<<<<<<<<<<<<< + * grid_it = local_tree.begin(ilevel) + * grid_end = local_tree.end(ilevel) + */ + __pyx_t_6 = __Pyx_pow_long(2, (__pyx_v_ilevel + 1)); + if (unlikely(__pyx_t_6 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_grid_half_width = (((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.boxlen / __pyx_t_6); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":544 + * level_cell_counts[ilevel] = grid_ind + * grid_half_width = self.rsnap.m_header.boxlen / (2**(ilevel + 1)) + * grid_it = local_tree.begin(ilevel) # <<<<<<<<<<<<<< + * grid_end = local_tree.end(ilevel) + * while grid_it != grid_end: + */ + __pyx_v_grid_it = __pyx_v_local_tree->begin(__pyx_v_ilevel); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":545 + * grid_half_width = self.rsnap.m_header.boxlen / (2**(ilevel + 1)) + * grid_it = local_tree.begin(ilevel) + * grid_end = local_tree.end(ilevel) # <<<<<<<<<<<<<< + * while grid_it != grid_end: + * gvec = local_tree.grid_pos_double(grid_it) + */ + __pyx_v_grid_end = __pyx_v_local_tree->end(__pyx_v_ilevel); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":546 + * grid_it = local_tree.begin(ilevel) + * grid_end = local_tree.end(ilevel) + * while grid_it != grid_end: # <<<<<<<<<<<<<< + * gvec = local_tree.grid_pos_double(grid_it) + * left_edges[grid_ind, 0] = gvec.x - grid_half_width + */ + while (1) { + __pyx_t_7 = (__pyx_v_grid_it != __pyx_v_grid_end); + if (!__pyx_t_7) break; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":547 + * grid_end = local_tree.end(ilevel) + * while grid_it != grid_end: + * gvec = local_tree.grid_pos_double(grid_it) # <<<<<<<<<<<<<< + * left_edges[grid_ind, 0] = gvec.x - grid_half_width + * left_edges[grid_ind, 1] = gvec.y - grid_half_width + */ + __pyx_v_gvec = __pyx_v_local_tree->grid_pos(__pyx_v_grid_it); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":548 + * while grid_it != grid_end: + * gvec = local_tree.grid_pos_double(grid_it) + * left_edges[grid_ind, 0] = gvec.x - grid_half_width # <<<<<<<<<<<<<< + * left_edges[grid_ind, 1] = gvec.y - grid_half_width + * left_edges[grid_ind, 2] = gvec.z - grid_half_width + */ + __pyx_t_8 = __pyx_v_grid_ind; + __pyx_t_6 = 0; + __pyx_t_9 = -1; + if (__pyx_t_8 < 0) { + __pyx_t_8 += __pyx_bshape_0_left_edges; + if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_8 >= __pyx_bshape_0_left_edges)) __pyx_t_9 = 0; + if (__pyx_t_6 < 0) { + __pyx_t_6 += __pyx_bshape_1_left_edges; + if (unlikely(__pyx_t_6 < 0)) __pyx_t_9 = 1; + } else if (unlikely(__pyx_t_6 >= __pyx_bshape_1_left_edges)) __pyx_t_9 = 1; + if (unlikely(__pyx_t_9 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_9); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edges.buf, __pyx_t_8, __pyx_bstride_0_left_edges, __pyx_t_6, __pyx_bstride_1_left_edges) = (__pyx_v_gvec.x - __pyx_v_grid_half_width); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":549 + * gvec = local_tree.grid_pos_double(grid_it) + * left_edges[grid_ind, 0] = gvec.x - grid_half_width + * left_edges[grid_ind, 1] = gvec.y - grid_half_width # <<<<<<<<<<<<<< + * left_edges[grid_ind, 2] = gvec.z - grid_half_width + * right_edges[grid_ind, 0] = gvec.x + grid_half_width + */ + __pyx_t_9 = __pyx_v_grid_ind; + __pyx_t_10 = 1; + __pyx_t_11 = -1; + if (__pyx_t_9 < 0) { + __pyx_t_9 += __pyx_bshape_0_left_edges; + if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 0; + } else if (unlikely(__pyx_t_9 >= __pyx_bshape_0_left_edges)) __pyx_t_11 = 0; + if (__pyx_t_10 < 0) { + __pyx_t_10 += __pyx_bshape_1_left_edges; + if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 1; + } else if (unlikely(__pyx_t_10 >= __pyx_bshape_1_left_edges)) __pyx_t_11 = 1; + if (unlikely(__pyx_t_11 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_11); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edges.buf, __pyx_t_9, __pyx_bstride_0_left_edges, __pyx_t_10, __pyx_bstride_1_left_edges) = (__pyx_v_gvec.y - __pyx_v_grid_half_width); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":550 + * left_edges[grid_ind, 0] = gvec.x - grid_half_width + * left_edges[grid_ind, 1] = gvec.y - grid_half_width + * left_edges[grid_ind, 2] = gvec.z - grid_half_width # <<<<<<<<<<<<<< + * right_edges[grid_ind, 0] = gvec.x + grid_half_width + * right_edges[grid_ind, 1] = gvec.y + grid_half_width + */ + __pyx_t_11 = __pyx_v_grid_ind; + __pyx_t_12 = 2; + __pyx_t_13 = -1; + if (__pyx_t_11 < 0) { + __pyx_t_11 += __pyx_bshape_0_left_edges; + if (unlikely(__pyx_t_11 < 0)) __pyx_t_13 = 0; + } else if (unlikely(__pyx_t_11 >= __pyx_bshape_0_left_edges)) __pyx_t_13 = 0; + if (__pyx_t_12 < 0) { + __pyx_t_12 += __pyx_bshape_1_left_edges; + if (unlikely(__pyx_t_12 < 0)) __pyx_t_13 = 1; + } else if (unlikely(__pyx_t_12 >= __pyx_bshape_1_left_edges)) __pyx_t_13 = 1; + if (unlikely(__pyx_t_13 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_13); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edges.buf, __pyx_t_11, __pyx_bstride_0_left_edges, __pyx_t_12, __pyx_bstride_1_left_edges) = (__pyx_v_gvec.z - __pyx_v_grid_half_width); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":551 + * left_edges[grid_ind, 1] = gvec.y - grid_half_width + * left_edges[grid_ind, 2] = gvec.z - grid_half_width + * right_edges[grid_ind, 0] = gvec.x + grid_half_width # <<<<<<<<<<<<<< + * right_edges[grid_ind, 1] = gvec.y + grid_half_width + * right_edges[grid_ind, 2] = gvec.z + grid_half_width + */ + __pyx_t_13 = __pyx_v_grid_ind; + __pyx_t_14 = 0; + __pyx_t_15 = -1; + if (__pyx_t_13 < 0) { + __pyx_t_13 += __pyx_bshape_0_right_edges; + if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 0; + } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_right_edges)) __pyx_t_15 = 0; + if (__pyx_t_14 < 0) { + __pyx_t_14 += __pyx_bshape_1_right_edges; + if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 1; + } else if (unlikely(__pyx_t_14 >= __pyx_bshape_1_right_edges)) __pyx_t_15 = 1; + if (unlikely(__pyx_t_15 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_15); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edges.buf, __pyx_t_13, __pyx_bstride_0_right_edges, __pyx_t_14, __pyx_bstride_1_right_edges) = (__pyx_v_gvec.x + __pyx_v_grid_half_width); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":552 + * left_edges[grid_ind, 2] = gvec.z - grid_half_width + * right_edges[grid_ind, 0] = gvec.x + grid_half_width + * right_edges[grid_ind, 1] = gvec.y + grid_half_width # <<<<<<<<<<<<<< + * right_edges[grid_ind, 2] = gvec.z + grid_half_width + * grid_levels[grid_ind, 0] = ilevel + */ + __pyx_t_15 = __pyx_v_grid_ind; + __pyx_t_16 = 1; + __pyx_t_17 = -1; + if (__pyx_t_15 < 0) { + __pyx_t_15 += __pyx_bshape_0_right_edges; + if (unlikely(__pyx_t_15 < 0)) __pyx_t_17 = 0; + } else if (unlikely(__pyx_t_15 >= __pyx_bshape_0_right_edges)) __pyx_t_17 = 0; + if (__pyx_t_16 < 0) { + __pyx_t_16 += __pyx_bshape_1_right_edges; + if (unlikely(__pyx_t_16 < 0)) __pyx_t_17 = 1; + } else if (unlikely(__pyx_t_16 >= __pyx_bshape_1_right_edges)) __pyx_t_17 = 1; + if (unlikely(__pyx_t_17 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_17); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edges.buf, __pyx_t_15, __pyx_bstride_0_right_edges, __pyx_t_16, __pyx_bstride_1_right_edges) = (__pyx_v_gvec.y + __pyx_v_grid_half_width); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":553 + * right_edges[grid_ind, 0] = gvec.x + grid_half_width + * right_edges[grid_ind, 1] = gvec.y + grid_half_width + * right_edges[grid_ind, 2] = gvec.z + grid_half_width # <<<<<<<<<<<<<< + * grid_levels[grid_ind, 0] = ilevel + * # Now the harder part + */ + __pyx_t_17 = __pyx_v_grid_ind; + __pyx_t_18 = 2; + __pyx_t_19 = -1; + if (__pyx_t_17 < 0) { + __pyx_t_17 += __pyx_bshape_0_right_edges; + if (unlikely(__pyx_t_17 < 0)) __pyx_t_19 = 0; + } else if (unlikely(__pyx_t_17 >= __pyx_bshape_0_right_edges)) __pyx_t_19 = 0; + if (__pyx_t_18 < 0) { + __pyx_t_18 += __pyx_bshape_1_right_edges; + if (unlikely(__pyx_t_18 < 0)) __pyx_t_19 = 1; + } else if (unlikely(__pyx_t_18 >= __pyx_bshape_1_right_edges)) __pyx_t_19 = 1; + if (unlikely(__pyx_t_19 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_19); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edges.buf, __pyx_t_17, __pyx_bstride_0_right_edges, __pyx_t_18, __pyx_bstride_1_right_edges) = (__pyx_v_gvec.z + __pyx_v_grid_half_width); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":554 + * right_edges[grid_ind, 1] = gvec.y + grid_half_width + * right_edges[grid_ind, 2] = gvec.z + grid_half_width + * grid_levels[grid_ind, 0] = ilevel # <<<<<<<<<<<<<< + * # Now the harder part + * father_it = grid_it.get_parent() + */ + __pyx_t_19 = __pyx_v_grid_ind; + __pyx_t_20 = 0; + __pyx_t_21 = -1; + if (__pyx_t_19 < 0) { + __pyx_t_19 += __pyx_bshape_0_grid_levels; + if (unlikely(__pyx_t_19 < 0)) __pyx_t_21 = 0; + } else if (unlikely(__pyx_t_19 >= __pyx_bshape_0_grid_levels)) __pyx_t_21 = 0; + if (__pyx_t_20 < 0) { + __pyx_t_20 += __pyx_bshape_1_grid_levels; + if (unlikely(__pyx_t_20 < 0)) __pyx_t_21 = 1; + } else if (unlikely(__pyx_t_20 >= __pyx_bshape_1_grid_levels)) __pyx_t_21 = 1; + if (unlikely(__pyx_t_21 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_21); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_grid_levels.buf, __pyx_t_19, __pyx_bstride_0_grid_levels, __pyx_t_20, __pyx_bstride_1_grid_levels) = __pyx_v_ilevel; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":556 + * grid_levels[grid_ind, 0] = ilevel + * # Now the harder part + * father_it = grid_it.get_parent() # <<<<<<<<<<<<<< + * grid_file_locations[grid_ind, 0] = idomain + * grid_file_locations[grid_ind, 1] = grid_ind - level_cell_counts[ilevel] + */ + __pyx_v_father_it = __pyx_v_grid_it.get_parent(); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":557 + * # Now the harder part + * father_it = grid_it.get_parent() + * grid_file_locations[grid_ind, 0] = idomain # <<<<<<<<<<<<<< + * grid_file_locations[grid_ind, 1] = grid_ind - level_cell_counts[ilevel] + * parent_ind = father_it.get_absolute_position() + */ + __pyx_t_21 = __pyx_v_grid_ind; + __pyx_t_22 = 0; + __pyx_t_23 = -1; + if (__pyx_t_21 < 0) { + __pyx_t_21 += __pyx_bshape_0_grid_file_locations; + if (unlikely(__pyx_t_21 < 0)) __pyx_t_23 = 0; + } else if (unlikely(__pyx_t_21 >= __pyx_bshape_0_grid_file_locations)) __pyx_t_23 = 0; + if (__pyx_t_22 < 0) { + __pyx_t_22 += __pyx_bshape_1_grid_file_locations; + if (unlikely(__pyx_t_22 < 0)) __pyx_t_23 = 1; + } else if (unlikely(__pyx_t_22 >= __pyx_bshape_1_grid_file_locations)) __pyx_t_23 = 1; + if (unlikely(__pyx_t_23 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_23); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_grid_file_locations.buf, __pyx_t_21, __pyx_bstride_0_grid_file_locations, __pyx_t_22, __pyx_bstride_1_grid_file_locations) = ((__pyx_t_5numpy_int64_t)__pyx_v_idomain); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":558 + * father_it = grid_it.get_parent() + * grid_file_locations[grid_ind, 0] = idomain + * grid_file_locations[grid_ind, 1] = grid_ind - level_cell_counts[ilevel] # <<<<<<<<<<<<<< + * parent_ind = father_it.get_absolute_position() + * if ilevel > 0: + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_grid_ind); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_24 = __Pyx_GetItemInt(((PyObject *)__pyx_v_level_cell_counts), __pyx_v_ilevel, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_24) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_24); + __pyx_t_25 = PyNumber_Subtract(__pyx_t_1, __pyx_t_24); if (unlikely(!__pyx_t_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_25); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; + __pyx_t_26 = __Pyx_PyInt_from_py_npy_int64(__pyx_t_25); if (unlikely((__pyx_t_26 == (npy_int64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; + __pyx_t_23 = __pyx_v_grid_ind; + __pyx_t_27 = 1; + __pyx_t_28 = -1; + if (__pyx_t_23 < 0) { + __pyx_t_23 += __pyx_bshape_0_grid_file_locations; + if (unlikely(__pyx_t_23 < 0)) __pyx_t_28 = 0; + } else if (unlikely(__pyx_t_23 >= __pyx_bshape_0_grid_file_locations)) __pyx_t_28 = 0; + if (__pyx_t_27 < 0) { + __pyx_t_27 += __pyx_bshape_1_grid_file_locations; + if (unlikely(__pyx_t_27 < 0)) __pyx_t_28 = 1; + } else if (unlikely(__pyx_t_27 >= __pyx_bshape_1_grid_file_locations)) __pyx_t_28 = 1; + if (unlikely(__pyx_t_28 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_28); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_grid_file_locations.buf, __pyx_t_23, __pyx_bstride_0_grid_file_locations, __pyx_t_27, __pyx_bstride_1_grid_file_locations) = __pyx_t_26; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":559 + * grid_file_locations[grid_ind, 0] = idomain + * grid_file_locations[grid_ind, 1] = grid_ind - level_cell_counts[ilevel] + * parent_ind = father_it.get_absolute_position() # <<<<<<<<<<<<<< + * if ilevel > 0: + * # We calculate the REAL parent index + */ + __pyx_v_parent_ind = __pyx_v_father_it.get_absolute_position(); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":560 + * grid_file_locations[grid_ind, 1] = grid_ind - level_cell_counts[ilevel] + * parent_ind = father_it.get_absolute_position() + * if ilevel > 0: # <<<<<<<<<<<<<< + * # We calculate the REAL parent index + * grid_file_locations[grid_ind, 2] = \ + */ + __pyx_t_7 = (__pyx_v_ilevel > 0); + if (__pyx_t_7) { + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":563 + * # We calculate the REAL parent index + * grid_file_locations[grid_ind, 2] = \ + * level_cell_counts[ilevel - 1] + parent_ind # <<<<<<<<<<<<<< + * else: + * grid_file_locations[grid_ind, 2] = -1 + */ + __pyx_t_29 = (__pyx_v_ilevel - 1); + __pyx_t_25 = __Pyx_GetItemInt(((PyObject *)__pyx_v_level_cell_counts), __pyx_t_29, sizeof(long), PyInt_FromLong); if (!__pyx_t_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_25); + __pyx_t_24 = PyLong_FromUnsignedLong(__pyx_v_parent_ind); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_24); + __pyx_t_1 = PyNumber_Add(__pyx_t_25, __pyx_t_24); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; + __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; + __pyx_t_26 = __Pyx_PyInt_from_py_npy_int64(__pyx_t_1); if (unlikely((__pyx_t_26 == (npy_int64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":562 + * if ilevel > 0: + * # We calculate the REAL parent index + * grid_file_locations[grid_ind, 2] = \ # <<<<<<<<<<<<<< + * level_cell_counts[ilevel - 1] + parent_ind + * else: + */ + __pyx_t_28 = __pyx_v_grid_ind; + __pyx_t_29 = 2; + __pyx_t_30 = -1; + if (__pyx_t_28 < 0) { + __pyx_t_28 += __pyx_bshape_0_grid_file_locations; + if (unlikely(__pyx_t_28 < 0)) __pyx_t_30 = 0; + } else if (unlikely(__pyx_t_28 >= __pyx_bshape_0_grid_file_locations)) __pyx_t_30 = 0; + if (__pyx_t_29 < 0) { + __pyx_t_29 += __pyx_bshape_1_grid_file_locations; + if (unlikely(__pyx_t_29 < 0)) __pyx_t_30 = 1; + } else if (unlikely(__pyx_t_29 >= __pyx_bshape_1_grid_file_locations)) __pyx_t_30 = 1; + if (unlikely(__pyx_t_30 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_30); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_grid_file_locations.buf, __pyx_t_28, __pyx_bstride_0_grid_file_locations, __pyx_t_29, __pyx_bstride_1_grid_file_locations) = __pyx_t_26; + goto __pyx_L12; + } + /*else*/ { + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":565 + * level_cell_counts[ilevel - 1] + parent_ind + * else: + * grid_file_locations[grid_ind, 2] = -1 # <<<<<<<<<<<<<< + * for ci in range(8): + * rr = grid_it.is_finest(ci) + */ + __pyx_t_30 = __pyx_v_grid_ind; + __pyx_t_31 = 2; + __pyx_t_32 = -1; + if (__pyx_t_30 < 0) { + __pyx_t_30 += __pyx_bshape_0_grid_file_locations; + if (unlikely(__pyx_t_30 < 0)) __pyx_t_32 = 0; + } else if (unlikely(__pyx_t_30 >= __pyx_bshape_0_grid_file_locations)) __pyx_t_32 = 0; + if (__pyx_t_31 < 0) { + __pyx_t_31 += __pyx_bshape_1_grid_file_locations; + if (unlikely(__pyx_t_31 < 0)) __pyx_t_32 = 1; + } else if (unlikely(__pyx_t_31 >= __pyx_bshape_1_grid_file_locations)) __pyx_t_32 = 1; + if (unlikely(__pyx_t_32 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_32); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_grid_file_locations.buf, __pyx_t_30, __pyx_bstride_0_grid_file_locations, __pyx_t_31, __pyx_bstride_1_grid_file_locations) = -1; + } + __pyx_L12:; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":566 + * else: + * grid_file_locations[grid_ind, 2] = -1 + * for ci in range(8): # <<<<<<<<<<<<<< + * rr = grid_it.is_finest(ci) + * child_mask[grid_ind, ci] = rr + */ + for (__pyx_t_7 = 0; __pyx_t_7 < 8; __pyx_t_7+=1) { + __pyx_v_ci = __pyx_t_7; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":567 + * grid_file_locations[grid_ind, 2] = -1 + * for ci in range(8): + * rr = grid_it.is_finest(ci) # <<<<<<<<<<<<<< + * child_mask[grid_ind, ci] = rr + * grid_ind += 1 + */ + __pyx_v_rr = ((__pyx_t_5numpy_int32_t)__pyx_v_grid_it.is_finest(__pyx_v_ci)); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":568 + * for ci in range(8): + * rr = grid_it.is_finest(ci) + * child_mask[grid_ind, ci] = rr # <<<<<<<<<<<<<< + * grid_ind += 1 + * grid_it.next() + */ + __pyx_t_32 = __pyx_v_grid_ind; + __pyx_t_33 = __pyx_v_ci; + __pyx_t_34 = -1; + if (__pyx_t_32 < 0) { + __pyx_t_32 += __pyx_bshape_0_child_mask; + if (unlikely(__pyx_t_32 < 0)) __pyx_t_34 = 0; + } else if (unlikely(__pyx_t_32 >= __pyx_bshape_0_child_mask)) __pyx_t_34 = 0; + if (__pyx_t_33 < 0) { + __pyx_t_33 += __pyx_bshape_1_child_mask; + if (unlikely(__pyx_t_33 < 0)) __pyx_t_34 = 1; + } else if (unlikely(__pyx_t_33 >= __pyx_bshape_1_child_mask)) __pyx_t_34 = 1; + if (unlikely(__pyx_t_34 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_34); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_child_mask.buf, __pyx_t_32, __pyx_bstride_0_child_mask, __pyx_t_33, __pyx_bstride_1_child_mask) = __pyx_v_rr; + } + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":569 + * rr = grid_it.is_finest(ci) + * child_mask[grid_ind, ci] = rr + * grid_ind += 1 # <<<<<<<<<<<<<< + * grid_it.next() + * del local_tree, local_hydro_data + */ + __pyx_v_grid_ind += 1; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":570 + * child_mask[grid_ind, ci] = rr + * grid_ind += 1 + * grid_it.next() # <<<<<<<<<<<<<< + * del local_tree, local_hydro_data + * + */ + __pyx_v_grid_it.next(); + } + } + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":571 + * grid_ind += 1 + * grid_it.next() + * del local_tree, local_hydro_data # <<<<<<<<<<<<<< + * + * def read_oct_grid(self, char *field, int level, int domain, int grid_id): + */ + delete __pyx_v_local_tree; + delete __pyx_v_local_hydro_data; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_24); + __Pyx_XDECREF(__pyx_t_25); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_right_edges); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_levels); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_file_locations); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_child_mask); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edges); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.ramses_reader.RAMSES_tree_proxy.fill_hierarchy_arrays"); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_right_edges); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_levels); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_file_locations); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_child_mask); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edges); + __pyx_L2:; + __Pyx_DECREF(__pyx_v_cell_count); + __Pyx_DECREF(__pyx_v_level_cell_counts); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":573 + * del local_tree, local_hydro_data + * + * def read_oct_grid(self, char *field, int level, int domain, int grid_id): # <<<<<<<<<<<<<< + * + * self.ensure_loaded(field, domain - 1) + */ + +static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_read_oct_grid(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_read_oct_grid(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + char *__pyx_v_field; + int __pyx_v_level; + int __pyx_v_domain; + int __pyx_v_grid_id; + int __pyx_v_varindex; + int __pyx_v_i; + PyArrayObject *__pyx_v_tr = 0; + double *__pyx_v_data; + RAMSES::AMR::RAMSES_tree *__pyx_v_local_tree; + RAMSES::HYDRO::RAMSES_hydro_data *__pyx_v_local_hydro_data; + Py_buffer __pyx_bstruct_tr; + Py_ssize_t __pyx_bstride_0_tr = 0; + Py_ssize_t __pyx_bstride_1_tr = 0; + Py_ssize_t __pyx_bstride_2_tr = 0; + Py_ssize_t __pyx_bshape_0_tr = 0; + Py_ssize_t __pyx_bshape_1_tr = 0; + Py_ssize_t __pyx_bshape_2_tr = 0; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyArrayObject *__pyx_t_6 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__field,&__pyx_n_s__level,&__pyx_n_s__domain,&__pyx_n_s__grid_id,0}; + __Pyx_RefNannySetupContext("read_oct_grid"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[4] = {0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__field); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__level); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("read_oct_grid", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__domain); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("read_oct_grid", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid_id); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("read_oct_grid", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "read_oct_grid") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_field = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_field) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_level = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_domain = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_domain == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_grid_id = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_grid_id == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_field = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_field) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_level = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_domain = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_domain == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_grid_id = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_grid_id == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("read_oct_grid", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.ramses_reader.RAMSES_tree_proxy.read_oct_grid"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_bstruct_tr.buf = NULL; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":575 + * def read_oct_grid(self, char *field, int level, int domain, int grid_id): + * + * self.ensure_loaded(field, domain - 1) # <<<<<<<<<<<<<< + * cdef int varindex = self.field_ind[field] + * cdef int i + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ensure_loaded); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyBytes_FromString(__pyx_v_field); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_3 = PyInt_FromLong((__pyx_v_domain - 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":576 + * + * self.ensure_loaded(field, domain - 1) + * cdef int varindex = self.field_ind[field] # <<<<<<<<<<<<<< + * cdef int i + * + */ + __pyx_t_3 = PyBytes_FromString(__pyx_v_field); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_4 = PyObject_GetItem(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_ind, ((PyObject *)__pyx_t_3)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_varindex = __pyx_t_5; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":579 + * cdef int i + * + * cdef np.ndarray[np.float64_t, ndim=3] tr = np.empty((2,2,2), dtype='float64', # <<<<<<<<<<<<<< + * order='F') + * cdef tree_iterator grid_it, grid_end + */ + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_int_2); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_2); + __Pyx_GIVEREF(__pyx_int_2); + __Pyx_INCREF(__pyx_int_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_2); + __Pyx_GIVEREF(__pyx_int_2); + __Pyx_INCREF(__pyx_int_2); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_2); + __Pyx_GIVEREF(__pyx_int_2); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__F)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_1, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = ((PyArrayObject *)__pyx_t_2); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_tr, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) { + __pyx_v_tr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_tr.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_bstride_0_tr = __pyx_bstruct_tr.strides[0]; __pyx_bstride_1_tr = __pyx_bstruct_tr.strides[1]; __pyx_bstride_2_tr = __pyx_bstruct_tr.strides[2]; + __pyx_bshape_0_tr = __pyx_bstruct_tr.shape[0]; __pyx_bshape_1_tr = __pyx_bstruct_tr.shape[1]; __pyx_bshape_2_tr = __pyx_bstruct_tr.shape[2]; + } + } + __pyx_t_6 = 0; + __pyx_v_tr = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":582 + * order='F') + * cdef tree_iterator grid_it, grid_end + * cdef double* data = tr.data # <<<<<<<<<<<<<< + * + * cdef RAMSES_tree *local_tree = self.trees[domain - 1] + */ + __pyx_v_data = ((double *)__pyx_v_tr->data); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":584 + * cdef double* data = tr.data + * + * cdef RAMSES_tree *local_tree = self.trees[domain - 1] # <<<<<<<<<<<<<< + * cdef RAMSES_hydro_data *local_hydro_data = self.hydro_datas[domain - 1][varindex] + * + */ + __pyx_v_local_tree = (((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->trees[(__pyx_v_domain - 1)]); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":585 + * + * cdef RAMSES_tree *local_tree = self.trees[domain - 1] + * cdef RAMSES_hydro_data *local_hydro_data = self.hydro_datas[domain - 1][varindex] # <<<<<<<<<<<<<< + * + * #inline ValueType_& cell_value( const typename TreeType_::iterator& it, + */ + __pyx_v_local_hydro_data = ((((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->hydro_datas[(__pyx_v_domain - 1)])[__pyx_v_varindex]); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":595 + * #} + * + * for i in range(8): # <<<<<<<<<<<<<< + * data[i] = local_hydro_data.m_var_array[level][8*grid_id+i] + * return tr + */ + for (__pyx_t_5 = 0; __pyx_t_5 < 8; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":596 + * + * for i in range(8): + * data[i] = local_hydro_data.m_var_array[level][8*grid_id+i] # <<<<<<<<<<<<<< + * return tr + * + */ + (__pyx_v_data[__pyx_v_i]) = ((__pyx_v_local_hydro_data->m_var_array[__pyx_v_level])[((8 * __pyx_v_grid_id) + __pyx_v_i)]); + } + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":597 + * for i in range(8): + * data[i] = local_hydro_data.m_var_array[level][8*grid_id+i] + * return tr # <<<<<<<<<<<<<< + * + * def read_grid(self, char *field, + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_tr)); + __pyx_r = ((PyObject *)__pyx_v_tr); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_tr); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.ramses_reader.RAMSES_tree_proxy.read_oct_grid"); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_tr); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_tr); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":599 + * return tr + * + * def read_grid(self, char *field, # <<<<<<<<<<<<<< + * np.ndarray[np.int64_t, ndim=1] start_index, + * np.ndarray[np.int32_t, ndim=1] grid_dims, + */ + +static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_read_grid(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_read_grid(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + char *__pyx_v_field; + PyArrayObject *__pyx_v_start_index = 0; + PyArrayObject *__pyx_v_grid_dims = 0; + PyArrayObject *__pyx_v_data = 0; + PyArrayObject *__pyx_v_filled = 0; + int __pyx_v_level; + int __pyx_v_ref_factor; + PyObject *__pyx_v_component_grid_info = 0; + int __pyx_v_varindex; + RAMSES::AMR::RAMSES_tree *__pyx_v_local_tree; + RAMSES::HYDRO::RAMSES_hydro_data *__pyx_v_local_hydro_data; + int __pyx_v_gi; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_k; + int __pyx_v_domain; + int __pyx_v_offset; + int __pyx_v_ir; + int __pyx_v_jr; + int __pyx_v_kr; + int __pyx_v_offi; + int __pyx_v_offj; + int __pyx_v_offk; + __pyx_t_5numpy_int64_t __pyx_v_di; + __pyx_t_5numpy_int64_t __pyx_v_dj; + __pyx_t_5numpy_int64_t __pyx_v_dk; + PyArrayObject *__pyx_v_ogrid_info; + PyArrayObject *__pyx_v_og_start_index; + __pyx_t_5numpy_float64_t __pyx_v_temp_data; + __pyx_t_5numpy_int64_t __pyx_v_end_index[3]; + int __pyx_v_to_fill; + PyObject *__pyx_v_odind; + Py_buffer __pyx_bstruct_grid_dims; + Py_ssize_t __pyx_bstride_0_grid_dims = 0; + Py_ssize_t __pyx_bshape_0_grid_dims = 0; + Py_buffer __pyx_bstruct_og_start_index; + Py_ssize_t __pyx_bstride_0_og_start_index = 0; + Py_ssize_t __pyx_bshape_0_og_start_index = 0; + Py_buffer __pyx_bstruct_ogrid_info; + Py_ssize_t __pyx_bstride_0_ogrid_info = 0; + Py_ssize_t __pyx_bshape_0_ogrid_info = 0; + Py_buffer __pyx_bstruct_filled; + Py_ssize_t __pyx_bstride_0_filled = 0; + Py_ssize_t __pyx_bstride_1_filled = 0; + Py_ssize_t __pyx_bstride_2_filled = 0; + Py_ssize_t __pyx_bshape_0_filled = 0; + Py_ssize_t __pyx_bshape_1_filled = 0; + Py_ssize_t __pyx_bshape_2_filled = 0; + Py_buffer __pyx_bstruct_data; + Py_ssize_t __pyx_bstride_0_data = 0; + Py_ssize_t __pyx_bstride_1_data = 0; + Py_ssize_t __pyx_bstride_2_data = 0; + Py_ssize_t __pyx_bshape_0_data = 0; + Py_ssize_t __pyx_bshape_1_data = 0; + Py_ssize_t __pyx_bshape_2_data = 0; + Py_buffer __pyx_bstruct_start_index; + Py_ssize_t __pyx_bstride_0_start_index = 0; + Py_ssize_t __pyx_bshape_0_start_index = 0; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + PyArrayObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + long __pyx_t_12; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + long __pyx_t_15; + PyArrayObject *__pyx_t_16 = NULL; + long __pyx_t_17; + long __pyx_t_18; + int __pyx_t_19; + long __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; + int __pyx_t_23; + long __pyx_t_24; + long __pyx_t_25; + int __pyx_t_26; + long __pyx_t_27; + long __pyx_t_28; + long __pyx_t_29; + int __pyx_t_30; + long __pyx_t_31; + long __pyx_t_32; + long __pyx_t_33; + long __pyx_t_34; + int __pyx_t_35; + int __pyx_t_36; + int __pyx_t_37; + int __pyx_t_38; + int __pyx_t_39; + int __pyx_t_40; + int __pyx_t_41; + int __pyx_t_42; + int __pyx_t_43; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__field,&__pyx_n_s__start_index,&__pyx_n_s__grid_dims,&__pyx_n_s__data,&__pyx_n_s__filled,&__pyx_n_s__level,&__pyx_n_s__ref_factor,&__pyx_n_s__component_grid_info,0}; + __Pyx_RefNannySetupContext("read_grid"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[8] = {0,0,0,0,0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__field); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start_index); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("read_grid", 1, 8, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid_dims); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("read_grid", 1, 8, 8, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("read_grid", 1, 8, 8, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filled); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("read_grid", 1, 8, 8, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__level); + if (likely(values[5])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("read_grid", 1, 8, 8, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 6: + values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref_factor); + if (likely(values[6])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("read_grid", 1, 8, 8, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 7: + values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__component_grid_info); + if (likely(values[7])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("read_grid", 1, 8, 8, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "read_grid") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_field = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_field) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_start_index = ((PyArrayObject *)values[1]); + __pyx_v_grid_dims = ((PyArrayObject *)values[2]); + __pyx_v_data = ((PyArrayObject *)values[3]); + __pyx_v_filled = ((PyArrayObject *)values[4]); + __pyx_v_level = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_ref_factor = __Pyx_PyInt_AsInt(values[6]); if (unlikely((__pyx_v_ref_factor == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_component_grid_info = values[7]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_field = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_field) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_start_index = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); + __pyx_v_grid_dims = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); + __pyx_v_data = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); + __pyx_v_filled = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); + __pyx_v_level = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_ref_factor = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 6)); if (unlikely((__pyx_v_ref_factor == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_component_grid_info = PyTuple_GET_ITEM(__pyx_args, 7); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("read_grid", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.ramses_reader.RAMSES_tree_proxy.read_grid"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_ogrid_info = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_og_start_index = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_odind = Py_None; __Pyx_INCREF(Py_None); + __pyx_bstruct_ogrid_info.buf = NULL; + __pyx_bstruct_og_start_index.buf = NULL; + __pyx_bstruct_start_index.buf = NULL; + __pyx_bstruct_grid_dims.buf = NULL; + __pyx_bstruct_data.buf = NULL; + __pyx_bstruct_filled.buf = NULL; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_start_index), __pyx_ptype_5numpy_ndarray, 1, "start_index", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grid_dims), __pyx_ptype_5numpy_ndarray, 1, "grid_dims", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), __pyx_ptype_5numpy_ndarray, 1, "data", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filled), __pyx_ptype_5numpy_ndarray, 1, "filled", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_start_index, (PyObject*)__pyx_v_start_index, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_start_index = __pyx_bstruct_start_index.strides[0]; + __pyx_bshape_0_start_index = __pyx_bstruct_start_index.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_grid_dims, (PyObject*)__pyx_v_grid_dims, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_grid_dims = __pyx_bstruct_grid_dims.strides[0]; + __pyx_bshape_0_grid_dims = __pyx_bstruct_grid_dims.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_data, (PyObject*)__pyx_v_data, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_data = __pyx_bstruct_data.strides[0]; __pyx_bstride_1_data = __pyx_bstruct_data.strides[1]; __pyx_bstride_2_data = __pyx_bstruct_data.strides[2]; + __pyx_bshape_0_data = __pyx_bstruct_data.shape[0]; __pyx_bshape_1_data = __pyx_bstruct_data.shape[1]; __pyx_bshape_2_data = __pyx_bstruct_data.shape[2]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_filled, (PyObject*)__pyx_v_filled, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_filled = __pyx_bstruct_filled.strides[0]; __pyx_bstride_1_filled = __pyx_bstruct_filled.strides[1]; __pyx_bstride_2_filled = __pyx_bstruct_filled.strides[2]; + __pyx_bshape_0_filled = __pyx_bstruct_filled.shape[0]; __pyx_bshape_1_filled = __pyx_bstruct_filled.shape[1]; __pyx_bshape_2_filled = __pyx_bstruct_filled.shape[2]; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":606 + * int level, int ref_factor, + * component_grid_info): + * cdef int varindex = self.field_ind[field] # <<<<<<<<<<<<<< + * cdef RAMSES_tree *local_tree = NULL + * cdef RAMSES_hydro_data *local_hydro_data = NULL + */ + __pyx_t_1 = PyBytes_FromString(__pyx_v_field); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyObject_GetItem(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_ind, ((PyObject *)__pyx_t_1)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_varindex = __pyx_t_3; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":607 + * component_grid_info): + * cdef int varindex = self.field_ind[field] + * cdef RAMSES_tree *local_tree = NULL # <<<<<<<<<<<<<< + * cdef RAMSES_hydro_data *local_hydro_data = NULL + * + */ + __pyx_v_local_tree = NULL; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":608 + * cdef int varindex = self.field_ind[field] + * cdef RAMSES_tree *local_tree = NULL + * cdef RAMSES_hydro_data *local_hydro_data = NULL # <<<<<<<<<<<<<< + * + * cdef int gi, i, j, k, domain, offset + */ + __pyx_v_local_hydro_data = NULL; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":618 + * cdef np.float64_t temp_data + * cdef np.int64_t end_index[3] + * cdef int to_fill = 0 # <<<<<<<<<<<<<< + * # Note that indexing into a cell is: + * # (k*2 + j)*2 + i + */ + __pyx_v_to_fill = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":621 + * # Note that indexing into a cell is: + * # (k*2 + j)*2 + i + * for i in range(3): # <<<<<<<<<<<<<< + * end_index[i] = start_index[i] + grid_dims[i] + * for gi in range(len(component_grid_info)): + */ + for (__pyx_t_3 = 0; __pyx_t_3 < 3; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":622 + * # (k*2 + j)*2 + i + * for i in range(3): + * end_index[i] = start_index[i] + grid_dims[i] # <<<<<<<<<<<<<< + * for gi in range(len(component_grid_info)): + * ogrid_info = component_grid_info[gi] + */ + __pyx_t_4 = __pyx_v_i; + __pyx_t_5 = -1; + if (__pyx_t_4 < 0) { + __pyx_t_4 += __pyx_bshape_0_start_index; + if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0; + } else if (unlikely(__pyx_t_4 >= __pyx_bshape_0_start_index)) __pyx_t_5 = 0; + if (unlikely(__pyx_t_5 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_5); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_5 = __pyx_v_i; + __pyx_t_6 = -1; + if (__pyx_t_5 < 0) { + __pyx_t_5 += __pyx_bshape_0_grid_dims; + if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0; + } else if (unlikely(__pyx_t_5 >= __pyx_bshape_0_grid_dims)) __pyx_t_6 = 0; + if (unlikely(__pyx_t_6 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_6); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + (__pyx_v_end_index[__pyx_v_i]) = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_start_index.buf, __pyx_t_4, __pyx_bstride_0_start_index)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_grid_dims.buf, __pyx_t_5, __pyx_bstride_0_grid_dims))); + } + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":623 + * for i in range(3): + * end_index[i] = start_index[i] + grid_dims[i] + * for gi in range(len(component_grid_info)): # <<<<<<<<<<<<<< + * ogrid_info = component_grid_info[gi] + * domain = ogrid_info[0] + */ + __pyx_t_7 = PyObject_Length(__pyx_v_component_grid_info); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_7; __pyx_t_3+=1) { + __pyx_v_gi = __pyx_t_3; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":624 + * end_index[i] = start_index[i] + grid_dims[i] + * for gi in range(len(component_grid_info)): + * ogrid_info = component_grid_info[gi] # <<<<<<<<<<<<<< + * domain = ogrid_info[0] + * self.ensure_loaded(field, domain - 1) + */ + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_component_grid_info, __pyx_v_gi, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = ((PyArrayObject *)__pyx_t_2); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ogrid_info); + __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_ogrid_info, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_6 < 0)) { + PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_ogrid_info, (PyObject*)__pyx_v_ogrid_info, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11); + } + } + __pyx_bstride_0_ogrid_info = __pyx_bstruct_ogrid_info.strides[0]; + __pyx_bshape_0_ogrid_info = __pyx_bstruct_ogrid_info.shape[0]; + if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_8 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_ogrid_info)); + __pyx_v_ogrid_info = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":625 + * for gi in range(len(component_grid_info)): + * ogrid_info = component_grid_info[gi] + * domain = ogrid_info[0] # <<<<<<<<<<<<<< + * self.ensure_loaded(field, domain - 1) + * local_tree = self.trees[domain - 1] + */ + __pyx_t_12 = 0; + __pyx_t_6 = -1; + if (__pyx_t_12 < 0) { + __pyx_t_12 += __pyx_bshape_0_ogrid_info; + if (unlikely(__pyx_t_12 < 0)) __pyx_t_6 = 0; + } else if (unlikely(__pyx_t_12 >= __pyx_bshape_0_ogrid_info)) __pyx_t_6 = 0; + if (unlikely(__pyx_t_6 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_6); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_domain = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_ogrid_info.buf, __pyx_t_12, __pyx_bstride_0_ogrid_info)); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":626 + * ogrid_info = component_grid_info[gi] + * domain = ogrid_info[0] + * self.ensure_loaded(field, domain - 1) # <<<<<<<<<<<<<< + * local_tree = self.trees[domain - 1] + * local_hydro_data = self.hydro_datas[domain - 1][varindex] + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ensure_loaded); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyBytes_FromString(__pyx_v_field); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_13 = PyInt_FromLong((__pyx_v_domain - 1)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_13); + __Pyx_GIVEREF(__pyx_t_13); + __pyx_t_1 = 0; + __pyx_t_13 = 0; + __pyx_t_13 = PyObject_Call(__pyx_t_2, __pyx_t_14, NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":627 + * domain = ogrid_info[0] + * self.ensure_loaded(field, domain - 1) + * local_tree = self.trees[domain - 1] # <<<<<<<<<<<<<< + * local_hydro_data = self.hydro_datas[domain - 1][varindex] + * offset = ogrid_info[1] + */ + __pyx_v_local_tree = (((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->trees[(__pyx_v_domain - 1)]); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":628 + * self.ensure_loaded(field, domain - 1) + * local_tree = self.trees[domain - 1] + * local_hydro_data = self.hydro_datas[domain - 1][varindex] # <<<<<<<<<<<<<< + * offset = ogrid_info[1] + * og_start_index = ogrid_info[3:] + */ + __pyx_v_local_hydro_data = ((((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->hydro_datas[(__pyx_v_domain - 1)])[__pyx_v_varindex]); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":629 + * local_tree = self.trees[domain - 1] + * local_hydro_data = self.hydro_datas[domain - 1][varindex] + * offset = ogrid_info[1] # <<<<<<<<<<<<<< + * og_start_index = ogrid_info[3:] + * for i in range(2*ref_factor): + */ + __pyx_t_15 = 1; + __pyx_t_6 = -1; + if (__pyx_t_15 < 0) { + __pyx_t_15 += __pyx_bshape_0_ogrid_info; + if (unlikely(__pyx_t_15 < 0)) __pyx_t_6 = 0; + } else if (unlikely(__pyx_t_15 >= __pyx_bshape_0_ogrid_info)) __pyx_t_6 = 0; + if (unlikely(__pyx_t_6 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_6); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_offset = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_ogrid_info.buf, __pyx_t_15, __pyx_bstride_0_ogrid_info)); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":630 + * local_hydro_data = self.hydro_datas[domain - 1][varindex] + * offset = ogrid_info[1] + * og_start_index = ogrid_info[3:] # <<<<<<<<<<<<<< + * for i in range(2*ref_factor): + * di = i + og_start_index[0] * ref_factor + */ + __pyx_t_13 = PySequence_GetSlice(((PyObject *)__pyx_v_ogrid_info), 3, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = ((PyArrayObject *)__pyx_t_13); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_og_start_index); + __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_og_start_index, (PyObject*)__pyx_t_16, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_6 < 0)) { + PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_og_start_index, (PyObject*)__pyx_v_og_start_index, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9); + } + } + __pyx_bstride_0_og_start_index = __pyx_bstruct_og_start_index.strides[0]; + __pyx_bshape_0_og_start_index = __pyx_bstruct_og_start_index.shape[0]; + if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_16 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_og_start_index)); + __pyx_v_og_start_index = ((PyArrayObject *)__pyx_t_13); + __pyx_t_13 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":631 + * offset = ogrid_info[1] + * og_start_index = ogrid_info[3:] + * for i in range(2*ref_factor): # <<<<<<<<<<<<<< + * di = i + og_start_index[0] * ref_factor + * if di < start_index[0] or di >= end_index[0]: continue + */ + __pyx_t_17 = (2 * __pyx_v_ref_factor); + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_17; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":632 + * og_start_index = ogrid_info[3:] + * for i in range(2*ref_factor): + * di = i + og_start_index[0] * ref_factor # <<<<<<<<<<<<<< + * if di < start_index[0] or di >= end_index[0]: continue + * ir = (i / ref_factor) + */ + __pyx_t_18 = 0; + __pyx_t_19 = -1; + if (__pyx_t_18 < 0) { + __pyx_t_18 += __pyx_bshape_0_og_start_index; + if (unlikely(__pyx_t_18 < 0)) __pyx_t_19 = 0; + } else if (unlikely(__pyx_t_18 >= __pyx_bshape_0_og_start_index)) __pyx_t_19 = 0; + if (unlikely(__pyx_t_19 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_19); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_di = (__pyx_v_i + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_og_start_index.buf, __pyx_t_18, __pyx_bstride_0_og_start_index)) * __pyx_v_ref_factor)); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":633 + * for i in range(2*ref_factor): + * di = i + og_start_index[0] * ref_factor + * if di < start_index[0] or di >= end_index[0]: continue # <<<<<<<<<<<<<< + * ir = (i / ref_factor) + * for j in range(2 * ref_factor): + */ + __pyx_t_20 = 0; + __pyx_t_19 = -1; + if (__pyx_t_20 < 0) { + __pyx_t_20 += __pyx_bshape_0_start_index; + if (unlikely(__pyx_t_20 < 0)) __pyx_t_19 = 0; + } else if (unlikely(__pyx_t_20 >= __pyx_bshape_0_start_index)) __pyx_t_19 = 0; + if (unlikely(__pyx_t_19 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_19); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_21 = (__pyx_v_di < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_start_index.buf, __pyx_t_20, __pyx_bstride_0_start_index))); + if (!__pyx_t_21) { + __pyx_t_22 = (__pyx_v_di >= (__pyx_v_end_index[0])); + __pyx_t_23 = __pyx_t_22; + } else { + __pyx_t_23 = __pyx_t_21; + } + if (__pyx_t_23) { + goto __pyx_L10_continue; + goto __pyx_L12; + } + __pyx_L12:; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":634 + * di = i + og_start_index[0] * ref_factor + * if di < start_index[0] or di >= end_index[0]: continue + * ir = (i / ref_factor) # <<<<<<<<<<<<<< + * for j in range(2 * ref_factor): + * dj = j + og_start_index[1] * ref_factor + */ + if (unlikely(__pyx_v_ref_factor == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_ref_factor == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_i))) { + PyErr_Format(PyExc_OverflowError, "value too large to perform division"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_ir = __Pyx_div_int(__pyx_v_i, __pyx_v_ref_factor); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":635 + * if di < start_index[0] or di >= end_index[0]: continue + * ir = (i / ref_factor) + * for j in range(2 * ref_factor): # <<<<<<<<<<<<<< + * dj = j + og_start_index[1] * ref_factor + * if dj < start_index[1] or dj >= end_index[1]: continue + */ + __pyx_t_24 = (2 * __pyx_v_ref_factor); + for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_24; __pyx_t_19+=1) { + __pyx_v_j = __pyx_t_19; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":636 + * ir = (i / ref_factor) + * for j in range(2 * ref_factor): + * dj = j + og_start_index[1] * ref_factor # <<<<<<<<<<<<<< + * if dj < start_index[1] or dj >= end_index[1]: continue + * jr = (j / ref_factor) + */ + __pyx_t_25 = 1; + __pyx_t_26 = -1; + if (__pyx_t_25 < 0) { + __pyx_t_25 += __pyx_bshape_0_og_start_index; + if (unlikely(__pyx_t_25 < 0)) __pyx_t_26 = 0; + } else if (unlikely(__pyx_t_25 >= __pyx_bshape_0_og_start_index)) __pyx_t_26 = 0; + if (unlikely(__pyx_t_26 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_26); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_dj = (__pyx_v_j + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_og_start_index.buf, __pyx_t_25, __pyx_bstride_0_og_start_index)) * __pyx_v_ref_factor)); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":637 + * for j in range(2 * ref_factor): + * dj = j + og_start_index[1] * ref_factor + * if dj < start_index[1] or dj >= end_index[1]: continue # <<<<<<<<<<<<<< + * jr = (j / ref_factor) + * for k in range(2 * ref_factor): + */ + __pyx_t_27 = 1; + __pyx_t_26 = -1; + if (__pyx_t_27 < 0) { + __pyx_t_27 += __pyx_bshape_0_start_index; + if (unlikely(__pyx_t_27 < 0)) __pyx_t_26 = 0; + } else if (unlikely(__pyx_t_27 >= __pyx_bshape_0_start_index)) __pyx_t_26 = 0; + if (unlikely(__pyx_t_26 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_26); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_23 = (__pyx_v_dj < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_start_index.buf, __pyx_t_27, __pyx_bstride_0_start_index))); + if (!__pyx_t_23) { + __pyx_t_21 = (__pyx_v_dj >= (__pyx_v_end_index[1])); + __pyx_t_22 = __pyx_t_21; + } else { + __pyx_t_22 = __pyx_t_23; + } + if (__pyx_t_22) { + goto __pyx_L13_continue; + goto __pyx_L15; + } + __pyx_L15:; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":638 + * dj = j + og_start_index[1] * ref_factor + * if dj < start_index[1] or dj >= end_index[1]: continue + * jr = (j / ref_factor) # <<<<<<<<<<<<<< + * for k in range(2 * ref_factor): + * dk = k + og_start_index[2] * ref_factor + */ + if (unlikely(__pyx_v_ref_factor == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_ref_factor == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_j))) { + PyErr_Format(PyExc_OverflowError, "value too large to perform division"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_jr = __Pyx_div_int(__pyx_v_j, __pyx_v_ref_factor); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":639 + * if dj < start_index[1] or dj >= end_index[1]: continue + * jr = (j / ref_factor) + * for k in range(2 * ref_factor): # <<<<<<<<<<<<<< + * dk = k + og_start_index[2] * ref_factor + * if dk < start_index[2] or dk >= end_index[2]: continue + */ + __pyx_t_28 = (2 * __pyx_v_ref_factor); + for (__pyx_t_26 = 0; __pyx_t_26 < __pyx_t_28; __pyx_t_26+=1) { + __pyx_v_k = __pyx_t_26; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":640 + * jr = (j / ref_factor) + * for k in range(2 * ref_factor): + * dk = k + og_start_index[2] * ref_factor # <<<<<<<<<<<<<< + * if dk < start_index[2] or dk >= end_index[2]: continue + * kr = (k / ref_factor) + */ + __pyx_t_29 = 2; + __pyx_t_30 = -1; + if (__pyx_t_29 < 0) { + __pyx_t_29 += __pyx_bshape_0_og_start_index; + if (unlikely(__pyx_t_29 < 0)) __pyx_t_30 = 0; + } else if (unlikely(__pyx_t_29 >= __pyx_bshape_0_og_start_index)) __pyx_t_30 = 0; + if (unlikely(__pyx_t_30 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_30); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_dk = (__pyx_v_k + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_og_start_index.buf, __pyx_t_29, __pyx_bstride_0_og_start_index)) * __pyx_v_ref_factor)); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":641 + * for k in range(2 * ref_factor): + * dk = k + og_start_index[2] * ref_factor + * if dk < start_index[2] or dk >= end_index[2]: continue # <<<<<<<<<<<<<< + * kr = (k / ref_factor) + * offi = di - start_index[0] + */ + __pyx_t_31 = 2; + __pyx_t_30 = -1; + if (__pyx_t_31 < 0) { + __pyx_t_31 += __pyx_bshape_0_start_index; + if (unlikely(__pyx_t_31 < 0)) __pyx_t_30 = 0; + } else if (unlikely(__pyx_t_31 >= __pyx_bshape_0_start_index)) __pyx_t_30 = 0; + if (unlikely(__pyx_t_30 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_30); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_22 = (__pyx_v_dk < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_start_index.buf, __pyx_t_31, __pyx_bstride_0_start_index))); + if (!__pyx_t_22) { + __pyx_t_23 = (__pyx_v_dk >= (__pyx_v_end_index[2])); + __pyx_t_21 = __pyx_t_23; + } else { + __pyx_t_21 = __pyx_t_22; + } + if (__pyx_t_21) { + goto __pyx_L16_continue; + goto __pyx_L18; + } + __pyx_L18:; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":642 + * dk = k + og_start_index[2] * ref_factor + * if dk < start_index[2] or dk >= end_index[2]: continue + * kr = (k / ref_factor) # <<<<<<<<<<<<<< + * offi = di - start_index[0] + * offj = dj - start_index[1] + */ + if (unlikely(__pyx_v_ref_factor == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_ref_factor == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_k))) { + PyErr_Format(PyExc_OverflowError, "value too large to perform division"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_kr = __Pyx_div_int(__pyx_v_k, __pyx_v_ref_factor); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":643 + * if dk < start_index[2] or dk >= end_index[2]: continue + * kr = (k / ref_factor) + * offi = di - start_index[0] # <<<<<<<<<<<<<< + * offj = dj - start_index[1] + * offk = dk - start_index[2] + */ + __pyx_t_32 = 0; + __pyx_t_30 = -1; + if (__pyx_t_32 < 0) { + __pyx_t_32 += __pyx_bshape_0_start_index; + if (unlikely(__pyx_t_32 < 0)) __pyx_t_30 = 0; + } else if (unlikely(__pyx_t_32 >= __pyx_bshape_0_start_index)) __pyx_t_30 = 0; + if (unlikely(__pyx_t_30 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_30); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_offi = (__pyx_v_di - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_start_index.buf, __pyx_t_32, __pyx_bstride_0_start_index))); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":644 + * kr = (k / ref_factor) + * offi = di - start_index[0] + * offj = dj - start_index[1] # <<<<<<<<<<<<<< + * offk = dk - start_index[2] + * #print offi, filled.shape[0], + */ + __pyx_t_33 = 1; + __pyx_t_30 = -1; + if (__pyx_t_33 < 0) { + __pyx_t_33 += __pyx_bshape_0_start_index; + if (unlikely(__pyx_t_33 < 0)) __pyx_t_30 = 0; + } else if (unlikely(__pyx_t_33 >= __pyx_bshape_0_start_index)) __pyx_t_30 = 0; + if (unlikely(__pyx_t_30 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_30); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_offj = (__pyx_v_dj - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_start_index.buf, __pyx_t_33, __pyx_bstride_0_start_index))); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":645 + * offi = di - start_index[0] + * offj = dj - start_index[1] + * offk = dk - start_index[2] # <<<<<<<<<<<<<< + * #print offi, filled.shape[0], + * #print offj, filled.shape[1], + */ + __pyx_t_34 = 2; + __pyx_t_30 = -1; + if (__pyx_t_34 < 0) { + __pyx_t_34 += __pyx_bshape_0_start_index; + if (unlikely(__pyx_t_34 < 0)) __pyx_t_30 = 0; + } else if (unlikely(__pyx_t_34 >= __pyx_bshape_0_start_index)) __pyx_t_30 = 0; + if (unlikely(__pyx_t_30 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_30); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_offk = (__pyx_v_dk - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_start_index.buf, __pyx_t_34, __pyx_bstride_0_start_index))); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":649 + * #print offj, filled.shape[1], + * #print offk, filled.shape[2] + * if filled[offi, offj, offk] == 1: continue # <<<<<<<<<<<<<< + * + * odind = (kr*2 + jr)*2 + ir + */ + __pyx_t_30 = __pyx_v_offi; + __pyx_t_35 = __pyx_v_offj; + __pyx_t_36 = __pyx_v_offk; + __pyx_t_37 = -1; + if (__pyx_t_30 < 0) { + __pyx_t_30 += __pyx_bshape_0_filled; + if (unlikely(__pyx_t_30 < 0)) __pyx_t_37 = 0; + } else if (unlikely(__pyx_t_30 >= __pyx_bshape_0_filled)) __pyx_t_37 = 0; + if (__pyx_t_35 < 0) { + __pyx_t_35 += __pyx_bshape_1_filled; + if (unlikely(__pyx_t_35 < 0)) __pyx_t_37 = 1; + } else if (unlikely(__pyx_t_35 >= __pyx_bshape_1_filled)) __pyx_t_37 = 1; + if (__pyx_t_36 < 0) { + __pyx_t_36 += __pyx_bshape_2_filled; + if (unlikely(__pyx_t_36 < 0)) __pyx_t_37 = 2; + } else if (unlikely(__pyx_t_36 >= __pyx_bshape_2_filled)) __pyx_t_37 = 2; + if (unlikely(__pyx_t_37 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_37); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_21 = ((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_filled.buf, __pyx_t_30, __pyx_bstride_0_filled, __pyx_t_35, __pyx_bstride_1_filled, __pyx_t_36, __pyx_bstride_2_filled)) == 1); + if (__pyx_t_21) { + goto __pyx_L16_continue; + goto __pyx_L19; + } + __pyx_L19:; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":651 + * if filled[offi, offj, offk] == 1: continue + * + * odind = (kr*2 + jr)*2 + ir # <<<<<<<<<<<<<< + * temp_data = local_hydro_data.m_var_array[ + * level][8*offset + odind] + */ + __pyx_t_13 = PyInt_FromLong(((((__pyx_v_kr * 2) + __pyx_v_jr) * 2) + __pyx_v_ir)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_v_odind); + __pyx_v_odind = __pyx_t_13; + __pyx_t_13 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":653 + * odind = (kr*2 + jr)*2 + ir + * temp_data = local_hydro_data.m_var_array[ + * level][8*offset + odind] # <<<<<<<<<<<<<< + * data[offi, offj, offk] = temp_data + * filled[offi, offj, offk] = 1 + */ + __pyx_t_13 = PyInt_FromLong((8 * __pyx_v_offset)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_14 = PyNumber_Add(__pyx_t_13, __pyx_v_odind); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_37 = __Pyx_PyInt_AsInt(__pyx_t_14); if (unlikely((__pyx_t_37 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_v_temp_data = ((__pyx_v_local_hydro_data->m_var_array[__pyx_v_level])[__pyx_t_37]); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":654 + * temp_data = local_hydro_data.m_var_array[ + * level][8*offset + odind] + * data[offi, offj, offk] = temp_data # <<<<<<<<<<<<<< + * filled[offi, offj, offk] = 1 + * to_fill += 1 + */ + __pyx_t_37 = __pyx_v_offi; + __pyx_t_38 = __pyx_v_offj; + __pyx_t_39 = __pyx_v_offk; + __pyx_t_40 = -1; + if (__pyx_t_37 < 0) { + __pyx_t_37 += __pyx_bshape_0_data; + if (unlikely(__pyx_t_37 < 0)) __pyx_t_40 = 0; + } else if (unlikely(__pyx_t_37 >= __pyx_bshape_0_data)) __pyx_t_40 = 0; + if (__pyx_t_38 < 0) { + __pyx_t_38 += __pyx_bshape_1_data; + if (unlikely(__pyx_t_38 < 0)) __pyx_t_40 = 1; + } else if (unlikely(__pyx_t_38 >= __pyx_bshape_1_data)) __pyx_t_40 = 1; + if (__pyx_t_39 < 0) { + __pyx_t_39 += __pyx_bshape_2_data; + if (unlikely(__pyx_t_39 < 0)) __pyx_t_40 = 2; + } else if (unlikely(__pyx_t_39 >= __pyx_bshape_2_data)) __pyx_t_40 = 2; + if (unlikely(__pyx_t_40 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_40); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_data.buf, __pyx_t_37, __pyx_bstride_0_data, __pyx_t_38, __pyx_bstride_1_data, __pyx_t_39, __pyx_bstride_2_data) = __pyx_v_temp_data; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":655 + * level][8*offset + odind] + * data[offi, offj, offk] = temp_data + * filled[offi, offj, offk] = 1 # <<<<<<<<<<<<<< + * to_fill += 1 + * return to_fill + */ + __pyx_t_40 = __pyx_v_offi; + __pyx_t_41 = __pyx_v_offj; + __pyx_t_42 = __pyx_v_offk; + __pyx_t_43 = -1; + if (__pyx_t_40 < 0) { + __pyx_t_40 += __pyx_bshape_0_filled; + if (unlikely(__pyx_t_40 < 0)) __pyx_t_43 = 0; + } else if (unlikely(__pyx_t_40 >= __pyx_bshape_0_filled)) __pyx_t_43 = 0; + if (__pyx_t_41 < 0) { + __pyx_t_41 += __pyx_bshape_1_filled; + if (unlikely(__pyx_t_41 < 0)) __pyx_t_43 = 1; + } else if (unlikely(__pyx_t_41 >= __pyx_bshape_1_filled)) __pyx_t_43 = 1; + if (__pyx_t_42 < 0) { + __pyx_t_42 += __pyx_bshape_2_filled; + if (unlikely(__pyx_t_42 < 0)) __pyx_t_43 = 2; + } else if (unlikely(__pyx_t_42 >= __pyx_bshape_2_filled)) __pyx_t_43 = 2; + if (unlikely(__pyx_t_43 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_43); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_filled.buf, __pyx_t_40, __pyx_bstride_0_filled, __pyx_t_41, __pyx_bstride_1_filled, __pyx_t_42, __pyx_bstride_2_filled) = 1; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":656 + * data[offi, offj, offk] = temp_data + * filled[offi, offj, offk] = 1 + * to_fill += 1 # <<<<<<<<<<<<<< + * return to_fill + * + */ + __pyx_v_to_fill += 1; + __pyx_L16_continue:; + } + __pyx_L13_continue:; + } + __pyx_L10_continue:; + } + } + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":657 + * filled[offi, offj, offk] = 1 + * to_fill += 1 + * return to_fill # <<<<<<<<<<<<<< + * + * cdef class ProtoSubgrid: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_14 = PyInt_FromLong(__pyx_v_to_fill); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __pyx_r = __pyx_t_14; + __pyx_t_14 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_dims); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_og_start_index); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ogrid_info); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_filled); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_start_index); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.ramses_reader.RAMSES_tree_proxy.read_grid"); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_dims); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_og_start_index); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ogrid_info); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_filled); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_start_index); + __pyx_L2:; + __Pyx_DECREF((PyObject *)__pyx_v_ogrid_info); + __Pyx_DECREF((PyObject *)__pyx_v_og_start_index); + __Pyx_DECREF(__pyx_v_odind); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":664 + * cdef np.int64_t right_edge[3] + * cdef np.int64_t dimensions[3] + * cdef public np.float64_t efficiency # <<<<<<<<<<<<<< + * cdef public object sigs + * cdef public object grid_file_locations + */ + +static PyObject *__pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_10efficiency___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_10efficiency___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->efficiency); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("yt.ramses_reader.ProtoSubgrid.efficiency.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_10efficiency___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_10efficiency___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __pyx_t_5numpy_float64_t __pyx_t_1; + __Pyx_RefNannySetupContext("__set__"); + __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->efficiency = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("yt.ramses_reader.ProtoSubgrid.efficiency.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":665 + * cdef np.int64_t dimensions[3] + * cdef public np.float64_t efficiency + * cdef public object sigs # <<<<<<<<<<<<<< + * cdef public object grid_file_locations + * cdef public object dd + */ + +static PyObject *__pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_4sigs___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_4sigs___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->sigs); + __pyx_r = ((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->sigs; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_4sigs___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_4sigs___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->sigs); + __Pyx_DECREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->sigs); + ((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->sigs = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_4sigs___del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_4sigs___del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->sigs); + __Pyx_DECREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->sigs); + ((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->sigs = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":666 + * cdef public np.float64_t efficiency + * cdef public object sigs + * cdef public object grid_file_locations # <<<<<<<<<<<<<< + * cdef public object dd + * + */ + +static PyObject *__pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_19grid_file_locations___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_19grid_file_locations___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->grid_file_locations); + __pyx_r = ((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->grid_file_locations; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_19grid_file_locations___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_19grid_file_locations___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->grid_file_locations); + __Pyx_DECREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->grid_file_locations); + ((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->grid_file_locations = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_19grid_file_locations___del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_19grid_file_locations___del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->grid_file_locations); + __Pyx_DECREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->grid_file_locations); + ((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->grid_file_locations = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":667 + * cdef public object sigs + * cdef public object grid_file_locations + * cdef public object dd # <<<<<<<<<<<<<< + * + * #@cython.boundscheck(False) + */ + +static PyObject *__pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_2dd___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_2dd___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dd); + __pyx_r = ((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dd; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_2dd___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_2dd___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dd); + __Pyx_DECREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dd); + ((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dd = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_2dd___del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_2dd___del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dd); + __Pyx_DECREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dd); + ((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dd = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":671 + * #@cython.boundscheck(False) + * #@cython.wraparound(False) + * def __cinit__(self, # <<<<<<<<<<<<<< + * np.ndarray[np.int64_t, ndim=1] left_index, + * np.ndarray[np.int64_t, ndim=1] dimensions, + */ + +static int __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_left_index = 0; + PyArrayObject *__pyx_v_dimensions = 0; + PyArrayObject *__pyx_v_left_edges = 0; + PyArrayObject *__pyx_v_right_edges = 0; + PyArrayObject *__pyx_v_grid_dimensions = 0; + PyArrayObject *__pyx_v_grid_file_locations = 0; + int __pyx_v_i; + int __pyx_v_ng; + int __pyx_v_l0; + int __pyx_v_l1; + int __pyx_v_l2; + int __pyx_v_i0; + int __pyx_v_i1; + int __pyx_v_i2; + __pyx_t_5numpy_int64_t __pyx_v_temp_l[3]; + __pyx_t_5numpy_int64_t __pyx_v_temp_r[3]; + __pyx_t_5numpy_float64_t __pyx_v_efficiency; + int __pyx_v_gi; + PyArrayObject *__pyx_v_sig0; + PyArrayObject *__pyx_v_sig1; + PyArrayObject *__pyx_v_sig2; + int __pyx_v_used; + long __pyx_v_nnn; + Py_buffer __pyx_bstruct_right_edges; + Py_ssize_t __pyx_bstride_0_right_edges = 0; + Py_ssize_t __pyx_bstride_1_right_edges = 0; + Py_ssize_t __pyx_bshape_0_right_edges = 0; + Py_ssize_t __pyx_bshape_1_right_edges = 0; + Py_buffer __pyx_bstruct_left_index; + Py_ssize_t __pyx_bstride_0_left_index = 0; + Py_ssize_t __pyx_bshape_0_left_index = 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_grid_file_locations; + Py_ssize_t __pyx_bstride_0_grid_file_locations = 0; + Py_ssize_t __pyx_bstride_1_grid_file_locations = 0; + Py_ssize_t __pyx_bshape_0_grid_file_locations = 0; + Py_ssize_t __pyx_bshape_1_grid_file_locations = 0; + Py_buffer __pyx_bstruct_grid_dimensions; + Py_ssize_t __pyx_bstride_0_grid_dimensions = 0; + Py_ssize_t __pyx_bstride_1_grid_dimensions = 0; + Py_ssize_t __pyx_bshape_0_grid_dimensions = 0; + Py_ssize_t __pyx_bshape_1_grid_dimensions = 0; + Py_buffer __pyx_bstruct_sig1; + Py_ssize_t __pyx_bstride_0_sig1 = 0; + Py_ssize_t __pyx_bshape_0_sig1 = 0; + Py_buffer __pyx_bstruct_sig2; + Py_ssize_t __pyx_bstride_0_sig2 = 0; + Py_ssize_t __pyx_bshape_0_sig2 = 0; + Py_buffer __pyx_bstruct_sig0; + Py_ssize_t __pyx_bstride_0_sig0 = 0; + Py_ssize_t __pyx_bshape_0_sig0 = 0; + Py_buffer __pyx_bstruct_left_edges; + Py_ssize_t __pyx_bstride_0_left_edges = 0; + Py_ssize_t __pyx_bstride_1_left_edges = 0; + Py_ssize_t __pyx_bshape_0_left_edges = 0; + Py_ssize_t __pyx_bshape_1_left_edges = 0; + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + long __pyx_t_8; + int __pyx_t_9; + long __pyx_t_10; + long __pyx_t_11; + int __pyx_t_12; + long __pyx_t_13; + int __pyx_t_14; + long __pyx_t_15; + int __pyx_t_16; + long __pyx_t_17; + int __pyx_t_18; + long __pyx_t_19; + long __pyx_t_20; + int __pyx_t_21; + long __pyx_t_22; + int __pyx_t_23; + long __pyx_t_24; + int __pyx_t_25; + long __pyx_t_26; + int __pyx_t_27; + long __pyx_t_28; + long __pyx_t_29; + int __pyx_t_30; + long __pyx_t_31; + int __pyx_t_32; + long __pyx_t_33; + int __pyx_t_34; + int __pyx_t_35; + int __pyx_t_36; + int __pyx_t_37; + int __pyx_t_38; + int __pyx_t_39; + int __pyx_t_40; + int __pyx_t_41; + PyObject *__pyx_t_42 = NULL; + PyObject *__pyx_t_43 = NULL; + PyArrayObject *__pyx_t_44 = NULL; + PyObject *__pyx_t_45 = NULL; + PyObject *__pyx_t_46 = NULL; + PyObject *__pyx_t_47 = NULL; + int __pyx_t_48; + long __pyx_t_49; + int __pyx_t_50; + __pyx_t_5numpy_int64_t __pyx_t_51; + int __pyx_t_52; + long __pyx_t_53; + int __pyx_t_54; + long __pyx_t_55; + int __pyx_t_56; + __pyx_t_5numpy_int64_t __pyx_t_57; + int __pyx_t_58; + long __pyx_t_59; + int __pyx_t_60; + long __pyx_t_61; + int __pyx_t_62; + __pyx_t_5numpy_int64_t __pyx_t_63; + int __pyx_t_64; + long __pyx_t_65; + int __pyx_t_66; + int __pyx_t_67; + int __pyx_t_68; + int __pyx_t_69; + long __pyx_t_70; + long __pyx_t_71; + long __pyx_t_72; + long __pyx_t_73; + int __pyx_t_74; + long __pyx_t_75; + int __pyx_t_76; + long __pyx_t_77; + int __pyx_t_78; + PyObject *__pyx_t_79 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__left_index,&__pyx_n_s__dimensions,&__pyx_n_s__left_edges,&__pyx_n_s__right_edges,&__pyx_n_s__grid_dimensions,&__pyx_n_s__grid_file_locations,0}; + __Pyx_RefNannySetupContext("__cinit__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[6] = {0,0,0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left_index); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dimensions); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left_edges); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right_edges); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid_dimensions); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid_file_locations); + if (likely(values[5])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_left_index = ((PyArrayObject *)values[0]); + __pyx_v_dimensions = ((PyArrayObject *)values[1]); + __pyx_v_left_edges = ((PyArrayObject *)values[2]); + __pyx_v_right_edges = ((PyArrayObject *)values[3]); + __pyx_v_grid_dimensions = ((PyArrayObject *)values[4]); + __pyx_v_grid_file_locations = ((PyArrayObject *)values[5]); + } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_left_index = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); + __pyx_v_dimensions = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); + __pyx_v_left_edges = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); + __pyx_v_right_edges = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); + __pyx_v_grid_dimensions = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); + __pyx_v_grid_file_locations = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 5)); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.ramses_reader.ProtoSubgrid.__cinit__"); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_v_sig0 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_sig1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_sig2 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_bstruct_sig0.buf = NULL; + __pyx_bstruct_sig1.buf = NULL; + __pyx_bstruct_sig2.buf = NULL; + __pyx_bstruct_left_index.buf = NULL; + __pyx_bstruct_dimensions.buf = NULL; + __pyx_bstruct_left_edges.buf = NULL; + __pyx_bstruct_right_edges.buf = NULL; + __pyx_bstruct_grid_dimensions.buf = NULL; + __pyx_bstruct_grid_file_locations.buf = NULL; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left_index), __pyx_ptype_5numpy_ndarray, 1, "left_index", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __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 = 673; __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 = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right_edges), __pyx_ptype_5numpy_ndarray, 1, "right_edges", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grid_dimensions), __pyx_ptype_5numpy_ndarray, 1, "grid_dimensions", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grid_file_locations), __pyx_ptype_5numpy_ndarray, 1, "grid_file_locations", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_left_index, (PyObject*)__pyx_v_left_index, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_left_index = __pyx_bstruct_left_index.strides[0]; + __pyx_bshape_0_left_index = __pyx_bstruct_left_index.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dimensions, (PyObject*)__pyx_v_dimensions, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __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]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_left_edges, (PyObject*)__pyx_v_left_edges, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_left_edges = __pyx_bstruct_left_edges.strides[0]; __pyx_bstride_1_left_edges = __pyx_bstruct_left_edges.strides[1]; + __pyx_bshape_0_left_edges = __pyx_bstruct_left_edges.shape[0]; __pyx_bshape_1_left_edges = __pyx_bstruct_left_edges.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_right_edges, (PyObject*)__pyx_v_right_edges, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_right_edges = __pyx_bstruct_right_edges.strides[0]; __pyx_bstride_1_right_edges = __pyx_bstruct_right_edges.strides[1]; + __pyx_bshape_0_right_edges = __pyx_bstruct_right_edges.shape[0]; __pyx_bshape_1_right_edges = __pyx_bstruct_right_edges.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_grid_dimensions, (PyObject*)__pyx_v_grid_dimensions, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_grid_dimensions = __pyx_bstruct_grid_dimensions.strides[0]; __pyx_bstride_1_grid_dimensions = __pyx_bstruct_grid_dimensions.strides[1]; + __pyx_bshape_0_grid_dimensions = __pyx_bstruct_grid_dimensions.shape[0]; __pyx_bshape_1_grid_dimensions = __pyx_bstruct_grid_dimensions.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_grid_file_locations, (PyObject*)__pyx_v_grid_file_locations, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_grid_file_locations = __pyx_bstruct_grid_file_locations.strides[0]; __pyx_bstride_1_grid_file_locations = __pyx_bstruct_grid_file_locations.strides[1]; + __pyx_bshape_0_grid_file_locations = __pyx_bstruct_grid_file_locations.shape[0]; __pyx_bshape_1_grid_file_locations = __pyx_bstruct_grid_file_locations.shape[1]; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":679 + * np.ndarray[np.int64_t, ndim=2] grid_file_locations): + * # This also includes the shrinking step. + * cdef int i, ci, ng = left_edges.shape[0] # <<<<<<<<<<<<<< + * cdef np.ndarray temp_arr + * cdef int l0, r0, l1, r1, l2, r2, i0, i1, i2 + */ + __pyx_v_ng = (__pyx_v_left_edges->dimensions[0]); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":684 + * cdef np.int64_t temp_l[3], temp_r[3], ncells + * cdef np.float64_t efficiency + * self.sigs = [] # <<<<<<<<<<<<<< + * for i in range(3): + * temp_l[i] = left_index[i] + dimensions[i] + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->sigs); + __Pyx_DECREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->sigs); + ((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->sigs = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":685 + * cdef np.float64_t efficiency + * self.sigs = [] + * for i in range(3): # <<<<<<<<<<<<<< + * temp_l[i] = left_index[i] + dimensions[i] + * temp_r[i] = left_index[i] + */ + for (__pyx_t_2 = 0; __pyx_t_2 < 3; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":686 + * self.sigs = [] + * for i in range(3): + * temp_l[i] = left_index[i] + dimensions[i] # <<<<<<<<<<<<<< + * temp_r[i] = left_index[i] + * self.signature[i] = NULL + */ + __pyx_t_3 = __pyx_v_i; + __pyx_t_4 = -1; + if (__pyx_t_3 < 0) { + __pyx_t_3 += __pyx_bshape_0_left_index; + if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 0; + } else if (unlikely(__pyx_t_3 >= __pyx_bshape_0_left_index)) __pyx_t_4 = 0; + if (unlikely(__pyx_t_4 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_4); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = __pyx_v_i; + __pyx_t_5 = -1; + if (__pyx_t_4 < 0) { + __pyx_t_4 += __pyx_bshape_0_dimensions; + if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0; + } else if (unlikely(__pyx_t_4 >= __pyx_bshape_0_dimensions)) __pyx_t_5 = 0; + if (unlikely(__pyx_t_5 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_5); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + (__pyx_v_temp_l[__pyx_v_i]) = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_index.buf, __pyx_t_3, __pyx_bstride_0_left_index)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_dimensions.buf, __pyx_t_4, __pyx_bstride_0_dimensions))); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":687 + * for i in range(3): + * temp_l[i] = left_index[i] + dimensions[i] + * temp_r[i] = left_index[i] # <<<<<<<<<<<<<< + * self.signature[i] = NULL + * for gi in range(ng): + */ + __pyx_t_5 = __pyx_v_i; + __pyx_t_6 = -1; + if (__pyx_t_5 < 0) { + __pyx_t_5 += __pyx_bshape_0_left_index; + if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0; + } else if (unlikely(__pyx_t_5 >= __pyx_bshape_0_left_index)) __pyx_t_6 = 0; + if (unlikely(__pyx_t_6 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_6); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + (__pyx_v_temp_r[__pyx_v_i]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_index.buf, __pyx_t_5, __pyx_bstride_0_left_index)); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":688 + * temp_l[i] = left_index[i] + dimensions[i] + * temp_r[i] = left_index[i] + * self.signature[i] = NULL # <<<<<<<<<<<<<< + * for gi in range(ng): + * if left_edges[gi,0] > left_index[0]+dimensions[0] or \ + */ + (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->signature[__pyx_v_i]) = NULL; + } + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":689 + * temp_r[i] = left_index[i] + * self.signature[i] = NULL + * for gi in range(ng): # <<<<<<<<<<<<<< + * if left_edges[gi,0] > left_index[0]+dimensions[0] or \ + * right_edges[gi,0] < left_index[0] or \ + */ + __pyx_t_2 = __pyx_v_ng; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_2; __pyx_t_6+=1) { + __pyx_v_gi = __pyx_t_6; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":690 + * self.signature[i] = NULL + * for gi in range(ng): + * if left_edges[gi,0] > left_index[0]+dimensions[0] or \ # <<<<<<<<<<<<<< + * right_edges[gi,0] < left_index[0] or \ + * left_edges[gi,1] > left_index[1]+dimensions[1] or \ + */ + __pyx_t_7 = __pyx_v_gi; + __pyx_t_8 = 0; + __pyx_t_9 = -1; + if (__pyx_t_7 < 0) { + __pyx_t_7 += __pyx_bshape_0_left_edges; + if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_7 >= __pyx_bshape_0_left_edges)) __pyx_t_9 = 0; + if (__pyx_t_8 < 0) { + __pyx_t_8 += __pyx_bshape_1_left_edges; + if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1; + } else if (unlikely(__pyx_t_8 >= __pyx_bshape_1_left_edges)) __pyx_t_9 = 1; + if (unlikely(__pyx_t_9 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_9); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_10 = 0; + __pyx_t_9 = -1; + if (__pyx_t_10 < 0) { + __pyx_t_10 += __pyx_bshape_0_left_index; + if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_left_index)) __pyx_t_9 = 0; + if (unlikely(__pyx_t_9 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_9); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_11 = 0; + __pyx_t_9 = -1; + if (__pyx_t_11 < 0) { + __pyx_t_11 += __pyx_bshape_0_dimensions; + if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_11 >= __pyx_bshape_0_dimensions)) __pyx_t_9 = 0; + if (unlikely(__pyx_t_9 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_9); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_12 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_edges.buf, __pyx_t_7, __pyx_bstride_0_left_edges, __pyx_t_8, __pyx_bstride_1_left_edges)) > ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_index.buf, __pyx_t_10, __pyx_bstride_0_left_index)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_dimensions.buf, __pyx_t_11, __pyx_bstride_0_dimensions)))); + if (!__pyx_t_12) { + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":691 + * for gi in range(ng): + * if left_edges[gi,0] > left_index[0]+dimensions[0] or \ + * right_edges[gi,0] < left_index[0] or \ # <<<<<<<<<<<<<< + * left_edges[gi,1] > left_index[1]+dimensions[1] or \ + * right_edges[gi,1] < left_index[1] or \ + */ + __pyx_t_9 = __pyx_v_gi; + __pyx_t_13 = 0; + __pyx_t_14 = -1; + if (__pyx_t_9 < 0) { + __pyx_t_9 += __pyx_bshape_0_right_edges; + if (unlikely(__pyx_t_9 < 0)) __pyx_t_14 = 0; + } else if (unlikely(__pyx_t_9 >= __pyx_bshape_0_right_edges)) __pyx_t_14 = 0; + if (__pyx_t_13 < 0) { + __pyx_t_13 += __pyx_bshape_1_right_edges; + if (unlikely(__pyx_t_13 < 0)) __pyx_t_14 = 1; + } else if (unlikely(__pyx_t_13 >= __pyx_bshape_1_right_edges)) __pyx_t_14 = 1; + if (unlikely(__pyx_t_14 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_14); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_15 = 0; + __pyx_t_14 = -1; + if (__pyx_t_15 < 0) { + __pyx_t_15 += __pyx_bshape_0_left_index; + if (unlikely(__pyx_t_15 < 0)) __pyx_t_14 = 0; + } else if (unlikely(__pyx_t_15 >= __pyx_bshape_0_left_index)) __pyx_t_14 = 0; + if (unlikely(__pyx_t_14 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_14); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_16 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_right_edges.buf, __pyx_t_9, __pyx_bstride_0_right_edges, __pyx_t_13, __pyx_bstride_1_right_edges)) < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_index.buf, __pyx_t_15, __pyx_bstride_0_left_index))); + if (!__pyx_t_16) { + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":692 + * if left_edges[gi,0] > left_index[0]+dimensions[0] or \ + * right_edges[gi,0] < left_index[0] or \ + * left_edges[gi,1] > left_index[1]+dimensions[1] or \ # <<<<<<<<<<<<<< + * right_edges[gi,1] < left_index[1] or \ + * left_edges[gi,2] > left_index[2]+dimensions[2] or \ + */ + __pyx_t_14 = __pyx_v_gi; + __pyx_t_17 = 1; + __pyx_t_18 = -1; + if (__pyx_t_14 < 0) { + __pyx_t_14 += __pyx_bshape_0_left_edges; + if (unlikely(__pyx_t_14 < 0)) __pyx_t_18 = 0; + } else if (unlikely(__pyx_t_14 >= __pyx_bshape_0_left_edges)) __pyx_t_18 = 0; + if (__pyx_t_17 < 0) { + __pyx_t_17 += __pyx_bshape_1_left_edges; + if (unlikely(__pyx_t_17 < 0)) __pyx_t_18 = 1; + } else if (unlikely(__pyx_t_17 >= __pyx_bshape_1_left_edges)) __pyx_t_18 = 1; + if (unlikely(__pyx_t_18 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_18); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_19 = 1; + __pyx_t_18 = -1; + if (__pyx_t_19 < 0) { + __pyx_t_19 += __pyx_bshape_0_left_index; + if (unlikely(__pyx_t_19 < 0)) __pyx_t_18 = 0; + } else if (unlikely(__pyx_t_19 >= __pyx_bshape_0_left_index)) __pyx_t_18 = 0; + if (unlikely(__pyx_t_18 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_18); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_20 = 1; + __pyx_t_18 = -1; + if (__pyx_t_20 < 0) { + __pyx_t_20 += __pyx_bshape_0_dimensions; + if (unlikely(__pyx_t_20 < 0)) __pyx_t_18 = 0; + } else if (unlikely(__pyx_t_20 >= __pyx_bshape_0_dimensions)) __pyx_t_18 = 0; + if (unlikely(__pyx_t_18 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_18); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_21 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_edges.buf, __pyx_t_14, __pyx_bstride_0_left_edges, __pyx_t_17, __pyx_bstride_1_left_edges)) > ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_index.buf, __pyx_t_19, __pyx_bstride_0_left_index)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_dimensions.buf, __pyx_t_20, __pyx_bstride_0_dimensions)))); + if (!__pyx_t_21) { + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":693 + * right_edges[gi,0] < left_index[0] or \ + * left_edges[gi,1] > left_index[1]+dimensions[1] or \ + * right_edges[gi,1] < left_index[1] or \ # <<<<<<<<<<<<<< + * left_edges[gi,2] > left_index[2]+dimensions[2] or \ + * right_edges[gi,2] < left_index[2]: + */ + __pyx_t_18 = __pyx_v_gi; + __pyx_t_22 = 1; + __pyx_t_23 = -1; + if (__pyx_t_18 < 0) { + __pyx_t_18 += __pyx_bshape_0_right_edges; + if (unlikely(__pyx_t_18 < 0)) __pyx_t_23 = 0; + } else if (unlikely(__pyx_t_18 >= __pyx_bshape_0_right_edges)) __pyx_t_23 = 0; + if (__pyx_t_22 < 0) { + __pyx_t_22 += __pyx_bshape_1_right_edges; + if (unlikely(__pyx_t_22 < 0)) __pyx_t_23 = 1; + } else if (unlikely(__pyx_t_22 >= __pyx_bshape_1_right_edges)) __pyx_t_23 = 1; + if (unlikely(__pyx_t_23 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_23); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_24 = 1; + __pyx_t_23 = -1; + if (__pyx_t_24 < 0) { + __pyx_t_24 += __pyx_bshape_0_left_index; + if (unlikely(__pyx_t_24 < 0)) __pyx_t_23 = 0; + } else if (unlikely(__pyx_t_24 >= __pyx_bshape_0_left_index)) __pyx_t_23 = 0; + if (unlikely(__pyx_t_23 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_23); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_25 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_right_edges.buf, __pyx_t_18, __pyx_bstride_0_right_edges, __pyx_t_22, __pyx_bstride_1_right_edges)) < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_index.buf, __pyx_t_24, __pyx_bstride_0_left_index))); + if (!__pyx_t_25) { + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":694 + * left_edges[gi,1] > left_index[1]+dimensions[1] or \ + * right_edges[gi,1] < left_index[1] or \ + * left_edges[gi,2] > left_index[2]+dimensions[2] or \ # <<<<<<<<<<<<<< + * right_edges[gi,2] < left_index[2]: + * #print "Skipping grid", gi, "which lies outside out box" + */ + __pyx_t_23 = __pyx_v_gi; + __pyx_t_26 = 2; + __pyx_t_27 = -1; + if (__pyx_t_23 < 0) { + __pyx_t_23 += __pyx_bshape_0_left_edges; + if (unlikely(__pyx_t_23 < 0)) __pyx_t_27 = 0; + } else if (unlikely(__pyx_t_23 >= __pyx_bshape_0_left_edges)) __pyx_t_27 = 0; + if (__pyx_t_26 < 0) { + __pyx_t_26 += __pyx_bshape_1_left_edges; + if (unlikely(__pyx_t_26 < 0)) __pyx_t_27 = 1; + } else if (unlikely(__pyx_t_26 >= __pyx_bshape_1_left_edges)) __pyx_t_27 = 1; + if (unlikely(__pyx_t_27 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_27); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_28 = 2; + __pyx_t_27 = -1; + if (__pyx_t_28 < 0) { + __pyx_t_28 += __pyx_bshape_0_left_index; + if (unlikely(__pyx_t_28 < 0)) __pyx_t_27 = 0; + } else if (unlikely(__pyx_t_28 >= __pyx_bshape_0_left_index)) __pyx_t_27 = 0; + if (unlikely(__pyx_t_27 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_27); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_29 = 2; + __pyx_t_27 = -1; + if (__pyx_t_29 < 0) { + __pyx_t_29 += __pyx_bshape_0_dimensions; + if (unlikely(__pyx_t_29 < 0)) __pyx_t_27 = 0; + } else if (unlikely(__pyx_t_29 >= __pyx_bshape_0_dimensions)) __pyx_t_27 = 0; + if (unlikely(__pyx_t_27 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_27); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_30 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_edges.buf, __pyx_t_23, __pyx_bstride_0_left_edges, __pyx_t_26, __pyx_bstride_1_left_edges)) > ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_index.buf, __pyx_t_28, __pyx_bstride_0_left_index)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_dimensions.buf, __pyx_t_29, __pyx_bstride_0_dimensions)))); + if (!__pyx_t_30) { + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":695 + * right_edges[gi,1] < left_index[1] or \ + * left_edges[gi,2] > left_index[2]+dimensions[2] or \ + * right_edges[gi,2] < left_index[2]: # <<<<<<<<<<<<<< + * #print "Skipping grid", gi, "which lies outside out box" + * continue + */ + __pyx_t_27 = __pyx_v_gi; + __pyx_t_31 = 2; + __pyx_t_32 = -1; + if (__pyx_t_27 < 0) { + __pyx_t_27 += __pyx_bshape_0_right_edges; + if (unlikely(__pyx_t_27 < 0)) __pyx_t_32 = 0; + } else if (unlikely(__pyx_t_27 >= __pyx_bshape_0_right_edges)) __pyx_t_32 = 0; + if (__pyx_t_31 < 0) { + __pyx_t_31 += __pyx_bshape_1_right_edges; + if (unlikely(__pyx_t_31 < 0)) __pyx_t_32 = 1; + } else if (unlikely(__pyx_t_31 >= __pyx_bshape_1_right_edges)) __pyx_t_32 = 1; + if (unlikely(__pyx_t_32 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_32); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_33 = 2; + __pyx_t_32 = -1; + if (__pyx_t_33 < 0) { + __pyx_t_33 += __pyx_bshape_0_left_index; + if (unlikely(__pyx_t_33 < 0)) __pyx_t_32 = 0; + } else if (unlikely(__pyx_t_33 >= __pyx_bshape_0_left_index)) __pyx_t_32 = 0; + if (unlikely(__pyx_t_32 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_32); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_34 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_right_edges.buf, __pyx_t_27, __pyx_bstride_0_right_edges, __pyx_t_31, __pyx_bstride_1_right_edges)) < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_index.buf, __pyx_t_33, __pyx_bstride_0_left_index))); + __pyx_t_35 = __pyx_t_34; + } else { + __pyx_t_35 = __pyx_t_30; + } + __pyx_t_30 = __pyx_t_35; + } else { + __pyx_t_30 = __pyx_t_25; + } + __pyx_t_25 = __pyx_t_30; + } else { + __pyx_t_25 = __pyx_t_21; + } + __pyx_t_21 = __pyx_t_25; + } else { + __pyx_t_21 = __pyx_t_16; + } + __pyx_t_16 = __pyx_t_21; + } else { + __pyx_t_16 = __pyx_t_12; + } + if (__pyx_t_16) { + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":697 + * right_edges[gi,2] < left_index[2]: + * #print "Skipping grid", gi, "which lies outside out box" + * continue # <<<<<<<<<<<<<< + * for i in range(3): + * temp_l[i] = i64min(left_edges[gi,i], temp_l[i]) + */ + goto __pyx_L8_continue; + goto __pyx_L10; + } + __pyx_L10:; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":698 + * #print "Skipping grid", gi, "which lies outside out box" + * continue + * for i in range(3): # <<<<<<<<<<<<<< + * temp_l[i] = i64min(left_edges[gi,i], temp_l[i]) + * temp_r[i] = i64max(right_edges[gi,i], temp_r[i]) + */ + for (__pyx_t_32 = 0; __pyx_t_32 < 3; __pyx_t_32+=1) { + __pyx_v_i = __pyx_t_32; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":699 + * continue + * for i in range(3): + * temp_l[i] = i64min(left_edges[gi,i], temp_l[i]) # <<<<<<<<<<<<<< + * temp_r[i] = i64max(right_edges[gi,i], temp_r[i]) + * for i in range(3): + */ + __pyx_t_36 = __pyx_v_gi; + __pyx_t_37 = __pyx_v_i; + __pyx_t_38 = -1; + if (__pyx_t_36 < 0) { + __pyx_t_36 += __pyx_bshape_0_left_edges; + if (unlikely(__pyx_t_36 < 0)) __pyx_t_38 = 0; + } else if (unlikely(__pyx_t_36 >= __pyx_bshape_0_left_edges)) __pyx_t_38 = 0; + if (__pyx_t_37 < 0) { + __pyx_t_37 += __pyx_bshape_1_left_edges; + if (unlikely(__pyx_t_37 < 0)) __pyx_t_38 = 1; + } else if (unlikely(__pyx_t_37 >= __pyx_bshape_1_left_edges)) __pyx_t_38 = 1; + if (unlikely(__pyx_t_38 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_38); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + (__pyx_v_temp_l[__pyx_v_i]) = __pyx_f_2yt_13ramses_reader_i64min((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_edges.buf, __pyx_t_36, __pyx_bstride_0_left_edges, __pyx_t_37, __pyx_bstride_1_left_edges)), (__pyx_v_temp_l[__pyx_v_i])); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":700 + * for i in range(3): + * temp_l[i] = i64min(left_edges[gi,i], temp_l[i]) + * temp_r[i] = i64max(right_edges[gi,i], temp_r[i]) # <<<<<<<<<<<<<< + * for i in range(3): + * self.left_edge[i] = i64max(temp_l[i], left_index[i]) + */ + __pyx_t_38 = __pyx_v_gi; + __pyx_t_39 = __pyx_v_i; + __pyx_t_40 = -1; + if (__pyx_t_38 < 0) { + __pyx_t_38 += __pyx_bshape_0_right_edges; + if (unlikely(__pyx_t_38 < 0)) __pyx_t_40 = 0; + } else if (unlikely(__pyx_t_38 >= __pyx_bshape_0_right_edges)) __pyx_t_40 = 0; + if (__pyx_t_39 < 0) { + __pyx_t_39 += __pyx_bshape_1_right_edges; + if (unlikely(__pyx_t_39 < 0)) __pyx_t_40 = 1; + } else if (unlikely(__pyx_t_39 >= __pyx_bshape_1_right_edges)) __pyx_t_40 = 1; + if (unlikely(__pyx_t_40 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_40); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + (__pyx_v_temp_r[__pyx_v_i]) = __pyx_f_2yt_13ramses_reader_i64max((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_right_edges.buf, __pyx_t_38, __pyx_bstride_0_right_edges, __pyx_t_39, __pyx_bstride_1_right_edges)), (__pyx_v_temp_r[__pyx_v_i])); + } + __pyx_L8_continue:; + } + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":701 + * temp_l[i] = i64min(left_edges[gi,i], temp_l[i]) + * temp_r[i] = i64max(right_edges[gi,i], temp_r[i]) + * for i in range(3): # <<<<<<<<<<<<<< + * self.left_edge[i] = i64max(temp_l[i], left_index[i]) + * self.right_edge[i] = i64min(temp_r[i], left_index[i] + dimensions[i]) + */ + for (__pyx_t_2 = 0; __pyx_t_2 < 3; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":702 + * temp_r[i] = i64max(right_edges[gi,i], temp_r[i]) + * for i in range(3): + * self.left_edge[i] = i64max(temp_l[i], left_index[i]) # <<<<<<<<<<<<<< + * self.right_edge[i] = i64min(temp_r[i], left_index[i] + dimensions[i]) + * self.dimensions[i] = self.right_edge[i] - self.left_edge[i] + */ + __pyx_t_6 = __pyx_v_i; + __pyx_t_32 = -1; + if (__pyx_t_6 < 0) { + __pyx_t_6 += __pyx_bshape_0_left_index; + if (unlikely(__pyx_t_6 < 0)) __pyx_t_32 = 0; + } else if (unlikely(__pyx_t_6 >= __pyx_bshape_0_left_index)) __pyx_t_32 = 0; + if (unlikely(__pyx_t_32 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_32); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->left_edge[__pyx_v_i]) = __pyx_f_2yt_13ramses_reader_i64max((__pyx_v_temp_l[__pyx_v_i]), (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_index.buf, __pyx_t_6, __pyx_bstride_0_left_index))); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":703 + * for i in range(3): + * self.left_edge[i] = i64max(temp_l[i], left_index[i]) + * self.right_edge[i] = i64min(temp_r[i], left_index[i] + dimensions[i]) # <<<<<<<<<<<<<< + * self.dimensions[i] = self.right_edge[i] - self.left_edge[i] + * if self.dimensions[i] <= 0: + */ + __pyx_t_32 = __pyx_v_i; + __pyx_t_40 = -1; + if (__pyx_t_32 < 0) { + __pyx_t_32 += __pyx_bshape_0_left_index; + if (unlikely(__pyx_t_32 < 0)) __pyx_t_40 = 0; + } else if (unlikely(__pyx_t_32 >= __pyx_bshape_0_left_index)) __pyx_t_40 = 0; + if (unlikely(__pyx_t_40 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_40); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_40 = __pyx_v_i; + __pyx_t_41 = -1; + if (__pyx_t_40 < 0) { + __pyx_t_40 += __pyx_bshape_0_dimensions; + if (unlikely(__pyx_t_40 < 0)) __pyx_t_41 = 0; + } else if (unlikely(__pyx_t_40 >= __pyx_bshape_0_dimensions)) __pyx_t_41 = 0; + if (unlikely(__pyx_t_41 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_41); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->right_edge[__pyx_v_i]) = __pyx_f_2yt_13ramses_reader_i64min((__pyx_v_temp_r[__pyx_v_i]), ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_index.buf, __pyx_t_32, __pyx_bstride_0_left_index)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_dimensions.buf, __pyx_t_40, __pyx_bstride_0_dimensions)))); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":704 + * self.left_edge[i] = i64max(temp_l[i], left_index[i]) + * self.right_edge[i] = i64min(temp_r[i], left_index[i] + dimensions[i]) + * self.dimensions[i] = self.right_edge[i] - self.left_edge[i] # <<<<<<<<<<<<<< + * if self.dimensions[i] <= 0: + * self.efficiency = -1.0 + */ + (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dimensions[__pyx_v_i]) = ((((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->right_edge[__pyx_v_i]) - (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->left_edge[__pyx_v_i])); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":705 + * self.right_edge[i] = i64min(temp_r[i], left_index[i] + dimensions[i]) + * self.dimensions[i] = self.right_edge[i] - self.left_edge[i] + * if self.dimensions[i] <= 0: # <<<<<<<<<<<<<< + * self.efficiency = -1.0 + * return + */ + __pyx_t_16 = ((((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dimensions[__pyx_v_i]) <= 0); + if (__pyx_t_16) { + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":706 + * self.dimensions[i] = self.right_edge[i] - self.left_edge[i] + * if self.dimensions[i] <= 0: + * self.efficiency = -1.0 # <<<<<<<<<<<<<< + * return + * self.sigs.append(np.zeros(self.dimensions[i], 'int64')) + */ + ((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->efficiency = (-1.0); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":707 + * if self.dimensions[i] <= 0: + * self.efficiency = -1.0 + * return # <<<<<<<<<<<<<< + * self.sigs.append(np.zeros(self.dimensions[i], 'int64')) + * #print self.sigs[0].size, self.sigs[1].size, self.sigs[2].size + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L15; + } + __pyx_L15:; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":708 + * self.efficiency = -1.0 + * return + * self.sigs.append(np.zeros(self.dimensions[i], 'int64')) # <<<<<<<<<<<<<< + * #print self.sigs[0].size, self.sigs[1].size, self.sigs[2].size + * + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_42 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_42); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_to_py_npy_int64((((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dimensions[__pyx_v_i])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_43 = PyTuple_New(2); if (unlikely(!__pyx_t_43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_43); + PyTuple_SET_ITEM(__pyx_t_43, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_n_s__int64)); + PyTuple_SET_ITEM(__pyx_t_43, 1, ((PyObject *)__pyx_n_s__int64)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__int64)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_42, __pyx_t_43, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; + __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0; + __pyx_t_43 = __Pyx_PyObject_Append(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->sigs, __pyx_t_1); if (unlikely(!__pyx_t_43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_43); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0; + } + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":715 + * # pass. + * cdef np.ndarray[np.int64_t, ndim=1] sig0, sig1, sig2 + * sig0 = self.sigs[0] # <<<<<<<<<<<<<< + * sig1 = self.sigs[1] + * sig2 = self.sigs[2] + */ + __pyx_t_43 = __Pyx_GetItemInt(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->sigs, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_43) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_43); + if (!(likely(((__pyx_t_43) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_43, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_44 = ((PyArrayObject *)__pyx_t_43); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sig0); + __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_sig0, (PyObject*)__pyx_t_44, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_2 < 0)) { + PyErr_Fetch(&__pyx_t_45, &__pyx_t_46, &__pyx_t_47); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_sig0, (PyObject*)__pyx_v_sig0, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_46); Py_XDECREF(__pyx_t_47); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_45, __pyx_t_46, __pyx_t_47); + } + } + __pyx_bstride_0_sig0 = __pyx_bstruct_sig0.strides[0]; + __pyx_bshape_0_sig0 = __pyx_bstruct_sig0.shape[0]; + if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_44 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_sig0)); + __pyx_v_sig0 = ((PyArrayObject *)__pyx_t_43); + __pyx_t_43 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":716 + * cdef np.ndarray[np.int64_t, ndim=1] sig0, sig1, sig2 + * sig0 = self.sigs[0] + * sig1 = self.sigs[1] # <<<<<<<<<<<<<< + * sig2 = self.sigs[2] + * efficiency = 0.0 + */ + __pyx_t_43 = __Pyx_GetItemInt(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->sigs, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_43) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_43); + if (!(likely(((__pyx_t_43) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_43, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_44 = ((PyArrayObject *)__pyx_t_43); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sig1); + __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_sig1, (PyObject*)__pyx_t_44, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_2 < 0)) { + PyErr_Fetch(&__pyx_t_47, &__pyx_t_46, &__pyx_t_45); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_sig1, (PyObject*)__pyx_v_sig1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_47); Py_XDECREF(__pyx_t_46); Py_XDECREF(__pyx_t_45); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_47, __pyx_t_46, __pyx_t_45); + } + } + __pyx_bstride_0_sig1 = __pyx_bstruct_sig1.strides[0]; + __pyx_bshape_0_sig1 = __pyx_bstruct_sig1.shape[0]; + if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_44 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_sig1)); + __pyx_v_sig1 = ((PyArrayObject *)__pyx_t_43); + __pyx_t_43 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":717 + * sig0 = self.sigs[0] + * sig1 = self.sigs[1] + * sig2 = self.sigs[2] # <<<<<<<<<<<<<< + * efficiency = 0.0 + * cdef int used + */ + __pyx_t_43 = __Pyx_GetItemInt(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->sigs, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_43) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_43); + if (!(likely(((__pyx_t_43) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_43, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_44 = ((PyArrayObject *)__pyx_t_43); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sig2); + __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_sig2, (PyObject*)__pyx_t_44, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_2 < 0)) { + PyErr_Fetch(&__pyx_t_45, &__pyx_t_46, &__pyx_t_47); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_sig2, (PyObject*)__pyx_v_sig2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_46); Py_XDECREF(__pyx_t_47); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_45, __pyx_t_46, __pyx_t_47); + } + } + __pyx_bstride_0_sig2 = __pyx_bstruct_sig2.strides[0]; + __pyx_bshape_0_sig2 = __pyx_bstruct_sig2.shape[0]; + if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_44 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_sig2)); + __pyx_v_sig2 = ((PyArrayObject *)__pyx_t_43); + __pyx_t_43 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":718 + * sig1 = self.sigs[1] + * sig2 = self.sigs[2] + * efficiency = 0.0 # <<<<<<<<<<<<<< + * cdef int used + * self.grid_file_locations = [] + */ + __pyx_v_efficiency = 0.0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":720 + * efficiency = 0.0 + * cdef int used + * self.grid_file_locations = [] # <<<<<<<<<<<<<< + * for gi in range(ng): + * used = 0 + */ + __pyx_t_43 = PyList_New(0); if (unlikely(!__pyx_t_43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_43)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_43)); + __Pyx_GOTREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->grid_file_locations); + __Pyx_DECREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->grid_file_locations); + ((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->grid_file_locations = ((PyObject *)__pyx_t_43); + __pyx_t_43 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":721 + * cdef int used + * self.grid_file_locations = [] + * for gi in range(ng): # <<<<<<<<<<<<<< + * used = 0 + * nnn = 0 + */ + __pyx_t_2 = __pyx_v_ng; + for (__pyx_t_41 = 0; __pyx_t_41 < __pyx_t_2; __pyx_t_41+=1) { + __pyx_v_gi = __pyx_t_41; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":722 + * self.grid_file_locations = [] + * for gi in range(ng): + * used = 0 # <<<<<<<<<<<<<< + * nnn = 0 + * for l0 in range(grid_dimensions[gi, 0]): + */ + __pyx_v_used = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":723 + * for gi in range(ng): + * used = 0 + * nnn = 0 # <<<<<<<<<<<<<< + * for l0 in range(grid_dimensions[gi, 0]): + * i0 = left_edges[gi, 0] + l0 + */ + __pyx_v_nnn = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":724 + * used = 0 + * nnn = 0 + * for l0 in range(grid_dimensions[gi, 0]): # <<<<<<<<<<<<<< + * i0 = left_edges[gi, 0] + l0 + * if i0 < self.left_edge[0]: continue + */ + __pyx_t_48 = __pyx_v_gi; + __pyx_t_49 = 0; + __pyx_t_50 = -1; + if (__pyx_t_48 < 0) { + __pyx_t_48 += __pyx_bshape_0_grid_dimensions; + if (unlikely(__pyx_t_48 < 0)) __pyx_t_50 = 0; + } else if (unlikely(__pyx_t_48 >= __pyx_bshape_0_grid_dimensions)) __pyx_t_50 = 0; + if (__pyx_t_49 < 0) { + __pyx_t_49 += __pyx_bshape_1_grid_dimensions; + if (unlikely(__pyx_t_49 < 0)) __pyx_t_50 = 1; + } else if (unlikely(__pyx_t_49 >= __pyx_bshape_1_grid_dimensions)) __pyx_t_50 = 1; + if (unlikely(__pyx_t_50 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_50); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_51 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_grid_dimensions.buf, __pyx_t_48, __pyx_bstride_0_grid_dimensions, __pyx_t_49, __pyx_bstride_1_grid_dimensions)); + for (__pyx_t_50 = 0; __pyx_t_50 < __pyx_t_51; __pyx_t_50+=1) { + __pyx_v_l0 = __pyx_t_50; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":725 + * nnn = 0 + * for l0 in range(grid_dimensions[gi, 0]): + * i0 = left_edges[gi, 0] + l0 # <<<<<<<<<<<<<< + * if i0 < self.left_edge[0]: continue + * if i0 >= self.right_edge[0]: break + */ + __pyx_t_52 = __pyx_v_gi; + __pyx_t_53 = 0; + __pyx_t_54 = -1; + if (__pyx_t_52 < 0) { + __pyx_t_52 += __pyx_bshape_0_left_edges; + if (unlikely(__pyx_t_52 < 0)) __pyx_t_54 = 0; + } else if (unlikely(__pyx_t_52 >= __pyx_bshape_0_left_edges)) __pyx_t_54 = 0; + if (__pyx_t_53 < 0) { + __pyx_t_53 += __pyx_bshape_1_left_edges; + if (unlikely(__pyx_t_53 < 0)) __pyx_t_54 = 1; + } else if (unlikely(__pyx_t_53 >= __pyx_bshape_1_left_edges)) __pyx_t_54 = 1; + if (unlikely(__pyx_t_54 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_54); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_i0 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_edges.buf, __pyx_t_52, __pyx_bstride_0_left_edges, __pyx_t_53, __pyx_bstride_1_left_edges)) + __pyx_v_l0); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":726 + * for l0 in range(grid_dimensions[gi, 0]): + * i0 = left_edges[gi, 0] + l0 + * if i0 < self.left_edge[0]: continue # <<<<<<<<<<<<<< + * if i0 >= self.right_edge[0]: break + * for l1 in range(grid_dimensions[gi, 1]): + */ + __pyx_t_16 = (__pyx_v_i0 < (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->left_edge[0])); + if (__pyx_t_16) { + goto __pyx_L18_continue; + goto __pyx_L20; + } + __pyx_L20:; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":727 + * i0 = left_edges[gi, 0] + l0 + * if i0 < self.left_edge[0]: continue + * if i0 >= self.right_edge[0]: break # <<<<<<<<<<<<<< + * for l1 in range(grid_dimensions[gi, 1]): + * i1 = left_edges[gi, 1] + l1 + */ + __pyx_t_16 = (__pyx_v_i0 >= (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->right_edge[0])); + if (__pyx_t_16) { + goto __pyx_L19_break; + goto __pyx_L21; + } + __pyx_L21:; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":728 + * if i0 < self.left_edge[0]: continue + * if i0 >= self.right_edge[0]: break + * for l1 in range(grid_dimensions[gi, 1]): # <<<<<<<<<<<<<< + * i1 = left_edges[gi, 1] + l1 + * if i1 < self.left_edge[1]: continue + */ + __pyx_t_54 = __pyx_v_gi; + __pyx_t_55 = 1; + __pyx_t_56 = -1; + if (__pyx_t_54 < 0) { + __pyx_t_54 += __pyx_bshape_0_grid_dimensions; + if (unlikely(__pyx_t_54 < 0)) __pyx_t_56 = 0; + } else if (unlikely(__pyx_t_54 >= __pyx_bshape_0_grid_dimensions)) __pyx_t_56 = 0; + if (__pyx_t_55 < 0) { + __pyx_t_55 += __pyx_bshape_1_grid_dimensions; + if (unlikely(__pyx_t_55 < 0)) __pyx_t_56 = 1; + } else if (unlikely(__pyx_t_55 >= __pyx_bshape_1_grid_dimensions)) __pyx_t_56 = 1; + if (unlikely(__pyx_t_56 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_56); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_57 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_grid_dimensions.buf, __pyx_t_54, __pyx_bstride_0_grid_dimensions, __pyx_t_55, __pyx_bstride_1_grid_dimensions)); + for (__pyx_t_56 = 0; __pyx_t_56 < __pyx_t_57; __pyx_t_56+=1) { + __pyx_v_l1 = __pyx_t_56; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":729 + * if i0 >= self.right_edge[0]: break + * for l1 in range(grid_dimensions[gi, 1]): + * i1 = left_edges[gi, 1] + l1 # <<<<<<<<<<<<<< + * if i1 < self.left_edge[1]: continue + * if i1 >= self.right_edge[1]: break + */ + __pyx_t_58 = __pyx_v_gi; + __pyx_t_59 = 1; + __pyx_t_60 = -1; + if (__pyx_t_58 < 0) { + __pyx_t_58 += __pyx_bshape_0_left_edges; + if (unlikely(__pyx_t_58 < 0)) __pyx_t_60 = 0; + } else if (unlikely(__pyx_t_58 >= __pyx_bshape_0_left_edges)) __pyx_t_60 = 0; + if (__pyx_t_59 < 0) { + __pyx_t_59 += __pyx_bshape_1_left_edges; + if (unlikely(__pyx_t_59 < 0)) __pyx_t_60 = 1; + } else if (unlikely(__pyx_t_59 >= __pyx_bshape_1_left_edges)) __pyx_t_60 = 1; + if (unlikely(__pyx_t_60 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_60); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_i1 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_edges.buf, __pyx_t_58, __pyx_bstride_0_left_edges, __pyx_t_59, __pyx_bstride_1_left_edges)) + __pyx_v_l1); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":730 + * for l1 in range(grid_dimensions[gi, 1]): + * i1 = left_edges[gi, 1] + l1 + * if i1 < self.left_edge[1]: continue # <<<<<<<<<<<<<< + * if i1 >= self.right_edge[1]: break + * for l2 in range(grid_dimensions[gi, 2]): + */ + __pyx_t_16 = (__pyx_v_i1 < (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->left_edge[1])); + if (__pyx_t_16) { + goto __pyx_L22_continue; + goto __pyx_L24; + } + __pyx_L24:; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":731 + * i1 = left_edges[gi, 1] + l1 + * if i1 < self.left_edge[1]: continue + * if i1 >= self.right_edge[1]: break # <<<<<<<<<<<<<< + * for l2 in range(grid_dimensions[gi, 2]): + * i2 = left_edges[gi, 2] + l2 + */ + __pyx_t_16 = (__pyx_v_i1 >= (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->right_edge[1])); + if (__pyx_t_16) { + goto __pyx_L23_break; + goto __pyx_L25; + } + __pyx_L25:; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":732 + * if i1 < self.left_edge[1]: continue + * if i1 >= self.right_edge[1]: break + * for l2 in range(grid_dimensions[gi, 2]): # <<<<<<<<<<<<<< + * i2 = left_edges[gi, 2] + l2 + * if i2 < self.left_edge[2]: continue + */ + __pyx_t_60 = __pyx_v_gi; + __pyx_t_61 = 2; + __pyx_t_62 = -1; + if (__pyx_t_60 < 0) { + __pyx_t_60 += __pyx_bshape_0_grid_dimensions; + if (unlikely(__pyx_t_60 < 0)) __pyx_t_62 = 0; + } else if (unlikely(__pyx_t_60 >= __pyx_bshape_0_grid_dimensions)) __pyx_t_62 = 0; + if (__pyx_t_61 < 0) { + __pyx_t_61 += __pyx_bshape_1_grid_dimensions; + if (unlikely(__pyx_t_61 < 0)) __pyx_t_62 = 1; + } else if (unlikely(__pyx_t_61 >= __pyx_bshape_1_grid_dimensions)) __pyx_t_62 = 1; + if (unlikely(__pyx_t_62 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_62); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_63 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_grid_dimensions.buf, __pyx_t_60, __pyx_bstride_0_grid_dimensions, __pyx_t_61, __pyx_bstride_1_grid_dimensions)); + for (__pyx_t_62 = 0; __pyx_t_62 < __pyx_t_63; __pyx_t_62+=1) { + __pyx_v_l2 = __pyx_t_62; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":733 + * if i1 >= self.right_edge[1]: break + * for l2 in range(grid_dimensions[gi, 2]): + * i2 = left_edges[gi, 2] + l2 # <<<<<<<<<<<<<< + * if i2 < self.left_edge[2]: continue + * if i2 >= self.right_edge[2]: break + */ + __pyx_t_64 = __pyx_v_gi; + __pyx_t_65 = 2; + __pyx_t_66 = -1; + if (__pyx_t_64 < 0) { + __pyx_t_64 += __pyx_bshape_0_left_edges; + if (unlikely(__pyx_t_64 < 0)) __pyx_t_66 = 0; + } else if (unlikely(__pyx_t_64 >= __pyx_bshape_0_left_edges)) __pyx_t_66 = 0; + if (__pyx_t_65 < 0) { + __pyx_t_65 += __pyx_bshape_1_left_edges; + if (unlikely(__pyx_t_65 < 0)) __pyx_t_66 = 1; + } else if (unlikely(__pyx_t_65 >= __pyx_bshape_1_left_edges)) __pyx_t_66 = 1; + if (unlikely(__pyx_t_66 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_66); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_i2 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_edges.buf, __pyx_t_64, __pyx_bstride_0_left_edges, __pyx_t_65, __pyx_bstride_1_left_edges)) + __pyx_v_l2); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":734 + * for l2 in range(grid_dimensions[gi, 2]): + * i2 = left_edges[gi, 2] + l2 + * if i2 < self.left_edge[2]: continue # <<<<<<<<<<<<<< + * if i2 >= self.right_edge[2]: break + * i = i0 - self.left_edge[0] + */ + __pyx_t_16 = (__pyx_v_i2 < (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->left_edge[2])); + if (__pyx_t_16) { + goto __pyx_L26_continue; + goto __pyx_L28; + } + __pyx_L28:; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":735 + * i2 = left_edges[gi, 2] + l2 + * if i2 < self.left_edge[2]: continue + * if i2 >= self.right_edge[2]: break # <<<<<<<<<<<<<< + * i = i0 - self.left_edge[0] + * sig0[i] += 1 + */ + __pyx_t_16 = (__pyx_v_i2 >= (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->right_edge[2])); + if (__pyx_t_16) { + goto __pyx_L27_break; + goto __pyx_L29; + } + __pyx_L29:; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":736 + * if i2 < self.left_edge[2]: continue + * if i2 >= self.right_edge[2]: break + * i = i0 - self.left_edge[0] # <<<<<<<<<<<<<< + * sig0[i] += 1 + * i = i1 - self.left_edge[1] + */ + __pyx_v_i = (__pyx_v_i0 - (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->left_edge[0])); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":737 + * if i2 >= self.right_edge[2]: break + * i = i0 - self.left_edge[0] + * sig0[i] += 1 # <<<<<<<<<<<<<< + * i = i1 - self.left_edge[1] + * sig1[i] += 1 + */ + __pyx_t_66 = __pyx_v_i; + __pyx_t_67 = -1; + if (__pyx_t_66 < 0) { + __pyx_t_66 += __pyx_bshape_0_sig0; + if (unlikely(__pyx_t_66 < 0)) __pyx_t_67 = 0; + } else if (unlikely(__pyx_t_66 >= __pyx_bshape_0_sig0)) __pyx_t_67 = 0; + if (unlikely(__pyx_t_67 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_67); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_sig0.buf, __pyx_t_66, __pyx_bstride_0_sig0) += 1; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":738 + * i = i0 - self.left_edge[0] + * sig0[i] += 1 + * i = i1 - self.left_edge[1] # <<<<<<<<<<<<<< + * sig1[i] += 1 + * i = i2 - self.left_edge[2] + */ + __pyx_v_i = (__pyx_v_i1 - (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->left_edge[1])); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":739 + * sig0[i] += 1 + * i = i1 - self.left_edge[1] + * sig1[i] += 1 # <<<<<<<<<<<<<< + * i = i2 - self.left_edge[2] + * sig2[i] += 1 + */ + __pyx_t_67 = __pyx_v_i; + __pyx_t_68 = -1; + if (__pyx_t_67 < 0) { + __pyx_t_67 += __pyx_bshape_0_sig1; + if (unlikely(__pyx_t_67 < 0)) __pyx_t_68 = 0; + } else if (unlikely(__pyx_t_67 >= __pyx_bshape_0_sig1)) __pyx_t_68 = 0; + if (unlikely(__pyx_t_68 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_68); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_sig1.buf, __pyx_t_67, __pyx_bstride_0_sig1) += 1; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":740 + * i = i1 - self.left_edge[1] + * sig1[i] += 1 + * i = i2 - self.left_edge[2] # <<<<<<<<<<<<<< + * sig2[i] += 1 + * efficiency += 1 + */ + __pyx_v_i = (__pyx_v_i2 - (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->left_edge[2])); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":741 + * sig1[i] += 1 + * i = i2 - self.left_edge[2] + * sig2[i] += 1 # <<<<<<<<<<<<<< + * efficiency += 1 + * used = 1 + */ + __pyx_t_68 = __pyx_v_i; + __pyx_t_69 = -1; + if (__pyx_t_68 < 0) { + __pyx_t_68 += __pyx_bshape_0_sig2; + if (unlikely(__pyx_t_68 < 0)) __pyx_t_69 = 0; + } else if (unlikely(__pyx_t_68 >= __pyx_bshape_0_sig2)) __pyx_t_69 = 0; + if (unlikely(__pyx_t_69 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_69); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_sig2.buf, __pyx_t_68, __pyx_bstride_0_sig2) += 1; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":742 + * i = i2 - self.left_edge[2] + * sig2[i] += 1 + * efficiency += 1 # <<<<<<<<<<<<<< + * used = 1 + * if used == 1: + */ + __pyx_v_efficiency += 1.0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":743 + * sig2[i] += 1 + * efficiency += 1 + * used = 1 # <<<<<<<<<<<<<< + * if used == 1: + * grid_file_locations[gi,3] = left_edges[gi, 0] + */ + __pyx_v_used = 1; + __pyx_L26_continue:; + } + __pyx_L27_break:; + __pyx_L22_continue:; + } + __pyx_L23_break:; + __pyx_L18_continue:; + } + __pyx_L19_break:; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":744 + * efficiency += 1 + * used = 1 + * if used == 1: # <<<<<<<<<<<<<< + * grid_file_locations[gi,3] = left_edges[gi, 0] + * grid_file_locations[gi,4] = left_edges[gi, 1] + */ + __pyx_t_16 = (__pyx_v_used == 1); + if (__pyx_t_16) { + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":745 + * used = 1 + * if used == 1: + * grid_file_locations[gi,3] = left_edges[gi, 0] # <<<<<<<<<<<<<< + * grid_file_locations[gi,4] = left_edges[gi, 1] + * grid_file_locations[gi,5] = left_edges[gi, 2] + */ + __pyx_t_50 = __pyx_v_gi; + __pyx_t_70 = 0; + __pyx_t_56 = -1; + if (__pyx_t_50 < 0) { + __pyx_t_50 += __pyx_bshape_0_left_edges; + if (unlikely(__pyx_t_50 < 0)) __pyx_t_56 = 0; + } else if (unlikely(__pyx_t_50 >= __pyx_bshape_0_left_edges)) __pyx_t_56 = 0; + if (__pyx_t_70 < 0) { + __pyx_t_70 += __pyx_bshape_1_left_edges; + if (unlikely(__pyx_t_70 < 0)) __pyx_t_56 = 1; + } else if (unlikely(__pyx_t_70 >= __pyx_bshape_1_left_edges)) __pyx_t_56 = 1; + if (unlikely(__pyx_t_56 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_56); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_56 = __pyx_v_gi; + __pyx_t_71 = 3; + __pyx_t_62 = -1; + if (__pyx_t_56 < 0) { + __pyx_t_56 += __pyx_bshape_0_grid_file_locations; + if (unlikely(__pyx_t_56 < 0)) __pyx_t_62 = 0; + } else if (unlikely(__pyx_t_56 >= __pyx_bshape_0_grid_file_locations)) __pyx_t_62 = 0; + if (__pyx_t_71 < 0) { + __pyx_t_71 += __pyx_bshape_1_grid_file_locations; + if (unlikely(__pyx_t_71 < 0)) __pyx_t_62 = 1; + } else if (unlikely(__pyx_t_71 >= __pyx_bshape_1_grid_file_locations)) __pyx_t_62 = 1; + if (unlikely(__pyx_t_62 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_62); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_grid_file_locations.buf, __pyx_t_56, __pyx_bstride_0_grid_file_locations, __pyx_t_71, __pyx_bstride_1_grid_file_locations) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_edges.buf, __pyx_t_50, __pyx_bstride_0_left_edges, __pyx_t_70, __pyx_bstride_1_left_edges)); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":746 + * if used == 1: + * grid_file_locations[gi,3] = left_edges[gi, 0] + * grid_file_locations[gi,4] = left_edges[gi, 1] # <<<<<<<<<<<<<< + * grid_file_locations[gi,5] = left_edges[gi, 2] + * self.grid_file_locations.append(grid_file_locations[gi,:]) + */ + __pyx_t_62 = __pyx_v_gi; + __pyx_t_72 = 1; + __pyx_t_69 = -1; + if (__pyx_t_62 < 0) { + __pyx_t_62 += __pyx_bshape_0_left_edges; + if (unlikely(__pyx_t_62 < 0)) __pyx_t_69 = 0; + } else if (unlikely(__pyx_t_62 >= __pyx_bshape_0_left_edges)) __pyx_t_69 = 0; + if (__pyx_t_72 < 0) { + __pyx_t_72 += __pyx_bshape_1_left_edges; + if (unlikely(__pyx_t_72 < 0)) __pyx_t_69 = 1; + } else if (unlikely(__pyx_t_72 >= __pyx_bshape_1_left_edges)) __pyx_t_69 = 1; + if (unlikely(__pyx_t_69 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_69); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_69 = __pyx_v_gi; + __pyx_t_73 = 4; + __pyx_t_74 = -1; + if (__pyx_t_69 < 0) { + __pyx_t_69 += __pyx_bshape_0_grid_file_locations; + if (unlikely(__pyx_t_69 < 0)) __pyx_t_74 = 0; + } else if (unlikely(__pyx_t_69 >= __pyx_bshape_0_grid_file_locations)) __pyx_t_74 = 0; + if (__pyx_t_73 < 0) { + __pyx_t_73 += __pyx_bshape_1_grid_file_locations; + if (unlikely(__pyx_t_73 < 0)) __pyx_t_74 = 1; + } else if (unlikely(__pyx_t_73 >= __pyx_bshape_1_grid_file_locations)) __pyx_t_74 = 1; + if (unlikely(__pyx_t_74 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_74); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_grid_file_locations.buf, __pyx_t_69, __pyx_bstride_0_grid_file_locations, __pyx_t_73, __pyx_bstride_1_grid_file_locations) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_edges.buf, __pyx_t_62, __pyx_bstride_0_left_edges, __pyx_t_72, __pyx_bstride_1_left_edges)); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":747 + * grid_file_locations[gi,3] = left_edges[gi, 0] + * grid_file_locations[gi,4] = left_edges[gi, 1] + * grid_file_locations[gi,5] = left_edges[gi, 2] # <<<<<<<<<<<<<< + * self.grid_file_locations.append(grid_file_locations[gi,:]) + * + */ + __pyx_t_74 = __pyx_v_gi; + __pyx_t_75 = 2; + __pyx_t_76 = -1; + if (__pyx_t_74 < 0) { + __pyx_t_74 += __pyx_bshape_0_left_edges; + if (unlikely(__pyx_t_74 < 0)) __pyx_t_76 = 0; + } else if (unlikely(__pyx_t_74 >= __pyx_bshape_0_left_edges)) __pyx_t_76 = 0; + if (__pyx_t_75 < 0) { + __pyx_t_75 += __pyx_bshape_1_left_edges; + if (unlikely(__pyx_t_75 < 0)) __pyx_t_76 = 1; + } else if (unlikely(__pyx_t_75 >= __pyx_bshape_1_left_edges)) __pyx_t_76 = 1; + if (unlikely(__pyx_t_76 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_76); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_76 = __pyx_v_gi; + __pyx_t_77 = 5; + __pyx_t_78 = -1; + if (__pyx_t_76 < 0) { + __pyx_t_76 += __pyx_bshape_0_grid_file_locations; + if (unlikely(__pyx_t_76 < 0)) __pyx_t_78 = 0; + } else if (unlikely(__pyx_t_76 >= __pyx_bshape_0_grid_file_locations)) __pyx_t_78 = 0; + if (__pyx_t_77 < 0) { + __pyx_t_77 += __pyx_bshape_1_grid_file_locations; + if (unlikely(__pyx_t_77 < 0)) __pyx_t_78 = 1; + } else if (unlikely(__pyx_t_77 >= __pyx_bshape_1_grid_file_locations)) __pyx_t_78 = 1; + if (unlikely(__pyx_t_78 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_78); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_grid_file_locations.buf, __pyx_t_76, __pyx_bstride_0_grid_file_locations, __pyx_t_77, __pyx_bstride_1_grid_file_locations) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_edges.buf, __pyx_t_74, __pyx_bstride_0_left_edges, __pyx_t_75, __pyx_bstride_1_left_edges)); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":748 + * grid_file_locations[gi,4] = left_edges[gi, 1] + * grid_file_locations[gi,5] = left_edges[gi, 2] + * self.grid_file_locations.append(grid_file_locations[gi,:]) # <<<<<<<<<<<<<< + * + * self.dd = np.ones(3, dtype='int64') + */ + __pyx_t_43 = PyInt_FromLong(__pyx_v_gi); if (unlikely(!__pyx_t_43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_43); + __pyx_t_1 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_42 = PyTuple_New(2); if (unlikely(!__pyx_t_42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_42); + PyTuple_SET_ITEM(__pyx_t_42, 0, __pyx_t_43); + __Pyx_GIVEREF(__pyx_t_43); + PyTuple_SET_ITEM(__pyx_t_42, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_43 = 0; + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_grid_file_locations), __pyx_t_42); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; + __pyx_t_42 = __Pyx_PyObject_Append(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->grid_file_locations, __pyx_t_1); if (unlikely(!__pyx_t_42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_42); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; + goto __pyx_L30; + } + __pyx_L30:; + } + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":750 + * self.grid_file_locations.append(grid_file_locations[gi,:]) + * + * self.dd = np.ones(3, dtype='int64') # <<<<<<<<<<<<<< + * for i in range(3): + * efficiency /= self.dimensions[i] + */ + __pyx_t_42 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_42); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_42, __pyx_n_s__ones); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; + __pyx_t_42 = PyTuple_New(1); if (unlikely(!__pyx_t_42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_42); + __Pyx_INCREF(__pyx_int_3); + PyTuple_SET_ITEM(__pyx_t_42, 0, __pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + __pyx_t_43 = PyDict_New(); if (unlikely(!__pyx_t_43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_43)); + if (PyDict_SetItem(__pyx_t_43, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__int64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_79 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_42, ((PyObject *)__pyx_t_43)); if (unlikely(!__pyx_t_79)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_79); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_43)); __pyx_t_43 = 0; + __Pyx_GIVEREF(__pyx_t_79); + __Pyx_GOTREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dd); + __Pyx_DECREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dd); + ((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dd = __pyx_t_79; + __pyx_t_79 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":751 + * + * self.dd = np.ones(3, dtype='int64') + * for i in range(3): # <<<<<<<<<<<<<< + * efficiency /= self.dimensions[i] + * self.dd[i] = self.dimensions[i] + */ + for (__pyx_t_2 = 0; __pyx_t_2 < 3; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":752 + * self.dd = np.ones(3, dtype='int64') + * for i in range(3): + * efficiency /= self.dimensions[i] # <<<<<<<<<<<<<< + * self.dd[i] = self.dimensions[i] + * #print "Efficiency is %0.3e" % (efficiency) + */ + __pyx_v_efficiency /= (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dimensions[__pyx_v_i]); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":753 + * for i in range(3): + * efficiency /= self.dimensions[i] + * self.dd[i] = self.dimensions[i] # <<<<<<<<<<<<<< + * #print "Efficiency is %0.3e" % (efficiency) + * self.efficiency = efficiency + */ + __pyx_t_79 = __Pyx_PyInt_to_py_npy_int64((((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dimensions[__pyx_v_i])); if (unlikely(!__pyx_t_79)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_79); + if (__Pyx_SetItemInt(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dd, __pyx_v_i, __pyx_t_79, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_79); __pyx_t_79 = 0; + } + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":755 + * self.dd[i] = self.dimensions[i] + * #print "Efficiency is %0.3e" % (efficiency) + * self.efficiency = efficiency # <<<<<<<<<<<<<< + * + * def find_split(self): + */ + ((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->efficiency = __pyx_v_efficiency; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_42); + __Pyx_XDECREF(__pyx_t_43); + __Pyx_XDECREF(__pyx_t_79); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_right_edges); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_index); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dimensions); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_file_locations); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_dimensions); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sig1); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sig2); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sig0); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edges); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.ramses_reader.ProtoSubgrid.__cinit__"); + __pyx_r = -1; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_right_edges); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_index); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dimensions); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_file_locations); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_dimensions); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sig1); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sig2); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sig0); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edges); + __pyx_L2:; + __Pyx_DECREF((PyObject *)__pyx_v_sig0); + __Pyx_DECREF((PyObject *)__pyx_v_sig1); + __Pyx_DECREF((PyObject *)__pyx_v_sig2); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":757 + * self.efficiency = efficiency + * + * def find_split(self): # <<<<<<<<<<<<<< + * # First look for zeros + * cdef int i, center, ax + */ + +static PyObject *__pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_find_split(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_find_split(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + int __pyx_v_i; + int __pyx_v_center; + int __pyx_v_ax; + PyArrayObject *__pyx_v_axes; + __pyx_t_5numpy_int64_t __pyx_v_strength; + __pyx_t_5numpy_int64_t __pyx_v_zcstrength; + __pyx_t_5numpy_int64_t __pyx_v_zcp; + PyArrayObject *__pyx_v_sig; + long __pyx_v_axi; + long __pyx_v_zca; + __pyx_t_5numpy_int64_t *__pyx_v_sig2d; + Py_buffer __pyx_bstruct_axes; + Py_ssize_t __pyx_bstride_0_axes = 0; + Py_ssize_t __pyx_bshape_0_axes = 0; + Py_buffer __pyx_bstruct_sig; + Py_ssize_t __pyx_bstride_0_sig = 0; + Py_ssize_t __pyx_bshape_0_sig = 0; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyArrayObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + long __pyx_t_9; + long __pyx_t_10; + PyArrayObject *__pyx_t_11 = NULL; + __pyx_t_5numpy_int64_t __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + int __pyx_t_18; + long __pyx_t_19; + long __pyx_t_20; + int __pyx_t_21; + long __pyx_t_22; + __Pyx_RefNannySetupContext("find_split"); + __pyx_v_axes = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_sig = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_bstruct_axes.buf = NULL; + __pyx_bstruct_sig.buf = NULL; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":762 + * cdef np.ndarray[ndim=1, dtype=np.int64_t] axes + * cdef np.int64_t strength, zcstrength, zcp + * axes = np.argsort(self.dd)[::-1] # <<<<<<<<<<<<<< + * cdef np.ndarray[np.int64_t] sig + * for axi in range(3): + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__argsort); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dd); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dd); + __Pyx_GIVEREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dd); + __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetItem(__pyx_t_3, __pyx_t_1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = ((PyArrayObject *)__pyx_t_2); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_axes); + __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_axes, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_5 < 0)) { + PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_axes, (PyObject*)__pyx_v_axes, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8); + } + } + __pyx_bstride_0_axes = __pyx_bstruct_axes.strides[0]; + __pyx_bshape_0_axes = __pyx_bstruct_axes.shape[0]; + if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_axes)); + __pyx_v_axes = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":764 + * axes = np.argsort(self.dd)[::-1] + * cdef np.ndarray[np.int64_t] sig + * for axi in range(3): # <<<<<<<<<<<<<< + * ax = axes[axi] + * center = self.dimensions[ax] / 2 + */ + for (__pyx_t_9 = 0; __pyx_t_9 < 3; __pyx_t_9+=1) { + __pyx_v_axi = __pyx_t_9; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":765 + * cdef np.ndarray[np.int64_t] sig + * for axi in range(3): + * ax = axes[axi] # <<<<<<<<<<<<<< + * center = self.dimensions[ax] / 2 + * sig = self.sigs[ax] + */ + __pyx_t_10 = __pyx_v_axi; + __pyx_t_5 = -1; + if (__pyx_t_10 < 0) { + __pyx_t_10 += __pyx_bshape_0_axes; + if (unlikely(__pyx_t_10 < 0)) __pyx_t_5 = 0; + } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_axes)) __pyx_t_5 = 0; + if (unlikely(__pyx_t_5 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_5); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_ax = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_axes.buf, __pyx_t_10, __pyx_bstride_0_axes)); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":766 + * for axi in range(3): + * ax = axes[axi] + * center = self.dimensions[ax] / 2 # <<<<<<<<<<<<<< + * sig = self.sigs[ax] + * for i in range(self.dimensions[ax]): + */ + __pyx_v_center = __Pyx_div___pyx_t_5numpy_int64_t((((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dimensions[__pyx_v_ax]), 2); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":767 + * ax = axes[axi] + * center = self.dimensions[ax] / 2 + * sig = self.sigs[ax] # <<<<<<<<<<<<<< + * for i in range(self.dimensions[ax]): + * if sig[i] == 0 and i > 0 and i < self.dimensions[ax] - 1: + */ + __pyx_t_2 = __Pyx_GetItemInt(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->sigs, __pyx_v_ax, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = ((PyArrayObject *)__pyx_t_2); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sig); + __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_sig, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_5 < 0)) { + PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_sig, (PyObject*)__pyx_v_sig, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6); + } + } + __pyx_bstride_0_sig = __pyx_bstruct_sig.strides[0]; + __pyx_bshape_0_sig = __pyx_bstruct_sig.shape[0]; + if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_11 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_sig)); + __pyx_v_sig = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":768 + * center = self.dimensions[ax] / 2 + * sig = self.sigs[ax] + * for i in range(self.dimensions[ax]): # <<<<<<<<<<<<<< + * if sig[i] == 0 and i > 0 and i < self.dimensions[ax] - 1: + * #print "zero: %s (%s)" % (i, self.dimensions[ax]) + */ + __pyx_t_12 = (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dimensions[__pyx_v_ax]); + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_12; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":769 + * sig = self.sigs[ax] + * for i in range(self.dimensions[ax]): + * if sig[i] == 0 and i > 0 and i < self.dimensions[ax] - 1: # <<<<<<<<<<<<<< + * #print "zero: %s (%s)" % (i, self.dimensions[ax]) + * return 'zs', ax, i + */ + __pyx_t_13 = __pyx_v_i; + __pyx_t_14 = -1; + if (__pyx_t_13 < 0) { + __pyx_t_13 += __pyx_bshape_0_sig; + if (unlikely(__pyx_t_13 < 0)) __pyx_t_14 = 0; + } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_sig)) __pyx_t_14 = 0; + if (unlikely(__pyx_t_14 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_14); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_15 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_sig.buf, __pyx_t_13, __pyx_bstride_0_sig)) == 0); + if (__pyx_t_15) { + __pyx_t_16 = (__pyx_v_i > 0); + if (__pyx_t_16) { + __pyx_t_17 = (__pyx_v_i < ((((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dimensions[__pyx_v_ax]) - 1)); + __pyx_t_18 = __pyx_t_17; + } else { + __pyx_t_18 = __pyx_t_16; + } + __pyx_t_16 = __pyx_t_18; + } else { + __pyx_t_16 = __pyx_t_15; + } + if (__pyx_t_16) { + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":771 + * if sig[i] == 0 and i > 0 and i < self.dimensions[ax] - 1: + * #print "zero: %s (%s)" % (i, self.dimensions[ax]) + * return 'zs', ax, i # <<<<<<<<<<<<<< + * zcstrength = 0 + * zcp = 0 + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyInt_FromLong(__pyx_v_ax); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_n_s__zs)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_s__zs)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__zs)); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_2 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + goto __pyx_L9; + } + __pyx_L9:; + } + } + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":772 + * #print "zero: %s (%s)" % (i, self.dimensions[ax]) + * return 'zs', ax, i + * zcstrength = 0 # <<<<<<<<<<<<<< + * zcp = 0 + * zca = -1 + */ + __pyx_v_zcstrength = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":773 + * return 'zs', ax, i + * zcstrength = 0 + * zcp = 0 # <<<<<<<<<<<<<< + * zca = -1 + * cdef int temp + */ + __pyx_v_zcp = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":774 + * zcstrength = 0 + * zcp = 0 + * zca = -1 # <<<<<<<<<<<<<< + * cdef int temp + * cdef np.int64_t *sig2d + */ + __pyx_v_zca = -1; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":777 + * cdef int temp + * cdef np.int64_t *sig2d + * for axi in range(3): # <<<<<<<<<<<<<< + * ax = axes[axi] + * sig = self.sigs[ax] + */ + for (__pyx_t_9 = 0; __pyx_t_9 < 3; __pyx_t_9+=1) { + __pyx_v_axi = __pyx_t_9; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":778 + * cdef np.int64_t *sig2d + * for axi in range(3): + * ax = axes[axi] # <<<<<<<<<<<<<< + * sig = self.sigs[ax] + * sig2d = malloc(sizeof(np.int64_t) * self.dimensions[ax]) + */ + __pyx_t_19 = __pyx_v_axi; + __pyx_t_5 = -1; + if (__pyx_t_19 < 0) { + __pyx_t_19 += __pyx_bshape_0_axes; + if (unlikely(__pyx_t_19 < 0)) __pyx_t_5 = 0; + } else if (unlikely(__pyx_t_19 >= __pyx_bshape_0_axes)) __pyx_t_5 = 0; + if (unlikely(__pyx_t_5 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_5); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_ax = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_axes.buf, __pyx_t_19, __pyx_bstride_0_axes)); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":779 + * for axi in range(3): + * ax = axes[axi] + * sig = self.sigs[ax] # <<<<<<<<<<<<<< + * sig2d = malloc(sizeof(np.int64_t) * self.dimensions[ax]) + * sig2d[0] = sig2d[self.dimensions[ax]-1] = 0 + */ + __pyx_t_3 = __Pyx_GetItemInt(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->sigs, __pyx_v_ax, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = ((PyArrayObject *)__pyx_t_3); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sig); + __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_sig, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_5 < 0)) { + PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_sig, (PyObject*)__pyx_v_sig, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8); + } + } + __pyx_bstride_0_sig = __pyx_bstruct_sig.strides[0]; + __pyx_bshape_0_sig = __pyx_bstruct_sig.shape[0]; + if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_11 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_sig)); + __pyx_v_sig = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":780 + * ax = axes[axi] + * sig = self.sigs[ax] + * sig2d = malloc(sizeof(np.int64_t) * self.dimensions[ax]) # <<<<<<<<<<<<<< + * sig2d[0] = sig2d[self.dimensions[ax]-1] = 0 + * for i in range(1, self.dimensions[ax] - 1): + */ + __pyx_v_sig2d = ((__pyx_t_5numpy_int64_t *)malloc(((sizeof(__pyx_t_5numpy_int64_t)) * (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dimensions[__pyx_v_ax])))); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":781 + * sig = self.sigs[ax] + * sig2d = malloc(sizeof(np.int64_t) * self.dimensions[ax]) + * sig2d[0] = sig2d[self.dimensions[ax]-1] = 0 # <<<<<<<<<<<<<< + * for i in range(1, self.dimensions[ax] - 1): + * sig2d[i] = sig[i-1] - 2*sig[i] + sig[i+1] + */ + (__pyx_v_sig2d[0]) = 0; + (__pyx_v_sig2d[((((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dimensions[__pyx_v_ax]) - 1)]) = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":782 + * sig2d = malloc(sizeof(np.int64_t) * self.dimensions[ax]) + * sig2d[0] = sig2d[self.dimensions[ax]-1] = 0 + * for i in range(1, self.dimensions[ax] - 1): # <<<<<<<<<<<<<< + * sig2d[i] = sig[i-1] - 2*sig[i] + sig[i+1] + * for i in range(1, self.dimensions[ax] - 1): + */ + __pyx_t_12 = ((((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dimensions[__pyx_v_ax]) - 1); + for (__pyx_t_5 = 1; __pyx_t_5 < __pyx_t_12; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":783 + * sig2d[0] = sig2d[self.dimensions[ax]-1] = 0 + * for i in range(1, self.dimensions[ax] - 1): + * sig2d[i] = sig[i-1] - 2*sig[i] + sig[i+1] # <<<<<<<<<<<<<< + * for i in range(1, self.dimensions[ax] - 1): + * if sig2d[i] * sig2d[i+1] <= 0: + */ + __pyx_t_20 = (__pyx_v_i - 1); + __pyx_t_14 = -1; + if (__pyx_t_20 < 0) { + __pyx_t_20 += __pyx_bshape_0_sig; + if (unlikely(__pyx_t_20 < 0)) __pyx_t_14 = 0; + } else if (unlikely(__pyx_t_20 >= __pyx_bshape_0_sig)) __pyx_t_14 = 0; + if (unlikely(__pyx_t_14 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_14); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_14 = __pyx_v_i; + __pyx_t_21 = -1; + if (__pyx_t_14 < 0) { + __pyx_t_14 += __pyx_bshape_0_sig; + if (unlikely(__pyx_t_14 < 0)) __pyx_t_21 = 0; + } else if (unlikely(__pyx_t_14 >= __pyx_bshape_0_sig)) __pyx_t_21 = 0; + if (unlikely(__pyx_t_21 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_21); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_22 = (__pyx_v_i + 1); + __pyx_t_21 = -1; + if (__pyx_t_22 < 0) { + __pyx_t_22 += __pyx_bshape_0_sig; + if (unlikely(__pyx_t_22 < 0)) __pyx_t_21 = 0; + } else if (unlikely(__pyx_t_22 >= __pyx_bshape_0_sig)) __pyx_t_21 = 0; + if (unlikely(__pyx_t_21 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_21); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + (__pyx_v_sig2d[__pyx_v_i]) = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_sig.buf, __pyx_t_20, __pyx_bstride_0_sig)) - (2 * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_sig.buf, __pyx_t_14, __pyx_bstride_0_sig)))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_sig.buf, __pyx_t_22, __pyx_bstride_0_sig))); + } + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":784 + * for i in range(1, self.dimensions[ax] - 1): + * sig2d[i] = sig[i-1] - 2*sig[i] + sig[i+1] + * for i in range(1, self.dimensions[ax] - 1): # <<<<<<<<<<<<<< + * if sig2d[i] * sig2d[i+1] <= 0: + * strength = labs(sig2d[i] - sig2d[i+1]) + */ + __pyx_t_12 = ((((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dimensions[__pyx_v_ax]) - 1); + for (__pyx_t_5 = 1; __pyx_t_5 < __pyx_t_12; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":785 + * sig2d[i] = sig[i-1] - 2*sig[i] + sig[i+1] + * for i in range(1, self.dimensions[ax] - 1): + * if sig2d[i] * sig2d[i+1] <= 0: # <<<<<<<<<<<<<< + * strength = labs(sig2d[i] - sig2d[i+1]) + * if (strength > zcstrength) or \ + */ + __pyx_t_16 = (((__pyx_v_sig2d[__pyx_v_i]) * (__pyx_v_sig2d[(__pyx_v_i + 1)])) <= 0); + if (__pyx_t_16) { + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":786 + * for i in range(1, self.dimensions[ax] - 1): + * if sig2d[i] * sig2d[i+1] <= 0: + * strength = labs(sig2d[i] - sig2d[i+1]) # <<<<<<<<<<<<<< + * if (strength > zcstrength) or \ + * (strength == zcstrength and (abs(center - i) < + */ + __pyx_v_strength = labs(((__pyx_v_sig2d[__pyx_v_i]) - (__pyx_v_sig2d[(__pyx_v_i + 1)]))); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":787 + * if sig2d[i] * sig2d[i+1] <= 0: + * strength = labs(sig2d[i] - sig2d[i+1]) + * if (strength > zcstrength) or \ # <<<<<<<<<<<<<< + * (strength == zcstrength and (abs(center - i) < + * abs(center - zcp))): + */ + __pyx_t_16 = (__pyx_v_strength > __pyx_v_zcstrength); + if (!__pyx_t_16) { + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":788 + * strength = labs(sig2d[i] - sig2d[i+1]) + * if (strength > zcstrength) or \ + * (strength == zcstrength and (abs(center - i) < # <<<<<<<<<<<<<< + * abs(center - zcp))): + * zcstrength = strength + */ + __pyx_t_15 = (__pyx_v_strength == __pyx_v_zcstrength); + if (__pyx_t_15) { + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":789 + * if (strength > zcstrength) or \ + * (strength == zcstrength and (abs(center - i) < + * abs(center - zcp))): # <<<<<<<<<<<<<< + * zcstrength = strength + * zcp = i + */ + __pyx_t_18 = (abs((__pyx_v_center - __pyx_v_i)) < abs((__pyx_v_center - __pyx_v_zcp))); + __pyx_t_17 = __pyx_t_18; + } else { + __pyx_t_17 = __pyx_t_15; + } + __pyx_t_15 = __pyx_t_17; + } else { + __pyx_t_15 = __pyx_t_16; + } + if (__pyx_t_15) { + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":790 + * (strength == zcstrength and (abs(center - i) < + * abs(center - zcp))): + * zcstrength = strength # <<<<<<<<<<<<<< + * zcp = i + * zca = ax + */ + __pyx_v_zcstrength = __pyx_v_strength; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":791 + * abs(center - zcp))): + * zcstrength = strength + * zcp = i # <<<<<<<<<<<<<< + * zca = ax + * free(sig2d) + */ + __pyx_v_zcp = __pyx_v_i; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":792 + * zcstrength = strength + * zcp = i + * zca = ax # <<<<<<<<<<<<<< + * free(sig2d) + * #print "zcp: %s (%s)" % (zcp, self.dimensions[ax]) + */ + __pyx_v_zca = __pyx_v_ax; + goto __pyx_L17; + } + __pyx_L17:; + goto __pyx_L16; + } + __pyx_L16:; + } + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":793 + * zcp = i + * zca = ax + * free(sig2d) # <<<<<<<<<<<<<< + * #print "zcp: %s (%s)" % (zcp, self.dimensions[ax]) + * return 'zc', ax, zcp + */ + free(__pyx_v_sig2d); + } + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":795 + * free(sig2d) + * #print "zcp: %s (%s)" % (zcp, self.dimensions[ax]) + * return 'zc', ax, zcp # <<<<<<<<<<<<<< + * + * def get_properties(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyInt_FromLong(__pyx_v_ax); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyInt_to_py_npy_int64(__pyx_v_zcp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__zc)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__zc)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__zc)); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_3 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_axes); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sig); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.ramses_reader.ProtoSubgrid.find_split"); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_axes); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sig); + __pyx_L2:; + __Pyx_DECREF((PyObject *)__pyx_v_axes); + __Pyx_DECREF((PyObject *)__pyx_v_sig); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":797 + * return 'zc', ax, zcp + * + * def get_properties(self): # <<<<<<<<<<<<<< + * cdef np.ndarray[np.int64_t, ndim=2] tr = np.empty((3,3), dtype='int64') + * cdef int i + */ + +static PyObject *__pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_get_properties(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_get_properties(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyArrayObject *__pyx_v_tr = 0; + int __pyx_v_i; + Py_buffer __pyx_bstruct_tr; + Py_ssize_t __pyx_bstride_0_tr = 0; + Py_ssize_t __pyx_bstride_1_tr = 0; + Py_ssize_t __pyx_bshape_0_tr = 0; + Py_ssize_t __pyx_bshape_1_tr = 0; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyArrayObject *__pyx_t_5 = NULL; + int __pyx_t_6; + long __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + long __pyx_t_10; + int __pyx_t_11; + long __pyx_t_12; + int __pyx_t_13; + __Pyx_RefNannySetupContext("get_properties"); + __pyx_bstruct_tr.buf = NULL; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":798 + * + * def get_properties(self): + * cdef np.ndarray[np.int64_t, ndim=2] tr = np.empty((3,3), dtype='int64') # <<<<<<<<<<<<<< + * cdef int i + * for i in range(3): + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_int_3); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + __Pyx_INCREF(__pyx_int_3); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__int64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_tr, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { + __pyx_v_tr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_tr.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_bstride_0_tr = __pyx_bstruct_tr.strides[0]; __pyx_bstride_1_tr = __pyx_bstruct_tr.strides[1]; + __pyx_bshape_0_tr = __pyx_bstruct_tr.shape[0]; __pyx_bshape_1_tr = __pyx_bstruct_tr.shape[1]; + } + } + __pyx_t_5 = 0; + __pyx_v_tr = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":800 + * cdef np.ndarray[np.int64_t, ndim=2] tr = np.empty((3,3), dtype='int64') + * cdef int i + * for i in range(3): # <<<<<<<<<<<<<< + * tr[0,i] = self.left_edge[i] + * tr[1,i] = self.right_edge[i] + */ + for (__pyx_t_6 = 0; __pyx_t_6 < 3; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":801 + * cdef int i + * for i in range(3): + * tr[0,i] = self.left_edge[i] # <<<<<<<<<<<<<< + * tr[1,i] = self.right_edge[i] + * tr[2,i] = self.dimensions[i] + */ + __pyx_t_7 = 0; + __pyx_t_8 = __pyx_v_i; + __pyx_t_9 = -1; + if (__pyx_t_7 < 0) { + __pyx_t_7 += __pyx_bshape_0_tr; + if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_7 >= __pyx_bshape_0_tr)) __pyx_t_9 = 0; + if (__pyx_t_8 < 0) { + __pyx_t_8 += __pyx_bshape_1_tr; + if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1; + } else if (unlikely(__pyx_t_8 >= __pyx_bshape_1_tr)) __pyx_t_9 = 1; + if (unlikely(__pyx_t_9 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_9); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_tr.buf, __pyx_t_7, __pyx_bstride_0_tr, __pyx_t_8, __pyx_bstride_1_tr) = (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->left_edge[__pyx_v_i]); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":802 + * for i in range(3): + * tr[0,i] = self.left_edge[i] + * tr[1,i] = self.right_edge[i] # <<<<<<<<<<<<<< + * tr[2,i] = self.dimensions[i] + * return tr + */ + __pyx_t_10 = 1; + __pyx_t_9 = __pyx_v_i; + __pyx_t_11 = -1; + if (__pyx_t_10 < 0) { + __pyx_t_10 += __pyx_bshape_0_tr; + if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0; + } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_tr)) __pyx_t_11 = 0; + if (__pyx_t_9 < 0) { + __pyx_t_9 += __pyx_bshape_1_tr; + if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1; + } else if (unlikely(__pyx_t_9 >= __pyx_bshape_1_tr)) __pyx_t_11 = 1; + if (unlikely(__pyx_t_11 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_11); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_tr.buf, __pyx_t_10, __pyx_bstride_0_tr, __pyx_t_9, __pyx_bstride_1_tr) = (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->right_edge[__pyx_v_i]); + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":803 + * tr[0,i] = self.left_edge[i] + * tr[1,i] = self.right_edge[i] + * tr[2,i] = self.dimensions[i] # <<<<<<<<<<<<<< + * return tr + */ + __pyx_t_12 = 2; + __pyx_t_11 = __pyx_v_i; + __pyx_t_13 = -1; + if (__pyx_t_12 < 0) { + __pyx_t_12 += __pyx_bshape_0_tr; + if (unlikely(__pyx_t_12 < 0)) __pyx_t_13 = 0; + } else if (unlikely(__pyx_t_12 >= __pyx_bshape_0_tr)) __pyx_t_13 = 0; + if (__pyx_t_11 < 0) { + __pyx_t_11 += __pyx_bshape_1_tr; + if (unlikely(__pyx_t_11 < 0)) __pyx_t_13 = 1; + } else if (unlikely(__pyx_t_11 >= __pyx_bshape_1_tr)) __pyx_t_13 = 1; + if (unlikely(__pyx_t_13 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_13); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_tr.buf, __pyx_t_12, __pyx_bstride_0_tr, __pyx_t_11, __pyx_bstride_1_tr) = (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dimensions[__pyx_v_i]); + } + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":804 + * tr[1,i] = self.right_edge[i] + * tr[2,i] = self.dimensions[i] + * return tr # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_tr)); + __pyx_r = ((PyObject *)__pyx_v_tr); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_tr); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.ramses_reader.ProtoSubgrid.get_properties"); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_tr); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_tr); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":188 + * # experimental exception made for __getbuffer__ and __releasebuffer__ + * # -- the details of this may change. + * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< + * # This implementation of getbuffer is geared towards Cython + * # requirements, and does not yet fullfill the PEP. + */ + +static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_v_copy_shape; + int __pyx_v_i; + int __pyx_v_ndim; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + int __pyx_v_t; + char *__pyx_v_f; + PyArray_Descr *__pyx_v_descr = 0; + int __pyx_v_offset; + int __pyx_v_hasfields; + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + char *__pyx_t_9; + __Pyx_RefNannySetupContext("__getbuffer__"); + if (__pyx_v_info == NULL) return 0; + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":194 + * # of flags + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + */ + __pyx_v_endian_detector = 1; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":195 + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * + * ndim = PyArray_NDIM(self) + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":197 + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":199 + * ndim = PyArray_NDIM(self) + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * copy_shape = 1 + * else: + */ + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":200 + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * copy_shape = 1 # <<<<<<<<<<<<<< + * else: + * copy_shape = 0 + */ + __pyx_v_copy_shape = 1; + goto __pyx_L5; + } + /*else*/ { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":202 + * copy_shape = 1 + * else: + * copy_shape = 0 # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + */ + __pyx_v_copy_shape = 0; + } + __pyx_L5:; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":204 + * copy_shape = 0 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") + */ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); + if (__pyx_t_1) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":205 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not C contiguous") + * + */ + __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":206 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":208 + * raise ValueError(u"ndarray is not C contiguous") + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") + */ + __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); + if (__pyx_t_3) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":209 + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not Fortran contiguous") + * + */ + __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = __pyx_t_3; + } + if (__pyx_t_2) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":210 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_4)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_4)); + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":212 + * raise ValueError(u"ndarray is not Fortran contiguous") + * + * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< + * info.ndim = ndim + * if copy_shape: + */ + __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":213 + * + * info.buf = PyArray_DATA(self) + * info.ndim = ndim # <<<<<<<<<<<<<< + * if copy_shape: + * # Allocate new buffer for strides and shape info. This is allocated + */ + __pyx_v_info->ndim = __pyx_v_ndim; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":214 + * info.buf = PyArray_DATA(self) + * info.ndim = ndim + * if copy_shape: # <<<<<<<<<<<<<< + * # Allocate new buffer for strides and shape info. This is allocated + * # as one block, strides first. + */ + if (__pyx_v_copy_shape) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":217 + * # Allocate new buffer for strides and shape info. This is allocated + * # as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< + * info.shape = info.strides + ndim + * for i in range(ndim): + */ + __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2))); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":218 + * # as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + * info.shape = info.strides + ndim # <<<<<<<<<<<<<< + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] + */ + __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":219 + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + * info.shape = info.strides + ndim + * for i in range(ndim): # <<<<<<<<<<<<<< + * info.strides[i] = PyArray_STRIDES(self)[i] + * info.shape[i] = PyArray_DIMS(self)[i] + */ + __pyx_t_6 = __pyx_v_ndim; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":220 + * info.shape = info.strides + ndim + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< + * info.shape[i] = PyArray_DIMS(self)[i] + * else: + */ + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":221 + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] + * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< + * else: + * info.strides = PyArray_STRIDES(self) + */ + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + } + goto __pyx_L8; + } + /*else*/ { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":223 + * info.shape[i] = PyArray_DIMS(self)[i] + * else: + * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL + */ + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":224 + * else: + * info.strides = PyArray_STRIDES(self) + * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) + */ + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); + } + __pyx_L8:; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":225 + * info.strides = PyArray_STRIDES(self) + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * info.itemsize = PyArray_ITEMSIZE(self) + * info.readonly = not PyArray_ISWRITEABLE(self) + */ + __pyx_v_info->suboffsets = NULL; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":226 + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< + * info.readonly = not PyArray_ISWRITEABLE(self) + * + */ + __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":227 + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) + * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< + * + * cdef int t + */ + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":230 + * + * cdef int t + * cdef char* f = NULL # <<<<<<<<<<<<<< + * cdef dtype descr = self.descr + * cdef list stack + */ + __pyx_v_f = NULL; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":231 + * cdef int t + * cdef char* f = NULL + * cdef dtype descr = self.descr # <<<<<<<<<<<<<< + * cdef list stack + * cdef int offset + */ + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); + __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":235 + * cdef int offset + * + * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< + * + * if not hasfields and not copy_shape: + */ + __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":237 + * cdef bint hasfields = PyDataType_HASFIELDS(descr) + * + * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< + * # do not call releasebuffer + * info.obj = None + */ + __pyx_t_2 = (!__pyx_v_hasfields); + if (__pyx_t_2) { + __pyx_t_3 = (!__pyx_v_copy_shape); + __pyx_t_1 = __pyx_t_3; + } else { + __pyx_t_1 = __pyx_t_2; + } + if (__pyx_t_1) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":239 + * if not hasfields and not copy_shape: + * # do not call releasebuffer + * info.obj = None # <<<<<<<<<<<<<< + * else: + * # need to call releasebuffer + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = Py_None; + goto __pyx_L11; + } + /*else*/ { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":242 + * else: + * # need to call releasebuffer + * info.obj = self # <<<<<<<<<<<<<< + * + * if not hasfields: + */ + __Pyx_INCREF(__pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = __pyx_v_self; + } + __pyx_L11:; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":244 + * info.obj = self + * + * if not hasfields: # <<<<<<<<<<<<<< + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or + */ + __pyx_t_1 = (!__pyx_v_hasfields); + if (__pyx_t_1) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":245 + * + * if not hasfields: + * t = descr.type_num # <<<<<<<<<<<<<< + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + */ + __pyx_v_t = __pyx_v_descr->type_num; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":246 + * if not hasfields: + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_little_endian; + } else { + __pyx_t_2 = __pyx_t_1; + } + if (!__pyx_t_2) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":247 + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); + if (__pyx_t_1) { + __pyx_t_3 = (!__pyx_v_little_endian); + __pyx_t_8 = __pyx_t_3; + } else { + __pyx_t_8 = __pyx_t_1; + } + __pyx_t_1 = __pyx_t_8; + } else { + __pyx_t_1 = __pyx_t_2; + } + if (__pyx_t_1) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":248 + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L13; + } + __pyx_L13:; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":249 + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + */ + __pyx_t_1 = (__pyx_v_t == NPY_BYTE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__b; + goto __pyx_L14; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":250 + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" + */ + __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__B; + goto __pyx_L14; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":251 + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" + */ + __pyx_t_1 = (__pyx_v_t == NPY_SHORT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__h; + goto __pyx_L14; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":252 + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" + */ + __pyx_t_1 = (__pyx_v_t == NPY_USHORT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__H; + goto __pyx_L14; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":253 + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" + */ + __pyx_t_1 = (__pyx_v_t == NPY_INT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__i; + goto __pyx_L14; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":254 + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" + */ + __pyx_t_1 = (__pyx_v_t == NPY_UINT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__I; + goto __pyx_L14; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":255 + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" + */ + __pyx_t_1 = (__pyx_v_t == NPY_LONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__l; + goto __pyx_L14; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":256 + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" + */ + __pyx_t_1 = (__pyx_v_t == NPY_ULONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__L; + goto __pyx_L14; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":257 + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" + */ + __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__q; + goto __pyx_L14; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":258 + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" + */ + __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Q; + goto __pyx_L14; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":259 + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" + */ + __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__f; + goto __pyx_L14; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":260 + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" + */ + __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__d; + goto __pyx_L14; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":261 + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" + */ + __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__g; + goto __pyx_L14; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":262 + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + */ + __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zf; + goto __pyx_L14; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":263 + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" + */ + __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zd; + goto __pyx_L14; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":264 + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f = "O" + * else: + */ + __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zg; + goto __pyx_L14; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":265 + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__O; + goto __pyx_L14; + } + /*else*/ { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":267 + * elif t == NPY_OBJECT: f = "O" + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * info.format = f + * return + */ + __pyx_t_5 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_6), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L14:; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":268 + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * info.format = f # <<<<<<<<<<<<<< + * return + * else: + */ + __pyx_v_info->format = __pyx_v_f; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":269 + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * info.format = f + * return # <<<<<<<<<<<<<< + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L12; + } + /*else*/ { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":271 + * return + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< + * info.format[0] = '^' # Native data types, manual alignment + * offset = 0 + */ + __pyx_v_info->format = ((char *)malloc(255)); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":272 + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * offset = 0 + * f = _util_dtypestring(descr, info.format + 1, + */ + (__pyx_v_info->format[0]) = '^'; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":273 + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = '^' # Native data types, manual alignment + * offset = 0 # <<<<<<<<<<<<<< + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + */ + __pyx_v_offset = 0; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":276 + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + * &offset) # <<<<<<<<<<<<<< + * f[0] = 0 # Terminate format string + * + */ + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_9; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":277 + * info.format + _buffer_format_string_len, + * &offset) + * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * + * def __releasebuffer__(ndarray self, Py_buffer* info): + */ + (__pyx_v_f[0]) = 0; + } + __pyx_L12:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("numpy.ndarray.__getbuffer__"); + __pyx_r = -1; + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(Py_None); + __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; + } + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_descr); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":279 + * f[0] = 0 # Terminate format string + * + * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + */ + +static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + int __pyx_t_1; + __Pyx_RefNannySetupContext("__releasebuffer__"); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":280 + * + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); + if (__pyx_t_1) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":281 + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) # <<<<<<<<<<<<<< + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) + */ + free(__pyx_v_info->format); + goto __pyx_L5; + } + __pyx_L5:; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":282 + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * stdlib.free(info.strides) + * # info.shape was stored after info.strides in the same block + */ + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":283 + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) # <<<<<<<<<<<<<< + * # info.shape was stored after info.strides in the same block + * + */ + free(__pyx_v_info->strides); + goto __pyx_L6; + } + __pyx_L6:; + + __Pyx_RefNannyFinishContext(); +} + +/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":756 + * ctypedef npy_cdouble complex_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":757 + * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":759 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":760 + * + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":762 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":763 + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":765 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":766 + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":768 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":769 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":771 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< + * # Recursive utility function used in __getbuffer__ to get format + * # string. The new location in the format string is returned. + */ + +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { + PyArray_Descr *__pyx_v_child; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + PyObject *__pyx_v_fields; + PyObject *__pyx_v_childname; + PyObject *__pyx_v_new_offset; + PyObject *__pyx_v_t; + char *__pyx_r; + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + char *__pyx_t_10; + __Pyx_RefNannySetupContext("_util_dtypestring"); + __pyx_v_child = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_fields = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_childname = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_t = Py_None; __Pyx_INCREF(Py_None); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":778 + * cdef int delta_offset + * cdef tuple i + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * cdef tuple fields + */ + __pyx_v_endian_detector = 1; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":779 + * cdef tuple i + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * cdef tuple fields + * + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":782 + * cdef tuple fields + * + * for childname in descr.names: # <<<<<<<<<<<<<< + * fields = descr.fields[childname] + * child, new_offset = fields + */ + if (likely(((PyObject *)__pyx_v_descr->names) != Py_None)) { + __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_2); + } else { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + for (;;) { + if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; + __Pyx_DECREF(__pyx_v_childname); + __pyx_v_childname = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":783 + * + * for childname in descr.names: + * fields = descr.fields[childname] # <<<<<<<<<<<<<< + * child, new_offset = fields + * + */ + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_fields)); + __pyx_v_fields = ((PyObject *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":784 + * for childname in descr.names: + * fields = descr.fields[childname] + * child, new_offset = fields # <<<<<<<<<<<<<< + * + * if (end - f) - (new_offset - offset[0]) < 15: + */ + if (likely(((PyObject *)__pyx_v_fields) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_fields)) == 2)) { + PyObject* tuple = ((PyObject *)__pyx_v_fields); + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_new_offset); + __pyx_v_new_offset = __pyx_t_4; + __pyx_t_4 = 0; + } else { + __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":786 + * child, new_offset = fields + * + * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + */ + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":787 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == '>' and little_endian) or + */ + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_7)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_7)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":789 + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_6 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_6) { + __pyx_t_7 = __pyx_v_little_endian; + } else { + __pyx_t_7 = __pyx_t_6; + } + if (!__pyx_t_7) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":790 + * + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * # One could encode it in the format string and have Cython + */ + __pyx_t_6 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_6) { + __pyx_t_8 = (!__pyx_v_little_endian); + __pyx_t_9 = __pyx_t_8; + } else { + __pyx_t_9 = __pyx_t_6; + } + __pyx_t_6 = __pyx_t_9; + } else { + __pyx_t_6 = __pyx_t_7; + } + if (__pyx_t_6) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":791 + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":801 + * + * # Output padding bytes + * while offset[0] < new_offset: # <<<<<<<<<<<<<< + * f[0] = 120 # "x"; pad byte + * f += 1 + */ + while (1) { + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_6) break; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":802 + * # Output padding bytes + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< + * f += 1 + * offset[0] += 1 + */ + (__pyx_v_f[0]) = 120; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":803 + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte + * f += 1 # <<<<<<<<<<<<<< + * offset[0] += 1 + * + */ + __pyx_v_f += 1; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":804 + * f[0] = 120 # "x"; pad byte + * f += 1 + * offset[0] += 1 # <<<<<<<<<<<<<< + * + * offset[0] += child.itemsize + */ + (__pyx_v_offset[0]) += 1; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":806 + * offset[0] += 1 + * + * offset[0] += child.itemsize # <<<<<<<<<<<<<< + * + * if not PyDataType_HASFIELDS(child): + */ + (__pyx_v_offset[0]) += __pyx_v_child->elsize; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":808 + * offset[0] += child.itemsize + * + * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< + * t = child.type_num + * if end - f < 5: + */ + __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_6) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":809 + * + * if not PyDataType_HASFIELDS(child): + * t = child.type_num # <<<<<<<<<<<<<< + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") + */ + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_t); + __pyx_v_t = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":810 + * if not PyDataType_HASFIELDS(child): + * t = child.type_num + * if end - f < 5: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short.") + * + */ + __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_6) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":811 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_8)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + __pyx_L10:; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":814 + * + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + */ + __pyx_t_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 98; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":815 + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + */ + __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 66; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":816 + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + */ + __pyx_t_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 104; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":817 + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + */ + __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 72; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":818 + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + */ + __pyx_t_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 105; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":819 + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + */ + __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 73; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":820 + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + */ + __pyx_t_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 108; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":821 + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + */ + __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 76; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":822 + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + */ + __pyx_t_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 113; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":823 + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + */ + __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 81; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":824 + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + */ + __pyx_t_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 102; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":825 + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + */ + __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 100; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":826 + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + */ + __pyx_t_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 103; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":827 + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + */ + __pyx_t_3 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 102; + __pyx_v_f += 1; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":828 + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" + */ + __pyx_t_5 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 100; + __pyx_v_f += 1; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":829 + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + */ + __pyx_t_3 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 103; + __pyx_v_f += 1; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":830 + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + __pyx_t_5 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 79; + goto __pyx_L11; + } + /*else*/ { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":832 + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * f += 1 + * else: + */ + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_6), __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L11:; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":833 + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * f += 1 # <<<<<<<<<<<<<< + * else: + * # Cython ignores struct boundary information ("T{...}"), + */ + __pyx_v_f += 1; + goto __pyx_L9; + } + /*else*/ { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":837 + * # Cython ignores struct boundary information ("T{...}"), + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< + * return f + * + */ + __pyx_t_10 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_10; + } + __pyx_L9:; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":838 + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) + * return f # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_f; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("numpy._util_dtypestring"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_child); + __Pyx_DECREF(__pyx_v_fields); + __Pyx_DECREF(__pyx_v_childname); + __Pyx_DECREF(__pyx_v_new_offset); + __Pyx_DECREF(__pyx_v_t); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":953 + * + * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * cdef PyObject* baseptr + * if base is None: + */ + +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + PyObject *__pyx_v_baseptr; + int __pyx_t_1; + __Pyx_RefNannySetupContext("set_array_base"); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":955 + * cdef inline void set_array_base(ndarray arr, object base): + * cdef PyObject* baseptr + * if base is None: # <<<<<<<<<<<<<< + * baseptr = NULL + * else: + */ + __pyx_t_1 = (__pyx_v_base == Py_None); + if (__pyx_t_1) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":956 + * cdef PyObject* baseptr + * if base is None: + * baseptr = NULL # <<<<<<<<<<<<<< + * else: + * Py_INCREF(base) # important to do this before decref below! + */ + __pyx_v_baseptr = NULL; + goto __pyx_L3; + } + /*else*/ { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":958 + * baseptr = NULL + * else: + * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< + * baseptr = base + * Py_XDECREF(arr.base) + */ + Py_INCREF(__pyx_v_base); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":959 + * else: + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base # <<<<<<<<<<<<<< + * Py_XDECREF(arr.base) + * arr.base = baseptr + */ + __pyx_v_baseptr = ((PyObject *)__pyx_v_base); + } + __pyx_L3:; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":960 + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base + * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< + * arr.base = baseptr + * + */ + Py_XDECREF(__pyx_v_arr->base); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":961 + * baseptr = base + * Py_XDECREF(arr.base) + * arr.base = baseptr # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): + */ + __pyx_v_arr->base = __pyx_v_baseptr; + + __Pyx_RefNannyFinishContext(); +} + +/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":963 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base"); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":964 + * + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: # <<<<<<<<<<<<<< + * return None + * else: + */ + __pyx_t_1 = (__pyx_v_arr->base == NULL); + if (__pyx_t_1) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":965 + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: + * return None # <<<<<<<<<<<<<< + * else: + * return arr.base + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":967 + * return None + * else: + * return arr.base # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); + __pyx_r = ((PyObject *)__pyx_v_arr->base); + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_tp_new_2yt_13ramses_reader_RAMSES_tree_proxy(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)o); + p->field_ind = Py_None; Py_INCREF(Py_None); + p->field_names = Py_None; Py_INCREF(Py_None); + if (__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy___cinit__(o, a, k) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_2yt_13ramses_reader_RAMSES_tree_proxy(PyObject *o) { + struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *p = (struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)o; + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy___dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + Py_XDECREF(p->field_ind); + Py_XDECREF(p->field_names); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_2yt_13ramses_reader_RAMSES_tree_proxy(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *p = (struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)o; + if (p->field_ind) { + e = (*v)(p->field_ind, a); if (e) return e; + } + if (p->field_names) { + e = (*v)(p->field_names, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_2yt_13ramses_reader_RAMSES_tree_proxy(PyObject *o) { + struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *p = (struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)o; + PyObject* tmp; + tmp = ((PyObject*)p->field_ind); + p->field_ind = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->field_names); + p->field_names = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_2yt_13ramses_reader_17RAMSES_tree_proxy_field_ind(PyObject *o, void *x) { + return __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_9field_ind___get__(o); +} + +static int __pyx_setprop_2yt_13ramses_reader_17RAMSES_tree_proxy_field_ind(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_9field_ind___set__(o, v); + } + else { + return __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_9field_ind___del__(o); + } +} + +static PyObject *__pyx_getprop_2yt_13ramses_reader_17RAMSES_tree_proxy_field_names(PyObject *o, void *x) { + return __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_11field_names___get__(o); +} + +static int __pyx_setprop_2yt_13ramses_reader_17RAMSES_tree_proxy_field_names(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_11field_names___set__(o, v); + } + else { + return __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_11field_names___del__(o); + } +} + +static PyMethodDef __pyx_methods_2yt_13ramses_reader_RAMSES_tree_proxy[] = { + {__Pyx_NAMESTR("count_zones"), (PyCFunction)__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_count_zones, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("ensure_loaded"), (PyCFunction)__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_ensure_loaded, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("clear_tree"), (PyCFunction)__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_clear_tree, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_file_info"), (PyCFunction)__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_get_file_info, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("fill_hierarchy_arrays"), (PyCFunction)__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_fill_hierarchy_arrays, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("read_oct_grid"), (PyCFunction)__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_read_oct_grid, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("read_grid"), (PyCFunction)__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_read_grid, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_2yt_13ramses_reader_RAMSES_tree_proxy[] = { + {(char *)"field_ind", __pyx_getprop_2yt_13ramses_reader_17RAMSES_tree_proxy_field_ind, __pyx_setprop_2yt_13ramses_reader_17RAMSES_tree_proxy_field_ind, 0, 0}, + {(char *)"field_names", __pyx_getprop_2yt_13ramses_reader_17RAMSES_tree_proxy_field_names, __pyx_setprop_2yt_13ramses_reader_17RAMSES_tree_proxy_field_names, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_RAMSES_tree_proxy = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*reserved*/ + #else + 0, /*nb_long*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_RAMSES_tree_proxy = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_RAMSES_tree_proxy = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_RAMSES_tree_proxy = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +PyTypeObject __pyx_type_2yt_13ramses_reader_RAMSES_tree_proxy = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("yt.ramses_reader.RAMSES_tree_proxy"), /*tp_name*/ + sizeof(struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2yt_13ramses_reader_RAMSES_tree_proxy, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*reserved*/ + #else + 0, /*tp_compare*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_RAMSES_tree_proxy, /*tp_as_number*/ + &__pyx_tp_as_sequence_RAMSES_tree_proxy, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_RAMSES_tree_proxy, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_RAMSES_tree_proxy, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_2yt_13ramses_reader_RAMSES_tree_proxy, /*tp_traverse*/ + __pyx_tp_clear_2yt_13ramses_reader_RAMSES_tree_proxy, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2yt_13ramses_reader_RAMSES_tree_proxy, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_2yt_13ramses_reader_RAMSES_tree_proxy, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2yt_13ramses_reader_RAMSES_tree_proxy, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_2yt_13ramses_reader_ProtoSubgrid(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)o); + p->sigs = Py_None; Py_INCREF(Py_None); + p->grid_file_locations = Py_None; Py_INCREF(Py_None); + p->dd = Py_None; Py_INCREF(Py_None); + if (__pyx_pf_2yt_13ramses_reader_12ProtoSubgrid___cinit__(o, a, k) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_2yt_13ramses_reader_ProtoSubgrid(PyObject *o) { + struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *p = (struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)o; + Py_XDECREF(p->sigs); + Py_XDECREF(p->grid_file_locations); + Py_XDECREF(p->dd); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_2yt_13ramses_reader_ProtoSubgrid(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *p = (struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)o; + if (p->sigs) { + e = (*v)(p->sigs, a); if (e) return e; + } + if (p->grid_file_locations) { + e = (*v)(p->grid_file_locations, a); if (e) return e; + } + if (p->dd) { + e = (*v)(p->dd, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_2yt_13ramses_reader_ProtoSubgrid(PyObject *o) { + struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *p = (struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)o; + PyObject* tmp; + tmp = ((PyObject*)p->sigs); + p->sigs = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->grid_file_locations); + p->grid_file_locations = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->dd); + p->dd = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_2yt_13ramses_reader_12ProtoSubgrid_efficiency(PyObject *o, void *x) { + return __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_10efficiency___get__(o); +} + +static int __pyx_setprop_2yt_13ramses_reader_12ProtoSubgrid_efficiency(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_10efficiency___set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_2yt_13ramses_reader_12ProtoSubgrid_sigs(PyObject *o, void *x) { + return __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_4sigs___get__(o); +} + +static int __pyx_setprop_2yt_13ramses_reader_12ProtoSubgrid_sigs(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_4sigs___set__(o, v); + } + else { + return __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_4sigs___del__(o); + } +} + +static PyObject *__pyx_getprop_2yt_13ramses_reader_12ProtoSubgrid_grid_file_locations(PyObject *o, void *x) { + return __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_19grid_file_locations___get__(o); +} + +static int __pyx_setprop_2yt_13ramses_reader_12ProtoSubgrid_grid_file_locations(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_19grid_file_locations___set__(o, v); + } + else { + return __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_19grid_file_locations___del__(o); + } +} + +static PyObject *__pyx_getprop_2yt_13ramses_reader_12ProtoSubgrid_dd(PyObject *o, void *x) { + return __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_2dd___get__(o); +} + +static int __pyx_setprop_2yt_13ramses_reader_12ProtoSubgrid_dd(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_2dd___set__(o, v); + } + else { + return __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_2dd___del__(o); + } +} + +static PyMethodDef __pyx_methods_2yt_13ramses_reader_ProtoSubgrid[] = { + {__Pyx_NAMESTR("find_split"), (PyCFunction)__pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_find_split, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_properties"), (PyCFunction)__pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_get_properties, METH_NOARGS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_2yt_13ramses_reader_ProtoSubgrid[] = { + {(char *)"efficiency", __pyx_getprop_2yt_13ramses_reader_12ProtoSubgrid_efficiency, __pyx_setprop_2yt_13ramses_reader_12ProtoSubgrid_efficiency, 0, 0}, + {(char *)"sigs", __pyx_getprop_2yt_13ramses_reader_12ProtoSubgrid_sigs, __pyx_setprop_2yt_13ramses_reader_12ProtoSubgrid_sigs, 0, 0}, + {(char *)"grid_file_locations", __pyx_getprop_2yt_13ramses_reader_12ProtoSubgrid_grid_file_locations, __pyx_setprop_2yt_13ramses_reader_12ProtoSubgrid_grid_file_locations, 0, 0}, + {(char *)"dd", __pyx_getprop_2yt_13ramses_reader_12ProtoSubgrid_dd, __pyx_setprop_2yt_13ramses_reader_12ProtoSubgrid_dd, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_ProtoSubgrid = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*reserved*/ + #else + 0, /*nb_long*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_ProtoSubgrid = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_ProtoSubgrid = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_ProtoSubgrid = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +PyTypeObject __pyx_type_2yt_13ramses_reader_ProtoSubgrid = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("yt.ramses_reader.ProtoSubgrid"), /*tp_name*/ + sizeof(struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2yt_13ramses_reader_ProtoSubgrid, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*reserved*/ + #else + 0, /*tp_compare*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_ProtoSubgrid, /*tp_as_number*/ + &__pyx_tp_as_sequence_ProtoSubgrid, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_ProtoSubgrid, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_ProtoSubgrid, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_2yt_13ramses_reader_ProtoSubgrid, /*tp_traverse*/ + __pyx_tp_clear_2yt_13ramses_reader_ProtoSubgrid, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2yt_13ramses_reader_ProtoSubgrid, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_2yt_13ramses_reader_ProtoSubgrid, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2yt_13ramses_reader_ProtoSubgrid, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("ramses_reader"), + __Pyx_DOCSTR(__pyx_k_9), /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, + {&__pyx_n_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 1}, + {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0}, + {&__pyx_kp_u_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 1, 0, 0}, + {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0}, + {&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0, 0}, + {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, + {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0}, + {&__pyx_n_s__F, __pyx_k__F, sizeof(__pyx_k__F), 0, 0, 1, 1}, + {&__pyx_n_s__H0, __pyx_k__H0, sizeof(__pyx_k__H0), 0, 0, 1, 1}, + {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, + {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s__aexp, __pyx_k__aexp, sizeof(__pyx_k__aexp), 0, 0, 1, 1}, + {&__pyx_n_s__argsort, __pyx_k__argsort, sizeof(__pyx_k__argsort), 0, 0, 1, 1}, + {&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1}, + {&__pyx_n_s__begin, __pyx_k__begin, sizeof(__pyx_k__begin), 0, 0, 1, 1}, + {&__pyx_n_s__boxlen, __pyx_k__boxlen, sizeof(__pyx_k__boxlen), 0, 0, 1, 1}, + {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1}, + {&__pyx_n_s__byteorder, __pyx_k__byteorder, sizeof(__pyx_k__byteorder), 0, 0, 1, 1}, + {&__pyx_n_s__c_str, __pyx_k__c_str, sizeof(__pyx_k__c_str), 0, 0, 1, 1}, + {&__pyx_n_s__child_mask, __pyx_k__child_mask, sizeof(__pyx_k__child_mask), 0, 0, 1, 1}, + {&__pyx_n_s__component_grid_info, __pyx_k__component_grid_info, sizeof(__pyx_k__component_grid_info), 0, 0, 1, 1}, + {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1}, + {&__pyx_n_s__dd, __pyx_k__dd, sizeof(__pyx_k__dd), 0, 0, 1, 1}, + {&__pyx_n_s__descr, __pyx_k__descr, sizeof(__pyx_k__descr), 0, 0, 1, 1}, + {&__pyx_n_s__dimensions, __pyx_k__dimensions, sizeof(__pyx_k__dimensions), 0, 0, 1, 1}, + {&__pyx_n_s__domain, __pyx_k__domain, sizeof(__pyx_k__domain), 0, 0, 1, 1}, + {&__pyx_n_s__domain_index, __pyx_k__domain_index, sizeof(__pyx_k__domain_index), 0, 0, 1, 1}, + {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, + {&__pyx_n_s__efficiency, __pyx_k__efficiency, sizeof(__pyx_k__efficiency), 0, 0, 1, 1}, + {&__pyx_n_s__empty, __pyx_k__empty, sizeof(__pyx_k__empty), 0, 0, 1, 1}, + {&__pyx_n_s__end, __pyx_k__end, sizeof(__pyx_k__end), 0, 0, 1, 1}, + {&__pyx_n_s__ensure_loaded, __pyx_k__ensure_loaded, sizeof(__pyx_k__ensure_loaded), 0, 0, 1, 1}, + {&__pyx_n_s__field, __pyx_k__field, sizeof(__pyx_k__field), 0, 0, 1, 1}, + {&__pyx_n_s__field_ind, __pyx_k__field_ind, sizeof(__pyx_k__field_ind), 0, 0, 1, 1}, + {&__pyx_n_s__field_names, __pyx_k__field_names, sizeof(__pyx_k__field_names), 0, 0, 1, 1}, + {&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1}, + {&__pyx_n_s__filled, __pyx_k__filled, sizeof(__pyx_k__filled), 0, 0, 1, 1}, + {&__pyx_n_s__float64, __pyx_k__float64, sizeof(__pyx_k__float64), 0, 0, 1, 1}, + {&__pyx_n_s__fn, __pyx_k__fn, sizeof(__pyx_k__fn), 0, 0, 1, 1}, + {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1}, + {&__pyx_n_s__get_parent, __pyx_k__get_parent, sizeof(__pyx_k__get_parent), 0, 0, 1, 1}, + {&__pyx_n_s__grid_dimensions, __pyx_k__grid_dimensions, sizeof(__pyx_k__grid_dimensions), 0, 0, 1, 1}, + {&__pyx_n_s__grid_dims, __pyx_k__grid_dims, sizeof(__pyx_k__grid_dims), 0, 0, 1, 1}, + {&__pyx_n_s__grid_file_locations, __pyx_k__grid_file_locations, sizeof(__pyx_k__grid_file_locations), 0, 0, 1, 1}, + {&__pyx_n_s__grid_id, __pyx_k__grid_id, sizeof(__pyx_k__grid_id), 0, 0, 1, 1}, + {&__pyx_n_s__grid_levels, __pyx_k__grid_levels, sizeof(__pyx_k__grid_levels), 0, 0, 1, 1}, + {&__pyx_n_s__grid_pos_double, __pyx_k__grid_pos_double, sizeof(__pyx_k__grid_pos_double), 0, 0, 1, 1}, + {&__pyx_n_s__hydro_datas, __pyx_k__hydro_datas, sizeof(__pyx_k__hydro_datas), 0, 0, 1, 1}, + {&__pyx_n_s__int64, __pyx_k__int64, sizeof(__pyx_k__int64), 0, 0, 1, 1}, + {&__pyx_n_s__is_finest, __pyx_k__is_finest, sizeof(__pyx_k__is_finest), 0, 0, 1, 1}, + {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1}, + {&__pyx_n_s__left_edge, __pyx_k__left_edge, sizeof(__pyx_k__left_edge), 0, 0, 1, 1}, + {&__pyx_n_s__left_edges, __pyx_k__left_edges, sizeof(__pyx_k__left_edges), 0, 0, 1, 1}, + {&__pyx_n_s__left_index, __pyx_k__left_index, sizeof(__pyx_k__left_index), 0, 0, 1, 1}, + {&__pyx_n_s__level, __pyx_k__level, sizeof(__pyx_k__level), 0, 0, 1, 1}, + {&__pyx_n_s__levelmax, __pyx_k__levelmax, sizeof(__pyx_k__levelmax), 0, 0, 1, 1}, + {&__pyx_n_s__levelmin, __pyx_k__levelmin, sizeof(__pyx_k__levelmin), 0, 0, 1, 1}, + {&__pyx_n_s__loaded, __pyx_k__loaded, sizeof(__pyx_k__loaded), 0, 0, 1, 1}, + {&__pyx_n_s__m_AMR_levels, __pyx_k__m_AMR_levels, sizeof(__pyx_k__m_AMR_levels), 0, 0, 1, 1}, + {&__pyx_n_s__m_header, __pyx_k__m_header, sizeof(__pyx_k__m_header), 0, 0, 1, 1}, + {&__pyx_n_s__m_maxlevel, __pyx_k__m_maxlevel, sizeof(__pyx_k__m_maxlevel), 0, 0, 1, 1}, + {&__pyx_n_s__m_nvars, __pyx_k__m_nvars, sizeof(__pyx_k__m_nvars), 0, 0, 1, 1}, + {&__pyx_n_s__m_var_array, __pyx_k__m_var_array, sizeof(__pyx_k__m_var_array), 0, 0, 1, 1}, + {&__pyx_n_s__m_varnames, __pyx_k__m_varnames, sizeof(__pyx_k__m_varnames), 0, 0, 1, 1}, + {&__pyx_n_s__names, __pyx_k__names, sizeof(__pyx_k__names), 0, 0, 1, 1}, + {&__pyx_n_s__ncpu, __pyx_k__ncpu, sizeof(__pyx_k__ncpu), 0, 0, 1, 1}, + {&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1}, + {&__pyx_n_s__ndomains, __pyx_k__ndomains, sizeof(__pyx_k__ndomains), 0, 0, 1, 1}, + {&__pyx_n_s__next, __pyx_k__next, sizeof(__pyx_k__next), 0, 0, 1, 1}, + {&__pyx_n_s__nfields, __pyx_k__nfields, sizeof(__pyx_k__nfields), 0, 0, 1, 1}, + {&__pyx_n_s__ngridmax, __pyx_k__ngridmax, sizeof(__pyx_k__ngridmax), 0, 0, 1, 1}, + {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, + {&__pyx_n_s__nstep_coarse, __pyx_k__nstep_coarse, sizeof(__pyx_k__nstep_coarse), 0, 0, 1, 1}, + {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, + {&__pyx_n_s__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1}, + {&__pyx_n_s__omega_b, __pyx_k__omega_b, sizeof(__pyx_k__omega_b), 0, 0, 1, 1}, + {&__pyx_n_s__omega_k, __pyx_k__omega_k, sizeof(__pyx_k__omega_k), 0, 0, 1, 1}, + {&__pyx_n_s__omega_l, __pyx_k__omega_l, sizeof(__pyx_k__omega_l), 0, 0, 1, 1}, + {&__pyx_n_s__omega_m, __pyx_k__omega_m, sizeof(__pyx_k__omega_m), 0, 0, 1, 1}, + {&__pyx_n_s__ones, __pyx_k__ones, sizeof(__pyx_k__ones), 0, 0, 1, 1}, + {&__pyx_n_s__order, __pyx_k__order, sizeof(__pyx_k__order), 0, 0, 1, 1}, + {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, + {&__pyx_n_s__read, __pyx_k__read, sizeof(__pyx_k__read), 0, 0, 1, 1}, + {&__pyx_n_s__readonly, __pyx_k__readonly, sizeof(__pyx_k__readonly), 0, 0, 1, 1}, + {&__pyx_n_s__ref_factor, __pyx_k__ref_factor, sizeof(__pyx_k__ref_factor), 0, 0, 1, 1}, + {&__pyx_n_s__right_edge, __pyx_k__right_edge, sizeof(__pyx_k__right_edge), 0, 0, 1, 1}, + {&__pyx_n_s__right_edges, __pyx_k__right_edges, sizeof(__pyx_k__right_edges), 0, 0, 1, 1}, + {&__pyx_n_s__rsnap, __pyx_k__rsnap, sizeof(__pyx_k__rsnap), 0, 0, 1, 1}, + {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, + {&__pyx_n_s__signature, __pyx_k__signature, sizeof(__pyx_k__signature), 0, 0, 1, 1}, + {&__pyx_n_s__sigs, __pyx_k__sigs, sizeof(__pyx_k__sigs), 0, 0, 1, 1}, + {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1}, + {&__pyx_n_s__snapshot_name, __pyx_k__snapshot_name, sizeof(__pyx_k__snapshot_name), 0, 0, 1, 1}, + {&__pyx_n_s__start_index, __pyx_k__start_index, sizeof(__pyx_k__start_index), 0, 0, 1, 1}, + {&__pyx_n_s__strides, __pyx_k__strides, sizeof(__pyx_k__strides), 0, 0, 1, 1}, + {&__pyx_n_s__suboffsets, __pyx_k__suboffsets, sizeof(__pyx_k__suboffsets), 0, 0, 1, 1}, + {&__pyx_n_s__time, __pyx_k__time, sizeof(__pyx_k__time), 0, 0, 1, 1}, + {&__pyx_n_s__trees, __pyx_k__trees, sizeof(__pyx_k__trees), 0, 0, 1, 1}, + {&__pyx_n_s__type_num, __pyx_k__type_num, sizeof(__pyx_k__type_num), 0, 0, 1, 1}, + {&__pyx_n_s__unit_d, __pyx_k__unit_d, sizeof(__pyx_k__unit_d), 0, 0, 1, 1}, + {&__pyx_n_s__unit_l, __pyx_k__unit_l, sizeof(__pyx_k__unit_l), 0, 0, 1, 1}, + {&__pyx_n_s__unit_t, __pyx_k__unit_t, sizeof(__pyx_k__unit_t), 0, 0, 1, 1}, + {&__pyx_n_s__varname, __pyx_k__varname, sizeof(__pyx_k__varname), 0, 0, 1, 1}, + {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1}, + {&__pyx_n_s__y, __pyx_k__y, sizeof(__pyx_k__y), 0, 0, 1, 1}, + {&__pyx_n_s__z, __pyx_k__z, sizeof(__pyx_k__z), 0, 0, 1, 1}, + {&__pyx_n_s__zc, __pyx_k__zc, sizeof(__pyx_k__zc), 0, 0, 1, 1}, + {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1}, + {&__pyx_n_s__zs, __pyx_k__zs, sizeof(__pyx_k__zs), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __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_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC initramses_reader(void); /*proto*/ +PyMODINIT_FUNC initramses_reader(void) +#else +PyMODINIT_FUNC PyInit_ramses_reader(void); /*proto*/ +PyMODINIT_FUNC PyInit_ramses_reader(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + #if CYTHON_REFNANNY + void* __pyx_refnanny = NULL; + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_ramses_reader(void)", __LINE__, __FILE__); + #endif + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __pyx_binding_PyCFunctionType_USED + if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("ramses_reader"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_9), 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_yt__ramses_reader) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + if (PyType_Ready(&__pyx_type_2yt_13ramses_reader_RAMSES_tree_proxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "RAMSES_tree_proxy", (PyObject *)&__pyx_type_2yt_13ramses_reader_RAMSES_tree_proxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2yt_13ramses_reader_RAMSES_tree_proxy = &__pyx_type_2yt_13ramses_reader_RAMSES_tree_proxy; + if (PyType_Ready(&__pyx_type_2yt_13ramses_reader_ProtoSubgrid) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "ProtoSubgrid", (PyObject *)&__pyx_type_2yt_13ramses_reader_ProtoSubgrid) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2yt_13ramses_reader_ProtoSubgrid = &__pyx_type_2yt_13ramses_reader_ProtoSubgrid; + /*--- Type import code ---*/ + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":32 + * from libc.stdlib cimport malloc, free, abs, calloc, labs + * + * import numpy as np # <<<<<<<<<<<<<< + * cimport numpy as np + * cimport cython + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":1 + * """ # <<<<<<<<<<<<<< + * Wrapping code for Oliver Hahn's RamsesRead++ + * + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":963 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + if (__pyx_m) { + __Pyx_AddTraceback("init yt.ramses_reader"); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init yt.ramses_reader"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ + +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_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *number, *more_or_less; + + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + number = (num_expected == 1) ? "" : "s"; + PyErr_Format(PyExc_TypeError, + #if PY_VERSION_HEX < 0x02050000 + "%s() takes %s %d positional argument%s (%d given)", + #else + "%s() takes %s %zd positional argument%s (%zd given)", + #endif + func_name, more_or_less, num_expected, number, num_found); +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + /* unexpected keyword found */ + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + + + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact) +{ + if (!type) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (none_allowed && obj == Py_None) return 1; + else if (exact) { + if (Py_TYPE(obj) == type) return 1; + } + else { + if (PyObject_TypeCheck(obj, type)) return 1; + } + PyErr_Format(PyExc_TypeError, + "Argument '%s' has incorrect type (expected %s, got %s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); + return 0; +} + +static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { + unsigned int n = 1; + return *(unsigned char*)(&n) != 0; +} + +typedef struct { + __Pyx_StructField root; + __Pyx_BufFmt_StackElem* head; + size_t fmt_offset; + int new_count, enc_count; + int is_complex; + char enc_type; + char packmode; +} __Pyx_BufFmt_Context; + +static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, + __Pyx_BufFmt_StackElem* stack, + __Pyx_TypeInfo* type) { + stack[0].field = &ctx->root; + stack[0].parent_offset = 0; + ctx->root.type = type; + ctx->root.name = "buffer dtype"; + ctx->root.offset = 0; + ctx->head = stack; + ctx->head->field = &ctx->root; + ctx->fmt_offset = 0; + ctx->head->parent_offset = 0; + ctx->packmode = '@'; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ctx->is_complex = 0; + while (type->typegroup == 'S') { + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = 0; + type = type->fields->type; + } +} + +static int __Pyx_BufFmt_ParseNumber(const char** ts) { + int count; + const char* t = *ts; + if (*t < '0' || *t > '9') { + return -1; + } else { + count = *t++ - '0'; + while (*t >= '0' && *t < '9') { + count *= 10; + count += *t++ - '0'; + } + } + *ts = t; + return count; +} + +static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { + char msg[] = {ch, 0}; + PyErr_Format(PyExc_ValueError, "Unexpected format string character: '%s'", msg); +} + +static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { + switch (ch) { + case 'b': return "'char'"; + case 'B': return "'unsigned char'"; + case 'h': return "'short'"; + case 'H': return "'unsigned short'"; + case 'i': return "'int'"; + case 'I': return "'unsigned int'"; + case 'l': return "'long'"; + case 'L': return "'unsigned long'"; + case 'q': return "'long long'"; + case 'Q': return "'unsigned long long'"; + case 'f': return (is_complex ? "'complex float'" : "'float'"); + case 'd': return (is_complex ? "'complex double'" : "'double'"); + case 'g': return (is_complex ? "'complex long double'" : "'long double'"); + case 'T': return "a struct"; + case 'O': return "Python object"; + case 'P': return "a pointer"; + case 0: return "end"; + default: return "unparseable format string"; + } +} + +static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': return 1; + case 'h': case 'H': return 2; + case 'i': case 'I': case 'l': case 'L': return 4; + case 'q': case 'Q': return 8; + case 'f': return (is_complex ? 8 : 4); + case 'd': return (is_complex ? 16 : 8); + case 'g': { + PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); + return 0; + } + case 'O': case 'P': return sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} + +static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { + switch (ch) { + case 'c': case 'b': case 'B': return 1; + case 'h': case 'H': return sizeof(short); + case 'i': case 'I': return sizeof(int); + case 'l': case 'L': return sizeof(long); + #ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(PY_LONG_LONG); + #endif + case 'f': return sizeof(float) * (is_complex ? 2 : 1); + case 'd': return sizeof(double) * (is_complex ? 2 : 1); + case 'g': return sizeof(long double) * (is_complex ? 2 : 1); + case 'O': case 'P': return sizeof(void*); + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } + } +} + +typedef struct { char c; short x; } __Pyx_st_short; +typedef struct { char c; int x; } __Pyx_st_int; +typedef struct { char c; long x; } __Pyx_st_long; +typedef struct { char c; float x; } __Pyx_st_float; +typedef struct { char c; double x; } __Pyx_st_double; +typedef struct { char c; long double x; } __Pyx_st_longdouble; +typedef struct { char c; void *x; } __Pyx_st_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { char c; PY_LONG_LONG x; } __Pyx_s_long_long; +#endif + +static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': return 1; + case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_s_long_long) - sizeof(PY_LONG_LONG); +#endif + case 'f': return sizeof(__Pyx_st_float) - sizeof(float); + case 'd': return sizeof(__Pyx_st_double) - sizeof(double); + case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} + +static size_t __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { + switch (ch) { + case 'c': case 'b': case 'h': case 'i': case 'l': case 'q': return 'I'; + case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U'; + case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R'); + case 'O': return 'O'; + case 'P': return 'P'; + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } + } +} + +static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { + if (ctx->head == NULL || ctx->head->field == &ctx->root) { + const char* expected; + const char* quote; + if (ctx->head == NULL) { + expected = "end"; + quote = ""; + } else { + expected = ctx->head->field->type->name; + quote = "'"; + } + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected %s%s%s but got %s", + quote, expected, quote, + __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); + } else { + __Pyx_StructField* field = ctx->head->field; + __Pyx_StructField* parent = (ctx->head - 1)->field; + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", + field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), + parent->type->name, field->name); + } +} + +static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { + char group; + size_t size, offset; + if (ctx->enc_type == 0) return 0; + group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); + do { + __Pyx_StructField* field = ctx->head->field; + __Pyx_TypeInfo* type = field->type; + + if (ctx->packmode == '@' || ctx->packmode == '^') { + size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); + } else { + size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); + } + if (ctx->packmode == '@') { + int align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); + int align_mod_offset; + if (align_at == 0) return -1; + align_mod_offset = ctx->fmt_offset % align_at; + if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; + } + + if (type->size != size || type->typegroup != group) { + if (type->typegroup == 'C' && type->fields != NULL) { + /* special case -- treat as struct rather than complex number */ + size_t parent_offset = ctx->head->parent_offset + field->offset; + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = parent_offset; + continue; + } + + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } + + offset = ctx->head->parent_offset + field->offset; + if (ctx->fmt_offset != offset) { + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch; next field is at offset %"PY_FORMAT_SIZE_T"d " + "but %"PY_FORMAT_SIZE_T"d expected", ctx->fmt_offset, offset); + return -1; + } + + ctx->fmt_offset += size; + + --ctx->enc_count; /* Consume from buffer string */ + + /* Done checking, move to next field, pushing or popping struct stack if needed */ + while (1) { + if (field == &ctx->root) { + ctx->head = NULL; + if (ctx->enc_count != 0) { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } + break; /* breaks both loops as ctx->enc_count == 0 */ + } + ctx->head->field = ++field; + if (field->type == NULL) { + --ctx->head; + field = ctx->head->field; + continue; + } else if (field->type->typegroup == 'S') { + size_t parent_offset = ctx->head->parent_offset + field->offset; + if (field->type->fields->type == NULL) continue; /* empty struct */ + field = field->type->fields; + ++ctx->head; + ctx->head->field = field; + ctx->head->parent_offset = parent_offset; + break; + } else { + break; + } + } + } while (ctx->enc_count); + ctx->enc_type = 0; + ctx->is_complex = 0; + return 0; +} + +static int __Pyx_BufFmt_FirstPack(__Pyx_BufFmt_Context* ctx) { + if (ctx->enc_type != 0 || ctx->packmode != '@') { + PyErr_SetString(PyExc_ValueError, "Buffer packing mode currently only allowed at beginning of format string (this is a defect)"); + return -1; + } + return 0; +} + +static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { + int got_Z = 0; + while (1) { + switch(*ts) { + case 0: + if (ctx->enc_type != 0 && ctx->head == NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + if (ctx->head != NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + return ts; + case ' ': + case 10: + case 13: + ++ts; + break; + case '<': + if (!__Pyx_IsLittleEndian()) { + PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); + return NULL; + } + if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL; + ctx->packmode = '='; + ++ts; + break; + case '>': + case '!': + if (__Pyx_IsLittleEndian()) { + PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); + return NULL; + } + if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL; + ctx->packmode = '='; + ++ts; + break; + case '=': + case '@': + case '^': + if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL; + ctx->packmode = *ts++; + break; + case 'T': /* substruct */ + { + int i; + const char* ts_after_sub; + int struct_count = ctx->new_count; + ctx->new_count = 1; + ++ts; + if (*ts != '{') { + PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); + return NULL; + } + ++ts; + ts_after_sub = ts; + for (i = 0; i != struct_count; ++i) { + ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); + if (!ts_after_sub) return NULL; + } + ts = ts_after_sub; + } + break; + case '}': /* end of substruct; either repeat or move on */ + ++ts; + return ts; + case 'x': + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->fmt_offset += ctx->new_count; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ++ts; + break; + case 'Z': + got_Z = 1; + ++ts; + if (*ts != 'f' && *ts != 'd' && *ts != 'g') { + __Pyx_BufFmt_RaiseUnexpectedChar('Z'); + return NULL; + } /* fall through */ + case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': + case 'l': case 'L': case 'q': case 'Q': + case 'f': case 'd': case 'g': + case 'O': + if (ctx->enc_type == *ts && got_Z == ctx->is_complex) { + /* Continue pooling same type */ + ctx->enc_count += ctx->new_count; + } else { + /* New type */ + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_count = ctx->new_count; + ctx->enc_type = *ts; + ctx->is_complex = got_Z; + } + ++ts; + ctx->new_count = 1; + got_Z = 0; + break; + default: + { + ctx->new_count = __Pyx_BufFmt_ParseNumber(&ts); + if (ctx->new_count == -1) { /* First char was not a digit */ + char msg[2] = { *ts, 0 }; + PyErr_Format(PyExc_ValueError, + "Does not understand character buffer dtype format string ('%s')", msg); + return NULL; + } + } + + } + } +} + +static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { + buf->buf = NULL; + buf->obj = NULL; + buf->strides = __Pyx_zeros; + buf->shape = __Pyx_zeros; + buf->suboffsets = __Pyx_minusones; +} + +static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) { + if (obj == Py_None) { + __Pyx_ZeroBuffer(buf); + return 0; + } + buf->buf = NULL; + if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail; + if (buf->ndim != nd) { + PyErr_Format(PyExc_ValueError, + "Buffer has wrong number of dimensions (expected %d, got %d)", + nd, buf->ndim); + goto fail; + } + if (!cast) { + __Pyx_BufFmt_Context ctx; + __Pyx_BufFmt_Init(&ctx, stack, dtype); + if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; + } + if ((unsigned)buf->itemsize != dtype->size) { + PyErr_Format(PyExc_ValueError, + "Item size of buffer (%"PY_FORMAT_SIZE_T"d byte%s) does not match size of '%s' (%"PY_FORMAT_SIZE_T"d byte%s)", + buf->itemsize, (buf->itemsize > 1) ? "s" : "", + dtype->name, + dtype->size, (dtype->size > 1) ? "s" : ""); + goto fail; + } + if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; + return 0; +fail:; + __Pyx_ZeroBuffer(buf); + return -1; +} + +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { + if (info->buf == NULL) return; + if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; + __Pyx_ReleaseBuffer(info); +} +static void __Pyx_RaiseBufferIndexError(int axis) { + PyErr_Format(PyExc_IndexError, + "Out of bounds on buffer access (axis %d)", axis); +} + + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} + + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (unlikely(!type)) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(PyObject_TypeCheck(obj, type))) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} + +static void __Pyx_RaiseBufferFallbackError(void) { + PyErr_Format(PyExc_ValueError, + "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!"); +} + + +static CYTHON_INLINE int __Pyx_div_int(int a, int b) { + int q = a / b; + int r = a - q*b; + q -= ((r != 0) & ((r ^ b) < 0)); + return q; +} + +static CYTHON_INLINE __pyx_t_5numpy_int64_t __Pyx_div___pyx_t_5numpy_int64_t(__pyx_t_5numpy_int64_t a, __pyx_t_5numpy_int64_t b) { + __pyx_t_5numpy_int64_t q = a / b; + __pyx_t_5numpy_int64_t r = a - q*b; + q -= ((r != 0) & ((r ^ b) < 0)); + return q; +} + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + #if PY_VERSION_HEX < 0x02050000 + "need more than %d value%s to unpack", (int)index, + #else + "need more than %zd value%s to unpack", index, + #endif + (index == 1) ? "" : "s"); +} + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + #if PY_VERSION_HEX < 0x02050000 + "too many values to unpack (expected %d)", (int)expected); + #else + "too many values to unpack (expected %zd)", expected); + #endif +} + +static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { + if (t == Py_None) { + __Pyx_RaiseNoneNotIterableError(); + } else if (PyTuple_GET_SIZE(t) < index) { + __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); + } else { + __Pyx_RaiseTooManyValuesError(index); + } +} + +#if PY_MAJOR_VERSION < 3 +static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { + #if PY_VERSION_HEX >= 0x02060000 + if (Py_TYPE(obj)->tp_flags & Py_TPFLAGS_HAVE_NEWBUFFER) + return PyObject_GetBuffer(obj, view, flags); + #endif + if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pf_5numpy_7ndarray___getbuffer__(obj, view, flags); + else { + PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); + return -1; + } +} + +static void __Pyx_ReleaseBuffer(Py_buffer *view) { + PyObject* obj = view->obj; + if (obj) { +if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pf_5numpy_7ndarray___releasebuffer__(obj, view); + Py_DECREF(obj); + view->obj = NULL; + } +} + +#endif + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { + PyObject *py_import = 0; + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!py_import) + goto bad; + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, NULL); +bad: + Py_XDECREF(empty_list); + Py_XDECREF(py_import); + Py_XDECREF(empty_dict); + return module; +} + +#if PY_MAJOR_VERSION < 3 +static PyObject *__Pyx_GetStdout(void) { + PyObject *f = PySys_GetObject((char *)"stdout"); + if (!f) { + PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout"); + } + return f; +} + +static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) { + PyObject* v; + int i; + + if (!f) { + if (!(f = __Pyx_GetStdout())) + return -1; + } + for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) { + if (PyFile_SoftSpace(f, 1)) { + if (PyFile_WriteString(" ", f) < 0) + return -1; + } + v = PyTuple_GET_ITEM(arg_tuple, i); + if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0) + return -1; + if (PyString_Check(v)) { + char *s = PyString_AsString(v); + Py_ssize_t len = PyString_Size(v); + if (len > 0 && + isspace(Py_CHARMASK(s[len-1])) && + s[len-1] != ' ') + PyFile_SoftSpace(f, 0); + } + } + if (newline) { + if (PyFile_WriteString("\n", f) < 0) + return -1; + PyFile_SoftSpace(f, 0); + } + return 0; +} + +#else /* Python 3 has a print function */ + +static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { + PyObject* kwargs = 0; + PyObject* result = 0; + PyObject* end_string; + if (unlikely(!__pyx_print)) { + __pyx_print = __Pyx_GetAttrString(__pyx_b, "print"); + if (!__pyx_print) + return -1; + } + if (stream) { + kwargs = PyDict_New(); + if (unlikely(!kwargs)) + return -1; + if (unlikely(PyDict_SetItemString(kwargs, "file", stream) < 0)) + goto bad; + if (!newline) { + end_string = PyUnicode_FromStringAndSize(" ", 1); + if (unlikely(!end_string)) + goto bad; + if (PyDict_SetItemString(kwargs, "end", end_string) < 0) { + Py_DECREF(end_string); + goto bad; + } + Py_DECREF(end_string); + } + } else if (!newline) { + if (unlikely(!__pyx_print_kwargs)) { + __pyx_print_kwargs = PyDict_New(); + if (unlikely(!__pyx_print_kwargs)) + return -1; + end_string = PyUnicode_FromStringAndSize(" ", 1); + if (unlikely(!end_string)) + return -1; + if (PyDict_SetItemString(__pyx_print_kwargs, "end", end_string) < 0) { + Py_DECREF(end_string); + return -1; + } + Py_DECREF(end_string); + } + kwargs = __pyx_print_kwargs; + } + result = PyObject_Call(__pyx_print, arg_tuple, kwargs); + if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs)) + Py_DECREF(kwargs); + if (!result) + return -1; + Py_DECREF(result); + return 0; +bad: + if (kwargs != __pyx_print_kwargs) + Py_XDECREF(kwargs); + return -1; +} + +#endif + +static CYTHON_INLINE long __Pyx_pow_long(long b, long e) { + long t = b; + switch (e) { + case 3: + t *= b; + case 2: + t *= b; + case 1: + return t; + case 0: + return 1; + } + if (unlikely(e<0)) return 0; + t = 1; + while (likely(e)) { + t *= (b * (e&1)) | ((~e)&1); /* 1 or b */ + b *= b; + e >>= 1; + } + return t; +} + +static CYTHON_INLINE npy_int64 __Pyx_PyInt_from_py_npy_int64(PyObject* x) { + const npy_int64 neg_one = (npy_int64)-1, const_zero = (npy_int64)0; + const int is_unsigned = const_zero < neg_one; + if (sizeof(npy_int64) == sizeof(char)) { + if (is_unsigned) + return (npy_int64)__Pyx_PyInt_AsUnsignedChar(x); + else + return (npy_int64)__Pyx_PyInt_AsSignedChar(x); + } else if (sizeof(npy_int64) == sizeof(short)) { + if (is_unsigned) + return (npy_int64)__Pyx_PyInt_AsUnsignedShort(x); + else + return (npy_int64)__Pyx_PyInt_AsSignedShort(x); + } else if (sizeof(npy_int64) == sizeof(int)) { + if (is_unsigned) + return (npy_int64)__Pyx_PyInt_AsUnsignedInt(x); + else + return (npy_int64)__Pyx_PyInt_AsSignedInt(x); + } else if (sizeof(npy_int64) == sizeof(long)) { + if (is_unsigned) + return (npy_int64)__Pyx_PyInt_AsUnsignedLong(x); + else + return (npy_int64)__Pyx_PyInt_AsSignedLong(x); + } else if (sizeof(npy_int64) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return (npy_int64)__Pyx_PyInt_AsUnsignedLongLong(x); + else + return (npy_int64)__Pyx_PyInt_AsSignedLongLong(x); + } else { + npy_int64 val; + PyObject *v = __Pyx_PyNumber_Int(x); + #if PY_VERSION_HEX < 0x03000000 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } + return (npy_int64)-1; + } +} + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int64(npy_int64 val) { + const npy_int64 neg_one = (npy_int64)-1, const_zero = (npy_int64)0; + const int is_unsigned = const_zero < neg_one; + if ((sizeof(npy_int64) == sizeof(char)) || + (sizeof(npy_int64) == sizeof(short))) { + return PyInt_FromLong((long)val); + } else if ((sizeof(npy_int64) == sizeof(int)) || + (sizeof(npy_int64) == sizeof(long))) { + if (is_unsigned) + return PyLong_FromUnsignedLong((unsigned long)val); + else + return PyInt_FromLong((long)val); + } else if (sizeof(npy_int64) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); + else + return PyLong_FromLongLong((PY_LONG_LONG)val); + } else { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + return _PyLong_FromByteArray(bytes, sizeof(npy_int64), + little, !is_unsigned); + } +} + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return ::std::complex< float >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } +/* + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { +#if HAVE_HYPOT + return hypotf(z.real, z.imag); +#else + return sqrtf(z.real*z.real + z.imag*z.imag); +#endif + } +*/ +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return ::std::complex< double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } +/* + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { +#if HAVE_HYPOT + return hypot(z.real, z.imag); +#else + return sqrt(z.real*z.real + z.imag*z.imag); +#endif + } +*/ +#endif + +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { + Py_XINCREF(type); + Py_XINCREF(value); + Py_XINCREF(tb); + /* First, check the traceback argument, replacing None with NULL. */ + if (tb == Py_None) { + Py_DECREF(tb); + tb = 0; + } + else if (tb != NULL && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + /* Next, replace a missing value with None */ + if (value == NULL) { + value = Py_None; + Py_INCREF(value); + } + #if PY_VERSION_HEX < 0x02050000 + if (!PyClass_Check(type)) + #else + if (!PyType_Check(type)) + #endif + { + /* Raising an instance. The value should be a dummy. */ + if (value != Py_None) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + /* Normalize to raise , */ + Py_DECREF(value); + value = type; + #if PY_VERSION_HEX < 0x02050000 + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } + else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } + #else + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + #endif + } + + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} + +#else /* Python 3+ */ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (!PyExceptionClass_Check(type)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + + PyErr_SetObject(type, value); + + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } + +bad: + return; +} +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#ifndef __PYX_HAVE_RT_ImportType +#define __PYX_HAVE_RT_ImportType +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, + long size, int strict) +{ + PyObject *py_module = 0; + PyObject *result = 0; + PyObject *py_name = 0; + char warning[200]; + + py_module = __Pyx_ImportModule(module_name); + if (!py_module) + goto bad; + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(class_name); + #else + py_name = PyUnicode_FromString(class_name); + #endif + if (!py_name) + goto bad; + result = PyObject_GetAttr(py_module, py_name); + Py_DECREF(py_name); + py_name = 0; + Py_DECREF(py_module); + py_module = 0; + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%s.%s is not a type object", + module_name, class_name); + goto bad; + } + if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility", + module_name, class_name); + #if PY_VERSION_HEX < 0x02050000 + PyErr_Warn(NULL, warning); + #else + PyErr_WarnEx(NULL, warning, 0); + #endif + } + else if (((PyTypeObject *)result)->tp_basicsize != size) { + PyErr_Format(PyExc_ValueError, + "%s.%s has the wrong size, try recompiling", + module_name, class_name); + goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(py_module); + Py_XDECREF(result); + return 0; +} +#endif + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(name); + #else + py_name = PyUnicode_FromString(name); + #endif + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(__pyx_filename); + #else + py_srcfile = PyUnicode_FromString(__pyx_filename); + #endif + if (!py_srcfile) goto bad; + if (__pyx_clineno) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + __pyx_lineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + if (!py_code) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +/* Type Conversion Functions */ + +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} + +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/frontends/ramses/setup.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yt/frontends/ramses/setup.py Thu Aug 26 10:24:41 2010 -0600 @@ -0,0 +1,12 @@ +#!/usr/bin/env python +import setuptools +import os, sys, os.path + +import os.path + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + config = Configuration('ramses',parent_package,top_path) + config.make_config_py() # installs __config__.py + config.make_svn_version_py() + return config diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/frontends/setup.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yt/frontends/setup.py Thu Aug 26 10:24:41 2010 -0600 @@ -0,0 +1,15 @@ +#!/usr/bin/env python +import setuptools + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + config = Configuration('frontends',parent_package,top_path) + config.make_config_py() # installs __config__.py + config.make_svn_version_py() + config.add_subpackage("chombo") + config.add_subpackage("enzo") + config.add_subpackage("flash") + config.add_subpackage("orion") + config.add_subpackage("ramses") + config.add_subpackage("tiger") + return config diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/frontends/tiger/setup.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yt/frontends/tiger/setup.py Thu Aug 26 10:24:41 2010 -0600 @@ -0,0 +1,12 @@ +#!/usr/bin/env python +import setuptools +import os, sys, os.path + +import os.path + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + config = Configuration('tiger',parent_package,top_path) + config.make_config_py() # installs __config__.py + config.make_svn_version_py() + return config diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/logger.py --- a/yt/logger.py Wed Aug 25 18:03:39 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +0,0 @@ -""" -Logging facility for yt -Will initialize everything, and associate one with each module - -Author: Matthew Turk -Affiliation: KIPAC/SLAC/Stanford -Homepage: http://yt.enzotools.org/ -License: - Copyright (C) 2007-2009 Matthew Turk. All Rights Reserved. - - This file is part of yt. - - yt is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -""" - -import logging, os -import logging.handlers as handlers -from yt.config import ytcfg - -# This next bit is grabbed from: -# http://stackoverflow.com/questions/384076/how-can-i-make-the-python-logging-output-to-be-colored -def add_coloring_to_emit_ansi(fn): - # add methods we need to the class - def new(*args): - levelno = args[1].levelno - if(levelno>=50): - color = '\x1b[31m' # red - elif(levelno>=40): - color = '\x1b[31m' # red - elif(levelno>=30): - color = '\x1b[33m' # yellow - elif(levelno>=20): - color = '\x1b[32m' # green - elif(levelno>=10): - color = '\x1b[35m' # pink - else: - color = '\x1b[0m' # normal - args[1].msg = color + args[1].msg + '\x1b[0m' # normal - #print "after" - return fn(*args) - return new - -if ytcfg.getboolean("yt","coloredlogs"): - logging.StreamHandler.emit = add_coloring_to_emit_ansi(logging.StreamHandler.emit) - -level = min(max(ytcfg.getint("yt", "loglevel"), 0), 50) -fstring = "%(name)-10s %(levelname)-10s %(asctime)s %(message)s" -logging.basicConfig( - format=fstring, - level=level -) - -f = logging.Formatter("%(levelname)-10s %(asctime)s %(message)s") - -rootLogger = logging.getLogger() - -ytLogger = logging.getLogger("yt") -ytLogger.debug("Set log level to %s", level) - -fidoLogger = logging.getLogger("yt.fido") -ravenLogger = logging.getLogger("yt.raven") -lagosLogger = logging.getLogger("yt.lagos") -enkiLogger = logging.getLogger("yt.enki") -deliveratorLogger = logging.getLogger("yt.deliverator") -reasonLogger = logging.getLogger("yt.reason") - -# Maybe some day we'll make this more configurable... unfortunately, for now, -# we preserve thread-safety by opening in the current directory. - -mb = 10*1024*1024 -bc = 10 - -loggers = [] -file_handlers = [] - -if ytcfg.getboolean("yt","logfile") and os.access(".", os.W_OK): - log_file_name = ytcfg.get("yt","LogFileName") - ytFileHandler = handlers.RotatingFileHandler(log_file_name, - maxBytes=mb, backupCount=bc) - k = logging.Formatter(fstring) - ytFileHandler.setFormatter(k) - ytLogger.addHandler(ytFileHandler) - loggers.append(ytLogger) - file_handlers.append(ytFileHandler) - -def disable_stream_logging(): - # We just remove the root logger's handlers - for handler in rootLogger.handlers: - if isinstance(handler, logging.StreamHandler): - rootLogger.removeHandler(handler) - -def disable_file_logging(): - for logger, handler in zip(loggers, file_handlers): - logger.removeHandler(handler) - -if ytcfg.getboolean("yt","suppressStreamLogging"): - disable_stream_logging() diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/parallel_tools/__init__.py --- a/yt/parallel_tools/__init__.py Wed Aug 25 18:03:39 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -""" -Tools for parallelism. - -Author: Matthew Turk -Affiliation: KIPAC/SLAC/Stanford -Homepage: http://yt.enzotools.org/ -License: - Copyright (C) 2010 Matthew Turk. All Rights Reserved. - - This file is part of yt. - - yt is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -""" - -from yt.lagos.ParallelTools import ParallelAnalysisInterface -from distributed_object_collection import DistributedObjectCollection diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/parallel_tools/distributed_object_collection.py --- a/yt/parallel_tools/distributed_object_collection.py Wed Aug 25 18:03:39 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,135 +0,0 @@ -""" -A simple distributed object mechanism, for storing array-heavy objects. -Meant to be subclassed. - -Author: Matthew Turk -Affiliation: KIPAC/SLAC/Stanford -Homepage: http://yt.enzotools.org/ -License: - Copyright (C) 2010 Matthew Turk. All Rights Reserved. - - This file is part of yt. - - yt is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -""" - -import numpy as na -from yt.funcs import * -from yt.parallel_tools import ParallelAnalysisInterface -from itertools import izip - -class DistributedObjectCollection(ParallelAnalysisInterface): - valid = True - - def _get_object_info(self): - pass - - def _set_object_info(self): - pass - - def join_lists(self): - info_dict = self._get_object_info() - info_dict = self._mpi_catdict(info_dict) - self._set_object_info(info_dict) - - def _collect_objects(self, desired_indices): - # We figure out which indices belong to which processor, - # then we pack them up, and we send a list to each processor. - request_count = [] - owners = self._object_owners[desired_indices] - mylog.debug("Owner list: %s", na.unique1d(owners)) - # Even if we have a million bricks, this should not take long. - s = self._mpi_get_size() - m = self._mpi_get_rank() - requests = dict( ( (i, []) for i in xrange(s) ) ) - for i, p in izip(desired_indices, owners): - requests[p].append(i) - for p in sorted(requests): - requests[p] = na.array(requests[p], dtype='int64') - request_count.append(len(requests[p])) - size = len(request_count) - mylog.debug("Requesting: %s", request_count) - request_count = na.array(request_count, dtype='int64') - # Now we distribute our requests to all the processors. - # This is two-pass. One to get the length of the arrays. The second - # pass is to get the actual indices themselves. - request_count = self._mpi_joindict({m : request_count}) - # Now we have our final array of requests, with arrangement - # (Nproc,Nproc). First index corresponds to requesting proc, second to - # sending. So [them,us] = 5 means we owe 5, whereas [us, them] means - # we are owed. - send_hooks = [] - dsend_buffers, dsend_hooks = [], [] - recv_hooks, recv_buffers = [], [] - drecv_buffers, drecv_hooks = [], [] - # We post our index-list and data receives from each processor. - mylog.debug("Posting data buffer receives") - proc_hooks = {} - for p, request_from in request_count.items(): - if p == m: continue - size = request_from[m] - #if size == 0: continue - # We post receives of the grids we *asked* for. - # Note that indices into this are not necessarily processor ids. - # So we store. This has to go before the appends or it's an - # off-by-one. - mylog.debug("Setting up index buffer of size %s for receive from %s", - size, p) - proc_hooks[len(drecv_buffers)] = p - drecv_buffers.append(self._create_buffer(requests[p])) - drecv_hooks.append(self._mpi_Irecv_double(drecv_buffers[-1], p, 1)) - recv_buffers.append(na.zeros(size, dtype='int64')) - # Our index list goes on 0, our buffer goes on 1. We know how big - # the index list will be, now. - recv_hooks.append(self._mpi_Irecv_long(recv_buffers[-1], p, 0)) - # Send our index lists into hte waiting buffers - mylog.debug("Sending index lists") - for p, ind_list in requests.items(): - if p == m: continue - if len(ind_list) == 0: continue - # Now, we actually send our index lists. - send_hooks.append(self._mpi_Isend_long(ind_list, p, 0)) - # Now we post receives for all of the data buffers. - mylog.debug("Sending data") - for i in self._mpi_Request_Waititer(recv_hooks): - # We get back the index, which here is identical to the processor - # number doing the send. At this point, we can post our receives. - p = proc_hooks[i] - mylog.debug("Processing from %s", p) - ind_list = recv_buffers[i] - dsend_buffers.append(self._create_buffer(ind_list)) - self._pack_buffer(ind_list, dsend_buffers[-1]) - dsend_hooks.append(self._mpi_Isend_double( - dsend_buffers[-1], p, 1)) - mylog.debug("Waiting on data receives: %s", len(drecv_hooks)) - for i in self._mpi_Request_Waititer(drecv_hooks): - mylog.debug("Unpacking from %s", proc_hooks[i]) - # Now we have to unpack our buffers - # Our key into this is actually the request for the processor - # number. - p = proc_hooks[i] - self._unpack_buffer(requests[p], drecv_buffers[i]) - mylog.debug("Finalizing sends: %s", len(dsend_hooks)) - for i in self._mpi_Request_Waititer(dsend_hooks): - continue - - def _create_buffer(self, ind_list): - pass - - def _pack_buffer(self, ind_list): - pass - - def _unpack_buffer(self, ind_list, my_buffer): - pass - diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/physical_constants.py --- a/yt/physical_constants.py Wed Aug 25 18:03:39 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -# -# Physical Constants and Units Conversion Factors -# - -# Masses -mass_hydrogen_cgs = 1.67e-24 # g -mass_electron_cgs = 9.11e-28 # g -# Velocities -speed_of_light_cgs = 2.99792458e10 # cm/s, exact - -# Cross Sections -cross_section_thompson_cgs = 6.65e-25 # cm^2 - -# Physical Constants -boltzmann_constant_cgs = 1.3806504e-16 # erg K^-1 -gravitational_constant_cgs = 6.67428e-8 # cm^3 g^-1 s^-2 -planck_constant_cgs = 6.62606896e-27 # erg s -rho_crit_now = 1.8788e-29 # g times h^2 (critical mass for closure, Cosmology) - -# Misc. Approximations -mass_mean_atomic_cosmology = 1.22 -mass_mean_atomic_galactic = 2.3 - -# Conversion Factors: X au * mpc_per_au = Y au -# length -mpc_per_mpc = 1 -mpc_per_kpc = 1e-3 -mpc_per_pc = 1e-6 -mpc_per_au = 4.847e-12 -mpc_per_rsun = 2.253e-14 -mpc_per_miles = 5.216e-20 -mpc_per_cm = 3.24e-25 -km_per_pc = 1.3806504e13 -km_per_m = 1e-3 -km_per_cm = 1e-5 - -m_per_fpc = 0.0324077649 - -au_per_mpc = 2.063e11 -rsun_per_mpc = 4.43664e13 -miles_per_mpc = 1.917e19 -cm_per_mpc = 3.0857e24 -cm_per_km = 1e5 -pc_per_km = 3.24e-14 -pc_per_cm = 3.24e-19 -#Short cuts -G = gravitational_constant_cgs -me = mass_electron_cgs -mp = mass_hydrogen_cgs -clight = speed_of_light_cgs -kboltz = boltzmann_constant_cgs -hcgs = planck_constant_cgs -sigma_thompson = cross_section_thompson_cgs diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/ramses_reader.cpp --- a/yt/ramses_reader.cpp Wed Aug 25 18:03:39 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11701 +0,0 @@ -/* Generated by Cython 0.13.beta0 on Tue Aug 10 15:34:03 2010 */ - -#define PY_SSIZE_T_CLEAN -#include "Python.h" -#ifndef Py_PYTHON_H - #error Python headers needed to compile C extensions, please install development version of Python. -#else - -#include /* For offsetof */ -#ifndef offsetof -#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) -#endif - -#if !defined(WIN32) && !defined(MS_WINDOWS) - #ifndef __stdcall - #define __stdcall - #endif - #ifndef __cdecl - #define __cdecl - #endif - #ifndef __fastcall - #define __fastcall - #endif -#endif - -#ifndef DL_IMPORT - #define DL_IMPORT(t) t -#endif -#ifndef DL_EXPORT - #define DL_EXPORT(t) t -#endif - -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG -#endif - -#if PY_VERSION_HEX < 0x02040000 - #define METH_COEXIST 0 - #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) - #define PyDict_Contains(d,o) PySequence_Contains(d,o) -#endif - -#if PY_VERSION_HEX < 0x02050000 - typedef int Py_ssize_t; - #define PY_SSIZE_T_MAX INT_MAX - #define PY_SSIZE_T_MIN INT_MIN - #define PY_FORMAT_SIZE_T "" - #define PyInt_FromSsize_t(z) PyInt_FromLong(z) - #define PyInt_AsSsize_t(o) PyInt_AsLong(o) - #define PyNumber_Index(o) PyNumber_Int(o) - #define PyIndex_Check(o) PyNumber_Check(o) - #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) -#endif - -#if PY_VERSION_HEX < 0x02060000 - #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) - #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) - #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) - #define PyVarObject_HEAD_INIT(type, size) \ - PyObject_HEAD_INIT(type) size, - #define PyType_Modified(t) - - typedef struct { - void *buf; - PyObject *obj; - Py_ssize_t len; - Py_ssize_t itemsize; - int readonly; - int ndim; - char *format; - Py_ssize_t *shape; - Py_ssize_t *strides; - Py_ssize_t *suboffsets; - void *internal; - } Py_buffer; - - #define PyBUF_SIMPLE 0 - #define PyBUF_WRITABLE 0x0001 - #define PyBUF_FORMAT 0x0004 - #define PyBUF_ND 0x0008 - #define PyBUF_STRIDES (0x0010 | PyBUF_ND) - #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) - #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) - #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) - #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) - -#endif - -#if PY_MAJOR_VERSION < 3 - #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" -#else - #define __Pyx_BUILTIN_MODULE_NAME "builtins" -#endif - -#if PY_MAJOR_VERSION >= 3 - #define Py_TPFLAGS_CHECKTYPES 0 - #define Py_TPFLAGS_HAVE_INDEX 0 -#endif - -#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) - #define Py_TPFLAGS_HAVE_NEWBUFFER 0 -#endif - -#if PY_MAJOR_VERSION >= 3 - #define PyBaseString_Type PyUnicode_Type - #define PyStringObject PyUnicodeObject - #define PyString_Type PyUnicode_Type - #define PyString_Check PyUnicode_Check - #define PyString_CheckExact PyUnicode_CheckExact -#endif - -#if PY_VERSION_HEX < 0x02060000 - #define PyBytesObject PyStringObject - #define PyBytes_Type PyString_Type - #define PyBytes_Check PyString_Check - #define PyBytes_CheckExact PyString_CheckExact - #define PyBytes_FromString PyString_FromString - #define PyBytes_FromStringAndSize PyString_FromStringAndSize - #define PyBytes_FromFormat PyString_FromFormat - #define PyBytes_DecodeEscape PyString_DecodeEscape - #define PyBytes_AsString PyString_AsString - #define PyBytes_AsStringAndSize PyString_AsStringAndSize - #define PyBytes_Size PyString_Size - #define PyBytes_AS_STRING PyString_AS_STRING - #define PyBytes_GET_SIZE PyString_GET_SIZE - #define PyBytes_Repr PyString_Repr - #define PyBytes_Concat PyString_Concat - #define PyBytes_ConcatAndDel PyString_ConcatAndDel - #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) - #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) -#endif - -#ifndef PySet_CheckExact -# define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) -#endif - -#if PY_MAJOR_VERSION >= 3 - #define PyInt_Type PyLong_Type - #define PyInt_Check(op) PyLong_Check(op) - #define PyInt_CheckExact(op) PyLong_CheckExact(op) - #define PyInt_FromString PyLong_FromString - #define PyInt_FromUnicode PyLong_FromUnicode - #define PyInt_FromLong PyLong_FromLong - #define PyInt_FromSize_t PyLong_FromSize_t - #define PyInt_FromSsize_t PyLong_FromSsize_t - #define PyInt_AsLong PyLong_AsLong - #define PyInt_AS_LONG PyLong_AS_LONG - #define PyInt_AsSsize_t PyLong_AsSsize_t - #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask - #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask -#endif - -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif - -#if PY_MAJOR_VERSION >= 3 - #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) -#endif - -#if PY_VERSION_HEX < 0x02050000 - #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) - #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) - #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) -#else - #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) - #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) - #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) -#endif - -#if PY_VERSION_HEX < 0x02050000 - #define __Pyx_NAMESTR(n) ((char *)(n)) - #define __Pyx_DOCSTR(n) ((char *)(n)) -#else - #define __Pyx_NAMESTR(n) (n) - #define __Pyx_DOCSTR(n) (n) -#endif - -#ifdef __cplusplus -#define __PYX_EXTERN_C extern "C" -#else -#define __PYX_EXTERN_C extern -#endif - -#if defined(WIN32) || defined(MS_WINDOWS) -#define _USE_MATH_DEFINES -#endif -#include -#define __PYX_HAVE_API__yt__ramses_reader -#include "stdlib.h" -#include "stdio.h" -#include "numpy/arrayobject.h" -#include "numpy/ufuncobject.h" -#include -#include -#include "string" -#include "RAMSES_typedefs.h" -#include "RAMSES_info.hh" -#include "RAMSES_amr_data.hh" - -/* inline attribute */ -#ifndef CYTHON_INLINE - #if defined(__GNUC__) - #define CYTHON_INLINE __inline__ - #elif defined(_MSC_VER) - #define CYTHON_INLINE __inline - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_INLINE inline - #else - #define CYTHON_INLINE - #endif -#endif - -/* unused attribute */ -#ifndef CYTHON_UNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -# elif defined(__ICC) || defined(__INTEL_COMPILER) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -#endif - -typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ - - -/* Type Conversion Predeclarations */ - -#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) -#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) - -#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); - -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); - -#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) - - -#ifdef __GNUC__ -/* Test for GCC > 2.95 */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) -#define likely(x) __builtin_expect(!!(x), 1) -#define unlikely(x) __builtin_expect(!!(x), 0) -#else /* __GNUC__ > 2 ... */ -#define likely(x) (x) -#define unlikely(x) (x) -#endif /* __GNUC__ > 2 ... */ -#else /* __GNUC__ */ -#define likely(x) (x) -#define unlikely(x) (x) -#endif /* __GNUC__ */ - -static PyObject *__pyx_m; -static PyObject *__pyx_b; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static int __pyx_lineno; -static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; -static const char *__pyx_filename; - - -#if !defined(CYTHON_CCOMPLEX) - #if defined(__cplusplus) - #define CYTHON_CCOMPLEX 1 - #elif defined(_Complex_I) - #define CYTHON_CCOMPLEX 1 - #else - #define CYTHON_CCOMPLEX 0 - #endif -#endif - -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - #include - #else - #include - #endif -#endif - -#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) - #undef _Complex_I - #define _Complex_I 1.0fj -#endif - -static const char *__pyx_f[] = { - "ramses_reader.pyx", - "numpy.pxd", -}; - -typedef npy_int8 __pyx_t_5numpy_int8_t; - -typedef npy_int16 __pyx_t_5numpy_int16_t; - -typedef npy_int32 __pyx_t_5numpy_int32_t; - -typedef npy_int64 __pyx_t_5numpy_int64_t; - -typedef npy_uint8 __pyx_t_5numpy_uint8_t; - -typedef npy_uint16 __pyx_t_5numpy_uint16_t; - -typedef npy_uint32 __pyx_t_5numpy_uint32_t; - -typedef npy_uint64 __pyx_t_5numpy_uint64_t; - -typedef npy_float32 __pyx_t_5numpy_float32_t; - -typedef npy_float64 __pyx_t_5numpy_float64_t; - -typedef npy_long __pyx_t_5numpy_int_t; - -typedef npy_longlong __pyx_t_5numpy_long_t; - -typedef npy_intp __pyx_t_5numpy_intp_t; - -typedef npy_uintp __pyx_t_5numpy_uintp_t; - -typedef npy_ulong __pyx_t_5numpy_uint_t; - -typedef npy_ulonglong __pyx_t_5numpy_ulong_t; - -typedef npy_double __pyx_t_5numpy_float_t; - -typedef npy_double __pyx_t_5numpy_double_t; - -typedef npy_longdouble __pyx_t_5numpy_longdouble_t; - -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - typedef ::std::complex< float > __pyx_t_float_complex; - #else - typedef float _Complex __pyx_t_float_complex; - #endif -#else - typedef struct { float real, imag; } __pyx_t_float_complex; -#endif - -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - typedef ::std::complex< double > __pyx_t_double_complex; - #else - typedef double _Complex __pyx_t_double_complex; - #endif -#else - typedef struct { double real, imag; } __pyx_t_double_complex; -#endif - -/* Type declarations */ - -typedef npy_cfloat __pyx_t_5numpy_cfloat_t; - -typedef npy_cdouble __pyx_t_5numpy_cdouble_t; - -typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; - -typedef npy_cdouble __pyx_t_5numpy_complex_t; - -/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":370 - * vector[vector[double]] m_var_array - * - * cdef class RAMSES_tree_proxy: # <<<<<<<<<<<<<< - * cdef string *snapshot_name - * cdef snapshot *rsnap - */ - -struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy { - PyObject_HEAD - std::string *snapshot_name; - RAMSES::snapshot *rsnap; - RAMSES::AMR::RAMSES_tree **trees; - RAMSES::HYDRO::RAMSES_hydro_data ***hydro_datas; - int *loaded; - PyObject *field_ind; - PyObject *field_names; - int ndomains; - int nfields; -}; - -/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":659 - * return to_fill - * - * cdef class ProtoSubgrid: # <<<<<<<<<<<<<< - * cdef np.int64_t *signature[3] - * cdef np.int64_t left_edge[3] - */ - -struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid { - PyObject_HEAD - __pyx_t_5numpy_int64_t *signature[3]; - __pyx_t_5numpy_int64_t left_edge[3]; - __pyx_t_5numpy_int64_t right_edge[3]; - __pyx_t_5numpy_int64_t dimensions[3]; - __pyx_t_5numpy_float64_t efficiency; - PyObject *sigs; - PyObject *grid_file_locations; - PyObject *dd; -}; - -#ifndef CYTHON_REFNANNY - #define CYTHON_REFNANNY 0 -#endif - -#if CYTHON_REFNANNY - typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*SetupContext)(const char*, int, const char*); - void (*FinishContext)(void**); - } __Pyx_RefNannyAPIStruct; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule((char *)modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); - end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; - } - #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) - #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) -#else - #define __Pyx_RefNannySetupContext(name) - #define __Pyx_RefNannyFinishContext() - #define __Pyx_INCREF(r) Py_INCREF(r) - #define __Pyx_DECREF(r) Py_DECREF(r) - #define __Pyx_GOTREF(r) - #define __Pyx_GIVEREF(r) - #define __Pyx_XDECREF(r) Py_XDECREF(r) -#endif /* CYTHON_REFNANNY */ -#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) -#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) - -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ - -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ - -static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, - Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ - -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ - -static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) { - if (likely(PyList_CheckExact(L))) { - if (PyList_Append(L, x) < 0) return NULL; - Py_INCREF(Py_None); - return Py_None; /* this is just to have an accurate signature */ - } - else { - PyObject *r, *m; - m = __Pyx_GetAttrString(L, "append"); - if (!m) return NULL; - r = PyObject_CallFunctionObjArgs(m, x, NULL); - Py_DECREF(m); - return r; - } -} - - -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { - PyObject *r; - if (!j) return NULL; - r = PyObject_GetItem(o, j); - Py_DECREF(j); - return r; -} - - -#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ - __Pyx_GetItemInt_List_Fast(o, i) : \ - __Pyx_GetItemInt_Generic(o, to_py_func(i))) - -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { - if (likely(o != Py_None)) { - if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { - PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); - Py_INCREF(r); - return r; - } - } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -} - -#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ - __Pyx_GetItemInt_Tuple_Fast(o, i) : \ - __Pyx_GetItemInt_Generic(o, to_py_func(i))) - -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { - if (likely(o != Py_None)) { - if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { - PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); - Py_INCREF(r); - return r; - } - } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -} - - -#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ - __Pyx_GetItemInt_Fast(o, i) : \ - __Pyx_GetItemInt_Generic(o, to_py_func(i))) - -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { - PyObject *r; - if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { - r = PyList_GET_ITEM(o, i); - Py_INCREF(r); - } - else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); - } - else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { - r = PySequence_GetItem(o, i); - } - else { - r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); - } - return r; -} - -#define __Pyx_SetItemInt(o, i, v, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ - __Pyx_SetItemInt_Fast(o, i, v) : \ - __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) - -static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { - int r; - if (!j) return -1; - r = PyObject_SetItem(o, j, v); - Py_DECREF(j); - return r; -} - -static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v) { - if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { - Py_INCREF(v); - Py_DECREF(PyList_GET_ITEM(o, i)); - PyList_SET_ITEM(o, i, v); - return 1; - } - else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && (likely(i >= 0))) - return PySequence_SetItem(o, i, v); - else { - PyObject *j = PyInt_FromSsize_t(i); - return __Pyx_SetItemInt_Generic(o, j, v); - } -} - -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact); /*proto*/ - -/* Run-time type information about structs used with buffers */ -struct __Pyx_StructField_; - -typedef struct { - const char* name; /* for error messages only */ - struct __Pyx_StructField_* fields; - size_t size; /* sizeof(type) */ - char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */ -} __Pyx_TypeInfo; - -typedef struct __Pyx_StructField_ { - __Pyx_TypeInfo* type; - const char* name; - size_t offset; -} __Pyx_StructField; - -typedef struct { - __Pyx_StructField* field; - size_t parent_offset; -} __Pyx_BufFmt_StackElem; - - -static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); -static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); -static void __Pyx_RaiseBufferIndexError(int axis); /*proto*/ -#define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1) - -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ - -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ -#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) - -static void __Pyx_RaiseBufferFallbackError(void); /*proto*/ - -static CYTHON_INLINE int __Pyx_div_int(int, int); /* proto */ - -#define UNARY_NEG_WOULD_OVERFLOW(x) (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) -#define __Pyx_BufPtrStrided3d(type, buf, i0, s0, i1, s1, i2, s2) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2) - -static CYTHON_INLINE __pyx_t_5numpy_int64_t __Pyx_div___pyx_t_5numpy_int64_t(__pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t); /* proto */ - -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); - -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); - -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); - -static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ -#if PY_MAJOR_VERSION < 3 -static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); -static void __Pyx_ReleaseBuffer(Py_buffer *view); -#else -#define __Pyx_GetBuffer PyObject_GetBuffer -#define __Pyx_ReleaseBuffer PyBuffer_Release -#endif - -Py_ssize_t __Pyx_zeros[] = {0, 0, 0}; -Py_ssize_t __Pyx_minusones[] = {-1, -1, -1}; - -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ - -static int __Pyx_Print(PyObject*, PyObject *, int); /*proto*/ -#if PY_MAJOR_VERSION >= 3 -static PyObject* __pyx_print = 0; -static PyObject* __pyx_print_kwargs = 0; -#endif - -static CYTHON_INLINE long __Pyx_pow_long(long, long); /* proto */ - -static CYTHON_INLINE npy_int64 __Pyx_PyInt_from_py_npy_int64(PyObject *); - -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int64(npy_int64); - -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - #define __Pyx_CREAL(z) ((z).real()) - #define __Pyx_CIMAG(z) ((z).imag()) - #else - #define __Pyx_CREAL(z) (__real__(z)) - #define __Pyx_CIMAG(z) (__imag__(z)) - #endif -#else - #define __Pyx_CREAL(z) ((z).real) - #define __Pyx_CIMAG(z) ((z).imag) -#endif - -#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX - #define __Pyx_SET_CREAL(z,x) ((z).real(x)) - #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) -#else - #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) - #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) -#endif - -static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); - -#if CYTHON_CCOMPLEX - #define __Pyx_c_eqf(a, b) ((a)==(b)) - #define __Pyx_c_sumf(a, b) ((a)+(b)) - #define __Pyx_c_difff(a, b) ((a)-(b)) - #define __Pyx_c_prodf(a, b) ((a)*(b)) - #define __Pyx_c_quotf(a, b) ((a)/(b)) - #define __Pyx_c_negf(a) (-(a)) - #ifdef __cplusplus - #define __Pyx_c_is_zerof(z) ((z)==(float)0) - #define __Pyx_c_conjf(z) (::std::conj(z)) - /*#define __Pyx_c_absf(z) (::std::abs(z))*/ - #else - #define __Pyx_c_is_zerof(z) ((z)==0) - #define __Pyx_c_conjf(z) (conjf(z)) - /*#define __Pyx_c_absf(z) (cabsf(z))*/ - #endif -#else - static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); - static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); - /*static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);*/ -#endif - -static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); - -#if CYTHON_CCOMPLEX - #define __Pyx_c_eq(a, b) ((a)==(b)) - #define __Pyx_c_sum(a, b) ((a)+(b)) - #define __Pyx_c_diff(a, b) ((a)-(b)) - #define __Pyx_c_prod(a, b) ((a)*(b)) - #define __Pyx_c_quot(a, b) ((a)/(b)) - #define __Pyx_c_neg(a) (-(a)) - #ifdef __cplusplus - #define __Pyx_c_is_zero(z) ((z)==(double)0) - #define __Pyx_c_conj(z) (::std::conj(z)) - /*#define __Pyx_c_abs(z) (::std::abs(z))*/ - #else - #define __Pyx_c_is_zero(z) ((z)==0) - #define __Pyx_c_conj(z) (conj(z)) - /*#define __Pyx_c_abs(z) (cabs(z))*/ - #endif -#else - static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); - static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); - /*static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);*/ -#endif - -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ - -static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); - -static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); - -static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); - -static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); - -static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); - -static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); - -static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); - -static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); - -static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); - -static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); - -static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); - -static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); - -static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); - -static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); - -static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); - -static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); - -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/ - -static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ - -static void __Pyx_AddTraceback(const char *funcname); /*proto*/ - -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ -/* Module declarations from libc.stdlib */ - -/* Module declarations from cpython.buffer */ - -/* Module declarations from cpython.ref */ - -/* Module declarations from libc.stdio */ - -/* Module declarations from cpython.object */ - -/* Module declarations from numpy */ - -/* Module declarations from numpy */ - -static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; -static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; -static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; -static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; -static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ -/* Module declarations from cython */ - -/* Module declarations from yt.ramses_reader */ - -static PyTypeObject *__pyx_ptype_2yt_13ramses_reader_RAMSES_tree_proxy = 0; -static PyTypeObject *__pyx_ptype_2yt_13ramses_reader_ProtoSubgrid = 0; -static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_13ramses_reader_i64max(__pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t); /*proto*/ -static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_13ramses_reader_i64min(__pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t); /*proto*/ -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t = { "float64_t", NULL, sizeof(__pyx_t_5numpy_float64_t), 'R' }; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t = { "int32_t", NULL, sizeof(__pyx_t_5numpy_int32_t), 'I' }; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t = { "int64_t", NULL, sizeof(__pyx_t_5numpy_int64_t), 'I' }; -#define __Pyx_MODULE_NAME "yt.ramses_reader" -int __pyx_module_is_main_yt__ramses_reader = 0; - -/* Implementation of yt.ramses_reader */ -static PyObject *__pyx_builtin_range; -static PyObject *__pyx_builtin_ValueError; -static PyObject *__pyx_builtin_RuntimeError; -static char __pyx_k_1[] = "READING FROM DISK"; -static char __pyx_k_2[] = "get_absolute_position"; -static char __pyx_k_3[] = "ndarray is not C contiguous"; -static char __pyx_k_4[] = "ndarray is not Fortran contiguous"; -static char __pyx_k_5[] = "Non-native byte order not supported"; -static char __pyx_k_6[] = "unknown dtype code in numpy.pxd (%d)"; -static char __pyx_k_7[] = "Format string allocated too short, see comment in numpy.pxd"; -static char __pyx_k_8[] = "Format string allocated too short."; -static char __pyx_k_9[] = "\nWrapping code for Oliver Hahn's RamsesRead++\n\nAuthor: Matthew Turk \nAffiliation: UCSD\nAuthor: Oliver Hahn \nAffiliation: KIPAC / Stanford\nHomepage: http://yt.enzotools.org/\nLicense:\n Copyright (C) 2010 Matthew Turk. All Rights Reserved.\n\n This file is part of yt.\n\n yt is free software; you can redistribute it and/or modify\n it under the terms of the GNU General Public License as published by\n the Free Software Foundation; either version 3 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see .\n"; -static char __pyx_k__B[] = "B"; -static char __pyx_k__F[] = "F"; -static char __pyx_k__H[] = "H"; -static char __pyx_k__I[] = "I"; -static char __pyx_k__L[] = "L"; -static char __pyx_k__O[] = "O"; -static char __pyx_k__Q[] = "Q"; -static char __pyx_k__b[] = "b"; -static char __pyx_k__d[] = "d"; -static char __pyx_k__f[] = "f"; -static char __pyx_k__g[] = "g"; -static char __pyx_k__h[] = "h"; -static char __pyx_k__i[] = "i"; -static char __pyx_k__l[] = "l"; -static char __pyx_k__q[] = "q"; -static char __pyx_k__x[] = "x"; -static char __pyx_k__y[] = "y"; -static char __pyx_k__z[] = "z"; -static char __pyx_k__H0[] = "H0"; -static char __pyx_k__Zd[] = "Zd"; -static char __pyx_k__Zf[] = "Zf"; -static char __pyx_k__Zg[] = "Zg"; -static char __pyx_k__dd[] = "dd"; -static char __pyx_k__fn[] = "fn"; -static char __pyx_k__np[] = "np"; -static char __pyx_k__zc[] = "zc"; -static char __pyx_k__zs[] = "zs"; -static char __pyx_k__buf[] = "buf"; -static char __pyx_k__end[] = "end"; -static char __pyx_k__obj[] = "obj"; -static char __pyx_k__aexp[] = "aexp"; -static char __pyx_k__base[] = "base"; -static char __pyx_k__data[] = "data"; -static char __pyx_k__ncpu[] = "ncpu"; -static char __pyx_k__ndim[] = "ndim"; -static char __pyx_k__next[] = "next"; -static char __pyx_k__ones[] = "ones"; -static char __pyx_k__read[] = "read"; -static char __pyx_k__sigs[] = "sigs"; -static char __pyx_k__size[] = "size"; -static char __pyx_k__time[] = "time"; -static char __pyx_k__begin[] = "begin"; -static char __pyx_k__c_str[] = "c_str"; -static char __pyx_k__descr[] = "descr"; -static char __pyx_k__dtype[] = "dtype"; -static char __pyx_k__empty[] = "empty"; -static char __pyx_k__field[] = "field"; -static char __pyx_k__int64[] = "int64"; -static char __pyx_k__level[] = "level"; -static char __pyx_k__names[] = "names"; -static char __pyx_k__numpy[] = "numpy"; -static char __pyx_k__order[] = "order"; -static char __pyx_k__range[] = "range"; -static char __pyx_k__rsnap[] = "rsnap"; -static char __pyx_k__shape[] = "shape"; -static char __pyx_k__trees[] = "trees"; -static char __pyx_k__zeros[] = "zeros"; -static char __pyx_k__boxlen[] = "boxlen"; -static char __pyx_k__domain[] = "domain"; -static char __pyx_k__fields[] = "fields"; -static char __pyx_k__filled[] = "filled"; -static char __pyx_k__format[] = "format"; -static char __pyx_k__loaded[] = "loaded"; -static char __pyx_k__unit_d[] = "unit_d"; -static char __pyx_k__unit_l[] = "unit_l"; -static char __pyx_k__unit_t[] = "unit_t"; -static char __pyx_k__argsort[] = "argsort"; -static char __pyx_k__float64[] = "float64"; -static char __pyx_k__grid_id[] = "grid_id"; -static char __pyx_k__m_nvars[] = "m_nvars"; -static char __pyx_k__nfields[] = "nfields"; -static char __pyx_k__omega_b[] = "omega_b"; -static char __pyx_k__omega_k[] = "omega_k"; -static char __pyx_k__omega_l[] = "omega_l"; -static char __pyx_k__omega_m[] = "omega_m"; -static char __pyx_k__strides[] = "strides"; -static char __pyx_k__varname[] = "varname"; -static char __pyx_k____main__[] = "__main__"; -static char __pyx_k____test__[] = "__test__"; -static char __pyx_k__itemsize[] = "itemsize"; -static char __pyx_k__levelmax[] = "levelmax"; -static char __pyx_k__levelmin[] = "levelmin"; -static char __pyx_k__m_header[] = "m_header"; -static char __pyx_k__ndomains[] = "ndomains"; -static char __pyx_k__ngridmax[] = "ngridmax"; -static char __pyx_k__readonly[] = "readonly"; -static char __pyx_k__type_num[] = "type_num"; -static char __pyx_k__byteorder[] = "byteorder"; -static char __pyx_k__field_ind[] = "field_ind"; -static char __pyx_k__grid_dims[] = "grid_dims"; -static char __pyx_k__is_finest[] = "is_finest"; -static char __pyx_k__left_edge[] = "left_edge"; -static char __pyx_k__signature[] = "signature"; -static char __pyx_k__ValueError[] = "ValueError"; -static char __pyx_k__child_mask[] = "child_mask"; -static char __pyx_k__dimensions[] = "dimensions"; -static char __pyx_k__efficiency[] = "efficiency"; -static char __pyx_k__get_parent[] = "get_parent"; -static char __pyx_k__left_edges[] = "left_edges"; -static char __pyx_k__left_index[] = "left_index"; -static char __pyx_k__m_maxlevel[] = "m_maxlevel"; -static char __pyx_k__m_varnames[] = "m_varnames"; -static char __pyx_k__ref_factor[] = "ref_factor"; -static char __pyx_k__right_edge[] = "right_edge"; -static char __pyx_k__suboffsets[] = "suboffsets"; -static char __pyx_k__field_names[] = "field_names"; -static char __pyx_k__grid_levels[] = "grid_levels"; -static char __pyx_k__hydro_datas[] = "hydro_datas"; -static char __pyx_k__m_var_array[] = "m_var_array"; -static char __pyx_k__right_edges[] = "right_edges"; -static char __pyx_k__start_index[] = "start_index"; -static char __pyx_k__RuntimeError[] = "RuntimeError"; -static char __pyx_k__domain_index[] = "domain_index"; -static char __pyx_k__m_AMR_levels[] = "m_AMR_levels"; -static char __pyx_k__nstep_coarse[] = "nstep_coarse"; -static char __pyx_k__ensure_loaded[] = "ensure_loaded"; -static char __pyx_k__snapshot_name[] = "snapshot_name"; -static char __pyx_k__grid_dimensions[] = "grid_dimensions"; -static char __pyx_k__grid_pos_double[] = "grid_pos_double"; -static char __pyx_k__component_grid_info[] = "component_grid_info"; -static char __pyx_k__grid_file_locations[] = "grid_file_locations"; -static PyObject *__pyx_kp_s_1; -static PyObject *__pyx_n_s_2; -static PyObject *__pyx_kp_u_3; -static PyObject *__pyx_kp_u_4; -static PyObject *__pyx_kp_u_5; -static PyObject *__pyx_kp_u_6; -static PyObject *__pyx_kp_u_7; -static PyObject *__pyx_kp_u_8; -static PyObject *__pyx_n_s__F; -static PyObject *__pyx_n_s__H0; -static PyObject *__pyx_n_s__RuntimeError; -static PyObject *__pyx_n_s__ValueError; -static PyObject *__pyx_n_s____main__; -static PyObject *__pyx_n_s____test__; -static PyObject *__pyx_n_s__aexp; -static PyObject *__pyx_n_s__argsort; -static PyObject *__pyx_n_s__base; -static PyObject *__pyx_n_s__begin; -static PyObject *__pyx_n_s__boxlen; -static PyObject *__pyx_n_s__buf; -static PyObject *__pyx_n_s__byteorder; -static PyObject *__pyx_n_s__c_str; -static PyObject *__pyx_n_s__child_mask; -static PyObject *__pyx_n_s__component_grid_info; -static PyObject *__pyx_n_s__data; -static PyObject *__pyx_n_s__dd; -static PyObject *__pyx_n_s__descr; -static PyObject *__pyx_n_s__dimensions; -static PyObject *__pyx_n_s__domain; -static PyObject *__pyx_n_s__domain_index; -static PyObject *__pyx_n_s__dtype; -static PyObject *__pyx_n_s__efficiency; -static PyObject *__pyx_n_s__empty; -static PyObject *__pyx_n_s__end; -static PyObject *__pyx_n_s__ensure_loaded; -static PyObject *__pyx_n_s__field; -static PyObject *__pyx_n_s__field_ind; -static PyObject *__pyx_n_s__field_names; -static PyObject *__pyx_n_s__fields; -static PyObject *__pyx_n_s__filled; -static PyObject *__pyx_n_s__float64; -static PyObject *__pyx_n_s__fn; -static PyObject *__pyx_n_s__format; -static PyObject *__pyx_n_s__get_parent; -static PyObject *__pyx_n_s__grid_dimensions; -static PyObject *__pyx_n_s__grid_dims; -static PyObject *__pyx_n_s__grid_file_locations; -static PyObject *__pyx_n_s__grid_id; -static PyObject *__pyx_n_s__grid_levels; -static PyObject *__pyx_n_s__grid_pos_double; -static PyObject *__pyx_n_s__hydro_datas; -static PyObject *__pyx_n_s__int64; -static PyObject *__pyx_n_s__is_finest; -static PyObject *__pyx_n_s__itemsize; -static PyObject *__pyx_n_s__left_edge; -static PyObject *__pyx_n_s__left_edges; -static PyObject *__pyx_n_s__left_index; -static PyObject *__pyx_n_s__level; -static PyObject *__pyx_n_s__levelmax; -static PyObject *__pyx_n_s__levelmin; -static PyObject *__pyx_n_s__loaded; -static PyObject *__pyx_n_s__m_AMR_levels; -static PyObject *__pyx_n_s__m_header; -static PyObject *__pyx_n_s__m_maxlevel; -static PyObject *__pyx_n_s__m_nvars; -static PyObject *__pyx_n_s__m_var_array; -static PyObject *__pyx_n_s__m_varnames; -static PyObject *__pyx_n_s__names; -static PyObject *__pyx_n_s__ncpu; -static PyObject *__pyx_n_s__ndim; -static PyObject *__pyx_n_s__ndomains; -static PyObject *__pyx_n_s__next; -static PyObject *__pyx_n_s__nfields; -static PyObject *__pyx_n_s__ngridmax; -static PyObject *__pyx_n_s__np; -static PyObject *__pyx_n_s__nstep_coarse; -static PyObject *__pyx_n_s__numpy; -static PyObject *__pyx_n_s__obj; -static PyObject *__pyx_n_s__omega_b; -static PyObject *__pyx_n_s__omega_k; -static PyObject *__pyx_n_s__omega_l; -static PyObject *__pyx_n_s__omega_m; -static PyObject *__pyx_n_s__ones; -static PyObject *__pyx_n_s__order; -static PyObject *__pyx_n_s__range; -static PyObject *__pyx_n_s__read; -static PyObject *__pyx_n_s__readonly; -static PyObject *__pyx_n_s__ref_factor; -static PyObject *__pyx_n_s__right_edge; -static PyObject *__pyx_n_s__right_edges; -static PyObject *__pyx_n_s__rsnap; -static PyObject *__pyx_n_s__shape; -static PyObject *__pyx_n_s__signature; -static PyObject *__pyx_n_s__sigs; -static PyObject *__pyx_n_s__size; -static PyObject *__pyx_n_s__snapshot_name; -static PyObject *__pyx_n_s__start_index; -static PyObject *__pyx_n_s__strides; -static PyObject *__pyx_n_s__suboffsets; -static PyObject *__pyx_n_s__time; -static PyObject *__pyx_n_s__trees; -static PyObject *__pyx_n_s__type_num; -static PyObject *__pyx_n_s__unit_d; -static PyObject *__pyx_n_s__unit_l; -static PyObject *__pyx_n_s__unit_t; -static PyObject *__pyx_n_s__varname; -static PyObject *__pyx_n_s__x; -static PyObject *__pyx_n_s__y; -static PyObject *__pyx_n_s__z; -static PyObject *__pyx_n_s__zc; -static PyObject *__pyx_n_s__zeros; -static PyObject *__pyx_n_s__zs; -static PyObject *__pyx_int_0; -static PyObject *__pyx_int_2; -static PyObject *__pyx_int_3; -static PyObject *__pyx_int_neg_1; -static PyObject *__pyx_int_15; - -/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":36 - * cimport cython - * - * cdef inline np.int64_t i64max(np.int64_t i0, np.int64_t i1): # <<<<<<<<<<<<<< - * if i0 > i1: return i0 - * return i1 - */ - -static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_13ramses_reader_i64max(__pyx_t_5numpy_int64_t __pyx_v_i0, __pyx_t_5numpy_int64_t __pyx_v_i1) { - __pyx_t_5numpy_int64_t __pyx_r; - int __pyx_t_1; - __Pyx_RefNannySetupContext("i64max"); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":37 - * - * cdef inline np.int64_t i64max(np.int64_t i0, np.int64_t i1): - * if i0 > i1: return i0 # <<<<<<<<<<<<<< - * return i1 - * - */ - __pyx_t_1 = (__pyx_v_i0 > __pyx_v_i1); - if (__pyx_t_1) { - __pyx_r = __pyx_v_i0; - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":38 - * cdef inline np.int64_t i64max(np.int64_t i0, np.int64_t i1): - * if i0 > i1: return i0 - * return i1 # <<<<<<<<<<<<<< - * - * cdef inline np.int64_t i64min(np.int64_t i0, np.int64_t i1): - */ - __pyx_r = __pyx_v_i1; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":40 - * return i1 - * - * cdef inline np.int64_t i64min(np.int64_t i0, np.int64_t i1): # <<<<<<<<<<<<<< - * if i0 < i1: return i0 - * return i1 - */ - -static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_13ramses_reader_i64min(__pyx_t_5numpy_int64_t __pyx_v_i0, __pyx_t_5numpy_int64_t __pyx_v_i1) { - __pyx_t_5numpy_int64_t __pyx_r; - int __pyx_t_1; - __Pyx_RefNannySetupContext("i64min"); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":41 - * - * cdef inline np.int64_t i64min(np.int64_t i0, np.int64_t i1): - * if i0 < i1: return i0 # <<<<<<<<<<<<<< - * return i1 - * - */ - __pyx_t_1 = (__pyx_v_i0 < __pyx_v_i1); - if (__pyx_t_1) { - __pyx_r = __pyx_v_i0; - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":42 - * cdef inline np.int64_t i64min(np.int64_t i0, np.int64_t i1): - * if i0 < i1: return i0 - * return i1 # <<<<<<<<<<<<<< - * - * cdef extern from "" namespace "std": - */ - __pyx_r = __pyx_v_i1; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":379 - * cdef int *loaded - * - * cdef public object field_ind # <<<<<<<<<<<<<< - * cdef public object field_names - * - */ - -static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_9field_ind___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_9field_ind___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_ind); - __pyx_r = ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_ind; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_9field_ind___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_9field_ind___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannySetupContext("__set__"); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_ind); - __Pyx_DECREF(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_ind); - ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_ind = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_9field_ind___del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_9field_ind___del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_ind); - __Pyx_DECREF(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_ind); - ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_ind = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":380 - * - * cdef public object field_ind - * cdef public object field_names # <<<<<<<<<<<<<< - * - * # We will store this here so that we have a record, independent of the - */ - -static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_11field_names___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_11field_names___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_names); - __pyx_r = ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_names; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_11field_names___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_11field_names___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannySetupContext("__set__"); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_names); - __Pyx_DECREF(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_names); - ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_names = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_11field_names___del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_11field_names___del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_names); - __Pyx_DECREF(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_names); - ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_names = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":386 - * cdef int ndomains, nfields - * - * def __cinit__(self, char *fn): # <<<<<<<<<<<<<< - * cdef int idomain, ifield, ii - * cdef RAMSES_tree *local_tree - */ - -static int __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - char *__pyx_v_fn; - int __pyx_v_idomain; - int __pyx_v_ifield; - int __pyx_v_ii; - RAMSES::AMR::RAMSES_tree *__pyx_v_local_tree; - RAMSES::HYDRO::RAMSES_hydro_data *__pyx_v_local_hydro_data; - std::string *__pyx_v_field_name; - int __pyx_r; - long __pyx_t_1; - int __pyx_t_2; - unsigned int __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fn,0}; - __Pyx_RefNannySetupContext("__cinit__"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[1] = {0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fn); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_fn = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_fn) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_fn = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_fn) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.ramses_reader.RAMSES_tree_proxy.__cinit__"); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":390 - * cdef RAMSES_tree *local_tree - * cdef RAMSES_hydro_data *local_hydro_data - * self.snapshot_name = new string(fn) # <<<<<<<<<<<<<< - * self.rsnap = new snapshot(deref(self.snapshot_name), version3) - * # We now have to get our field names to fill our array - */ - ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->snapshot_name = new std::string(__pyx_v_fn); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":391 - * cdef RAMSES_hydro_data *local_hydro_data - * self.snapshot_name = new string(fn) - * self.rsnap = new snapshot(deref(self.snapshot_name), version3) # <<<<<<<<<<<<<< - * # We now have to get our field names to fill our array - * self.trees = \ - */ - ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap = new RAMSES::snapshot((*((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->snapshot_name), RAMSES::version3); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":393 - * self.rsnap = new snapshot(deref(self.snapshot_name), version3) - * # We now have to get our field names to fill our array - * self.trees = \ # <<<<<<<<<<<<<< - * malloc(sizeof(RAMSES_tree*) * self.rsnap.m_header.ncpu) - * self.hydro_datas = \ - */ - ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->trees = ((RAMSES::AMR::RAMSES_tree **)malloc(((sizeof(RAMSES::AMR::RAMSES_tree *)) * ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.ncpu))); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":395 - * self.trees = \ - * malloc(sizeof(RAMSES_tree*) * self.rsnap.m_header.ncpu) - * self.hydro_datas = \ # <<<<<<<<<<<<<< - * malloc(sizeof(RAMSES_hydro_data**) * self.rsnap.m_header.ncpu) - * self.ndomains = self.rsnap.m_header.ncpu - */ - ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->hydro_datas = ((RAMSES::HYDRO::RAMSES_hydro_data ***)malloc(((sizeof(RAMSES::HYDRO::RAMSES_hydro_data **)) * ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.ncpu))); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":397 - * self.hydro_datas = \ - * malloc(sizeof(RAMSES_hydro_data**) * self.rsnap.m_header.ncpu) - * self.ndomains = self.rsnap.m_header.ncpu # <<<<<<<<<<<<<< - * #for ii in range(self.ndomains): self.trees[ii] = NULL - * for idomain in range(1, self.rsnap.m_header.ncpu + 1): - */ - ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->ndomains = ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.ncpu; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":399 - * self.ndomains = self.rsnap.m_header.ncpu - * #for ii in range(self.ndomains): self.trees[ii] = NULL - * for idomain in range(1, self.rsnap.m_header.ncpu + 1): # <<<<<<<<<<<<<< - * local_tree = new RAMSES_tree(deref(self.rsnap), idomain, - * self.rsnap.m_header.levelmax, 0) - */ - __pyx_t_1 = (((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.ncpu + 1); - for (__pyx_t_2 = 1; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_idomain = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":401 - * for idomain in range(1, self.rsnap.m_header.ncpu + 1): - * local_tree = new RAMSES_tree(deref(self.rsnap), idomain, - * self.rsnap.m_header.levelmax, 0) # <<<<<<<<<<<<<< - * local_tree.read() - * local_hydro_data = new RAMSES_hydro_data(deref(local_tree)) - */ - __pyx_v_local_tree = new RAMSES::AMR::RAMSES_tree((*((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap), __pyx_v_idomain, ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.levelmax, 0); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":402 - * local_tree = new RAMSES_tree(deref(self.rsnap), idomain, - * self.rsnap.m_header.levelmax, 0) - * local_tree.read() # <<<<<<<<<<<<<< - * local_hydro_data = new RAMSES_hydro_data(deref(local_tree)) - * self.hydro_datas[idomain - 1] = \ - */ - __pyx_v_local_tree->read(); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":403 - * self.rsnap.m_header.levelmax, 0) - * local_tree.read() - * local_hydro_data = new RAMSES_hydro_data(deref(local_tree)) # <<<<<<<<<<<<<< - * self.hydro_datas[idomain - 1] = \ - * malloc(sizeof(RAMSES_hydro_data*) * local_hydro_data.m_nvars) - */ - __pyx_v_local_hydro_data = new RAMSES::HYDRO::RAMSES_hydro_data((*__pyx_v_local_tree)); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":404 - * local_tree.read() - * local_hydro_data = new RAMSES_hydro_data(deref(local_tree)) - * self.hydro_datas[idomain - 1] = \ # <<<<<<<<<<<<<< - * malloc(sizeof(RAMSES_hydro_data*) * local_hydro_data.m_nvars) - * del local_hydro_data - */ - (((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->hydro_datas[(__pyx_v_idomain - 1)]) = ((RAMSES::HYDRO::RAMSES_hydro_data **)malloc(((sizeof(RAMSES::HYDRO::RAMSES_hydro_data *)) * __pyx_v_local_hydro_data->m_nvars))); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":406 - * self.hydro_datas[idomain - 1] = \ - * malloc(sizeof(RAMSES_hydro_data*) * local_hydro_data.m_nvars) - * del local_hydro_data # <<<<<<<<<<<<<< - * for ii in range(local_hydro_data.m_nvars): - * self.hydro_datas[idomain - 1][ii] = \ - */ - delete __pyx_v_local_hydro_data; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":407 - * malloc(sizeof(RAMSES_hydro_data*) * local_hydro_data.m_nvars) - * del local_hydro_data - * for ii in range(local_hydro_data.m_nvars): # <<<<<<<<<<<<<< - * self.hydro_datas[idomain - 1][ii] = \ - * new RAMSES_hydro_data(deref(local_tree)) - */ - __pyx_t_3 = __pyx_v_local_hydro_data->m_nvars; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_ii = __pyx_t_4; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":408 - * del local_hydro_data - * for ii in range(local_hydro_data.m_nvars): - * self.hydro_datas[idomain - 1][ii] = \ # <<<<<<<<<<<<<< - * new RAMSES_hydro_data(deref(local_tree)) - * self.trees[idomain - 1] = local_tree - */ - ((((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->hydro_datas[(__pyx_v_idomain - 1)])[__pyx_v_ii]) = new RAMSES::HYDRO::RAMSES_hydro_data((*__pyx_v_local_tree)); - } - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":410 - * self.hydro_datas[idomain - 1][ii] = \ - * new RAMSES_hydro_data(deref(local_tree)) - * self.trees[idomain - 1] = local_tree # <<<<<<<<<<<<<< - * # We do not delete anything - * # Only once, we read all the field names - */ - (((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->trees[(__pyx_v_idomain - 1)]) = __pyx_v_local_tree; - } - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":413 - * # We do not delete anything - * # Only once, we read all the field names - * self.nfields = local_hydro_data.m_nvars # <<<<<<<<<<<<<< - * cdef string *field_name - * self.field_names = [] - */ - ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->nfields = __pyx_v_local_hydro_data->m_nvars; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":415 - * self.nfields = local_hydro_data.m_nvars - * cdef string *field_name - * self.field_names = [] # <<<<<<<<<<<<<< - * self.field_ind = {} - * self.loaded = malloc(sizeof(int) * local_hydro_data.m_nvars) - */ - __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); - __Pyx_GOTREF(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_names); - __Pyx_DECREF(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_names); - ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_names = ((PyObject *)__pyx_t_5); - __pyx_t_5 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":416 - * cdef string *field_name - * self.field_names = [] - * self.field_ind = {} # <<<<<<<<<<<<<< - * self.loaded = malloc(sizeof(int) * local_hydro_data.m_nvars) - * for ifield in range(local_hydro_data.m_nvars): - */ - __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); - __Pyx_GOTREF(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_ind); - __Pyx_DECREF(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_ind); - ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_ind = ((PyObject *)__pyx_t_5); - __pyx_t_5 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":417 - * self.field_names = [] - * self.field_ind = {} - * self.loaded = malloc(sizeof(int) * local_hydro_data.m_nvars) # <<<<<<<<<<<<<< - * for ifield in range(local_hydro_data.m_nvars): - * field_name = &(local_hydro_data.m_varnames[ifield]) - */ - ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->loaded = ((int *)malloc(((sizeof(int)) * __pyx_v_local_hydro_data->m_nvars))); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":418 - * self.field_ind = {} - * self.loaded = malloc(sizeof(int) * local_hydro_data.m_nvars) - * for ifield in range(local_hydro_data.m_nvars): # <<<<<<<<<<<<<< - * field_name = &(local_hydro_data.m_varnames[ifield]) - * # Does this leak? - */ - __pyx_t_3 = __pyx_v_local_hydro_data->m_nvars; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2+=1) { - __pyx_v_ifield = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":419 - * self.loaded = malloc(sizeof(int) * local_hydro_data.m_nvars) - * for ifield in range(local_hydro_data.m_nvars): - * field_name = &(local_hydro_data.m_varnames[ifield]) # <<<<<<<<<<<<<< - * # Does this leak? - * self.field_names.append(field_name.c_str()) - */ - __pyx_v_field_name = (&(__pyx_v_local_hydro_data->m_varnames[__pyx_v_ifield])); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":421 - * field_name = &(local_hydro_data.m_varnames[ifield]) - * # Does this leak? - * self.field_names.append(field_name.c_str()) # <<<<<<<<<<<<<< - * self.field_ind[self.field_names[-1]] = ifield - * self.loaded[ifield] = 0 - */ - __pyx_t_5 = PyBytes_FromString(__pyx_v_field_name->c_str()); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_6 = __Pyx_PyObject_Append(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_names, ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":422 - * # Does this leak? - * self.field_names.append(field_name.c_str()) - * self.field_ind[self.field_names[-1]] = ifield # <<<<<<<<<<<<<< - * self.loaded[ifield] = 0 - * # This all needs to be cleaned up in the deallocator - */ - __pyx_t_6 = PyInt_FromLong(__pyx_v_ifield); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = __Pyx_GetItemInt(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_names, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetItem(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_ind, __pyx_t_5, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":423 - * self.field_names.append(field_name.c_str()) - * self.field_ind[self.field_names[-1]] = ifield - * self.loaded[ifield] = 0 # <<<<<<<<<<<<<< - * # This all needs to be cleaned up in the deallocator - * - */ - (((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->loaded[__pyx_v_ifield]) = 0; - } - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("yt.ramses_reader.RAMSES_tree_proxy.__cinit__"); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":426 - * # This all needs to be cleaned up in the deallocator - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * cdef int idomain, ifield - * for idomain in range(self.ndomains): - */ - -static void __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy___dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy___dealloc__(PyObject *__pyx_v_self) { - int __pyx_v_idomain; - int __pyx_v_ifield; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - __Pyx_RefNannySetupContext("__dealloc__"); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":428 - * def __dealloc__(self): - * cdef int idomain, ifield - * for idomain in range(self.ndomains): # <<<<<<<<<<<<<< - * for ifield in range(self.nfields): - * if self.hydro_datas[idomain][ifield] != NULL: - */ - __pyx_t_1 = ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->ndomains; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_idomain = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":429 - * cdef int idomain, ifield - * for idomain in range(self.ndomains): - * for ifield in range(self.nfields): # <<<<<<<<<<<<<< - * if self.hydro_datas[idomain][ifield] != NULL: - * del self.hydro_datas[idomain][ifield] - */ - __pyx_t_3 = ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->nfields; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_ifield = __pyx_t_4; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":430 - * for idomain in range(self.ndomains): - * for ifield in range(self.nfields): - * if self.hydro_datas[idomain][ifield] != NULL: # <<<<<<<<<<<<<< - * del self.hydro_datas[idomain][ifield] - * if self.trees[idomain] != NULL: - */ - __pyx_t_5 = (((((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->hydro_datas[__pyx_v_idomain])[__pyx_v_ifield]) != NULL); - if (__pyx_t_5) { - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":431 - * for ifield in range(self.nfields): - * if self.hydro_datas[idomain][ifield] != NULL: - * del self.hydro_datas[idomain][ifield] # <<<<<<<<<<<<<< - * if self.trees[idomain] != NULL: - * del self.trees[idomain] - */ - delete ((((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->hydro_datas[__pyx_v_idomain])[__pyx_v_ifield]); - goto __pyx_L9; - } - __pyx_L9:; - } - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":432 - * if self.hydro_datas[idomain][ifield] != NULL: - * del self.hydro_datas[idomain][ifield] - * if self.trees[idomain] != NULL: # <<<<<<<<<<<<<< - * del self.trees[idomain] - * free(self.hydro_datas[idomain]) - */ - __pyx_t_5 = ((((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->trees[__pyx_v_idomain]) != NULL); - if (__pyx_t_5) { - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":433 - * del self.hydro_datas[idomain][ifield] - * if self.trees[idomain] != NULL: - * del self.trees[idomain] # <<<<<<<<<<<<<< - * free(self.hydro_datas[idomain]) - * free(self.trees) - */ - delete (((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->trees[__pyx_v_idomain]); - goto __pyx_L10; - } - __pyx_L10:; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":434 - * if self.trees[idomain] != NULL: - * del self.trees[idomain] - * free(self.hydro_datas[idomain]) # <<<<<<<<<<<<<< - * free(self.trees) - * free(self.hydro_datas) - */ - free((((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->hydro_datas[__pyx_v_idomain])); - } - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":435 - * del self.trees[idomain] - * free(self.hydro_datas[idomain]) - * free(self.trees) # <<<<<<<<<<<<<< - * free(self.hydro_datas) - * free(self.loaded) - */ - free(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->trees); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":436 - * free(self.hydro_datas[idomain]) - * free(self.trees) - * free(self.hydro_datas) # <<<<<<<<<<<<<< - * free(self.loaded) - * if self.snapshot_name != NULL: del self.snapshot_name - */ - free(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->hydro_datas); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":437 - * free(self.trees) - * free(self.hydro_datas) - * free(self.loaded) # <<<<<<<<<<<<<< - * if self.snapshot_name != NULL: del self.snapshot_name - * if self.rsnap != NULL: del self.rsnap - */ - free(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->loaded); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":438 - * free(self.hydro_datas) - * free(self.loaded) - * if self.snapshot_name != NULL: del self.snapshot_name # <<<<<<<<<<<<<< - * if self.rsnap != NULL: del self.rsnap - * - */ - __pyx_t_5 = (((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->snapshot_name != NULL); - if (__pyx_t_5) { - delete ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->snapshot_name; - goto __pyx_L11; - } - __pyx_L11:; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":439 - * free(self.loaded) - * if self.snapshot_name != NULL: del self.snapshot_name - * if self.rsnap != NULL: del self.rsnap # <<<<<<<<<<<<<< - * - * def count_zones(self): - */ - __pyx_t_5 = (((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap != NULL); - if (__pyx_t_5) { - delete ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap; - goto __pyx_L12; - } - __pyx_L12:; - - __Pyx_RefNannyFinishContext(); -} - -/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":441 - * if self.rsnap != NULL: del self.rsnap - * - * def count_zones(self): # <<<<<<<<<<<<<< - * # We need to do simulation domains here - * - */ - -static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_count_zones(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_count_zones(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - unsigned int __pyx_v_idomain; - unsigned int __pyx_v_ilevel; - RAMSES::AMR::RAMSES_tree *__pyx_v_local_tree; - RAMSES::HYDRO::RAMSES_hydro_data *__pyx_v_local_hydro_data; - RAMSES::AMR::RAMSES_level *__pyx_v_local_level; - PyObject *__pyx_v_cell_count; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - long __pyx_t_2; - unsigned int __pyx_t_3; - int __pyx_t_4; - long __pyx_t_5; - unsigned int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - __Pyx_RefNannySetupContext("count_zones"); - __pyx_v_cell_count = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":451 - * # All the loop-local pointers must be declared up here - * - * cell_count = [] # <<<<<<<<<<<<<< - * for ilevel in range(self.rsnap.m_header.levelmax + 1): - * cell_count.append(0) - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(((PyObject *)__pyx_v_cell_count)); - __pyx_v_cell_count = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":452 - * - * cell_count = [] - * for ilevel in range(self.rsnap.m_header.levelmax + 1): # <<<<<<<<<<<<<< - * cell_count.append(0) - * for idomain in range(1, self.rsnap.m_header.ncpu + 1): - */ - __pyx_t_2 = (((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.levelmax + 1); - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_ilevel = __pyx_t_3; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":453 - * cell_count = [] - * for ilevel in range(self.rsnap.m_header.levelmax + 1): - * cell_count.append(0) # <<<<<<<<<<<<<< - * for idomain in range(1, self.rsnap.m_header.ncpu + 1): - * local_tree = new RAMSES_tree(deref(self.rsnap), idomain, - */ - if (unlikely(__pyx_v_cell_count == Py_None)) { - PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = PyList_Append(((PyObject *)__pyx_v_cell_count), __pyx_int_0); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":454 - * for ilevel in range(self.rsnap.m_header.levelmax + 1): - * cell_count.append(0) - * for idomain in range(1, self.rsnap.m_header.ncpu + 1): # <<<<<<<<<<<<<< - * local_tree = new RAMSES_tree(deref(self.rsnap), idomain, - * self.rsnap.m_header.levelmax, 0) - */ - __pyx_t_2 = (((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.ncpu + 1); - for (__pyx_t_3 = 1; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_idomain = __pyx_t_3; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":456 - * for idomain in range(1, self.rsnap.m_header.ncpu + 1): - * local_tree = new RAMSES_tree(deref(self.rsnap), idomain, - * self.rsnap.m_header.levelmax, 0) # <<<<<<<<<<<<<< - * local_tree.read() - * local_hydro_data = new RAMSES_hydro_data(deref(local_tree)) - */ - __pyx_v_local_tree = new RAMSES::AMR::RAMSES_tree((*((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap), __pyx_v_idomain, ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.levelmax, 0); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":457 - * local_tree = new RAMSES_tree(deref(self.rsnap), idomain, - * self.rsnap.m_header.levelmax, 0) - * local_tree.read() # <<<<<<<<<<<<<< - * local_hydro_data = new RAMSES_hydro_data(deref(local_tree)) - * for ilevel in range(local_tree.m_maxlevel + 1): - */ - __pyx_v_local_tree->read(); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":458 - * self.rsnap.m_header.levelmax, 0) - * local_tree.read() - * local_hydro_data = new RAMSES_hydro_data(deref(local_tree)) # <<<<<<<<<<<<<< - * for ilevel in range(local_tree.m_maxlevel + 1): - * local_level = &local_tree.m_AMR_levels[ilevel] - */ - __pyx_v_local_hydro_data = new RAMSES::HYDRO::RAMSES_hydro_data((*__pyx_v_local_tree)); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":459 - * local_tree.read() - * local_hydro_data = new RAMSES_hydro_data(deref(local_tree)) - * for ilevel in range(local_tree.m_maxlevel + 1): # <<<<<<<<<<<<<< - * local_level = &local_tree.m_AMR_levels[ilevel] - * cell_count[ilevel] += local_level.size() - */ - __pyx_t_5 = (__pyx_v_local_tree->m_maxlevel + 1); - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_ilevel = __pyx_t_6; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":460 - * local_hydro_data = new RAMSES_hydro_data(deref(local_tree)) - * for ilevel in range(local_tree.m_maxlevel + 1): - * local_level = &local_tree.m_AMR_levels[ilevel] # <<<<<<<<<<<<<< - * cell_count[ilevel] += local_level.size() - * del local_tree, local_hydro_data - */ - __pyx_v_local_level = (&(__pyx_v_local_tree->m_AMR_levels[__pyx_v_ilevel])); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":461 - * for ilevel in range(local_tree.m_maxlevel + 1): - * local_level = &local_tree.m_AMR_levels[ilevel] - * cell_count[ilevel] += local_level.size() # <<<<<<<<<<<<<< - * del local_tree, local_hydro_data - * - */ - __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_local_level->size()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_cell_count), __pyx_v_ilevel, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyNumber_InPlaceAdd(__pyx_t_7, __pyx_t_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_cell_count), __pyx_v_ilevel, __pyx_t_8, sizeof(unsigned int)+1, PyLong_FromUnsignedLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":462 - * local_level = &local_tree.m_AMR_levels[ilevel] - * cell_count[ilevel] += local_level.size() - * del local_tree, local_hydro_data # <<<<<<<<<<<<<< - * - * return cell_count - */ - delete __pyx_v_local_tree; - delete __pyx_v_local_hydro_data; - } - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":464 - * del local_tree, local_hydro_data - * - * return cell_count # <<<<<<<<<<<<<< - * - * def ensure_loaded(self, char *varname, int domain_index): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_cell_count)); - __pyx_r = ((PyObject *)__pyx_v_cell_count); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("yt.ramses_reader.RAMSES_tree_proxy.count_zones"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF(__pyx_v_cell_count); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":466 - * return cell_count - * - * def ensure_loaded(self, char *varname, int domain_index): # <<<<<<<<<<<<<< - * # this domain_index must be zero-indexed - * cdef int varindex = self.field_ind[varname] - */ - -static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_ensure_loaded(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_ensure_loaded(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - char *__pyx_v_varname; - int __pyx_v_domain_index; - int __pyx_v_varindex; - std::string *__pyx_v_field_name; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__varname,&__pyx_n_s__domain_index,0}; - __Pyx_RefNannySetupContext("ensure_loaded"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__varname); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__domain_index); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("ensure_loaded", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "ensure_loaded") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_varname = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_varname) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_domain_index = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_domain_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_varname = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_varname) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_domain_index = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_domain_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("ensure_loaded", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.ramses_reader.RAMSES_tree_proxy.ensure_loaded"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":468 - * def ensure_loaded(self, char *varname, int domain_index): - * # this domain_index must be zero-indexed - * cdef int varindex = self.field_ind[varname] # <<<<<<<<<<<<<< - * cdef string *field_name = new string(varname) - * if self.loaded[varindex] == 1: return - */ - __pyx_t_1 = PyBytes_FromString(__pyx_v_varname); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = PyObject_GetItem(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_ind, ((PyObject *)__pyx_t_1)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_varindex = __pyx_t_3; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":469 - * # this domain_index must be zero-indexed - * cdef int varindex = self.field_ind[varname] - * cdef string *field_name = new string(varname) # <<<<<<<<<<<<<< - * if self.loaded[varindex] == 1: return - * print "READING FROM DISK", varname - */ - __pyx_v_field_name = new std::string(__pyx_v_varname); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":470 - * cdef int varindex = self.field_ind[varname] - * cdef string *field_name = new string(varname) - * if self.loaded[varindex] == 1: return # <<<<<<<<<<<<<< - * print "READING FROM DISK", varname - * self.hydro_datas[domain_index][varindex].read(deref(field_name)) - */ - __pyx_t_4 = ((((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->loaded[__pyx_v_varindex]) == 1); - if (__pyx_t_4) { - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - goto __pyx_L6; - } - __pyx_L6:; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":471 - * cdef string *field_name = new string(varname) - * if self.loaded[varindex] == 1: return - * print "READING FROM DISK", varname # <<<<<<<<<<<<<< - * self.hydro_datas[domain_index][varindex].read(deref(field_name)) - * self.loaded[varindex] = 1 - */ - __pyx_t_2 = PyBytes_FromString(__pyx_v_varname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); - PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); - __pyx_t_2 = 0; - if (__Pyx_Print(0, __pyx_t_1, 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":472 - * if self.loaded[varindex] == 1: return - * print "READING FROM DISK", varname - * self.hydro_datas[domain_index][varindex].read(deref(field_name)) # <<<<<<<<<<<<<< - * self.loaded[varindex] = 1 - * del field_name - */ - ((((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->hydro_datas[__pyx_v_domain_index])[__pyx_v_varindex])->read((*__pyx_v_field_name)); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":473 - * print "READING FROM DISK", varname - * self.hydro_datas[domain_index][varindex].read(deref(field_name)) - * self.loaded[varindex] = 1 # <<<<<<<<<<<<<< - * del field_name - * - */ - (((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->loaded[__pyx_v_varindex]) = 1; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":474 - * self.hydro_datas[domain_index][varindex].read(deref(field_name)) - * self.loaded[varindex] = 1 - * del field_name # <<<<<<<<<<<<<< - * - * def clear_tree(self, char *varname, int domain_index): - */ - delete __pyx_v_field_name; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("yt.ramses_reader.RAMSES_tree_proxy.ensure_loaded"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":476 - * del field_name - * - * def clear_tree(self, char *varname, int domain_index): # <<<<<<<<<<<<<< - * # this domain_index must be zero-indexed - * # We delete and re-create - */ - -static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_clear_tree(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_clear_tree(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - char *__pyx_v_varname; - int __pyx_v_domain_index; - int __pyx_v_varindex; - std::string *__pyx_v_field_name; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__varname,&__pyx_n_s__domain_index,0}; - __Pyx_RefNannySetupContext("clear_tree"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__varname); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__domain_index); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("clear_tree", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "clear_tree") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_varname = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_varname) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_domain_index = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_domain_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_varname = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_varname) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_domain_index = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_domain_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("clear_tree", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.ramses_reader.RAMSES_tree_proxy.clear_tree"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":479 - * # this domain_index must be zero-indexed - * # We delete and re-create - * cdef int varindex = self.field_ind[varname] # <<<<<<<<<<<<<< - * cdef string *field_name = new string(varname) - * if self.loaded[varindex] == 0: return - */ - __pyx_t_1 = PyBytes_FromString(__pyx_v_varname); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = PyObject_GetItem(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_ind, ((PyObject *)__pyx_t_1)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_varindex = __pyx_t_3; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":480 - * # We delete and re-create - * cdef int varindex = self.field_ind[varname] - * cdef string *field_name = new string(varname) # <<<<<<<<<<<<<< - * if self.loaded[varindex] == 0: return - * del self.hydro_datas[domain_index][varindex] - */ - __pyx_v_field_name = new std::string(__pyx_v_varname); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":481 - * cdef int varindex = self.field_ind[varname] - * cdef string *field_name = new string(varname) - * if self.loaded[varindex] == 0: return # <<<<<<<<<<<<<< - * del self.hydro_datas[domain_index][varindex] - * self.hydro_datas[domain_index - 1][varindex] = \ - */ - __pyx_t_4 = ((((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->loaded[__pyx_v_varindex]) == 0); - if (__pyx_t_4) { - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - goto __pyx_L6; - } - __pyx_L6:; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":482 - * cdef string *field_name = new string(varname) - * if self.loaded[varindex] == 0: return - * del self.hydro_datas[domain_index][varindex] # <<<<<<<<<<<<<< - * self.hydro_datas[domain_index - 1][varindex] = \ - * new RAMSES_hydro_data(deref(self.trees[domain_index])) - */ - delete ((((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->hydro_datas[__pyx_v_domain_index])[__pyx_v_varindex]); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":483 - * if self.loaded[varindex] == 0: return - * del self.hydro_datas[domain_index][varindex] - * self.hydro_datas[domain_index - 1][varindex] = \ # <<<<<<<<<<<<<< - * new RAMSES_hydro_data(deref(self.trees[domain_index])) - * self.loaded[varindex] = 0 - */ - ((((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->hydro_datas[(__pyx_v_domain_index - 1)])[__pyx_v_varindex]) = new RAMSES::HYDRO::RAMSES_hydro_data((*(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->trees[__pyx_v_domain_index]))); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":485 - * self.hydro_datas[domain_index - 1][varindex] = \ - * new RAMSES_hydro_data(deref(self.trees[domain_index])) - * self.loaded[varindex] = 0 # <<<<<<<<<<<<<< - * del field_name - * - */ - (((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->loaded[__pyx_v_varindex]) = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":486 - * new RAMSES_hydro_data(deref(self.trees[domain_index])) - * self.loaded[varindex] = 0 - * del field_name # <<<<<<<<<<<<<< - * - * def get_file_info(self): - */ - delete __pyx_v_field_name; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("yt.ramses_reader.RAMSES_tree_proxy.clear_tree"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":488 - * del field_name - * - * def get_file_info(self): # <<<<<<<<<<<<<< - * header_info = {} - * header_info["ncpu"] = self.rsnap.m_header.ncpu - */ - -static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_get_file_info(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_get_file_info(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_v_header_info; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("get_file_info"); - __pyx_v_header_info = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":489 - * - * def get_file_info(self): - * header_info = {} # <<<<<<<<<<<<<< - * header_info["ncpu"] = self.rsnap.m_header.ncpu - * header_info["ndim"] = self.rsnap.m_header.ndim - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(((PyObject *)__pyx_v_header_info)); - __pyx_v_header_info = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":490 - * def get_file_info(self): - * header_info = {} - * header_info["ncpu"] = self.rsnap.m_header.ncpu # <<<<<<<<<<<<<< - * header_info["ndim"] = self.rsnap.m_header.ndim - * header_info["levelmin"] = self.rsnap.m_header.levelmin - */ - __pyx_t_1 = PyLong_FromUnsignedLong(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.ncpu); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(((PyObject *)__pyx_v_header_info), ((PyObject *)__pyx_n_s__ncpu), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":491 - * header_info = {} - * header_info["ncpu"] = self.rsnap.m_header.ncpu - * header_info["ndim"] = self.rsnap.m_header.ndim # <<<<<<<<<<<<<< - * header_info["levelmin"] = self.rsnap.m_header.levelmin - * header_info["levelmax"] = self.rsnap.m_header.levelmax - */ - __pyx_t_1 = PyLong_FromUnsignedLong(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(((PyObject *)__pyx_v_header_info), ((PyObject *)__pyx_n_s__ndim), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":492 - * header_info["ncpu"] = self.rsnap.m_header.ncpu - * header_info["ndim"] = self.rsnap.m_header.ndim - * header_info["levelmin"] = self.rsnap.m_header.levelmin # <<<<<<<<<<<<<< - * header_info["levelmax"] = self.rsnap.m_header.levelmax - * header_info["ngridmax"] = self.rsnap.m_header.ngridmax - */ - __pyx_t_1 = PyLong_FromUnsignedLong(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.levelmin); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(((PyObject *)__pyx_v_header_info), ((PyObject *)__pyx_n_s__levelmin), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":493 - * header_info["ndim"] = self.rsnap.m_header.ndim - * header_info["levelmin"] = self.rsnap.m_header.levelmin - * header_info["levelmax"] = self.rsnap.m_header.levelmax # <<<<<<<<<<<<<< - * header_info["ngridmax"] = self.rsnap.m_header.ngridmax - * header_info["nstep_coarse"] = self.rsnap.m_header.nstep_coarse - */ - __pyx_t_1 = PyLong_FromUnsignedLong(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.levelmax); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(((PyObject *)__pyx_v_header_info), ((PyObject *)__pyx_n_s__levelmax), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":494 - * header_info["levelmin"] = self.rsnap.m_header.levelmin - * header_info["levelmax"] = self.rsnap.m_header.levelmax - * header_info["ngridmax"] = self.rsnap.m_header.ngridmax # <<<<<<<<<<<<<< - * header_info["nstep_coarse"] = self.rsnap.m_header.nstep_coarse - * header_info["boxlen"] = self.rsnap.m_header.boxlen - */ - __pyx_t_1 = PyLong_FromUnsignedLong(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.ngridmax); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(((PyObject *)__pyx_v_header_info), ((PyObject *)__pyx_n_s__ngridmax), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":495 - * header_info["levelmax"] = self.rsnap.m_header.levelmax - * header_info["ngridmax"] = self.rsnap.m_header.ngridmax - * header_info["nstep_coarse"] = self.rsnap.m_header.nstep_coarse # <<<<<<<<<<<<<< - * header_info["boxlen"] = self.rsnap.m_header.boxlen - * header_info["time"] = self.rsnap.m_header.time - */ - __pyx_t_1 = PyLong_FromUnsignedLong(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.nstep_coarse); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(((PyObject *)__pyx_v_header_info), ((PyObject *)__pyx_n_s__nstep_coarse), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":496 - * header_info["ngridmax"] = self.rsnap.m_header.ngridmax - * header_info["nstep_coarse"] = self.rsnap.m_header.nstep_coarse - * header_info["boxlen"] = self.rsnap.m_header.boxlen # <<<<<<<<<<<<<< - * header_info["time"] = self.rsnap.m_header.time - * header_info["aexp"] = self.rsnap.m_header.aexp - */ - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.boxlen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(((PyObject *)__pyx_v_header_info), ((PyObject *)__pyx_n_s__boxlen), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":497 - * header_info["nstep_coarse"] = self.rsnap.m_header.nstep_coarse - * header_info["boxlen"] = self.rsnap.m_header.boxlen - * header_info["time"] = self.rsnap.m_header.time # <<<<<<<<<<<<<< - * header_info["aexp"] = self.rsnap.m_header.aexp - * header_info["H0"] = self.rsnap.m_header.H0 - */ - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.time); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(((PyObject *)__pyx_v_header_info), ((PyObject *)__pyx_n_s__time), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":498 - * header_info["boxlen"] = self.rsnap.m_header.boxlen - * header_info["time"] = self.rsnap.m_header.time - * header_info["aexp"] = self.rsnap.m_header.aexp # <<<<<<<<<<<<<< - * header_info["H0"] = self.rsnap.m_header.H0 - * header_info["omega_m"] = self.rsnap.m_header.omega_m - */ - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.aexp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(((PyObject *)__pyx_v_header_info), ((PyObject *)__pyx_n_s__aexp), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":499 - * header_info["time"] = self.rsnap.m_header.time - * header_info["aexp"] = self.rsnap.m_header.aexp - * header_info["H0"] = self.rsnap.m_header.H0 # <<<<<<<<<<<<<< - * header_info["omega_m"] = self.rsnap.m_header.omega_m - * header_info["omega_l"] = self.rsnap.m_header.omega_l - */ - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.H0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(((PyObject *)__pyx_v_header_info), ((PyObject *)__pyx_n_s__H0), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":500 - * header_info["aexp"] = self.rsnap.m_header.aexp - * header_info["H0"] = self.rsnap.m_header.H0 - * header_info["omega_m"] = self.rsnap.m_header.omega_m # <<<<<<<<<<<<<< - * header_info["omega_l"] = self.rsnap.m_header.omega_l - * header_info["omega_k"] = self.rsnap.m_header.omega_k - */ - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.omega_m); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(((PyObject *)__pyx_v_header_info), ((PyObject *)__pyx_n_s__omega_m), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":501 - * header_info["H0"] = self.rsnap.m_header.H0 - * header_info["omega_m"] = self.rsnap.m_header.omega_m - * header_info["omega_l"] = self.rsnap.m_header.omega_l # <<<<<<<<<<<<<< - * header_info["omega_k"] = self.rsnap.m_header.omega_k - * header_info["omega_b"] = self.rsnap.m_header.omega_b - */ - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.omega_l); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(((PyObject *)__pyx_v_header_info), ((PyObject *)__pyx_n_s__omega_l), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":502 - * header_info["omega_m"] = self.rsnap.m_header.omega_m - * header_info["omega_l"] = self.rsnap.m_header.omega_l - * header_info["omega_k"] = self.rsnap.m_header.omega_k # <<<<<<<<<<<<<< - * header_info["omega_b"] = self.rsnap.m_header.omega_b - * header_info["unit_l"] = self.rsnap.m_header.unit_l - */ - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.omega_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(((PyObject *)__pyx_v_header_info), ((PyObject *)__pyx_n_s__omega_k), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":503 - * header_info["omega_l"] = self.rsnap.m_header.omega_l - * header_info["omega_k"] = self.rsnap.m_header.omega_k - * header_info["omega_b"] = self.rsnap.m_header.omega_b # <<<<<<<<<<<<<< - * header_info["unit_l"] = self.rsnap.m_header.unit_l - * header_info["unit_d"] = self.rsnap.m_header.unit_d - */ - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.omega_b); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(((PyObject *)__pyx_v_header_info), ((PyObject *)__pyx_n_s__omega_b), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":504 - * header_info["omega_k"] = self.rsnap.m_header.omega_k - * header_info["omega_b"] = self.rsnap.m_header.omega_b - * header_info["unit_l"] = self.rsnap.m_header.unit_l # <<<<<<<<<<<<<< - * header_info["unit_d"] = self.rsnap.m_header.unit_d - * header_info["unit_t"] = self.rsnap.m_header.unit_t - */ - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.unit_l); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(((PyObject *)__pyx_v_header_info), ((PyObject *)__pyx_n_s__unit_l), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":505 - * header_info["omega_b"] = self.rsnap.m_header.omega_b - * header_info["unit_l"] = self.rsnap.m_header.unit_l - * header_info["unit_d"] = self.rsnap.m_header.unit_d # <<<<<<<<<<<<<< - * header_info["unit_t"] = self.rsnap.m_header.unit_t - * return header_info - */ - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.unit_d); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(((PyObject *)__pyx_v_header_info), ((PyObject *)__pyx_n_s__unit_d), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":506 - * header_info["unit_l"] = self.rsnap.m_header.unit_l - * header_info["unit_d"] = self.rsnap.m_header.unit_d - * header_info["unit_t"] = self.rsnap.m_header.unit_t # <<<<<<<<<<<<<< - * return header_info - * - */ - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.unit_t); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(((PyObject *)__pyx_v_header_info), ((PyObject *)__pyx_n_s__unit_t), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":507 - * header_info["unit_d"] = self.rsnap.m_header.unit_d - * header_info["unit_t"] = self.rsnap.m_header.unit_t - * return header_info # <<<<<<<<<<<<<< - * - * def fill_hierarchy_arrays(self, - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_header_info)); - __pyx_r = ((PyObject *)__pyx_v_header_info); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("yt.ramses_reader.RAMSES_tree_proxy.get_file_info"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF(__pyx_v_header_info); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":509 - * return header_info - * - * def fill_hierarchy_arrays(self, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t, ndim=2] left_edges, - * np.ndarray[np.float64_t, ndim=2] right_edges, - */ - -static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_fill_hierarchy_arrays(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_fill_hierarchy_arrays(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_left_edges = 0; - PyArrayObject *__pyx_v_right_edges = 0; - PyArrayObject *__pyx_v_grid_levels = 0; - PyArrayObject *__pyx_v_grid_file_locations = 0; - PyArrayObject *__pyx_v_child_mask = 0; - unsigned int __pyx_v_idomain; - unsigned int __pyx_v_ilevel; - RAMSES::AMR::RAMSES_tree *__pyx_v_local_tree; - RAMSES::HYDRO::RAMSES_hydro_data *__pyx_v_local_hydro_data; - RAMSES::AMR::RAMSES_tree::iterator __pyx_v_grid_it; - RAMSES::AMR::RAMSES_tree::iterator __pyx_v_grid_end; - RAMSES::AMR::RAMSES_tree::iterator __pyx_v_father_it; - RAMSES::AMR::vec __pyx_v_gvec; - int __pyx_v_grid_ind; - unsigned int __pyx_v_parent_ind; - int __pyx_v_ci; - double __pyx_v_grid_half_width; - __pyx_t_5numpy_int32_t __pyx_v_rr; - PyObject *__pyx_v_cell_count; - PyObject *__pyx_v_level_cell_counts; - Py_buffer __pyx_bstruct_right_edges; - Py_ssize_t __pyx_bstride_0_right_edges = 0; - Py_ssize_t __pyx_bstride_1_right_edges = 0; - Py_ssize_t __pyx_bshape_0_right_edges = 0; - Py_ssize_t __pyx_bshape_1_right_edges = 0; - Py_buffer __pyx_bstruct_grid_levels; - Py_ssize_t __pyx_bstride_0_grid_levels = 0; - Py_ssize_t __pyx_bstride_1_grid_levels = 0; - Py_ssize_t __pyx_bshape_0_grid_levels = 0; - Py_ssize_t __pyx_bshape_1_grid_levels = 0; - Py_buffer __pyx_bstruct_grid_file_locations; - Py_ssize_t __pyx_bstride_0_grid_file_locations = 0; - Py_ssize_t __pyx_bstride_1_grid_file_locations = 0; - Py_ssize_t __pyx_bshape_0_grid_file_locations = 0; - Py_ssize_t __pyx_bshape_1_grid_file_locations = 0; - Py_buffer __pyx_bstruct_child_mask; - Py_ssize_t __pyx_bstride_0_child_mask = 0; - Py_ssize_t __pyx_bstride_1_child_mask = 0; - Py_ssize_t __pyx_bshape_0_child_mask = 0; - Py_ssize_t __pyx_bshape_1_child_mask = 0; - Py_buffer __pyx_bstruct_left_edges; - Py_ssize_t __pyx_bstride_0_left_edges = 0; - Py_ssize_t __pyx_bstride_1_left_edges = 0; - Py_ssize_t __pyx_bshape_0_left_edges = 0; - Py_ssize_t __pyx_bshape_1_left_edges = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - long __pyx_t_2; - unsigned int __pyx_t_3; - long __pyx_t_4; - unsigned int __pyx_t_5; - long __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - long __pyx_t_10; - int __pyx_t_11; - long __pyx_t_12; - int __pyx_t_13; - long __pyx_t_14; - int __pyx_t_15; - long __pyx_t_16; - int __pyx_t_17; - long __pyx_t_18; - int __pyx_t_19; - long __pyx_t_20; - int __pyx_t_21; - long __pyx_t_22; - int __pyx_t_23; - PyObject *__pyx_t_24 = NULL; - PyObject *__pyx_t_25 = NULL; - __pyx_t_5numpy_int64_t __pyx_t_26; - long __pyx_t_27; - int __pyx_t_28; - long __pyx_t_29; - int __pyx_t_30; - long __pyx_t_31; - int __pyx_t_32; - int __pyx_t_33; - int __pyx_t_34; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__left_edges,&__pyx_n_s__right_edges,&__pyx_n_s__grid_levels,&__pyx_n_s__grid_file_locations,&__pyx_n_s__child_mask,0}; - __Pyx_RefNannySetupContext("fill_hierarchy_arrays"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[5] = {0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left_edges); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right_edges); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("fill_hierarchy_arrays", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid_levels); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("fill_hierarchy_arrays", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid_file_locations); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("fill_hierarchy_arrays", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__child_mask); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("fill_hierarchy_arrays", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "fill_hierarchy_arrays") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_left_edges = ((PyArrayObject *)values[0]); - __pyx_v_right_edges = ((PyArrayObject *)values[1]); - __pyx_v_grid_levels = ((PyArrayObject *)values[2]); - __pyx_v_grid_file_locations = ((PyArrayObject *)values[3]); - __pyx_v_child_mask = ((PyArrayObject *)values[4]); - } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_left_edges = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_right_edges = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_grid_levels = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_grid_file_locations = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); - __pyx_v_child_mask = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("fill_hierarchy_arrays", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.ramses_reader.RAMSES_tree_proxy.fill_hierarchy_arrays"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_v_cell_count = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_level_cell_counts = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_bstruct_left_edges.buf = NULL; - __pyx_bstruct_right_edges.buf = NULL; - __pyx_bstruct_grid_levels.buf = NULL; - __pyx_bstruct_grid_file_locations.buf = NULL; - __pyx_bstruct_child_mask.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left_edges), __pyx_ptype_5numpy_ndarray, 1, "left_edges", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right_edges), __pyx_ptype_5numpy_ndarray, 1, "right_edges", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grid_levels), __pyx_ptype_5numpy_ndarray, 1, "grid_levels", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grid_file_locations), __pyx_ptype_5numpy_ndarray, 1, "grid_file_locations", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_child_mask), __pyx_ptype_5numpy_ndarray, 1, "child_mask", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_left_edges, (PyObject*)__pyx_v_left_edges, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_left_edges = __pyx_bstruct_left_edges.strides[0]; __pyx_bstride_1_left_edges = __pyx_bstruct_left_edges.strides[1]; - __pyx_bshape_0_left_edges = __pyx_bstruct_left_edges.shape[0]; __pyx_bshape_1_left_edges = __pyx_bstruct_left_edges.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_right_edges, (PyObject*)__pyx_v_right_edges, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_right_edges = __pyx_bstruct_right_edges.strides[0]; __pyx_bstride_1_right_edges = __pyx_bstruct_right_edges.strides[1]; - __pyx_bshape_0_right_edges = __pyx_bstruct_right_edges.shape[0]; __pyx_bshape_1_right_edges = __pyx_bstruct_right_edges.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_grid_levels, (PyObject*)__pyx_v_grid_levels, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_grid_levels = __pyx_bstruct_grid_levels.strides[0]; __pyx_bstride_1_grid_levels = __pyx_bstruct_grid_levels.strides[1]; - __pyx_bshape_0_grid_levels = __pyx_bstruct_grid_levels.shape[0]; __pyx_bshape_1_grid_levels = __pyx_bstruct_grid_levels.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_grid_file_locations, (PyObject*)__pyx_v_grid_file_locations, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_grid_file_locations = __pyx_bstruct_grid_file_locations.strides[0]; __pyx_bstride_1_grid_file_locations = __pyx_bstruct_grid_file_locations.strides[1]; - __pyx_bshape_0_grid_file_locations = __pyx_bstruct_grid_file_locations.shape[0]; __pyx_bshape_1_grid_file_locations = __pyx_bstruct_grid_file_locations.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_child_mask, (PyObject*)__pyx_v_child_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_child_mask = __pyx_bstruct_child_mask.strides[0]; __pyx_bstride_1_child_mask = __pyx_bstruct_child_mask.strides[1]; - __pyx_bshape_0_child_mask = __pyx_bstruct_child_mask.shape[0]; __pyx_bshape_1_child_mask = __pyx_bstruct_child_mask.shape[1]; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":526 - * cdef tree_iterator grid_it, grid_end, father_it - * cdef vec[double] gvec - * cdef int grid_ind = 0 # <<<<<<<<<<<<<< - * cdef unsigned parent_ind - * cdef bint ci - */ - __pyx_v_grid_ind = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":533 - * - * cdef np.int32_t rr - * cell_count = [] # <<<<<<<<<<<<<< - * level_cell_counts = {} - * for idomain in range(1, self.rsnap.m_header.ncpu + 1): - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(((PyObject *)__pyx_v_cell_count)); - __pyx_v_cell_count = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":534 - * cdef np.int32_t rr - * cell_count = [] - * level_cell_counts = {} # <<<<<<<<<<<<<< - * for idomain in range(1, self.rsnap.m_header.ncpu + 1): - * local_tree = new RAMSES_tree(deref(self.rsnap), idomain, - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(((PyObject *)__pyx_v_level_cell_counts)); - __pyx_v_level_cell_counts = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":535 - * cell_count = [] - * level_cell_counts = {} - * for idomain in range(1, self.rsnap.m_header.ncpu + 1): # <<<<<<<<<<<<<< - * local_tree = new RAMSES_tree(deref(self.rsnap), idomain, - * self.rsnap.m_header.levelmax, 0) - */ - __pyx_t_2 = (((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.ncpu + 1); - for (__pyx_t_3 = 1; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_idomain = __pyx_t_3; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":537 - * for idomain in range(1, self.rsnap.m_header.ncpu + 1): - * local_tree = new RAMSES_tree(deref(self.rsnap), idomain, - * self.rsnap.m_header.levelmax, 0) # <<<<<<<<<<<<<< - * local_tree.read() - * local_hydro_data = new RAMSES_hydro_data(deref(local_tree)) - */ - __pyx_v_local_tree = new RAMSES::AMR::RAMSES_tree((*((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap), __pyx_v_idomain, ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.levelmax, 0); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":538 - * local_tree = new RAMSES_tree(deref(self.rsnap), idomain, - * self.rsnap.m_header.levelmax, 0) - * local_tree.read() # <<<<<<<<<<<<<< - * local_hydro_data = new RAMSES_hydro_data(deref(local_tree)) - * for ilevel in range(local_tree.m_maxlevel + 1): - */ - __pyx_v_local_tree->read(); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":539 - * self.rsnap.m_header.levelmax, 0) - * local_tree.read() - * local_hydro_data = new RAMSES_hydro_data(deref(local_tree)) # <<<<<<<<<<<<<< - * for ilevel in range(local_tree.m_maxlevel + 1): - * # this gets overwritten for every domain, which is okay - */ - __pyx_v_local_hydro_data = new RAMSES::HYDRO::RAMSES_hydro_data((*__pyx_v_local_tree)); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":540 - * local_tree.read() - * local_hydro_data = new RAMSES_hydro_data(deref(local_tree)) - * for ilevel in range(local_tree.m_maxlevel + 1): # <<<<<<<<<<<<<< - * # this gets overwritten for every domain, which is okay - * level_cell_counts[ilevel] = grid_ind - */ - __pyx_t_4 = (__pyx_v_local_tree->m_maxlevel + 1); - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_ilevel = __pyx_t_5; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":542 - * for ilevel in range(local_tree.m_maxlevel + 1): - * # this gets overwritten for every domain, which is okay - * level_cell_counts[ilevel] = grid_ind # <<<<<<<<<<<<<< - * grid_half_width = self.rsnap.m_header.boxlen / (2**(ilevel + 1)) - * grid_it = local_tree.begin(ilevel) - */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_grid_ind); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_level_cell_counts), __pyx_v_ilevel, __pyx_t_1, sizeof(unsigned int)+1, PyLong_FromUnsignedLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":543 - * # this gets overwritten for every domain, which is okay - * level_cell_counts[ilevel] = grid_ind - * grid_half_width = self.rsnap.m_header.boxlen / (2**(ilevel + 1)) # <<<<<<<<<<<<<< - * grid_it = local_tree.begin(ilevel) - * grid_end = local_tree.end(ilevel) - */ - __pyx_t_6 = __Pyx_pow_long(2, (__pyx_v_ilevel + 1)); - if (unlikely(__pyx_t_6 == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_grid_half_width = (((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->rsnap->m_header.boxlen / __pyx_t_6); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":544 - * level_cell_counts[ilevel] = grid_ind - * grid_half_width = self.rsnap.m_header.boxlen / (2**(ilevel + 1)) - * grid_it = local_tree.begin(ilevel) # <<<<<<<<<<<<<< - * grid_end = local_tree.end(ilevel) - * while grid_it != grid_end: - */ - __pyx_v_grid_it = __pyx_v_local_tree->begin(__pyx_v_ilevel); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":545 - * grid_half_width = self.rsnap.m_header.boxlen / (2**(ilevel + 1)) - * grid_it = local_tree.begin(ilevel) - * grid_end = local_tree.end(ilevel) # <<<<<<<<<<<<<< - * while grid_it != grid_end: - * gvec = local_tree.grid_pos_double(grid_it) - */ - __pyx_v_grid_end = __pyx_v_local_tree->end(__pyx_v_ilevel); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":546 - * grid_it = local_tree.begin(ilevel) - * grid_end = local_tree.end(ilevel) - * while grid_it != grid_end: # <<<<<<<<<<<<<< - * gvec = local_tree.grid_pos_double(grid_it) - * left_edges[grid_ind, 0] = gvec.x - grid_half_width - */ - while (1) { - __pyx_t_7 = (__pyx_v_grid_it != __pyx_v_grid_end); - if (!__pyx_t_7) break; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":547 - * grid_end = local_tree.end(ilevel) - * while grid_it != grid_end: - * gvec = local_tree.grid_pos_double(grid_it) # <<<<<<<<<<<<<< - * left_edges[grid_ind, 0] = gvec.x - grid_half_width - * left_edges[grid_ind, 1] = gvec.y - grid_half_width - */ - __pyx_v_gvec = __pyx_v_local_tree->grid_pos(__pyx_v_grid_it); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":548 - * while grid_it != grid_end: - * gvec = local_tree.grid_pos_double(grid_it) - * left_edges[grid_ind, 0] = gvec.x - grid_half_width # <<<<<<<<<<<<<< - * left_edges[grid_ind, 1] = gvec.y - grid_half_width - * left_edges[grid_ind, 2] = gvec.z - grid_half_width - */ - __pyx_t_8 = __pyx_v_grid_ind; - __pyx_t_6 = 0; - __pyx_t_9 = -1; - if (__pyx_t_8 < 0) { - __pyx_t_8 += __pyx_bshape_0_left_edges; - if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_8 >= __pyx_bshape_0_left_edges)) __pyx_t_9 = 0; - if (__pyx_t_6 < 0) { - __pyx_t_6 += __pyx_bshape_1_left_edges; - if (unlikely(__pyx_t_6 < 0)) __pyx_t_9 = 1; - } else if (unlikely(__pyx_t_6 >= __pyx_bshape_1_left_edges)) __pyx_t_9 = 1; - if (unlikely(__pyx_t_9 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_9); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edges.buf, __pyx_t_8, __pyx_bstride_0_left_edges, __pyx_t_6, __pyx_bstride_1_left_edges) = (__pyx_v_gvec.x - __pyx_v_grid_half_width); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":549 - * gvec = local_tree.grid_pos_double(grid_it) - * left_edges[grid_ind, 0] = gvec.x - grid_half_width - * left_edges[grid_ind, 1] = gvec.y - grid_half_width # <<<<<<<<<<<<<< - * left_edges[grid_ind, 2] = gvec.z - grid_half_width - * right_edges[grid_ind, 0] = gvec.x + grid_half_width - */ - __pyx_t_9 = __pyx_v_grid_ind; - __pyx_t_10 = 1; - __pyx_t_11 = -1; - if (__pyx_t_9 < 0) { - __pyx_t_9 += __pyx_bshape_0_left_edges; - if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 0; - } else if (unlikely(__pyx_t_9 >= __pyx_bshape_0_left_edges)) __pyx_t_11 = 0; - if (__pyx_t_10 < 0) { - __pyx_t_10 += __pyx_bshape_1_left_edges; - if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 1; - } else if (unlikely(__pyx_t_10 >= __pyx_bshape_1_left_edges)) __pyx_t_11 = 1; - if (unlikely(__pyx_t_11 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_11); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edges.buf, __pyx_t_9, __pyx_bstride_0_left_edges, __pyx_t_10, __pyx_bstride_1_left_edges) = (__pyx_v_gvec.y - __pyx_v_grid_half_width); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":550 - * left_edges[grid_ind, 0] = gvec.x - grid_half_width - * left_edges[grid_ind, 1] = gvec.y - grid_half_width - * left_edges[grid_ind, 2] = gvec.z - grid_half_width # <<<<<<<<<<<<<< - * right_edges[grid_ind, 0] = gvec.x + grid_half_width - * right_edges[grid_ind, 1] = gvec.y + grid_half_width - */ - __pyx_t_11 = __pyx_v_grid_ind; - __pyx_t_12 = 2; - __pyx_t_13 = -1; - if (__pyx_t_11 < 0) { - __pyx_t_11 += __pyx_bshape_0_left_edges; - if (unlikely(__pyx_t_11 < 0)) __pyx_t_13 = 0; - } else if (unlikely(__pyx_t_11 >= __pyx_bshape_0_left_edges)) __pyx_t_13 = 0; - if (__pyx_t_12 < 0) { - __pyx_t_12 += __pyx_bshape_1_left_edges; - if (unlikely(__pyx_t_12 < 0)) __pyx_t_13 = 1; - } else if (unlikely(__pyx_t_12 >= __pyx_bshape_1_left_edges)) __pyx_t_13 = 1; - if (unlikely(__pyx_t_13 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_13); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edges.buf, __pyx_t_11, __pyx_bstride_0_left_edges, __pyx_t_12, __pyx_bstride_1_left_edges) = (__pyx_v_gvec.z - __pyx_v_grid_half_width); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":551 - * left_edges[grid_ind, 1] = gvec.y - grid_half_width - * left_edges[grid_ind, 2] = gvec.z - grid_half_width - * right_edges[grid_ind, 0] = gvec.x + grid_half_width # <<<<<<<<<<<<<< - * right_edges[grid_ind, 1] = gvec.y + grid_half_width - * right_edges[grid_ind, 2] = gvec.z + grid_half_width - */ - __pyx_t_13 = __pyx_v_grid_ind; - __pyx_t_14 = 0; - __pyx_t_15 = -1; - if (__pyx_t_13 < 0) { - __pyx_t_13 += __pyx_bshape_0_right_edges; - if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 0; - } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_right_edges)) __pyx_t_15 = 0; - if (__pyx_t_14 < 0) { - __pyx_t_14 += __pyx_bshape_1_right_edges; - if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 1; - } else if (unlikely(__pyx_t_14 >= __pyx_bshape_1_right_edges)) __pyx_t_15 = 1; - if (unlikely(__pyx_t_15 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_15); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edges.buf, __pyx_t_13, __pyx_bstride_0_right_edges, __pyx_t_14, __pyx_bstride_1_right_edges) = (__pyx_v_gvec.x + __pyx_v_grid_half_width); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":552 - * left_edges[grid_ind, 2] = gvec.z - grid_half_width - * right_edges[grid_ind, 0] = gvec.x + grid_half_width - * right_edges[grid_ind, 1] = gvec.y + grid_half_width # <<<<<<<<<<<<<< - * right_edges[grid_ind, 2] = gvec.z + grid_half_width - * grid_levels[grid_ind, 0] = ilevel - */ - __pyx_t_15 = __pyx_v_grid_ind; - __pyx_t_16 = 1; - __pyx_t_17 = -1; - if (__pyx_t_15 < 0) { - __pyx_t_15 += __pyx_bshape_0_right_edges; - if (unlikely(__pyx_t_15 < 0)) __pyx_t_17 = 0; - } else if (unlikely(__pyx_t_15 >= __pyx_bshape_0_right_edges)) __pyx_t_17 = 0; - if (__pyx_t_16 < 0) { - __pyx_t_16 += __pyx_bshape_1_right_edges; - if (unlikely(__pyx_t_16 < 0)) __pyx_t_17 = 1; - } else if (unlikely(__pyx_t_16 >= __pyx_bshape_1_right_edges)) __pyx_t_17 = 1; - if (unlikely(__pyx_t_17 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_17); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edges.buf, __pyx_t_15, __pyx_bstride_0_right_edges, __pyx_t_16, __pyx_bstride_1_right_edges) = (__pyx_v_gvec.y + __pyx_v_grid_half_width); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":553 - * right_edges[grid_ind, 0] = gvec.x + grid_half_width - * right_edges[grid_ind, 1] = gvec.y + grid_half_width - * right_edges[grid_ind, 2] = gvec.z + grid_half_width # <<<<<<<<<<<<<< - * grid_levels[grid_ind, 0] = ilevel - * # Now the harder part - */ - __pyx_t_17 = __pyx_v_grid_ind; - __pyx_t_18 = 2; - __pyx_t_19 = -1; - if (__pyx_t_17 < 0) { - __pyx_t_17 += __pyx_bshape_0_right_edges; - if (unlikely(__pyx_t_17 < 0)) __pyx_t_19 = 0; - } else if (unlikely(__pyx_t_17 >= __pyx_bshape_0_right_edges)) __pyx_t_19 = 0; - if (__pyx_t_18 < 0) { - __pyx_t_18 += __pyx_bshape_1_right_edges; - if (unlikely(__pyx_t_18 < 0)) __pyx_t_19 = 1; - } else if (unlikely(__pyx_t_18 >= __pyx_bshape_1_right_edges)) __pyx_t_19 = 1; - if (unlikely(__pyx_t_19 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_19); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edges.buf, __pyx_t_17, __pyx_bstride_0_right_edges, __pyx_t_18, __pyx_bstride_1_right_edges) = (__pyx_v_gvec.z + __pyx_v_grid_half_width); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":554 - * right_edges[grid_ind, 1] = gvec.y + grid_half_width - * right_edges[grid_ind, 2] = gvec.z + grid_half_width - * grid_levels[grid_ind, 0] = ilevel # <<<<<<<<<<<<<< - * # Now the harder part - * father_it = grid_it.get_parent() - */ - __pyx_t_19 = __pyx_v_grid_ind; - __pyx_t_20 = 0; - __pyx_t_21 = -1; - if (__pyx_t_19 < 0) { - __pyx_t_19 += __pyx_bshape_0_grid_levels; - if (unlikely(__pyx_t_19 < 0)) __pyx_t_21 = 0; - } else if (unlikely(__pyx_t_19 >= __pyx_bshape_0_grid_levels)) __pyx_t_21 = 0; - if (__pyx_t_20 < 0) { - __pyx_t_20 += __pyx_bshape_1_grid_levels; - if (unlikely(__pyx_t_20 < 0)) __pyx_t_21 = 1; - } else if (unlikely(__pyx_t_20 >= __pyx_bshape_1_grid_levels)) __pyx_t_21 = 1; - if (unlikely(__pyx_t_21 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_21); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_grid_levels.buf, __pyx_t_19, __pyx_bstride_0_grid_levels, __pyx_t_20, __pyx_bstride_1_grid_levels) = __pyx_v_ilevel; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":556 - * grid_levels[grid_ind, 0] = ilevel - * # Now the harder part - * father_it = grid_it.get_parent() # <<<<<<<<<<<<<< - * grid_file_locations[grid_ind, 0] = idomain - * grid_file_locations[grid_ind, 1] = grid_ind - level_cell_counts[ilevel] - */ - __pyx_v_father_it = __pyx_v_grid_it.get_parent(); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":557 - * # Now the harder part - * father_it = grid_it.get_parent() - * grid_file_locations[grid_ind, 0] = idomain # <<<<<<<<<<<<<< - * grid_file_locations[grid_ind, 1] = grid_ind - level_cell_counts[ilevel] - * parent_ind = father_it.get_absolute_position() - */ - __pyx_t_21 = __pyx_v_grid_ind; - __pyx_t_22 = 0; - __pyx_t_23 = -1; - if (__pyx_t_21 < 0) { - __pyx_t_21 += __pyx_bshape_0_grid_file_locations; - if (unlikely(__pyx_t_21 < 0)) __pyx_t_23 = 0; - } else if (unlikely(__pyx_t_21 >= __pyx_bshape_0_grid_file_locations)) __pyx_t_23 = 0; - if (__pyx_t_22 < 0) { - __pyx_t_22 += __pyx_bshape_1_grid_file_locations; - if (unlikely(__pyx_t_22 < 0)) __pyx_t_23 = 1; - } else if (unlikely(__pyx_t_22 >= __pyx_bshape_1_grid_file_locations)) __pyx_t_23 = 1; - if (unlikely(__pyx_t_23 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_23); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_grid_file_locations.buf, __pyx_t_21, __pyx_bstride_0_grid_file_locations, __pyx_t_22, __pyx_bstride_1_grid_file_locations) = ((__pyx_t_5numpy_int64_t)__pyx_v_idomain); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":558 - * father_it = grid_it.get_parent() - * grid_file_locations[grid_ind, 0] = idomain - * grid_file_locations[grid_ind, 1] = grid_ind - level_cell_counts[ilevel] # <<<<<<<<<<<<<< - * parent_ind = father_it.get_absolute_position() - * if ilevel > 0: - */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_grid_ind); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_24 = __Pyx_GetItemInt(((PyObject *)__pyx_v_level_cell_counts), __pyx_v_ilevel, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_24) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_24); - __pyx_t_25 = PyNumber_Subtract(__pyx_t_1, __pyx_t_24); if (unlikely(!__pyx_t_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_25); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; - __pyx_t_26 = __Pyx_PyInt_from_py_npy_int64(__pyx_t_25); if (unlikely((__pyx_t_26 == (npy_int64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; - __pyx_t_23 = __pyx_v_grid_ind; - __pyx_t_27 = 1; - __pyx_t_28 = -1; - if (__pyx_t_23 < 0) { - __pyx_t_23 += __pyx_bshape_0_grid_file_locations; - if (unlikely(__pyx_t_23 < 0)) __pyx_t_28 = 0; - } else if (unlikely(__pyx_t_23 >= __pyx_bshape_0_grid_file_locations)) __pyx_t_28 = 0; - if (__pyx_t_27 < 0) { - __pyx_t_27 += __pyx_bshape_1_grid_file_locations; - if (unlikely(__pyx_t_27 < 0)) __pyx_t_28 = 1; - } else if (unlikely(__pyx_t_27 >= __pyx_bshape_1_grid_file_locations)) __pyx_t_28 = 1; - if (unlikely(__pyx_t_28 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_28); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_grid_file_locations.buf, __pyx_t_23, __pyx_bstride_0_grid_file_locations, __pyx_t_27, __pyx_bstride_1_grid_file_locations) = __pyx_t_26; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":559 - * grid_file_locations[grid_ind, 0] = idomain - * grid_file_locations[grid_ind, 1] = grid_ind - level_cell_counts[ilevel] - * parent_ind = father_it.get_absolute_position() # <<<<<<<<<<<<<< - * if ilevel > 0: - * # We calculate the REAL parent index - */ - __pyx_v_parent_ind = __pyx_v_father_it.get_absolute_position(); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":560 - * grid_file_locations[grid_ind, 1] = grid_ind - level_cell_counts[ilevel] - * parent_ind = father_it.get_absolute_position() - * if ilevel > 0: # <<<<<<<<<<<<<< - * # We calculate the REAL parent index - * grid_file_locations[grid_ind, 2] = \ - */ - __pyx_t_7 = (__pyx_v_ilevel > 0); - if (__pyx_t_7) { - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":563 - * # We calculate the REAL parent index - * grid_file_locations[grid_ind, 2] = \ - * level_cell_counts[ilevel - 1] + parent_ind # <<<<<<<<<<<<<< - * else: - * grid_file_locations[grid_ind, 2] = -1 - */ - __pyx_t_29 = (__pyx_v_ilevel - 1); - __pyx_t_25 = __Pyx_GetItemInt(((PyObject *)__pyx_v_level_cell_counts), __pyx_t_29, sizeof(long), PyInt_FromLong); if (!__pyx_t_25) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_25); - __pyx_t_24 = PyLong_FromUnsignedLong(__pyx_v_parent_ind); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_24); - __pyx_t_1 = PyNumber_Add(__pyx_t_25, __pyx_t_24); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; - __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; - __pyx_t_26 = __Pyx_PyInt_from_py_npy_int64(__pyx_t_1); if (unlikely((__pyx_t_26 == (npy_int64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":562 - * if ilevel > 0: - * # We calculate the REAL parent index - * grid_file_locations[grid_ind, 2] = \ # <<<<<<<<<<<<<< - * level_cell_counts[ilevel - 1] + parent_ind - * else: - */ - __pyx_t_28 = __pyx_v_grid_ind; - __pyx_t_29 = 2; - __pyx_t_30 = -1; - if (__pyx_t_28 < 0) { - __pyx_t_28 += __pyx_bshape_0_grid_file_locations; - if (unlikely(__pyx_t_28 < 0)) __pyx_t_30 = 0; - } else if (unlikely(__pyx_t_28 >= __pyx_bshape_0_grid_file_locations)) __pyx_t_30 = 0; - if (__pyx_t_29 < 0) { - __pyx_t_29 += __pyx_bshape_1_grid_file_locations; - if (unlikely(__pyx_t_29 < 0)) __pyx_t_30 = 1; - } else if (unlikely(__pyx_t_29 >= __pyx_bshape_1_grid_file_locations)) __pyx_t_30 = 1; - if (unlikely(__pyx_t_30 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_30); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_grid_file_locations.buf, __pyx_t_28, __pyx_bstride_0_grid_file_locations, __pyx_t_29, __pyx_bstride_1_grid_file_locations) = __pyx_t_26; - goto __pyx_L12; - } - /*else*/ { - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":565 - * level_cell_counts[ilevel - 1] + parent_ind - * else: - * grid_file_locations[grid_ind, 2] = -1 # <<<<<<<<<<<<<< - * for ci in range(8): - * rr = grid_it.is_finest(ci) - */ - __pyx_t_30 = __pyx_v_grid_ind; - __pyx_t_31 = 2; - __pyx_t_32 = -1; - if (__pyx_t_30 < 0) { - __pyx_t_30 += __pyx_bshape_0_grid_file_locations; - if (unlikely(__pyx_t_30 < 0)) __pyx_t_32 = 0; - } else if (unlikely(__pyx_t_30 >= __pyx_bshape_0_grid_file_locations)) __pyx_t_32 = 0; - if (__pyx_t_31 < 0) { - __pyx_t_31 += __pyx_bshape_1_grid_file_locations; - if (unlikely(__pyx_t_31 < 0)) __pyx_t_32 = 1; - } else if (unlikely(__pyx_t_31 >= __pyx_bshape_1_grid_file_locations)) __pyx_t_32 = 1; - if (unlikely(__pyx_t_32 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_32); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_grid_file_locations.buf, __pyx_t_30, __pyx_bstride_0_grid_file_locations, __pyx_t_31, __pyx_bstride_1_grid_file_locations) = -1; - } - __pyx_L12:; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":566 - * else: - * grid_file_locations[grid_ind, 2] = -1 - * for ci in range(8): # <<<<<<<<<<<<<< - * rr = grid_it.is_finest(ci) - * child_mask[grid_ind, ci] = rr - */ - for (__pyx_t_7 = 0; __pyx_t_7 < 8; __pyx_t_7+=1) { - __pyx_v_ci = __pyx_t_7; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":567 - * grid_file_locations[grid_ind, 2] = -1 - * for ci in range(8): - * rr = grid_it.is_finest(ci) # <<<<<<<<<<<<<< - * child_mask[grid_ind, ci] = rr - * grid_ind += 1 - */ - __pyx_v_rr = ((__pyx_t_5numpy_int32_t)__pyx_v_grid_it.is_finest(__pyx_v_ci)); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":568 - * for ci in range(8): - * rr = grid_it.is_finest(ci) - * child_mask[grid_ind, ci] = rr # <<<<<<<<<<<<<< - * grid_ind += 1 - * grid_it.next() - */ - __pyx_t_32 = __pyx_v_grid_ind; - __pyx_t_33 = __pyx_v_ci; - __pyx_t_34 = -1; - if (__pyx_t_32 < 0) { - __pyx_t_32 += __pyx_bshape_0_child_mask; - if (unlikely(__pyx_t_32 < 0)) __pyx_t_34 = 0; - } else if (unlikely(__pyx_t_32 >= __pyx_bshape_0_child_mask)) __pyx_t_34 = 0; - if (__pyx_t_33 < 0) { - __pyx_t_33 += __pyx_bshape_1_child_mask; - if (unlikely(__pyx_t_33 < 0)) __pyx_t_34 = 1; - } else if (unlikely(__pyx_t_33 >= __pyx_bshape_1_child_mask)) __pyx_t_34 = 1; - if (unlikely(__pyx_t_34 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_34); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_child_mask.buf, __pyx_t_32, __pyx_bstride_0_child_mask, __pyx_t_33, __pyx_bstride_1_child_mask) = __pyx_v_rr; - } - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":569 - * rr = grid_it.is_finest(ci) - * child_mask[grid_ind, ci] = rr - * grid_ind += 1 # <<<<<<<<<<<<<< - * grid_it.next() - * del local_tree, local_hydro_data - */ - __pyx_v_grid_ind += 1; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":570 - * child_mask[grid_ind, ci] = rr - * grid_ind += 1 - * grid_it.next() # <<<<<<<<<<<<<< - * del local_tree, local_hydro_data - * - */ - __pyx_v_grid_it.next(); - } - } - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":571 - * grid_ind += 1 - * grid_it.next() - * del local_tree, local_hydro_data # <<<<<<<<<<<<<< - * - * def read_oct_grid(self, char *field, int level, int domain, int grid_id): - */ - delete __pyx_v_local_tree; - delete __pyx_v_local_hydro_data; - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_24); - __Pyx_XDECREF(__pyx_t_25); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_right_edges); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_levels); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_file_locations); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_child_mask); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edges); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.ramses_reader.RAMSES_tree_proxy.fill_hierarchy_arrays"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_right_edges); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_levels); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_file_locations); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_child_mask); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edges); - __pyx_L2:; - __Pyx_DECREF(__pyx_v_cell_count); - __Pyx_DECREF(__pyx_v_level_cell_counts); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":573 - * del local_tree, local_hydro_data - * - * def read_oct_grid(self, char *field, int level, int domain, int grid_id): # <<<<<<<<<<<<<< - * - * self.ensure_loaded(field, domain - 1) - */ - -static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_read_oct_grid(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_read_oct_grid(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - char *__pyx_v_field; - int __pyx_v_level; - int __pyx_v_domain; - int __pyx_v_grid_id; - int __pyx_v_varindex; - int __pyx_v_i; - PyArrayObject *__pyx_v_tr = 0; - double *__pyx_v_data; - RAMSES::AMR::RAMSES_tree *__pyx_v_local_tree; - RAMSES::HYDRO::RAMSES_hydro_data *__pyx_v_local_hydro_data; - Py_buffer __pyx_bstruct_tr; - Py_ssize_t __pyx_bstride_0_tr = 0; - Py_ssize_t __pyx_bstride_1_tr = 0; - Py_ssize_t __pyx_bstride_2_tr = 0; - Py_ssize_t __pyx_bshape_0_tr = 0; - Py_ssize_t __pyx_bshape_1_tr = 0; - Py_ssize_t __pyx_bshape_2_tr = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyArrayObject *__pyx_t_6 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__field,&__pyx_n_s__level,&__pyx_n_s__domain,&__pyx_n_s__grid_id,0}; - __Pyx_RefNannySetupContext("read_oct_grid"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[4] = {0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__field); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__level); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("read_oct_grid", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__domain); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("read_oct_grid", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid_id); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("read_oct_grid", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "read_oct_grid") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_field = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_field) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_level = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_domain = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_domain == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_grid_id = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_grid_id == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_field = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_field) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_level = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_domain = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_domain == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_grid_id = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_grid_id == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("read_oct_grid", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.ramses_reader.RAMSES_tree_proxy.read_oct_grid"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_tr.buf = NULL; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":575 - * def read_oct_grid(self, char *field, int level, int domain, int grid_id): - * - * self.ensure_loaded(field, domain - 1) # <<<<<<<<<<<<<< - * cdef int varindex = self.field_ind[field] - * cdef int i - */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ensure_loaded); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyBytes_FromString(__pyx_v_field); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_3 = PyInt_FromLong((__pyx_v_domain - 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":576 - * - * self.ensure_loaded(field, domain - 1) - * cdef int varindex = self.field_ind[field] # <<<<<<<<<<<<<< - * cdef int i - * - */ - __pyx_t_3 = PyBytes_FromString(__pyx_v_field); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_4 = PyObject_GetItem(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_ind, ((PyObject *)__pyx_t_3)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_varindex = __pyx_t_5; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":579 - * cdef int i - * - * cdef np.ndarray[np.float64_t, ndim=3] tr = np.empty((2,2,2), dtype='float64', # <<<<<<<<<<<<<< - * order='F') - * cdef tree_iterator grid_it, grid_end - */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_int_2); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_2); - __Pyx_GIVEREF(__pyx_int_2); - __Pyx_INCREF(__pyx_int_2); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_2); - __Pyx_GIVEREF(__pyx_int_2); - __Pyx_INCREF(__pyx_int_2); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_2); - __Pyx_GIVEREF(__pyx_int_2); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__F)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_1, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = ((PyArrayObject *)__pyx_t_2); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_tr, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) { - __pyx_v_tr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_tr.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_tr = __pyx_bstruct_tr.strides[0]; __pyx_bstride_1_tr = __pyx_bstruct_tr.strides[1]; __pyx_bstride_2_tr = __pyx_bstruct_tr.strides[2]; - __pyx_bshape_0_tr = __pyx_bstruct_tr.shape[0]; __pyx_bshape_1_tr = __pyx_bstruct_tr.shape[1]; __pyx_bshape_2_tr = __pyx_bstruct_tr.shape[2]; - } - } - __pyx_t_6 = 0; - __pyx_v_tr = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":582 - * order='F') - * cdef tree_iterator grid_it, grid_end - * cdef double* data = tr.data # <<<<<<<<<<<<<< - * - * cdef RAMSES_tree *local_tree = self.trees[domain - 1] - */ - __pyx_v_data = ((double *)__pyx_v_tr->data); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":584 - * cdef double* data = tr.data - * - * cdef RAMSES_tree *local_tree = self.trees[domain - 1] # <<<<<<<<<<<<<< - * cdef RAMSES_hydro_data *local_hydro_data = self.hydro_datas[domain - 1][varindex] - * - */ - __pyx_v_local_tree = (((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->trees[(__pyx_v_domain - 1)]); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":585 - * - * cdef RAMSES_tree *local_tree = self.trees[domain - 1] - * cdef RAMSES_hydro_data *local_hydro_data = self.hydro_datas[domain - 1][varindex] # <<<<<<<<<<<<<< - * - * #inline ValueType_& cell_value( const typename TreeType_::iterator& it, - */ - __pyx_v_local_hydro_data = ((((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->hydro_datas[(__pyx_v_domain - 1)])[__pyx_v_varindex]); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":595 - * #} - * - * for i in range(8): # <<<<<<<<<<<<<< - * data[i] = local_hydro_data.m_var_array[level][8*grid_id+i] - * return tr - */ - for (__pyx_t_5 = 0; __pyx_t_5 < 8; __pyx_t_5+=1) { - __pyx_v_i = __pyx_t_5; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":596 - * - * for i in range(8): - * data[i] = local_hydro_data.m_var_array[level][8*grid_id+i] # <<<<<<<<<<<<<< - * return tr - * - */ - (__pyx_v_data[__pyx_v_i]) = ((__pyx_v_local_hydro_data->m_var_array[__pyx_v_level])[((8 * __pyx_v_grid_id) + __pyx_v_i)]); - } - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":597 - * for i in range(8): - * data[i] = local_hydro_data.m_var_array[level][8*grid_id+i] - * return tr # <<<<<<<<<<<<<< - * - * def read_grid(self, char *field, - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_tr)); - __pyx_r = ((PyObject *)__pyx_v_tr); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_tr); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.ramses_reader.RAMSES_tree_proxy.read_oct_grid"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_tr); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_tr); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":599 - * return tr - * - * def read_grid(self, char *field, # <<<<<<<<<<<<<< - * np.ndarray[np.int64_t, ndim=1] start_index, - * np.ndarray[np.int32_t, ndim=1] grid_dims, - */ - -static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_read_grid(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_read_grid(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - char *__pyx_v_field; - PyArrayObject *__pyx_v_start_index = 0; - PyArrayObject *__pyx_v_grid_dims = 0; - PyArrayObject *__pyx_v_data = 0; - PyArrayObject *__pyx_v_filled = 0; - int __pyx_v_level; - int __pyx_v_ref_factor; - PyObject *__pyx_v_component_grid_info = 0; - int __pyx_v_varindex; - RAMSES::AMR::RAMSES_tree *__pyx_v_local_tree; - RAMSES::HYDRO::RAMSES_hydro_data *__pyx_v_local_hydro_data; - int __pyx_v_gi; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - int __pyx_v_domain; - int __pyx_v_offset; - int __pyx_v_ir; - int __pyx_v_jr; - int __pyx_v_kr; - int __pyx_v_offi; - int __pyx_v_offj; - int __pyx_v_offk; - __pyx_t_5numpy_int64_t __pyx_v_di; - __pyx_t_5numpy_int64_t __pyx_v_dj; - __pyx_t_5numpy_int64_t __pyx_v_dk; - PyArrayObject *__pyx_v_ogrid_info; - PyArrayObject *__pyx_v_og_start_index; - __pyx_t_5numpy_float64_t __pyx_v_temp_data; - __pyx_t_5numpy_int64_t __pyx_v_end_index[3]; - int __pyx_v_to_fill; - PyObject *__pyx_v_odind; - Py_buffer __pyx_bstruct_grid_dims; - Py_ssize_t __pyx_bstride_0_grid_dims = 0; - Py_ssize_t __pyx_bshape_0_grid_dims = 0; - Py_buffer __pyx_bstruct_og_start_index; - Py_ssize_t __pyx_bstride_0_og_start_index = 0; - Py_ssize_t __pyx_bshape_0_og_start_index = 0; - Py_buffer __pyx_bstruct_ogrid_info; - Py_ssize_t __pyx_bstride_0_ogrid_info = 0; - Py_ssize_t __pyx_bshape_0_ogrid_info = 0; - Py_buffer __pyx_bstruct_filled; - Py_ssize_t __pyx_bstride_0_filled = 0; - Py_ssize_t __pyx_bstride_1_filled = 0; - Py_ssize_t __pyx_bstride_2_filled = 0; - Py_ssize_t __pyx_bshape_0_filled = 0; - Py_ssize_t __pyx_bshape_1_filled = 0; - Py_ssize_t __pyx_bshape_2_filled = 0; - Py_buffer __pyx_bstruct_data; - Py_ssize_t __pyx_bstride_0_data = 0; - Py_ssize_t __pyx_bstride_1_data = 0; - Py_ssize_t __pyx_bstride_2_data = 0; - Py_ssize_t __pyx_bshape_0_data = 0; - Py_ssize_t __pyx_bshape_1_data = 0; - Py_ssize_t __pyx_bshape_2_data = 0; - Py_buffer __pyx_bstruct_start_index; - Py_ssize_t __pyx_bstride_0_start_index = 0; - Py_ssize_t __pyx_bshape_0_start_index = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - Py_ssize_t __pyx_t_7; - PyArrayObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - long __pyx_t_12; - PyObject *__pyx_t_13 = NULL; - PyObject *__pyx_t_14 = NULL; - long __pyx_t_15; - PyArrayObject *__pyx_t_16 = NULL; - long __pyx_t_17; - long __pyx_t_18; - int __pyx_t_19; - long __pyx_t_20; - int __pyx_t_21; - int __pyx_t_22; - int __pyx_t_23; - long __pyx_t_24; - long __pyx_t_25; - int __pyx_t_26; - long __pyx_t_27; - long __pyx_t_28; - long __pyx_t_29; - int __pyx_t_30; - long __pyx_t_31; - long __pyx_t_32; - long __pyx_t_33; - long __pyx_t_34; - int __pyx_t_35; - int __pyx_t_36; - int __pyx_t_37; - int __pyx_t_38; - int __pyx_t_39; - int __pyx_t_40; - int __pyx_t_41; - int __pyx_t_42; - int __pyx_t_43; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__field,&__pyx_n_s__start_index,&__pyx_n_s__grid_dims,&__pyx_n_s__data,&__pyx_n_s__filled,&__pyx_n_s__level,&__pyx_n_s__ref_factor,&__pyx_n_s__component_grid_info,0}; - __Pyx_RefNannySetupContext("read_grid"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[8] = {0,0,0,0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__field); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start_index); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("read_grid", 1, 8, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid_dims); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("read_grid", 1, 8, 8, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("read_grid", 1, 8, 8, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filled); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("read_grid", 1, 8, 8, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__level); - if (likely(values[5])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("read_grid", 1, 8, 8, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 6: - values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref_factor); - if (likely(values[6])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("read_grid", 1, 8, 8, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 7: - values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__component_grid_info); - if (likely(values[7])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("read_grid", 1, 8, 8, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "read_grid") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_field = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_field) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_start_index = ((PyArrayObject *)values[1]); - __pyx_v_grid_dims = ((PyArrayObject *)values[2]); - __pyx_v_data = ((PyArrayObject *)values[3]); - __pyx_v_filled = ((PyArrayObject *)values[4]); - __pyx_v_level = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_ref_factor = __Pyx_PyInt_AsInt(values[6]); if (unlikely((__pyx_v_ref_factor == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_component_grid_info = values[7]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_field = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_field) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_start_index = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_grid_dims = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_data = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); - __pyx_v_filled = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); - __pyx_v_level = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_ref_factor = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 6)); if (unlikely((__pyx_v_ref_factor == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_component_grid_info = PyTuple_GET_ITEM(__pyx_args, 7); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("read_grid", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.ramses_reader.RAMSES_tree_proxy.read_grid"); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_v_ogrid_info = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_og_start_index = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_odind = Py_None; __Pyx_INCREF(Py_None); - __pyx_bstruct_ogrid_info.buf = NULL; - __pyx_bstruct_og_start_index.buf = NULL; - __pyx_bstruct_start_index.buf = NULL; - __pyx_bstruct_grid_dims.buf = NULL; - __pyx_bstruct_data.buf = NULL; - __pyx_bstruct_filled.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_start_index), __pyx_ptype_5numpy_ndarray, 1, "start_index", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grid_dims), __pyx_ptype_5numpy_ndarray, 1, "grid_dims", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), __pyx_ptype_5numpy_ndarray, 1, "data", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filled), __pyx_ptype_5numpy_ndarray, 1, "filled", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_start_index, (PyObject*)__pyx_v_start_index, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_start_index = __pyx_bstruct_start_index.strides[0]; - __pyx_bshape_0_start_index = __pyx_bstruct_start_index.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_grid_dims, (PyObject*)__pyx_v_grid_dims, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_grid_dims = __pyx_bstruct_grid_dims.strides[0]; - __pyx_bshape_0_grid_dims = __pyx_bstruct_grid_dims.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_data, (PyObject*)__pyx_v_data, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_data = __pyx_bstruct_data.strides[0]; __pyx_bstride_1_data = __pyx_bstruct_data.strides[1]; __pyx_bstride_2_data = __pyx_bstruct_data.strides[2]; - __pyx_bshape_0_data = __pyx_bstruct_data.shape[0]; __pyx_bshape_1_data = __pyx_bstruct_data.shape[1]; __pyx_bshape_2_data = __pyx_bstruct_data.shape[2]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_filled, (PyObject*)__pyx_v_filled, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_filled = __pyx_bstruct_filled.strides[0]; __pyx_bstride_1_filled = __pyx_bstruct_filled.strides[1]; __pyx_bstride_2_filled = __pyx_bstruct_filled.strides[2]; - __pyx_bshape_0_filled = __pyx_bstruct_filled.shape[0]; __pyx_bshape_1_filled = __pyx_bstruct_filled.shape[1]; __pyx_bshape_2_filled = __pyx_bstruct_filled.shape[2]; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":606 - * int level, int ref_factor, - * component_grid_info): - * cdef int varindex = self.field_ind[field] # <<<<<<<<<<<<<< - * cdef RAMSES_tree *local_tree = NULL - * cdef RAMSES_hydro_data *local_hydro_data = NULL - */ - __pyx_t_1 = PyBytes_FromString(__pyx_v_field); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = PyObject_GetItem(((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->field_ind, ((PyObject *)__pyx_t_1)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_varindex = __pyx_t_3; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":607 - * component_grid_info): - * cdef int varindex = self.field_ind[field] - * cdef RAMSES_tree *local_tree = NULL # <<<<<<<<<<<<<< - * cdef RAMSES_hydro_data *local_hydro_data = NULL - * - */ - __pyx_v_local_tree = NULL; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":608 - * cdef int varindex = self.field_ind[field] - * cdef RAMSES_tree *local_tree = NULL - * cdef RAMSES_hydro_data *local_hydro_data = NULL # <<<<<<<<<<<<<< - * - * cdef int gi, i, j, k, domain, offset - */ - __pyx_v_local_hydro_data = NULL; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":618 - * cdef np.float64_t temp_data - * cdef np.int64_t end_index[3] - * cdef int to_fill = 0 # <<<<<<<<<<<<<< - * # Note that indexing into a cell is: - * # (k*2 + j)*2 + i - */ - __pyx_v_to_fill = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":621 - * # Note that indexing into a cell is: - * # (k*2 + j)*2 + i - * for i in range(3): # <<<<<<<<<<<<<< - * end_index[i] = start_index[i] + grid_dims[i] - * for gi in range(len(component_grid_info)): - */ - for (__pyx_t_3 = 0; __pyx_t_3 < 3; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":622 - * # (k*2 + j)*2 + i - * for i in range(3): - * end_index[i] = start_index[i] + grid_dims[i] # <<<<<<<<<<<<<< - * for gi in range(len(component_grid_info)): - * ogrid_info = component_grid_info[gi] - */ - __pyx_t_4 = __pyx_v_i; - __pyx_t_5 = -1; - if (__pyx_t_4 < 0) { - __pyx_t_4 += __pyx_bshape_0_start_index; - if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0; - } else if (unlikely(__pyx_t_4 >= __pyx_bshape_0_start_index)) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_5 = __pyx_v_i; - __pyx_t_6 = -1; - if (__pyx_t_5 < 0) { - __pyx_t_5 += __pyx_bshape_0_grid_dims; - if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0; - } else if (unlikely(__pyx_t_5 >= __pyx_bshape_0_grid_dims)) __pyx_t_6 = 0; - if (unlikely(__pyx_t_6 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_6); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - (__pyx_v_end_index[__pyx_v_i]) = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_start_index.buf, __pyx_t_4, __pyx_bstride_0_start_index)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_grid_dims.buf, __pyx_t_5, __pyx_bstride_0_grid_dims))); - } - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":623 - * for i in range(3): - * end_index[i] = start_index[i] + grid_dims[i] - * for gi in range(len(component_grid_info)): # <<<<<<<<<<<<<< - * ogrid_info = component_grid_info[gi] - * domain = ogrid_info[0] - */ - __pyx_t_7 = PyObject_Length(__pyx_v_component_grid_info); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_7; __pyx_t_3+=1) { - __pyx_v_gi = __pyx_t_3; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":624 - * end_index[i] = start_index[i] + grid_dims[i] - * for gi in range(len(component_grid_info)): - * ogrid_info = component_grid_info[gi] # <<<<<<<<<<<<<< - * domain = ogrid_info[0] - * self.ensure_loaded(field, domain - 1) - */ - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_component_grid_info, __pyx_v_gi, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = ((PyArrayObject *)__pyx_t_2); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ogrid_info); - __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_ogrid_info, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_6 < 0)) { - PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_ogrid_info, (PyObject*)__pyx_v_ogrid_info, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11); - } - } - __pyx_bstride_0_ogrid_info = __pyx_bstruct_ogrid_info.strides[0]; - __pyx_bshape_0_ogrid_info = __pyx_bstruct_ogrid_info.shape[0]; - if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_8 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_ogrid_info)); - __pyx_v_ogrid_info = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":625 - * for gi in range(len(component_grid_info)): - * ogrid_info = component_grid_info[gi] - * domain = ogrid_info[0] # <<<<<<<<<<<<<< - * self.ensure_loaded(field, domain - 1) - * local_tree = self.trees[domain - 1] - */ - __pyx_t_12 = 0; - __pyx_t_6 = -1; - if (__pyx_t_12 < 0) { - __pyx_t_12 += __pyx_bshape_0_ogrid_info; - if (unlikely(__pyx_t_12 < 0)) __pyx_t_6 = 0; - } else if (unlikely(__pyx_t_12 >= __pyx_bshape_0_ogrid_info)) __pyx_t_6 = 0; - if (unlikely(__pyx_t_6 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_6); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_domain = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_ogrid_info.buf, __pyx_t_12, __pyx_bstride_0_ogrid_info)); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":626 - * ogrid_info = component_grid_info[gi] - * domain = ogrid_info[0] - * self.ensure_loaded(field, domain - 1) # <<<<<<<<<<<<<< - * local_tree = self.trees[domain - 1] - * local_hydro_data = self.hydro_datas[domain - 1][varindex] - */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ensure_loaded); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyBytes_FromString(__pyx_v_field); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_13 = PyInt_FromLong((__pyx_v_domain - 1)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_t_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_13); - __Pyx_GIVEREF(__pyx_t_13); - __pyx_t_1 = 0; - __pyx_t_13 = 0; - __pyx_t_13 = PyObject_Call(__pyx_t_2, __pyx_t_14, NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":627 - * domain = ogrid_info[0] - * self.ensure_loaded(field, domain - 1) - * local_tree = self.trees[domain - 1] # <<<<<<<<<<<<<< - * local_hydro_data = self.hydro_datas[domain - 1][varindex] - * offset = ogrid_info[1] - */ - __pyx_v_local_tree = (((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->trees[(__pyx_v_domain - 1)]); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":628 - * self.ensure_loaded(field, domain - 1) - * local_tree = self.trees[domain - 1] - * local_hydro_data = self.hydro_datas[domain - 1][varindex] # <<<<<<<<<<<<<< - * offset = ogrid_info[1] - * og_start_index = ogrid_info[3:] - */ - __pyx_v_local_hydro_data = ((((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)__pyx_v_self)->hydro_datas[(__pyx_v_domain - 1)])[__pyx_v_varindex]); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":629 - * local_tree = self.trees[domain - 1] - * local_hydro_data = self.hydro_datas[domain - 1][varindex] - * offset = ogrid_info[1] # <<<<<<<<<<<<<< - * og_start_index = ogrid_info[3:] - * for i in range(2*ref_factor): - */ - __pyx_t_15 = 1; - __pyx_t_6 = -1; - if (__pyx_t_15 < 0) { - __pyx_t_15 += __pyx_bshape_0_ogrid_info; - if (unlikely(__pyx_t_15 < 0)) __pyx_t_6 = 0; - } else if (unlikely(__pyx_t_15 >= __pyx_bshape_0_ogrid_info)) __pyx_t_6 = 0; - if (unlikely(__pyx_t_6 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_6); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_offset = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_ogrid_info.buf, __pyx_t_15, __pyx_bstride_0_ogrid_info)); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":630 - * local_hydro_data = self.hydro_datas[domain - 1][varindex] - * offset = ogrid_info[1] - * og_start_index = ogrid_info[3:] # <<<<<<<<<<<<<< - * for i in range(2*ref_factor): - * di = i + og_start_index[0] * ref_factor - */ - __pyx_t_13 = PySequence_GetSlice(((PyObject *)__pyx_v_ogrid_info), 3, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_13); - if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_16 = ((PyArrayObject *)__pyx_t_13); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_og_start_index); - __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_og_start_index, (PyObject*)__pyx_t_16, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_6 < 0)) { - PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_og_start_index, (PyObject*)__pyx_v_og_start_index, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9); - } - } - __pyx_bstride_0_og_start_index = __pyx_bstruct_og_start_index.strides[0]; - __pyx_bshape_0_og_start_index = __pyx_bstruct_og_start_index.shape[0]; - if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_16 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_og_start_index)); - __pyx_v_og_start_index = ((PyArrayObject *)__pyx_t_13); - __pyx_t_13 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":631 - * offset = ogrid_info[1] - * og_start_index = ogrid_info[3:] - * for i in range(2*ref_factor): # <<<<<<<<<<<<<< - * di = i + og_start_index[0] * ref_factor - * if di < start_index[0] or di >= end_index[0]: continue - */ - __pyx_t_17 = (2 * __pyx_v_ref_factor); - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_17; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":632 - * og_start_index = ogrid_info[3:] - * for i in range(2*ref_factor): - * di = i + og_start_index[0] * ref_factor # <<<<<<<<<<<<<< - * if di < start_index[0] or di >= end_index[0]: continue - * ir = (i / ref_factor) - */ - __pyx_t_18 = 0; - __pyx_t_19 = -1; - if (__pyx_t_18 < 0) { - __pyx_t_18 += __pyx_bshape_0_og_start_index; - if (unlikely(__pyx_t_18 < 0)) __pyx_t_19 = 0; - } else if (unlikely(__pyx_t_18 >= __pyx_bshape_0_og_start_index)) __pyx_t_19 = 0; - if (unlikely(__pyx_t_19 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_19); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_di = (__pyx_v_i + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_og_start_index.buf, __pyx_t_18, __pyx_bstride_0_og_start_index)) * __pyx_v_ref_factor)); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":633 - * for i in range(2*ref_factor): - * di = i + og_start_index[0] * ref_factor - * if di < start_index[0] or di >= end_index[0]: continue # <<<<<<<<<<<<<< - * ir = (i / ref_factor) - * for j in range(2 * ref_factor): - */ - __pyx_t_20 = 0; - __pyx_t_19 = -1; - if (__pyx_t_20 < 0) { - __pyx_t_20 += __pyx_bshape_0_start_index; - if (unlikely(__pyx_t_20 < 0)) __pyx_t_19 = 0; - } else if (unlikely(__pyx_t_20 >= __pyx_bshape_0_start_index)) __pyx_t_19 = 0; - if (unlikely(__pyx_t_19 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_19); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_21 = (__pyx_v_di < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_start_index.buf, __pyx_t_20, __pyx_bstride_0_start_index))); - if (!__pyx_t_21) { - __pyx_t_22 = (__pyx_v_di >= (__pyx_v_end_index[0])); - __pyx_t_23 = __pyx_t_22; - } else { - __pyx_t_23 = __pyx_t_21; - } - if (__pyx_t_23) { - goto __pyx_L10_continue; - goto __pyx_L12; - } - __pyx_L12:; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":634 - * di = i + og_start_index[0] * ref_factor - * if di < start_index[0] or di >= end_index[0]: continue - * ir = (i / ref_factor) # <<<<<<<<<<<<<< - * for j in range(2 * ref_factor): - * dj = j + og_start_index[1] * ref_factor - */ - if (unlikely(__pyx_v_ref_factor == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_ref_factor == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_i))) { - PyErr_Format(PyExc_OverflowError, "value too large to perform division"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_ir = __Pyx_div_int(__pyx_v_i, __pyx_v_ref_factor); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":635 - * if di < start_index[0] or di >= end_index[0]: continue - * ir = (i / ref_factor) - * for j in range(2 * ref_factor): # <<<<<<<<<<<<<< - * dj = j + og_start_index[1] * ref_factor - * if dj < start_index[1] or dj >= end_index[1]: continue - */ - __pyx_t_24 = (2 * __pyx_v_ref_factor); - for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_24; __pyx_t_19+=1) { - __pyx_v_j = __pyx_t_19; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":636 - * ir = (i / ref_factor) - * for j in range(2 * ref_factor): - * dj = j + og_start_index[1] * ref_factor # <<<<<<<<<<<<<< - * if dj < start_index[1] or dj >= end_index[1]: continue - * jr = (j / ref_factor) - */ - __pyx_t_25 = 1; - __pyx_t_26 = -1; - if (__pyx_t_25 < 0) { - __pyx_t_25 += __pyx_bshape_0_og_start_index; - if (unlikely(__pyx_t_25 < 0)) __pyx_t_26 = 0; - } else if (unlikely(__pyx_t_25 >= __pyx_bshape_0_og_start_index)) __pyx_t_26 = 0; - if (unlikely(__pyx_t_26 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_26); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_dj = (__pyx_v_j + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_og_start_index.buf, __pyx_t_25, __pyx_bstride_0_og_start_index)) * __pyx_v_ref_factor)); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":637 - * for j in range(2 * ref_factor): - * dj = j + og_start_index[1] * ref_factor - * if dj < start_index[1] or dj >= end_index[1]: continue # <<<<<<<<<<<<<< - * jr = (j / ref_factor) - * for k in range(2 * ref_factor): - */ - __pyx_t_27 = 1; - __pyx_t_26 = -1; - if (__pyx_t_27 < 0) { - __pyx_t_27 += __pyx_bshape_0_start_index; - if (unlikely(__pyx_t_27 < 0)) __pyx_t_26 = 0; - } else if (unlikely(__pyx_t_27 >= __pyx_bshape_0_start_index)) __pyx_t_26 = 0; - if (unlikely(__pyx_t_26 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_26); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_23 = (__pyx_v_dj < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_start_index.buf, __pyx_t_27, __pyx_bstride_0_start_index))); - if (!__pyx_t_23) { - __pyx_t_21 = (__pyx_v_dj >= (__pyx_v_end_index[1])); - __pyx_t_22 = __pyx_t_21; - } else { - __pyx_t_22 = __pyx_t_23; - } - if (__pyx_t_22) { - goto __pyx_L13_continue; - goto __pyx_L15; - } - __pyx_L15:; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":638 - * dj = j + og_start_index[1] * ref_factor - * if dj < start_index[1] or dj >= end_index[1]: continue - * jr = (j / ref_factor) # <<<<<<<<<<<<<< - * for k in range(2 * ref_factor): - * dk = k + og_start_index[2] * ref_factor - */ - if (unlikely(__pyx_v_ref_factor == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_ref_factor == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_j))) { - PyErr_Format(PyExc_OverflowError, "value too large to perform division"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_jr = __Pyx_div_int(__pyx_v_j, __pyx_v_ref_factor); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":639 - * if dj < start_index[1] or dj >= end_index[1]: continue - * jr = (j / ref_factor) - * for k in range(2 * ref_factor): # <<<<<<<<<<<<<< - * dk = k + og_start_index[2] * ref_factor - * if dk < start_index[2] or dk >= end_index[2]: continue - */ - __pyx_t_28 = (2 * __pyx_v_ref_factor); - for (__pyx_t_26 = 0; __pyx_t_26 < __pyx_t_28; __pyx_t_26+=1) { - __pyx_v_k = __pyx_t_26; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":640 - * jr = (j / ref_factor) - * for k in range(2 * ref_factor): - * dk = k + og_start_index[2] * ref_factor # <<<<<<<<<<<<<< - * if dk < start_index[2] or dk >= end_index[2]: continue - * kr = (k / ref_factor) - */ - __pyx_t_29 = 2; - __pyx_t_30 = -1; - if (__pyx_t_29 < 0) { - __pyx_t_29 += __pyx_bshape_0_og_start_index; - if (unlikely(__pyx_t_29 < 0)) __pyx_t_30 = 0; - } else if (unlikely(__pyx_t_29 >= __pyx_bshape_0_og_start_index)) __pyx_t_30 = 0; - if (unlikely(__pyx_t_30 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_30); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_dk = (__pyx_v_k + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_og_start_index.buf, __pyx_t_29, __pyx_bstride_0_og_start_index)) * __pyx_v_ref_factor)); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":641 - * for k in range(2 * ref_factor): - * dk = k + og_start_index[2] * ref_factor - * if dk < start_index[2] or dk >= end_index[2]: continue # <<<<<<<<<<<<<< - * kr = (k / ref_factor) - * offi = di - start_index[0] - */ - __pyx_t_31 = 2; - __pyx_t_30 = -1; - if (__pyx_t_31 < 0) { - __pyx_t_31 += __pyx_bshape_0_start_index; - if (unlikely(__pyx_t_31 < 0)) __pyx_t_30 = 0; - } else if (unlikely(__pyx_t_31 >= __pyx_bshape_0_start_index)) __pyx_t_30 = 0; - if (unlikely(__pyx_t_30 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_30); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_22 = (__pyx_v_dk < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_start_index.buf, __pyx_t_31, __pyx_bstride_0_start_index))); - if (!__pyx_t_22) { - __pyx_t_23 = (__pyx_v_dk >= (__pyx_v_end_index[2])); - __pyx_t_21 = __pyx_t_23; - } else { - __pyx_t_21 = __pyx_t_22; - } - if (__pyx_t_21) { - goto __pyx_L16_continue; - goto __pyx_L18; - } - __pyx_L18:; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":642 - * dk = k + og_start_index[2] * ref_factor - * if dk < start_index[2] or dk >= end_index[2]: continue - * kr = (k / ref_factor) # <<<<<<<<<<<<<< - * offi = di - start_index[0] - * offj = dj - start_index[1] - */ - if (unlikely(__pyx_v_ref_factor == 0)) { - PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_ref_factor == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_k))) { - PyErr_Format(PyExc_OverflowError, "value too large to perform division"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_kr = __Pyx_div_int(__pyx_v_k, __pyx_v_ref_factor); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":643 - * if dk < start_index[2] or dk >= end_index[2]: continue - * kr = (k / ref_factor) - * offi = di - start_index[0] # <<<<<<<<<<<<<< - * offj = dj - start_index[1] - * offk = dk - start_index[2] - */ - __pyx_t_32 = 0; - __pyx_t_30 = -1; - if (__pyx_t_32 < 0) { - __pyx_t_32 += __pyx_bshape_0_start_index; - if (unlikely(__pyx_t_32 < 0)) __pyx_t_30 = 0; - } else if (unlikely(__pyx_t_32 >= __pyx_bshape_0_start_index)) __pyx_t_30 = 0; - if (unlikely(__pyx_t_30 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_30); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_offi = (__pyx_v_di - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_start_index.buf, __pyx_t_32, __pyx_bstride_0_start_index))); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":644 - * kr = (k / ref_factor) - * offi = di - start_index[0] - * offj = dj - start_index[1] # <<<<<<<<<<<<<< - * offk = dk - start_index[2] - * #print offi, filled.shape[0], - */ - __pyx_t_33 = 1; - __pyx_t_30 = -1; - if (__pyx_t_33 < 0) { - __pyx_t_33 += __pyx_bshape_0_start_index; - if (unlikely(__pyx_t_33 < 0)) __pyx_t_30 = 0; - } else if (unlikely(__pyx_t_33 >= __pyx_bshape_0_start_index)) __pyx_t_30 = 0; - if (unlikely(__pyx_t_30 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_30); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_offj = (__pyx_v_dj - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_start_index.buf, __pyx_t_33, __pyx_bstride_0_start_index))); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":645 - * offi = di - start_index[0] - * offj = dj - start_index[1] - * offk = dk - start_index[2] # <<<<<<<<<<<<<< - * #print offi, filled.shape[0], - * #print offj, filled.shape[1], - */ - __pyx_t_34 = 2; - __pyx_t_30 = -1; - if (__pyx_t_34 < 0) { - __pyx_t_34 += __pyx_bshape_0_start_index; - if (unlikely(__pyx_t_34 < 0)) __pyx_t_30 = 0; - } else if (unlikely(__pyx_t_34 >= __pyx_bshape_0_start_index)) __pyx_t_30 = 0; - if (unlikely(__pyx_t_30 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_30); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_offk = (__pyx_v_dk - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_start_index.buf, __pyx_t_34, __pyx_bstride_0_start_index))); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":649 - * #print offj, filled.shape[1], - * #print offk, filled.shape[2] - * if filled[offi, offj, offk] == 1: continue # <<<<<<<<<<<<<< - * - * odind = (kr*2 + jr)*2 + ir - */ - __pyx_t_30 = __pyx_v_offi; - __pyx_t_35 = __pyx_v_offj; - __pyx_t_36 = __pyx_v_offk; - __pyx_t_37 = -1; - if (__pyx_t_30 < 0) { - __pyx_t_30 += __pyx_bshape_0_filled; - if (unlikely(__pyx_t_30 < 0)) __pyx_t_37 = 0; - } else if (unlikely(__pyx_t_30 >= __pyx_bshape_0_filled)) __pyx_t_37 = 0; - if (__pyx_t_35 < 0) { - __pyx_t_35 += __pyx_bshape_1_filled; - if (unlikely(__pyx_t_35 < 0)) __pyx_t_37 = 1; - } else if (unlikely(__pyx_t_35 >= __pyx_bshape_1_filled)) __pyx_t_37 = 1; - if (__pyx_t_36 < 0) { - __pyx_t_36 += __pyx_bshape_2_filled; - if (unlikely(__pyx_t_36 < 0)) __pyx_t_37 = 2; - } else if (unlikely(__pyx_t_36 >= __pyx_bshape_2_filled)) __pyx_t_37 = 2; - if (unlikely(__pyx_t_37 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_37); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_21 = ((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_filled.buf, __pyx_t_30, __pyx_bstride_0_filled, __pyx_t_35, __pyx_bstride_1_filled, __pyx_t_36, __pyx_bstride_2_filled)) == 1); - if (__pyx_t_21) { - goto __pyx_L16_continue; - goto __pyx_L19; - } - __pyx_L19:; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":651 - * if filled[offi, offj, offk] == 1: continue - * - * odind = (kr*2 + jr)*2 + ir # <<<<<<<<<<<<<< - * temp_data = local_hydro_data.m_var_array[ - * level][8*offset + odind] - */ - __pyx_t_13 = PyInt_FromLong(((((__pyx_v_kr * 2) + __pyx_v_jr) * 2) + __pyx_v_ir)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_v_odind); - __pyx_v_odind = __pyx_t_13; - __pyx_t_13 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":653 - * odind = (kr*2 + jr)*2 + ir - * temp_data = local_hydro_data.m_var_array[ - * level][8*offset + odind] # <<<<<<<<<<<<<< - * data[offi, offj, offk] = temp_data - * filled[offi, offj, offk] = 1 - */ - __pyx_t_13 = PyInt_FromLong((8 * __pyx_v_offset)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_14 = PyNumber_Add(__pyx_t_13, __pyx_v_odind); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_37 = __Pyx_PyInt_AsInt(__pyx_t_14); if (unlikely((__pyx_t_37 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_v_temp_data = ((__pyx_v_local_hydro_data->m_var_array[__pyx_v_level])[__pyx_t_37]); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":654 - * temp_data = local_hydro_data.m_var_array[ - * level][8*offset + odind] - * data[offi, offj, offk] = temp_data # <<<<<<<<<<<<<< - * filled[offi, offj, offk] = 1 - * to_fill += 1 - */ - __pyx_t_37 = __pyx_v_offi; - __pyx_t_38 = __pyx_v_offj; - __pyx_t_39 = __pyx_v_offk; - __pyx_t_40 = -1; - if (__pyx_t_37 < 0) { - __pyx_t_37 += __pyx_bshape_0_data; - if (unlikely(__pyx_t_37 < 0)) __pyx_t_40 = 0; - } else if (unlikely(__pyx_t_37 >= __pyx_bshape_0_data)) __pyx_t_40 = 0; - if (__pyx_t_38 < 0) { - __pyx_t_38 += __pyx_bshape_1_data; - if (unlikely(__pyx_t_38 < 0)) __pyx_t_40 = 1; - } else if (unlikely(__pyx_t_38 >= __pyx_bshape_1_data)) __pyx_t_40 = 1; - if (__pyx_t_39 < 0) { - __pyx_t_39 += __pyx_bshape_2_data; - if (unlikely(__pyx_t_39 < 0)) __pyx_t_40 = 2; - } else if (unlikely(__pyx_t_39 >= __pyx_bshape_2_data)) __pyx_t_40 = 2; - if (unlikely(__pyx_t_40 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_40); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_data.buf, __pyx_t_37, __pyx_bstride_0_data, __pyx_t_38, __pyx_bstride_1_data, __pyx_t_39, __pyx_bstride_2_data) = __pyx_v_temp_data; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":655 - * level][8*offset + odind] - * data[offi, offj, offk] = temp_data - * filled[offi, offj, offk] = 1 # <<<<<<<<<<<<<< - * to_fill += 1 - * return to_fill - */ - __pyx_t_40 = __pyx_v_offi; - __pyx_t_41 = __pyx_v_offj; - __pyx_t_42 = __pyx_v_offk; - __pyx_t_43 = -1; - if (__pyx_t_40 < 0) { - __pyx_t_40 += __pyx_bshape_0_filled; - if (unlikely(__pyx_t_40 < 0)) __pyx_t_43 = 0; - } else if (unlikely(__pyx_t_40 >= __pyx_bshape_0_filled)) __pyx_t_43 = 0; - if (__pyx_t_41 < 0) { - __pyx_t_41 += __pyx_bshape_1_filled; - if (unlikely(__pyx_t_41 < 0)) __pyx_t_43 = 1; - } else if (unlikely(__pyx_t_41 >= __pyx_bshape_1_filled)) __pyx_t_43 = 1; - if (__pyx_t_42 < 0) { - __pyx_t_42 += __pyx_bshape_2_filled; - if (unlikely(__pyx_t_42 < 0)) __pyx_t_43 = 2; - } else if (unlikely(__pyx_t_42 >= __pyx_bshape_2_filled)) __pyx_t_43 = 2; - if (unlikely(__pyx_t_43 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_43); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_filled.buf, __pyx_t_40, __pyx_bstride_0_filled, __pyx_t_41, __pyx_bstride_1_filled, __pyx_t_42, __pyx_bstride_2_filled) = 1; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":656 - * data[offi, offj, offk] = temp_data - * filled[offi, offj, offk] = 1 - * to_fill += 1 # <<<<<<<<<<<<<< - * return to_fill - * - */ - __pyx_v_to_fill += 1; - __pyx_L16_continue:; - } - __pyx_L13_continue:; - } - __pyx_L10_continue:; - } - } - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":657 - * filled[offi, offj, offk] = 1 - * to_fill += 1 - * return to_fill # <<<<<<<<<<<<<< - * - * cdef class ProtoSubgrid: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_14 = PyInt_FromLong(__pyx_v_to_fill); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __pyx_r = __pyx_t_14; - __pyx_t_14 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_XDECREF(__pyx_t_14); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_dims); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_og_start_index); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ogrid_info); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_filled); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_start_index); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.ramses_reader.RAMSES_tree_proxy.read_grid"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_dims); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_og_start_index); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ogrid_info); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_filled); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_start_index); - __pyx_L2:; - __Pyx_DECREF((PyObject *)__pyx_v_ogrid_info); - __Pyx_DECREF((PyObject *)__pyx_v_og_start_index); - __Pyx_DECREF(__pyx_v_odind); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":664 - * cdef np.int64_t right_edge[3] - * cdef np.int64_t dimensions[3] - * cdef public np.float64_t efficiency # <<<<<<<<<<<<<< - * cdef public object sigs - * cdef public object grid_file_locations - */ - -static PyObject *__pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_10efficiency___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_10efficiency___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->efficiency); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("yt.ramses_reader.ProtoSubgrid.efficiency.__get__"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_10efficiency___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_10efficiency___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __pyx_t_5numpy_float64_t __pyx_t_1; - __Pyx_RefNannySetupContext("__set__"); - __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->efficiency = __pyx_t_1; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("yt.ramses_reader.ProtoSubgrid.efficiency.__set__"); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":665 - * cdef np.int64_t dimensions[3] - * cdef public np.float64_t efficiency - * cdef public object sigs # <<<<<<<<<<<<<< - * cdef public object grid_file_locations - * cdef public object dd - */ - -static PyObject *__pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_4sigs___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_4sigs___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->sigs); - __pyx_r = ((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->sigs; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_4sigs___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_4sigs___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannySetupContext("__set__"); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->sigs); - __Pyx_DECREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->sigs); - ((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->sigs = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_4sigs___del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_4sigs___del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->sigs); - __Pyx_DECREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->sigs); - ((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->sigs = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":666 - * cdef public np.float64_t efficiency - * cdef public object sigs - * cdef public object grid_file_locations # <<<<<<<<<<<<<< - * cdef public object dd - * - */ - -static PyObject *__pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_19grid_file_locations___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_19grid_file_locations___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->grid_file_locations); - __pyx_r = ((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->grid_file_locations; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_19grid_file_locations___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_19grid_file_locations___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannySetupContext("__set__"); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->grid_file_locations); - __Pyx_DECREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->grid_file_locations); - ((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->grid_file_locations = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_19grid_file_locations___del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_19grid_file_locations___del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->grid_file_locations); - __Pyx_DECREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->grid_file_locations); - ((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->grid_file_locations = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":667 - * cdef public object sigs - * cdef public object grid_file_locations - * cdef public object dd # <<<<<<<<<<<<<< - * - * #@cython.boundscheck(False) - */ - -static PyObject *__pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_2dd___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_2dd___get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannySetupContext("__get__"); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dd); - __pyx_r = ((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dd; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_2dd___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_2dd___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannySetupContext("__set__"); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dd); - __Pyx_DECREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dd); - ((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dd = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_2dd___del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_2dd___del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannySetupContext("__del__"); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dd); - __Pyx_DECREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dd); - ((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dd = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":671 - * #@cython.boundscheck(False) - * #@cython.wraparound(False) - * def __cinit__(self, # <<<<<<<<<<<<<< - * np.ndarray[np.int64_t, ndim=1] left_index, - * np.ndarray[np.int64_t, ndim=1] dimensions, - */ - -static int __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_left_index = 0; - PyArrayObject *__pyx_v_dimensions = 0; - PyArrayObject *__pyx_v_left_edges = 0; - PyArrayObject *__pyx_v_right_edges = 0; - PyArrayObject *__pyx_v_grid_dimensions = 0; - PyArrayObject *__pyx_v_grid_file_locations = 0; - int __pyx_v_i; - int __pyx_v_ng; - int __pyx_v_l0; - int __pyx_v_l1; - int __pyx_v_l2; - int __pyx_v_i0; - int __pyx_v_i1; - int __pyx_v_i2; - __pyx_t_5numpy_int64_t __pyx_v_temp_l[3]; - __pyx_t_5numpy_int64_t __pyx_v_temp_r[3]; - __pyx_t_5numpy_float64_t __pyx_v_efficiency; - int __pyx_v_gi; - PyArrayObject *__pyx_v_sig0; - PyArrayObject *__pyx_v_sig1; - PyArrayObject *__pyx_v_sig2; - int __pyx_v_used; - long __pyx_v_nnn; - Py_buffer __pyx_bstruct_right_edges; - Py_ssize_t __pyx_bstride_0_right_edges = 0; - Py_ssize_t __pyx_bstride_1_right_edges = 0; - Py_ssize_t __pyx_bshape_0_right_edges = 0; - Py_ssize_t __pyx_bshape_1_right_edges = 0; - Py_buffer __pyx_bstruct_left_index; - Py_ssize_t __pyx_bstride_0_left_index = 0; - Py_ssize_t __pyx_bshape_0_left_index = 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_grid_file_locations; - Py_ssize_t __pyx_bstride_0_grid_file_locations = 0; - Py_ssize_t __pyx_bstride_1_grid_file_locations = 0; - Py_ssize_t __pyx_bshape_0_grid_file_locations = 0; - Py_ssize_t __pyx_bshape_1_grid_file_locations = 0; - Py_buffer __pyx_bstruct_grid_dimensions; - Py_ssize_t __pyx_bstride_0_grid_dimensions = 0; - Py_ssize_t __pyx_bstride_1_grid_dimensions = 0; - Py_ssize_t __pyx_bshape_0_grid_dimensions = 0; - Py_ssize_t __pyx_bshape_1_grid_dimensions = 0; - Py_buffer __pyx_bstruct_sig1; - Py_ssize_t __pyx_bstride_0_sig1 = 0; - Py_ssize_t __pyx_bshape_0_sig1 = 0; - Py_buffer __pyx_bstruct_sig2; - Py_ssize_t __pyx_bstride_0_sig2 = 0; - Py_ssize_t __pyx_bshape_0_sig2 = 0; - Py_buffer __pyx_bstruct_sig0; - Py_ssize_t __pyx_bstride_0_sig0 = 0; - Py_ssize_t __pyx_bshape_0_sig0 = 0; - Py_buffer __pyx_bstruct_left_edges; - Py_ssize_t __pyx_bstride_0_left_edges = 0; - Py_ssize_t __pyx_bstride_1_left_edges = 0; - Py_ssize_t __pyx_bshape_0_left_edges = 0; - Py_ssize_t __pyx_bshape_1_left_edges = 0; - int __pyx_r; - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - long __pyx_t_8; - int __pyx_t_9; - long __pyx_t_10; - long __pyx_t_11; - int __pyx_t_12; - long __pyx_t_13; - int __pyx_t_14; - long __pyx_t_15; - int __pyx_t_16; - long __pyx_t_17; - int __pyx_t_18; - long __pyx_t_19; - long __pyx_t_20; - int __pyx_t_21; - long __pyx_t_22; - int __pyx_t_23; - long __pyx_t_24; - int __pyx_t_25; - long __pyx_t_26; - int __pyx_t_27; - long __pyx_t_28; - long __pyx_t_29; - int __pyx_t_30; - long __pyx_t_31; - int __pyx_t_32; - long __pyx_t_33; - int __pyx_t_34; - int __pyx_t_35; - int __pyx_t_36; - int __pyx_t_37; - int __pyx_t_38; - int __pyx_t_39; - int __pyx_t_40; - int __pyx_t_41; - PyObject *__pyx_t_42 = NULL; - PyObject *__pyx_t_43 = NULL; - PyArrayObject *__pyx_t_44 = NULL; - PyObject *__pyx_t_45 = NULL; - PyObject *__pyx_t_46 = NULL; - PyObject *__pyx_t_47 = NULL; - int __pyx_t_48; - long __pyx_t_49; - int __pyx_t_50; - __pyx_t_5numpy_int64_t __pyx_t_51; - int __pyx_t_52; - long __pyx_t_53; - int __pyx_t_54; - long __pyx_t_55; - int __pyx_t_56; - __pyx_t_5numpy_int64_t __pyx_t_57; - int __pyx_t_58; - long __pyx_t_59; - int __pyx_t_60; - long __pyx_t_61; - int __pyx_t_62; - __pyx_t_5numpy_int64_t __pyx_t_63; - int __pyx_t_64; - long __pyx_t_65; - int __pyx_t_66; - int __pyx_t_67; - int __pyx_t_68; - int __pyx_t_69; - long __pyx_t_70; - long __pyx_t_71; - long __pyx_t_72; - long __pyx_t_73; - int __pyx_t_74; - long __pyx_t_75; - int __pyx_t_76; - long __pyx_t_77; - int __pyx_t_78; - PyObject *__pyx_t_79 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__left_index,&__pyx_n_s__dimensions,&__pyx_n_s__left_edges,&__pyx_n_s__right_edges,&__pyx_n_s__grid_dimensions,&__pyx_n_s__grid_file_locations,0}; - __Pyx_RefNannySetupContext("__cinit__"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[6] = {0,0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left_index); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dimensions); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left_edges); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right_edges); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid_dimensions); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid_file_locations); - if (likely(values[5])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_left_index = ((PyArrayObject *)values[0]); - __pyx_v_dimensions = ((PyArrayObject *)values[1]); - __pyx_v_left_edges = ((PyArrayObject *)values[2]); - __pyx_v_right_edges = ((PyArrayObject *)values[3]); - __pyx_v_grid_dimensions = ((PyArrayObject *)values[4]); - __pyx_v_grid_file_locations = ((PyArrayObject *)values[5]); - } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_left_index = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_dimensions = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_left_edges = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_right_edges = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); - __pyx_v_grid_dimensions = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); - __pyx_v_grid_file_locations = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 5)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("yt.ramses_reader.ProtoSubgrid.__cinit__"); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_v_sig0 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_sig1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_sig2 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_bstruct_sig0.buf = NULL; - __pyx_bstruct_sig1.buf = NULL; - __pyx_bstruct_sig2.buf = NULL; - __pyx_bstruct_left_index.buf = NULL; - __pyx_bstruct_dimensions.buf = NULL; - __pyx_bstruct_left_edges.buf = NULL; - __pyx_bstruct_right_edges.buf = NULL; - __pyx_bstruct_grid_dimensions.buf = NULL; - __pyx_bstruct_grid_file_locations.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left_index), __pyx_ptype_5numpy_ndarray, 1, "left_index", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __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 = 673; __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 = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right_edges), __pyx_ptype_5numpy_ndarray, 1, "right_edges", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grid_dimensions), __pyx_ptype_5numpy_ndarray, 1, "grid_dimensions", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grid_file_locations), __pyx_ptype_5numpy_ndarray, 1, "grid_file_locations", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_left_index, (PyObject*)__pyx_v_left_index, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_left_index = __pyx_bstruct_left_index.strides[0]; - __pyx_bshape_0_left_index = __pyx_bstruct_left_index.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dimensions, (PyObject*)__pyx_v_dimensions, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __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]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_left_edges, (PyObject*)__pyx_v_left_edges, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_left_edges = __pyx_bstruct_left_edges.strides[0]; __pyx_bstride_1_left_edges = __pyx_bstruct_left_edges.strides[1]; - __pyx_bshape_0_left_edges = __pyx_bstruct_left_edges.shape[0]; __pyx_bshape_1_left_edges = __pyx_bstruct_left_edges.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_right_edges, (PyObject*)__pyx_v_right_edges, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_right_edges = __pyx_bstruct_right_edges.strides[0]; __pyx_bstride_1_right_edges = __pyx_bstruct_right_edges.strides[1]; - __pyx_bshape_0_right_edges = __pyx_bstruct_right_edges.shape[0]; __pyx_bshape_1_right_edges = __pyx_bstruct_right_edges.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_grid_dimensions, (PyObject*)__pyx_v_grid_dimensions, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_grid_dimensions = __pyx_bstruct_grid_dimensions.strides[0]; __pyx_bstride_1_grid_dimensions = __pyx_bstruct_grid_dimensions.strides[1]; - __pyx_bshape_0_grid_dimensions = __pyx_bstruct_grid_dimensions.shape[0]; __pyx_bshape_1_grid_dimensions = __pyx_bstruct_grid_dimensions.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_grid_file_locations, (PyObject*)__pyx_v_grid_file_locations, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_bstride_0_grid_file_locations = __pyx_bstruct_grid_file_locations.strides[0]; __pyx_bstride_1_grid_file_locations = __pyx_bstruct_grid_file_locations.strides[1]; - __pyx_bshape_0_grid_file_locations = __pyx_bstruct_grid_file_locations.shape[0]; __pyx_bshape_1_grid_file_locations = __pyx_bstruct_grid_file_locations.shape[1]; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":679 - * np.ndarray[np.int64_t, ndim=2] grid_file_locations): - * # This also includes the shrinking step. - * cdef int i, ci, ng = left_edges.shape[0] # <<<<<<<<<<<<<< - * cdef np.ndarray temp_arr - * cdef int l0, r0, l1, r1, l2, r2, i0, i1, i2 - */ - __pyx_v_ng = (__pyx_v_left_edges->dimensions[0]); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":684 - * cdef np.int64_t temp_l[3], temp_r[3], ncells - * cdef np.float64_t efficiency - * self.sigs = [] # <<<<<<<<<<<<<< - * for i in range(3): - * temp_l[i] = left_index[i] + dimensions[i] - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __Pyx_GOTREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->sigs); - __Pyx_DECREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->sigs); - ((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->sigs = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":685 - * cdef np.float64_t efficiency - * self.sigs = [] - * for i in range(3): # <<<<<<<<<<<<<< - * temp_l[i] = left_index[i] + dimensions[i] - * temp_r[i] = left_index[i] - */ - for (__pyx_t_2 = 0; __pyx_t_2 < 3; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":686 - * self.sigs = [] - * for i in range(3): - * temp_l[i] = left_index[i] + dimensions[i] # <<<<<<<<<<<<<< - * temp_r[i] = left_index[i] - * self.signature[i] = NULL - */ - __pyx_t_3 = __pyx_v_i; - __pyx_t_4 = -1; - if (__pyx_t_3 < 0) { - __pyx_t_3 += __pyx_bshape_0_left_index; - if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 0; - } else if (unlikely(__pyx_t_3 >= __pyx_bshape_0_left_index)) __pyx_t_4 = 0; - if (unlikely(__pyx_t_4 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_4); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = __pyx_v_i; - __pyx_t_5 = -1; - if (__pyx_t_4 < 0) { - __pyx_t_4 += __pyx_bshape_0_dimensions; - if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0; - } else if (unlikely(__pyx_t_4 >= __pyx_bshape_0_dimensions)) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - (__pyx_v_temp_l[__pyx_v_i]) = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_index.buf, __pyx_t_3, __pyx_bstride_0_left_index)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_dimensions.buf, __pyx_t_4, __pyx_bstride_0_dimensions))); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":687 - * for i in range(3): - * temp_l[i] = left_index[i] + dimensions[i] - * temp_r[i] = left_index[i] # <<<<<<<<<<<<<< - * self.signature[i] = NULL - * for gi in range(ng): - */ - __pyx_t_5 = __pyx_v_i; - __pyx_t_6 = -1; - if (__pyx_t_5 < 0) { - __pyx_t_5 += __pyx_bshape_0_left_index; - if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0; - } else if (unlikely(__pyx_t_5 >= __pyx_bshape_0_left_index)) __pyx_t_6 = 0; - if (unlikely(__pyx_t_6 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_6); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - (__pyx_v_temp_r[__pyx_v_i]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_index.buf, __pyx_t_5, __pyx_bstride_0_left_index)); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":688 - * temp_l[i] = left_index[i] + dimensions[i] - * temp_r[i] = left_index[i] - * self.signature[i] = NULL # <<<<<<<<<<<<<< - * for gi in range(ng): - * if left_edges[gi,0] > left_index[0]+dimensions[0] or \ - */ - (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->signature[__pyx_v_i]) = NULL; - } - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":689 - * temp_r[i] = left_index[i] - * self.signature[i] = NULL - * for gi in range(ng): # <<<<<<<<<<<<<< - * if left_edges[gi,0] > left_index[0]+dimensions[0] or \ - * right_edges[gi,0] < left_index[0] or \ - */ - __pyx_t_2 = __pyx_v_ng; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_2; __pyx_t_6+=1) { - __pyx_v_gi = __pyx_t_6; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":690 - * self.signature[i] = NULL - * for gi in range(ng): - * if left_edges[gi,0] > left_index[0]+dimensions[0] or \ # <<<<<<<<<<<<<< - * right_edges[gi,0] < left_index[0] or \ - * left_edges[gi,1] > left_index[1]+dimensions[1] or \ - */ - __pyx_t_7 = __pyx_v_gi; - __pyx_t_8 = 0; - __pyx_t_9 = -1; - if (__pyx_t_7 < 0) { - __pyx_t_7 += __pyx_bshape_0_left_edges; - if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_7 >= __pyx_bshape_0_left_edges)) __pyx_t_9 = 0; - if (__pyx_t_8 < 0) { - __pyx_t_8 += __pyx_bshape_1_left_edges; - if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1; - } else if (unlikely(__pyx_t_8 >= __pyx_bshape_1_left_edges)) __pyx_t_9 = 1; - if (unlikely(__pyx_t_9 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_9); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_10 = 0; - __pyx_t_9 = -1; - if (__pyx_t_10 < 0) { - __pyx_t_10 += __pyx_bshape_0_left_index; - if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_left_index)) __pyx_t_9 = 0; - if (unlikely(__pyx_t_9 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_9); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_11 = 0; - __pyx_t_9 = -1; - if (__pyx_t_11 < 0) { - __pyx_t_11 += __pyx_bshape_0_dimensions; - if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_11 >= __pyx_bshape_0_dimensions)) __pyx_t_9 = 0; - if (unlikely(__pyx_t_9 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_9); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_12 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_edges.buf, __pyx_t_7, __pyx_bstride_0_left_edges, __pyx_t_8, __pyx_bstride_1_left_edges)) > ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_index.buf, __pyx_t_10, __pyx_bstride_0_left_index)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_dimensions.buf, __pyx_t_11, __pyx_bstride_0_dimensions)))); - if (!__pyx_t_12) { - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":691 - * for gi in range(ng): - * if left_edges[gi,0] > left_index[0]+dimensions[0] or \ - * right_edges[gi,0] < left_index[0] or \ # <<<<<<<<<<<<<< - * left_edges[gi,1] > left_index[1]+dimensions[1] or \ - * right_edges[gi,1] < left_index[1] or \ - */ - __pyx_t_9 = __pyx_v_gi; - __pyx_t_13 = 0; - __pyx_t_14 = -1; - if (__pyx_t_9 < 0) { - __pyx_t_9 += __pyx_bshape_0_right_edges; - if (unlikely(__pyx_t_9 < 0)) __pyx_t_14 = 0; - } else if (unlikely(__pyx_t_9 >= __pyx_bshape_0_right_edges)) __pyx_t_14 = 0; - if (__pyx_t_13 < 0) { - __pyx_t_13 += __pyx_bshape_1_right_edges; - if (unlikely(__pyx_t_13 < 0)) __pyx_t_14 = 1; - } else if (unlikely(__pyx_t_13 >= __pyx_bshape_1_right_edges)) __pyx_t_14 = 1; - if (unlikely(__pyx_t_14 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_14); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_15 = 0; - __pyx_t_14 = -1; - if (__pyx_t_15 < 0) { - __pyx_t_15 += __pyx_bshape_0_left_index; - if (unlikely(__pyx_t_15 < 0)) __pyx_t_14 = 0; - } else if (unlikely(__pyx_t_15 >= __pyx_bshape_0_left_index)) __pyx_t_14 = 0; - if (unlikely(__pyx_t_14 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_14); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_16 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_right_edges.buf, __pyx_t_9, __pyx_bstride_0_right_edges, __pyx_t_13, __pyx_bstride_1_right_edges)) < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_index.buf, __pyx_t_15, __pyx_bstride_0_left_index))); - if (!__pyx_t_16) { - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":692 - * if left_edges[gi,0] > left_index[0]+dimensions[0] or \ - * right_edges[gi,0] < left_index[0] or \ - * left_edges[gi,1] > left_index[1]+dimensions[1] or \ # <<<<<<<<<<<<<< - * right_edges[gi,1] < left_index[1] or \ - * left_edges[gi,2] > left_index[2]+dimensions[2] or \ - */ - __pyx_t_14 = __pyx_v_gi; - __pyx_t_17 = 1; - __pyx_t_18 = -1; - if (__pyx_t_14 < 0) { - __pyx_t_14 += __pyx_bshape_0_left_edges; - if (unlikely(__pyx_t_14 < 0)) __pyx_t_18 = 0; - } else if (unlikely(__pyx_t_14 >= __pyx_bshape_0_left_edges)) __pyx_t_18 = 0; - if (__pyx_t_17 < 0) { - __pyx_t_17 += __pyx_bshape_1_left_edges; - if (unlikely(__pyx_t_17 < 0)) __pyx_t_18 = 1; - } else if (unlikely(__pyx_t_17 >= __pyx_bshape_1_left_edges)) __pyx_t_18 = 1; - if (unlikely(__pyx_t_18 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_18); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_19 = 1; - __pyx_t_18 = -1; - if (__pyx_t_19 < 0) { - __pyx_t_19 += __pyx_bshape_0_left_index; - if (unlikely(__pyx_t_19 < 0)) __pyx_t_18 = 0; - } else if (unlikely(__pyx_t_19 >= __pyx_bshape_0_left_index)) __pyx_t_18 = 0; - if (unlikely(__pyx_t_18 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_18); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_20 = 1; - __pyx_t_18 = -1; - if (__pyx_t_20 < 0) { - __pyx_t_20 += __pyx_bshape_0_dimensions; - if (unlikely(__pyx_t_20 < 0)) __pyx_t_18 = 0; - } else if (unlikely(__pyx_t_20 >= __pyx_bshape_0_dimensions)) __pyx_t_18 = 0; - if (unlikely(__pyx_t_18 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_18); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_21 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_edges.buf, __pyx_t_14, __pyx_bstride_0_left_edges, __pyx_t_17, __pyx_bstride_1_left_edges)) > ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_index.buf, __pyx_t_19, __pyx_bstride_0_left_index)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_dimensions.buf, __pyx_t_20, __pyx_bstride_0_dimensions)))); - if (!__pyx_t_21) { - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":693 - * right_edges[gi,0] < left_index[0] or \ - * left_edges[gi,1] > left_index[1]+dimensions[1] or \ - * right_edges[gi,1] < left_index[1] or \ # <<<<<<<<<<<<<< - * left_edges[gi,2] > left_index[2]+dimensions[2] or \ - * right_edges[gi,2] < left_index[2]: - */ - __pyx_t_18 = __pyx_v_gi; - __pyx_t_22 = 1; - __pyx_t_23 = -1; - if (__pyx_t_18 < 0) { - __pyx_t_18 += __pyx_bshape_0_right_edges; - if (unlikely(__pyx_t_18 < 0)) __pyx_t_23 = 0; - } else if (unlikely(__pyx_t_18 >= __pyx_bshape_0_right_edges)) __pyx_t_23 = 0; - if (__pyx_t_22 < 0) { - __pyx_t_22 += __pyx_bshape_1_right_edges; - if (unlikely(__pyx_t_22 < 0)) __pyx_t_23 = 1; - } else if (unlikely(__pyx_t_22 >= __pyx_bshape_1_right_edges)) __pyx_t_23 = 1; - if (unlikely(__pyx_t_23 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_23); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_24 = 1; - __pyx_t_23 = -1; - if (__pyx_t_24 < 0) { - __pyx_t_24 += __pyx_bshape_0_left_index; - if (unlikely(__pyx_t_24 < 0)) __pyx_t_23 = 0; - } else if (unlikely(__pyx_t_24 >= __pyx_bshape_0_left_index)) __pyx_t_23 = 0; - if (unlikely(__pyx_t_23 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_23); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_25 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_right_edges.buf, __pyx_t_18, __pyx_bstride_0_right_edges, __pyx_t_22, __pyx_bstride_1_right_edges)) < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_index.buf, __pyx_t_24, __pyx_bstride_0_left_index))); - if (!__pyx_t_25) { - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":694 - * left_edges[gi,1] > left_index[1]+dimensions[1] or \ - * right_edges[gi,1] < left_index[1] or \ - * left_edges[gi,2] > left_index[2]+dimensions[2] or \ # <<<<<<<<<<<<<< - * right_edges[gi,2] < left_index[2]: - * #print "Skipping grid", gi, "which lies outside out box" - */ - __pyx_t_23 = __pyx_v_gi; - __pyx_t_26 = 2; - __pyx_t_27 = -1; - if (__pyx_t_23 < 0) { - __pyx_t_23 += __pyx_bshape_0_left_edges; - if (unlikely(__pyx_t_23 < 0)) __pyx_t_27 = 0; - } else if (unlikely(__pyx_t_23 >= __pyx_bshape_0_left_edges)) __pyx_t_27 = 0; - if (__pyx_t_26 < 0) { - __pyx_t_26 += __pyx_bshape_1_left_edges; - if (unlikely(__pyx_t_26 < 0)) __pyx_t_27 = 1; - } else if (unlikely(__pyx_t_26 >= __pyx_bshape_1_left_edges)) __pyx_t_27 = 1; - if (unlikely(__pyx_t_27 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_27); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_28 = 2; - __pyx_t_27 = -1; - if (__pyx_t_28 < 0) { - __pyx_t_28 += __pyx_bshape_0_left_index; - if (unlikely(__pyx_t_28 < 0)) __pyx_t_27 = 0; - } else if (unlikely(__pyx_t_28 >= __pyx_bshape_0_left_index)) __pyx_t_27 = 0; - if (unlikely(__pyx_t_27 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_27); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_29 = 2; - __pyx_t_27 = -1; - if (__pyx_t_29 < 0) { - __pyx_t_29 += __pyx_bshape_0_dimensions; - if (unlikely(__pyx_t_29 < 0)) __pyx_t_27 = 0; - } else if (unlikely(__pyx_t_29 >= __pyx_bshape_0_dimensions)) __pyx_t_27 = 0; - if (unlikely(__pyx_t_27 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_27); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_30 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_edges.buf, __pyx_t_23, __pyx_bstride_0_left_edges, __pyx_t_26, __pyx_bstride_1_left_edges)) > ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_index.buf, __pyx_t_28, __pyx_bstride_0_left_index)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_dimensions.buf, __pyx_t_29, __pyx_bstride_0_dimensions)))); - if (!__pyx_t_30) { - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":695 - * right_edges[gi,1] < left_index[1] or \ - * left_edges[gi,2] > left_index[2]+dimensions[2] or \ - * right_edges[gi,2] < left_index[2]: # <<<<<<<<<<<<<< - * #print "Skipping grid", gi, "which lies outside out box" - * continue - */ - __pyx_t_27 = __pyx_v_gi; - __pyx_t_31 = 2; - __pyx_t_32 = -1; - if (__pyx_t_27 < 0) { - __pyx_t_27 += __pyx_bshape_0_right_edges; - if (unlikely(__pyx_t_27 < 0)) __pyx_t_32 = 0; - } else if (unlikely(__pyx_t_27 >= __pyx_bshape_0_right_edges)) __pyx_t_32 = 0; - if (__pyx_t_31 < 0) { - __pyx_t_31 += __pyx_bshape_1_right_edges; - if (unlikely(__pyx_t_31 < 0)) __pyx_t_32 = 1; - } else if (unlikely(__pyx_t_31 >= __pyx_bshape_1_right_edges)) __pyx_t_32 = 1; - if (unlikely(__pyx_t_32 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_32); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_33 = 2; - __pyx_t_32 = -1; - if (__pyx_t_33 < 0) { - __pyx_t_33 += __pyx_bshape_0_left_index; - if (unlikely(__pyx_t_33 < 0)) __pyx_t_32 = 0; - } else if (unlikely(__pyx_t_33 >= __pyx_bshape_0_left_index)) __pyx_t_32 = 0; - if (unlikely(__pyx_t_32 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_32); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_34 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_right_edges.buf, __pyx_t_27, __pyx_bstride_0_right_edges, __pyx_t_31, __pyx_bstride_1_right_edges)) < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_index.buf, __pyx_t_33, __pyx_bstride_0_left_index))); - __pyx_t_35 = __pyx_t_34; - } else { - __pyx_t_35 = __pyx_t_30; - } - __pyx_t_30 = __pyx_t_35; - } else { - __pyx_t_30 = __pyx_t_25; - } - __pyx_t_25 = __pyx_t_30; - } else { - __pyx_t_25 = __pyx_t_21; - } - __pyx_t_21 = __pyx_t_25; - } else { - __pyx_t_21 = __pyx_t_16; - } - __pyx_t_16 = __pyx_t_21; - } else { - __pyx_t_16 = __pyx_t_12; - } - if (__pyx_t_16) { - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":697 - * right_edges[gi,2] < left_index[2]: - * #print "Skipping grid", gi, "which lies outside out box" - * continue # <<<<<<<<<<<<<< - * for i in range(3): - * temp_l[i] = i64min(left_edges[gi,i], temp_l[i]) - */ - goto __pyx_L8_continue; - goto __pyx_L10; - } - __pyx_L10:; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":698 - * #print "Skipping grid", gi, "which lies outside out box" - * continue - * for i in range(3): # <<<<<<<<<<<<<< - * temp_l[i] = i64min(left_edges[gi,i], temp_l[i]) - * temp_r[i] = i64max(right_edges[gi,i], temp_r[i]) - */ - for (__pyx_t_32 = 0; __pyx_t_32 < 3; __pyx_t_32+=1) { - __pyx_v_i = __pyx_t_32; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":699 - * continue - * for i in range(3): - * temp_l[i] = i64min(left_edges[gi,i], temp_l[i]) # <<<<<<<<<<<<<< - * temp_r[i] = i64max(right_edges[gi,i], temp_r[i]) - * for i in range(3): - */ - __pyx_t_36 = __pyx_v_gi; - __pyx_t_37 = __pyx_v_i; - __pyx_t_38 = -1; - if (__pyx_t_36 < 0) { - __pyx_t_36 += __pyx_bshape_0_left_edges; - if (unlikely(__pyx_t_36 < 0)) __pyx_t_38 = 0; - } else if (unlikely(__pyx_t_36 >= __pyx_bshape_0_left_edges)) __pyx_t_38 = 0; - if (__pyx_t_37 < 0) { - __pyx_t_37 += __pyx_bshape_1_left_edges; - if (unlikely(__pyx_t_37 < 0)) __pyx_t_38 = 1; - } else if (unlikely(__pyx_t_37 >= __pyx_bshape_1_left_edges)) __pyx_t_38 = 1; - if (unlikely(__pyx_t_38 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_38); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - (__pyx_v_temp_l[__pyx_v_i]) = __pyx_f_2yt_13ramses_reader_i64min((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_edges.buf, __pyx_t_36, __pyx_bstride_0_left_edges, __pyx_t_37, __pyx_bstride_1_left_edges)), (__pyx_v_temp_l[__pyx_v_i])); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":700 - * for i in range(3): - * temp_l[i] = i64min(left_edges[gi,i], temp_l[i]) - * temp_r[i] = i64max(right_edges[gi,i], temp_r[i]) # <<<<<<<<<<<<<< - * for i in range(3): - * self.left_edge[i] = i64max(temp_l[i], left_index[i]) - */ - __pyx_t_38 = __pyx_v_gi; - __pyx_t_39 = __pyx_v_i; - __pyx_t_40 = -1; - if (__pyx_t_38 < 0) { - __pyx_t_38 += __pyx_bshape_0_right_edges; - if (unlikely(__pyx_t_38 < 0)) __pyx_t_40 = 0; - } else if (unlikely(__pyx_t_38 >= __pyx_bshape_0_right_edges)) __pyx_t_40 = 0; - if (__pyx_t_39 < 0) { - __pyx_t_39 += __pyx_bshape_1_right_edges; - if (unlikely(__pyx_t_39 < 0)) __pyx_t_40 = 1; - } else if (unlikely(__pyx_t_39 >= __pyx_bshape_1_right_edges)) __pyx_t_40 = 1; - if (unlikely(__pyx_t_40 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_40); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - (__pyx_v_temp_r[__pyx_v_i]) = __pyx_f_2yt_13ramses_reader_i64max((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_right_edges.buf, __pyx_t_38, __pyx_bstride_0_right_edges, __pyx_t_39, __pyx_bstride_1_right_edges)), (__pyx_v_temp_r[__pyx_v_i])); - } - __pyx_L8_continue:; - } - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":701 - * temp_l[i] = i64min(left_edges[gi,i], temp_l[i]) - * temp_r[i] = i64max(right_edges[gi,i], temp_r[i]) - * for i in range(3): # <<<<<<<<<<<<<< - * self.left_edge[i] = i64max(temp_l[i], left_index[i]) - * self.right_edge[i] = i64min(temp_r[i], left_index[i] + dimensions[i]) - */ - for (__pyx_t_2 = 0; __pyx_t_2 < 3; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":702 - * temp_r[i] = i64max(right_edges[gi,i], temp_r[i]) - * for i in range(3): - * self.left_edge[i] = i64max(temp_l[i], left_index[i]) # <<<<<<<<<<<<<< - * self.right_edge[i] = i64min(temp_r[i], left_index[i] + dimensions[i]) - * self.dimensions[i] = self.right_edge[i] - self.left_edge[i] - */ - __pyx_t_6 = __pyx_v_i; - __pyx_t_32 = -1; - if (__pyx_t_6 < 0) { - __pyx_t_6 += __pyx_bshape_0_left_index; - if (unlikely(__pyx_t_6 < 0)) __pyx_t_32 = 0; - } else if (unlikely(__pyx_t_6 >= __pyx_bshape_0_left_index)) __pyx_t_32 = 0; - if (unlikely(__pyx_t_32 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_32); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->left_edge[__pyx_v_i]) = __pyx_f_2yt_13ramses_reader_i64max((__pyx_v_temp_l[__pyx_v_i]), (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_index.buf, __pyx_t_6, __pyx_bstride_0_left_index))); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":703 - * for i in range(3): - * self.left_edge[i] = i64max(temp_l[i], left_index[i]) - * self.right_edge[i] = i64min(temp_r[i], left_index[i] + dimensions[i]) # <<<<<<<<<<<<<< - * self.dimensions[i] = self.right_edge[i] - self.left_edge[i] - * if self.dimensions[i] <= 0: - */ - __pyx_t_32 = __pyx_v_i; - __pyx_t_40 = -1; - if (__pyx_t_32 < 0) { - __pyx_t_32 += __pyx_bshape_0_left_index; - if (unlikely(__pyx_t_32 < 0)) __pyx_t_40 = 0; - } else if (unlikely(__pyx_t_32 >= __pyx_bshape_0_left_index)) __pyx_t_40 = 0; - if (unlikely(__pyx_t_40 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_40); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_40 = __pyx_v_i; - __pyx_t_41 = -1; - if (__pyx_t_40 < 0) { - __pyx_t_40 += __pyx_bshape_0_dimensions; - if (unlikely(__pyx_t_40 < 0)) __pyx_t_41 = 0; - } else if (unlikely(__pyx_t_40 >= __pyx_bshape_0_dimensions)) __pyx_t_41 = 0; - if (unlikely(__pyx_t_41 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_41); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->right_edge[__pyx_v_i]) = __pyx_f_2yt_13ramses_reader_i64min((__pyx_v_temp_r[__pyx_v_i]), ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_index.buf, __pyx_t_32, __pyx_bstride_0_left_index)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_dimensions.buf, __pyx_t_40, __pyx_bstride_0_dimensions)))); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":704 - * self.left_edge[i] = i64max(temp_l[i], left_index[i]) - * self.right_edge[i] = i64min(temp_r[i], left_index[i] + dimensions[i]) - * self.dimensions[i] = self.right_edge[i] - self.left_edge[i] # <<<<<<<<<<<<<< - * if self.dimensions[i] <= 0: - * self.efficiency = -1.0 - */ - (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dimensions[__pyx_v_i]) = ((((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->right_edge[__pyx_v_i]) - (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->left_edge[__pyx_v_i])); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":705 - * self.right_edge[i] = i64min(temp_r[i], left_index[i] + dimensions[i]) - * self.dimensions[i] = self.right_edge[i] - self.left_edge[i] - * if self.dimensions[i] <= 0: # <<<<<<<<<<<<<< - * self.efficiency = -1.0 - * return - */ - __pyx_t_16 = ((((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dimensions[__pyx_v_i]) <= 0); - if (__pyx_t_16) { - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":706 - * self.dimensions[i] = self.right_edge[i] - self.left_edge[i] - * if self.dimensions[i] <= 0: - * self.efficiency = -1.0 # <<<<<<<<<<<<<< - * return - * self.sigs.append(np.zeros(self.dimensions[i], 'int64')) - */ - ((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->efficiency = (-1.0); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":707 - * if self.dimensions[i] <= 0: - * self.efficiency = -1.0 - * return # <<<<<<<<<<<<<< - * self.sigs.append(np.zeros(self.dimensions[i], 'int64')) - * #print self.sigs[0].size, self.sigs[1].size, self.sigs[2].size - */ - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L15; - } - __pyx_L15:; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":708 - * self.efficiency = -1.0 - * return - * self.sigs.append(np.zeros(self.dimensions[i], 'int64')) # <<<<<<<<<<<<<< - * #print self.sigs[0].size, self.sigs[1].size, self.sigs[2].size - * - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_42 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_42); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_to_py_npy_int64((((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dimensions[__pyx_v_i])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_43 = PyTuple_New(2); if (unlikely(!__pyx_t_43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_43); - PyTuple_SET_ITEM(__pyx_t_43, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_n_s__int64)); - PyTuple_SET_ITEM(__pyx_t_43, 1, ((PyObject *)__pyx_n_s__int64)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__int64)); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_42, __pyx_t_43, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; - __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0; - __pyx_t_43 = __Pyx_PyObject_Append(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->sigs, __pyx_t_1); if (unlikely(!__pyx_t_43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_43); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0; - } - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":715 - * # pass. - * cdef np.ndarray[np.int64_t, ndim=1] sig0, sig1, sig2 - * sig0 = self.sigs[0] # <<<<<<<<<<<<<< - * sig1 = self.sigs[1] - * sig2 = self.sigs[2] - */ - __pyx_t_43 = __Pyx_GetItemInt(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->sigs, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_43) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_43); - if (!(likely(((__pyx_t_43) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_43, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_44 = ((PyArrayObject *)__pyx_t_43); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sig0); - __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_sig0, (PyObject*)__pyx_t_44, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_2 < 0)) { - PyErr_Fetch(&__pyx_t_45, &__pyx_t_46, &__pyx_t_47); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_sig0, (PyObject*)__pyx_v_sig0, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_46); Py_XDECREF(__pyx_t_47); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_45, __pyx_t_46, __pyx_t_47); - } - } - __pyx_bstride_0_sig0 = __pyx_bstruct_sig0.strides[0]; - __pyx_bshape_0_sig0 = __pyx_bstruct_sig0.shape[0]; - if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_44 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_sig0)); - __pyx_v_sig0 = ((PyArrayObject *)__pyx_t_43); - __pyx_t_43 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":716 - * cdef np.ndarray[np.int64_t, ndim=1] sig0, sig1, sig2 - * sig0 = self.sigs[0] - * sig1 = self.sigs[1] # <<<<<<<<<<<<<< - * sig2 = self.sigs[2] - * efficiency = 0.0 - */ - __pyx_t_43 = __Pyx_GetItemInt(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->sigs, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_43) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_43); - if (!(likely(((__pyx_t_43) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_43, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_44 = ((PyArrayObject *)__pyx_t_43); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sig1); - __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_sig1, (PyObject*)__pyx_t_44, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_2 < 0)) { - PyErr_Fetch(&__pyx_t_47, &__pyx_t_46, &__pyx_t_45); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_sig1, (PyObject*)__pyx_v_sig1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_47); Py_XDECREF(__pyx_t_46); Py_XDECREF(__pyx_t_45); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_47, __pyx_t_46, __pyx_t_45); - } - } - __pyx_bstride_0_sig1 = __pyx_bstruct_sig1.strides[0]; - __pyx_bshape_0_sig1 = __pyx_bstruct_sig1.shape[0]; - if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_44 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_sig1)); - __pyx_v_sig1 = ((PyArrayObject *)__pyx_t_43); - __pyx_t_43 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":717 - * sig0 = self.sigs[0] - * sig1 = self.sigs[1] - * sig2 = self.sigs[2] # <<<<<<<<<<<<<< - * efficiency = 0.0 - * cdef int used - */ - __pyx_t_43 = __Pyx_GetItemInt(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->sigs, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_43) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_43); - if (!(likely(((__pyx_t_43) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_43, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_44 = ((PyArrayObject *)__pyx_t_43); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sig2); - __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_sig2, (PyObject*)__pyx_t_44, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_2 < 0)) { - PyErr_Fetch(&__pyx_t_45, &__pyx_t_46, &__pyx_t_47); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_sig2, (PyObject*)__pyx_v_sig2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_46); Py_XDECREF(__pyx_t_47); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_45, __pyx_t_46, __pyx_t_47); - } - } - __pyx_bstride_0_sig2 = __pyx_bstruct_sig2.strides[0]; - __pyx_bshape_0_sig2 = __pyx_bstruct_sig2.shape[0]; - if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_44 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_sig2)); - __pyx_v_sig2 = ((PyArrayObject *)__pyx_t_43); - __pyx_t_43 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":718 - * sig1 = self.sigs[1] - * sig2 = self.sigs[2] - * efficiency = 0.0 # <<<<<<<<<<<<<< - * cdef int used - * self.grid_file_locations = [] - */ - __pyx_v_efficiency = 0.0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":720 - * efficiency = 0.0 - * cdef int used - * self.grid_file_locations = [] # <<<<<<<<<<<<<< - * for gi in range(ng): - * used = 0 - */ - __pyx_t_43 = PyList_New(0); if (unlikely(!__pyx_t_43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_43)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_43)); - __Pyx_GOTREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->grid_file_locations); - __Pyx_DECREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->grid_file_locations); - ((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->grid_file_locations = ((PyObject *)__pyx_t_43); - __pyx_t_43 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":721 - * cdef int used - * self.grid_file_locations = [] - * for gi in range(ng): # <<<<<<<<<<<<<< - * used = 0 - * nnn = 0 - */ - __pyx_t_2 = __pyx_v_ng; - for (__pyx_t_41 = 0; __pyx_t_41 < __pyx_t_2; __pyx_t_41+=1) { - __pyx_v_gi = __pyx_t_41; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":722 - * self.grid_file_locations = [] - * for gi in range(ng): - * used = 0 # <<<<<<<<<<<<<< - * nnn = 0 - * for l0 in range(grid_dimensions[gi, 0]): - */ - __pyx_v_used = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":723 - * for gi in range(ng): - * used = 0 - * nnn = 0 # <<<<<<<<<<<<<< - * for l0 in range(grid_dimensions[gi, 0]): - * i0 = left_edges[gi, 0] + l0 - */ - __pyx_v_nnn = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":724 - * used = 0 - * nnn = 0 - * for l0 in range(grid_dimensions[gi, 0]): # <<<<<<<<<<<<<< - * i0 = left_edges[gi, 0] + l0 - * if i0 < self.left_edge[0]: continue - */ - __pyx_t_48 = __pyx_v_gi; - __pyx_t_49 = 0; - __pyx_t_50 = -1; - if (__pyx_t_48 < 0) { - __pyx_t_48 += __pyx_bshape_0_grid_dimensions; - if (unlikely(__pyx_t_48 < 0)) __pyx_t_50 = 0; - } else if (unlikely(__pyx_t_48 >= __pyx_bshape_0_grid_dimensions)) __pyx_t_50 = 0; - if (__pyx_t_49 < 0) { - __pyx_t_49 += __pyx_bshape_1_grid_dimensions; - if (unlikely(__pyx_t_49 < 0)) __pyx_t_50 = 1; - } else if (unlikely(__pyx_t_49 >= __pyx_bshape_1_grid_dimensions)) __pyx_t_50 = 1; - if (unlikely(__pyx_t_50 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_50); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_51 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_grid_dimensions.buf, __pyx_t_48, __pyx_bstride_0_grid_dimensions, __pyx_t_49, __pyx_bstride_1_grid_dimensions)); - for (__pyx_t_50 = 0; __pyx_t_50 < __pyx_t_51; __pyx_t_50+=1) { - __pyx_v_l0 = __pyx_t_50; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":725 - * nnn = 0 - * for l0 in range(grid_dimensions[gi, 0]): - * i0 = left_edges[gi, 0] + l0 # <<<<<<<<<<<<<< - * if i0 < self.left_edge[0]: continue - * if i0 >= self.right_edge[0]: break - */ - __pyx_t_52 = __pyx_v_gi; - __pyx_t_53 = 0; - __pyx_t_54 = -1; - if (__pyx_t_52 < 0) { - __pyx_t_52 += __pyx_bshape_0_left_edges; - if (unlikely(__pyx_t_52 < 0)) __pyx_t_54 = 0; - } else if (unlikely(__pyx_t_52 >= __pyx_bshape_0_left_edges)) __pyx_t_54 = 0; - if (__pyx_t_53 < 0) { - __pyx_t_53 += __pyx_bshape_1_left_edges; - if (unlikely(__pyx_t_53 < 0)) __pyx_t_54 = 1; - } else if (unlikely(__pyx_t_53 >= __pyx_bshape_1_left_edges)) __pyx_t_54 = 1; - if (unlikely(__pyx_t_54 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_54); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_i0 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_edges.buf, __pyx_t_52, __pyx_bstride_0_left_edges, __pyx_t_53, __pyx_bstride_1_left_edges)) + __pyx_v_l0); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":726 - * for l0 in range(grid_dimensions[gi, 0]): - * i0 = left_edges[gi, 0] + l0 - * if i0 < self.left_edge[0]: continue # <<<<<<<<<<<<<< - * if i0 >= self.right_edge[0]: break - * for l1 in range(grid_dimensions[gi, 1]): - */ - __pyx_t_16 = (__pyx_v_i0 < (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->left_edge[0])); - if (__pyx_t_16) { - goto __pyx_L18_continue; - goto __pyx_L20; - } - __pyx_L20:; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":727 - * i0 = left_edges[gi, 0] + l0 - * if i0 < self.left_edge[0]: continue - * if i0 >= self.right_edge[0]: break # <<<<<<<<<<<<<< - * for l1 in range(grid_dimensions[gi, 1]): - * i1 = left_edges[gi, 1] + l1 - */ - __pyx_t_16 = (__pyx_v_i0 >= (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->right_edge[0])); - if (__pyx_t_16) { - goto __pyx_L19_break; - goto __pyx_L21; - } - __pyx_L21:; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":728 - * if i0 < self.left_edge[0]: continue - * if i0 >= self.right_edge[0]: break - * for l1 in range(grid_dimensions[gi, 1]): # <<<<<<<<<<<<<< - * i1 = left_edges[gi, 1] + l1 - * if i1 < self.left_edge[1]: continue - */ - __pyx_t_54 = __pyx_v_gi; - __pyx_t_55 = 1; - __pyx_t_56 = -1; - if (__pyx_t_54 < 0) { - __pyx_t_54 += __pyx_bshape_0_grid_dimensions; - if (unlikely(__pyx_t_54 < 0)) __pyx_t_56 = 0; - } else if (unlikely(__pyx_t_54 >= __pyx_bshape_0_grid_dimensions)) __pyx_t_56 = 0; - if (__pyx_t_55 < 0) { - __pyx_t_55 += __pyx_bshape_1_grid_dimensions; - if (unlikely(__pyx_t_55 < 0)) __pyx_t_56 = 1; - } else if (unlikely(__pyx_t_55 >= __pyx_bshape_1_grid_dimensions)) __pyx_t_56 = 1; - if (unlikely(__pyx_t_56 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_56); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_57 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_grid_dimensions.buf, __pyx_t_54, __pyx_bstride_0_grid_dimensions, __pyx_t_55, __pyx_bstride_1_grid_dimensions)); - for (__pyx_t_56 = 0; __pyx_t_56 < __pyx_t_57; __pyx_t_56+=1) { - __pyx_v_l1 = __pyx_t_56; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":729 - * if i0 >= self.right_edge[0]: break - * for l1 in range(grid_dimensions[gi, 1]): - * i1 = left_edges[gi, 1] + l1 # <<<<<<<<<<<<<< - * if i1 < self.left_edge[1]: continue - * if i1 >= self.right_edge[1]: break - */ - __pyx_t_58 = __pyx_v_gi; - __pyx_t_59 = 1; - __pyx_t_60 = -1; - if (__pyx_t_58 < 0) { - __pyx_t_58 += __pyx_bshape_0_left_edges; - if (unlikely(__pyx_t_58 < 0)) __pyx_t_60 = 0; - } else if (unlikely(__pyx_t_58 >= __pyx_bshape_0_left_edges)) __pyx_t_60 = 0; - if (__pyx_t_59 < 0) { - __pyx_t_59 += __pyx_bshape_1_left_edges; - if (unlikely(__pyx_t_59 < 0)) __pyx_t_60 = 1; - } else if (unlikely(__pyx_t_59 >= __pyx_bshape_1_left_edges)) __pyx_t_60 = 1; - if (unlikely(__pyx_t_60 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_60); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_i1 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_edges.buf, __pyx_t_58, __pyx_bstride_0_left_edges, __pyx_t_59, __pyx_bstride_1_left_edges)) + __pyx_v_l1); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":730 - * for l1 in range(grid_dimensions[gi, 1]): - * i1 = left_edges[gi, 1] + l1 - * if i1 < self.left_edge[1]: continue # <<<<<<<<<<<<<< - * if i1 >= self.right_edge[1]: break - * for l2 in range(grid_dimensions[gi, 2]): - */ - __pyx_t_16 = (__pyx_v_i1 < (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->left_edge[1])); - if (__pyx_t_16) { - goto __pyx_L22_continue; - goto __pyx_L24; - } - __pyx_L24:; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":731 - * i1 = left_edges[gi, 1] + l1 - * if i1 < self.left_edge[1]: continue - * if i1 >= self.right_edge[1]: break # <<<<<<<<<<<<<< - * for l2 in range(grid_dimensions[gi, 2]): - * i2 = left_edges[gi, 2] + l2 - */ - __pyx_t_16 = (__pyx_v_i1 >= (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->right_edge[1])); - if (__pyx_t_16) { - goto __pyx_L23_break; - goto __pyx_L25; - } - __pyx_L25:; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":732 - * if i1 < self.left_edge[1]: continue - * if i1 >= self.right_edge[1]: break - * for l2 in range(grid_dimensions[gi, 2]): # <<<<<<<<<<<<<< - * i2 = left_edges[gi, 2] + l2 - * if i2 < self.left_edge[2]: continue - */ - __pyx_t_60 = __pyx_v_gi; - __pyx_t_61 = 2; - __pyx_t_62 = -1; - if (__pyx_t_60 < 0) { - __pyx_t_60 += __pyx_bshape_0_grid_dimensions; - if (unlikely(__pyx_t_60 < 0)) __pyx_t_62 = 0; - } else if (unlikely(__pyx_t_60 >= __pyx_bshape_0_grid_dimensions)) __pyx_t_62 = 0; - if (__pyx_t_61 < 0) { - __pyx_t_61 += __pyx_bshape_1_grid_dimensions; - if (unlikely(__pyx_t_61 < 0)) __pyx_t_62 = 1; - } else if (unlikely(__pyx_t_61 >= __pyx_bshape_1_grid_dimensions)) __pyx_t_62 = 1; - if (unlikely(__pyx_t_62 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_62); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_63 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_grid_dimensions.buf, __pyx_t_60, __pyx_bstride_0_grid_dimensions, __pyx_t_61, __pyx_bstride_1_grid_dimensions)); - for (__pyx_t_62 = 0; __pyx_t_62 < __pyx_t_63; __pyx_t_62+=1) { - __pyx_v_l2 = __pyx_t_62; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":733 - * if i1 >= self.right_edge[1]: break - * for l2 in range(grid_dimensions[gi, 2]): - * i2 = left_edges[gi, 2] + l2 # <<<<<<<<<<<<<< - * if i2 < self.left_edge[2]: continue - * if i2 >= self.right_edge[2]: break - */ - __pyx_t_64 = __pyx_v_gi; - __pyx_t_65 = 2; - __pyx_t_66 = -1; - if (__pyx_t_64 < 0) { - __pyx_t_64 += __pyx_bshape_0_left_edges; - if (unlikely(__pyx_t_64 < 0)) __pyx_t_66 = 0; - } else if (unlikely(__pyx_t_64 >= __pyx_bshape_0_left_edges)) __pyx_t_66 = 0; - if (__pyx_t_65 < 0) { - __pyx_t_65 += __pyx_bshape_1_left_edges; - if (unlikely(__pyx_t_65 < 0)) __pyx_t_66 = 1; - } else if (unlikely(__pyx_t_65 >= __pyx_bshape_1_left_edges)) __pyx_t_66 = 1; - if (unlikely(__pyx_t_66 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_66); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_i2 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_edges.buf, __pyx_t_64, __pyx_bstride_0_left_edges, __pyx_t_65, __pyx_bstride_1_left_edges)) + __pyx_v_l2); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":734 - * for l2 in range(grid_dimensions[gi, 2]): - * i2 = left_edges[gi, 2] + l2 - * if i2 < self.left_edge[2]: continue # <<<<<<<<<<<<<< - * if i2 >= self.right_edge[2]: break - * i = i0 - self.left_edge[0] - */ - __pyx_t_16 = (__pyx_v_i2 < (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->left_edge[2])); - if (__pyx_t_16) { - goto __pyx_L26_continue; - goto __pyx_L28; - } - __pyx_L28:; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":735 - * i2 = left_edges[gi, 2] + l2 - * if i2 < self.left_edge[2]: continue - * if i2 >= self.right_edge[2]: break # <<<<<<<<<<<<<< - * i = i0 - self.left_edge[0] - * sig0[i] += 1 - */ - __pyx_t_16 = (__pyx_v_i2 >= (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->right_edge[2])); - if (__pyx_t_16) { - goto __pyx_L27_break; - goto __pyx_L29; - } - __pyx_L29:; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":736 - * if i2 < self.left_edge[2]: continue - * if i2 >= self.right_edge[2]: break - * i = i0 - self.left_edge[0] # <<<<<<<<<<<<<< - * sig0[i] += 1 - * i = i1 - self.left_edge[1] - */ - __pyx_v_i = (__pyx_v_i0 - (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->left_edge[0])); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":737 - * if i2 >= self.right_edge[2]: break - * i = i0 - self.left_edge[0] - * sig0[i] += 1 # <<<<<<<<<<<<<< - * i = i1 - self.left_edge[1] - * sig1[i] += 1 - */ - __pyx_t_66 = __pyx_v_i; - __pyx_t_67 = -1; - if (__pyx_t_66 < 0) { - __pyx_t_66 += __pyx_bshape_0_sig0; - if (unlikely(__pyx_t_66 < 0)) __pyx_t_67 = 0; - } else if (unlikely(__pyx_t_66 >= __pyx_bshape_0_sig0)) __pyx_t_67 = 0; - if (unlikely(__pyx_t_67 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_67); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_sig0.buf, __pyx_t_66, __pyx_bstride_0_sig0) += 1; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":738 - * i = i0 - self.left_edge[0] - * sig0[i] += 1 - * i = i1 - self.left_edge[1] # <<<<<<<<<<<<<< - * sig1[i] += 1 - * i = i2 - self.left_edge[2] - */ - __pyx_v_i = (__pyx_v_i1 - (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->left_edge[1])); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":739 - * sig0[i] += 1 - * i = i1 - self.left_edge[1] - * sig1[i] += 1 # <<<<<<<<<<<<<< - * i = i2 - self.left_edge[2] - * sig2[i] += 1 - */ - __pyx_t_67 = __pyx_v_i; - __pyx_t_68 = -1; - if (__pyx_t_67 < 0) { - __pyx_t_67 += __pyx_bshape_0_sig1; - if (unlikely(__pyx_t_67 < 0)) __pyx_t_68 = 0; - } else if (unlikely(__pyx_t_67 >= __pyx_bshape_0_sig1)) __pyx_t_68 = 0; - if (unlikely(__pyx_t_68 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_68); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_sig1.buf, __pyx_t_67, __pyx_bstride_0_sig1) += 1; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":740 - * i = i1 - self.left_edge[1] - * sig1[i] += 1 - * i = i2 - self.left_edge[2] # <<<<<<<<<<<<<< - * sig2[i] += 1 - * efficiency += 1 - */ - __pyx_v_i = (__pyx_v_i2 - (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->left_edge[2])); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":741 - * sig1[i] += 1 - * i = i2 - self.left_edge[2] - * sig2[i] += 1 # <<<<<<<<<<<<<< - * efficiency += 1 - * used = 1 - */ - __pyx_t_68 = __pyx_v_i; - __pyx_t_69 = -1; - if (__pyx_t_68 < 0) { - __pyx_t_68 += __pyx_bshape_0_sig2; - if (unlikely(__pyx_t_68 < 0)) __pyx_t_69 = 0; - } else if (unlikely(__pyx_t_68 >= __pyx_bshape_0_sig2)) __pyx_t_69 = 0; - if (unlikely(__pyx_t_69 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_69); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_sig2.buf, __pyx_t_68, __pyx_bstride_0_sig2) += 1; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":742 - * i = i2 - self.left_edge[2] - * sig2[i] += 1 - * efficiency += 1 # <<<<<<<<<<<<<< - * used = 1 - * if used == 1: - */ - __pyx_v_efficiency += 1.0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":743 - * sig2[i] += 1 - * efficiency += 1 - * used = 1 # <<<<<<<<<<<<<< - * if used == 1: - * grid_file_locations[gi,3] = left_edges[gi, 0] - */ - __pyx_v_used = 1; - __pyx_L26_continue:; - } - __pyx_L27_break:; - __pyx_L22_continue:; - } - __pyx_L23_break:; - __pyx_L18_continue:; - } - __pyx_L19_break:; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":744 - * efficiency += 1 - * used = 1 - * if used == 1: # <<<<<<<<<<<<<< - * grid_file_locations[gi,3] = left_edges[gi, 0] - * grid_file_locations[gi,4] = left_edges[gi, 1] - */ - __pyx_t_16 = (__pyx_v_used == 1); - if (__pyx_t_16) { - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":745 - * used = 1 - * if used == 1: - * grid_file_locations[gi,3] = left_edges[gi, 0] # <<<<<<<<<<<<<< - * grid_file_locations[gi,4] = left_edges[gi, 1] - * grid_file_locations[gi,5] = left_edges[gi, 2] - */ - __pyx_t_50 = __pyx_v_gi; - __pyx_t_70 = 0; - __pyx_t_56 = -1; - if (__pyx_t_50 < 0) { - __pyx_t_50 += __pyx_bshape_0_left_edges; - if (unlikely(__pyx_t_50 < 0)) __pyx_t_56 = 0; - } else if (unlikely(__pyx_t_50 >= __pyx_bshape_0_left_edges)) __pyx_t_56 = 0; - if (__pyx_t_70 < 0) { - __pyx_t_70 += __pyx_bshape_1_left_edges; - if (unlikely(__pyx_t_70 < 0)) __pyx_t_56 = 1; - } else if (unlikely(__pyx_t_70 >= __pyx_bshape_1_left_edges)) __pyx_t_56 = 1; - if (unlikely(__pyx_t_56 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_56); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_56 = __pyx_v_gi; - __pyx_t_71 = 3; - __pyx_t_62 = -1; - if (__pyx_t_56 < 0) { - __pyx_t_56 += __pyx_bshape_0_grid_file_locations; - if (unlikely(__pyx_t_56 < 0)) __pyx_t_62 = 0; - } else if (unlikely(__pyx_t_56 >= __pyx_bshape_0_grid_file_locations)) __pyx_t_62 = 0; - if (__pyx_t_71 < 0) { - __pyx_t_71 += __pyx_bshape_1_grid_file_locations; - if (unlikely(__pyx_t_71 < 0)) __pyx_t_62 = 1; - } else if (unlikely(__pyx_t_71 >= __pyx_bshape_1_grid_file_locations)) __pyx_t_62 = 1; - if (unlikely(__pyx_t_62 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_62); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_grid_file_locations.buf, __pyx_t_56, __pyx_bstride_0_grid_file_locations, __pyx_t_71, __pyx_bstride_1_grid_file_locations) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_edges.buf, __pyx_t_50, __pyx_bstride_0_left_edges, __pyx_t_70, __pyx_bstride_1_left_edges)); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":746 - * if used == 1: - * grid_file_locations[gi,3] = left_edges[gi, 0] - * grid_file_locations[gi,4] = left_edges[gi, 1] # <<<<<<<<<<<<<< - * grid_file_locations[gi,5] = left_edges[gi, 2] - * self.grid_file_locations.append(grid_file_locations[gi,:]) - */ - __pyx_t_62 = __pyx_v_gi; - __pyx_t_72 = 1; - __pyx_t_69 = -1; - if (__pyx_t_62 < 0) { - __pyx_t_62 += __pyx_bshape_0_left_edges; - if (unlikely(__pyx_t_62 < 0)) __pyx_t_69 = 0; - } else if (unlikely(__pyx_t_62 >= __pyx_bshape_0_left_edges)) __pyx_t_69 = 0; - if (__pyx_t_72 < 0) { - __pyx_t_72 += __pyx_bshape_1_left_edges; - if (unlikely(__pyx_t_72 < 0)) __pyx_t_69 = 1; - } else if (unlikely(__pyx_t_72 >= __pyx_bshape_1_left_edges)) __pyx_t_69 = 1; - if (unlikely(__pyx_t_69 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_69); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_69 = __pyx_v_gi; - __pyx_t_73 = 4; - __pyx_t_74 = -1; - if (__pyx_t_69 < 0) { - __pyx_t_69 += __pyx_bshape_0_grid_file_locations; - if (unlikely(__pyx_t_69 < 0)) __pyx_t_74 = 0; - } else if (unlikely(__pyx_t_69 >= __pyx_bshape_0_grid_file_locations)) __pyx_t_74 = 0; - if (__pyx_t_73 < 0) { - __pyx_t_73 += __pyx_bshape_1_grid_file_locations; - if (unlikely(__pyx_t_73 < 0)) __pyx_t_74 = 1; - } else if (unlikely(__pyx_t_73 >= __pyx_bshape_1_grid_file_locations)) __pyx_t_74 = 1; - if (unlikely(__pyx_t_74 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_74); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_grid_file_locations.buf, __pyx_t_69, __pyx_bstride_0_grid_file_locations, __pyx_t_73, __pyx_bstride_1_grid_file_locations) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_edges.buf, __pyx_t_62, __pyx_bstride_0_left_edges, __pyx_t_72, __pyx_bstride_1_left_edges)); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":747 - * grid_file_locations[gi,3] = left_edges[gi, 0] - * grid_file_locations[gi,4] = left_edges[gi, 1] - * grid_file_locations[gi,5] = left_edges[gi, 2] # <<<<<<<<<<<<<< - * self.grid_file_locations.append(grid_file_locations[gi,:]) - * - */ - __pyx_t_74 = __pyx_v_gi; - __pyx_t_75 = 2; - __pyx_t_76 = -1; - if (__pyx_t_74 < 0) { - __pyx_t_74 += __pyx_bshape_0_left_edges; - if (unlikely(__pyx_t_74 < 0)) __pyx_t_76 = 0; - } else if (unlikely(__pyx_t_74 >= __pyx_bshape_0_left_edges)) __pyx_t_76 = 0; - if (__pyx_t_75 < 0) { - __pyx_t_75 += __pyx_bshape_1_left_edges; - if (unlikely(__pyx_t_75 < 0)) __pyx_t_76 = 1; - } else if (unlikely(__pyx_t_75 >= __pyx_bshape_1_left_edges)) __pyx_t_76 = 1; - if (unlikely(__pyx_t_76 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_76); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_76 = __pyx_v_gi; - __pyx_t_77 = 5; - __pyx_t_78 = -1; - if (__pyx_t_76 < 0) { - __pyx_t_76 += __pyx_bshape_0_grid_file_locations; - if (unlikely(__pyx_t_76 < 0)) __pyx_t_78 = 0; - } else if (unlikely(__pyx_t_76 >= __pyx_bshape_0_grid_file_locations)) __pyx_t_78 = 0; - if (__pyx_t_77 < 0) { - __pyx_t_77 += __pyx_bshape_1_grid_file_locations; - if (unlikely(__pyx_t_77 < 0)) __pyx_t_78 = 1; - } else if (unlikely(__pyx_t_77 >= __pyx_bshape_1_grid_file_locations)) __pyx_t_78 = 1; - if (unlikely(__pyx_t_78 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_78); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_grid_file_locations.buf, __pyx_t_76, __pyx_bstride_0_grid_file_locations, __pyx_t_77, __pyx_bstride_1_grid_file_locations) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_left_edges.buf, __pyx_t_74, __pyx_bstride_0_left_edges, __pyx_t_75, __pyx_bstride_1_left_edges)); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":748 - * grid_file_locations[gi,4] = left_edges[gi, 1] - * grid_file_locations[gi,5] = left_edges[gi, 2] - * self.grid_file_locations.append(grid_file_locations[gi,:]) # <<<<<<<<<<<<<< - * - * self.dd = np.ones(3, dtype='int64') - */ - __pyx_t_43 = PyInt_FromLong(__pyx_v_gi); if (unlikely(!__pyx_t_43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_43); - __pyx_t_1 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_42 = PyTuple_New(2); if (unlikely(!__pyx_t_42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_42); - PyTuple_SET_ITEM(__pyx_t_42, 0, __pyx_t_43); - __Pyx_GIVEREF(__pyx_t_43); - PyTuple_SET_ITEM(__pyx_t_42, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_43 = 0; - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_grid_file_locations), __pyx_t_42); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; - __pyx_t_42 = __Pyx_PyObject_Append(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->grid_file_locations, __pyx_t_1); if (unlikely(!__pyx_t_42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_42); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; - goto __pyx_L30; - } - __pyx_L30:; - } - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":750 - * self.grid_file_locations.append(grid_file_locations[gi,:]) - * - * self.dd = np.ones(3, dtype='int64') # <<<<<<<<<<<<<< - * for i in range(3): - * efficiency /= self.dimensions[i] - */ - __pyx_t_42 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_42); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_42, __pyx_n_s__ones); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; - __pyx_t_42 = PyTuple_New(1); if (unlikely(!__pyx_t_42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_42); - __Pyx_INCREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_42, 0, __pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - __pyx_t_43 = PyDict_New(); if (unlikely(!__pyx_t_43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_43)); - if (PyDict_SetItem(__pyx_t_43, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__int64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_79 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_42, ((PyObject *)__pyx_t_43)); if (unlikely(!__pyx_t_79)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_79); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_43)); __pyx_t_43 = 0; - __Pyx_GIVEREF(__pyx_t_79); - __Pyx_GOTREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dd); - __Pyx_DECREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dd); - ((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dd = __pyx_t_79; - __pyx_t_79 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":751 - * - * self.dd = np.ones(3, dtype='int64') - * for i in range(3): # <<<<<<<<<<<<<< - * efficiency /= self.dimensions[i] - * self.dd[i] = self.dimensions[i] - */ - for (__pyx_t_2 = 0; __pyx_t_2 < 3; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":752 - * self.dd = np.ones(3, dtype='int64') - * for i in range(3): - * efficiency /= self.dimensions[i] # <<<<<<<<<<<<<< - * self.dd[i] = self.dimensions[i] - * #print "Efficiency is %0.3e" % (efficiency) - */ - __pyx_v_efficiency /= (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dimensions[__pyx_v_i]); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":753 - * for i in range(3): - * efficiency /= self.dimensions[i] - * self.dd[i] = self.dimensions[i] # <<<<<<<<<<<<<< - * #print "Efficiency is %0.3e" % (efficiency) - * self.efficiency = efficiency - */ - __pyx_t_79 = __Pyx_PyInt_to_py_npy_int64((((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dimensions[__pyx_v_i])); if (unlikely(!__pyx_t_79)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_79); - if (__Pyx_SetItemInt(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dd, __pyx_v_i, __pyx_t_79, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_79); __pyx_t_79 = 0; - } - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":755 - * self.dd[i] = self.dimensions[i] - * #print "Efficiency is %0.3e" % (efficiency) - * self.efficiency = efficiency # <<<<<<<<<<<<<< - * - * def find_split(self): - */ - ((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->efficiency = __pyx_v_efficiency; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_42); - __Pyx_XDECREF(__pyx_t_43); - __Pyx_XDECREF(__pyx_t_79); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_right_edges); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_index); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dimensions); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_file_locations); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_dimensions); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sig1); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sig2); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sig0); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edges); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.ramses_reader.ProtoSubgrid.__cinit__"); - __pyx_r = -1; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_right_edges); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_index); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dimensions); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_file_locations); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_dimensions); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sig1); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sig2); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sig0); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edges); - __pyx_L2:; - __Pyx_DECREF((PyObject *)__pyx_v_sig0); - __Pyx_DECREF((PyObject *)__pyx_v_sig1); - __Pyx_DECREF((PyObject *)__pyx_v_sig2); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":757 - * self.efficiency = efficiency - * - * def find_split(self): # <<<<<<<<<<<<<< - * # First look for zeros - * cdef int i, center, ax - */ - -static PyObject *__pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_find_split(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_find_split(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - int __pyx_v_i; - int __pyx_v_center; - int __pyx_v_ax; - PyArrayObject *__pyx_v_axes; - __pyx_t_5numpy_int64_t __pyx_v_strength; - __pyx_t_5numpy_int64_t __pyx_v_zcstrength; - __pyx_t_5numpy_int64_t __pyx_v_zcp; - PyArrayObject *__pyx_v_sig; - long __pyx_v_axi; - long __pyx_v_zca; - __pyx_t_5numpy_int64_t *__pyx_v_sig2d; - Py_buffer __pyx_bstruct_axes; - Py_ssize_t __pyx_bstride_0_axes = 0; - Py_ssize_t __pyx_bshape_0_axes = 0; - Py_buffer __pyx_bstruct_sig; - Py_ssize_t __pyx_bstride_0_sig = 0; - Py_ssize_t __pyx_bshape_0_sig = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyArrayObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - long __pyx_t_9; - long __pyx_t_10; - PyArrayObject *__pyx_t_11 = NULL; - __pyx_t_5numpy_int64_t __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - int __pyx_t_18; - long __pyx_t_19; - long __pyx_t_20; - int __pyx_t_21; - long __pyx_t_22; - __Pyx_RefNannySetupContext("find_split"); - __pyx_v_axes = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_sig = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_bstruct_axes.buf = NULL; - __pyx_bstruct_sig.buf = NULL; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":762 - * cdef np.ndarray[ndim=1, dtype=np.int64_t] axes - * cdef np.int64_t strength, zcstrength, zcp - * axes = np.argsort(self.dd)[::-1] # <<<<<<<<<<<<<< - * cdef np.ndarray[np.int64_t] sig - * for axi in range(3): - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__argsort); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dd); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dd); - __Pyx_GIVEREF(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dd); - __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetItem(__pyx_t_3, __pyx_t_1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = ((PyArrayObject *)__pyx_t_2); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_axes); - __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_axes, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_5 < 0)) { - PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_axes, (PyObject*)__pyx_v_axes, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8); - } - } - __pyx_bstride_0_axes = __pyx_bstruct_axes.strides[0]; - __pyx_bshape_0_axes = __pyx_bstruct_axes.shape[0]; - if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_axes)); - __pyx_v_axes = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":764 - * axes = np.argsort(self.dd)[::-1] - * cdef np.ndarray[np.int64_t] sig - * for axi in range(3): # <<<<<<<<<<<<<< - * ax = axes[axi] - * center = self.dimensions[ax] / 2 - */ - for (__pyx_t_9 = 0; __pyx_t_9 < 3; __pyx_t_9+=1) { - __pyx_v_axi = __pyx_t_9; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":765 - * cdef np.ndarray[np.int64_t] sig - * for axi in range(3): - * ax = axes[axi] # <<<<<<<<<<<<<< - * center = self.dimensions[ax] / 2 - * sig = self.sigs[ax] - */ - __pyx_t_10 = __pyx_v_axi; - __pyx_t_5 = -1; - if (__pyx_t_10 < 0) { - __pyx_t_10 += __pyx_bshape_0_axes; - if (unlikely(__pyx_t_10 < 0)) __pyx_t_5 = 0; - } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_axes)) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_ax = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_axes.buf, __pyx_t_10, __pyx_bstride_0_axes)); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":766 - * for axi in range(3): - * ax = axes[axi] - * center = self.dimensions[ax] / 2 # <<<<<<<<<<<<<< - * sig = self.sigs[ax] - * for i in range(self.dimensions[ax]): - */ - __pyx_v_center = __Pyx_div___pyx_t_5numpy_int64_t((((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dimensions[__pyx_v_ax]), 2); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":767 - * ax = axes[axi] - * center = self.dimensions[ax] / 2 - * sig = self.sigs[ax] # <<<<<<<<<<<<<< - * for i in range(self.dimensions[ax]): - * if sig[i] == 0 and i > 0 and i < self.dimensions[ax] - 1: - */ - __pyx_t_2 = __Pyx_GetItemInt(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->sigs, __pyx_v_ax, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_11 = ((PyArrayObject *)__pyx_t_2); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sig); - __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_sig, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_5 < 0)) { - PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_sig, (PyObject*)__pyx_v_sig, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6); - } - } - __pyx_bstride_0_sig = __pyx_bstruct_sig.strides[0]; - __pyx_bshape_0_sig = __pyx_bstruct_sig.shape[0]; - if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_11 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_sig)); - __pyx_v_sig = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":768 - * center = self.dimensions[ax] / 2 - * sig = self.sigs[ax] - * for i in range(self.dimensions[ax]): # <<<<<<<<<<<<<< - * if sig[i] == 0 and i > 0 and i < self.dimensions[ax] - 1: - * #print "zero: %s (%s)" % (i, self.dimensions[ax]) - */ - __pyx_t_12 = (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dimensions[__pyx_v_ax]); - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_12; __pyx_t_5+=1) { - __pyx_v_i = __pyx_t_5; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":769 - * sig = self.sigs[ax] - * for i in range(self.dimensions[ax]): - * if sig[i] == 0 and i > 0 and i < self.dimensions[ax] - 1: # <<<<<<<<<<<<<< - * #print "zero: %s (%s)" % (i, self.dimensions[ax]) - * return 'zs', ax, i - */ - __pyx_t_13 = __pyx_v_i; - __pyx_t_14 = -1; - if (__pyx_t_13 < 0) { - __pyx_t_13 += __pyx_bshape_0_sig; - if (unlikely(__pyx_t_13 < 0)) __pyx_t_14 = 0; - } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_sig)) __pyx_t_14 = 0; - if (unlikely(__pyx_t_14 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_14); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_15 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_sig.buf, __pyx_t_13, __pyx_bstride_0_sig)) == 0); - if (__pyx_t_15) { - __pyx_t_16 = (__pyx_v_i > 0); - if (__pyx_t_16) { - __pyx_t_17 = (__pyx_v_i < ((((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dimensions[__pyx_v_ax]) - 1)); - __pyx_t_18 = __pyx_t_17; - } else { - __pyx_t_18 = __pyx_t_16; - } - __pyx_t_16 = __pyx_t_18; - } else { - __pyx_t_16 = __pyx_t_15; - } - if (__pyx_t_16) { - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":771 - * if sig[i] == 0 and i > 0 and i < self.dimensions[ax] - 1: - * #print "zero: %s (%s)" % (i, self.dimensions[ax]) - * return 'zs', ax, i # <<<<<<<<<<<<<< - * zcstrength = 0 - * zcp = 0 - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyInt_FromLong(__pyx_v_ax); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_n_s__zs)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_s__zs)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__zs)); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_2 = 0; - __pyx_t_1 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - goto __pyx_L9; - } - __pyx_L9:; - } - } - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":772 - * #print "zero: %s (%s)" % (i, self.dimensions[ax]) - * return 'zs', ax, i - * zcstrength = 0 # <<<<<<<<<<<<<< - * zcp = 0 - * zca = -1 - */ - __pyx_v_zcstrength = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":773 - * return 'zs', ax, i - * zcstrength = 0 - * zcp = 0 # <<<<<<<<<<<<<< - * zca = -1 - * cdef int temp - */ - __pyx_v_zcp = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":774 - * zcstrength = 0 - * zcp = 0 - * zca = -1 # <<<<<<<<<<<<<< - * cdef int temp - * cdef np.int64_t *sig2d - */ - __pyx_v_zca = -1; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":777 - * cdef int temp - * cdef np.int64_t *sig2d - * for axi in range(3): # <<<<<<<<<<<<<< - * ax = axes[axi] - * sig = self.sigs[ax] - */ - for (__pyx_t_9 = 0; __pyx_t_9 < 3; __pyx_t_9+=1) { - __pyx_v_axi = __pyx_t_9; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":778 - * cdef np.int64_t *sig2d - * for axi in range(3): - * ax = axes[axi] # <<<<<<<<<<<<<< - * sig = self.sigs[ax] - * sig2d = malloc(sizeof(np.int64_t) * self.dimensions[ax]) - */ - __pyx_t_19 = __pyx_v_axi; - __pyx_t_5 = -1; - if (__pyx_t_19 < 0) { - __pyx_t_19 += __pyx_bshape_0_axes; - if (unlikely(__pyx_t_19 < 0)) __pyx_t_5 = 0; - } else if (unlikely(__pyx_t_19 >= __pyx_bshape_0_axes)) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_ax = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_axes.buf, __pyx_t_19, __pyx_bstride_0_axes)); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":779 - * for axi in range(3): - * ax = axes[axi] - * sig = self.sigs[ax] # <<<<<<<<<<<<<< - * sig2d = malloc(sizeof(np.int64_t) * self.dimensions[ax]) - * sig2d[0] = sig2d[self.dimensions[ax]-1] = 0 - */ - __pyx_t_3 = __Pyx_GetItemInt(((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->sigs, __pyx_v_ax, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_11 = ((PyArrayObject *)__pyx_t_3); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sig); - __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_sig, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_5 < 0)) { - PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_sig, (PyObject*)__pyx_v_sig, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8); - } - } - __pyx_bstride_0_sig = __pyx_bstruct_sig.strides[0]; - __pyx_bshape_0_sig = __pyx_bstruct_sig.shape[0]; - if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_11 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_sig)); - __pyx_v_sig = ((PyArrayObject *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":780 - * ax = axes[axi] - * sig = self.sigs[ax] - * sig2d = malloc(sizeof(np.int64_t) * self.dimensions[ax]) # <<<<<<<<<<<<<< - * sig2d[0] = sig2d[self.dimensions[ax]-1] = 0 - * for i in range(1, self.dimensions[ax] - 1): - */ - __pyx_v_sig2d = ((__pyx_t_5numpy_int64_t *)malloc(((sizeof(__pyx_t_5numpy_int64_t)) * (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dimensions[__pyx_v_ax])))); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":781 - * sig = self.sigs[ax] - * sig2d = malloc(sizeof(np.int64_t) * self.dimensions[ax]) - * sig2d[0] = sig2d[self.dimensions[ax]-1] = 0 # <<<<<<<<<<<<<< - * for i in range(1, self.dimensions[ax] - 1): - * sig2d[i] = sig[i-1] - 2*sig[i] + sig[i+1] - */ - (__pyx_v_sig2d[0]) = 0; - (__pyx_v_sig2d[((((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dimensions[__pyx_v_ax]) - 1)]) = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":782 - * sig2d = malloc(sizeof(np.int64_t) * self.dimensions[ax]) - * sig2d[0] = sig2d[self.dimensions[ax]-1] = 0 - * for i in range(1, self.dimensions[ax] - 1): # <<<<<<<<<<<<<< - * sig2d[i] = sig[i-1] - 2*sig[i] + sig[i+1] - * for i in range(1, self.dimensions[ax] - 1): - */ - __pyx_t_12 = ((((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dimensions[__pyx_v_ax]) - 1); - for (__pyx_t_5 = 1; __pyx_t_5 < __pyx_t_12; __pyx_t_5+=1) { - __pyx_v_i = __pyx_t_5; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":783 - * sig2d[0] = sig2d[self.dimensions[ax]-1] = 0 - * for i in range(1, self.dimensions[ax] - 1): - * sig2d[i] = sig[i-1] - 2*sig[i] + sig[i+1] # <<<<<<<<<<<<<< - * for i in range(1, self.dimensions[ax] - 1): - * if sig2d[i] * sig2d[i+1] <= 0: - */ - __pyx_t_20 = (__pyx_v_i - 1); - __pyx_t_14 = -1; - if (__pyx_t_20 < 0) { - __pyx_t_20 += __pyx_bshape_0_sig; - if (unlikely(__pyx_t_20 < 0)) __pyx_t_14 = 0; - } else if (unlikely(__pyx_t_20 >= __pyx_bshape_0_sig)) __pyx_t_14 = 0; - if (unlikely(__pyx_t_14 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_14); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_14 = __pyx_v_i; - __pyx_t_21 = -1; - if (__pyx_t_14 < 0) { - __pyx_t_14 += __pyx_bshape_0_sig; - if (unlikely(__pyx_t_14 < 0)) __pyx_t_21 = 0; - } else if (unlikely(__pyx_t_14 >= __pyx_bshape_0_sig)) __pyx_t_21 = 0; - if (unlikely(__pyx_t_21 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_21); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_22 = (__pyx_v_i + 1); - __pyx_t_21 = -1; - if (__pyx_t_22 < 0) { - __pyx_t_22 += __pyx_bshape_0_sig; - if (unlikely(__pyx_t_22 < 0)) __pyx_t_21 = 0; - } else if (unlikely(__pyx_t_22 >= __pyx_bshape_0_sig)) __pyx_t_21 = 0; - if (unlikely(__pyx_t_21 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_21); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - (__pyx_v_sig2d[__pyx_v_i]) = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_sig.buf, __pyx_t_20, __pyx_bstride_0_sig)) - (2 * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_sig.buf, __pyx_t_14, __pyx_bstride_0_sig)))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_sig.buf, __pyx_t_22, __pyx_bstride_0_sig))); - } - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":784 - * for i in range(1, self.dimensions[ax] - 1): - * sig2d[i] = sig[i-1] - 2*sig[i] + sig[i+1] - * for i in range(1, self.dimensions[ax] - 1): # <<<<<<<<<<<<<< - * if sig2d[i] * sig2d[i+1] <= 0: - * strength = labs(sig2d[i] - sig2d[i+1]) - */ - __pyx_t_12 = ((((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dimensions[__pyx_v_ax]) - 1); - for (__pyx_t_5 = 1; __pyx_t_5 < __pyx_t_12; __pyx_t_5+=1) { - __pyx_v_i = __pyx_t_5; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":785 - * sig2d[i] = sig[i-1] - 2*sig[i] + sig[i+1] - * for i in range(1, self.dimensions[ax] - 1): - * if sig2d[i] * sig2d[i+1] <= 0: # <<<<<<<<<<<<<< - * strength = labs(sig2d[i] - sig2d[i+1]) - * if (strength > zcstrength) or \ - */ - __pyx_t_16 = (((__pyx_v_sig2d[__pyx_v_i]) * (__pyx_v_sig2d[(__pyx_v_i + 1)])) <= 0); - if (__pyx_t_16) { - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":786 - * for i in range(1, self.dimensions[ax] - 1): - * if sig2d[i] * sig2d[i+1] <= 0: - * strength = labs(sig2d[i] - sig2d[i+1]) # <<<<<<<<<<<<<< - * if (strength > zcstrength) or \ - * (strength == zcstrength and (abs(center - i) < - */ - __pyx_v_strength = labs(((__pyx_v_sig2d[__pyx_v_i]) - (__pyx_v_sig2d[(__pyx_v_i + 1)]))); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":787 - * if sig2d[i] * sig2d[i+1] <= 0: - * strength = labs(sig2d[i] - sig2d[i+1]) - * if (strength > zcstrength) or \ # <<<<<<<<<<<<<< - * (strength == zcstrength and (abs(center - i) < - * abs(center - zcp))): - */ - __pyx_t_16 = (__pyx_v_strength > __pyx_v_zcstrength); - if (!__pyx_t_16) { - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":788 - * strength = labs(sig2d[i] - sig2d[i+1]) - * if (strength > zcstrength) or \ - * (strength == zcstrength and (abs(center - i) < # <<<<<<<<<<<<<< - * abs(center - zcp))): - * zcstrength = strength - */ - __pyx_t_15 = (__pyx_v_strength == __pyx_v_zcstrength); - if (__pyx_t_15) { - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":789 - * if (strength > zcstrength) or \ - * (strength == zcstrength and (abs(center - i) < - * abs(center - zcp))): # <<<<<<<<<<<<<< - * zcstrength = strength - * zcp = i - */ - __pyx_t_18 = (abs((__pyx_v_center - __pyx_v_i)) < abs((__pyx_v_center - __pyx_v_zcp))); - __pyx_t_17 = __pyx_t_18; - } else { - __pyx_t_17 = __pyx_t_15; - } - __pyx_t_15 = __pyx_t_17; - } else { - __pyx_t_15 = __pyx_t_16; - } - if (__pyx_t_15) { - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":790 - * (strength == zcstrength and (abs(center - i) < - * abs(center - zcp))): - * zcstrength = strength # <<<<<<<<<<<<<< - * zcp = i - * zca = ax - */ - __pyx_v_zcstrength = __pyx_v_strength; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":791 - * abs(center - zcp))): - * zcstrength = strength - * zcp = i # <<<<<<<<<<<<<< - * zca = ax - * free(sig2d) - */ - __pyx_v_zcp = __pyx_v_i; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":792 - * zcstrength = strength - * zcp = i - * zca = ax # <<<<<<<<<<<<<< - * free(sig2d) - * #print "zcp: %s (%s)" % (zcp, self.dimensions[ax]) - */ - __pyx_v_zca = __pyx_v_ax; - goto __pyx_L17; - } - __pyx_L17:; - goto __pyx_L16; - } - __pyx_L16:; - } - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":793 - * zcp = i - * zca = ax - * free(sig2d) # <<<<<<<<<<<<<< - * #print "zcp: %s (%s)" % (zcp, self.dimensions[ax]) - * return 'zc', ax, zcp - */ - free(__pyx_v_sig2d); - } - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":795 - * free(sig2d) - * #print "zcp: %s (%s)" % (zcp, self.dimensions[ax]) - * return 'zc', ax, zcp # <<<<<<<<<<<<<< - * - * def get_properties(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyInt_FromLong(__pyx_v_ax); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyInt_to_py_npy_int64(__pyx_v_zcp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)__pyx_n_s__zc)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__zc)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__zc)); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_3 = 0; - __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_axes); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sig); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.ramses_reader.ProtoSubgrid.find_split"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_axes); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_sig); - __pyx_L2:; - __Pyx_DECREF((PyObject *)__pyx_v_axes); - __Pyx_DECREF((PyObject *)__pyx_v_sig); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":797 - * return 'zc', ax, zcp - * - * def get_properties(self): # <<<<<<<<<<<<<< - * cdef np.ndarray[np.int64_t, ndim=2] tr = np.empty((3,3), dtype='int64') - * cdef int i - */ - -static PyObject *__pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_get_properties(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_get_properties(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyArrayObject *__pyx_v_tr = 0; - int __pyx_v_i; - Py_buffer __pyx_bstruct_tr; - Py_ssize_t __pyx_bstride_0_tr = 0; - Py_ssize_t __pyx_bstride_1_tr = 0; - Py_ssize_t __pyx_bshape_0_tr = 0; - Py_ssize_t __pyx_bshape_1_tr = 0; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyArrayObject *__pyx_t_5 = NULL; - int __pyx_t_6; - long __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - long __pyx_t_10; - int __pyx_t_11; - long __pyx_t_12; - int __pyx_t_13; - __Pyx_RefNannySetupContext("get_properties"); - __pyx_bstruct_tr.buf = NULL; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":798 - * - * def get_properties(self): - * cdef np.ndarray[np.int64_t, ndim=2] tr = np.empty((3,3), dtype='int64') # <<<<<<<<<<<<<< - * cdef int i - * for i in range(3): - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - __Pyx_INCREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__int64)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_tr, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { - __pyx_v_tr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_tr.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_tr = __pyx_bstruct_tr.strides[0]; __pyx_bstride_1_tr = __pyx_bstruct_tr.strides[1]; - __pyx_bshape_0_tr = __pyx_bstruct_tr.shape[0]; __pyx_bshape_1_tr = __pyx_bstruct_tr.shape[1]; - } - } - __pyx_t_5 = 0; - __pyx_v_tr = ((PyArrayObject *)__pyx_t_4); - __pyx_t_4 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":800 - * cdef np.ndarray[np.int64_t, ndim=2] tr = np.empty((3,3), dtype='int64') - * cdef int i - * for i in range(3): # <<<<<<<<<<<<<< - * tr[0,i] = self.left_edge[i] - * tr[1,i] = self.right_edge[i] - */ - for (__pyx_t_6 = 0; __pyx_t_6 < 3; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":801 - * cdef int i - * for i in range(3): - * tr[0,i] = self.left_edge[i] # <<<<<<<<<<<<<< - * tr[1,i] = self.right_edge[i] - * tr[2,i] = self.dimensions[i] - */ - __pyx_t_7 = 0; - __pyx_t_8 = __pyx_v_i; - __pyx_t_9 = -1; - if (__pyx_t_7 < 0) { - __pyx_t_7 += __pyx_bshape_0_tr; - if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_7 >= __pyx_bshape_0_tr)) __pyx_t_9 = 0; - if (__pyx_t_8 < 0) { - __pyx_t_8 += __pyx_bshape_1_tr; - if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1; - } else if (unlikely(__pyx_t_8 >= __pyx_bshape_1_tr)) __pyx_t_9 = 1; - if (unlikely(__pyx_t_9 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_9); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_tr.buf, __pyx_t_7, __pyx_bstride_0_tr, __pyx_t_8, __pyx_bstride_1_tr) = (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->left_edge[__pyx_v_i]); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":802 - * for i in range(3): - * tr[0,i] = self.left_edge[i] - * tr[1,i] = self.right_edge[i] # <<<<<<<<<<<<<< - * tr[2,i] = self.dimensions[i] - * return tr - */ - __pyx_t_10 = 1; - __pyx_t_9 = __pyx_v_i; - __pyx_t_11 = -1; - if (__pyx_t_10 < 0) { - __pyx_t_10 += __pyx_bshape_0_tr; - if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0; - } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_tr)) __pyx_t_11 = 0; - if (__pyx_t_9 < 0) { - __pyx_t_9 += __pyx_bshape_1_tr; - if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1; - } else if (unlikely(__pyx_t_9 >= __pyx_bshape_1_tr)) __pyx_t_11 = 1; - if (unlikely(__pyx_t_11 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_11); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_tr.buf, __pyx_t_10, __pyx_bstride_0_tr, __pyx_t_9, __pyx_bstride_1_tr) = (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->right_edge[__pyx_v_i]); - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":803 - * tr[0,i] = self.left_edge[i] - * tr[1,i] = self.right_edge[i] - * tr[2,i] = self.dimensions[i] # <<<<<<<<<<<<<< - * return tr - */ - __pyx_t_12 = 2; - __pyx_t_11 = __pyx_v_i; - __pyx_t_13 = -1; - if (__pyx_t_12 < 0) { - __pyx_t_12 += __pyx_bshape_0_tr; - if (unlikely(__pyx_t_12 < 0)) __pyx_t_13 = 0; - } else if (unlikely(__pyx_t_12 >= __pyx_bshape_0_tr)) __pyx_t_13 = 0; - if (__pyx_t_11 < 0) { - __pyx_t_11 += __pyx_bshape_1_tr; - if (unlikely(__pyx_t_11 < 0)) __pyx_t_13 = 1; - } else if (unlikely(__pyx_t_11 >= __pyx_bshape_1_tr)) __pyx_t_13 = 1; - if (unlikely(__pyx_t_13 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_13); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_tr.buf, __pyx_t_12, __pyx_bstride_0_tr, __pyx_t_11, __pyx_bstride_1_tr) = (((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)__pyx_v_self)->dimensions[__pyx_v_i]); - } - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":804 - * tr[1,i] = self.right_edge[i] - * tr[2,i] = self.dimensions[i] - * return tr # <<<<<<<<<<<<<< - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_tr)); - __pyx_r = ((PyObject *)__pyx_v_tr); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_tr); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("yt.ramses_reader.ProtoSubgrid.get_properties"); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_tr); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_tr); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":188 - * # experimental exception made for __getbuffer__ and __releasebuffer__ - * # -- the details of this may change. - * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< - * # This implementation of getbuffer is geared towards Cython - * # requirements, and does not yet fullfill the PEP. - */ - -static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_v_copy_shape; - int __pyx_v_i; - int __pyx_v_ndim; - int __pyx_v_endian_detector; - int __pyx_v_little_endian; - int __pyx_v_t; - char *__pyx_v_f; - PyArray_Descr *__pyx_v_descr = 0; - int __pyx_v_offset; - int __pyx_v_hasfields; - int __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - char *__pyx_t_9; - __Pyx_RefNannySetupContext("__getbuffer__"); - if (__pyx_v_info == NULL) return 0; - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":194 - * # of flags - * cdef int copy_shape, i, ndim - * cdef int endian_detector = 1 # <<<<<<<<<<<<<< - * cdef bint little_endian = ((&endian_detector)[0] != 0) - * - */ - __pyx_v_endian_detector = 1; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":195 - * cdef int copy_shape, i, ndim - * cdef int endian_detector = 1 - * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< - * - * ndim = PyArray_NDIM(self) - */ - __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":197 - * cdef bint little_endian = ((&endian_detector)[0] != 0) - * - * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< - * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - */ - __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":199 - * ndim = PyArray_NDIM(self) - * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< - * copy_shape = 1 - * else: - */ - __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); - if (__pyx_t_1) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":200 - * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * copy_shape = 1 # <<<<<<<<<<<<<< - * else: - * copy_shape = 0 - */ - __pyx_v_copy_shape = 1; - goto __pyx_L5; - } - /*else*/ { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":202 - * copy_shape = 1 - * else: - * copy_shape = 0 # <<<<<<<<<<<<<< - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - */ - __pyx_v_copy_shape = 0; - } - __pyx_L5:; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":204 - * copy_shape = 0 - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError(u"ndarray is not C contiguous") - */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); - if (__pyx_t_1) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":205 - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< - * raise ValueError(u"ndarray is not C contiguous") - * - */ - __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); - __pyx_t_3 = __pyx_t_2; - } else { - __pyx_t_3 = __pyx_t_1; - } - if (__pyx_t_3) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":206 - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; - } - __pyx_L6:; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":208 - * raise ValueError(u"ndarray is not C contiguous") - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError(u"ndarray is not Fortran contiguous") - */ - __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); - if (__pyx_t_3) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":209 - * - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< - * raise ValueError(u"ndarray is not Fortran contiguous") - * - */ - __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); - __pyx_t_2 = __pyx_t_1; - } else { - __pyx_t_2 = __pyx_t_3; - } - if (__pyx_t_2) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":210 - * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< - * - * info.buf = PyArray_DATA(self) - */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_4)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_4)); - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; - } - __pyx_L7:; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":212 - * raise ValueError(u"ndarray is not Fortran contiguous") - * - * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< - * info.ndim = ndim - * if copy_shape: - */ - __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":213 - * - * info.buf = PyArray_DATA(self) - * info.ndim = ndim # <<<<<<<<<<<<<< - * if copy_shape: - * # Allocate new buffer for strides and shape info. This is allocated - */ - __pyx_v_info->ndim = __pyx_v_ndim; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":214 - * info.buf = PyArray_DATA(self) - * info.ndim = ndim - * if copy_shape: # <<<<<<<<<<<<<< - * # Allocate new buffer for strides and shape info. This is allocated - * # as one block, strides first. - */ - if (__pyx_v_copy_shape) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":217 - * # Allocate new buffer for strides and shape info. This is allocated - * # as one block, strides first. - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< - * info.shape = info.strides + ndim - * for i in range(ndim): - */ - __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2))); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":218 - * # as one block, strides first. - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) - * info.shape = info.strides + ndim # <<<<<<<<<<<<<< - * for i in range(ndim): - * info.strides[i] = PyArray_STRIDES(self)[i] - */ - __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":219 - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) - * info.shape = info.strides + ndim - * for i in range(ndim): # <<<<<<<<<<<<<< - * info.strides[i] = PyArray_STRIDES(self)[i] - * info.shape[i] = PyArray_DIMS(self)[i] - */ - __pyx_t_6 = __pyx_v_ndim; - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_i = __pyx_t_7; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":220 - * info.shape = info.strides + ndim - * for i in range(ndim): - * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< - * info.shape[i] = PyArray_DIMS(self)[i] - * else: - */ - (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":221 - * for i in range(ndim): - * info.strides[i] = PyArray_STRIDES(self)[i] - * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< - * else: - * info.strides = PyArray_STRIDES(self) - */ - (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); - } - goto __pyx_L8; - } - /*else*/ { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":223 - * info.shape[i] = PyArray_DIMS(self)[i] - * else: - * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< - * info.shape = PyArray_DIMS(self) - * info.suboffsets = NULL - */ - __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":224 - * else: - * info.strides = PyArray_STRIDES(self) - * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< - * info.suboffsets = NULL - * info.itemsize = PyArray_ITEMSIZE(self) - */ - __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); - } - __pyx_L8:; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":225 - * info.strides = PyArray_STRIDES(self) - * info.shape = PyArray_DIMS(self) - * info.suboffsets = NULL # <<<<<<<<<<<<<< - * info.itemsize = PyArray_ITEMSIZE(self) - * info.readonly = not PyArray_ISWRITEABLE(self) - */ - __pyx_v_info->suboffsets = NULL; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":226 - * info.shape = PyArray_DIMS(self) - * info.suboffsets = NULL - * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< - * info.readonly = not PyArray_ISWRITEABLE(self) - * - */ - __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":227 - * info.suboffsets = NULL - * info.itemsize = PyArray_ITEMSIZE(self) - * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< - * - * cdef int t - */ - __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":230 - * - * cdef int t - * cdef char* f = NULL # <<<<<<<<<<<<<< - * cdef dtype descr = self.descr - * cdef list stack - */ - __pyx_v_f = NULL; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":231 - * cdef int t - * cdef char* f = NULL - * cdef dtype descr = self.descr # <<<<<<<<<<<<<< - * cdef list stack - * cdef int offset - */ - __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); - __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":235 - * cdef int offset - * - * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< - * - * if not hasfields and not copy_shape: - */ - __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":237 - * cdef bint hasfields = PyDataType_HASFIELDS(descr) - * - * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< - * # do not call releasebuffer - * info.obj = None - */ - __pyx_t_2 = (!__pyx_v_hasfields); - if (__pyx_t_2) { - __pyx_t_3 = (!__pyx_v_copy_shape); - __pyx_t_1 = __pyx_t_3; - } else { - __pyx_t_1 = __pyx_t_2; - } - if (__pyx_t_1) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":239 - * if not hasfields and not copy_shape: - * # do not call releasebuffer - * info.obj = None # <<<<<<<<<<<<<< - * else: - * # need to call releasebuffer - */ - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = Py_None; - goto __pyx_L11; - } - /*else*/ { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":242 - * else: - * # need to call releasebuffer - * info.obj = self # <<<<<<<<<<<<<< - * - * if not hasfields: - */ - __Pyx_INCREF(__pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = __pyx_v_self; - } - __pyx_L11:; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":244 - * info.obj = self - * - * if not hasfields: # <<<<<<<<<<<<<< - * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or - */ - __pyx_t_1 = (!__pyx_v_hasfields); - if (__pyx_t_1) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":245 - * - * if not hasfields: - * t = descr.type_num # <<<<<<<<<<<<<< - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): - */ - __pyx_v_t = __pyx_v_descr->type_num; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":246 - * if not hasfields: - * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == '<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - */ - __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); - if (__pyx_t_1) { - __pyx_t_2 = __pyx_v_little_endian; - } else { - __pyx_t_2 = __pyx_t_1; - } - if (!__pyx_t_2) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":247 - * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< - * raise ValueError(u"Non-native byte order not supported") - * if t == NPY_BYTE: f = "b" - */ - __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); - if (__pyx_t_1) { - __pyx_t_3 = (!__pyx_v_little_endian); - __pyx_t_8 = __pyx_t_3; - } else { - __pyx_t_8 = __pyx_t_1; - } - __pyx_t_1 = __pyx_t_8; - } else { - __pyx_t_1 = __pyx_t_2; - } - if (__pyx_t_1) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":248 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< - * if t == NPY_BYTE: f = "b" - * elif t == NPY_UBYTE: f = "B" - */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L13; - } - __pyx_L13:; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":249 - * (descr.byteorder == '<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< - * elif t == NPY_UBYTE: f = "B" - * elif t == NPY_SHORT: f = "h" - */ - __pyx_t_1 = (__pyx_v_t == NPY_BYTE); - if (__pyx_t_1) { - __pyx_v_f = __pyx_k__b; - goto __pyx_L14; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":250 - * raise ValueError(u"Non-native byte order not supported") - * if t == NPY_BYTE: f = "b" - * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< - * elif t == NPY_SHORT: f = "h" - * elif t == NPY_USHORT: f = "H" - */ - __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); - if (__pyx_t_1) { - __pyx_v_f = __pyx_k__B; - goto __pyx_L14; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":251 - * if t == NPY_BYTE: f = "b" - * elif t == NPY_UBYTE: f = "B" - * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< - * elif t == NPY_USHORT: f = "H" - * elif t == NPY_INT: f = "i" - */ - __pyx_t_1 = (__pyx_v_t == NPY_SHORT); - if (__pyx_t_1) { - __pyx_v_f = __pyx_k__h; - goto __pyx_L14; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":252 - * elif t == NPY_UBYTE: f = "B" - * elif t == NPY_SHORT: f = "h" - * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< - * elif t == NPY_INT: f = "i" - * elif t == NPY_UINT: f = "I" - */ - __pyx_t_1 = (__pyx_v_t == NPY_USHORT); - if (__pyx_t_1) { - __pyx_v_f = __pyx_k__H; - goto __pyx_L14; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":253 - * elif t == NPY_SHORT: f = "h" - * elif t == NPY_USHORT: f = "H" - * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< - * elif t == NPY_UINT: f = "I" - * elif t == NPY_LONG: f = "l" - */ - __pyx_t_1 = (__pyx_v_t == NPY_INT); - if (__pyx_t_1) { - __pyx_v_f = __pyx_k__i; - goto __pyx_L14; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":254 - * elif t == NPY_USHORT: f = "H" - * elif t == NPY_INT: f = "i" - * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< - * elif t == NPY_LONG: f = "l" - * elif t == NPY_ULONG: f = "L" - */ - __pyx_t_1 = (__pyx_v_t == NPY_UINT); - if (__pyx_t_1) { - __pyx_v_f = __pyx_k__I; - goto __pyx_L14; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":255 - * elif t == NPY_INT: f = "i" - * elif t == NPY_UINT: f = "I" - * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< - * elif t == NPY_ULONG: f = "L" - * elif t == NPY_LONGLONG: f = "q" - */ - __pyx_t_1 = (__pyx_v_t == NPY_LONG); - if (__pyx_t_1) { - __pyx_v_f = __pyx_k__l; - goto __pyx_L14; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":256 - * elif t == NPY_UINT: f = "I" - * elif t == NPY_LONG: f = "l" - * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< - * elif t == NPY_LONGLONG: f = "q" - * elif t == NPY_ULONGLONG: f = "Q" - */ - __pyx_t_1 = (__pyx_v_t == NPY_ULONG); - if (__pyx_t_1) { - __pyx_v_f = __pyx_k__L; - goto __pyx_L14; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":257 - * elif t == NPY_LONG: f = "l" - * elif t == NPY_ULONG: f = "L" - * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< - * elif t == NPY_ULONGLONG: f = "Q" - * elif t == NPY_FLOAT: f = "f" - */ - __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); - if (__pyx_t_1) { - __pyx_v_f = __pyx_k__q; - goto __pyx_L14; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":258 - * elif t == NPY_ULONG: f = "L" - * elif t == NPY_LONGLONG: f = "q" - * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< - * elif t == NPY_FLOAT: f = "f" - * elif t == NPY_DOUBLE: f = "d" - */ - __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); - if (__pyx_t_1) { - __pyx_v_f = __pyx_k__Q; - goto __pyx_L14; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":259 - * elif t == NPY_LONGLONG: f = "q" - * elif t == NPY_ULONGLONG: f = "Q" - * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< - * elif t == NPY_DOUBLE: f = "d" - * elif t == NPY_LONGDOUBLE: f = "g" - */ - __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); - if (__pyx_t_1) { - __pyx_v_f = __pyx_k__f; - goto __pyx_L14; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":260 - * elif t == NPY_ULONGLONG: f = "Q" - * elif t == NPY_FLOAT: f = "f" - * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< - * elif t == NPY_LONGDOUBLE: f = "g" - * elif t == NPY_CFLOAT: f = "Zf" - */ - __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); - if (__pyx_t_1) { - __pyx_v_f = __pyx_k__d; - goto __pyx_L14; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":261 - * elif t == NPY_FLOAT: f = "f" - * elif t == NPY_DOUBLE: f = "d" - * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< - * elif t == NPY_CFLOAT: f = "Zf" - * elif t == NPY_CDOUBLE: f = "Zd" - */ - __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); - if (__pyx_t_1) { - __pyx_v_f = __pyx_k__g; - goto __pyx_L14; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":262 - * elif t == NPY_DOUBLE: f = "d" - * elif t == NPY_LONGDOUBLE: f = "g" - * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< - * elif t == NPY_CDOUBLE: f = "Zd" - * elif t == NPY_CLONGDOUBLE: f = "Zg" - */ - __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); - if (__pyx_t_1) { - __pyx_v_f = __pyx_k__Zf; - goto __pyx_L14; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":263 - * elif t == NPY_LONGDOUBLE: f = "g" - * elif t == NPY_CFLOAT: f = "Zf" - * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< - * elif t == NPY_CLONGDOUBLE: f = "Zg" - * elif t == NPY_OBJECT: f = "O" - */ - __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); - if (__pyx_t_1) { - __pyx_v_f = __pyx_k__Zd; - goto __pyx_L14; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":264 - * elif t == NPY_CFLOAT: f = "Zf" - * elif t == NPY_CDOUBLE: f = "Zd" - * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< - * elif t == NPY_OBJECT: f = "O" - * else: - */ - __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); - if (__pyx_t_1) { - __pyx_v_f = __pyx_k__Zg; - goto __pyx_L14; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":265 - * elif t == NPY_CDOUBLE: f = "Zd" - * elif t == NPY_CLONGDOUBLE: f = "Zg" - * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - */ - __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); - if (__pyx_t_1) { - __pyx_v_f = __pyx_k__O; - goto __pyx_L14; - } - /*else*/ { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":267 - * elif t == NPY_OBJECT: f = "O" - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< - * info.format = f - * return - */ - __pyx_t_5 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_6), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_L14:; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":268 - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - * info.format = f # <<<<<<<<<<<<<< - * return - * else: - */ - __pyx_v_info->format = __pyx_v_f; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":269 - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - * info.format = f - * return # <<<<<<<<<<<<<< - * else: - * info.format = stdlib.malloc(_buffer_format_string_len) - */ - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L12; - } - /*else*/ { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":271 - * return - * else: - * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< - * info.format[0] = '^' # Native data types, manual alignment - * offset = 0 - */ - __pyx_v_info->format = ((char *)malloc(255)); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":272 - * else: - * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< - * offset = 0 - * f = _util_dtypestring(descr, info.format + 1, - */ - (__pyx_v_info->format[0]) = '^'; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":273 - * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment - * offset = 0 # <<<<<<<<<<<<<< - * f = _util_dtypestring(descr, info.format + 1, - * info.format + _buffer_format_string_len, - */ - __pyx_v_offset = 0; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":276 - * f = _util_dtypestring(descr, info.format + 1, - * info.format + _buffer_format_string_len, - * &offset) # <<<<<<<<<<<<<< - * f[0] = 0 # Terminate format string - * - */ - __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_9; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":277 - * info.format + _buffer_format_string_len, - * &offset) - * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< - * - * def __releasebuffer__(ndarray self, Py_buffer* info): - */ - (__pyx_v_f[0]) = 0; - } - __pyx_L12:; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("numpy.ndarray.__getbuffer__"); - __pyx_r = -1; - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; - goto __pyx_L2; - __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { - __Pyx_GOTREF(Py_None); - __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; - } - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_descr); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":279 - * f[0] = 0 # Terminate format string - * - * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) - */ - -static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { - int __pyx_t_1; - __Pyx_RefNannySetupContext("__releasebuffer__"); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":280 - * - * def __releasebuffer__(ndarray self, Py_buffer* info): - * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - */ - __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); - if (__pyx_t_1) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":281 - * def __releasebuffer__(ndarray self, Py_buffer* info): - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) # <<<<<<<<<<<<<< - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * stdlib.free(info.strides) - */ - free(__pyx_v_info->format); - goto __pyx_L5; - } - __pyx_L5:; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":282 - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< - * stdlib.free(info.strides) - * # info.shape was stored after info.strides in the same block - */ - __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); - if (__pyx_t_1) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":283 - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * stdlib.free(info.strides) # <<<<<<<<<<<<<< - * # info.shape was stored after info.strides in the same block - * - */ - free(__pyx_v_info->strides); - goto __pyx_L6; - } - __pyx_L6:; - - __Pyx_RefNannyFinishContext(); -} - -/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":756 - * ctypedef npy_cdouble complex_t - * - * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(1, a) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":757 - * - * cdef inline object PyArray_MultiIterNew1(a): - * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew2(a, b): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":759 - * return PyArray_MultiIterNew(1, a) - * - * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(2, a, b) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":760 - * - * cdef inline object PyArray_MultiIterNew2(a, b): - * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":762 - * return PyArray_MultiIterNew(2, a, b) - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(3, a, b, c) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":763 - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): - * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":765 - * return PyArray_MultiIterNew(3, a, b, c) - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(4, a, b, c, d) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":766 - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): - * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":768 - * return PyArray_MultiIterNew(4, a, b, c, d) - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(5, a, b, c, d, e) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":769 - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): - * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< - * - * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5"); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":771 - * return PyArray_MultiIterNew(5, a, b, c, d, e) - * - * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< - * # Recursive utility function used in __getbuffer__ to get format - * # string. The new location in the format string is returned. - */ - -static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { - PyArray_Descr *__pyx_v_child; - int __pyx_v_endian_detector; - int __pyx_v_little_endian; - PyObject *__pyx_v_fields; - PyObject *__pyx_v_childname; - PyObject *__pyx_v_new_offset; - PyObject *__pyx_v_t; - char *__pyx_r; - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - char *__pyx_t_10; - __Pyx_RefNannySetupContext("_util_dtypestring"); - __pyx_v_child = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_fields = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_childname = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_t = Py_None; __Pyx_INCREF(Py_None); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":778 - * cdef int delta_offset - * cdef tuple i - * cdef int endian_detector = 1 # <<<<<<<<<<<<<< - * cdef bint little_endian = ((&endian_detector)[0] != 0) - * cdef tuple fields - */ - __pyx_v_endian_detector = 1; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":779 - * cdef tuple i - * cdef int endian_detector = 1 - * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< - * cdef tuple fields - * - */ - __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":782 - * cdef tuple fields - * - * for childname in descr.names: # <<<<<<<<<<<<<< - * fields = descr.fields[childname] - * child, new_offset = fields - */ - if (likely(((PyObject *)__pyx_v_descr->names) != Py_None)) { - __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_2); - } else { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - for (;;) { - if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; - __Pyx_DECREF(__pyx_v_childname); - __pyx_v_childname = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":783 - * - * for childname in descr.names: - * fields = descr.fields[childname] # <<<<<<<<<<<<<< - * child, new_offset = fields - * - */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_fields)); - __pyx_v_fields = ((PyObject *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":784 - * for childname in descr.names: - * fields = descr.fields[childname] - * child, new_offset = fields # <<<<<<<<<<<<<< - * - * if (end - f) - (new_offset - offset[0]) < 15: - */ - if (likely(((PyObject *)__pyx_v_fields) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_fields)) == 2)) { - PyObject* tuple = ((PyObject *)__pyx_v_fields); - __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_v_child)); - __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); - __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_v_new_offset); - __pyx_v_new_offset = __pyx_t_4; - __pyx_t_4 = 0; - } else { - __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":786 - * child, new_offset = fields - * - * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") - * - */ - __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":787 - * - * if (end - f) - (new_offset - offset[0]) < 15: - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< - * - * if ((child.byteorder == '>' and little_endian) or - */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_7)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_7)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_7)); - __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; - } - __pyx_L5:; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":789 - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") - * - * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == '<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") - */ - __pyx_t_6 = (__pyx_v_child->byteorder == '>'); - if (__pyx_t_6) { - __pyx_t_7 = __pyx_v_little_endian; - } else { - __pyx_t_7 = __pyx_t_6; - } - if (!__pyx_t_7) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":790 - * - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< - * raise ValueError(u"Non-native byte order not supported") - * # One could encode it in the format string and have Cython - */ - __pyx_t_6 = (__pyx_v_child->byteorder == '<'); - if (__pyx_t_6) { - __pyx_t_8 = (!__pyx_v_little_endian); - __pyx_t_9 = __pyx_t_8; - } else { - __pyx_t_9 = __pyx_t_6; - } - __pyx_t_6 = __pyx_t_9; - } else { - __pyx_t_6 = __pyx_t_7; - } - if (__pyx_t_6) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":791 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< - * # One could encode it in the format string and have Cython - * # complain instead, BUT: < and > in format strings also imply - */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; - } - __pyx_L6:; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":801 - * - * # Output padding bytes - * while offset[0] < new_offset: # <<<<<<<<<<<<<< - * f[0] = 120 # "x"; pad byte - * f += 1 - */ - while (1) { - __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_6) break; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":802 - * # Output padding bytes - * while offset[0] < new_offset: - * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< - * f += 1 - * offset[0] += 1 - */ - (__pyx_v_f[0]) = 120; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":803 - * while offset[0] < new_offset: - * f[0] = 120 # "x"; pad byte - * f += 1 # <<<<<<<<<<<<<< - * offset[0] += 1 - * - */ - __pyx_v_f += 1; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":804 - * f[0] = 120 # "x"; pad byte - * f += 1 - * offset[0] += 1 # <<<<<<<<<<<<<< - * - * offset[0] += child.itemsize - */ - (__pyx_v_offset[0]) += 1; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":806 - * offset[0] += 1 - * - * offset[0] += child.itemsize # <<<<<<<<<<<<<< - * - * if not PyDataType_HASFIELDS(child): - */ - (__pyx_v_offset[0]) += __pyx_v_child->elsize; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":808 - * offset[0] += child.itemsize - * - * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< - * t = child.type_num - * if end - f < 5: - */ - __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); - if (__pyx_t_6) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":809 - * - * if not PyDataType_HASFIELDS(child): - * t = child.type_num # <<<<<<<<<<<<<< - * if end - f < 5: - * raise RuntimeError(u"Format string allocated too short.") - */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_v_t); - __pyx_v_t = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":810 - * if not PyDataType_HASFIELDS(child): - * t = child.type_num - * if end - f < 5: # <<<<<<<<<<<<<< - * raise RuntimeError(u"Format string allocated too short.") - * - */ - __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); - if (__pyx_t_6) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":811 - * t = child.type_num - * if end - f < 5: - * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< - * - * # Until ticket #99 is fixed, use integers to avoid warnings - */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_8)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_8)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; - } - __pyx_L10:; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":814 - * - * # Until ticket #99 is fixed, use integers to avoid warnings - * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" - */ - __pyx_t_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 98; - goto __pyx_L11; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":815 - * # Until ticket #99 is fixed, use integers to avoid warnings - * if t == NPY_BYTE: f[0] = 98 #"b" - * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" - */ - __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 66; - goto __pyx_L11; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":816 - * if t == NPY_BYTE: f[0] = 98 #"b" - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" - */ - __pyx_t_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 104; - goto __pyx_L11; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":817 - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" - */ - __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 72; - goto __pyx_L11; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":818 - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" - */ - __pyx_t_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 105; - goto __pyx_L11; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":819 - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" - */ - __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 73; - goto __pyx_L11; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":820 - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - */ - __pyx_t_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 108; - goto __pyx_L11; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":821 - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - */ - __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 76; - goto __pyx_L11; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":822 - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" - */ - __pyx_t_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 113; - goto __pyx_L11; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":823 - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - */ - __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 81; - goto __pyx_L11; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":824 - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - */ - __pyx_t_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 102; - goto __pyx_L11; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":825 - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - */ - __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 100; - goto __pyx_L11; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":826 - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - */ - __pyx_t_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 103; - goto __pyx_L11; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":827 - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg - */ - __pyx_t_3 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 90; - (__pyx_v_f[1]) = 102; - __pyx_v_f += 1; - goto __pyx_L11; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":828 - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg - * elif t == NPY_OBJECT: f[0] = 79 #"O" - */ - __pyx_t_5 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 90; - (__pyx_v_f[1]) = 100; - __pyx_v_f += 1; - goto __pyx_L11; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":829 - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< - * elif t == NPY_OBJECT: f[0] = 79 #"O" - * else: - */ - __pyx_t_3 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 90; - (__pyx_v_f[1]) = 103; - __pyx_v_f += 1; - goto __pyx_L11; - } - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":830 - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg - * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - */ - __pyx_t_5 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { - (__pyx_v_f[0]) = 79; - goto __pyx_L11; - } - /*else*/ { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":832 - * elif t == NPY_OBJECT: f[0] = 79 #"O" - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< - * f += 1 - * else: - */ - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_6), __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_L11:; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":833 - * else: - * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) - * f += 1 # <<<<<<<<<<<<<< - * else: - * # Cython ignores struct boundary information ("T{...}"), - */ - __pyx_v_f += 1; - goto __pyx_L9; - } - /*else*/ { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":837 - * # Cython ignores struct boundary information ("T{...}"), - * # so don't output it - * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< - * return f - * - */ - __pyx_t_10 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_10; - } - __pyx_L9:; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":838 - * # so don't output it - * f = _util_dtypestring(child, f, end, offset) - * return f # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_f; - goto __pyx_L0; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("numpy._util_dtypestring"); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_child); - __Pyx_DECREF(__pyx_v_fields); - __Pyx_DECREF(__pyx_v_childname); - __Pyx_DECREF(__pyx_v_new_offset); - __Pyx_DECREF(__pyx_v_t); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":953 - * - * - * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< - * cdef PyObject* baseptr - * if base is None: - */ - -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { - PyObject *__pyx_v_baseptr; - int __pyx_t_1; - __Pyx_RefNannySetupContext("set_array_base"); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":955 - * cdef inline void set_array_base(ndarray arr, object base): - * cdef PyObject* baseptr - * if base is None: # <<<<<<<<<<<<<< - * baseptr = NULL - * else: - */ - __pyx_t_1 = (__pyx_v_base == Py_None); - if (__pyx_t_1) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":956 - * cdef PyObject* baseptr - * if base is None: - * baseptr = NULL # <<<<<<<<<<<<<< - * else: - * Py_INCREF(base) # important to do this before decref below! - */ - __pyx_v_baseptr = NULL; - goto __pyx_L3; - } - /*else*/ { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":958 - * baseptr = NULL - * else: - * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< - * baseptr = base - * Py_XDECREF(arr.base) - */ - Py_INCREF(__pyx_v_base); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":959 - * else: - * Py_INCREF(base) # important to do this before decref below! - * baseptr = base # <<<<<<<<<<<<<< - * Py_XDECREF(arr.base) - * arr.base = baseptr - */ - __pyx_v_baseptr = ((PyObject *)__pyx_v_base); - } - __pyx_L3:; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":960 - * Py_INCREF(base) # important to do this before decref below! - * baseptr = base - * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< - * arr.base = baseptr - * - */ - Py_XDECREF(__pyx_v_arr->base); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":961 - * baseptr = base - * Py_XDECREF(arr.base) - * arr.base = baseptr # <<<<<<<<<<<<<< - * - * cdef inline object get_array_base(ndarray arr): - */ - __pyx_v_arr->base = __pyx_v_baseptr; - - __Pyx_RefNannyFinishContext(); -} - -/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":963 - * arr.base = baseptr - * - * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * if arr.base is NULL: - * return None - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { - PyObject *__pyx_r = NULL; - int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base"); - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":964 - * - * cdef inline object get_array_base(ndarray arr): - * if arr.base is NULL: # <<<<<<<<<<<<<< - * return None - * else: - */ - __pyx_t_1 = (__pyx_v_arr->base == NULL); - if (__pyx_t_1) { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":965 - * cdef inline object get_array_base(ndarray arr): - * if arr.base is NULL: - * return None # <<<<<<<<<<<<<< - * else: - * return arr.base - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_None); - __pyx_r = Py_None; - goto __pyx_L0; - goto __pyx_L3; - } - /*else*/ { - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":967 - * return None - * else: - * return arr.base # <<<<<<<<<<<<<< - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); - __pyx_r = ((PyObject *)__pyx_v_arr->base); - goto __pyx_L0; - } - __pyx_L3:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_tp_new_2yt_13ramses_reader_RAMSES_tree_proxy(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *p; - PyObject *o = (*t->tp_alloc)(t, 0); - if (!o) return 0; - p = ((struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)o); - p->field_ind = Py_None; Py_INCREF(Py_None); - p->field_names = Py_None; Py_INCREF(Py_None); - if (__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy___cinit__(o, a, k) < 0) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_2yt_13ramses_reader_RAMSES_tree_proxy(PyObject *o) { - struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *p = (struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)o; - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy___dealloc__(o); - if (PyErr_Occurred()) PyErr_WriteUnraisable(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); - } - Py_XDECREF(p->field_ind); - Py_XDECREF(p->field_names); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_2yt_13ramses_reader_RAMSES_tree_proxy(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *p = (struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)o; - if (p->field_ind) { - e = (*v)(p->field_ind, a); if (e) return e; - } - if (p->field_names) { - e = (*v)(p->field_names, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_2yt_13ramses_reader_RAMSES_tree_proxy(PyObject *o) { - struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *p = (struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy *)o; - PyObject* tmp; - tmp = ((PyObject*)p->field_ind); - p->field_ind = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->field_names); - p->field_names = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyObject *__pyx_getprop_2yt_13ramses_reader_17RAMSES_tree_proxy_field_ind(PyObject *o, void *x) { - return __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_9field_ind___get__(o); -} - -static int __pyx_setprop_2yt_13ramses_reader_17RAMSES_tree_proxy_field_ind(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_9field_ind___set__(o, v); - } - else { - return __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_9field_ind___del__(o); - } -} - -static PyObject *__pyx_getprop_2yt_13ramses_reader_17RAMSES_tree_proxy_field_names(PyObject *o, void *x) { - return __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_11field_names___get__(o); -} - -static int __pyx_setprop_2yt_13ramses_reader_17RAMSES_tree_proxy_field_names(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_11field_names___set__(o, v); - } - else { - return __pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_11field_names___del__(o); - } -} - -static PyMethodDef __pyx_methods_2yt_13ramses_reader_RAMSES_tree_proxy[] = { - {__Pyx_NAMESTR("count_zones"), (PyCFunction)__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_count_zones, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("ensure_loaded"), (PyCFunction)__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_ensure_loaded, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("clear_tree"), (PyCFunction)__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_clear_tree, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_file_info"), (PyCFunction)__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_get_file_info, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("fill_hierarchy_arrays"), (PyCFunction)__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_fill_hierarchy_arrays, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read_oct_grid"), (PyCFunction)__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_read_oct_grid, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read_grid"), (PyCFunction)__pyx_pf_2yt_13ramses_reader_17RAMSES_tree_proxy_read_grid, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_2yt_13ramses_reader_RAMSES_tree_proxy[] = { - {(char *)"field_ind", __pyx_getprop_2yt_13ramses_reader_17RAMSES_tree_proxy_field_ind, __pyx_setprop_2yt_13ramses_reader_17RAMSES_tree_proxy_field_ind, 0, 0}, - {(char *)"field_names", __pyx_getprop_2yt_13ramses_reader_17RAMSES_tree_proxy_field_names, __pyx_setprop_2yt_13ramses_reader_17RAMSES_tree_proxy_field_names, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_RAMSES_tree_proxy = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION >= 3 - 0, /*reserved*/ - #else - 0, /*nb_long*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_RAMSES_tree_proxy = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_RAMSES_tree_proxy = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_RAMSES_tree_proxy = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -PyTypeObject __pyx_type_2yt_13ramses_reader_RAMSES_tree_proxy = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("yt.ramses_reader.RAMSES_tree_proxy"), /*tp_name*/ - sizeof(struct __pyx_obj_2yt_13ramses_reader_RAMSES_tree_proxy), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_2yt_13ramses_reader_RAMSES_tree_proxy, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION >= 3 - 0, /*reserved*/ - #else - 0, /*tp_compare*/ - #endif - 0, /*tp_repr*/ - &__pyx_tp_as_number_RAMSES_tree_proxy, /*tp_as_number*/ - &__pyx_tp_as_sequence_RAMSES_tree_proxy, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_RAMSES_tree_proxy, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_RAMSES_tree_proxy, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_2yt_13ramses_reader_RAMSES_tree_proxy, /*tp_traverse*/ - __pyx_tp_clear_2yt_13ramses_reader_RAMSES_tree_proxy, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_2yt_13ramses_reader_RAMSES_tree_proxy, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_2yt_13ramses_reader_RAMSES_tree_proxy, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_2yt_13ramses_reader_RAMSES_tree_proxy, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static PyObject *__pyx_tp_new_2yt_13ramses_reader_ProtoSubgrid(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *p; - PyObject *o = (*t->tp_alloc)(t, 0); - if (!o) return 0; - p = ((struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)o); - p->sigs = Py_None; Py_INCREF(Py_None); - p->grid_file_locations = Py_None; Py_INCREF(Py_None); - p->dd = Py_None; Py_INCREF(Py_None); - if (__pyx_pf_2yt_13ramses_reader_12ProtoSubgrid___cinit__(o, a, k) < 0) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_2yt_13ramses_reader_ProtoSubgrid(PyObject *o) { - struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *p = (struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)o; - Py_XDECREF(p->sigs); - Py_XDECREF(p->grid_file_locations); - Py_XDECREF(p->dd); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_2yt_13ramses_reader_ProtoSubgrid(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *p = (struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)o; - if (p->sigs) { - e = (*v)(p->sigs, a); if (e) return e; - } - if (p->grid_file_locations) { - e = (*v)(p->grid_file_locations, a); if (e) return e; - } - if (p->dd) { - e = (*v)(p->dd, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_2yt_13ramses_reader_ProtoSubgrid(PyObject *o) { - struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *p = (struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid *)o; - PyObject* tmp; - tmp = ((PyObject*)p->sigs); - p->sigs = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->grid_file_locations); - p->grid_file_locations = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->dd); - p->dd = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyObject *__pyx_getprop_2yt_13ramses_reader_12ProtoSubgrid_efficiency(PyObject *o, void *x) { - return __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_10efficiency___get__(o); -} - -static int __pyx_setprop_2yt_13ramses_reader_12ProtoSubgrid_efficiency(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_10efficiency___set__(o, v); - } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; - } -} - -static PyObject *__pyx_getprop_2yt_13ramses_reader_12ProtoSubgrid_sigs(PyObject *o, void *x) { - return __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_4sigs___get__(o); -} - -static int __pyx_setprop_2yt_13ramses_reader_12ProtoSubgrid_sigs(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_4sigs___set__(o, v); - } - else { - return __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_4sigs___del__(o); - } -} - -static PyObject *__pyx_getprop_2yt_13ramses_reader_12ProtoSubgrid_grid_file_locations(PyObject *o, void *x) { - return __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_19grid_file_locations___get__(o); -} - -static int __pyx_setprop_2yt_13ramses_reader_12ProtoSubgrid_grid_file_locations(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_19grid_file_locations___set__(o, v); - } - else { - return __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_19grid_file_locations___del__(o); - } -} - -static PyObject *__pyx_getprop_2yt_13ramses_reader_12ProtoSubgrid_dd(PyObject *o, void *x) { - return __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_2dd___get__(o); -} - -static int __pyx_setprop_2yt_13ramses_reader_12ProtoSubgrid_dd(PyObject *o, PyObject *v, void *x) { - if (v) { - return __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_2dd___set__(o, v); - } - else { - return __pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_2dd___del__(o); - } -} - -static PyMethodDef __pyx_methods_2yt_13ramses_reader_ProtoSubgrid[] = { - {__Pyx_NAMESTR("find_split"), (PyCFunction)__pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_find_split, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_properties"), (PyCFunction)__pyx_pf_2yt_13ramses_reader_12ProtoSubgrid_get_properties, METH_NOARGS, __Pyx_DOCSTR(0)}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_2yt_13ramses_reader_ProtoSubgrid[] = { - {(char *)"efficiency", __pyx_getprop_2yt_13ramses_reader_12ProtoSubgrid_efficiency, __pyx_setprop_2yt_13ramses_reader_12ProtoSubgrid_efficiency, 0, 0}, - {(char *)"sigs", __pyx_getprop_2yt_13ramses_reader_12ProtoSubgrid_sigs, __pyx_setprop_2yt_13ramses_reader_12ProtoSubgrid_sigs, 0, 0}, - {(char *)"grid_file_locations", __pyx_getprop_2yt_13ramses_reader_12ProtoSubgrid_grid_file_locations, __pyx_setprop_2yt_13ramses_reader_12ProtoSubgrid_grid_file_locations, 0, 0}, - {(char *)"dd", __pyx_getprop_2yt_13ramses_reader_12ProtoSubgrid_dd, __pyx_setprop_2yt_13ramses_reader_12ProtoSubgrid_dd, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_ProtoSubgrid = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION >= 3 - 0, /*reserved*/ - #else - 0, /*nb_long*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_ProtoSubgrid = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_ProtoSubgrid = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_ProtoSubgrid = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -PyTypeObject __pyx_type_2yt_13ramses_reader_ProtoSubgrid = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("yt.ramses_reader.ProtoSubgrid"), /*tp_name*/ - sizeof(struct __pyx_obj_2yt_13ramses_reader_ProtoSubgrid), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_2yt_13ramses_reader_ProtoSubgrid, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION >= 3 - 0, /*reserved*/ - #else - 0, /*tp_compare*/ - #endif - 0, /*tp_repr*/ - &__pyx_tp_as_number_ProtoSubgrid, /*tp_as_number*/ - &__pyx_tp_as_sequence_ProtoSubgrid, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_ProtoSubgrid, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_ProtoSubgrid, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_2yt_13ramses_reader_ProtoSubgrid, /*tp_traverse*/ - __pyx_tp_clear_2yt_13ramses_reader_ProtoSubgrid, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_2yt_13ramses_reader_ProtoSubgrid, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_2yt_13ramses_reader_ProtoSubgrid, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_2yt_13ramses_reader_ProtoSubgrid, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static PyMethodDef __pyx_methods[] = { - {0, 0, 0, 0} -}; - -#if PY_MAJOR_VERSION >= 3 -static struct PyModuleDef __pyx_moduledef = { - PyModuleDef_HEAD_INIT, - __Pyx_NAMESTR("ramses_reader"), - __Pyx_DOCSTR(__pyx_k_9), /* m_doc */ - -1, /* m_size */ - __pyx_methods /* m_methods */, - NULL, /* m_reload */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; -#endif - -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, - {&__pyx_n_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 1}, - {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0}, - {&__pyx_kp_u_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 1, 0, 0}, - {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0}, - {&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0, 0}, - {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, - {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0}, - {&__pyx_n_s__F, __pyx_k__F, sizeof(__pyx_k__F), 0, 0, 1, 1}, - {&__pyx_n_s__H0, __pyx_k__H0, sizeof(__pyx_k__H0), 0, 0, 1, 1}, - {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, - {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, - {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, - {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, - {&__pyx_n_s__aexp, __pyx_k__aexp, sizeof(__pyx_k__aexp), 0, 0, 1, 1}, - {&__pyx_n_s__argsort, __pyx_k__argsort, sizeof(__pyx_k__argsort), 0, 0, 1, 1}, - {&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1}, - {&__pyx_n_s__begin, __pyx_k__begin, sizeof(__pyx_k__begin), 0, 0, 1, 1}, - {&__pyx_n_s__boxlen, __pyx_k__boxlen, sizeof(__pyx_k__boxlen), 0, 0, 1, 1}, - {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1}, - {&__pyx_n_s__byteorder, __pyx_k__byteorder, sizeof(__pyx_k__byteorder), 0, 0, 1, 1}, - {&__pyx_n_s__c_str, __pyx_k__c_str, sizeof(__pyx_k__c_str), 0, 0, 1, 1}, - {&__pyx_n_s__child_mask, __pyx_k__child_mask, sizeof(__pyx_k__child_mask), 0, 0, 1, 1}, - {&__pyx_n_s__component_grid_info, __pyx_k__component_grid_info, sizeof(__pyx_k__component_grid_info), 0, 0, 1, 1}, - {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1}, - {&__pyx_n_s__dd, __pyx_k__dd, sizeof(__pyx_k__dd), 0, 0, 1, 1}, - {&__pyx_n_s__descr, __pyx_k__descr, sizeof(__pyx_k__descr), 0, 0, 1, 1}, - {&__pyx_n_s__dimensions, __pyx_k__dimensions, sizeof(__pyx_k__dimensions), 0, 0, 1, 1}, - {&__pyx_n_s__domain, __pyx_k__domain, sizeof(__pyx_k__domain), 0, 0, 1, 1}, - {&__pyx_n_s__domain_index, __pyx_k__domain_index, sizeof(__pyx_k__domain_index), 0, 0, 1, 1}, - {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, - {&__pyx_n_s__efficiency, __pyx_k__efficiency, sizeof(__pyx_k__efficiency), 0, 0, 1, 1}, - {&__pyx_n_s__empty, __pyx_k__empty, sizeof(__pyx_k__empty), 0, 0, 1, 1}, - {&__pyx_n_s__end, __pyx_k__end, sizeof(__pyx_k__end), 0, 0, 1, 1}, - {&__pyx_n_s__ensure_loaded, __pyx_k__ensure_loaded, sizeof(__pyx_k__ensure_loaded), 0, 0, 1, 1}, - {&__pyx_n_s__field, __pyx_k__field, sizeof(__pyx_k__field), 0, 0, 1, 1}, - {&__pyx_n_s__field_ind, __pyx_k__field_ind, sizeof(__pyx_k__field_ind), 0, 0, 1, 1}, - {&__pyx_n_s__field_names, __pyx_k__field_names, sizeof(__pyx_k__field_names), 0, 0, 1, 1}, - {&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1}, - {&__pyx_n_s__filled, __pyx_k__filled, sizeof(__pyx_k__filled), 0, 0, 1, 1}, - {&__pyx_n_s__float64, __pyx_k__float64, sizeof(__pyx_k__float64), 0, 0, 1, 1}, - {&__pyx_n_s__fn, __pyx_k__fn, sizeof(__pyx_k__fn), 0, 0, 1, 1}, - {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1}, - {&__pyx_n_s__get_parent, __pyx_k__get_parent, sizeof(__pyx_k__get_parent), 0, 0, 1, 1}, - {&__pyx_n_s__grid_dimensions, __pyx_k__grid_dimensions, sizeof(__pyx_k__grid_dimensions), 0, 0, 1, 1}, - {&__pyx_n_s__grid_dims, __pyx_k__grid_dims, sizeof(__pyx_k__grid_dims), 0, 0, 1, 1}, - {&__pyx_n_s__grid_file_locations, __pyx_k__grid_file_locations, sizeof(__pyx_k__grid_file_locations), 0, 0, 1, 1}, - {&__pyx_n_s__grid_id, __pyx_k__grid_id, sizeof(__pyx_k__grid_id), 0, 0, 1, 1}, - {&__pyx_n_s__grid_levels, __pyx_k__grid_levels, sizeof(__pyx_k__grid_levels), 0, 0, 1, 1}, - {&__pyx_n_s__grid_pos_double, __pyx_k__grid_pos_double, sizeof(__pyx_k__grid_pos_double), 0, 0, 1, 1}, - {&__pyx_n_s__hydro_datas, __pyx_k__hydro_datas, sizeof(__pyx_k__hydro_datas), 0, 0, 1, 1}, - {&__pyx_n_s__int64, __pyx_k__int64, sizeof(__pyx_k__int64), 0, 0, 1, 1}, - {&__pyx_n_s__is_finest, __pyx_k__is_finest, sizeof(__pyx_k__is_finest), 0, 0, 1, 1}, - {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1}, - {&__pyx_n_s__left_edge, __pyx_k__left_edge, sizeof(__pyx_k__left_edge), 0, 0, 1, 1}, - {&__pyx_n_s__left_edges, __pyx_k__left_edges, sizeof(__pyx_k__left_edges), 0, 0, 1, 1}, - {&__pyx_n_s__left_index, __pyx_k__left_index, sizeof(__pyx_k__left_index), 0, 0, 1, 1}, - {&__pyx_n_s__level, __pyx_k__level, sizeof(__pyx_k__level), 0, 0, 1, 1}, - {&__pyx_n_s__levelmax, __pyx_k__levelmax, sizeof(__pyx_k__levelmax), 0, 0, 1, 1}, - {&__pyx_n_s__levelmin, __pyx_k__levelmin, sizeof(__pyx_k__levelmin), 0, 0, 1, 1}, - {&__pyx_n_s__loaded, __pyx_k__loaded, sizeof(__pyx_k__loaded), 0, 0, 1, 1}, - {&__pyx_n_s__m_AMR_levels, __pyx_k__m_AMR_levels, sizeof(__pyx_k__m_AMR_levels), 0, 0, 1, 1}, - {&__pyx_n_s__m_header, __pyx_k__m_header, sizeof(__pyx_k__m_header), 0, 0, 1, 1}, - {&__pyx_n_s__m_maxlevel, __pyx_k__m_maxlevel, sizeof(__pyx_k__m_maxlevel), 0, 0, 1, 1}, - {&__pyx_n_s__m_nvars, __pyx_k__m_nvars, sizeof(__pyx_k__m_nvars), 0, 0, 1, 1}, - {&__pyx_n_s__m_var_array, __pyx_k__m_var_array, sizeof(__pyx_k__m_var_array), 0, 0, 1, 1}, - {&__pyx_n_s__m_varnames, __pyx_k__m_varnames, sizeof(__pyx_k__m_varnames), 0, 0, 1, 1}, - {&__pyx_n_s__names, __pyx_k__names, sizeof(__pyx_k__names), 0, 0, 1, 1}, - {&__pyx_n_s__ncpu, __pyx_k__ncpu, sizeof(__pyx_k__ncpu), 0, 0, 1, 1}, - {&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1}, - {&__pyx_n_s__ndomains, __pyx_k__ndomains, sizeof(__pyx_k__ndomains), 0, 0, 1, 1}, - {&__pyx_n_s__next, __pyx_k__next, sizeof(__pyx_k__next), 0, 0, 1, 1}, - {&__pyx_n_s__nfields, __pyx_k__nfields, sizeof(__pyx_k__nfields), 0, 0, 1, 1}, - {&__pyx_n_s__ngridmax, __pyx_k__ngridmax, sizeof(__pyx_k__ngridmax), 0, 0, 1, 1}, - {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, - {&__pyx_n_s__nstep_coarse, __pyx_k__nstep_coarse, sizeof(__pyx_k__nstep_coarse), 0, 0, 1, 1}, - {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, - {&__pyx_n_s__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1}, - {&__pyx_n_s__omega_b, __pyx_k__omega_b, sizeof(__pyx_k__omega_b), 0, 0, 1, 1}, - {&__pyx_n_s__omega_k, __pyx_k__omega_k, sizeof(__pyx_k__omega_k), 0, 0, 1, 1}, - {&__pyx_n_s__omega_l, __pyx_k__omega_l, sizeof(__pyx_k__omega_l), 0, 0, 1, 1}, - {&__pyx_n_s__omega_m, __pyx_k__omega_m, sizeof(__pyx_k__omega_m), 0, 0, 1, 1}, - {&__pyx_n_s__ones, __pyx_k__ones, sizeof(__pyx_k__ones), 0, 0, 1, 1}, - {&__pyx_n_s__order, __pyx_k__order, sizeof(__pyx_k__order), 0, 0, 1, 1}, - {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, - {&__pyx_n_s__read, __pyx_k__read, sizeof(__pyx_k__read), 0, 0, 1, 1}, - {&__pyx_n_s__readonly, __pyx_k__readonly, sizeof(__pyx_k__readonly), 0, 0, 1, 1}, - {&__pyx_n_s__ref_factor, __pyx_k__ref_factor, sizeof(__pyx_k__ref_factor), 0, 0, 1, 1}, - {&__pyx_n_s__right_edge, __pyx_k__right_edge, sizeof(__pyx_k__right_edge), 0, 0, 1, 1}, - {&__pyx_n_s__right_edges, __pyx_k__right_edges, sizeof(__pyx_k__right_edges), 0, 0, 1, 1}, - {&__pyx_n_s__rsnap, __pyx_k__rsnap, sizeof(__pyx_k__rsnap), 0, 0, 1, 1}, - {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, - {&__pyx_n_s__signature, __pyx_k__signature, sizeof(__pyx_k__signature), 0, 0, 1, 1}, - {&__pyx_n_s__sigs, __pyx_k__sigs, sizeof(__pyx_k__sigs), 0, 0, 1, 1}, - {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1}, - {&__pyx_n_s__snapshot_name, __pyx_k__snapshot_name, sizeof(__pyx_k__snapshot_name), 0, 0, 1, 1}, - {&__pyx_n_s__start_index, __pyx_k__start_index, sizeof(__pyx_k__start_index), 0, 0, 1, 1}, - {&__pyx_n_s__strides, __pyx_k__strides, sizeof(__pyx_k__strides), 0, 0, 1, 1}, - {&__pyx_n_s__suboffsets, __pyx_k__suboffsets, sizeof(__pyx_k__suboffsets), 0, 0, 1, 1}, - {&__pyx_n_s__time, __pyx_k__time, sizeof(__pyx_k__time), 0, 0, 1, 1}, - {&__pyx_n_s__trees, __pyx_k__trees, sizeof(__pyx_k__trees), 0, 0, 1, 1}, - {&__pyx_n_s__type_num, __pyx_k__type_num, sizeof(__pyx_k__type_num), 0, 0, 1, 1}, - {&__pyx_n_s__unit_d, __pyx_k__unit_d, sizeof(__pyx_k__unit_d), 0, 0, 1, 1}, - {&__pyx_n_s__unit_l, __pyx_k__unit_l, sizeof(__pyx_k__unit_l), 0, 0, 1, 1}, - {&__pyx_n_s__unit_t, __pyx_k__unit_t, sizeof(__pyx_k__unit_t), 0, 0, 1, 1}, - {&__pyx_n_s__varname, __pyx_k__varname, sizeof(__pyx_k__varname), 0, 0, 1, 1}, - {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1}, - {&__pyx_n_s__y, __pyx_k__y, sizeof(__pyx_k__y), 0, 0, 1, 1}, - {&__pyx_n_s__z, __pyx_k__z, sizeof(__pyx_k__z), 0, 0, 1, 1}, - {&__pyx_n_s__zc, __pyx_k__zc, sizeof(__pyx_k__zc), 0, 0, 1, 1}, - {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1}, - {&__pyx_n_s__zs, __pyx_k__zs, sizeof(__pyx_k__zs), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; -static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - return 0; - __pyx_L1_error:; - return -1; -} - -static int __Pyx_InitGlobals(void) { - if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __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_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - return 0; - __pyx_L1_error:; - return -1; -} - -#if PY_MAJOR_VERSION < 3 -PyMODINIT_FUNC initramses_reader(void); /*proto*/ -PyMODINIT_FUNC initramses_reader(void) -#else -PyMODINIT_FUNC PyInit_ramses_reader(void); /*proto*/ -PyMODINIT_FUNC PyInit_ramses_reader(void) -#endif -{ - PyObject *__pyx_t_1 = NULL; - #if CYTHON_REFNANNY - void* __pyx_refnanny = NULL; - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); - if (!__Pyx_RefNanny) { - PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); - } - __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_ramses_reader(void)", __LINE__, __FILE__); - #endif - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #ifdef __pyx_binding_PyCFunctionType_USED - if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - /*--- Library function declarations ---*/ - /*--- Threads initialization code ---*/ - #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - #ifdef WITH_THREAD /* Python build with threading support? */ - PyEval_InitThreads(); - #endif - #endif - /*--- Module creation code ---*/ - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("ramses_reader"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_9), 0, PYTHON_API_VERSION); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - #if PY_MAJOR_VERSION < 3 - Py_INCREF(__pyx_m); - #endif - __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); - if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - /*--- Initialize various global constants etc. ---*/ - if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_module_is_main_yt__ramses_reader) { - if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - } - /*--- Builtin init code ---*/ - if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /*--- Global init code ---*/ - /*--- Function export code ---*/ - /*--- Type init code ---*/ - if (PyType_Ready(&__pyx_type_2yt_13ramses_reader_RAMSES_tree_proxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "RAMSES_tree_proxy", (PyObject *)&__pyx_type_2yt_13ramses_reader_RAMSES_tree_proxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_2yt_13ramses_reader_RAMSES_tree_proxy = &__pyx_type_2yt_13ramses_reader_RAMSES_tree_proxy; - if (PyType_Ready(&__pyx_type_2yt_13ramses_reader_ProtoSubgrid) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "ProtoSubgrid", (PyObject *)&__pyx_type_2yt_13ramses_reader_ProtoSubgrid) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_2yt_13ramses_reader_ProtoSubgrid = &__pyx_type_2yt_13ramses_reader_ProtoSubgrid; - /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /*--- Function import code ---*/ - /*--- Execution code ---*/ - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":32 - * from libc.stdlib cimport malloc, free, abs, calloc, labs - * - * import numpy as np # <<<<<<<<<<<<<< - * cimport numpy as np - * cimport cython - */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/matthewturk/yt/yt/yt/ramses_reader.pyx":1 - * """ # <<<<<<<<<<<<<< - * Wrapping code for Oliver Hahn's RamsesRead++ - * - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - - /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":963 - * arr.base = baseptr - * - * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * if arr.base is NULL: - * return None - */ - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - if (__pyx_m) { - __Pyx_AddTraceback("init yt.ramses_reader"); - Py_DECREF(__pyx_m); __pyx_m = 0; - } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init yt.ramses_reader"); - } - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - #if PY_MAJOR_VERSION < 3 - return; - #else - return __pyx_m; - #endif -} - -/* Runtime support code */ - -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_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AS_STRING(kw_name)); - #endif -} - -static void __Pyx_RaiseArgtupleInvalid( - const char* func_name, - int exact, - Py_ssize_t num_min, - Py_ssize_t num_max, - Py_ssize_t num_found) -{ - Py_ssize_t num_expected; - const char *number, *more_or_less; - - if (num_found < num_min) { - num_expected = num_min; - more_or_less = "at least"; - } else { - num_expected = num_max; - more_or_less = "at most"; - } - if (exact) { - more_or_less = "exactly"; - } - number = (num_expected == 1) ? "" : "s"; - PyErr_Format(PyExc_TypeError, - #if PY_VERSION_HEX < 0x02050000 - "%s() takes %s %d positional argument%s (%d given)", - #else - "%s() takes %s %zd positional argument%s (%zd given)", - #endif - func_name, more_or_less, num_expected, number, num_found); -} - -static int __Pyx_ParseOptionalKeywords( - PyObject *kwds, - PyObject **argnames[], - PyObject *kwds2, - PyObject *values[], - Py_ssize_t num_pos_args, - const char* function_name) -{ - PyObject *key = 0, *value = 0; - Py_ssize_t pos = 0; - PyObject*** name; - PyObject*** first_kw_arg = argnames + num_pos_args; - - while (PyDict_Next(kwds, &pos, &key, &value)) { - name = first_kw_arg; - while (*name && (**name != key)) name++; - if (*name) { - values[name-argnames] = value; - } else { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; - } else { - for (name = first_kw_arg; *name; name++) { - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) break; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) break; - #endif - } - if (*name) { - values[name-argnames] = value; - } else { - /* unexpected keyword found */ - for (name=argnames; name != first_kw_arg; name++) { - if (**name == key) goto arg_passed_twice; - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) goto arg_passed_twice; - #endif - } - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; - } - } - } - } - } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, **name); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%s() got an unexpected keyword argument '%s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - return -1; -} - - - -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact) -{ - if (!type) { - PyErr_Format(PyExc_SystemError, "Missing type object"); - return 0; - } - if (none_allowed && obj == Py_None) return 1; - else if (exact) { - if (Py_TYPE(obj) == type) return 1; - } - else { - if (PyObject_TypeCheck(obj, type)) return 1; - } - PyErr_Format(PyExc_TypeError, - "Argument '%s' has incorrect type (expected %s, got %s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); - return 0; -} - -static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { - unsigned int n = 1; - return *(unsigned char*)(&n) != 0; -} - -typedef struct { - __Pyx_StructField root; - __Pyx_BufFmt_StackElem* head; - size_t fmt_offset; - int new_count, enc_count; - int is_complex; - char enc_type; - char packmode; -} __Pyx_BufFmt_Context; - -static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, - __Pyx_BufFmt_StackElem* stack, - __Pyx_TypeInfo* type) { - stack[0].field = &ctx->root; - stack[0].parent_offset = 0; - ctx->root.type = type; - ctx->root.name = "buffer dtype"; - ctx->root.offset = 0; - ctx->head = stack; - ctx->head->field = &ctx->root; - ctx->fmt_offset = 0; - ctx->head->parent_offset = 0; - ctx->packmode = '@'; - ctx->new_count = 1; - ctx->enc_count = 0; - ctx->enc_type = 0; - ctx->is_complex = 0; - while (type->typegroup == 'S') { - ++ctx->head; - ctx->head->field = type->fields; - ctx->head->parent_offset = 0; - type = type->fields->type; - } -} - -static int __Pyx_BufFmt_ParseNumber(const char** ts) { - int count; - const char* t = *ts; - if (*t < '0' || *t > '9') { - return -1; - } else { - count = *t++ - '0'; - while (*t >= '0' && *t < '9') { - count *= 10; - count += *t++ - '0'; - } - } - *ts = t; - return count; -} - -static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { - char msg[] = {ch, 0}; - PyErr_Format(PyExc_ValueError, "Unexpected format string character: '%s'", msg); -} - -static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { - switch (ch) { - case 'b': return "'char'"; - case 'B': return "'unsigned char'"; - case 'h': return "'short'"; - case 'H': return "'unsigned short'"; - case 'i': return "'int'"; - case 'I': return "'unsigned int'"; - case 'l': return "'long'"; - case 'L': return "'unsigned long'"; - case 'q': return "'long long'"; - case 'Q': return "'unsigned long long'"; - case 'f': return (is_complex ? "'complex float'" : "'float'"); - case 'd': return (is_complex ? "'complex double'" : "'double'"); - case 'g': return (is_complex ? "'complex long double'" : "'long double'"); - case 'T': return "a struct"; - case 'O': return "Python object"; - case 'P': return "a pointer"; - case 0: return "end"; - default: return "unparseable format string"; - } -} - -static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { - switch (ch) { - case '?': case 'c': case 'b': case 'B': return 1; - case 'h': case 'H': return 2; - case 'i': case 'I': case 'l': case 'L': return 4; - case 'q': case 'Q': return 8; - case 'f': return (is_complex ? 8 : 4); - case 'd': return (is_complex ? 16 : 8); - case 'g': { - PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); - return 0; - } - case 'O': case 'P': return sizeof(void*); - default: - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; - } -} - -static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { - switch (ch) { - case 'c': case 'b': case 'B': return 1; - case 'h': case 'H': return sizeof(short); - case 'i': case 'I': return sizeof(int); - case 'l': case 'L': return sizeof(long); - #ifdef HAVE_LONG_LONG - case 'q': case 'Q': return sizeof(PY_LONG_LONG); - #endif - case 'f': return sizeof(float) * (is_complex ? 2 : 1); - case 'd': return sizeof(double) * (is_complex ? 2 : 1); - case 'g': return sizeof(long double) * (is_complex ? 2 : 1); - case 'O': case 'P': return sizeof(void*); - default: { - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; - } - } -} - -typedef struct { char c; short x; } __Pyx_st_short; -typedef struct { char c; int x; } __Pyx_st_int; -typedef struct { char c; long x; } __Pyx_st_long; -typedef struct { char c; float x; } __Pyx_st_float; -typedef struct { char c; double x; } __Pyx_st_double; -typedef struct { char c; long double x; } __Pyx_st_longdouble; -typedef struct { char c; void *x; } __Pyx_st_void_p; -#ifdef HAVE_LONG_LONG -typedef struct { char c; PY_LONG_LONG x; } __Pyx_s_long_long; -#endif - -static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { - switch (ch) { - case '?': case 'c': case 'b': case 'B': return 1; - case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); - case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); - case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); -#ifdef HAVE_LONG_LONG - case 'q': case 'Q': return sizeof(__Pyx_s_long_long) - sizeof(PY_LONG_LONG); -#endif - case 'f': return sizeof(__Pyx_st_float) - sizeof(float); - case 'd': return sizeof(__Pyx_st_double) - sizeof(double); - case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); - case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); - default: - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; - } -} - -static size_t __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { - switch (ch) { - case 'c': case 'b': case 'h': case 'i': case 'l': case 'q': return 'I'; - case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U'; - case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R'); - case 'O': return 'O'; - case 'P': return 'P'; - default: { - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; - } - } -} - -static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { - if (ctx->head == NULL || ctx->head->field == &ctx->root) { - const char* expected; - const char* quote; - if (ctx->head == NULL) { - expected = "end"; - quote = ""; - } else { - expected = ctx->head->field->type->name; - quote = "'"; - } - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch, expected %s%s%s but got %s", - quote, expected, quote, - __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); - } else { - __Pyx_StructField* field = ctx->head->field; - __Pyx_StructField* parent = (ctx->head - 1)->field; - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", - field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), - parent->type->name, field->name); - } -} - -static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { - char group; - size_t size, offset; - if (ctx->enc_type == 0) return 0; - group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); - do { - __Pyx_StructField* field = ctx->head->field; - __Pyx_TypeInfo* type = field->type; - - if (ctx->packmode == '@' || ctx->packmode == '^') { - size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); - } else { - size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); - } - if (ctx->packmode == '@') { - int align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); - int align_mod_offset; - if (align_at == 0) return -1; - align_mod_offset = ctx->fmt_offset % align_at; - if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; - } - - if (type->size != size || type->typegroup != group) { - if (type->typegroup == 'C' && type->fields != NULL) { - /* special case -- treat as struct rather than complex number */ - size_t parent_offset = ctx->head->parent_offset + field->offset; - ++ctx->head; - ctx->head->field = type->fields; - ctx->head->parent_offset = parent_offset; - continue; - } - - __Pyx_BufFmt_RaiseExpected(ctx); - return -1; - } - - offset = ctx->head->parent_offset + field->offset; - if (ctx->fmt_offset != offset) { - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch; next field is at offset %"PY_FORMAT_SIZE_T"d " - "but %"PY_FORMAT_SIZE_T"d expected", ctx->fmt_offset, offset); - return -1; - } - - ctx->fmt_offset += size; - - --ctx->enc_count; /* Consume from buffer string */ - - /* Done checking, move to next field, pushing or popping struct stack if needed */ - while (1) { - if (field == &ctx->root) { - ctx->head = NULL; - if (ctx->enc_count != 0) { - __Pyx_BufFmt_RaiseExpected(ctx); - return -1; - } - break; /* breaks both loops as ctx->enc_count == 0 */ - } - ctx->head->field = ++field; - if (field->type == NULL) { - --ctx->head; - field = ctx->head->field; - continue; - } else if (field->type->typegroup == 'S') { - size_t parent_offset = ctx->head->parent_offset + field->offset; - if (field->type->fields->type == NULL) continue; /* empty struct */ - field = field->type->fields; - ++ctx->head; - ctx->head->field = field; - ctx->head->parent_offset = parent_offset; - break; - } else { - break; - } - } - } while (ctx->enc_count); - ctx->enc_type = 0; - ctx->is_complex = 0; - return 0; -} - -static int __Pyx_BufFmt_FirstPack(__Pyx_BufFmt_Context* ctx) { - if (ctx->enc_type != 0 || ctx->packmode != '@') { - PyErr_SetString(PyExc_ValueError, "Buffer packing mode currently only allowed at beginning of format string (this is a defect)"); - return -1; - } - return 0; -} - -static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { - int got_Z = 0; - while (1) { - switch(*ts) { - case 0: - if (ctx->enc_type != 0 && ctx->head == NULL) { - __Pyx_BufFmt_RaiseExpected(ctx); - return NULL; - } - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - if (ctx->head != NULL) { - __Pyx_BufFmt_RaiseExpected(ctx); - return NULL; - } - return ts; - case ' ': - case 10: - case 13: - ++ts; - break; - case '<': - if (!__Pyx_IsLittleEndian()) { - PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); - return NULL; - } - if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL; - ctx->packmode = '='; - ++ts; - break; - case '>': - case '!': - if (__Pyx_IsLittleEndian()) { - PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); - return NULL; - } - if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL; - ctx->packmode = '='; - ++ts; - break; - case '=': - case '@': - case '^': - if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL; - ctx->packmode = *ts++; - break; - case 'T': /* substruct */ - { - int i; - const char* ts_after_sub; - int struct_count = ctx->new_count; - ctx->new_count = 1; - ++ts; - if (*ts != '{') { - PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); - return NULL; - } - ++ts; - ts_after_sub = ts; - for (i = 0; i != struct_count; ++i) { - ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); - if (!ts_after_sub) return NULL; - } - ts = ts_after_sub; - } - break; - case '}': /* end of substruct; either repeat or move on */ - ++ts; - return ts; - case 'x': - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->fmt_offset += ctx->new_count; - ctx->new_count = 1; - ctx->enc_count = 0; - ctx->enc_type = 0; - ++ts; - break; - case 'Z': - got_Z = 1; - ++ts; - if (*ts != 'f' && *ts != 'd' && *ts != 'g') { - __Pyx_BufFmt_RaiseUnexpectedChar('Z'); - return NULL; - } /* fall through */ - case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': - case 'l': case 'L': case 'q': case 'Q': - case 'f': case 'd': case 'g': - case 'O': - if (ctx->enc_type == *ts && got_Z == ctx->is_complex) { - /* Continue pooling same type */ - ctx->enc_count += ctx->new_count; - } else { - /* New type */ - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->enc_count = ctx->new_count; - ctx->enc_type = *ts; - ctx->is_complex = got_Z; - } - ++ts; - ctx->new_count = 1; - got_Z = 0; - break; - default: - { - ctx->new_count = __Pyx_BufFmt_ParseNumber(&ts); - if (ctx->new_count == -1) { /* First char was not a digit */ - char msg[2] = { *ts, 0 }; - PyErr_Format(PyExc_ValueError, - "Does not understand character buffer dtype format string ('%s')", msg); - return NULL; - } - } - - } - } -} - -static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { - buf->buf = NULL; - buf->obj = NULL; - buf->strides = __Pyx_zeros; - buf->shape = __Pyx_zeros; - buf->suboffsets = __Pyx_minusones; -} - -static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) { - if (obj == Py_None) { - __Pyx_ZeroBuffer(buf); - return 0; - } - buf->buf = NULL; - if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail; - if (buf->ndim != nd) { - PyErr_Format(PyExc_ValueError, - "Buffer has wrong number of dimensions (expected %d, got %d)", - nd, buf->ndim); - goto fail; - } - if (!cast) { - __Pyx_BufFmt_Context ctx; - __Pyx_BufFmt_Init(&ctx, stack, dtype); - if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; - } - if ((unsigned)buf->itemsize != dtype->size) { - PyErr_Format(PyExc_ValueError, - "Item size of buffer (%"PY_FORMAT_SIZE_T"d byte%s) does not match size of '%s' (%"PY_FORMAT_SIZE_T"d byte%s)", - buf->itemsize, (buf->itemsize > 1) ? "s" : "", - dtype->name, - dtype->size, (dtype->size > 1) ? "s" : ""); - goto fail; - } - if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; - return 0; -fail:; - __Pyx_ZeroBuffer(buf); - return -1; -} - -static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { - if (info->buf == NULL) return; - if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; - __Pyx_ReleaseBuffer(info); -} -static void __Pyx_RaiseBufferIndexError(int axis) { - PyErr_Format(PyExc_IndexError, - "Out of bounds on buffer access (axis %d)", axis); -} - - -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); - - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} - -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { - PyThreadState *tstate = PyThreadState_GET(); - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} - - -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (unlikely(!type)) { - PyErr_Format(PyExc_SystemError, "Missing type object"); - return 0; - } - if (likely(PyObject_TypeCheck(obj, type))) - return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", - Py_TYPE(obj)->tp_name, type->tp_name); - return 0; -} - -static void __Pyx_RaiseBufferFallbackError(void) { - PyErr_Format(PyExc_ValueError, - "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!"); -} - - -static CYTHON_INLINE int __Pyx_div_int(int a, int b) { - int q = a / b; - int r = a - q*b; - q -= ((r != 0) & ((r ^ b) < 0)); - return q; -} - -static CYTHON_INLINE __pyx_t_5numpy_int64_t __Pyx_div___pyx_t_5numpy_int64_t(__pyx_t_5numpy_int64_t a, __pyx_t_5numpy_int64_t b) { - __pyx_t_5numpy_int64_t q = a / b; - __pyx_t_5numpy_int64_t r = a - q*b; - q -= ((r != 0) & ((r ^ b) < 0)); - return q; -} - -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); -} - -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { - PyErr_Format(PyExc_ValueError, - #if PY_VERSION_HEX < 0x02050000 - "need more than %d value%s to unpack", (int)index, - #else - "need more than %zd value%s to unpack", index, - #endif - (index == 1) ? "" : "s"); -} - -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { - PyErr_Format(PyExc_ValueError, - #if PY_VERSION_HEX < 0x02050000 - "too many values to unpack (expected %d)", (int)expected); - #else - "too many values to unpack (expected %zd)", expected); - #endif -} - -static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { - if (t == Py_None) { - __Pyx_RaiseNoneNotIterableError(); - } else if (PyTuple_GET_SIZE(t) < index) { - __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); - } else { - __Pyx_RaiseTooManyValuesError(index); - } -} - -#if PY_MAJOR_VERSION < 3 -static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { - #if PY_VERSION_HEX >= 0x02060000 - if (Py_TYPE(obj)->tp_flags & Py_TPFLAGS_HAVE_NEWBUFFER) - return PyObject_GetBuffer(obj, view, flags); - #endif - if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pf_5numpy_7ndarray___getbuffer__(obj, view, flags); - else { - PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); - return -1; - } -} - -static void __Pyx_ReleaseBuffer(Py_buffer *view) { - PyObject* obj = view->obj; - if (obj) { -if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pf_5numpy_7ndarray___releasebuffer__(obj, view); - Py_DECREF(obj); - view->obj = NULL; - } -} - -#endif - -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { - PyObject *py_import = 0; - PyObject *empty_list = 0; - PyObject *module = 0; - PyObject *global_dict = 0; - PyObject *empty_dict = 0; - PyObject *list; - py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); - if (!py_import) - goto bad; - if (from_list) - list = from_list; - else { - empty_list = PyList_New(0); - if (!empty_list) - goto bad; - list = empty_list; - } - global_dict = PyModule_GetDict(__pyx_m); - if (!global_dict) - goto bad; - empty_dict = PyDict_New(); - if (!empty_dict) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, NULL); -bad: - Py_XDECREF(empty_list); - Py_XDECREF(py_import); - Py_XDECREF(empty_dict); - return module; -} - -#if PY_MAJOR_VERSION < 3 -static PyObject *__Pyx_GetStdout(void) { - PyObject *f = PySys_GetObject((char *)"stdout"); - if (!f) { - PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout"); - } - return f; -} - -static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) { - PyObject* v; - int i; - - if (!f) { - if (!(f = __Pyx_GetStdout())) - return -1; - } - for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) { - if (PyFile_SoftSpace(f, 1)) { - if (PyFile_WriteString(" ", f) < 0) - return -1; - } - v = PyTuple_GET_ITEM(arg_tuple, i); - if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0) - return -1; - if (PyString_Check(v)) { - char *s = PyString_AsString(v); - Py_ssize_t len = PyString_Size(v); - if (len > 0 && - isspace(Py_CHARMASK(s[len-1])) && - s[len-1] != ' ') - PyFile_SoftSpace(f, 0); - } - } - if (newline) { - if (PyFile_WriteString("\n", f) < 0) - return -1; - PyFile_SoftSpace(f, 0); - } - return 0; -} - -#else /* Python 3 has a print function */ - -static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { - PyObject* kwargs = 0; - PyObject* result = 0; - PyObject* end_string; - if (unlikely(!__pyx_print)) { - __pyx_print = __Pyx_GetAttrString(__pyx_b, "print"); - if (!__pyx_print) - return -1; - } - if (stream) { - kwargs = PyDict_New(); - if (unlikely(!kwargs)) - return -1; - if (unlikely(PyDict_SetItemString(kwargs, "file", stream) < 0)) - goto bad; - if (!newline) { - end_string = PyUnicode_FromStringAndSize(" ", 1); - if (unlikely(!end_string)) - goto bad; - if (PyDict_SetItemString(kwargs, "end", end_string) < 0) { - Py_DECREF(end_string); - goto bad; - } - Py_DECREF(end_string); - } - } else if (!newline) { - if (unlikely(!__pyx_print_kwargs)) { - __pyx_print_kwargs = PyDict_New(); - if (unlikely(!__pyx_print_kwargs)) - return -1; - end_string = PyUnicode_FromStringAndSize(" ", 1); - if (unlikely(!end_string)) - return -1; - if (PyDict_SetItemString(__pyx_print_kwargs, "end", end_string) < 0) { - Py_DECREF(end_string); - return -1; - } - Py_DECREF(end_string); - } - kwargs = __pyx_print_kwargs; - } - result = PyObject_Call(__pyx_print, arg_tuple, kwargs); - if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs)) - Py_DECREF(kwargs); - if (!result) - return -1; - Py_DECREF(result); - return 0; -bad: - if (kwargs != __pyx_print_kwargs) - Py_XDECREF(kwargs); - return -1; -} - -#endif - -static CYTHON_INLINE long __Pyx_pow_long(long b, long e) { - long t = b; - switch (e) { - case 3: - t *= b; - case 2: - t *= b; - case 1: - return t; - case 0: - return 1; - } - if (unlikely(e<0)) return 0; - t = 1; - while (likely(e)) { - t *= (b * (e&1)) | ((~e)&1); /* 1 or b */ - b *= b; - e >>= 1; - } - return t; -} - -static CYTHON_INLINE npy_int64 __Pyx_PyInt_from_py_npy_int64(PyObject* x) { - const npy_int64 neg_one = (npy_int64)-1, const_zero = (npy_int64)0; - const int is_unsigned = const_zero < neg_one; - if (sizeof(npy_int64) == sizeof(char)) { - if (is_unsigned) - return (npy_int64)__Pyx_PyInt_AsUnsignedChar(x); - else - return (npy_int64)__Pyx_PyInt_AsSignedChar(x); - } else if (sizeof(npy_int64) == sizeof(short)) { - if (is_unsigned) - return (npy_int64)__Pyx_PyInt_AsUnsignedShort(x); - else - return (npy_int64)__Pyx_PyInt_AsSignedShort(x); - } else if (sizeof(npy_int64) == sizeof(int)) { - if (is_unsigned) - return (npy_int64)__Pyx_PyInt_AsUnsignedInt(x); - else - return (npy_int64)__Pyx_PyInt_AsSignedInt(x); - } else if (sizeof(npy_int64) == sizeof(long)) { - if (is_unsigned) - return (npy_int64)__Pyx_PyInt_AsUnsignedLong(x); - else - return (npy_int64)__Pyx_PyInt_AsSignedLong(x); - } else if (sizeof(npy_int64) == sizeof(PY_LONG_LONG)) { - if (is_unsigned) - return (npy_int64)__Pyx_PyInt_AsUnsignedLongLong(x); - else - return (npy_int64)__Pyx_PyInt_AsSignedLongLong(x); - } else { - npy_int64 val; - PyObject *v = __Pyx_PyNumber_Int(x); - #if PY_VERSION_HEX < 0x03000000 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } - return (npy_int64)-1; - } -} - -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int64(npy_int64 val) { - const npy_int64 neg_one = (npy_int64)-1, const_zero = (npy_int64)0; - const int is_unsigned = const_zero < neg_one; - if ((sizeof(npy_int64) == sizeof(char)) || - (sizeof(npy_int64) == sizeof(short))) { - return PyInt_FromLong((long)val); - } else if ((sizeof(npy_int64) == sizeof(int)) || - (sizeof(npy_int64) == sizeof(long))) { - if (is_unsigned) - return PyLong_FromUnsignedLong((unsigned long)val); - else - return PyInt_FromLong((long)val); - } else if (sizeof(npy_int64) == sizeof(PY_LONG_LONG)) { - if (is_unsigned) - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); - else - return PyLong_FromLongLong((PY_LONG_LONG)val); - } else { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - return _PyLong_FromByteArray(bytes, sizeof(npy_int64), - little, !is_unsigned); - } -} - -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - return ::std::complex< float >(x, y); - } - #else - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - return x + y*(__pyx_t_float_complex)_Complex_I; - } - #endif -#else - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - __pyx_t_float_complex z; - z.real = x; - z.imag = y; - return z; - } -#endif - -#if CYTHON_CCOMPLEX -#else - static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { - return (a.real == b.real) && (a.imag == b.imag); - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - z.real = a.real + b.real; - z.imag = a.imag + b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - z.real = a.real - b.real; - z.imag = a.imag - b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - z.real = a.real * b.real - a.imag * b.imag; - z.imag = a.real * b.imag + a.imag * b.real; - return z; - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - float denom = b.real * b.real + b.imag * b.imag; - z.real = (a.real * b.real + a.imag * b.imag) / denom; - z.imag = (a.imag * b.real - a.real * b.imag) / denom; - return z; - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { - __pyx_t_float_complex z; - z.real = -a.real; - z.imag = -a.imag; - return z; - } - static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { - return (a.real == 0) && (a.imag == 0); - } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { - __pyx_t_float_complex z; - z.real = a.real; - z.imag = -a.imag; - return z; - } -/* - static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { -#if HAVE_HYPOT - return hypotf(z.real, z.imag); -#else - return sqrtf(z.real*z.real + z.imag*z.imag); -#endif - } -*/ -#endif - -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - return ::std::complex< double >(x, y); - } - #else - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - return x + y*(__pyx_t_double_complex)_Complex_I; - } - #endif -#else - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - __pyx_t_double_complex z; - z.real = x; - z.imag = y; - return z; - } -#endif - -#if CYTHON_CCOMPLEX -#else - static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { - return (a.real == b.real) && (a.imag == b.imag); - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - z.real = a.real + b.real; - z.imag = a.imag + b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - z.real = a.real - b.real; - z.imag = a.imag - b.imag; - return z; - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - z.real = a.real * b.real - a.imag * b.imag; - z.imag = a.real * b.imag + a.imag * b.real; - return z; - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - double denom = b.real * b.real + b.imag * b.imag; - z.real = (a.real * b.real + a.imag * b.imag) / denom; - z.imag = (a.imag * b.real - a.real * b.imag) / denom; - return z; - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { - __pyx_t_double_complex z; - z.real = -a.real; - z.imag = -a.imag; - return z; - } - static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { - return (a.real == 0) && (a.imag == 0); - } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { - __pyx_t_double_complex z; - z.real = a.real; - z.imag = -a.imag; - return z; - } -/* - static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { -#if HAVE_HYPOT - return hypot(z.real, z.imag); -#else - return sqrt(z.real*z.real + z.imag*z.imag); -#endif - } -*/ -#endif - -#if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { - Py_XINCREF(type); - Py_XINCREF(value); - Py_XINCREF(tb); - /* First, check the traceback argument, replacing None with NULL. */ - if (tb == Py_None) { - Py_DECREF(tb); - tb = 0; - } - else if (tb != NULL && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - /* Next, replace a missing value with None */ - if (value == NULL) { - value = Py_None; - Py_INCREF(value); - } - #if PY_VERSION_HEX < 0x02050000 - if (!PyClass_Check(type)) - #else - if (!PyType_Check(type)) - #endif - { - /* Raising an instance. The value should be a dummy. */ - if (value != Py_None) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; - } - /* Normalize to raise , */ - Py_DECREF(value); - value = type; - #if PY_VERSION_HEX < 0x02050000 - if (PyInstance_Check(type)) { - type = (PyObject*) ((PyInstanceObject*)type)->in_class; - Py_INCREF(type); - } - else { - type = 0; - PyErr_SetString(PyExc_TypeError, - "raise: exception must be an old-style class or instance"); - goto raise_error; - } - #else - type = (PyObject*) Py_TYPE(type); - Py_INCREF(type); - if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; - } - #endif - } - - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; -} - -#else /* Python 3+ */ - -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto bad; - } - if (value == Py_None) - value = 0; - - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto bad; - } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (!PyExceptionClass_Check(type)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } - - PyErr_SetObject(type, value); - - if (tb) { - PyThreadState *tstate = PyThreadState_GET(); - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); - } - } - -bad: - return; -} -#endif - -static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { - const unsigned char neg_one = (unsigned char)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(unsigned char) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(unsigned char)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to unsigned char" : - "value too large to convert to unsigned char"); - } - return (unsigned char)-1; - } - return (unsigned char)val; - } - return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); -} - -static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { - const unsigned short neg_one = (unsigned short)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(unsigned short) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(unsigned short)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to unsigned short" : - "value too large to convert to unsigned short"); - } - return (unsigned short)-1; - } - return (unsigned short)val; - } - return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); -} - -static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { - const unsigned int neg_one = (unsigned int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(unsigned int) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(unsigned int)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to unsigned int" : - "value too large to convert to unsigned int"); - } - return (unsigned int)-1; - } - return (unsigned int)val; - } - return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); -} - -static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { - const char neg_one = (char)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(char) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(char)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to char" : - "value too large to convert to char"); - } - return (char)-1; - } - return (char)val; - } - return (char)__Pyx_PyInt_AsLong(x); -} - -static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { - const short neg_one = (short)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(short) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(short)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to short" : - "value too large to convert to short"); - } - return (short)-1; - } - return (short)val; - } - return (short)__Pyx_PyInt_AsLong(x); -} - -static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { - const int neg_one = (int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(int) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(int)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to int" : - "value too large to convert to int"); - } - return (int)-1; - } - return (int)val; - } - return (int)__Pyx_PyInt_AsLong(x); -} - -static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { - const signed char neg_one = (signed char)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(signed char) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(signed char)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to signed char" : - "value too large to convert to signed char"); - } - return (signed char)-1; - } - return (signed char)val; - } - return (signed char)__Pyx_PyInt_AsSignedLong(x); -} - -static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { - const signed short neg_one = (signed short)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(signed short) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(signed short)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to signed short" : - "value too large to convert to signed short"); - } - return (signed short)-1; - } - return (signed short)val; - } - return (signed short)__Pyx_PyInt_AsSignedLong(x); -} - -static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { - const signed int neg_one = (signed int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(signed int) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(signed int)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to signed int" : - "value too large to convert to signed int"); - } - return (signed int)-1; - } - return (signed int)val; - } - return (signed int)__Pyx_PyInt_AsSignedLong(x); -} - -static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { - const int neg_one = (int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(int) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(int)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to int" : - "value too large to convert to int"); - } - return (int)-1; - } - return (int)val; - } - return (int)__Pyx_PyInt_AsLong(x); -} - -static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { - const unsigned long neg_one = (unsigned long)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; -#if PY_VERSION_HEX < 0x03000000 - if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned long"); - return (unsigned long)-1; - } - return (unsigned long)val; - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned long"); - return (unsigned long)-1; - } - return PyLong_AsUnsignedLong(x); - } else { - return PyLong_AsLong(x); - } - } else { - unsigned long val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (unsigned long)-1; - val = __Pyx_PyInt_AsUnsignedLong(tmp); - Py_DECREF(tmp); - return val; - } -} - -static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { - const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; -#if PY_VERSION_HEX < 0x03000000 - if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned PY_LONG_LONG"); - return (unsigned PY_LONG_LONG)-1; - } - return (unsigned PY_LONG_LONG)val; - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned PY_LONG_LONG"); - return (unsigned PY_LONG_LONG)-1; - } - return PyLong_AsUnsignedLongLong(x); - } else { - return PyLong_AsLongLong(x); - } - } else { - unsigned PY_LONG_LONG val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (unsigned PY_LONG_LONG)-1; - val = __Pyx_PyInt_AsUnsignedLongLong(tmp); - Py_DECREF(tmp); - return val; - } -} - -static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { - const long neg_one = (long)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; -#if PY_VERSION_HEX < 0x03000000 - if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long)-1; - } - return (long)val; - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long)-1; - } - return PyLong_AsUnsignedLong(x); - } else { - return PyLong_AsLong(x); - } - } else { - long val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (long)-1; - val = __Pyx_PyInt_AsLong(tmp); - Py_DECREF(tmp); - return val; - } -} - -static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { - const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; -#if PY_VERSION_HEX < 0x03000000 - if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to PY_LONG_LONG"); - return (PY_LONG_LONG)-1; - } - return (PY_LONG_LONG)val; - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to PY_LONG_LONG"); - return (PY_LONG_LONG)-1; - } - return PyLong_AsUnsignedLongLong(x); - } else { - return PyLong_AsLongLong(x); - } - } else { - PY_LONG_LONG val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (PY_LONG_LONG)-1; - val = __Pyx_PyInt_AsLongLong(tmp); - Py_DECREF(tmp); - return val; - } -} - -static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { - const signed long neg_one = (signed long)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; -#if PY_VERSION_HEX < 0x03000000 - if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed long"); - return (signed long)-1; - } - return (signed long)val; - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed long"); - return (signed long)-1; - } - return PyLong_AsUnsignedLong(x); - } else { - return PyLong_AsLong(x); - } - } else { - signed long val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (signed long)-1; - val = __Pyx_PyInt_AsSignedLong(tmp); - Py_DECREF(tmp); - return val; - } -} - -static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { - const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; -#if PY_VERSION_HEX < 0x03000000 - if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed PY_LONG_LONG"); - return (signed PY_LONG_LONG)-1; - } - return (signed PY_LONG_LONG)val; - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed PY_LONG_LONG"); - return (signed PY_LONG_LONG)-1; - } - return PyLong_AsUnsignedLongLong(x); - } else { - return PyLong_AsLongLong(x); - } - } else { - signed PY_LONG_LONG val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (signed PY_LONG_LONG)-1; - val = __Pyx_PyInt_AsSignedLongLong(tmp); - Py_DECREF(tmp); - return val; - } -} - -#ifndef __PYX_HAVE_RT_ImportType -#define __PYX_HAVE_RT_ImportType -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, - long size, int strict) -{ - PyObject *py_module = 0; - PyObject *result = 0; - PyObject *py_name = 0; - char warning[200]; - - py_module = __Pyx_ImportModule(module_name); - if (!py_module) - goto bad; - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(class_name); - #else - py_name = PyUnicode_FromString(class_name); - #endif - if (!py_name) - goto bad; - result = PyObject_GetAttr(py_module, py_name); - Py_DECREF(py_name); - py_name = 0; - Py_DECREF(py_module); - py_module = 0; - if (!result) - goto bad; - if (!PyType_Check(result)) { - PyErr_Format(PyExc_TypeError, - "%s.%s is not a type object", - module_name, class_name); - goto bad; - } - if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) { - PyOS_snprintf(warning, sizeof(warning), - "%s.%s size changed, may indicate binary incompatibility", - module_name, class_name); - #if PY_VERSION_HEX < 0x02050000 - PyErr_Warn(NULL, warning); - #else - PyErr_WarnEx(NULL, warning, 0); - #endif - } - else if (((PyTypeObject *)result)->tp_basicsize != size) { - PyErr_Format(PyExc_ValueError, - "%s.%s has the wrong size, try recompiling", - module_name, class_name); - goto bad; - } - return (PyTypeObject *)result; -bad: - Py_XDECREF(py_module); - Py_XDECREF(result); - return 0; -} -#endif - -#ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(name); - #else - py_name = PyUnicode_FromString(name); - #endif - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; -} -#endif - -#include "compile.h" -#include "frameobject.h" -#include "traceback.h" - -static void __Pyx_AddTraceback(const char *funcname) { - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; - PyObject *py_globals = 0; - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(__pyx_filename); - #else - py_srcfile = PyUnicode_FromString(__pyx_filename); - #endif - if (!py_srcfile) goto bad; - if (__pyx_clineno) { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); - #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); - #endif - } - else { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); - #endif - } - if (!py_funcname) goto bad; - py_globals = PyModule_GetDict(__pyx_m); - if (!py_globals) goto bad; - py_code = PyCode_New( - 0, /*int argcount,*/ - #if PY_MAJOR_VERSION >= 3 - 0, /*int kwonlyargcount,*/ - #endif - 0, /*int nlocals,*/ - 0, /*int stacksize,*/ - 0, /*int flags,*/ - __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ - py_srcfile, /*PyObject *filename,*/ - py_funcname, /*PyObject *name,*/ - __pyx_lineno, /*int firstlineno,*/ - __pyx_empty_bytes /*PyObject *lnotab*/ - ); - if (!py_code) goto bad; - py_frame = PyFrame_New( - PyThreadState_GET(), /*PyThreadState *tstate,*/ - py_code, /*PyCodeObject *code,*/ - py_globals, /*PyObject *globals,*/ - 0 /*PyObject *locals*/ - ); - if (!py_frame) goto bad; - py_frame->f_lineno = __pyx_lineno; - PyTraceBack_Here(py_frame); -bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); - Py_XDECREF(py_code); - Py_XDECREF(py_frame); -} - -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { - while (t->p) { - #if PY_MAJOR_VERSION < 3 - if (t->is_unicode) { - *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); - } else if (t->intern) { - *t->p = PyString_InternFromString(t->s); - } else { - *t->p = PyString_FromStringAndSize(t->s, t->n - 1); - } - #else /* Python 3+ has unicode identifiers */ - if (t->is_unicode | t->is_str) { - if (t->intern) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->encoding) { - *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); - } else { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); - } - } else { - *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); - } - #endif - if (!*t->p) - return -1; - ++t; - } - return 0; -} - -/* Type Conversion Functions */ - -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { - int is_true = x == Py_True; - if (is_true | (x == Py_False) | (x == Py_None)) return is_true; - else return PyObject_IsTrue(x); -} - -static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { - PyNumberMethods *m; - const char *name = NULL; - PyObject *res = NULL; -#if PY_VERSION_HEX < 0x03000000 - if (PyInt_Check(x) || PyLong_Check(x)) -#else - if (PyLong_Check(x)) -#endif - return Py_INCREF(x), x; - m = Py_TYPE(x)->tp_as_number; -#if PY_VERSION_HEX < 0x03000000 - if (m && m->nb_int) { - name = "int"; - res = PyNumber_Int(x); - } - else if (m && m->nb_long) { - name = "long"; - res = PyNumber_Long(x); - } -#else - if (m && m->nb_int) { - name = "int"; - res = PyNumber_Long(x); - } -#endif - if (res) { -#if PY_VERSION_HEX < 0x03000000 - if (!PyInt_Check(res) && !PyLong_Check(res)) { -#else - if (!PyLong_Check(res)) { -#endif - PyErr_Format(PyExc_TypeError, - "__%s__ returned non-%s (type %.200s)", - name, name, Py_TYPE(res)->tp_name); - Py_DECREF(res); - return NULL; - } - } - else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, - "an integer is required"); - } - return res; -} - -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { - Py_ssize_t ival; - PyObject* x = PyNumber_Index(b); - if (!x) return -1; - ival = PyInt_AsSsize_t(x); - Py_DECREF(x); - return ival; -} - -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { -#if PY_VERSION_HEX < 0x02050000 - if (ival <= LONG_MAX) - return PyInt_FromLong((long)ival); - else { - unsigned char *bytes = (unsigned char *) &ival; - int one = 1; int little = (int)*(unsigned char*)&one; - return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); - } -#else - return PyInt_FromSize_t(ival); -#endif -} - -static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { - unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); - if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { - return (size_t)-1; - } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to size_t"); - return (size_t)-1; - } - return (size_t)val; -} - - -#endif /* Py_PYTHON_H */ diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/setup.py --- a/yt/setup.py Wed Aug 25 18:03:39 2010 -0600 +++ b/yt/setup.py Thu Aug 26 10:24:41 2010 -0600 @@ -56,13 +56,11 @@ def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('yt', parent_package, top_path) - config.add_subpackage('lagos') - config.add_subpackage('raven') - config.add_subpackage('fido') - config.add_subpackage('reason') - config.add_subpackage('extensions') - config.add_subpackage('parallel_tools') + config.add_subpackage('analysis_modules') config.add_subpackage('data_objects') + config.add_subpackage('frontends') + config.add_subpackage('utilities') + config.add_subpackage('visualization') png_inc, png_lib = check_for_png() include_dirs=[png_inc] library_dirs=[png_lib] diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/utilities/_amr_utils/CICDeposit.pyx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yt/utilities/_amr_utils/CICDeposit.pyx Thu Aug 26 10:24:41 2010 -0600 @@ -0,0 +1,80 @@ +""" +Simle integrators for the radiative transfer equation + +Author: Britton Smith +Affiliation: CASA/University of Colorado +Homepage: http://yt.enzotools.org/ +License: + Copyright (C) 2008 Matthew Turk. All Rights Reserved. + + This file is part of yt. + + yt is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +@cython.boundscheck(False) +@cython.wraparound(False) +def CICDeposit_3(np.ndarray[np.float64_t, ndim=1] posx, + np.ndarray[np.float64_t, ndim=1] posy, + np.ndarray[np.float64_t, ndim=1] posz, + np.ndarray[np.float32_t, ndim=1] mass, + np.int64_t npositions, + np.ndarray[np.float32_t, ndim=3] field, + np.ndarray[np.float64_t, ndim=1] leftEdge, + np.ndarray[np.int32_t, ndim=1] gridDimension, + np.float64_t cellSize): + + cdef int i1, j1, k1, n + cdef double xpos, ypos, zpos + cdef double fact, edge0, edge1, edge2 + cdef double le0, le1, le2 + cdef float dx, dy, dz, dx2, dy2, dz2 + + edge0 = ( gridDimension[0]) - 0.5001 + edge1 = ( gridDimension[1]) - 0.5001 + edge2 = ( gridDimension[2]) - 0.5001 + fact = 1.0 / cellSize + + le0 = leftEdge[0] + le1 = leftEdge[1] + le2 = leftEdge[2] + + for n in range(npositions): + + # Compute the position of the central cell + xpos = fmin(fmax((posx[n] - le0)*fact, 0.5001), edge0) + ypos = fmin(fmax((posy[n] - le1)*fact, 0.5001), edge1) + zpos = fmin(fmax((posz[n] - le2)*fact, 0.5001), edge2) + + i1 = (xpos + 0.5) + j1 = (ypos + 0.5) + k1 = (zpos + 0.5) + + # Compute the weights + dx = ( i1) + 0.5 - xpos + dy = ( j1) + 0.5 - ypos + dz = ( k1) + 0.5 - zpos + dx2 = 1.0 - dx + dy2 = 1.0 - dy + dz2 = 1.0 - dz + + # Interpolate from field into sumfield + field[i1-1,j1-1,k1-1] += mass[n] * dx * dy * dz + field[i1 ,j1-1,k1-1] += mass[n] * dx2 * dy * dz + field[i1-1,j1 ,k1-1] += mass[n] * dx * dy2 * dz + field[i1 ,j1 ,k1-1] += mass[n] * dx2 * dy2 * dz + field[i1-1,j1-1,k1 ] += mass[n] * dx * dy * dz2 + field[i1 ,j1-1,k1 ] += mass[n] * dx2 * dy * dz2 + field[i1-1,j1 ,k1 ] += mass[n] * dx * dy2 * dz2 + field[i1 ,j1 ,k1 ] += mass[n] * dx2 * dy2 * dz2 diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/utilities/_amr_utils/ContourFinding.pyx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yt/utilities/_amr_utils/ContourFinding.pyx Thu Aug 26 10:24:41 2010 -0600 @@ -0,0 +1,176 @@ +""" +A two-pass contour finding algorithm + +Author: Matthew Turk +Affiliation: KIPAC/SLAC/Stanford +Homepage: http://yt.enzotools.org/ +License: + Copyright (C) 2010 Matthew Turk. All Rights Reserved. + + This file is part of yt. + + yt is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +import numpy as np +cimport numpy as np +cimport cython + +cdef extern from "math.h": + double fabs(double x) + +cdef inline np.int64_t i64max(np.int64_t i0, np.int64_t i1): + if i0 > i1: return i0 + return i1 + +cdef inline np.int64_t i64min(np.int64_t i0, np.int64_t i1): + if i0 < i1: return i0 + return i1 + +@cython.boundscheck(False) +def construct_boundary_relationships( + np.ndarray[dtype=np.int64_t, ndim=3] contour_ids): + # We only look at the boundary and one cell in + cdef int i, j, nx, ny, nz, offset_i, offset_j, oi, oj + cdef np.int64_t c1, c2 + tree = [] + nx = contour_ids.shape[0] + ny = contour_ids.shape[1] + nz = contour_ids.shape[2] + # First x-pass + for i in range(ny): + for j in range(nz): + for offset_i in range(3): + oi = offset_i - 1 + if i == 0 and oi == -1: continue + if i == ny - 1 and oj == 1: continue + for offset_j in range(3): + oj = offset_j - 1 + if j == 0 and oj == -1: continue + if j == nz - 1 and oj == 1: continue + c1 = contour_ids[0, i, j] + c2 = contour_ids[1, i + oi, j + oj] + if c1 > -1 and c2 > -1: + tree.append((i64max(c1,c2), i64min(c1,c2))) + c1 = contour_ids[nx-1, i, j] + c2 = contour_ids[nx-2, i + oi, j + oj] + if c1 > -1 and c2 > -1: + tree.append((i64max(c1,c2), i64min(c1,c2))) + # Now y-pass + for i in range(nx): + for j in range(nz): + for offset_i in range(3): + oi = offset_i - 1 + if i == 0 and oi == -1: continue + if i == nx - 1 and oj == 1: continue + for offset_j in range(3): + oj = offset_j - 1 + if j == 0 and oj == -1: continue + if j == nz - 1 and oj == 1: continue + c1 = contour_ids[i, 0, j] + c2 = contour_ids[i + oi, 1, j + oj] + if c1 > -1 and c2 > -1: + tree.append((i64max(c1,c2), i64min(c1,c2))) + c1 = contour_ids[i, ny-1, j] + c2 = contour_ids[i + oi, ny-2, j + oj] + if c1 > -1 and c2 > -1: + tree.append((i64max(c1,c2), i64min(c1,c2))) + for i in range(nx): + for j in range(ny): + for offset_i in range(3): + oi = offset_i - 1 + if i == 0 and oi == -1: continue + if i == nx - 1 and oj == 1: continue + for offset_j in range(3): + oj = offset_j - 1 + if j == 0 and oj == -1: continue + if j == ny - 1 and oj == 1: continue + c1 = contour_ids[i, j, 0] + c2 = contour_ids[i + oi, j + oj, 1] + if c1 > -1 and c2 > -1: + tree.append((i64max(c1,c2), i64min(c1,c2))) + c1 = contour_ids[i, j, nz-1] + c2 = contour_ids[i + oi, j + oj, nz-2] + if c1 > -1 and c2 > -1: + tree.append((i64max(c1,c2), i64min(c1,c2))) + return tree + +cdef inline int are_neighbors( + np.float64_t x1, np.float64_t y1, np.float64_t z1, + np.float64_t dx1, np.float64_t dy1, np.float64_t dz1, + np.float64_t x2, np.float64_t y2, np.float64_t z2, + np.float64_t dx2, np.float64_t dy2, np.float64_t dz2, + ): + # We assume an epsilon of 1e-15 + if fabs(x1-x2) > 0.5*(dx1+dx2): return 0 + if fabs(y1-y2) > 0.5*(dy1+dy2): return 0 + if fabs(z1-z2) > 0.5*(dz1+dz2): return 0 + return 1 + +@cython.boundscheck(False) +@cython.wraparound(False) +def identify_field_neighbors( + np.ndarray[dtype=np.float64_t, ndim=1] field, + np.ndarray[dtype=np.float64_t, ndim=1] x, + np.ndarray[dtype=np.float64_t, ndim=1] y, + np.ndarray[dtype=np.float64_t, ndim=1] z, + np.ndarray[dtype=np.float64_t, ndim=1] dx, + np.ndarray[dtype=np.float64_t, ndim=1] dy, + np.ndarray[dtype=np.float64_t, ndim=1] dz, + ): + # We assume this field is pre-jittered; it has no identical values. + cdef int outer, inner, N, added + cdef np.float64_t x1, y1, z1, dx1, dy1, dz1 + N = field.shape[0] + #cdef np.ndarray[dtype=np.object_t] joins + joins = [[] for outer in range(N)] + #joins = np.empty(N, dtype='object') + for outer in range(N): + if (outer % 10000) == 0: print outer, N + x1 = x[outer] + y1 = y[outer] + z1 = z[outer] + dx1 = dx[outer] + dy1 = dy[outer] + dz1 = dz[outer] + this_joins = joins[outer] + added = 0 + # Go in reverse order + for inner in range(outer, 0, -1): + if not are_neighbors(x1, y1, z1, dx1, dy1, dz1, + x[inner], y[inner], z[inner], + dx[inner], dy[inner], dz[inner]): + continue + # Hot dog, we have a weiner! + this_joins.append(inner) + added += 1 + if added == 26: break + return joins + +@cython.boundscheck(False) +@cython.wraparound(False) +def extract_identified_contours(int max_ind, joins): + cdef int i + contours = [] + for i in range(max_ind + 1): # +1 to get to the max_ind itself + contours.append(set([i])) + if len(joins[i]) == 0: + continue + proto_contour = [i] + for j in joins[i]: + proto_contour += contours[j] + proto_contour = set(proto_contour) + for j in proto_contour: + contours[j] = proto_contour + return contours diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/utilities/_amr_utils/DepthFirstOctree.pyx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yt/utilities/_amr_utils/DepthFirstOctree.pyx Thu Aug 26 10:24:41 2010 -0600 @@ -0,0 +1,167 @@ +""" +This is a recursive function to return a depth-first octree + +Author: Matthew Turk +Affiliation: KIPAC/SLAC/Stanford +Homepage: http://yt.enzotools.org/ +License: + Copyright (C) 2008 Matthew Turk. All Rights Reserved. + + This file is part of yt. + + yt is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +import numpy as np +cimport numpy as np +cimport cython + +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, + 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 + def __cinit__(self, grids): + self.grids = grids + + def __getitem__(self, int item): + return self.grids[item] + +@cython.boundscheck(False) +def RecurseOctreeDepthFirst(int i_i, int j_i, int k_i, + int i_f, int j_f, int k_f, + position curpos, int gi, + 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[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 + cdef np.float64_t dx = grid.dx[0] + cdef np.float64_t child_dx + cdef np.ndarray[np.float64_t, ndim=1] child_leftedges + cdef np.float64_t cx, cy, cz + for i_off in range(i_f): + i = i_off + i_i + cx = (leftedges[0] + i*dx) + for j_off in range(j_f): + j = j_off + j_i + cy = (leftedges[1] + j*dx) + for k_off in range(k_f): + k = k_off + k_i + cz = (leftedges[2] + k*dx) + 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 + child_grid = grids[ci-1] + child_dx = child_grid.dx[0] + child_leftedges = child_grid.left_edges + child_i = int((cx - child_leftedges[0])/child_dx) + child_j = int((cy - child_leftedges[1])/child_dx) + child_k = int((cz - child_leftedges[2])/child_dx) + s = RecurseOctreeDepthFirst(child_i, child_j, child_k, 2, 2, 2, + curpos, ci, output, refined, grids) + return s + +@cython.boundscheck(False) +def RecurseOctreeByLevels(int i_i, int j_i, int k_i, + int i_f, int j_f, int k_f, + np.ndarray[np.int32_t, ndim=1] curpos, + int gi, + np.ndarray[np.float64_t, ndim=2] output, + np.ndarray[np.int32_t, ndim=2] genealogy, + np.ndarray[np.float64_t, ndim=2] corners, + OctreeGridList grids): + cdef np.int32_t i, i_off, j, j_off, k, k_off, ci, fi + cdef int child_i, child_j, child_k + cdef OctreeGrid child_grid + cdef OctreeGrid grid = grids[gi-1] + 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 + cdef np.float64_t dx = grid.dx[0] + cdef np.float64_t child_dx + cdef np.ndarray[np.float64_t, ndim=1] child_leftedges + cdef np.float64_t cx, cy, cz + cdef int cp + for i_off in range(i_f): + i = i_off + i_i + cx = (leftedges[0] + i*dx) + if i_f > 2: print k, cz + for j_off in range(j_f): + j = j_off + j_i + cy = (leftedges[1] + j*dx) + for k_off in range(k_f): + k = k_off + k_i + cz = (leftedges[2] + k*dx) + cp = curpos[level] + corners[cp, 0] = cx + corners[cp, 1] = cy + corners[cp, 2] = cz + genealogy[curpos[level], 2] = level + # always output data + for fi in range(fields.shape[0]): + output[cp,fi] = fields[fi,i,j,k] + ci = child_indices[i,j,k] + if ci > -1: + child_grid = grids[ci-1] + child_dx = child_grid.dx[0] + child_leftedges = child_grid.left_edges + child_i = int((cx-child_leftedges[0])/child_dx) + child_j = int((cy-child_leftedges[1])/child_dx) + child_k = int((cz-child_leftedges[2])/child_dx) + # set current child id to id of next cell to examine + genealogy[cp, 0] = curpos[level+1] + # set next parent id to id of current cell + genealogy[curpos[level+1]:curpos[level+1]+8, 1] = cp + s = RecurseOctreeByLevels(child_i, child_j, child_k, 2, 2, 2, + curpos, ci, output, genealogy, + corners, grids) + curpos[level] += 1 + return s + diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/utilities/_amr_utils/FixedInterpolator.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yt/utilities/_amr_utils/FixedInterpolator.c Thu Aug 26 10:24:41 2010 -0600 @@ -0,0 +1,130 @@ +/************************************************************************ +* Copyright (C) 2009 Matthew Turk. All Rights Reserved. +* +* This file is part of yt. +* +* yt is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* +************************************************************************/ + + +// +// A small, tiny, itty bitty module for computation-intensive interpolation +// that I can't seem to make fast in Cython +// + +#include "FixedInterpolator.h" + +#define VINDEX(A,B,C) data[((((A)+ci[0])*(ds[1]+1)+((B)+ci[1]))*(ds[2]+1)+ci[2]+(C))] +// (((C*ds[1])+B)*ds[0]+A) +#define OINDEX(A,B,C) data[(A)*(ds[1]+1)*(ds[2]+1)+(B)*ds[2]+(B)+(C)] + +npy_float64 fast_interpolate(int ds[3], int ci[3], npy_float64 dp[3], + npy_float64 *data) +{ + int i; + npy_float64 dv, dm[3]; + for(i=0;i<3;i++)dm[i] = (1.0 - dp[i]); + dv = 0.0; + dv += VINDEX(0,0,0) * (dm[0]*dm[1]*dm[2]); + dv += VINDEX(0,0,1) * (dm[0]*dm[1]*dp[2]); + dv += VINDEX(0,1,0) * (dm[0]*dp[1]*dm[2]); + dv += VINDEX(0,1,1) * (dm[0]*dp[1]*dp[2]); + dv += VINDEX(1,0,0) * (dp[0]*dm[1]*dm[2]); + dv += VINDEX(1,0,1) * (dp[0]*dm[1]*dp[2]); + dv += VINDEX(1,1,0) * (dp[0]*dp[1]*dm[2]); + dv += VINDEX(1,1,1) * (dp[0]*dp[1]*dp[2]); + /*assert(dv < -20);*/ + return dv; +} + +npy_float64 offset_interpolate(int ds[3], npy_float64 dp[3], npy_float64 *data) +{ + int i; + npy_float64 dv, vz[4]; + + dv = 1.0 - dp[2]; + vz[0] = dv*OINDEX(0,0,0) + dp[2]*OINDEX(0,0,1); + vz[1] = dv*OINDEX(0,1,0) + dp[2]*OINDEX(0,1,1); + vz[2] = dv*OINDEX(1,0,0) + dp[2]*OINDEX(1,0,1); + vz[3] = dv*OINDEX(1,1,0) + dp[2]*OINDEX(1,1,1); + + dv = 1.0 - dp[1]; + vz[0] = dv*vz[0] + dp[1]*vz[1]; + vz[1] = dv*vz[2] + dp[1]*vz[3]; + + dv = 1.0 - dp[0]; + vz[0] = dv*vz[0] + dp[0]*vz[1]; + + return vz[0]; +} + +npy_float64 trilinear_interpolate(int ds[3], int ci[3], npy_float64 dp[3], + npy_float64 *data) +{ + /* dims is one less than the dimensions of the array */ + int i; + npy_float64 dm[3], vz[4]; + //dp is the distance to the plane. dm is val, dp = 1-val + for(i=0;i<3;i++)dm[i] = (1.0 - dp[i]); + + //First interpolate in z + vz[0] = dm[2]*VINDEX(0,0,0) + dp[2]*VINDEX(0,0,1); + vz[1] = dm[2]*VINDEX(0,1,0) + dp[2]*VINDEX(0,1,1); + vz[2] = dm[2]*VINDEX(1,0,0) + dp[2]*VINDEX(1,0,1); + vz[3] = dm[2]*VINDEX(1,1,0) + dp[2]*VINDEX(1,1,1); + + //Then in y + vz[0] = dm[1]*vz[0] + dp[1]*vz[1]; + vz[1] = dm[1]*vz[2] + dp[1]*vz[3]; + + //Then in x + vz[0] = dm[0]*vz[0] + dp[0]*vz[1]; + /*assert(dv < -20);*/ + return vz[0]; +} + +npy_float64 eval_gradient(int *ds, int *ci, npy_float64 *dp, + npy_float64 *data, npy_float64 *grad) +{ + // We just take some small value + + int i; + npy_float64 denom, plus, minus, backup, normval; + + normval = 0.0; + for (i = 0; i < 3; i++) { + backup = dp[i]; + grad[i] = 0.0; + if (dp[i] >= 0.95) {plus = dp[i]; minus = dp[i] - 0.05;} + else if (dp[i] <= 0.05) {plus = dp[i] + 0.05; minus = 0.0;} + else {plus = dp[i] + 0.05; minus = dp[i] - 0.05;} + //fprintf(stderr, "DIM: %d %0.3lf %0.3lf\n", i, plus, minus); + denom = plus - minus; + dp[i] = plus; + grad[i] += trilinear_interpolate(ds, ci, dp, data) / denom; + dp[i] = minus; + grad[i] -= trilinear_interpolate(ds, ci, dp, data) / denom; + dp[i] = backup; + normval += grad[i]*grad[i]; + } + if (normval != 0.0){ + normval = sqrt(normval); + for (i = 0; i < 3; i++) grad[i] /= -normval; + //fprintf(stderr, "Normval: %0.3lf %0.3lf %0.3lf %0.3lf\n", + // normval, grad[0], grad[1], grad[2]); + }else{ + grad[0]=grad[1]=grad[2]=0.0; + } +} diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/utilities/_amr_utils/FixedInterpolator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yt/utilities/_amr_utils/FixedInterpolator.h Thu Aug 26 10:24:41 2010 -0600 @@ -0,0 +1,45 @@ +/************************************************************************ +* Copyright (C) 2009 Matthew Turk. All Rights Reserved. +* +* This file is part of yt. +* +* yt is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* +************************************************************************/ + + +// +// A small, tiny, itty bitty module for computation-intensive interpolation +// that I can't seem to make fast in Cython +// + +#include "Python.h" + +#include +#include +#include +#include + +#include "numpy/ndarrayobject.h" + +npy_float64 fast_interpolate(int ds[3], int ci[3], npy_float64 dp[3], + npy_float64 *data); + +npy_float64 offset_interpolate(int ds[3], npy_float64 dp[3], npy_float64 *data); + +npy_float64 trilinear_interpolate(int ds[3], int ci[3], npy_float64 dp[3], + npy_float64 *data); + +npy_float64 eval_gradient(int ds[3], int ci[3], npy_float64 dp[3], + npy_float64 *data, npy_float64 *grad); diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/utilities/_amr_utils/Interpolators.pyx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yt/utilities/_amr_utils/Interpolators.pyx Thu Aug 26 10:24:41 2010 -0600 @@ -0,0 +1,116 @@ +""" +Simple interpolators + +Author: Matthew Turk +Affiliation: KIPAC/SLAC/Stanford +Homepage: http://yt.enzotools.org/ +License: + Copyright (C) 2008 Matthew Turk. All Rights Reserved. + + This file is part of yt. + + yt is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +import numpy as np +cimport numpy as np +cimport cython + +@cython.boundscheck(False) +def UnilinearlyInterpolate(np.ndarray[np.float64_t, ndim=1] table, + np.ndarray[np.float64_t, ndim=1] x_vals, + np.ndarray[np.float64_t, ndim=1] x_bins, + np.ndarray[np.int32_t, ndim=1] x_is, + np.ndarray[np.float64_t, ndim=1] output): + cdef double x, xp, xm + cdef int i, x_i, y_i + for i in range(x_vals.shape[0]): + x_i = x_is[i] + x = x_vals[i] + dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) + xp = (x - x_bins[x_i]) * dx_inv + xm = (x_bins[x_i+1] - x) * dx_inv + output[i] = table[x_i ] * (xm) \ + + table[x_i+1] * (xp) + +@cython.boundscheck(False) +def BilinearlyInterpolate(np.ndarray[np.float64_t, ndim=2] table, + np.ndarray[np.float64_t, ndim=1] x_vals, + np.ndarray[np.float64_t, ndim=1] y_vals, + np.ndarray[np.float64_t, ndim=1] x_bins, + np.ndarray[np.float64_t, ndim=1] y_bins, + np.ndarray[np.int32_t, ndim=1] x_is, + np.ndarray[np.int32_t, ndim=1] y_is, + np.ndarray[np.float64_t, ndim=1] output): + cdef double x, xp, xm + cdef double y, yp, ym + cdef double dx_inv, dy_inv + cdef int i, x_i, y_i + for i in range(x_vals.shape[0]): + x_i = x_is[i] + y_i = y_is[i] + x = x_vals[i] + y = y_vals[i] + dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) + dy_inv = 1.0 / (y_bins[y_i+1] - y_bins[y_i]) + xp = (x - x_bins[x_i]) * dx_inv + yp = (y - y_bins[y_i]) * dy_inv + xm = (x_bins[x_i+1] - x) * dx_inv + ym = (y_bins[y_i+1] - y) * dy_inv + output[i] = table[x_i , y_i ] * (xm*ym) \ + + table[x_i+1, y_i ] * (xp*ym) \ + + table[x_i , y_i+1] * (xm*yp) \ + + table[x_i+1, y_i+1] * (xp*yp) + +@cython.boundscheck(False) +def TrilinearlyInterpolate(np.ndarray[np.float64_t, ndim=3] table, + np.ndarray[np.float64_t, ndim=1] x_vals, + np.ndarray[np.float64_t, ndim=1] y_vals, + np.ndarray[np.float64_t, ndim=1] z_vals, + np.ndarray[np.float64_t, ndim=1] x_bins, + np.ndarray[np.float64_t, ndim=1] y_bins, + np.ndarray[np.float64_t, ndim=1] z_bins, + np.ndarray[np.int_t, ndim=1] x_is, + np.ndarray[np.int_t, ndim=1] y_is, + np.ndarray[np.int_t, ndim=1] z_is, + np.ndarray[np.float64_t, ndim=1] output): + cdef double x, xp, xm + cdef double y, yp, ym + cdef double z, zp, zm + cdef double dx_inv, dy_inv, dz_inv + cdef int i, x_i, y_i, z_i + for i in range(x_vals.shape[0]): + x_i = x_is[i] + y_i = y_is[i] + z_i = z_is[i] + x = x_vals[i] + y = y_vals[i] + z = z_vals[i] + dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) + dy_inv = 1.0 / (y_bins[y_i+1] - y_bins[y_i]) + dz_inv = 1.0 / (z_bins[z_i+1] - z_bins[z_i]) + xp = (x - x_bins[x_i]) * dx_inv + yp = (y - y_bins[y_i]) * dy_inv + zp = (z - z_bins[z_i]) * dz_inv + xm = (x_bins[x_i+1] - x) * dx_inv + ym = (y_bins[y_i+1] - y) * dy_inv + zm = (z_bins[z_i+1] - z) * dz_inv + output[i] = table[x_i ,y_i ,z_i ] * (xm*ym*zm) \ + + table[x_i+1,y_i ,z_i ] * (xp*ym*zm) \ + + table[x_i ,y_i+1,z_i ] * (xm*yp*zm) \ + + table[x_i ,y_i ,z_i+1] * (xm*ym*zp) \ + + table[x_i+1,y_i ,z_i+1] * (xp*ym*zp) \ + + table[x_i ,y_i+1,z_i+1] * (xm*yp*zp) \ + + table[x_i+1,y_i+1,z_i ] * (xp*yp*zm) \ + + table[x_i+1,y_i+1,z_i+1] * (xp*yp*zp) diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/utilities/_amr_utils/Octree.pyx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yt/utilities/_amr_utils/Octree.pyx Thu Aug 26 10:24:41 2010 -0600 @@ -0,0 +1,280 @@ +""" +A refine-by-two AMR-specific octree + +Author: Matthew Turk +Affiliation: UCSD +Homepage: http://yt.enzotools.org/ +License: + Copyright (C) 2010 Matthew Turk. All Rights Reserved. + + This file is part of yt. + + yt is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + + +import numpy as np +cimport numpy as np +# Double up here for def'd functions +cimport numpy as cnp +cimport cython + +from stdlib cimport malloc, free, abs + +cdef extern from "stdlib.h": + # NOTE that size_t might not be int + void *alloca(int) + +cdef struct OctreeNode: + np.float64_t *val + np.float64_t weight_val + np.int64_t pos[3] + int level + int nvals + OctreeNode *children[2][2][2] + +cdef void OTN_add_value(OctreeNode *self, + np.float64_t *val, np.float64_t weight_val): + cdef int i + for i in range(self.nvals): + self.val[i] += val[i] + self.weight_val += weight_val + +cdef void OTN_refine(OctreeNode *self): + cdef int i, j, i1, j1 + cdef np.int64_t npos[3] + cdef OctreeNode *node + for i in range(2): + npos[0] = self.pos[0] * 2 + i + for j in range(2): + npos[1] = self.pos[1] * 2 + j + # We have to be careful with allocation... + for k in range(2): + npos[2] = self.pos[2] * 2 + k + self.children[i][j][k] = OTN_initialize( + npos, + self.nvals, self.val, self.weight_val, + self.level + 1) + for i in range(self.nvals): self.val[i] = 0.0 + self.weight_val = 0.0 + +cdef OctreeNode *OTN_initialize(np.int64_t pos[3], int nvals, + np.float64_t *val, np.float64_t weight_val, + int level): + cdef OctreeNode *node + cdef int i, j + node = malloc(sizeof(OctreeNode)) + node.pos[0] = pos[0] + node.pos[1] = pos[1] + node.pos[2] = pos[2] + node.nvals = nvals + node.val = malloc( + nvals * sizeof(np.float64_t)) + for i in range(nvals): + node.val[i] = val[i] + node.weight_val = weight_val + for i in range(2): + for j in range(2): + for k in range(2): + node.children[i][j][k] = NULL + node.level = level + return node + +cdef void OTN_free(OctreeNode *node): + cdef int i, j + for i in range(2): + for j in range(2): + for k in range(2): + if node.children[i][j][k] == NULL: continue + OTN_free(node.children[i][j][k]) + free(node.val) + free(node) + +cdef class Octree: + cdef int nvals + cdef np.int64_t po2[80] + cdef OctreeNode ****root_nodes + cdef np.int64_t top_grid_dims[3] + + def __cinit__(self, np.ndarray[np.int64_t, ndim=1] top_grid_dims, + int nvals): + cdef int i, j + cdef OctreeNode *node + cdef np.int64_t pos[3] + cdef np.float64_t *vals = alloca( + sizeof(np.float64_t)*nvals) + cdef np.float64_t weight_val = 0.0 + self.nvals = nvals + for i in range(nvals): vals[i] = 0.0 + + self.top_grid_dims[0] = top_grid_dims[0] + self.top_grid_dims[1] = top_grid_dims[1] + self.top_grid_dims[2] = top_grid_dims[2] + + # This wouldn't be necessary if we did bitshifting... + for i in range(80): + self.po2[i] = 2**i + # Cython doesn't seem to like sizeof(OctreeNode ***) + self.root_nodes = \ + malloc(sizeof(void*) * top_grid_dims[0]) + + # We initialize our root values to 0.0. + for i in range(top_grid_dims[0]): + pos[0] = i + self.root_nodes[i] = \ + malloc(sizeof(OctreeNode **) * top_grid_dims[1]) + for j in range(top_grid_dims[1]): + pos[1] = j + self.root_nodes[i][j] = \ + malloc(sizeof(OctreeNode *) * top_grid_dims[1]) + for k in range(top_grid_dims[2]): + pos[2] = k + self.root_nodes[i][j][k] = OTN_initialize( + pos, nvals, vals, weight_val, 0) + + cdef void add_to_position(self, + int level, np.int64_t pos[3], + np.float64_t *val, + np.float64_t weight_val): + cdef int i, j + cdef OctreeNode *node + node = self.find_on_root_level(pos, level) + cdef np.int64_t fac + for L in range(level): + if node.children[0][0][0] == NULL: + OTN_refine(node) + # Maybe we should use bitwise operators? + fac = self.po2[level - L - 1] + i = (pos[0] >= fac*(2*node.pos[0]+1)) + j = (pos[1] >= fac*(2*node.pos[1]+1)) + k = (pos[2] >= fac*(2*node.pos[2]+1)) + node = node.children[i][j][k] + OTN_add_value(node, val, weight_val) + + cdef OctreeNode *find_on_root_level(self, np.int64_t pos[3], int level): + # We need this because the root level won't just have four children + # So we find on the root level, then we traverse the tree. + cdef np.int64_t i, j + i = (pos[0] / self.po2[level]) + j = (pos[1] / self.po2[level]) + k = (pos[2] / self.po2[level]) + return self.root_nodes[i][j][k] + + + @cython.boundscheck(False) + @cython.wraparound(False) + def add_array_to_tree(self, int level, + np.ndarray[np.int64_t, ndim=1] pxs, + np.ndarray[np.int64_t, ndim=1] pys, + np.ndarray[np.int64_t, ndim=1] pzs, + np.ndarray[np.float64_t, ndim=2] pvals, + np.ndarray[np.float64_t, ndim=1] pweight_vals): + cdef int np = pxs.shape[0] + cdef int p + cdef cnp.float64_t *vals + cdef cnp.float64_t *data = pvals.data + cdef cnp.int64_t pos[3] + for p in range(np): + vals = data + self.nvals*p + pos[0] = pxs[p] + pos[1] = pys[p] + pos[2] = pzs[p] + self.add_to_position(level, pos, vals, pweight_vals[p]) + + def add_grid_to_tree(self, int level, + np.ndarray[np.int64_t, ndim=1] start_index, + np.ndarray[np.float64_t, ndim=2] pvals, + np.ndarray[np.float64_t, ndim=2] wvals, + np.ndarray[np.int32_t, ndim=2] cm): + pass + + @cython.boundscheck(False) + @cython.wraparound(False) + def get_all_from_level(self, int level, int count_only = 0): + cdef int i, j + cdef int total = 0 + vals = [] + for i in range(self.top_grid_dims[0]): + for j in range(self.top_grid_dims[1]): + for k in range(self.top_grid_dims[2]): + total += self.count_at_level(self.root_nodes[i][j][k], level) + if count_only: return total + # Allocate our array + cdef np.ndarray[np.int64_t, ndim=2] npos + cdef np.ndarray[np.float64_t, ndim=2] nvals + cdef np.ndarray[np.float64_t, ndim=1] nwvals + npos = np.zeros( (total, 2), dtype='int64') + nvals = np.zeros( (total, self.nvals), dtype='float64') + nwvals = np.zeros( total, dtype='float64') + cdef np.int64_t curpos = 0 + cdef np.int64_t *pdata = npos.data + cdef np.float64_t *vdata = nvals.data + cdef np.float64_t *wdata = nwvals.data + for i in range(self.top_grid_dims[0]): + for j in range(self.top_grid_dims[1]): + for k in range(self.top_grid_dims[2]): + curpos += self.fill_from_level(self.root_nodes[i][j][k], + level, curpos, pdata, vdata, wdata) + return npos, nvals, nwvals + + cdef int count_at_level(self, OctreeNode *node, int level): + cdef int i, j + # We only really return a non-zero, calculated value if we are at the + # level in question. + if node.level == level: + # We return 1 if there are no finer points at this level and zero + # if there are + return (node.children[0][0][0] == NULL) + if node.children[0][0][0] == NULL: return 0 + cdef int count = 0 + for i in range(2): + for j in range(2): + for k in range(2): + count += self.count_at_level(node.children[i][j][k], level) + return count + + cdef int fill_from_level(self, OctreeNode *node, int level, + np.int64_t curpos, + np.int64_t *pdata, + np.float64_t *vdata, + np.float64_t *wdata): + cdef int i, j + if node.level == level: + if node.children[0][0][0] != NULL: return 0 + for i in range(self.nvals): + vdata[self.nvals * curpos + i] = node.val[i] + wdata[curpos] = node.weight_val + pdata[curpos * 3] = node.pos[0] + pdata[curpos * 3 + 1] = node.pos[1] + pdata[curpos * 3 + 2] = node.pos[2] + return 1 + if node.children[0][0] == NULL: return 0 + cdef np.int64_t added = 0 + for i in range(2): + for j in range(2): + for k in range(2): + added += self.fill_from_level(node.children[i][j][k], + level, curpos + added, pdata, vdata, wdata) + return added + + def __dealloc__(self): + cdef int i, j + for i in range(self.top_grid_dims[0]): + for j in range(self.top_grid_dims[1]): + for k in range(self.top_grid_dims[2]): + OTN_free(self.root_nodes[i][j][k]) + free(self.root_nodes[i][j]) + free(self.root_nodes[i]) + free(self.root_nodes) + diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/utilities/_amr_utils/PointsInVolume.pyx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yt/utilities/_amr_utils/PointsInVolume.pyx Thu Aug 26 10:24:41 2010 -0600 @@ -0,0 +1,217 @@ +""" +Checks for points contained in a volume + +Author: John Wise +Affiliation: Princeton +Homepage: http://yt.enzotools.org/ +License: + Copyright (C) 2009 John. All Rights Reserved. + + This file is part of yt. + + yt is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + + +import numpy as np +cimport numpy as np +cimport cython + +cdef extern from "math.h": + double fabs(double x) + +@cython.wraparound(False) +@cython.boundscheck(False) +def planar_points_in_volume( + np.ndarray[np.float64_t, ndim=2] points, + np.ndarray[np.int8_t, ndim=1] pmask, # pixel mask + np.ndarray[np.float64_t, ndim=1] left_edge, + np.ndarray[np.float64_t, ndim=1] right_edge, + np.ndarray[np.int32_t, ndim=3] mask, + float dx): + cdef np.ndarray[np.int8_t, ndim=1] \ + valid = np.zeros(points.shape[0], dtype='int8') + cdef int i, dim, count + cdef int ex + cdef double dx_inv + cdef unsigned int idx[3] + count = 0 + dx_inv = 1.0 / dx + for i in xrange(points.shape[0]): + if pmask[i] == 0: + continue + ex = 1 + for dim in xrange(3): + if points[i,dim] < left_edge[dim] or points[i,dim] > right_edge[dim]: + valid[i] = ex = 0 + break + if ex == 1: + for dim in xrange(3): + idx[dim] = \ + ((points[i,dim] - left_edge[dim]) * dx_inv) + if mask[idx[0], idx[1], idx[2]] == 1: + valid[i] = 1 + count += 1 + + cdef np.ndarray[np.int32_t, ndim=1] result = np.empty(count, dtype='int32') + count = 0 + for i in xrange(points.shape[0]): + if valid[i] == 1 and pmask[i] == 1: + result[count] = i + count += 1 + + return result + +cdef inline void set_rotated_pos( + np.float64_t cp[3], np.float64_t rdds[3][3], + np.float64_t rorigin[3], int i, int j, int k): + cdef int oi + for oi in range(3): + cp[oi] = rdds[0][oi] * (0.5 + i) \ + + rdds[1][oi] * (0.5 + j) \ + + rdds[2][oi] * (0.5 + k) \ + + rorigin[oi] + +#@cython.wraparound(False) +#@cython.boundscheck(False) +def grid_points_in_volume( + np.ndarray[np.float64_t, ndim=1] box_lengths, + np.ndarray[np.float64_t, ndim=1] box_origin, + np.ndarray[np.float64_t, ndim=2] rot_mat, + np.ndarray[np.float64_t, ndim=1] grid_left_edge, + np.ndarray[np.float64_t, ndim=1] grid_right_edge, + np.ndarray[np.float64_t, ndim=1] dds, + np.ndarray[np.int32_t, ndim=3] mask, + int break_first): + cdef int n[3], i, j, k, ax + cdef np.float64_t rds[3][3], cur_pos[3], rorigin[3] + for i in range(3): + rorigin[i] = 0.0 + for i in range(3): + n[i] = mask.shape[i] + for j in range(3): + # Set up our transposed dx, which has a component in every + # direction + rds[i][j] = dds[i] * rot_mat[j,i] + # In our rotated coordinate system, the box origin is 0,0,0 + # so we subtract the box_origin from the grid_origin and rotate + # that + rorigin[j] += (grid_left_edge[i] - box_origin[i]) * rot_mat[j,i] + + for i in range(n[0]): + for j in range(n[1]): + for k in range(n[2]): + set_rotated_pos(cur_pos, rds, rorigin, i, j, k) + if (cur_pos[0] > box_lengths[0]): continue + if (cur_pos[1] > box_lengths[1]): continue + if (cur_pos[2] > box_lengths[2]): continue + if (cur_pos[0] < 0.0): continue + if (cur_pos[1] < 0.0): continue + if (cur_pos[2] < 0.0): continue + if break_first: + if mask[i,j,k]: return 1 + else: + mask[i,j,k] = 1 + return 0 + +cdef void normalize_vector(np.float64_t vec[3]): + cdef int i + cdef np.float64_t norm = 0.0 + for i in range(3): + norm += vec[i]*vec[i] + norm = norm**0.5 + for i in range(3): + vec[i] /= norm + +cdef void get_cross_product(np.float64_t v1[3], + np.float64_t v2[3], + np.float64_t cp[3]): + cp[0] = v1[1]*v2[2] - v1[2]*v2[1] + cp[1] = v1[3]*v2[0] - v1[0]*v2[3] + cp[2] = v1[0]*v2[1] - v1[1]*v2[0] + #print cp[0], cp[1], cp[2] + +cdef int check_projected_overlap( + np.float64_t sep_ax[3], np.float64_t sep_vec[3], int gi, + np.float64_t b_vec[3][3], np.float64_t g_vec[3][3]): + cdef int g_ax, b_ax + cdef np.float64_t tba, tga, ba, ga, sep_dot + ba = ga = sep_dot = 0.0 + for g_ax in range(3): + # We need the grid vectors, which we'll precompute here + tba = tga = 0.0 + for b_ax in range(3): + tba += b_vec[g_ax][b_ax] * sep_vec[b_ax] + tga += g_vec[g_ax][b_ax] * sep_vec[b_ax] + ba += fabs(tba) + ga += fabs(tga) + sep_dot += sep_vec[g_ax] * sep_ax[g_ax] + #print sep_vec[0], sep_vec[1], sep_vec[2], + #print sep_ax[0], sep_ax[1], sep_ax[2] + return (fabs(sep_dot) > ba+ga) + # Now we do + +@cython.wraparound(False) +@cython.boundscheck(False) +def find_grids_in_inclined_box( + np.ndarray[np.float64_t, ndim=2] box_vectors, + np.ndarray[np.float64_t, ndim=1] box_center, + np.ndarray[np.float64_t, ndim=2] grid_left_edges, + np.ndarray[np.float64_t, ndim=2] grid_right_edges): + + # http://www.gamasutra.com/view/feature/3383/simple_intersection_tests_for_games.php?page=5 + cdef int n = grid_right_edges.shape[0] + cdef int g_ax, b_ax, gi + cdef np.float64_t b_vec[3][3], g_vec[3][3], a_vec[3][3], sep_ax[15][3] + cdef np.float64_t sep_vec[3], norm + cdef np.ndarray[np.int32_t, ndim=1] good = np.zeros(n, dtype='int32') + cdef np.ndarray[np.float64_t, ndim=2] grid_centers + # Fill in our axis unit vectors + for b_ax in range(3): + for g_ax in range(3): + a_vec[b_ax][g_ax] = (b_ax == g_ax) + grid_centers = (grid_right_edges + grid_left_edges)/2.0 + + # Now we pre-compute our candidate separating axes, because the unit + # vectors for all the grids are identical + for b_ax in range(3): + # We have 6 principal axes we already know, which are the grid (domain) + # principal axes and the box axes + sep_ax[b_ax][0] = sep_ax[b_ax][1] = sep_ax[b_ax][2] = 0.0 + sep_ax[b_ax][b_ax] = 1.0 # delta_ijk, for grid axes + for g_ax in range(3): + b_vec[b_ax][g_ax] = 0.5*box_vectors[b_ax,g_ax] + sep_ax[b_ax + 3][g_ax] = b_vec[b_ax][g_ax] # box axes + normalize_vector(sep_ax[b_ax + 3]) + for g_ax in range(3): + get_cross_product(b_vec[b_ax], a_vec[g_ax], sep_ax[b_ax*3 + g_ax + 6]) + normalize_vector(sep_ax[b_ax*3 + g_ax + 6]) + + for gi in range(n): + for g_ax in range(3): + # Calculate the separation vector + sep_vec[g_ax] = grid_centers[gi, g_ax] - box_center[g_ax] + # Calculate the grid axis lengths + g_vec[g_ax][0] = g_vec[g_ax][1] = g_vec[g_ax][2] = 0.0 + g_vec[g_ax][g_ax] = 0.5 * (grid_right_edges[gi, g_ax] + - grid_left_edges[gi, g_ax]) + for b_ax in range(15): + #print b_ax, + if check_projected_overlap( + sep_ax[b_ax], sep_vec, gi, + b_vec, g_vec): + good[gi] = 1 + break + return good + diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/utilities/_amr_utils/QuadTree.pyx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yt/utilities/_amr_utils/QuadTree.pyx Thu Aug 26 10:24:41 2010 -0600 @@ -0,0 +1,257 @@ +""" +A refine-by-two AMR-specific quadtree + +Author: Matthew Turk +Affiliation: UCSD +Homepage: http://yt.enzotools.org/ +License: + Copyright (C) 2010 Matthew Turk. All Rights Reserved. + + This file is part of yt. + + yt is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + + +import numpy as np +cimport numpy as np +# Double up here for def'd functions +cimport numpy as cnp +cimport cython + +from stdlib cimport malloc, free, abs + +cdef extern from "stdlib.h": + # NOTE that size_t might not be int + void *alloca(int) + +cdef struct QuadTreeNode: + np.float64_t *val + np.float64_t weight_val + np.int64_t pos[2] + int level + int nvals + QuadTreeNode *children[2][2] + +cdef void QTN_add_value(QuadTreeNode *self, + np.float64_t *val, np.float64_t weight_val): + cdef int i + for i in range(self.nvals): + self.val[i] += val[i] + self.weight_val += weight_val + +cdef void QTN_refine(QuadTreeNode *self): + cdef int i, j, i1, j1 + cdef np.int64_t npos[2] + cdef QuadTreeNode *node + for i in range(2): + npos[0] = self.pos[0] * 2 + i + for j in range(2): + npos[1] = self.pos[1] * 2 + j + # We have to be careful with allocation... + self.children[i][j] = QTN_initialize( + npos, + self.nvals, self.val, self.weight_val, + self.level + 1) + for i in range(self.nvals): self.val[i] = 0.0 + self.weight_val = 0.0 + +cdef QuadTreeNode *QTN_initialize(np.int64_t pos[2], int nvals, + np.float64_t *val, np.float64_t weight_val, + int level): + cdef QuadTreeNode *node + cdef int i, j + node = malloc(sizeof(QuadTreeNode)) + node.pos[0] = pos[0] + node.pos[1] = pos[1] + node.nvals = nvals + node.val = malloc( + nvals * sizeof(np.float64_t)) + for i in range(nvals): + node.val[i] = val[i] + node.weight_val = weight_val + for i in range(2): + for j in range(2): + node.children[i][j] = NULL + node.level = level + return node + +cdef void QTN_free(QuadTreeNode *node): + cdef int i, j + for i in range(2): + for j in range(2): + if node.children[i][j] == NULL: continue + QTN_free(node.children[i][j]) + free(node.val) + free(node) + +cdef class QuadTree: + cdef int nvals + cdef np.int64_t po2[80] + cdef QuadTreeNode ***root_nodes + cdef np.int64_t top_grid_dims[2] + + def __cinit__(self, np.ndarray[np.int64_t, ndim=1] top_grid_dims, + int nvals): + cdef int i, j + cdef QuadTreeNode *node + cdef np.int64_t pos[2] + cdef np.float64_t *vals = alloca( + sizeof(np.float64_t)*nvals) + cdef np.float64_t weight_val = 0.0 + self.nvals = nvals + for i in range(nvals): vals[i] = 0.0 + + self.top_grid_dims[0] = top_grid_dims[0] + self.top_grid_dims[1] = top_grid_dims[1] + + # This wouldn't be necessary if we did bitshifting... + for i in range(80): + self.po2[i] = 2**i + self.root_nodes = \ + malloc(sizeof(QuadTreeNode **) * top_grid_dims[0]) + + # We initialize our root values to 0.0. + for i in range(top_grid_dims[0]): + pos[0] = i + self.root_nodes[i] = \ + malloc(sizeof(QuadTreeNode *) * top_grid_dims[1]) + for j in range(top_grid_dims[1]): + pos[1] = j + self.root_nodes[i][j] = QTN_initialize( + pos, nvals, vals, weight_val, 0) + + cdef void add_to_position(self, + int level, np.int64_t pos[2], + np.float64_t *val, + np.float64_t weight_val): + cdef int i, j + cdef QuadTreeNode *node + node = self.find_on_root_level(pos, level) + cdef np.int64_t fac + for L in range(level): + if node.children[0][0] == NULL: + QTN_refine(node) + # Maybe we should use bitwise operators? + fac = self.po2[level - L - 1] + i = (pos[0] >= fac*(2*node.pos[0]+1)) + j = (pos[1] >= fac*(2*node.pos[1]+1)) + node = node.children[i][j] + QTN_add_value(node, val, weight_val) + + cdef QuadTreeNode *find_on_root_level(self, np.int64_t pos[2], int level): + # We need this because the root level won't just have four children + # So we find on the root level, then we traverse the tree. + cdef np.int64_t i, j + i = (pos[0] / self.po2[level]) + j = (pos[1] / self.po2[level]) + return self.root_nodes[i][j] + + + @cython.boundscheck(False) + @cython.wraparound(False) + def add_array_to_tree(self, int level, + np.ndarray[np.int64_t, ndim=1] pxs, + np.ndarray[np.int64_t, ndim=1] pys, + np.ndarray[np.float64_t, ndim=2] pvals, + np.ndarray[np.float64_t, ndim=1] pweight_vals): + cdef int np = pxs.shape[0] + cdef int p + cdef cnp.float64_t *vals + cdef cnp.float64_t *data = pvals.data + cdef cnp.int64_t pos[2] + for p in range(np): + vals = data + self.nvals*p + pos[0] = pxs[p] + pos[1] = pys[p] + self.add_to_position(level, pos, vals, pweight_vals[p]) + + def add_grid_to_tree(self, int level, + np.ndarray[np.int64_t, ndim=1] start_index, + np.ndarray[np.float64_t, ndim=2] pvals, + np.ndarray[np.float64_t, ndim=2] wvals, + np.ndarray[np.int32_t, ndim=2] cm): + pass + + @cython.boundscheck(False) + @cython.wraparound(False) + def get_all_from_level(self, int level, int count_only = 0): + cdef int i, j + cdef int total = 0 + vals = [] + for i in range(self.top_grid_dims[0]): + for j in range(self.top_grid_dims[1]): + total += self.count_at_level(self.root_nodes[i][j], level) + if count_only: return total + # Allocate our array + cdef np.ndarray[np.int64_t, ndim=2] npos + cdef np.ndarray[np.float64_t, ndim=2] nvals + cdef np.ndarray[np.float64_t, ndim=1] nwvals + npos = np.zeros( (total, 2), dtype='int64') + nvals = np.zeros( (total, self.nvals), dtype='float64') + nwvals = np.zeros( total, dtype='float64') + cdef np.int64_t curpos = 0 + cdef np.int64_t *pdata = npos.data + cdef np.float64_t *vdata = nvals.data + cdef np.float64_t *wdata = nwvals.data + for i in range(self.top_grid_dims[0]): + for j in range(self.top_grid_dims[1]): + curpos += self.fill_from_level(self.root_nodes[i][j], + level, curpos, pdata, vdata, wdata) + return npos, nvals, nwvals + + cdef int count_at_level(self, QuadTreeNode *node, int level): + cdef int i, j + # We only really return a non-zero, calculated value if we are at the + # level in question. + if node.level == level: + # We return 1 if there are no finer points at this level and zero + # if there are + return (node.children[0][0] == NULL) + if node.children[0][0] == NULL: return 0 + cdef int count = 0 + for i in range(2): + for j in range(2): + count += self.count_at_level(node.children[i][j], level) + return count + + cdef int fill_from_level(self, QuadTreeNode *node, int level, + np.int64_t curpos, + np.int64_t *pdata, + np.float64_t *vdata, + np.float64_t *wdata): + cdef int i, j + if node.level == level: + if node.children[0][0] != NULL: return 0 + for i in range(self.nvals): + vdata[self.nvals * curpos + i] = node.val[i] + wdata[curpos] = node.weight_val + pdata[curpos * 2] = node.pos[0] + pdata[curpos * 2 + 1] = node.pos[1] + return 1 + if node.children[0][0] == NULL: return 0 + cdef np.int64_t added = 0 + for i in range(2): + for j in range(2): + added += self.fill_from_level(node.children[i][j], + level, curpos + added, pdata, vdata, wdata) + return added + + def __dealloc__(self): + cdef int i, j + for i in range(self.top_grid_dims[0]): + for j in range(self.top_grid_dims[1]): + QTN_free(self.root_nodes[i][j]) + free(self.root_nodes[i]) + free(self.root_nodes) diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/utilities/_amr_utils/RayIntegrators.pyx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yt/utilities/_amr_utils/RayIntegrators.pyx Thu Aug 26 10:24:41 2010 -0600 @@ -0,0 +1,374 @@ +""" +Simle integrators for the radiative transfer equation + +Author: Matthew Turk +Affiliation: KIPAC/SLAC/Stanford +Homepage: http://yt.enzotools.org/ +License: + Copyright (C) 2008 Matthew Turk. All Rights Reserved. + + This file is part of yt. + + yt is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +import numpy as np +cimport numpy as np +cimport cython +from stdlib cimport malloc, free, abs + +cdef extern from "math.h": + double exp(double x) + float expf(float x) + +@cython.boundscheck(False) +def Transfer3D(np.ndarray[np.float64_t, ndim=3] i_s, + np.ndarray[np.float64_t, ndim=4] o_s, + np.ndarray[np.float64_t, ndim=4] e, + np.ndarray[np.float64_t, ndim=4] a, + int imin, int imax, int jmin, int jmax, + int kmin, int kmax, int istride, int jstride, + np.float64_t dx): + """ + This function accepts an incoming slab (*i_s*), a buffer + for an outgoing set of values at every point in the grid (*o_s*), + an emission array (*e*), an absorption array (*a*), and dimensions of + the grid (*imin*, *imax*, *jmin*, *jmax*, *kmin*, *kmax*) as well + as strides in the *i* and *j* directions, and a *dx* of the grid being + integrated. + """ + cdef int i, ii + cdef int j, jj + cdef int k, kk + cdef int n, nn + nn = o_s.shape[3] # This might be slow + cdef np.float64_t *temp = malloc(sizeof(np.float64_t) * nn) + for i in range((imax-imin)*istride): + ii = i + imin*istride + for j in range((jmax-jmin)*jstride): + jj = j + jmin*jstride + # Not sure about the ordering of the loops here + for n in range(nn): + temp[n] = i_s[ii,jj,n] + for k in range(kmax-kmin): + kk = k + kmin#*kstride, which doesn't make any sense + for n in range(nn): + o_s[i,j,k,n] = temp[n] + dx*(e[i,j,k,n] - temp[n]*a[i,j,k,n]) + temp[n] = o_s[i,j,k,n] + for n in range(nn): + i_s[ii,jj,n] = temp[n] + free(temp) + +@cython.boundscheck(False) +def TransferShells(np.ndarray[np.float64_t, ndim=3] i_s, + np.ndarray[np.float64_t, ndim=3] data, + np.ndarray[np.float64_t, ndim=2] shells): + """ + This function accepts an incoming slab (*i_s*), a buffer of *data*, + and a list of shells specified as [ (value, tolerance, r, g, b), ... ]. + """ + cdef int i, ii + cdef int j, jj + cdef int k, kk + cdef int n, nn + cdef np.float64_t dist + ii = data.shape[0] + jj = data.shape[1] + kk = data.shape[2] + nn = shells.shape[0] + cdef float rgba[4] + cdef float alpha + for i in range(ii): + for j in range(jj): + # Not sure about the ordering of the loops here + for k in range(kk): + for n in range(nn): + dist = shells[n, 0] - data[i,j,k] + if dist < 0: dist *= -1.0 + if dist < shells[n,1]: + dist = exp(-dist/8.0) + rgba[0] = shells[n,2] + rgba[1] = shells[n,3] + rgba[2] = shells[n,4] + rgba[3] = shells[n,5] + alpha = i_s[i,j,3] + dist *= dist # This might improve appearance + i_s[i,j,0] += (1.0 - alpha)*rgba[0]*dist*rgba[3] + i_s[i,j,1] += (1.0 - alpha)*rgba[1]*dist*rgba[3] + i_s[i,j,2] += (1.0 - alpha)*rgba[2]*dist*rgba[3] + i_s[i,j,3] += (1.0 - alpha)*rgba[3]*dist*rgba[3] + break + +@cython.boundscheck(False) +def Transfer1D(float i_s, + np.ndarray[np.float_t, ndim=1] o_s, + np.ndarray[np.float_t, ndim=1] e, + np.ndarray[np.float_t, ndim=1] a, + np.ndarray[np.float_t, ndim=1] dx, + int imin, int imax): + cdef int i + for i in range(imin, imax): + o_s[i] = i_s + dx[i]*(e[i] - i_s*a[i]) + i_s = o_s[i] + return i_s + +@cython.wraparound(False) +@cython.boundscheck(False) +def VoxelTraversal(np.ndarray[np.int_t, ndim=3] grid_mask, + np.ndarray[np.float64_t, ndim=3] grid_t, + np.ndarray[np.float64_t, ndim=3] grid_dt, + np.ndarray[np.float64_t, ndim=1] left_edge, + np.ndarray[np.float64_t, ndim=1] right_edge, + np.ndarray[np.float64_t, ndim=1] dx, + np.ndarray[np.float64_t, ndim=1] u, + np.ndarray[np.float64_t, ndim=1] v): + # We're roughly following Amanatides & Woo + # Find the first place the ray hits the grid on its path + # Do left edge then right edge in each dim + cdef int i, x, y + cdef np.float64_t tl, tr, intersect_t, enter_t, exit_t, dt_tolerance + cdef np.ndarray[np.int64_t, ndim=1] step = np.empty((3,), dtype=np.int64) + cdef np.ndarray[np.int64_t, ndim=1] cur_ind = np.empty((3,), dtype=np.int64) + cdef np.ndarray[np.float64_t, ndim=1] tdelta = np.empty((3,), dtype=np.float64) + cdef np.ndarray[np.float64_t, ndim=1] tmax = np.empty((3,), dtype=np.float64) + cdef np.ndarray[np.float64_t, ndim=1] intersect = np.empty((3,), dtype=np.float64) + intersect_t = 1 + dt_tolerance = 1e-6 + # recall p = v * t + u + # where p is position, v is our vector, u is the start point + for i in range(3): + # As long as we're iterating, set some other stuff, too + if(v[i] < 0): step[i] = -1 + else: step[i] = 1 + x = (i+1)%3 + y = (i+2)%3 + tl = (left_edge[i] - u[i])/v[i] + tr = (right_edge[i] - u[i])/v[i] + if (left_edge[x] <= (u[x] + tl*v[x]) <= right_edge[x]) and \ + (left_edge[y] <= (u[y] + tl*v[y]) <= right_edge[y]) and \ + (0.0 <= tl < intersect_t): + intersect_t = tl + if (left_edge[x] <= (u[x] + tr*v[x]) <= right_edge[x]) and \ + (left_edge[y] <= (u[y] + tr*v[y]) <= right_edge[y]) and \ + (0.0 <= tr < intersect_t): + intersect_t = tr + # if fully enclosed + if (left_edge[0] <= u[0] <= right_edge[0]) and \ + (left_edge[1] <= u[1] <= right_edge[1]) and \ + (left_edge[2] <= u[2] <= right_edge[2]): + intersect_t = 0.0 + if not (0 <= intersect_t <= 1): return + # Now get the indices of the intersection + intersect = u + intersect_t * v + for i in range(3): + cur_ind[i] = np.floor((intersect[i] + 1e-8*dx[i] - left_edge[i])/dx[i]) + tmax[i] = (((cur_ind[i]+step[i])*dx[i])+left_edge[i]-u[i])/v[i] + if cur_ind[i] == grid_mask.shape[i] and step[i] < 0: + cur_ind[i] = grid_mask.shape[i] - 1 + if step[i] > 0: tmax[i] = (((cur_ind[i]+1)*dx[i])+left_edge[i]-u[i])/v[i] + if step[i] < 0: tmax[i] = (((cur_ind[i]+0)*dx[i])+left_edge[i]-u[i])/v[i] + tdelta[i] = (dx[i]/v[i]) + if tdelta[i] < 0: tdelta[i] *= -1 + # The variable intersect contains the point we first pierce the grid + enter_t = intersect_t + while 1: + if (not (0 <= cur_ind[0] < grid_mask.shape[0])) or \ + (not (0 <= cur_ind[1] < grid_mask.shape[1])) or \ + (not (0 <= cur_ind[2] < grid_mask.shape[2])): + break + # Note that we are calculating t on the fly, but we get *negative* t + # values from what they should be. + # If we've reached t = 1, we are done. + grid_mask[cur_ind[0], cur_ind[1], cur_ind[2]] = 1 + if (tmax[0] > 1.0) and (tmax[1] > 1.0) and (tmax[2] > 1.0): + grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = 1.0 - enter_t + break + if tmax[0] < tmax[1]: + if tmax[0] < tmax[2]: + grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t + grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[0] - enter_t + enter_t = tmax[0] + tmax[0] += tdelta[0] + cur_ind[0] += step[0] + else: + grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t + grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[2] - enter_t + enter_t = tmax[2] + tmax[2] += tdelta[2] + cur_ind[2] += step[2] + else: + if tmax[1] < tmax[2]: + grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t + grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[1] - enter_t + enter_t = tmax[1] + tmax[1] += tdelta[1] + cur_ind[1] += step[1] + else: + grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t + grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[2] - enter_t + enter_t = tmax[2] + tmax[2] += tdelta[2] + cur_ind[2] += step[2] + return + +@cython.wraparound(False) +@cython.boundscheck(False) +def PlaneVoxelIntegration(np.ndarray[np.float64_t, ndim=1] left_edge, + np.ndarray[np.float64_t, ndim=1] right_edge, + np.ndarray[np.float64_t, ndim=1] dx, + np.ndarray[np.float64_t, ndim=2] ug, + np.ndarray[np.float64_t, ndim=1] v, + np.ndarray[np.float64_t, ndim=2] image, + np.ndarray[np.float64_t, ndim=3] data, + np.ndarray[np.float64_t, ndim=2] shells): + # We're roughly following Amanatides & Woo on a ray-by-ray basis + # Note that for now it's just shells, but this can and should be + # generalized to transfer functions + cdef int i, x, y, vi + intersect_t = 1 + dt_tolerance = 1e-6 + cdef int nv = ug.shape[0] + cdef int nshells = shells.shape[0] + cdef np.ndarray[np.float64_t, ndim=1] u = np.empty((3,), dtype=np.float64) + # Copy things into temporary location for passing between functions + for vi in range(nv): + for i in range(3): u[i] = ug[vi, i] + integrate_ray(u, v, left_edge, right_edge, dx, + nshells, vi, data, shells, image) + +@cython.wraparound(False) +@cython.boundscheck(False) +def integrate_ray(np.ndarray[np.float64_t, ndim=1] u, + np.ndarray[np.float64_t, ndim=1] v, + np.ndarray[np.float64_t, ndim=1] left_edge, + np.ndarray[np.float64_t, ndim=1] right_edge, + np.ndarray[np.float64_t, ndim=1] dx, + int nshells, int ind, + np.ndarray[np.float64_t, ndim=3] data, + np.ndarray[np.float64_t, ndim=2] shells, + np.ndarray[np.float64_t, ndim=2] image): + cdef int step[3], x, y, i, n + cdef np.float64_t intersect_t = 1 + cdef np.float64_t dt_tolerance = 1e-6 + cdef np.float64_t tl, tr, enter_t, exit_t + cdef np.int64_t cur_ind[3] + cdef np.float64_t tdelta[3] + cdef np.float64_t tmax[3] + cdef np.float64_t intersect[3] + cdef np.float64_t dt, dv + cdef np.float64_t dist, alpha + cdef np.float64_t one = 1.0 + cdef int dims[3] + cdef np.float64_t rgba[4], temp_x, temp_y + for i in range(3): + # As long as we're iterating, set some other stuff, too + dims[i] = data.shape[i] + if(v[i] < 0): step[i] = -1 + else: step[i] = 1 + x = (i+1)%3 + y = (i+2)%3 + tl = (left_edge[i] - u[i])/v[i] + tr = (right_edge[i] - u[i])/v[i] + temp_x = (u[x] + tl*v[x]) + temp_y = (u[y] + tl*v[y]) + if (left_edge[x] <= temp_x) and (temp_x <= right_edge[x]) and \ + (left_edge[y] <= temp_y) and (temp_y <= right_edge[y]) and \ + (0.0 <= tl) and (tl < intersect_t): + intersect_t = tl + temp_x = (u[x] + tr*v[x]) + temp_y = (u[y] + tr*v[y]) + if (left_edge[x] <= temp_x) and (temp_x <= right_edge[x]) and \ + (left_edge[y] <= temp_y) and (temp_y <= right_edge[y]) and \ + (0.0 <= tr) and (tr < intersect_t): + intersect_t = tr + # if fully enclosed + if (left_edge[0] <= u[0] <= right_edge[0]) and \ + (left_edge[1] <= u[1] <= right_edge[1]) and \ + (left_edge[2] <= u[2] <= right_edge[2]): + intersect_t = 0.0 + if not (0 <= intersect_t <= 1): + #print "Returning: intersect_t ==", intersect_t + return + # Now get the indices of the intersection + for i in range(3): intersect[i] = u[i] + intersect_t * v[i] + cdef int ncells = 0 + for i in range(3): + cur_ind[i] = np.floor((intersect[i] + 1e-8*dx[i] - left_edge[i])/dx[i]) + tmax[i] = (((cur_ind[i]+step[i])*dx[i])+left_edge[i]-u[i])/v[i] + if cur_ind[i] == dims[i] and step[i] < 0: + cur_ind[i] = dims[i] - 1 + if step[i] > 0: tmax[i] = (((cur_ind[i]+1)*dx[i])+left_edge[i]-u[i])/v[i] + if step[i] < 0: tmax[i] = (((cur_ind[i]+0)*dx[i])+left_edge[i]-u[i])/v[i] + tdelta[i] = (dx[i]/v[i]) + if tdelta[i] < 0: tdelta[i] *= -1 + # The variable intersect contains the point we first pierce the grid + enter_t = intersect_t + if (not (0 <= cur_ind[0] < dims[0])) or \ + (not (0 <= cur_ind[1] < dims[1])) or \ + (not (0 <= cur_ind[2] < dims[2])): + #print "Returning: cur_ind", cur_ind[0], cur_ind[1], cur_ind[2] + #print " dims: ", dims[0], dims[1], dims[2] + #print " intersect:", intersect[0], intersect[1], intersect[2] + #print " intersect:", intersect_t + #print " u :", u[0], u[1], u[2] + # + return + #print cur_ind[0], dims[0], cur_ind[1], dims[1], cur_ind[2], dims[2] + dv = data[cur_ind[0], cur_ind[1], cur_ind[2]] + #dt = 1e300 + while 1: + if image[ind,3] >= 1.0: break + if (not (0 <= cur_ind[0] < dims[0])) or \ + (not (0 <= cur_ind[1] < dims[1])) or \ + (not (0 <= cur_ind[2] < dims[2])): + break + # Do our transfer here + for n in range(nshells): + dist = shells[n, 0] - dv + if dist < shells[n,1]: + dist = exp(-dist/8.0) + alpha = (1.0 - shells[n,5])*shells[n,5]#*dt + image[ind,0] += alpha*shells[n,2]*dist + image[ind,1] += alpha*shells[n,3]*dist + image[ind,2] += alpha*shells[n,4]*dist + image[ind,3] += alpha*shells[n,5]*dist + #image[ind,i] += rgba[i]*dist*rgba[3]/dt + #print rgba[i], image[ind,i], dist, dt + break + if (tmax[0] > 1.0) and (tmax[1] > 1.0) and (tmax[2] > 1.0): + dt = 1.0 - enter_t + break + if tmax[0] < tmax[1]: + if tmax[0] < tmax[2]: + dt = tmax[0] - enter_t + enter_t = tmax[0] + tmax[0] += tdelta[0] + cur_ind[0] += step[0] + else: + dt = tmax[2] - enter_t + enter_t = tmax[2] + tmax[2] += tdelta[2] + cur_ind[2] += step[2] + else: + if tmax[1] < tmax[2]: + dt = tmax[1] - enter_t + enter_t = tmax[1] + tmax[1] += tdelta[1] + cur_ind[1] += step[1] + else: + dt = tmax[2] - enter_t + enter_t = tmax[2] + tmax[2] += tdelta[2] + cur_ind[2] += step[2] + dv = data[cur_ind[0], cur_ind[1], cur_ind[2]] diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/utilities/_amr_utils/VolumeIntegrator.pyx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yt/utilities/_amr_utils/VolumeIntegrator.pyx Thu Aug 26 10:24:41 2010 -0600 @@ -0,0 +1,656 @@ +""" +Simple integrators for the radiative transfer equation + +Author: Matthew Turk +Affiliation: KIPAC/SLAC/Stanford +Homepage: http://yt.enzotools.org/ +License: + Copyright (C) 2009 Matthew Turk. All Rights Reserved. + + This file is part of yt. + + yt is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +import numpy as np +cimport numpy as np +cimport cython +from stdlib cimport malloc, free, abs + +cdef inline int imax(int i0, int i1): + if i0 > i1: return i0 + return i1 + +cdef inline np.float64_t fmax(np.float64_t f0, np.float64_t f1): + if f0 > f1: return f0 + return f1 + +cdef inline int imin(int i0, int i1): + if i0 < i1: return i0 + return i1 + +cdef inline np.float64_t fmin(np.float64_t f0, np.float64_t f1): + if f0 < f1: return f0 + return f1 + +cdef inline int iclip(int i, int a, int b): + if i < a: return a + if i > b: return b + return i + +cdef inline np.float64_t fclip(np.float64_t f, + np.float64_t a, np.float64_t b): + return fmin(fmax(f, a), b) + +cdef extern from "math.h": + double exp(double x) + float expf(float x) + double floor(double x) + double ceil(double x) + double fmod(double x, double y) + double log2(double x) + long int lrint(double x) + +cdef extern from "FixedInterpolator.h": + np.float64_t fast_interpolate(int ds[3], int ci[3], np.float64_t dp[3], + np.float64_t *data) + np.float64_t offset_interpolate(int ds[3], np.float64_t dp[3], np.float64_t *data) + np.float64_t trilinear_interpolate(int ds[3], int ci[3], np.float64_t dp[3], + np.float64_t *data) + np.float64_t eval_gradient(int *ds, int *ci, np.float64_t *dp, + np.float64_t *data, np.float64_t *grad) + +cdef class VectorPlane + +cdef struct FieldInterpolationTable: + # Note that we make an assumption about retaining a reference to values + # externally. + np.float64_t *values + np.float64_t bounds[2] + np.float64_t dbin + np.float64_t idbin + int field_id + int weight_field_id + int weight_table_id + int nbins + int pass_through + +cdef void FIT_initialize_table(FieldInterpolationTable *fit, int nbins, + np.float64_t *values, np.float64_t bounds1, np.float64_t bounds2, + int field_id, int weight_field_id = -1, int weight_table_id = -1, + int pass_through = 0): + fit.bounds[0] = bounds1; fit.bounds[1] = bounds2 + fit.nbins = nbins + fit.dbin = (fit.bounds[1] - fit.bounds[0])/fit.nbins + fit.idbin = 1.0/fit.dbin + # Better not pull this out from under us, yo + fit.values = values + fit.field_id = field_id + fit.weight_field_id = weight_field_id + fit.weight_table_id = weight_table_id + fit.pass_through = pass_through + +cdef np.float64_t FIT_get_value(FieldInterpolationTable *fit, + np.float64_t *dvs): + cdef np.float64_t bv, dy, dd, tf + cdef int bin_id + if fit.pass_through == 1: return dvs[fit.field_id] + if dvs[fit.field_id] > fit.bounds[1] or dvs[fit.field_id] < fit.bounds[0]: return 0.0 + bin_id = ((dvs[fit.field_id] - fit.bounds[0]) * fit.idbin) + dd = dvs[fit.field_id] - (fit.bounds[0] + bin_id * fit.dbin) # x - x0 + bv = fit.values[bin_id] + dy = fit.values[bin_id + 1] - bv + if fit.weight_field_id != -1: + return dvs[fit.weight_field_id] * (bv + dd*dy*fit.idbin) + return (bv + dd*dy*fit.idbin) + +cdef class TransferFunctionProxy: + cdef int n_fields + cdef int n_field_tables + cdef public int ns + + # These are the field tables and their affiliated storage. + # We have one field_id for every table. Note that a single field can + # correspond to multiple tables, and each field table will only have + # interpolate called once. + cdef FieldInterpolationTable field_tables[6] + cdef np.float64_t istorage[6] + + # Here are the field tables that correspond to each of the six channels. + # We have three emission channels, three absorption channels. + cdef int field_table_ids[6] + + # We store a reference to the transfer function object and to the field + # interpolation tables + cdef public object tf_obj + cdef public object my_field_tables + + def __cinit__(self, tf_obj): + # We have N fields. We have 6 channels. We have M field tables. + # The idea is that we can have multiple channels corresponding to the + # same field table. So, we create storage for the outputs from all the + # field tables. We need to know which field value to pass in to the + # field table, and we need to know which table to use for each of the + # six channels. + cdef int i + cdef np.ndarray[np.float64_t, ndim=1] temp + cdef FieldInterpolationTable fit + + self.tf_obj = tf_obj + + self.n_field_tables = tf_obj.n_field_tables + for i in range(6): self.istorage[i] = 0.0 + + self.my_field_tables = [] + for i in range(self.n_field_tables): + temp = tf_obj.tables[i].y + FIT_initialize_table(&self.field_tables[i], + temp.shape[0], + temp.data, + tf_obj.tables[i].x_bounds[0], + tf_obj.tables[i].x_bounds[1], + tf_obj.field_ids[i], tf_obj.weight_field_ids[i], + tf_obj.weight_table_ids[i], + tf_obj.tables[i].pass_through) + self.my_field_tables.append((tf_obj.tables[i], + tf_obj.tables[i].y)) + self.field_tables[i].field_id = tf_obj.field_ids[i] + self.field_tables[i].weight_field_id = tf_obj.weight_field_ids[i] + print "Field table", i, "corresponds to", + print self.field_tables[i].field_id, + print "(Weighted with ", self.field_tables[i].weight_field_id, + print ")" + + for i in range(6): + self.field_table_ids[i] = tf_obj.field_table_ids[i] + print "Channel", i, "corresponds to", self.field_table_ids[i] + + @cython.boundscheck(False) + @cython.wraparound(False) + cdef void eval_transfer(self, np.float64_t dt, np.float64_t *dvs, + np.float64_t *rgba, np.float64_t *grad): + cdef int i, fid, use + cdef np.float64_t ta, tf, trgba[6], dot_prod + # NOTE: We now disable this. I have left it to ease the process of + # potentially, one day, re-including it. + #use = 0 + #for i in range(self.n_field_tables): + # fid = self.field_tables[i].field_id + # if (dvs[fid] >= self.field_tables[i].bounds[0]) and \ + # (dvs[fid] <= self.field_tables[i].bounds[1]): + # use = 1 + # break + for i in range(self.n_field_tables): + self.istorage[i] = FIT_get_value(&self.field_tables[i], dvs) + # We have to do this after the interpolation + for i in range(self.n_field_tables): + fid = self.field_tables[i].weight_table_id + if fid != -1: self.istorage[i] *= self.istorage[fid] + for i in range(6): + trgba[i] = self.istorage[self.field_table_ids[i]] + #print i, trgba[i], + #print + # A few words on opacity. We're going to be integrating equation 1.23 + # from Rybicki & Lightman. dI_\nu / ds = -\alpha_\nu I_\nu + j_\nu + # \alpha_nu = \kappa \rho , but we leave that up to the input + # transfer function. + # SOoooooOOOooo, the upshot is that we are doing a rectangular + # integration here: + # I_{i+1} = ds * C_i + (1.0 - ds*alpha_i) * I_i + for i in range(3): + # This is the new way: alpha corresponds to opacity of a given + # slice. Previously it was ill-defined, but represented some + # measure of emissivity. + ta = fmax((1.0 - dt*trgba[i+3]), 0.0) + rgba[i ] = dt*trgba[i ] + ta * rgba[i ] + #rgba[i+3] = dt*trgba[i+3] + ta * rgba[i+3] + # This is the old way: + #rgba[i ] += trgba[i] * (1.0 - rgba[i+3])*dt*trgba[i+3] + #rgba[i+3] += trgba[i] * (1.0 - rgba[i+3])*dt*trgba[i+3] + +cdef class VectorPlane: + cdef public object avp_pos, avp_dir, acenter, aimage + cdef np.float64_t *vp_pos, *vp_dir, *center, *image, + cdef np.float64_t pdx, pdy, bounds[4] + cdef int nv[2] + cdef int vp_strides[3] + cdef int im_strides[3] + cdef int vd_strides[3] + cdef public object ax_vec, ay_vec + cdef np.float64_t *x_vec, *y_vec + + def __cinit__(self, + np.ndarray[np.float64_t, ndim=3] vp_pos, + np.ndarray vp_dir, + np.ndarray[np.float64_t, ndim=1] center, + bounds, + np.ndarray[np.float64_t, ndim=3] image, + np.ndarray[np.float64_t, ndim=1] x_vec, + np.ndarray[np.float64_t, ndim=1] y_vec): + cdef int i, j + self.avp_pos = vp_pos + self.avp_dir = vp_dir + self.acenter = center + self.aimage = image + self.ax_vec = x_vec + self.ay_vec = y_vec + self.vp_pos = vp_pos.data + self.vp_dir = vp_dir.data + self.center = center.data + self.image = image.data + self.x_vec = x_vec.data + self.y_vec = y_vec.data + self.nv[0] = vp_pos.shape[0] + self.nv[1] = vp_pos.shape[1] + for i in range(4): self.bounds[i] = bounds[i] + self.pdx = (self.bounds[1] - self.bounds[0])/self.nv[0] + self.pdy = (self.bounds[3] - self.bounds[2])/self.nv[1] + for i in range(3): + self.vp_strides[i] = vp_pos.strides[i] / 8 + self.im_strides[i] = image.strides[i] / 8 + if vp_dir.ndim > 1: + for i in range(3): + self.vd_strides[i] = vp_dir.strides[i] / 8 + else: + self.vd_strides[0] = self.vd_strides[1] = self.vd_strides[2] = -1 + + @cython.boundscheck(False) + @cython.wraparound(False) + cdef void get_start_stop(self, np.float64_t *ex, int *rv): + # Extrema need to be re-centered + cdef np.float64_t cx, cy + cdef int i + cx = cy = 0.0 + for i in range(3): + cx += self.center[i] * self.x_vec[i] + cy += self.center[i] * self.y_vec[i] + rv[0] = lrint((ex[0] - cx - self.bounds[0])/self.pdx) + rv[1] = rv[0] + lrint((ex[1] - ex[0])/self.pdx) + rv[2] = lrint((ex[2] - cy - self.bounds[2])/self.pdy) + rv[3] = rv[2] + lrint((ex[3] - ex[2])/self.pdy) + + cdef inline void copy_into(self, np.float64_t *fv, np.float64_t *tv, + int i, int j, int nk, int strides[3]): + # We know the first two dimensions of our from-vector, and our + # to-vector is flat and 'ni' long + cdef int k + cdef int offset = strides[0] * i + strides[1] * j + for k in range(nk): + tv[k] = fv[offset + k] + + cdef inline void copy_back(self, np.float64_t *fv, np.float64_t *tv, + int i, int j, int nk, int strides[3]): + cdef int k + cdef int offset = strides[0] * i + strides[1] * j + for k in range(nk): + tv[offset + k] = fv[k] + +cdef class PartitionedGrid: + cdef public object my_data + cdef public object LeftEdge + cdef public object RightEdge + cdef np.float64_t *data[6] + cdef np.float64_t dvs[6] + cdef np.float64_t left_edge[3] + cdef np.float64_t right_edge[3] + cdef np.float64_t dds[3] + cdef np.float64_t idds[3] + cdef int dims[3] + cdef public int parent_grid_id + cdef public int n_fields + + @cython.boundscheck(False) + @cython.wraparound(False) + def __cinit__(self, + int parent_grid_id, int n_fields, data, + np.ndarray[np.float64_t, ndim=1] left_edge, + np.ndarray[np.float64_t, ndim=1] right_edge, + np.ndarray[np.int64_t, ndim=1] dims): + # The data is likely brought in via a slice, so we copy it + cdef int i, j, k, size + cdef np.ndarray[np.float64_t, ndim=3] tdata + self.parent_grid_id = parent_grid_id + self.LeftEdge = left_edge + self.RightEdge = right_edge + for i in range(3): + self.left_edge[i] = left_edge[i] + self.right_edge[i] = right_edge[i] + self.dims[i] = dims[i] + self.dds[i] = (self.right_edge[i] - self.left_edge[i])/dims[i] + self.idds[i] = 1.0/self.dds[i] + self.my_data = data + self.n_fields = n_fields + for i in range(n_fields): + tdata = data[i] + self.data[i] = tdata.data + + @cython.boundscheck(False) + @cython.wraparound(False) + def cast_plane(self, TransferFunctionProxy tf, VectorPlane vp): + # This routine will iterate over all of the vectors and cast each in + # turn. Might benefit from a more sophisticated intersection check, + # like http://courses.csusm.edu/cs697exz/ray_box.htm + cdef int vi, vj, hit, i, ni, nj, nn + cdef int iter[4] + cdef np.float64_t v_pos[3], v_dir[3], rgba[6], extrema[4] + hit = 0 + self.calculate_extent(vp, extrema) + vp.get_start_stop(extrema, iter) + iter[0] = iclip(iter[0], 0, vp.nv[0]) + iter[1] = iclip(iter[1], 0, vp.nv[0]) + iter[2] = iclip(iter[2], 0, vp.nv[1]) + iter[3] = iclip(iter[3], 0, vp.nv[1]) + if vp.vd_strides[0] == -1: + for vi in range(iter[0], iter[1]): + for vj in range(iter[2], iter[3]): + vp.copy_into(vp.vp_pos, v_pos, vi, vj, 3, vp.vp_strides) + vp.copy_into(vp.image, rgba, vi, vj, 3, vp.im_strides) + self.integrate_ray(v_pos, vp.vp_dir, rgba, tf) + vp.copy_back(rgba, vp.image, vi, vj, 3, vp.im_strides) + else: + # If we do not have an orthographic projection, we have to cast all + # our rays (until we can get an extrema calculation...) + for vi in range(vp.nv[0]): + for vj in range(vp.nv[1]): + vp.copy_into(vp.vp_pos, v_pos, vi, vj, 3, vp.vp_strides) + vp.copy_into(vp.image, rgba, vi, vj, 3, vp.im_strides) + vp.copy_into(vp.vp_dir, v_dir, vi, vj, 3, vp.vd_strides) + self.integrate_ray(v_pos, v_dir, rgba, tf) + vp.copy_back(rgba, vp.image, vi, vj, 3, vp.im_strides) + return hit + + @cython.boundscheck(False) + @cython.wraparound(False) + cdef void calculate_extent(self, VectorPlane vp, + np.float64_t extrema[4]): + # We do this for all eight corners + cdef np.float64_t *edges[2], temp + edges[0] = self.left_edge + edges[1] = self.right_edge + extrema[0] = extrema[2] = 1e300; extrema[1] = extrema[3] = -1e300 + cdef int i, j, k + for i in range(2): + for j in range(2): + for k in range(2): + # This should rotate it into the vector plane + temp = edges[i][0] * vp.x_vec[0] + temp += edges[j][1] * vp.x_vec[1] + temp += edges[k][2] * vp.x_vec[2] + if temp < extrema[0]: extrema[0] = temp + if temp > extrema[1]: extrema[1] = temp + temp = edges[i][0] * vp.y_vec[0] + temp += edges[j][1] * vp.y_vec[1] + temp += edges[k][2] * vp.y_vec[2] + if temp < extrema[2]: extrema[2] = temp + if temp > extrema[3]: extrema[3] = temp + #print extrema[0], extrema[1], extrema[2], extrema[3] + + @cython.boundscheck(False) + @cython.wraparound(False) + cdef int integrate_ray(self, np.float64_t v_pos[3], + np.float64_t v_dir[3], + np.float64_t rgba[4], + TransferFunctionProxy tf): + cdef int cur_ind[3], step[3], x, y, i, n, flat_ind, hit, direction + cdef np.float64_t intersect_t = 1.0 + cdef np.float64_t iv_dir[3] + cdef np.float64_t intersect[3], tmax[3], tdelta[3] + cdef np.float64_t enter_t, dist, alpha, dt, exit_t + cdef np.float64_t tr, tl, temp_x, temp_y, dv + for i in range(3): + if (v_dir[i] < 0): + step[i] = -1 + elif (v_dir[i] == 0): + step[i] = 1 + tmax[i] = 1e60 + iv_dir[i] = 1e60 + tdelta[i] = 1e-60 + continue + else: + step[i] = 1 + x = (i+1) % 3 + y = (i+2) % 3 + iv_dir[i] = 1.0/v_dir[i] + tl = (self.left_edge[i] - v_pos[i])*iv_dir[i] + temp_x = (v_pos[x] + tl*v_dir[x]) + temp_y = (v_pos[y] + tl*v_dir[y]) + if self.left_edge[x] <= temp_x and temp_x <= self.right_edge[x] and \ + self.left_edge[y] <= temp_y and temp_y <= self.right_edge[y] and \ + 0.0 <= tl and tl < intersect_t: + direction = i + intersect_t = tl + tr = (self.right_edge[i] - v_pos[i])*iv_dir[i] + temp_x = (v_pos[x] + tr*v_dir[x]) + temp_y = (v_pos[y] + tr*v_dir[y]) + if self.left_edge[x] <= temp_x and temp_x <= self.right_edge[x] and \ + self.left_edge[y] <= temp_y and temp_y <= self.right_edge[y] and \ + 0.0 <= tr and tr < intersect_t: + direction = i + intersect_t = tr + if self.left_edge[0] <= v_pos[0] and v_pos[0] <= self.right_edge[0] and \ + self.left_edge[1] <= v_pos[1] and v_pos[1] <= self.right_edge[1] and \ + self.left_edge[2] <= v_pos[2] and v_pos[2] <= self.right_edge[2]: + intersect_t = 0.0 + if not ((0.0 <= intersect_t) and (intersect_t < 1.0)): return 0 + for i in range(3): + intersect[i] = v_pos[i] + intersect_t * v_dir[i] + cur_ind[i] = floor((intersect[i] + + step[i]*1e-8*self.dds[i] - + self.left_edge[i])*self.idds[i]) + tmax[i] = (((cur_ind[i]+step[i])*self.dds[i])+ + self.left_edge[i]-v_pos[i])*iv_dir[i] + # This deals with the asymmetry in having our indices refer to the + # left edge of a cell, but the right edge of the brick being one + # extra zone out. + if cur_ind[i] == self.dims[i] and step[i] < 0: + cur_ind[i] = self.dims[i] - 1 + if cur_ind[i] < 0 or cur_ind[i] >= self.dims[i]: return 0 + if step[i] > 0: + tmax[i] = (((cur_ind[i]+1)*self.dds[i]) + +self.left_edge[i]-v_pos[i])*iv_dir[i] + if step[i] < 0: + tmax[i] = (((cur_ind[i]+0)*self.dds[i]) + +self.left_edge[i]-v_pos[i])*iv_dir[i] + tdelta[i] = (self.dds[i]*iv_dir[i]) + if tdelta[i] < 0: tdelta[i] *= -1 + # We have to jumpstart our calculation + enter_t = intersect_t + while 1: + # dims here is one less than the dimensions of the data, + # but we are tracing on the grid, not on the data... + if (not (0 <= cur_ind[0] < self.dims[0])) or \ + (not (0 <= cur_ind[1] < self.dims[1])) or \ + (not (0 <= cur_ind[2] < self.dims[2])): + break + hit += 1 + if tmax[0] < tmax[1]: + if tmax[0] < tmax[2]: + exit_t = fmin(tmax[0], 1.0) + self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, + rgba, tf) + cur_ind[0] += step[0] + enter_t = tmax[0] + tmax[0] += tdelta[0] + else: + exit_t = fmin(tmax[2], 1.0) + self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, + rgba, tf) + cur_ind[2] += step[2] + enter_t = tmax[2] + tmax[2] += tdelta[2] + else: + if tmax[1] < tmax[2]: + exit_t = fmin(tmax[1], 1.0) + self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, + rgba, tf) + cur_ind[1] += step[1] + enter_t = tmax[1] + tmax[1] += tdelta[1] + else: + exit_t = fmin(tmax[2], 1.0) + self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, + rgba, tf) + cur_ind[2] += step[2] + enter_t = tmax[2] + tmax[2] += tdelta[2] + if enter_t > 1.0: break + return hit + + @cython.boundscheck(False) + @cython.wraparound(False) + cdef void sample_values(self, + np.float64_t v_pos[3], + np.float64_t v_dir[3], + np.float64_t enter_t, + np.float64_t exit_t, + int ci[3], + np.float64_t *rgba, + TransferFunctionProxy tf): + cdef np.float64_t cp[3], dp[3], temp, dt, t, dv + cdef np.float64_t grad[3], ds[3] + grad[0] = grad[1] = grad[2] = 0.0 + cdef int dti, i + dt = (exit_t - enter_t) / tf.ns # 4 samples should be dt=0.25 + cdef int offset = ci[0] * (self.dims[1] + 1) * (self.dims[2] + 1) \ + + ci[1] * (self.dims[2] + 1) + ci[2] + for i in range(3): + # temp is the left edge of the current cell + temp = ci[i] * self.dds[i] + self.left_edge[i] + # this gets us dp as the current first sample position + dp[i] = (enter_t + 0.5 * dt) * v_dir[i] + v_pos[i] - temp + dp[i] *= self.idds[i] + ds[i] = v_dir[i] * self.idds[i] * dt + for dti in range(tf.ns): + for i in range(self.n_fields): + self.dvs[i] = offset_interpolate(self.dims, dp, self.data[i] + offset) + #if (dv < tf.x_bounds[0]) or (dv > tf.x_bounds[1]): + # continue + for i in range(3): + dp[i] += ds[i] + tf.eval_transfer(dt, self.dvs, rgba, grad) + +cdef class GridFace: + cdef int direction + cdef public np.float64_t coord + cdef np.float64_t left_edge[3] + cdef np.float64_t right_edge[3] + + @cython.boundscheck(False) + @cython.wraparound(False) + def __init__(self, grid, int direction, int left): + self.direction = direction + if left == 1: + self.coord = grid.LeftEdge[direction] + else: + self.coord = grid.RightEdge[direction] + cdef int i + for i in range(3): + self.left_edge[i] = grid.LeftEdge[i] + self.right_edge[i] = grid.RightEdge[i] + self.left_edge[direction] = self.right_edge[direction] = self.coord + + @cython.boundscheck(False) + @cython.wraparound(False) + cdef int proj_overlap(self, np.float64_t *left_edge, np.float64_t *right_edge): + cdef int xax, yax + xax = (self.direction + 1) % 3 + yax = (self.direction + 2) % 3 + if left_edge[xax] >= self.right_edge[xax]: return 0 + if right_edge[xax] <= self.left_edge[xax]: return 0 + if left_edge[yax] >= self.right_edge[yax]: return 0 + if right_edge[yax] <= self.left_edge[yax]: return 0 + return 1 + +cdef class ProtoPrism: + cdef np.float64_t left_edge[3] + cdef np.float64_t right_edge[3] + cdef public object LeftEdge + cdef public object RightEdge + cdef public object subgrid_faces + cdef public int parent_grid_id + def __cinit__(self, int parent_grid_id, + np.ndarray[np.float64_t, ndim=1] left_edge, + np.ndarray[np.float64_t, ndim=1] right_edge, + subgrid_faces): + self.parent_grid_id = parent_grid_id + cdef int i + self.LeftEdge = left_edge + self.RightEdge = right_edge + for i in range(3): + self.left_edge[i] = left_edge[i] + self.right_edge[i] = right_edge[i] + self.subgrid_faces = subgrid_faces + + @cython.boundscheck(False) + @cython.wraparound(False) + def sweep(self, int direction = 0, int stack = 0): + cdef int i + cdef GridFace face + cdef np.float64_t proto_split[3] + for i in range(3): proto_split[i] = self.right_edge[i] + for face in self.subgrid_faces[direction]: + proto_split[direction] = face.coord + if proto_split[direction] <= self.left_edge[direction]: + continue + if proto_split[direction] == self.right_edge[direction]: + if stack == 2: return [self] + return self.sweep((direction + 1) % 3, stack + 1) + if face.proj_overlap(self.left_edge, proto_split) == 1: + left, right = self.split(proto_split, direction) + LC = left.sweep((direction + 1) % 3) + RC = right.sweep(direction) + return LC + RC + raise RuntimeError + + @cython.boundscheck(False) + @cython.wraparound(False) + cdef object split(self, np.float64_t *sp, int direction): + cdef int i + cdef np.ndarray split_left = self.LeftEdge.copy() + cdef np.ndarray split_right = self.RightEdge.copy() + + for i in range(3): split_left[i] = self.right_edge[i] + split_left[direction] = sp[direction] + left = ProtoPrism(self.parent_grid_id, self.LeftEdge, split_left, + self.subgrid_faces) + + for i in range(3): split_right[i] = self.left_edge[i] + split_right[direction] = sp[direction] + right = ProtoPrism(self.parent_grid_id, split_right, self.RightEdge, + self.subgrid_faces) + + return (left, right) + + @cython.boundscheck(False) + @cython.wraparound(False) + def get_brick(self, np.ndarray[np.float64_t, ndim=1] grid_left_edge, + np.ndarray[np.float64_t, ndim=1] grid_dds, + child_mask): + # We get passed in the left edge, the dds (which gives dimensions) and + # the data, which is already vertex-centered. + cdef PartitionedGrid PG + cdef int li[3], ri[3], idims[3], i + for i in range(3): + li[i] = lrint((self.left_edge[i] - grid_left_edge[i])/grid_dds[i]) + ri[i] = lrint((self.right_edge[i] - grid_left_edge[i])/grid_dds[i]) + idims[i] = ri[i] - li[i] + if child_mask[li[0], li[1], li[2]] == 0: return [] + cdef np.ndarray[np.int64_t, ndim=1] dims = np.empty(3, dtype='int64') + for i in range(3): + dims[i] = idims[i] + #cdef np.ndarray[np.float64_t, ndim=3] new_data + #new_data = data[li[0]:ri[0]+1,li[1]:ri[1]+1,li[2]:ri[2]+1].copy() + #PG = PartitionedGrid(self.parent_grid_id, new_data, + # self.LeftEdge, self.RightEdge, dims) + return ((li[0], ri[0]), (li[1], ri[1]), (li[2], ri[2]), dims) diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/utilities/_amr_utils/fortran_reader.pyx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yt/utilities/_amr_utils/fortran_reader.pyx Thu Aug 26 10:24:41 2010 -0600 @@ -0,0 +1,70 @@ +""" +Simple readers for fortran unformatted data, specifically for the Tiger code. + +Author: Matthew Turk +Affiliation: UCSD +Homepage: http://yt.enzotools.org/ +License: + Copyright (C) 2010 Matthew Turk. All Rights Reserved. + + This file is part of yt. + + yt is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +import numpy as np +cimport numpy as np +cimport cython + +from stdio cimport fopen, fclose, FILE + +cdef extern from "stdio.h": + cdef int SEEK_SET + cdef int SEEK_CUR + cdef int SEEK_END + int fseek(FILE *stream, long offset, int whence) + size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream) + long ftell(FILE *stream) + +@cython.boundscheck(False) +@cython.wraparound(False) +def read_tiger_section( + char *fn, + np.ndarray[np.int64_t, ndim=1] slab_start, + np.ndarray[np.int64_t, ndim=1] slab_size, + np.ndarray[np.int64_t, ndim=1] root_size, + int offset = 36): + cdef int strides[3] + strides[0] = 1 + strides[1] = root_size[0] * strides[0] + strides[2] = strides[1] * root_size[1] + 2 + cdef np.int64_t i, j, k + cdef np.ndarray buffer = np.zeros(slab_size, dtype='float32', order='F') + cdef FILE *f = fopen(fn, "rb") + #for i in range(3): offset += strides[i] * slab_start[i] + cdef np.int64_t pos = 0 + cdef np.int64_t moff = 0 + cdef float *data = buffer.data + fseek(f, offset, 0) + # If anybody wants to convert this loop to a SEEK_CUR, that'd be great. + for i in range(slab_size[2]): + for j in range(slab_size[1]): + moff = (slab_start[0] ) * strides[0] \ + + (slab_start[1] + j) * strides[1] \ + + (slab_start[2] + i) * strides[2] + #print offset + 4 * moff, pos + fseek(f, offset + 4 * moff, SEEK_SET) + fread( (data + pos), 4, slab_size[0], f) + pos += slab_size[0] + return buffer diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/utilities/_amr_utils/png_writer.pyx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yt/utilities/_amr_utils/png_writer.pyx Thu Aug 26 10:24:41 2010 -0600 @@ -0,0 +1,170 @@ +""" +A light interface to libpng + +Author: Matthew Turk +Affiliation: UCSD +Homepage: http://yt.enzotools.org/ +License: + Copyright (C) 2010 Matthew Turk. All Rights Reserved. + + This file is part of yt. + + yt is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +import numpy as np +cimport numpy as np +cimport cython + +from stdio cimport fopen, fclose, FILE + +cdef extern from "stdlib.h": + # NOTE that size_t might not be int + void *alloca(int) + +cdef extern from "png.h": + ctypedef unsigned long png_uint_32 + ctypedef long png_int_32 + ctypedef unsigned short png_uint_16 + ctypedef short png_int_16 + ctypedef unsigned char png_byte + ctypedef void *png_voidp + ctypedef png_byte *png_bytep + ctypedef png_uint_32 *png_uint_32p + ctypedef png_int_32 *png_int_32p + ctypedef png_uint_16 *png_uint_16p + ctypedef png_int_16 *png_int_16p + ctypedef char *png_charp + ctypedef char *png_const_charp + ctypedef FILE *png_FILE_p + + ctypedef struct png_struct: + pass + ctypedef png_struct *png_structp + + ctypedef struct png_info: + pass + ctypedef png_info *png_infop + + ctypedef struct png_color_8: + png_byte red + png_byte green + png_byte blue + png_byte gray + png_byte alpha + ctypedef png_color_8 *png_color_8p + + cdef png_const_charp PNG_LIBPNG_VER_STRING + + # Note that we don't support error or warning functions + png_structp png_create_write_struct( + png_const_charp user_png_ver, png_voidp error_ptr, + void *error_fn, void *warn_fn) + + png_infop png_create_info_struct(png_structp png_ptr) + + void png_init_io(png_structp png_ptr, png_FILE_p fp) + + void png_set_IHDR(png_structp png_ptr, png_infop info_ptr, + png_uint_32 width, png_uint_32 height, int bit_depth, + int color_type, int interlace_method, int compression_method, + int filter_method) + + cdef int PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE + cdef int PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE + + void png_set_pHYs(png_structp png_ptr, png_infop info_ptr, + png_uint_32 res_x, png_uint_32 res_y, int unit_type) + + cdef int PNG_RESOLUTION_METER + + void png_set_sBIT(png_structp png_ptr, png_infop info_ptr, + png_color_8p sig_bit) + + void png_write_info(png_structp png_ptr, png_infop info_ptr) + void png_write_image(png_structp png_ptr, png_bytep *image) + void png_write_end(png_structp png_ptr, png_infop info_ptr) + + void png_destroy_write_struct( + png_structp *png_ptr_ptr, png_infop *info_ptr_ptr) + +def write_png(np.ndarray[np.uint8_t, ndim=3] buffer, + char *filename, int dpi=100): + + # This is something of a translation of the matplotlib _png module + cdef png_byte *pix_buffer = buffer.data + cdef int width = buffer.shape[1] + cdef int height = buffer.shape[0] + + cdef FILE* fileobj = fopen(filename, "wb") + cdef png_bytep *row_pointers + cdef png_structp png_ptr + cdef png_infop info_ptr + + cdef png_color_8 sig_bit + cdef png_uint_32 row + + row_pointers = alloca(sizeof(png_bytep) * height) + + for row in range(height): + row_pointers[row] = pix_buffer + row * width * 4 + png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL) + info_ptr = png_create_info_struct(png_ptr) + + # Um we are ignoring setjmp sorry guys + + png_init_io(png_ptr, fileobj) + + png_set_IHDR(png_ptr, info_ptr, width, height, 8, + PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE, + PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE) + + cdef size_t dots_per_meter = (dpi / (2.54 / 100.0)) + png_set_pHYs(png_ptr, info_ptr, dots_per_meter, dots_per_meter, + PNG_RESOLUTION_METER) + + sig_bit.gray = 0 + sig_bit.red = sig_bit.green = sig_bit.blue = sig_bit.alpha = 8 + + png_set_sBIT(png_ptr, info_ptr, &sig_bit) + + png_write_info(png_ptr, info_ptr) + png_write_image(png_ptr, row_pointers) + png_write_end(png_ptr, info_ptr) + + fclose(fileobj) + png_destroy_write_struct(&png_ptr, &info_ptr) + +def add_points_to_image( + np.ndarray[np.uint8_t, ndim=3] buffer, + np.ndarray[np.float64_t, ndim=1] px, + np.ndarray[np.float64_t, ndim=1] py, + np.float64_t pv): + cdef int i, j, k, pi + cdef int np = px.shape[0] + cdef int xs = buffer.shape[0] + cdef int ys = buffer.shape[1] + cdef int v + v = iclip((pv * 255), 0, 255) + for pi in range(np): + j = (xs * px[pi]) + i = (ys * py[pi]) + for k in range(3): + buffer[i, j, k] = 0 + return + for i in range(xs): + for j in range(ys): + for k in range(3): + v = buffer[i, j, k] + buffer[i, j, k] = iclip(v, 0, 255) diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/utilities/amr_utils.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yt/utilities/amr_utils.c Thu Aug 26 10:24:41 2010 -0600 @@ -0,0 +1,32107 @@ +/* Generated by Cython 0.13.beta0 on Mon Aug 2 07:18:26 2010 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else + +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif + +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif + +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif + +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif + +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#endif + +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) PyInt_AsLong(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#endif + +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#endif + +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif + +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif + +#ifndef PySet_CheckExact +# define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif + +#ifdef __cplusplus +#define __PYX_EXTERN_C extern "C" +#else +#define __PYX_EXTERN_C extern +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE_API__yt__amr_utils +#include "stdio.h" +#include "stdlib.h" +#include "numpy/arrayobject.h" +#include "numpy/ufuncobject.h" +#include "math.h" +#include "FixedInterpolator.h" +#include "png.h" + +/* inline attribute */ +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif + +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || defined(__INTEL_COMPILER) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + + +/* Type Conversion Predeclarations */ + +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) + +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) + + +#ifdef __GNUC__ +/* Test for GCC > 2.95 */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) +#define likely(x) __builtin_expect(!!(x), 1) +#define unlikely(x) __builtin_expect(!!(x), 0) +#else /* __GNUC__ > 2 ... */ +#define likely(x) (x) +#define unlikely(x) (x) +#endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ +#define likely(x) (x) +#define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +#if !defined(CYTHON_CCOMPLEX) + #if defined(__cplusplus) + #define CYTHON_CCOMPLEX 1 + #elif defined(_Complex_I) + #define CYTHON_CCOMPLEX 1 + #else + #define CYTHON_CCOMPLEX 0 + #endif +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #include + #else + #include + #endif +#endif + +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj +#endif + +static const char *__pyx_f[] = { + "DepthFirstOctree.pyx", + "PointsInVolume.pyx", + "VolumeIntegrator.pyx", + "Interpolators.pyx", + "RayIntegrators.pyx", + "CICDeposit.pyx", + "ContourFinding.pyx", + "png_writer.pyx", + "fortran_reader.pyx", + "QuadTree.pyx", + "numpy.pxd", + "amr_utils.pyx", +}; + +typedef npy_int8 __pyx_t_5numpy_int8_t; + +typedef npy_int16 __pyx_t_5numpy_int16_t; + +typedef npy_int32 __pyx_t_5numpy_int32_t; + +typedef npy_int64 __pyx_t_5numpy_int64_t; + +typedef npy_uint8 __pyx_t_5numpy_uint8_t; + +typedef npy_uint16 __pyx_t_5numpy_uint16_t; + +typedef npy_uint32 __pyx_t_5numpy_uint32_t; + +typedef npy_uint64 __pyx_t_5numpy_uint64_t; + +typedef npy_float32 __pyx_t_5numpy_float32_t; + +typedef npy_float64 __pyx_t_5numpy_float64_t; + +typedef npy_long __pyx_t_5numpy_int_t; + +typedef npy_longlong __pyx_t_5numpy_long_t; + +typedef npy_intp __pyx_t_5numpy_intp_t; + +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +typedef npy_ulong __pyx_t_5numpy_uint_t; + +typedef npy_ulonglong __pyx_t_5numpy_ulong_t; + +typedef npy_double __pyx_t_5numpy_float_t; + +typedef npy_double __pyx_t_5numpy_double_t; + +typedef npy_longdouble __pyx_t_5numpy_longdouble_t; + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< float > __pyx_t_float_complex; + #else + typedef float _Complex __pyx_t_float_complex; + #endif +#else + typedef struct { float real, imag; } __pyx_t_float_complex; +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< double > __pyx_t_double_complex; + #else + typedef double _Complex __pyx_t_double_complex; + #endif +#else + typedef struct { double real, imag; } __pyx_t_double_complex; +#endif + +/* Type declarations */ + +typedef npy_cfloat __pyx_t_5numpy_cfloat_t; + +typedef npy_cdouble __pyx_t_5numpy_cdouble_t; + +typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; + +typedef npy_cdouble __pyx_t_5numpy_complex_t; + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":76 + * cdef class VectorPlane + * + * cdef struct FieldInterpolationTable: # <<<<<<<<<<<<<< + * # Note that we make an assumption about retaining a reference to values + * # externally. + */ + +struct __pyx_t_2yt_9amr_utils_FieldInterpolationTable { + __pyx_t_5numpy_float64_t *values; + __pyx_t_5numpy_float64_t bounds[2]; + __pyx_t_5numpy_float64_t dbin; + __pyx_t_5numpy_float64_t idbin; + int field_id; + int weight_field_id; + int weight_table_id; + int nbins; + int pass_through; +}; + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":89 + * int pass_through + * + * cdef void FIT_initialize_table(FieldInterpolationTable *fit, int nbins, # <<<<<<<<<<<<<< + * np.float64_t *values, np.float64_t bounds1, np.float64_t bounds2, + * int field_id, int weight_field_id = -1, int weight_table_id = -1, + */ + +struct __pyx_opt_args_2yt_9amr_utils_FIT_initialize_table { + int __pyx_n; + int weight_field_id; + int weight_table_id; + int pass_through; +}; + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":39 + * void *alloca(int) + * + * cdef struct QuadTreeNode: # <<<<<<<<<<<<<< + * np.float64_t *val + * np.float64_t weight_val + */ + +struct __pyx_t_2yt_9amr_utils_QuadTreeNode { + __pyx_t_5numpy_float64_t *val; + __pyx_t_5numpy_float64_t weight_val; + __pyx_t_5numpy_int64_t pos[2]; + int level; + int nvals; + struct __pyx_t_2yt_9amr_utils_QuadTreeNode *children[2][2]; +}; + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":118 + * return (bv + dd*dy*fit.idbin) + * + * cdef class TransferFunctionProxy: # <<<<<<<<<<<<<< + * cdef int n_fields + * cdef int n_field_tables + */ + +struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy { + PyObject_HEAD + struct __pyx_vtabstruct_2yt_9amr_utils_TransferFunctionProxy *__pyx_vtab; + int n_fields; + int n_field_tables; + int ns; + struct __pyx_t_2yt_9amr_utils_FieldInterpolationTable field_tables[6]; + __pyx_t_5numpy_float64_t istorage[6]; + int field_table_ids[6]; + PyObject *tf_obj; + PyObject *my_field_tables; +}; + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":36 + * self.refined_pos = 0 + * + * cdef class OctreeGrid: # <<<<<<<<<<<<<< + * cdef public object child_indices, fields, left_edges, dimensions, dx + * cdef public int level + */ + +struct __pyx_obj_2yt_9amr_utils_OctreeGrid { + PyObject_HEAD + PyObject *child_indices; + PyObject *fields; + PyObject *left_edges; + PyObject *dimensions; + PyObject *dx; + int level; +}; + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":53 + * self.level = level + * + * cdef class OctreeGridList: # <<<<<<<<<<<<<< + * cdef public object grids + * def __cinit__(self, grids): + */ + +struct __pyx_obj_2yt_9amr_utils_OctreeGridList { + PyObject_HEAD + PyObject *grids; +}; + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":575 + * return 1 + * + * cdef class ProtoPrism: # <<<<<<<<<<<<<< + * cdef np.float64_t left_edge[3] + * cdef np.float64_t right_edge[3] + */ + +struct __pyx_obj_2yt_9amr_utils_ProtoPrism { + PyObject_HEAD + struct __pyx_vtabstruct_2yt_9amr_utils_ProtoPrism *__pyx_vtab; + __pyx_t_5numpy_float64_t left_edge[3]; + __pyx_t_5numpy_float64_t right_edge[3]; + PyObject *LeftEdge; + PyObject *RightEdge; + PyObject *subgrid_faces; + int parent_grid_id; +}; + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":30 + * cimport cython + * + * cdef class position: # <<<<<<<<<<<<<< + * cdef public int output_pos, refined_pos + * def __cinit__(self): + */ + +struct __pyx_obj_2yt_9amr_utils_position { + PyObject_HEAD + int output_pos; + int refined_pos; +}; + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":543 + * tf.eval_transfer(dt, self.dvs, rgba, grad) + * + * cdef class GridFace: # <<<<<<<<<<<<<< + * cdef int direction + * cdef public np.float64_t coord + */ + +struct __pyx_obj_2yt_9amr_utils_GridFace { + PyObject_HEAD + struct __pyx_vtabstruct_2yt_9amr_utils_GridFace *__pyx_vtab; + int direction; + __pyx_t_5numpy_float64_t coord; + __pyx_t_5numpy_float64_t left_edge[3]; + __pyx_t_5numpy_float64_t right_edge[3]; +}; + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":99 + * free(node) + * + * cdef class QuadTree: # <<<<<<<<<<<<<< + * cdef int nvals + * cdef np.int64_t po2[80] + */ + +struct __pyx_obj_2yt_9amr_utils_QuadTree { + PyObject_HEAD + struct __pyx_vtabstruct_2yt_9amr_utils_QuadTree *__pyx_vtab; + int nvals; + __pyx_t_5numpy_int64_t po2[80]; + struct __pyx_t_2yt_9amr_utils_QuadTreeNode ***root_nodes; + __pyx_t_5numpy_int64_t top_grid_dims[2]; +}; + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":74 + * np.float64_t *data, np.float64_t *grad) + * + * cdef class VectorPlane # <<<<<<<<<<<<<< + * + * cdef struct FieldInterpolationTable: + */ + +struct __pyx_obj_2yt_9amr_utils_VectorPlane { + PyObject_HEAD + struct __pyx_vtabstruct_2yt_9amr_utils_VectorPlane *__pyx_vtab; + PyObject *avp_pos; + PyObject *avp_dir; + PyObject *acenter; + PyObject *aimage; + __pyx_t_5numpy_float64_t *vp_pos; + __pyx_t_5numpy_float64_t *vp_dir; + __pyx_t_5numpy_float64_t *center; + __pyx_t_5numpy_float64_t *image; + __pyx_t_5numpy_float64_t pdx; + __pyx_t_5numpy_float64_t pdy; + __pyx_t_5numpy_float64_t bounds[4]; + int nv[2]; + int vp_strides[3]; + int im_strides[3]; + int vd_strides[3]; + PyObject *ax_vec; + PyObject *ay_vec; + __pyx_t_5numpy_float64_t *x_vec; + __pyx_t_5numpy_float64_t *y_vec; +}; + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":299 + * tv[offset + k] = fv[k] + * + * cdef class PartitionedGrid: # <<<<<<<<<<<<<< + * cdef public object my_data + * cdef public object LeftEdge + */ + +struct __pyx_obj_2yt_9amr_utils_PartitionedGrid { + PyObject_HEAD + struct __pyx_vtabstruct_2yt_9amr_utils_PartitionedGrid *__pyx_vtab; + PyObject *my_data; + PyObject *LeftEdge; + PyObject *RightEdge; + __pyx_t_5numpy_float64_t *data[6]; + __pyx_t_5numpy_float64_t dvs[6]; + __pyx_t_5numpy_float64_t left_edge[3]; + __pyx_t_5numpy_float64_t right_edge[3]; + __pyx_t_5numpy_float64_t dds[3]; + __pyx_t_5numpy_float64_t idds[3]; + int dims[3]; + int parent_grid_id; + int n_fields; +}; + + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":543 + * tf.eval_transfer(dt, self.dvs, rgba, grad) + * + * cdef class GridFace: # <<<<<<<<<<<<<< + * cdef int direction + * cdef public np.float64_t coord + */ + +struct __pyx_vtabstruct_2yt_9amr_utils_GridFace { + int (*proj_overlap)(struct __pyx_obj_2yt_9amr_utils_GridFace *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *); +}; +static struct __pyx_vtabstruct_2yt_9amr_utils_GridFace *__pyx_vtabptr_2yt_9amr_utils_GridFace; + + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":118 + * return (bv + dd*dy*fit.idbin) + * + * cdef class TransferFunctionProxy: # <<<<<<<<<<<<<< + * cdef int n_fields + * cdef int n_field_tables + */ + +struct __pyx_vtabstruct_2yt_9amr_utils_TransferFunctionProxy { + void (*eval_transfer)(struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *); +}; +static struct __pyx_vtabstruct_2yt_9amr_utils_TransferFunctionProxy *__pyx_vtabptr_2yt_9amr_utils_TransferFunctionProxy; + + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":575 + * return 1 + * + * cdef class ProtoPrism: # <<<<<<<<<<<<<< + * cdef np.float64_t left_edge[3] + * cdef np.float64_t right_edge[3] + */ + +struct __pyx_vtabstruct_2yt_9amr_utils_ProtoPrism { + PyObject *(*split)(struct __pyx_obj_2yt_9amr_utils_ProtoPrism *, __pyx_t_5numpy_float64_t *, int); +}; +static struct __pyx_vtabstruct_2yt_9amr_utils_ProtoPrism *__pyx_vtabptr_2yt_9amr_utils_ProtoPrism; + + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":99 + * free(node) + * + * cdef class QuadTree: # <<<<<<<<<<<<<< + * cdef int nvals + * cdef np.int64_t po2[80] + */ + +struct __pyx_vtabstruct_2yt_9amr_utils_QuadTree { + void (*add_to_position)(struct __pyx_obj_2yt_9amr_utils_QuadTree *, int, __pyx_t_5numpy_int64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t); + struct __pyx_t_2yt_9amr_utils_QuadTreeNode *(*find_on_root_level)(struct __pyx_obj_2yt_9amr_utils_QuadTree *, __pyx_t_5numpy_int64_t *, int); + int (*count_at_level)(struct __pyx_obj_2yt_9amr_utils_QuadTree *, struct __pyx_t_2yt_9amr_utils_QuadTreeNode *, int); + int (*fill_from_level)(struct __pyx_obj_2yt_9amr_utils_QuadTree *, struct __pyx_t_2yt_9amr_utils_QuadTreeNode *, int, __pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *); +}; +static struct __pyx_vtabstruct_2yt_9amr_utils_QuadTree *__pyx_vtabptr_2yt_9amr_utils_QuadTree; + + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":222 + * #rgba[i+3] += trgba[i] * (1.0 - rgba[i+3])*dt*trgba[i+3] + * + * cdef class VectorPlane: # <<<<<<<<<<<<<< + * cdef public object avp_pos, avp_dir, acenter, aimage + * cdef np.float64_t *vp_pos, *vp_dir, *center, *image, + */ + +struct __pyx_vtabstruct_2yt_9amr_utils_VectorPlane { + void (*get_start_stop)(struct __pyx_obj_2yt_9amr_utils_VectorPlane *, __pyx_t_5numpy_float64_t *, int *); + void (*copy_into)(struct __pyx_obj_2yt_9amr_utils_VectorPlane *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, int, int, int, int *); + void (*copy_back)(struct __pyx_obj_2yt_9amr_utils_VectorPlane *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, int, int, int, int *); +}; +static struct __pyx_vtabstruct_2yt_9amr_utils_VectorPlane *__pyx_vtabptr_2yt_9amr_utils_VectorPlane; + + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":299 + * tv[offset + k] = fv[k] + * + * cdef class PartitionedGrid: # <<<<<<<<<<<<<< + * cdef public object my_data + * cdef public object LeftEdge + */ + +struct __pyx_vtabstruct_2yt_9amr_utils_PartitionedGrid { + void (*calculate_extent)(struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *, struct __pyx_obj_2yt_9amr_utils_VectorPlane *, __pyx_t_5numpy_float64_t *); + int (*integrate_ray)(struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *); + void (*sample_values)(struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, int *, __pyx_t_5numpy_float64_t *, struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *); +}; +static struct __pyx_vtabstruct_2yt_9amr_utils_PartitionedGrid *__pyx_vtabptr_2yt_9amr_utils_PartitionedGrid; + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); + end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; + } + #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) +#else + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) +#endif /* CYTHON_REFNANNY */ +#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) +#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, + const char* function_name, int kw_allowed); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); /*proto*/ + +/* Run-time type information about structs used with buffers */ +struct __Pyx_StructField_; + +typedef struct { + const char* name; /* for error messages only */ + struct __Pyx_StructField_* fields; + size_t size; /* sizeof(type) */ + char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */ +} __Pyx_TypeInfo; + +typedef struct __Pyx_StructField_ { + __Pyx_TypeInfo* type; + const char* name; + size_t offset; +} __Pyx_StructField; + +typedef struct { + __Pyx_StructField* field; + size_t parent_offset; +} __Pyx_BufFmt_StackElem; + + +static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} + + +#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_List_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + + +#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { + PyObject *r; + if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { + r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { + r = PySequence_GetItem(o, i); + } + else { + r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); + } + return r; +} + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ +#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) +#define __Pyx_BufPtrStrided4d(type, buf, i0, s0, i1, s1, i2, s2, i3, s3) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2 + i3 * s3) +#define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1) + +static void __Pyx_RaiseBufferFallbackError(void); /*proto*/ +#define __Pyx_BufPtrStrided3d(type, buf, i0, s0, i1, s1, i2, s2) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2) +static void __Pyx_RaiseBufferIndexError(int axis); /*proto*/ + +static CYTHON_INLINE long __Pyx_mod_long(long, long); /* proto */ + +static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) { + if (likely(PyList_CheckExact(L))) { + if (PyList_Append(L, x) < 0) return NULL; + Py_INCREF(Py_None); + return Py_None; /* this is just to have an accurate signature */ + } + else { + PyObject *r, *m; + m = __Pyx_GetAttrString(L, "append"); + if (!m) return NULL; + r = PyObject_CallFunctionObjArgs(m, x, NULL); + Py_DECREF(m); + return r; + } +} + +static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */ + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ +static int __Pyx_EndUnpack(PyObject *, Py_ssize_t expected); /*proto*/ + +#define __Pyx_SetItemInt(o, i, v, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_SetItemInt_Fast(o, i, v) : \ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) + +static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { + int r; + if (!j) return -1; + r = PyObject_SetItem(o, j, v); + Py_DECREF(j); + return r; +} + +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v) { + if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { + Py_INCREF(v); + Py_DECREF(PyList_GET_ITEM(o, i)); + PyList_SET_ITEM(o, i, v); + return 1; + } + else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && (likely(i >= 0))) + return PySequence_SetItem(o, i, v); + else { + PyObject *j = PyInt_FromSsize_t(i); + return __Pyx_SetItemInt_Generic(o, j, v); + } +} + +static CYTHON_INLINE __pyx_t_5numpy_int64_t __Pyx_div___pyx_t_5numpy_int64_t(__pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t); /* proto */ + +#define UNARY_NEG_WOULD_OVERFLOW(x) (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ +#if PY_MAJOR_VERSION < 3 +static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); +static void __Pyx_ReleaseBuffer(Py_buffer *view); +#else +#define __Pyx_GetBuffer PyObject_GetBuffer +#define __Pyx_ReleaseBuffer PyBuffer_Release +#endif + +Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0}; +Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1}; + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp); + +static CYTHON_INLINE npy_int32 __Pyx_PyInt_from_py_npy_int32(PyObject *); + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int32(npy_int32); + +static int __Pyx_Print(PyObject*, PyObject *, int); /*proto*/ +#if PY_MAJOR_VERSION >= 3 +static PyObject* __pyx_print = 0; +static PyObject* __pyx_print_kwargs = 0; +#endif + +static CYTHON_INLINE npy_int64 __Pyx_PyInt_from_py_npy_int64(PyObject *); + +static int __Pyx_PrintOne(PyObject* stream, PyObject *o); /*proto*/ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int64(npy_int64); + +#if PY_VERSION_HEX < 0x02050000 +#ifndef PyAnySet_CheckExact + +#define PyAnySet_CheckExact(ob) \ + ((ob)->ob_type == &PySet_Type || \ + (ob)->ob_type == &PyFrozenSet_Type) + +#define PySet_New(iterable) \ + PyObject_CallFunctionObjArgs((PyObject *)&PySet_Type, (iterable), NULL) + +#define Pyx_PyFrozenSet_New(iterable) \ + PyObject_CallFunctionObjArgs((PyObject *)&PyFrozenSet_Type, (iterable), NULL) + +#define PySet_Size(anyset) \ + PyObject_Size((anyset)) + +#define PySet_Contains(anyset, key) \ + PySequence_Contains((anyset), (key)) + +#define PySet_Pop(set) \ + PyObject_CallMethod(set, (char *)"pop", NULL) + +static CYTHON_INLINE int PySet_Clear(PyObject *set) { + PyObject *ret = PyObject_CallMethod(set, (char *)"clear", NULL); + if (!ret) return -1; + Py_DECREF(ret); return 0; +} + +static CYTHON_INLINE int PySet_Discard(PyObject *set, PyObject *key) { + PyObject *ret = PyObject_CallMethod(set, (char *)"discard", (char *)"O", key); + if (!ret) return -1; + Py_DECREF(ret); return 0; +} + +static CYTHON_INLINE int PySet_Add(PyObject *set, PyObject *key) { + PyObject *ret = PyObject_CallMethod(set, (char *)"add", (char *)"O", key); + if (!ret) return -1; + Py_DECREF(ret); return 0; +} + +#endif /* PyAnySet_CheckExact (<= Py2.4) */ + +#if PY_VERSION_HEX < 0x02040000 +#ifndef Py_SETOBJECT_H +#define Py_SETOBJECT_H + +static PyTypeObject *__Pyx_PySet_Type = NULL; +static PyTypeObject *__Pyx_PyFrozenSet_Type = NULL; + +#define PySet_Type (*__Pyx_PySet_Type) +#define PyFrozenSet_Type (*__Pyx_PyFrozenSet_Type) + +#define PyAnySet_Check(ob) \ + (PyAnySet_CheckExact(ob) || \ + PyType_IsSubtype((ob)->ob_type, &PySet_Type) || \ + PyType_IsSubtype((ob)->ob_type, &PyFrozenSet_Type)) + +#define PyFrozenSet_CheckExact(ob) ((ob)->ob_type == &PyFrozenSet_Type) + +static int __Pyx_Py23SetsImport(void) { + PyObject *sets=0, *Set=0, *ImmutableSet=0; + + sets = PyImport_ImportModule((char *)"sets"); + if (!sets) goto bad; + Set = PyObject_GetAttrString(sets, (char *)"Set"); + if (!Set) goto bad; + ImmutableSet = PyObject_GetAttrString(sets, (char *)"ImmutableSet"); + if (!ImmutableSet) goto bad; + Py_DECREF(sets); + + __Pyx_PySet_Type = (PyTypeObject*) Set; + __Pyx_PyFrozenSet_Type = (PyTypeObject*) ImmutableSet; + + return 0; + + bad: + Py_XDECREF(sets); + Py_XDECREF(Set); + Py_XDECREF(ImmutableSet); + return -1; +} + +#else +static int __Pyx_Py23SetsImport(void) { return 0; } +#endif /* !Py_SETOBJECT_H */ +#endif /* < Py2.4 */ +#endif /* < Py2.5 */ + +static CYTHON_INLINE png_uint_32 __Pyx_PyInt_from_py_png_uint_32(PyObject *); + +static CYTHON_INLINE long __Pyx_pow_long(long, long); /* proto */ + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #define __Pyx_CREAL(z) ((z).real()) + #define __Pyx_CIMAG(z) ((z).imag()) + #else + #define __Pyx_CREAL(z) (__real__(z)) + #define __Pyx_CIMAG(z) (__imag__(z)) + #endif +#else + #define __Pyx_CREAL(z) ((z).real) + #define __Pyx_CIMAG(z) ((z).imag) +#endif + +#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX + #define __Pyx_SET_CREAL(z,x) ((z).real(x)) + #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) +#else + #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) + #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) +#endif + +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eqf(a, b) ((a)==(b)) + #define __Pyx_c_sumf(a, b) ((a)+(b)) + #define __Pyx_c_difff(a, b) ((a)-(b)) + #define __Pyx_c_prodf(a, b) ((a)*(b)) + #define __Pyx_c_quotf(a, b) ((a)/(b)) + #define __Pyx_c_negf(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zerof(z) ((z)==(float)0) + #define __Pyx_c_conjf(z) (::std::conj(z)) + /*#define __Pyx_c_absf(z) (::std::abs(z))*/ + #else + #define __Pyx_c_is_zerof(z) ((z)==0) + #define __Pyx_c_conjf(z) (conjf(z)) + /*#define __Pyx_c_absf(z) (cabsf(z))*/ + #endif +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); + /*static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);*/ +#endif + +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eq(a, b) ((a)==(b)) + #define __Pyx_c_sum(a, b) ((a)+(b)) + #define __Pyx_c_diff(a, b) ((a)-(b)) + #define __Pyx_c_prod(a, b) ((a)*(b)) + #define __Pyx_c_quot(a, b) ((a)/(b)) + #define __Pyx_c_neg(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero(z) ((z)==(double)0) + #define __Pyx_c_conj(z) (::std::conj(z)) + /*#define __Pyx_c_abs(z) (::std::abs(z))*/ + #else + #define __Pyx_c_is_zero(z) ((z)==0) + #define __Pyx_c_conj(z) (conj(z)) + /*#define __Pyx_c_abs(z) (cabs(z))*/ + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); + /*static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);*/ +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static void __Pyx_WriteUnraisable(const char *name); /*proto*/ + +static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/ + +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ + +static void __Pyx_AddTraceback(const char *funcname); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ +/* Module declarations from cpython.buffer */ + +/* Module declarations from cpython.ref */ + +/* Module declarations from libc.stdio */ + +/* Module declarations from cpython.object */ + +/* Module declarations from libc.stdlib */ + +/* Module declarations from numpy */ + +/* Module declarations from numpy */ + +static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; +static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; +static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; +static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; +static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ +/* Module declarations from cython */ + +/* Module declarations from stdlib */ + +/* Module declarations from stdio */ + +/* Module declarations from yt.amr_utils */ + +static PyTypeObject *__pyx_ptype_2yt_9amr_utils_position = 0; +static PyTypeObject *__pyx_ptype_2yt_9amr_utils_OctreeGrid = 0; +static PyTypeObject *__pyx_ptype_2yt_9amr_utils_OctreeGridList = 0; +static PyTypeObject *__pyx_ptype_2yt_9amr_utils_VectorPlane = 0; +static PyTypeObject *__pyx_ptype_2yt_9amr_utils_TransferFunctionProxy = 0; +static PyTypeObject *__pyx_ptype_2yt_9amr_utils_PartitionedGrid = 0; +static PyTypeObject *__pyx_ptype_2yt_9amr_utils_GridFace = 0; +static PyTypeObject *__pyx_ptype_2yt_9amr_utils_ProtoPrism = 0; +static PyTypeObject *__pyx_ptype_2yt_9amr_utils_QuadTree = 0; +static CYTHON_INLINE void __pyx_f_2yt_9amr_utils_set_rotated_pos(__pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t (*)[3], __pyx_t_5numpy_float64_t *, int, int, int); /*proto*/ +static void __pyx_f_2yt_9amr_utils_normalize_vector(__pyx_t_5numpy_float64_t *); /*proto*/ +static void __pyx_f_2yt_9amr_utils_get_cross_product(__pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *); /*proto*/ +static int __pyx_f_2yt_9amr_utils_check_projected_overlap(__pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, int, __pyx_t_5numpy_float64_t (*)[3], __pyx_t_5numpy_float64_t (*)[3]); /*proto*/ +static CYTHON_INLINE int __pyx_f_2yt_9amr_utils_imax(int, int); /*proto*/ +static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9amr_utils_fmax(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/ +static CYTHON_INLINE int __pyx_f_2yt_9amr_utils_imin(int, int); /*proto*/ +static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9amr_utils_fmin(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/ +static CYTHON_INLINE int __pyx_f_2yt_9amr_utils_iclip(int, int, int); /*proto*/ +static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9amr_utils_fclip(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/ +static void __pyx_f_2yt_9amr_utils_FIT_initialize_table(struct __pyx_t_2yt_9amr_utils_FieldInterpolationTable *, int, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, int, struct __pyx_opt_args_2yt_9amr_utils_FIT_initialize_table *__pyx_optional_args); /*proto*/ +static __pyx_t_5numpy_float64_t __pyx_f_2yt_9amr_utils_FIT_get_value(struct __pyx_t_2yt_9amr_utils_FieldInterpolationTable *, __pyx_t_5numpy_float64_t *); /*proto*/ +static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_9amr_utils_i64max(__pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t); /*proto*/ +static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_9amr_utils_i64min(__pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t); /*proto*/ +static CYTHON_INLINE int __pyx_f_2yt_9amr_utils_are_neighbors(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/ +static void __pyx_f_2yt_9amr_utils_QTN_add_value(struct __pyx_t_2yt_9amr_utils_QuadTreeNode *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t); /*proto*/ +static void __pyx_f_2yt_9amr_utils_QTN_refine(struct __pyx_t_2yt_9amr_utils_QuadTreeNode *); /*proto*/ +static struct __pyx_t_2yt_9amr_utils_QuadTreeNode *__pyx_f_2yt_9amr_utils_QTN_initialize(__pyx_t_5numpy_int64_t *, int, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t, int); /*proto*/ +static void __pyx_f_2yt_9amr_utils_QTN_free(struct __pyx_t_2yt_9amr_utils_QuadTreeNode *); /*proto*/ +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t = { "int32_t", NULL, sizeof(__pyx_t_5numpy_int32_t), 'I' }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t = { "float64_t", NULL, sizeof(__pyx_t_5numpy_float64_t), 'R' }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int_t = { "int_t", NULL, sizeof(__pyx_t_5numpy_int_t), 'I' }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t = { "int8_t", NULL, sizeof(__pyx_t_5numpy_int8_t), 'I' }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float_t = { "float_t", NULL, sizeof(__pyx_t_5numpy_float_t), 'R' }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t = { "int64_t", NULL, sizeof(__pyx_t_5numpy_int64_t), 'I' }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t = { "float32_t", NULL, sizeof(__pyx_t_5numpy_float32_t), 'R' }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t = { "uint8_t", NULL, sizeof(__pyx_t_5numpy_uint8_t), 'U' }; +#define __Pyx_MODULE_NAME "yt.amr_utils" +int __pyx_module_is_main_yt__amr_utils = 0; + +/* Implementation of yt.amr_utils */ +static PyObject *__pyx_builtin_range; +static PyObject *__pyx_builtin_xrange; +static PyObject *__pyx_builtin_RuntimeError; +static PyObject *__pyx_builtin_ValueError; +static char __pyx_k_1[] = "RecurseOctreeDepthFirst"; +static char __pyx_k_2[] = "RecurseOctreeByLevels"; +static char __pyx_k_3[] = "Field table"; +static char __pyx_k_4[] = "corresponds to"; +static char __pyx_k_5[] = "(Weighted with "; +static char __pyx_k_6[] = ")"; +static char __pyx_k_7[] = "ndarray is not C contiguous"; +static char __pyx_k_8[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_9[] = "Non-native byte order not supported"; +static char __pyx_k_10[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_11[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_12[] = "Format string allocated too short."; +static char __pyx_k_13[] = "\nContainer file to hold all our Cython routines. This is to avoid problems with\nstatic linking.\n\nAuthor: Matthew Turk \nAffiliation: KIPAC/SLAC/Stanford\nHomepage: http://yt.enzotools.org/\nLicense:\n Copyright (C) 2008 Matthew Turk. All Rights Reserved.\n\n This file is part of yt.\n\n yt is free software; you can redistribute it and/or modify\n it under the terms of the GNU General Public License as published by\n the Free Software Foundation; either version 3 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see .\n"; +static char __pyx_k_14[] = "Transfer3D (line 36)"; +static char __pyx_k_15[] = "TransferShells (line 74)"; +static char __pyx_k__B[] = "B"; +static char __pyx_k__F[] = "F"; +static char __pyx_k__H[] = "H"; +static char __pyx_k__I[] = "I"; +static char __pyx_k__L[] = "L"; +static char __pyx_k__O[] = "O"; +static char __pyx_k__Q[] = "Q"; +static char __pyx_k__a[] = "a"; +static char __pyx_k__b[] = "b"; +static char __pyx_k__d[] = "d"; +static char __pyx_k__e[] = "e"; +static char __pyx_k__f[] = "f"; +static char __pyx_k__g[] = "g"; +static char __pyx_k__h[] = "h"; +static char __pyx_k__i[] = "i"; +static char __pyx_k__l[] = "l"; +static char __pyx_k__q[] = "q"; +static char __pyx_k__u[] = "u"; +static char __pyx_k__v[] = "v"; +static char __pyx_k__x[] = "x"; +static char __pyx_k__y[] = "y"; +static char __pyx_k__z[] = "z"; +static char __pyx_k__Zd[] = "Zd"; +static char __pyx_k__Zf[] = "Zf"; +static char __pyx_k__Zg[] = "Zg"; +static char __pyx_k__cm[] = "cm"; +static char __pyx_k__dx[] = "dx"; +static char __pyx_k__dy[] = "dy"; +static char __pyx_k__dz[] = "dz"; +static char __pyx_k__fn[] = "fn"; +static char __pyx_k__gi[] = "gi"; +static char __pyx_k__np[] = "np"; +static char __pyx_k__ns[] = "ns"; +static char __pyx_k__nv[] = "nv"; +static char __pyx_k__pv[] = "pv"; +static char __pyx_k__px[] = "px"; +static char __pyx_k__py[] = "py"; +static char __pyx_k__rb[] = "rb"; +static char __pyx_k__tf[] = "tf"; +static char __pyx_k__ug[] = "ug"; +static char __pyx_k__vp[] = "vp"; +static char __pyx_k__wb[] = "wb"; +static char __pyx_k__buf[] = "buf"; +static char __pyx_k__dds[] = "dds"; +static char __pyx_k__dpi[] = "dpi"; +static char __pyx_k__dvs[] = "dvs"; +static char __pyx_k__i_f[] = "i_f"; +static char __pyx_k__i_i[] = "i_i"; +static char __pyx_k__i_s[] = "i_s"; +static char __pyx_k__ind[] = "ind"; +static char __pyx_k__j_f[] = "j_f"; +static char __pyx_k__j_i[] = "j_i"; +static char __pyx_k__k_f[] = "k_f"; +static char __pyx_k__k_i[] = "k_i"; +static char __pyx_k__o_s[] = "o_s"; +static char __pyx_k__obj[] = "obj"; +static char __pyx_k__pdx[] = "pdx"; +static char __pyx_k__pdy[] = "pdy"; +static char __pyx_k__po2[] = "po2"; +static char __pyx_k__pos[] = "pos"; +static char __pyx_k__pxs[] = "pxs"; +static char __pyx_k__pys[] = "pys"; +static char __pyx_k__red[] = "red"; +static char __pyx_k__val[] = "val"; +static char __pyx_k__base[] = "base"; +static char __pyx_k__blue[] = "blue"; +static char __pyx_k__copy[] = "copy"; +static char __pyx_k__data[] = "data"; +static char __pyx_k__dbin[] = "dbin"; +static char __pyx_k__dims[] = "dims"; +static char __pyx_k__gray[] = "gray"; +static char __pyx_k__grid[] = "grid"; +static char __pyx_k__idds[] = "idds"; +static char __pyx_k__imax[] = "imax"; +static char __pyx_k__imin[] = "imin"; +static char __pyx_k__int8[] = "int8"; +static char __pyx_k__jmax[] = "jmax"; +static char __pyx_k__jmin[] = "jmin"; +static char __pyx_k__kmax[] = "kmax"; +static char __pyx_k__kmin[] = "kmin"; +static char __pyx_k__left[] = "left"; +static char __pyx_k__mask[] = "mask"; +static char __pyx_k__mass[] = "mass"; +static char __pyx_k__ndim[] = "ndim"; +static char __pyx_k__posx[] = "posx"; +static char __pyx_k__posy[] = "posy"; +static char __pyx_k__posz[] = "posz"; +static char __pyx_k__x_is[] = "x_is"; +static char __pyx_k__y_is[] = "y_is"; +static char __pyx_k__z_is[] = "z_is"; +static char __pyx_k__alpha[] = "alpha"; +static char __pyx_k__coord[] = "coord"; +static char __pyx_k__descr[] = "descr"; +static char __pyx_k__dtype[] = "dtype"; +static char __pyx_k__empty[] = "empty"; +static char __pyx_k__field[] = "field"; +static char __pyx_k__floor[] = "floor"; +static char __pyx_k__green[] = "green"; +static char __pyx_k__grids[] = "grids"; +static char __pyx_k__idbin[] = "idbin"; +static char __pyx_k__image[] = "image"; +static char __pyx_k__int32[] = "int32"; +static char __pyx_k__int64[] = "int64"; +static char __pyx_k__joins[] = "joins"; +static char __pyx_k__level[] = "level"; +static char __pyx_k__names[] = "names"; +static char __pyx_k__nbins[] = "nbins"; +static char __pyx_k__numpy[] = "numpy"; +static char __pyx_k__nvals[] = "nvals"; +static char __pyx_k__order[] = "order"; +static char __pyx_k__pmask[] = "pmask"; +static char __pyx_k__pvals[] = "pvals"; +static char __pyx_k__range[] = "range"; +static char __pyx_k__shape[] = "shape"; +static char __pyx_k__split[] = "split"; +static char __pyx_k__stack[] = "stack"; +static char __pyx_k__sweep[] = "sweep"; +static char __pyx_k__table[] = "table"; +static char __pyx_k__wvals[] = "wvals"; +static char __pyx_k__x_vec[] = "x_vec"; +static char __pyx_k__y_vec[] = "y_vec"; +static char __pyx_k__zeros[] = "zeros"; +static char __pyx_k__aimage[] = "aimage"; +static char __pyx_k__ax_vec[] = "ax_vec"; +static char __pyx_k__ay_vec[] = "ay_vec"; +static char __pyx_k__bounds[] = "bounds"; +static char __pyx_k__buffer[] = "buffer"; +static char __pyx_k__center[] = "center"; +static char __pyx_k__curpos[] = "curpos"; +static char __pyx_k__fields[] = "fields"; +static char __pyx_k__format[] = "format"; +static char __pyx_k__grid_t[] = "grid_t"; +static char __pyx_k__offset[] = "offset"; +static char __pyx_k__output[] = "output"; +static char __pyx_k__points[] = "points"; +static char __pyx_k__shells[] = "shells"; +static char __pyx_k__tables[] = "tables"; +static char __pyx_k__tf_obj[] = "tf_obj"; +static char __pyx_k__values[] = "values"; +static char __pyx_k__vp_dir[] = "vp_dir"; +static char __pyx_k__vp_pos[] = "vp_pos"; +static char __pyx_k__x_bins[] = "x_bins"; +static char __pyx_k__x_vals[] = "x_vals"; +static char __pyx_k__xrange[] = "xrange"; +static char __pyx_k__y_bins[] = "y_bins"; +static char __pyx_k__y_vals[] = "y_vals"; +static char __pyx_k__z_bins[] = "z_bins"; +static char __pyx_k__z_vals[] = "z_vals"; +static char __pyx_k__Channel[] = "Channel"; +static char __pyx_k__acenter[] = "acenter"; +static char __pyx_k__avp_dir[] = "avp_dir"; +static char __pyx_k__avp_pos[] = "avp_pos"; +static char __pyx_k__corners[] = "corners"; +static char __pyx_k__float32[] = "float32"; +static char __pyx_k__float64[] = "float64"; +static char __pyx_k__grid_dt[] = "grid_dt"; +static char __pyx_k__istride[] = "istride"; +static char __pyx_k__jstride[] = "jstride"; +static char __pyx_k__max_ind[] = "max_ind"; +static char __pyx_k__my_data[] = "my_data"; +static char __pyx_k__nshells[] = "nshells"; +static char __pyx_k__refined[] = "refined"; +static char __pyx_k__rot_mat[] = "rot_mat"; +static char __pyx_k__strides[] = "strides"; +static char __pyx_k__LeftEdge[] = "LeftEdge"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__cellSize[] = "cellSize"; +static char __pyx_k__children[] = "children"; +static char __pyx_k__field_id[] = "field_id"; +static char __pyx_k__filename[] = "filename"; +static char __pyx_k__grid_dds[] = "grid_dds"; +static char __pyx_k__istorage[] = "istorage"; +static char __pyx_k__itemsize[] = "itemsize"; +static char __pyx_k__leftEdge[] = "leftEdge"; +static char __pyx_k__n_fields[] = "n_fields"; +static char __pyx_k__readonly[] = "readonly"; +static char __pyx_k__type_num[] = "type_num"; +static char __pyx_k__x_bounds[] = "x_bounds"; +static char __pyx_k__RightEdge[] = "RightEdge"; +static char __pyx_k__byteorder[] = "byteorder"; +static char __pyx_k__copy_back[] = "copy_back"; +static char __pyx_k__copy_into[] = "copy_into"; +static char __pyx_k__direction[] = "direction"; +static char __pyx_k__field_ids[] = "field_ids"; +static char __pyx_k__genealogy[] = "genealogy"; +static char __pyx_k__grid_mask[] = "grid_mask"; +static char __pyx_k__left_edge[] = "left_edge"; +static char __pyx_k__root_size[] = "root_size"; +static char __pyx_k__slab_size[] = "slab_size"; +static char __pyx_k__Transfer3D[] = "Transfer3D"; +static char __pyx_k__ValueError[] = "ValueError"; +static char __pyx_k__box_center[] = "box_center"; +static char __pyx_k__box_origin[] = "box_origin"; +static char __pyx_k__child_mask[] = "child_mask"; +static char __pyx_k__count_only[] = "count_only"; +static char __pyx_k__dimensions[] = "dimensions"; +static char __pyx_k__im_strides[] = "im_strides"; +static char __pyx_k__left_edges[] = "left_edges"; +static char __pyx_k__npositions[] = "npositions"; +static char __pyx_k__output_pos[] = "output_pos"; +static char __pyx_k__right_edge[] = "right_edge"; +static char __pyx_k__root_nodes[] = "root_nodes"; +static char __pyx_k__slab_start[] = "slab_start"; +static char __pyx_k__suboffsets[] = "suboffsets"; +static char __pyx_k__vd_strides[] = "vd_strides"; +static char __pyx_k__vp_strides[] = "vp_strides"; +static char __pyx_k__weight_val[] = "weight_val"; +static char __pyx_k__box_lengths[] = "box_lengths"; +static char __pyx_k__box_vectors[] = "box_vectors"; +static char __pyx_k__break_first[] = "break_first"; +static char __pyx_k__refined_pos[] = "refined_pos"; +static char __pyx_k__start_index[] = "start_index"; +static char __pyx_k__RuntimeError[] = "RuntimeError"; +static char __pyx_k__field_tables[] = "field_tables"; +static char __pyx_k__pass_through[] = "pass_through"; +static char __pyx_k__proj_overlap[] = "proj_overlap"; +static char __pyx_k__pweight_vals[] = "pweight_vals"; +static char __pyx_k__child_indices[] = "child_indices"; +static char __pyx_k__eval_transfer[] = "eval_transfer"; +static char __pyx_k__gridDimension[] = "gridDimension"; +static char __pyx_k__integrate_ray[] = "integrate_ray"; +static char __pyx_k__sample_values[] = "sample_values"; +static char __pyx_k__subgrid_faces[] = "subgrid_faces"; +static char __pyx_k__top_grid_dims[] = "top_grid_dims"; +static char __pyx_k__TransferShells[] = "TransferShells"; +static char __pyx_k__count_at_level[] = "count_at_level"; +static char __pyx_k__get_start_stop[] = "get_start_stop"; +static char __pyx_k__grid_left_edge[] = "grid_left_edge"; +static char __pyx_k__n_field_tables[] = "n_field_tables"; +static char __pyx_k__parent_grid_id[] = "parent_grid_id"; +static char __pyx_k__add_to_position[] = "add_to_position"; +static char __pyx_k__field_table_ids[] = "field_table_ids"; +static char __pyx_k__fill_from_level[] = "fill_from_level"; +static char __pyx_k__grid_left_edges[] = "grid_left_edges"; +static char __pyx_k__grid_right_edge[] = "grid_right_edge"; +static char __pyx_k__my_field_tables[] = "my_field_tables"; +static char __pyx_k__weight_field_id[] = "weight_field_id"; +static char __pyx_k__weight_table_id[] = "weight_table_id"; +static char __pyx_k__calculate_extent[] = "calculate_extent"; +static char __pyx_k__grid_right_edges[] = "grid_right_edges"; +static char __pyx_k__weight_field_ids[] = "weight_field_ids"; +static char __pyx_k__weight_table_ids[] = "weight_table_ids"; +static char __pyx_k__find_on_root_level[] = "find_on_root_level"; +static PyObject *__pyx_n_s_1; +static PyObject *__pyx_kp_u_10; +static PyObject *__pyx_kp_u_11; +static PyObject *__pyx_kp_u_12; +static PyObject *__pyx_kp_u_14; +static PyObject *__pyx_kp_u_15; +static PyObject *__pyx_n_s_2; +static PyObject *__pyx_kp_s_3; +static PyObject *__pyx_kp_s_4; +static PyObject *__pyx_kp_s_5; +static PyObject *__pyx_kp_s_6; +static PyObject *__pyx_kp_u_7; +static PyObject *__pyx_kp_u_8; +static PyObject *__pyx_kp_u_9; +static PyObject *__pyx_n_s__Channel; +static PyObject *__pyx_n_s__F; +static PyObject *__pyx_n_s__LeftEdge; +static PyObject *__pyx_n_s__RightEdge; +static PyObject *__pyx_n_s__RuntimeError; +static PyObject *__pyx_n_s__Transfer3D; +static PyObject *__pyx_n_s__TransferShells; +static PyObject *__pyx_n_s__ValueError; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__a; +static PyObject *__pyx_n_s__acenter; +static PyObject *__pyx_n_s__add_to_position; +static PyObject *__pyx_n_s__aimage; +static PyObject *__pyx_n_s__alpha; +static PyObject *__pyx_n_s__avp_dir; +static PyObject *__pyx_n_s__avp_pos; +static PyObject *__pyx_n_s__ax_vec; +static PyObject *__pyx_n_s__ay_vec; +static PyObject *__pyx_n_s__base; +static PyObject *__pyx_n_s__blue; +static PyObject *__pyx_n_s__bounds; +static PyObject *__pyx_n_s__box_center; +static PyObject *__pyx_n_s__box_lengths; +static PyObject *__pyx_n_s__box_origin; +static PyObject *__pyx_n_s__box_vectors; +static PyObject *__pyx_n_s__break_first; +static PyObject *__pyx_n_s__buf; +static PyObject *__pyx_n_s__buffer; +static PyObject *__pyx_n_s__byteorder; +static PyObject *__pyx_n_s__calculate_extent; +static PyObject *__pyx_n_s__cellSize; +static PyObject *__pyx_n_s__center; +static PyObject *__pyx_n_s__child_indices; +static PyObject *__pyx_n_s__child_mask; +static PyObject *__pyx_n_s__children; +static PyObject *__pyx_n_s__cm; +static PyObject *__pyx_n_s__coord; +static PyObject *__pyx_n_s__copy; +static PyObject *__pyx_n_s__copy_back; +static PyObject *__pyx_n_s__copy_into; +static PyObject *__pyx_n_s__corners; +static PyObject *__pyx_n_s__count_at_level; +static PyObject *__pyx_n_s__count_only; +static PyObject *__pyx_n_s__curpos; +static PyObject *__pyx_n_s__data; +static PyObject *__pyx_n_s__dbin; +static PyObject *__pyx_n_s__dds; +static PyObject *__pyx_n_s__descr; +static PyObject *__pyx_n_s__dimensions; +static PyObject *__pyx_n_s__dims; +static PyObject *__pyx_n_s__direction; +static PyObject *__pyx_n_s__dpi; +static PyObject *__pyx_n_s__dtype; +static PyObject *__pyx_n_s__dvs; +static PyObject *__pyx_n_s__dx; +static PyObject *__pyx_n_s__dy; +static PyObject *__pyx_n_s__dz; +static PyObject *__pyx_n_s__e; +static PyObject *__pyx_n_s__empty; +static PyObject *__pyx_n_s__eval_transfer; +static PyObject *__pyx_n_s__field; +static PyObject *__pyx_n_s__field_id; +static PyObject *__pyx_n_s__field_ids; +static PyObject *__pyx_n_s__field_table_ids; +static PyObject *__pyx_n_s__field_tables; +static PyObject *__pyx_n_s__fields; +static PyObject *__pyx_n_s__filename; +static PyObject *__pyx_n_s__fill_from_level; +static PyObject *__pyx_n_s__find_on_root_level; +static PyObject *__pyx_n_s__float32; +static PyObject *__pyx_n_s__float64; +static PyObject *__pyx_n_s__floor; +static PyObject *__pyx_n_s__fn; +static PyObject *__pyx_n_s__format; +static PyObject *__pyx_n_s__genealogy; +static PyObject *__pyx_n_s__get_start_stop; +static PyObject *__pyx_n_s__gi; +static PyObject *__pyx_n_s__gray; +static PyObject *__pyx_n_s__green; +static PyObject *__pyx_n_s__grid; +static PyObject *__pyx_n_s__gridDimension; +static PyObject *__pyx_n_s__grid_dds; +static PyObject *__pyx_n_s__grid_dt; +static PyObject *__pyx_n_s__grid_left_edge; +static PyObject *__pyx_n_s__grid_left_edges; +static PyObject *__pyx_n_s__grid_mask; +static PyObject *__pyx_n_s__grid_right_edge; +static PyObject *__pyx_n_s__grid_right_edges; +static PyObject *__pyx_n_s__grid_t; +static PyObject *__pyx_n_s__grids; +static PyObject *__pyx_n_s__i_f; +static PyObject *__pyx_n_s__i_i; +static PyObject *__pyx_n_s__i_s; +static PyObject *__pyx_n_s__idbin; +static PyObject *__pyx_n_s__idds; +static PyObject *__pyx_n_s__im_strides; +static PyObject *__pyx_n_s__image; +static PyObject *__pyx_n_s__imax; +static PyObject *__pyx_n_s__imin; +static PyObject *__pyx_n_s__ind; +static PyObject *__pyx_n_s__int32; +static PyObject *__pyx_n_s__int64; +static PyObject *__pyx_n_s__int8; +static PyObject *__pyx_n_s__integrate_ray; +static PyObject *__pyx_n_s__istorage; +static PyObject *__pyx_n_s__istride; +static PyObject *__pyx_n_s__itemsize; +static PyObject *__pyx_n_s__j_f; +static PyObject *__pyx_n_s__j_i; +static PyObject *__pyx_n_s__jmax; +static PyObject *__pyx_n_s__jmin; +static PyObject *__pyx_n_s__joins; +static PyObject *__pyx_n_s__jstride; +static PyObject *__pyx_n_s__k_f; +static PyObject *__pyx_n_s__k_i; +static PyObject *__pyx_n_s__kmax; +static PyObject *__pyx_n_s__kmin; +static PyObject *__pyx_n_s__left; +static PyObject *__pyx_n_s__leftEdge; +static PyObject *__pyx_n_s__left_edge; +static PyObject *__pyx_n_s__left_edges; +static PyObject *__pyx_n_s__level; +static PyObject *__pyx_n_s__mask; +static PyObject *__pyx_n_s__mass; +static PyObject *__pyx_n_s__max_ind; +static PyObject *__pyx_n_s__my_data; +static PyObject *__pyx_n_s__my_field_tables; +static PyObject *__pyx_n_s__n_field_tables; +static PyObject *__pyx_n_s__n_fields; +static PyObject *__pyx_n_s__names; +static PyObject *__pyx_n_s__nbins; +static PyObject *__pyx_n_s__ndim; +static PyObject *__pyx_n_s__np; +static PyObject *__pyx_n_s__npositions; +static PyObject *__pyx_n_s__ns; +static PyObject *__pyx_n_s__nshells; +static PyObject *__pyx_n_s__numpy; +static PyObject *__pyx_n_s__nv; +static PyObject *__pyx_n_s__nvals; +static PyObject *__pyx_n_s__o_s; +static PyObject *__pyx_n_s__obj; +static PyObject *__pyx_n_s__offset; +static PyObject *__pyx_n_s__order; +static PyObject *__pyx_n_s__output; +static PyObject *__pyx_n_s__output_pos; +static PyObject *__pyx_n_s__parent_grid_id; +static PyObject *__pyx_n_s__pass_through; +static PyObject *__pyx_n_s__pdx; +static PyObject *__pyx_n_s__pdy; +static PyObject *__pyx_n_s__pmask; +static PyObject *__pyx_n_s__po2; +static PyObject *__pyx_n_s__points; +static PyObject *__pyx_n_s__pos; +static PyObject *__pyx_n_s__posx; +static PyObject *__pyx_n_s__posy; +static PyObject *__pyx_n_s__posz; +static PyObject *__pyx_n_s__proj_overlap; +static PyObject *__pyx_n_s__pv; +static PyObject *__pyx_n_s__pvals; +static PyObject *__pyx_n_s__pweight_vals; +static PyObject *__pyx_n_s__px; +static PyObject *__pyx_n_s__pxs; +static PyObject *__pyx_n_s__py; +static PyObject *__pyx_n_s__pys; +static PyObject *__pyx_n_s__range; +static PyObject *__pyx_n_s__readonly; +static PyObject *__pyx_n_s__red; +static PyObject *__pyx_n_s__refined; +static PyObject *__pyx_n_s__refined_pos; +static PyObject *__pyx_n_s__right_edge; +static PyObject *__pyx_n_s__root_nodes; +static PyObject *__pyx_n_s__root_size; +static PyObject *__pyx_n_s__rot_mat; +static PyObject *__pyx_n_s__sample_values; +static PyObject *__pyx_n_s__shape; +static PyObject *__pyx_n_s__shells; +static PyObject *__pyx_n_s__slab_size; +static PyObject *__pyx_n_s__slab_start; +static PyObject *__pyx_n_s__split; +static PyObject *__pyx_n_s__stack; +static PyObject *__pyx_n_s__start_index; +static PyObject *__pyx_n_s__strides; +static PyObject *__pyx_n_s__subgrid_faces; +static PyObject *__pyx_n_s__suboffsets; +static PyObject *__pyx_n_s__sweep; +static PyObject *__pyx_n_s__table; +static PyObject *__pyx_n_s__tables; +static PyObject *__pyx_n_s__tf; +static PyObject *__pyx_n_s__tf_obj; +static PyObject *__pyx_n_s__top_grid_dims; +static PyObject *__pyx_n_s__type_num; +static PyObject *__pyx_n_s__u; +static PyObject *__pyx_n_s__ug; +static PyObject *__pyx_n_s__v; +static PyObject *__pyx_n_s__val; +static PyObject *__pyx_n_s__values; +static PyObject *__pyx_n_s__vd_strides; +static PyObject *__pyx_n_s__vp; +static PyObject *__pyx_n_s__vp_dir; +static PyObject *__pyx_n_s__vp_pos; +static PyObject *__pyx_n_s__vp_strides; +static PyObject *__pyx_n_s__weight_field_id; +static PyObject *__pyx_n_s__weight_field_ids; +static PyObject *__pyx_n_s__weight_table_id; +static PyObject *__pyx_n_s__weight_table_ids; +static PyObject *__pyx_n_s__weight_val; +static PyObject *__pyx_n_s__wvals; +static PyObject *__pyx_n_s__x; +static PyObject *__pyx_n_s__x_bins; +static PyObject *__pyx_n_s__x_bounds; +static PyObject *__pyx_n_s__x_is; +static PyObject *__pyx_n_s__x_vals; +static PyObject *__pyx_n_s__x_vec; +static PyObject *__pyx_n_s__xrange; +static PyObject *__pyx_n_s__y; +static PyObject *__pyx_n_s__y_bins; +static PyObject *__pyx_n_s__y_is; +static PyObject *__pyx_n_s__y_vals; +static PyObject *__pyx_n_s__y_vec; +static PyObject *__pyx_n_s__z; +static PyObject *__pyx_n_s__z_bins; +static PyObject *__pyx_n_s__z_is; +static PyObject *__pyx_n_s__z_vals; +static PyObject *__pyx_n_s__zeros; +static PyObject *__pyx_int_0; +static PyObject *__pyx_int_1; +static PyObject *__pyx_int_2; +static PyObject *__pyx_int_3; +static PyObject *__pyx_int_15; + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":31 + * + * cdef class position: + * cdef public int output_pos, refined_pos # <<<<<<<<<<<<<< + * def __cinit__(self): + * self.output_pos = 0 + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_8position_10output_pos___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_8position_10output_pos___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2yt_9amr_utils_position *)__pyx_v_self)->output_pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("yt.amr_utils.position.output_pos.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_8position_10output_pos___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_8position_10output_pos___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + int __pyx_t_1; + __Pyx_RefNannySetupContext("__set__"); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_2yt_9amr_utils_position *)__pyx_v_self)->output_pos = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("yt.amr_utils.position.output_pos.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_2yt_9amr_utils_8position_11refined_pos___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_8position_11refined_pos___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2yt_9amr_utils_position *)__pyx_v_self)->refined_pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("yt.amr_utils.position.refined_pos.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_8position_11refined_pos___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_8position_11refined_pos___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + int __pyx_t_1; + __Pyx_RefNannySetupContext("__set__"); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_2yt_9amr_utils_position *)__pyx_v_self)->refined_pos = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("yt.amr_utils.position.refined_pos.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/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_9amr_utils_8position___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_8position___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + __Pyx_RefNannySetupContext("__cinit__"); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/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_9amr_utils_position *)__pyx_v_self)->output_pos = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":34 + * def __cinit__(self): + * self.output_pos = 0 + * self.refined_pos = 0 # <<<<<<<<<<<<<< + * + * cdef class OctreeGrid: + */ + ((struct __pyx_obj_2yt_9amr_utils_position *)__pyx_v_self)->refined_pos = 0; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":37 + * + * cdef class OctreeGrid: + * cdef public object child_indices, fields, left_edges, dimensions, dx # <<<<<<<<<<<<<< + * cdef public int level + * def __cinit__(self, + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_10OctreeGrid_13child_indices___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_10OctreeGrid_13child_indices___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->child_indices); + __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->child_indices; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_13child_indices___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_13child_indices___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->child_indices); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->child_indices); + ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->child_indices = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_13child_indices___del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_13child_indices___del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->child_indices); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->child_indices); + ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->child_indices = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_2yt_9amr_utils_10OctreeGrid_6fields___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_10OctreeGrid_6fields___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->fields); + __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->fields; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_6fields___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_6fields___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->fields); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->fields); + ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->fields = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_6fields___del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_6fields___del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->fields); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->fields); + ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->fields = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_2yt_9amr_utils_10OctreeGrid_10left_edges___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_10OctreeGrid_10left_edges___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->left_edges); + __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->left_edges; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_10left_edges___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_10left_edges___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->left_edges); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->left_edges); + ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->left_edges = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_10left_edges___del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_10left_edges___del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->left_edges); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->left_edges); + ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->left_edges = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_2yt_9amr_utils_10OctreeGrid_10dimensions___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_10OctreeGrid_10dimensions___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dimensions); + __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dimensions; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_10dimensions___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_10dimensions___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dimensions); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dimensions); + ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dimensions = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_10dimensions___del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_10dimensions___del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dimensions); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dimensions); + ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dimensions = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_2yt_9amr_utils_10OctreeGrid_2dx___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_10OctreeGrid_2dx___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dx); + __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dx; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_2dx___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_2dx___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dx); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dx); + ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dx = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_2dx___del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_2dx___del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dx); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dx); + ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dx = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":38 + * 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, + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_10OctreeGrid_5level___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_10OctreeGrid_5level___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->level); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("yt.amr_utils.OctreeGrid.level.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_5level___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_10OctreeGrid_5level___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + int __pyx_t_1; + __Pyx_RefNannySetupContext("__set__"); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->level = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("yt.amr_utils.OctreeGrid.level.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":39 + * cdef public object child_indices, fields, left_edges, dimensions, dx + * cdef public int level + * def __cinit__(self, # <<<<<<<<<<<<<< + * np.ndarray[np.int32_t, ndim=3] child_indices, + * np.ndarray[np.float64_t, ndim=4] fields, + */ + +static int __pyx_pf_2yt_9amr_utils_10OctreeGrid___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_10OctreeGrid___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_child_indices = 0; + PyArrayObject *__pyx_v_fields = 0; + 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; + Py_ssize_t __pyx_bstride_2_child_indices = 0; + 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_fields; + Py_ssize_t __pyx_bstride_0_fields = 0; + Py_ssize_t __pyx_bstride_1_fields = 0; + Py_ssize_t __pyx_bstride_2_fields = 0; + Py_ssize_t __pyx_bstride_3_fields = 0; + Py_ssize_t __pyx_bshape_0_fields = 0; + Py_ssize_t __pyx_bshape_1_fields = 0; + Py_ssize_t __pyx_bshape_2_fields = 0; + Py_ssize_t __pyx_bshape_3_fields = 0; + 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_left_edges; + Py_ssize_t __pyx_bstride_0_left_edges = 0; + Py_ssize_t __pyx_bshape_0_left_edges = 0; + Py_buffer __pyx_bstruct_dimensions; + Py_ssize_t __pyx_bstride_0_dimensions = 0; + Py_ssize_t __pyx_bshape_0_dimensions = 0; + int __pyx_r; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__child_indices,&__pyx_n_s__fields,&__pyx_n_s__left_edges,&__pyx_n_s__dimensions,&__pyx_n_s__dx,&__pyx_n_s__level,0}; + __Pyx_RefNannySetupContext("__cinit__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[6] = {0,0,0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__child_indices); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fields); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left_edges); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dimensions); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dx); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__level); + if (likely(values[5])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_child_indices = ((PyArrayObject *)values[0]); + __pyx_v_fields = ((PyArrayObject *)values[1]); + __pyx_v_left_edges = ((PyArrayObject *)values[2]); + __pyx_v_dimensions = ((PyArrayObject *)values[3]); + __pyx_v_dx = ((PyArrayObject *)values[4]); + __pyx_v_level = __Pyx_PyInt_AsInt(values[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 (PyTuple_GET_SIZE(__pyx_args) != 6) { + goto __pyx_L5_argtuple_error; + } else { + __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_AsInt(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;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.OctreeGrid.__cinit__"); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_bstruct_child_indices.buf = NULL; + __pyx_bstruct_fields.buf = NULL; + __pyx_bstruct_left_edges.buf = NULL; + __pyx_bstruct_dimensions.buf = NULL; + __pyx_bstruct_dx.buf = NULL; + 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;} + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_child_indices, (PyObject*)__pyx_v_child_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -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]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_fields, (PyObject*)__pyx_v_fields, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -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]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_left_edges, (PyObject*)__pyx_v_left_edges, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -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]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dimensions, (PyObject*)__pyx_v_dimensions, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -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]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dx, (PyObject*)__pyx_v_dx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_dx = __pyx_bstruct_dx.strides[0]; + __pyx_bshape_0_dx = __pyx_bstruct_dx.shape[0]; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/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 + */ + __Pyx_INCREF(((PyObject *)__pyx_v_child_indices)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_child_indices)); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->child_indices); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->child_indices); + ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->child_indices = ((PyObject *)__pyx_v_child_indices); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":47 + * int level): + * self.child_indices = child_indices + * self.fields = fields # <<<<<<<<<<<<<< + * self.left_edges = left_edges + * self.dimensions = dimensions + */ + __Pyx_INCREF(((PyObject *)__pyx_v_fields)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_fields)); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->fields); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->fields); + ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->fields = ((PyObject *)__pyx_v_fields); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":48 + * self.child_indices = child_indices + * self.fields = fields + * self.left_edges = left_edges # <<<<<<<<<<<<<< + * self.dimensions = dimensions + * self.dx = dx + */ + __Pyx_INCREF(((PyObject *)__pyx_v_left_edges)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_left_edges)); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->left_edges); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->left_edges); + ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->left_edges = ((PyObject *)__pyx_v_left_edges); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":49 + * self.fields = fields + * self.left_edges = left_edges + * self.dimensions = dimensions # <<<<<<<<<<<<<< + * self.dx = dx + * self.level = level + */ + __Pyx_INCREF(((PyObject *)__pyx_v_dimensions)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dimensions)); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dimensions); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dimensions); + ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dimensions = ((PyObject *)__pyx_v_dimensions); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":50 + * self.left_edges = left_edges + * self.dimensions = dimensions + * self.dx = dx # <<<<<<<<<<<<<< + * self.level = level + * + */ + __Pyx_INCREF(((PyObject *)__pyx_v_dx)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dx)); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dx); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dx); + ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->dx = ((PyObject *)__pyx_v_dx); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":51 + * self.dimensions = dimensions + * self.dx = dx + * self.level = level # <<<<<<<<<<<<<< + * + * cdef class OctreeGridList: + */ + ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_v_self)->level = __pyx_v_level; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_child_indices); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fields); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dx); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edges); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dimensions); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.amr_utils.OctreeGrid.__cinit__"); + __pyx_r = -1; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_child_indices); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fields); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dx); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edges); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dimensions); + __pyx_L2:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":54 + * + * cdef class OctreeGridList: + * cdef public object grids # <<<<<<<<<<<<<< + * def __cinit__(self, grids): + * self.grids = grids + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_14OctreeGridList_5grids___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_14OctreeGridList_5grids___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)__pyx_v_self)->grids); + __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)__pyx_v_self)->grids; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_14OctreeGridList_5grids___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_14OctreeGridList_5grids___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)__pyx_v_self)->grids); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)__pyx_v_self)->grids); + ((struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)__pyx_v_self)->grids = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_14OctreeGridList_5grids___del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_14OctreeGridList_5grids___del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)__pyx_v_self)->grids); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)__pyx_v_self)->grids); + ((struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)__pyx_v_self)->grids = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":55 + * cdef class OctreeGridList: + * cdef public object grids + * def __cinit__(self, grids): # <<<<<<<<<<<<<< + * self.grids = grids + * + */ + +static int __pyx_pf_2yt_9amr_utils_14OctreeGridList___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_14OctreeGridList___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_grids = 0; + int __pyx_r; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__grids,0}; + __Pyx_RefNannySetupContext("__cinit__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[1] = {0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grids); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_grids = values[0]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_grids = PyTuple_GET_ITEM(__pyx_args, 0); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.OctreeGridList.__cinit__"); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":56 + * cdef public object grids + * def __cinit__(self, grids): + * self.grids = grids # <<<<<<<<<<<<<< + * + * def __getitem__(self, int item): + */ + __Pyx_INCREF(__pyx_v_grids); + __Pyx_GIVEREF(__pyx_v_grids); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)__pyx_v_self)->grids); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)__pyx_v_self)->grids); + ((struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)__pyx_v_self)->grids = __pyx_v_grids; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":58 + * self.grids = grids + * + * def __getitem__(self, int item): # <<<<<<<<<<<<<< + * return self.grids[item] + * + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_14OctreeGridList___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_item); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_14OctreeGridList___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_item) { + int __pyx_v_item; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__getitem__"); + assert(__pyx_arg_item); { + __pyx_v_item = __Pyx_PyInt_AsInt(__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_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.OctreeGridList.__getitem__"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":59 + * + * def __getitem__(self, int item): + * return self.grids[item] # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetItemInt(((struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)__pyx_v_self)->grids, __pyx_v_item, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("yt.amr_utils.OctreeGridList.__getitem__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":62 + * + * @cython.boundscheck(False) + * def RecurseOctreeDepthFirst(int i_i, int j_i, int k_i, # <<<<<<<<<<<<<< + * int i_f, int j_f, int k_f, + * position curpos, int gi, + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_RecurseOctreeDepthFirst(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_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_9amr_utils_position *__pyx_v_curpos = 0; + int __pyx_v_gi; + PyArrayObject *__pyx_v_output = 0; + PyArrayObject *__pyx_v_refined = 0; + struct __pyx_obj_2yt_9amr_utils_OctreeGridList *__pyx_v_grids = 0; + int __pyx_v_i; + int __pyx_v_i_off; + int __pyx_v_j; + int __pyx_v_j_off; + int __pyx_v_k; + int __pyx_v_k_off; + int __pyx_v_ci; + int __pyx_v_fi; + int __pyx_v_child_i; + int __pyx_v_child_j; + int __pyx_v_child_k; + struct __pyx_obj_2yt_9amr_utils_OctreeGrid *__pyx_v_child_grid; + struct __pyx_obj_2yt_9amr_utils_OctreeGrid *__pyx_v_grid = 0; + PyArrayObject *__pyx_v_child_indices = 0; + PyArrayObject *__pyx_v_dimensions = 0; + PyArrayObject *__pyx_v_fields = 0; + PyArrayObject *__pyx_v_leftedges = 0; + __pyx_t_5numpy_float64_t __pyx_v_dx; + __pyx_t_5numpy_float64_t __pyx_v_child_dx; + PyArrayObject *__pyx_v_child_leftedges; + __pyx_t_5numpy_float64_t __pyx_v_cx; + __pyx_t_5numpy_float64_t __pyx_v_cy; + __pyx_t_5numpy_float64_t __pyx_v_cz; + PyObject *__pyx_v_s; + Py_buffer __pyx_bstruct_leftedges; + Py_ssize_t __pyx_bstride_0_leftedges = 0; + Py_ssize_t __pyx_bshape_0_leftedges = 0; + Py_buffer __pyx_bstruct_refined; + Py_ssize_t __pyx_bstride_0_refined = 0; + Py_ssize_t __pyx_bshape_0_refined = 0; + Py_buffer __pyx_bstruct_child_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; + Py_ssize_t __pyx_bstride_2_child_indices = 0; + 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_fields; + Py_ssize_t __pyx_bstride_0_fields = 0; + Py_ssize_t __pyx_bstride_1_fields = 0; + Py_ssize_t __pyx_bstride_2_fields = 0; + Py_ssize_t __pyx_bstride_3_fields = 0; + Py_ssize_t __pyx_bshape_0_fields = 0; + Py_ssize_t __pyx_bshape_1_fields = 0; + Py_ssize_t __pyx_bshape_2_fields = 0; + Py_ssize_t __pyx_bshape_3_fields = 0; + Py_buffer __pyx_bstruct_output; + Py_ssize_t __pyx_bstride_0_output = 0; + Py_ssize_t __pyx_bstride_1_output = 0; + Py_ssize_t __pyx_bshape_0_output = 0; + Py_ssize_t __pyx_bshape_1_output = 0; + PyObject *__pyx_r = NULL; + long __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyArrayObject *__pyx_t_3 = NULL; + PyArrayObject *__pyx_t_4 = NULL; + PyArrayObject *__pyx_t_5 = NULL; + PyArrayObject *__pyx_t_6 = NULL; + __pyx_t_5numpy_float64_t __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + long __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + long __pyx_t_15; + PyObject *__pyx_t_16 = NULL; + PyObject *__pyx_t_17 = NULL; + PyObject *__pyx_t_18 = NULL; + int __pyx_t_19; + int __pyx_t_20; + npy_intp __pyx_t_21; + int __pyx_t_22; + int __pyx_t_23; + int __pyx_t_24; + int __pyx_t_25; + int __pyx_t_26; + int __pyx_t_27; + int __pyx_t_28; + long __pyx_t_29; + PyArrayObject *__pyx_t_30 = NULL; + int __pyx_t_31; + PyObject *__pyx_t_32 = NULL; + PyObject *__pyx_t_33 = NULL; + PyObject *__pyx_t_34 = NULL; + long __pyx_t_35; + long __pyx_t_36; + PyObject *__pyx_t_37 = NULL; + PyObject *__pyx_t_38 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__i_i,&__pyx_n_s__j_i,&__pyx_n_s__k_i,&__pyx_n_s__i_f,&__pyx_n_s__j_f,&__pyx_n_s__k_f,&__pyx_n_s__curpos,&__pyx_n_s__gi,&__pyx_n_s__output,&__pyx_n_s__refined,&__pyx_n_s__grids,0}; + __Pyx_RefNannySetupContext("RecurseOctreeDepthFirst"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); + case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); + case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i_i); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__j_i); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("RecurseOctreeDepthFirst", 1, 11, 11, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__k_i); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("RecurseOctreeDepthFirst", 1, 11, 11, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i_f); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("RecurseOctreeDepthFirst", 1, 11, 11, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__j_f); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("RecurseOctreeDepthFirst", 1, 11, 11, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__k_f); + if (likely(values[5])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("RecurseOctreeDepthFirst", 1, 11, 11, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 6: + values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__curpos); + if (likely(values[6])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("RecurseOctreeDepthFirst", 1, 11, 11, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 7: + values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__gi); + if (likely(values[7])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("RecurseOctreeDepthFirst", 1, 11, 11, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 8: + values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__output); + if (likely(values[8])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("RecurseOctreeDepthFirst", 1, 11, 11, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 9: + values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__refined); + if (likely(values[9])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("RecurseOctreeDepthFirst", 1, 11, 11, 9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 10: + values[10] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grids); + if (likely(values[10])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("RecurseOctreeDepthFirst", 1, 11, 11, 10); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "RecurseOctreeDepthFirst") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_i_i = __Pyx_PyInt_AsInt(values[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_AsInt(values[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_AsInt(values[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_AsInt(values[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_AsInt(values[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_AsInt(values[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_9amr_utils_position *)values[6]); + __pyx_v_gi = __Pyx_PyInt_AsInt(values[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 *)values[8]); + __pyx_v_refined = ((PyArrayObject *)values[9]); + __pyx_v_grids = ((struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)values[10]); + } else if (PyTuple_GET_SIZE(__pyx_args) != 11) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_i_i = __Pyx_PyInt_AsInt(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_AsInt(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_AsInt(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_AsInt(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_AsInt(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_AsInt(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_9amr_utils_position *)PyTuple_GET_ITEM(__pyx_args, 6)); + __pyx_v_gi = __Pyx_PyInt_AsInt(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_9amr_utils_OctreeGridList *)PyTuple_GET_ITEM(__pyx_args, 10)); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("RecurseOctreeDepthFirst", 1, 11, 11, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.RecurseOctreeDepthFirst"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_child_grid = ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_child_leftedges = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_s = Py_None; __Pyx_INCREF(Py_None); + __pyx_bstruct_child_indices.buf = NULL; + __pyx_bstruct_dimensions.buf = NULL; + __pyx_bstruct_fields.buf = NULL; + __pyx_bstruct_leftedges.buf = NULL; + __pyx_bstruct_child_leftedges.buf = NULL; + __pyx_bstruct_output.buf = NULL; + __pyx_bstruct_refined.buf = NULL; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_curpos), __pyx_ptype_2yt_9amr_utils_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_9amr_utils_OctreeGridList, 1, "grids", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_output, (PyObject*)__pyx_v_output, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -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]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_refined, (PyObject*)__pyx_v_refined, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_refined = __pyx_bstruct_refined.strides[0]; + __pyx_bshape_0_refined = __pyx_bstruct_refined.shape[0]; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":71 + * cdef int child_i, child_j, child_k + * cdef OctreeGrid child_grid + * cdef OctreeGrid grid = grids[gi-1] # <<<<<<<<<<<<<< + * cdef np.ndarray[np.int32_t, ndim=3] child_indices = grid.child_indices + * cdef np.ndarray[np.int32_t, ndim=1] dimensions = grid.dimensions + */ + __pyx_t_1 = (__pyx_v_gi - 1); + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_grids), __pyx_t_1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_2yt_9amr_utils_OctreeGrid))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_grid = ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":72 + * cdef OctreeGrid child_grid + * cdef OctreeGrid grid = grids[gi-1] + * cdef np.ndarray[np.int32_t, ndim=3] child_indices = grid.child_indices # <<<<<<<<<<<<<< + * cdef np.ndarray[np.int32_t, ndim=1] dimensions = grid.dimensions + * cdef np.ndarray[np.float64_t, ndim=4] fields = grid.fields + */ + if (!(likely(((__pyx_v_grid->child_indices) == Py_None) || likely(__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_3 = ((PyArrayObject *)__pyx_v_grid->child_indices); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_child_indices, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) { + __pyx_v_child_indices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_child_indices.buf = NULL; + {__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]; + } + } + __pyx_t_3 = 0; + __Pyx_INCREF(__pyx_v_grid->child_indices); + __pyx_v_child_indices = ((PyArrayObject *)__pyx_v_grid->child_indices); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/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 (!(likely(((__pyx_v_grid->dimensions) == Py_None) || likely(__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_4 = ((PyArrayObject *)__pyx_v_grid->dimensions); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dimensions, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_dimensions = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_dimensions.buf = NULL; + {__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]; + } + } + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_v_grid->dimensions); + __pyx_v_dimensions = ((PyArrayObject *)__pyx_v_grid->dimensions); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/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.float64_t dx = grid.dx[0] + */ + if (!(likely(((__pyx_v_grid->fields) == Py_None) || likely(__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_5 = ((PyArrayObject *)__pyx_v_grid->fields); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_fields, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) { + __pyx_v_fields = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_fields.buf = NULL; + {__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]; + } + } + __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_v_grid->fields); + __pyx_v_fields = ((PyArrayObject *)__pyx_v_grid->fields); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/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.float64_t dx = grid.dx[0] + * cdef np.float64_t child_dx + */ + if (!(likely(((__pyx_v_grid->left_edges) == Py_None) || likely(__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_6 = ((PyArrayObject *)__pyx_v_grid->left_edges); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_leftedges, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_leftedges = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_leftedges.buf = NULL; + {__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]; + } + } + __pyx_t_6 = 0; + __Pyx_INCREF(__pyx_v_grid->left_edges); + __pyx_v_leftedges = ((PyArrayObject *)__pyx_v_grid->left_edges); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/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.float64_t dx = grid.dx[0] # <<<<<<<<<<<<<< + * cdef np.float64_t child_dx + * cdef np.ndarray[np.float64_t, ndim=1] child_leftedges + */ + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_grid->dx, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_7 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_dx = __pyx_t_7; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":80 + * cdef np.ndarray[np.float64_t, ndim=1] child_leftedges + * cdef np.float64_t cx, cy, cz + * for k_off in range(k_f): # <<<<<<<<<<<<<< + * k = k_off + k_i + * cz = (leftedges[2] + k*dx) + */ + __pyx_t_8 = __pyx_v_k_f; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_k_off = __pyx_t_9; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":81 + * cdef np.float64_t cx, cy, cz + * for k_off in range(k_f): + * k = k_off + k_i # <<<<<<<<<<<<<< + * cz = (leftedges[2] + k*dx) + * for j_off in range(j_f): + */ + __pyx_v_k = (__pyx_v_k_off + __pyx_v_k_i); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":82 + * for k_off in range(k_f): + * k = k_off + k_i + * cz = (leftedges[2] + k*dx) # <<<<<<<<<<<<<< + * for j_off in range(j_f): + * j = j_off + j_i + */ + __pyx_t_1 = 2; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_bshape_0_leftedges; + __pyx_v_cz = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_leftedges.buf, __pyx_t_1, __pyx_bstride_0_leftedges)) + (__pyx_v_k * __pyx_v_dx)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":83 + * k = k_off + k_i + * cz = (leftedges[2] + k*dx) + * for j_off in range(j_f): # <<<<<<<<<<<<<< + * j = j_off + j_i + * cy = (leftedges[1] + j*dx) + */ + __pyx_t_10 = __pyx_v_j_f; + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { + __pyx_v_j_off = __pyx_t_11; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":84 + * cz = (leftedges[2] + k*dx) + * for j_off in range(j_f): + * j = j_off + j_i # <<<<<<<<<<<<<< + * cy = (leftedges[1] + j*dx) + * for i_off in range(i_f): + */ + __pyx_v_j = (__pyx_v_j_off + __pyx_v_j_i); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":85 + * for j_off in range(j_f): + * j = j_off + j_i + * cy = (leftedges[1] + j*dx) # <<<<<<<<<<<<<< + * for i_off in range(i_f): + * i = i_off + i_i + */ + __pyx_t_12 = 1; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_bshape_0_leftedges; + __pyx_v_cy = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_leftedges.buf, __pyx_t_12, __pyx_bstride_0_leftedges)) + (__pyx_v_j * __pyx_v_dx)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":86 + * j = j_off + j_i + * cy = (leftedges[1] + j*dx) + * for i_off in range(i_f): # <<<<<<<<<<<<<< + * i = i_off + i_i + * cx = (leftedges[0] + i*dx) + */ + __pyx_t_13 = __pyx_v_i_f; + for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { + __pyx_v_i_off = __pyx_t_14; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":87 + * cy = (leftedges[1] + j*dx) + * for i_off in range(i_f): + * i = i_off + i_i # <<<<<<<<<<<<<< + * cx = (leftedges[0] + i*dx) + * ci = grid.child_indices[i,j,k] + */ + __pyx_v_i = (__pyx_v_i_off + __pyx_v_i_i); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":88 + * for i_off in range(i_f): + * i = i_off + i_i + * cx = (leftedges[0] + i*dx) # <<<<<<<<<<<<<< + * ci = grid.child_indices[i,j,k] + * if ci == -1: + */ + __pyx_t_15 = 0; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_0_leftedges; + __pyx_v_cx = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_leftedges.buf, __pyx_t_15, __pyx_bstride_0_leftedges)) + (__pyx_v_i * __pyx_v_dx)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":89 + * i = i_off + i_i + * cx = (leftedges[0] + i*dx) + * ci = grid.child_indices[i,j,k] # <<<<<<<<<<<<<< + * if ci == -1: + * for fi in range(fields.shape[0]): + */ + __pyx_t_2 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_16 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_17 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_18 = PyTuple_New(3); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_16); + __Pyx_GIVEREF(__pyx_t_16); + PyTuple_SET_ITEM(__pyx_t_18, 2, __pyx_t_17); + __Pyx_GIVEREF(__pyx_t_17); + __pyx_t_2 = 0; + __pyx_t_16 = 0; + __pyx_t_17 = 0; + __pyx_t_17 = PyObject_GetItem(__pyx_v_grid->child_indices, __pyx_t_18); if (!__pyx_t_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_17); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_19 = __Pyx_PyInt_AsInt(__pyx_t_17); if (unlikely((__pyx_t_19 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __pyx_v_ci = __pyx_t_19; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":90 + * cx = (leftedges[0] + i*dx) + * 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_t_20 = (__pyx_v_ci == -1); + if (__pyx_t_20) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":91 + * 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_t_21 = (__pyx_v_fields->dimensions[0]); + for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_21; __pyx_t_19+=1) { + __pyx_v_fi = __pyx_t_19; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":92 + * 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_22 = __pyx_v_fi; + __pyx_t_23 = __pyx_v_i; + __pyx_t_24 = __pyx_v_j; + __pyx_t_25 = __pyx_v_k; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_bshape_0_fields; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_bshape_1_fields; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_bshape_2_fields; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_bshape_3_fields; + __pyx_t_26 = __pyx_v_curpos->output_pos; + __pyx_t_27 = __pyx_v_fi; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_bshape_0_output; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_bshape_1_output; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_output.buf, __pyx_t_26, __pyx_bstride_0_output, __pyx_t_27, __pyx_bstride_1_output) = (*__Pyx_BufPtrStrided4d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_fields.buf, __pyx_t_22, __pyx_bstride_0_fields, __pyx_t_23, __pyx_bstride_1_fields, __pyx_t_24, __pyx_bstride_2_fields, __pyx_t_25, __pyx_bstride_3_fields)); + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":93 + * 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_19 = __pyx_v_curpos->refined_pos; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_bshape_0_refined; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_refined.buf, __pyx_t_19, __pyx_bstride_0_refined) = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":94 + * 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; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":95 + * refined[curpos.refined_pos] = 0 + * curpos.output_pos += 1 + * curpos.refined_pos += 1 # <<<<<<<<<<<<<< + * else: + * refined[curpos.refined_pos] = 1 + */ + __pyx_v_curpos->refined_pos += 1; + goto __pyx_L12; + } + /*else*/ { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":97 + * curpos.refined_pos += 1 + * else: + * refined[curpos.refined_pos] = 1 # <<<<<<<<<<<<<< + * curpos.refined_pos += 1 + * child_grid = grids[ci-1] + */ + __pyx_t_28 = __pyx_v_curpos->refined_pos; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_bshape_0_refined; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_refined.buf, __pyx_t_28, __pyx_bstride_0_refined) = 1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":98 + * else: + * refined[curpos.refined_pos] = 1 + * curpos.refined_pos += 1 # <<<<<<<<<<<<<< + * child_grid = grids[ci-1] + * child_dx = child_grid.dx[0] + */ + __pyx_v_curpos->refined_pos += 1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":99 + * refined[curpos.refined_pos] = 1 + * curpos.refined_pos += 1 + * child_grid = grids[ci-1] # <<<<<<<<<<<<<< + * child_dx = child_grid.dx[0] + * child_leftedges = child_grid.left_edges + */ + __pyx_t_29 = (__pyx_v_ci - 1); + __pyx_t_17 = __Pyx_GetItemInt(((PyObject *)__pyx_v_grids), __pyx_t_29, sizeof(long), PyInt_FromLong); if (!__pyx_t_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_17); + if (!(likely(((__pyx_t_17) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_17, __pyx_ptype_2yt_9amr_utils_OctreeGrid))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_child_grid)); + __pyx_v_child_grid = ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_t_17); + __pyx_t_17 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":100 + * curpos.refined_pos += 1 + * child_grid = grids[ci-1] + * child_dx = child_grid.dx[0] # <<<<<<<<<<<<<< + * child_leftedges = child_grid.left_edges + * child_i = int((cx - child_leftedges[0])/child_dx) + */ + __pyx_t_17 = __Pyx_GetItemInt(__pyx_v_child_grid->dx, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_17); if (unlikely((__pyx_t_7 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __pyx_v_child_dx = __pyx_t_7; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":101 + * child_grid = grids[ci-1] + * child_dx = child_grid.dx[0] + * child_leftedges = child_grid.left_edges # <<<<<<<<<<<<<< + * child_i = int((cx - child_leftedges[0])/child_dx) + * child_j = int((cy - child_leftedges[1])/child_dx) + */ + if (!(likely(((__pyx_v_child_grid->left_edges) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_child_grid->left_edges, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_30 = ((PyArrayObject *)__pyx_v_child_grid->left_edges); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_child_leftedges); + __pyx_t_31 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_child_leftedges, (PyObject*)__pyx_t_30, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_31 < 0)) { + PyErr_Fetch(&__pyx_t_32, &__pyx_t_33, &__pyx_t_34); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_child_leftedges, (PyObject*)__pyx_v_child_leftedges, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_32); Py_XDECREF(__pyx_t_33); Py_XDECREF(__pyx_t_34); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_32, __pyx_t_33, __pyx_t_34); + } + } + __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_31 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_30 = 0; + __Pyx_INCREF(__pyx_v_child_grid->left_edges); + __Pyx_DECREF(((PyObject *)__pyx_v_child_leftedges)); + __pyx_v_child_leftedges = ((PyArrayObject *)__pyx_v_child_grid->left_edges); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":102 + * child_dx = child_grid.dx[0] + * child_leftedges = child_grid.left_edges + * child_i = int((cx - child_leftedges[0])/child_dx) # <<<<<<<<<<<<<< + * child_j = int((cy - child_leftedges[1])/child_dx) + * child_k = int((cz - child_leftedges[2])/child_dx) + */ + __pyx_t_29 = 0; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_bshape_0_child_leftedges; + __pyx_t_7 = (__pyx_v_cx - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_child_leftedges.buf, __pyx_t_29, __pyx_bstride_0_child_leftedges))); + if (unlikely(__pyx_v_child_dx == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_child_i = ((int)(__pyx_t_7 / __pyx_v_child_dx)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":103 + * child_leftedges = child_grid.left_edges + * child_i = int((cx - child_leftedges[0])/child_dx) + * child_j = int((cy - child_leftedges[1])/child_dx) # <<<<<<<<<<<<<< + * child_k = int((cz - child_leftedges[2])/child_dx) + * s = RecurseOctreeDepthFirst(child_i, child_j, child_k, 2, 2, 2, + */ + __pyx_t_35 = 1; + if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_bshape_0_child_leftedges; + __pyx_t_7 = (__pyx_v_cy - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_child_leftedges.buf, __pyx_t_35, __pyx_bstride_0_child_leftedges))); + if (unlikely(__pyx_v_child_dx == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_child_j = ((int)(__pyx_t_7 / __pyx_v_child_dx)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":104 + * child_i = int((cx - child_leftedges[0])/child_dx) + * child_j = int((cy - child_leftedges[1])/child_dx) + * child_k = int((cz - child_leftedges[2])/child_dx) # <<<<<<<<<<<<<< + * s = RecurseOctreeDepthFirst(child_i, child_j, child_k, 2, 2, 2, + * curpos, ci, output, refined, grids) + */ + __pyx_t_36 = 2; + if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_bshape_0_child_leftedges; + __pyx_t_7 = (__pyx_v_cz - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_child_leftedges.buf, __pyx_t_36, __pyx_bstride_0_child_leftedges))); + if (unlikely(__pyx_v_child_dx == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_child_k = ((int)(__pyx_t_7 / __pyx_v_child_dx)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":105 + * child_j = int((cy - child_leftedges[1])/child_dx) + * child_k = int((cz - child_leftedges[2])/child_dx) + * s = RecurseOctreeDepthFirst(child_i, child_j, child_k, 2, 2, 2, # <<<<<<<<<<<<<< + * curpos, ci, output, refined, grids) + * return s + */ + __pyx_t_17 = __Pyx_GetName(__pyx_m, __pyx_n_s_1); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_18 = PyInt_FromLong(__pyx_v_child_i); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_16 = PyInt_FromLong(__pyx_v_child_j); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_2 = PyInt_FromLong(__pyx_v_child_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":106 + * child_k = int((cz - child_leftedges[2])/child_dx) + * s = RecurseOctreeDepthFirst(child_i, child_j, child_k, 2, 2, 2, + * curpos, ci, output, refined, grids) # <<<<<<<<<<<<<< + * return s + * + */ + __pyx_t_37 = PyInt_FromLong(__pyx_v_ci); if (unlikely(!__pyx_t_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_37); + __pyx_t_38 = PyTuple_New(11); if (unlikely(!__pyx_t_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_38); + PyTuple_SET_ITEM(__pyx_t_38, 0, __pyx_t_18); + __Pyx_GIVEREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_38, 1, __pyx_t_16); + __Pyx_GIVEREF(__pyx_t_16); + PyTuple_SET_ITEM(__pyx_t_38, 2, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_int_2); + PyTuple_SET_ITEM(__pyx_t_38, 3, __pyx_int_2); + __Pyx_GIVEREF(__pyx_int_2); + __Pyx_INCREF(__pyx_int_2); + PyTuple_SET_ITEM(__pyx_t_38, 4, __pyx_int_2); + __Pyx_GIVEREF(__pyx_int_2); + __Pyx_INCREF(__pyx_int_2); + PyTuple_SET_ITEM(__pyx_t_38, 5, __pyx_int_2); + __Pyx_GIVEREF(__pyx_int_2); + __Pyx_INCREF(((PyObject *)__pyx_v_curpos)); + PyTuple_SET_ITEM(__pyx_t_38, 6, ((PyObject *)__pyx_v_curpos)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_curpos)); + PyTuple_SET_ITEM(__pyx_t_38, 7, __pyx_t_37); + __Pyx_GIVEREF(__pyx_t_37); + __Pyx_INCREF(((PyObject *)__pyx_v_output)); + PyTuple_SET_ITEM(__pyx_t_38, 8, ((PyObject *)__pyx_v_output)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_output)); + __Pyx_INCREF(((PyObject *)__pyx_v_refined)); + PyTuple_SET_ITEM(__pyx_t_38, 9, ((PyObject *)__pyx_v_refined)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_refined)); + __Pyx_INCREF(((PyObject *)__pyx_v_grids)); + PyTuple_SET_ITEM(__pyx_t_38, 10, ((PyObject *)__pyx_v_grids)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_grids)); + __pyx_t_18 = 0; + __pyx_t_16 = 0; + __pyx_t_2 = 0; + __pyx_t_37 = 0; + __pyx_t_37 = PyObject_Call(__pyx_t_17, __pyx_t_38, NULL); if (unlikely(!__pyx_t_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_37); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_DECREF(__pyx_t_38); __pyx_t_38 = 0; + __Pyx_DECREF(__pyx_v_s); + __pyx_v_s = __pyx_t_37; + __pyx_t_37 = 0; + } + __pyx_L12:; + } + } + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":107 + * s = RecurseOctreeDepthFirst(child_i, child_j, child_k, 2, 2, 2, + * curpos, ci, output, refined, grids) + * return s # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_s); + __pyx_r = __pyx_v_s; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_16); + __Pyx_XDECREF(__pyx_t_17); + __Pyx_XDECREF(__pyx_t_18); + __Pyx_XDECREF(__pyx_t_37); + __Pyx_XDECREF(__pyx_t_38); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_leftedges); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_refined); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_child_leftedges); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dimensions); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_child_indices); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fields); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.amr_utils.RecurseOctreeDepthFirst"); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_leftedges); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_refined); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_child_leftedges); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dimensions); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_child_indices); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fields); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output); + __pyx_L2:; + __Pyx_DECREF((PyObject *)__pyx_v_child_grid); + __Pyx_XDECREF((PyObject *)__pyx_v_grid); + __Pyx_XDECREF((PyObject *)__pyx_v_child_indices); + __Pyx_XDECREF((PyObject *)__pyx_v_dimensions); + __Pyx_XDECREF((PyObject *)__pyx_v_fields); + __Pyx_XDECREF((PyObject *)__pyx_v_leftedges); + __Pyx_DECREF((PyObject *)__pyx_v_child_leftedges); + __Pyx_DECREF(__pyx_v_s); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":110 + * + * @cython.boundscheck(False) + * def RecurseOctreeByLevels(int i_i, int j_i, int k_i, # <<<<<<<<<<<<<< + * int i_f, int j_f, int k_f, + * np.ndarray[np.int32_t, ndim=1] curpos, + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_RecurseOctreeByLevels(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_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; + int __pyx_v_i_f; + int __pyx_v_j_f; + int __pyx_v_k_f; + PyArrayObject *__pyx_v_curpos = 0; + int __pyx_v_gi; + PyArrayObject *__pyx_v_output = 0; + PyArrayObject *__pyx_v_genealogy = 0; + PyArrayObject *__pyx_v_corners = 0; + struct __pyx_obj_2yt_9amr_utils_OctreeGridList *__pyx_v_grids = 0; + __pyx_t_5numpy_int32_t __pyx_v_i; + __pyx_t_5numpy_int32_t __pyx_v_i_off; + __pyx_t_5numpy_int32_t __pyx_v_j; + __pyx_t_5numpy_int32_t __pyx_v_j_off; + __pyx_t_5numpy_int32_t __pyx_v_k; + __pyx_t_5numpy_int32_t __pyx_v_k_off; + __pyx_t_5numpy_int32_t __pyx_v_ci; + __pyx_t_5numpy_int32_t __pyx_v_fi; + int __pyx_v_child_i; + int __pyx_v_child_j; + int __pyx_v_child_k; + struct __pyx_obj_2yt_9amr_utils_OctreeGrid *__pyx_v_child_grid; + struct __pyx_obj_2yt_9amr_utils_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; + PyArrayObject *__pyx_v_leftedges = 0; + __pyx_t_5numpy_float64_t __pyx_v_dx; + __pyx_t_5numpy_float64_t __pyx_v_child_dx; + PyArrayObject *__pyx_v_child_leftedges; + __pyx_t_5numpy_float64_t __pyx_v_cx; + __pyx_t_5numpy_float64_t __pyx_v_cy; + __pyx_t_5numpy_float64_t __pyx_v_cz; + int __pyx_v_cp; + PyObject *__pyx_v_s; + Py_buffer __pyx_bstruct_leftedges; + Py_ssize_t __pyx_bstride_0_leftedges = 0; + Py_ssize_t __pyx_bshape_0_leftedges = 0; + Py_buffer __pyx_bstruct_curpos; + Py_ssize_t __pyx_bstride_0_curpos = 0; + Py_ssize_t __pyx_bshape_0_curpos = 0; + Py_buffer __pyx_bstruct_child_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; + Py_ssize_t __pyx_bstride_2_child_indices = 0; + 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_corners; + Py_ssize_t __pyx_bstride_0_corners = 0; + Py_ssize_t __pyx_bstride_1_corners = 0; + Py_ssize_t __pyx_bshape_0_corners = 0; + Py_ssize_t __pyx_bshape_1_corners = 0; + Py_buffer __pyx_bstruct_fields; + Py_ssize_t __pyx_bstride_0_fields = 0; + Py_ssize_t __pyx_bstride_1_fields = 0; + Py_ssize_t __pyx_bstride_2_fields = 0; + Py_ssize_t __pyx_bstride_3_fields = 0; + Py_ssize_t __pyx_bshape_0_fields = 0; + Py_ssize_t __pyx_bshape_1_fields = 0; + Py_ssize_t __pyx_bshape_2_fields = 0; + Py_ssize_t __pyx_bshape_3_fields = 0; + Py_buffer __pyx_bstruct_output; + Py_ssize_t __pyx_bstride_0_output = 0; + Py_ssize_t __pyx_bstride_1_output = 0; + Py_ssize_t __pyx_bshape_0_output = 0; + Py_ssize_t __pyx_bshape_1_output = 0; + PyObject *__pyx_r = NULL; + long __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyArrayObject *__pyx_t_3 = NULL; + PyArrayObject *__pyx_t_4 = NULL; + PyArrayObject *__pyx_t_5 = NULL; + PyArrayObject *__pyx_t_6 = NULL; + __pyx_t_5numpy_float64_t __pyx_t_7; + int __pyx_t_8; + __pyx_t_5numpy_int32_t __pyx_t_9; + int __pyx_t_10; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + int __pyx_t_13; + __pyx_t_5numpy_int32_t __pyx_t_14; + long __pyx_t_15; + int __pyx_t_16; + __pyx_t_5numpy_int32_t __pyx_t_17; + long __pyx_t_18; + int __pyx_t_19; + int __pyx_t_20; + long __pyx_t_21; + int __pyx_t_22; + long __pyx_t_23; + int __pyx_t_24; + long __pyx_t_25; + int __pyx_t_26; + __pyx_t_5numpy_int32_t __pyx_t_27; + long __pyx_t_28; + npy_intp __pyx_t_29; + __pyx_t_5numpy_int32_t __pyx_t_30; + __pyx_t_5numpy_int32_t __pyx_t_31; + __pyx_t_5numpy_int32_t __pyx_t_32; + __pyx_t_5numpy_int32_t __pyx_t_33; + __pyx_t_5numpy_int32_t __pyx_t_34; + int __pyx_t_35; + __pyx_t_5numpy_int32_t __pyx_t_36; + __pyx_t_5numpy_int32_t __pyx_t_37; + __pyx_t_5numpy_int32_t __pyx_t_38; + long __pyx_t_39; + PyArrayObject *__pyx_t_40 = NULL; + int __pyx_t_41; + PyObject *__pyx_t_42 = NULL; + PyObject *__pyx_t_43 = NULL; + PyObject *__pyx_t_44 = NULL; + long __pyx_t_45; + long __pyx_t_46; + long __pyx_t_47; + long __pyx_t_48; + long __pyx_t_49; + long __pyx_t_50; + PyObject *__pyx_t_51 = NULL; + PyObject *__pyx_t_52 = NULL; + PyObject *__pyx_t_53 = NULL; + int __pyx_t_54; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__i_i,&__pyx_n_s__j_i,&__pyx_n_s__k_i,&__pyx_n_s__i_f,&__pyx_n_s__j_f,&__pyx_n_s__k_f,&__pyx_n_s__curpos,&__pyx_n_s__gi,&__pyx_n_s__output,&__pyx_n_s__genealogy,&__pyx_n_s__corners,&__pyx_n_s__grids,0}; + __Pyx_RefNannySetupContext("RecurseOctreeByLevels"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); + case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); + case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); + case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i_i); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__j_i); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("RecurseOctreeByLevels", 1, 12, 12, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__k_i); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("RecurseOctreeByLevels", 1, 12, 12, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i_f); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("RecurseOctreeByLevels", 1, 12, 12, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__j_f); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("RecurseOctreeByLevels", 1, 12, 12, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__k_f); + if (likely(values[5])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("RecurseOctreeByLevels", 1, 12, 12, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 6: + values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__curpos); + if (likely(values[6])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("RecurseOctreeByLevels", 1, 12, 12, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 7: + values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__gi); + if (likely(values[7])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("RecurseOctreeByLevels", 1, 12, 12, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 8: + values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__output); + if (likely(values[8])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("RecurseOctreeByLevels", 1, 12, 12, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 9: + values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__genealogy); + if (likely(values[9])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("RecurseOctreeByLevels", 1, 12, 12, 9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 10: + values[10] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__corners); + if (likely(values[10])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("RecurseOctreeByLevels", 1, 12, 12, 10); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 11: + values[11] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grids); + if (likely(values[11])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("RecurseOctreeByLevels", 1, 12, 12, 11); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "RecurseOctreeByLevels") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_i_i = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_i_i == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_j_i = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_j_i == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_k_i = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_k_i == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_i_f = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_i_f == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_j_f = __Pyx_PyInt_AsInt(values[4]); if (unlikely((__pyx_v_j_f == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_k_f = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_k_f == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_curpos = ((PyArrayObject *)values[6]); + __pyx_v_gi = __Pyx_PyInt_AsInt(values[7]); if (unlikely((__pyx_v_gi == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_output = ((PyArrayObject *)values[8]); + __pyx_v_genealogy = ((PyArrayObject *)values[9]); + __pyx_v_corners = ((PyArrayObject *)values[10]); + __pyx_v_grids = ((struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)values[11]); + } else if (PyTuple_GET_SIZE(__pyx_args) != 12) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_i_i = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_i_i == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_j_i = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_j_i == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_k_i = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_k_i == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_i_f = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_i_f == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_j_f = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_j_f == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_k_f = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_k_f == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_curpos = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 6)); + __pyx_v_gi = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 7)); if (unlikely((__pyx_v_gi == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_output = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 8)); + __pyx_v_genealogy = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 9)); + __pyx_v_corners = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 10)); + __pyx_v_grids = ((struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)PyTuple_GET_ITEM(__pyx_args, 11)); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("RecurseOctreeByLevels", 1, 12, 12, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.RecurseOctreeByLevels"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_child_grid = ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_child_leftedges = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_s = Py_None; __Pyx_INCREF(Py_None); + __pyx_bstruct_child_indices.buf = NULL; + __pyx_bstruct_dimensions.buf = NULL; + __pyx_bstruct_fields.buf = NULL; + __pyx_bstruct_leftedges.buf = NULL; + __pyx_bstruct_child_leftedges.buf = NULL; + __pyx_bstruct_curpos.buf = NULL; + __pyx_bstruct_output.buf = NULL; + __pyx_bstruct_genealogy.buf = NULL; + __pyx_bstruct_corners.buf = NULL; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_curpos), __pyx_ptype_5numpy_ndarray, 1, "curpos", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_output), __pyx_ptype_5numpy_ndarray, 1, "output", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_genealogy), __pyx_ptype_5numpy_ndarray, 1, "genealogy", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_corners), __pyx_ptype_5numpy_ndarray, 1, "corners", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grids), __pyx_ptype_2yt_9amr_utils_OctreeGridList, 1, "grids", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_curpos, (PyObject*)__pyx_v_curpos, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_curpos = __pyx_bstruct_curpos.strides[0]; + __pyx_bshape_0_curpos = __pyx_bstruct_curpos.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_output, (PyObject*)__pyx_v_output, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_output = __pyx_bstruct_output.strides[0]; __pyx_bstride_1_output = __pyx_bstruct_output.strides[1]; + __pyx_bshape_0_output = __pyx_bstruct_output.shape[0]; __pyx_bshape_1_output = __pyx_bstruct_output.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_genealogy, (PyObject*)__pyx_v_genealogy, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_genealogy = __pyx_bstruct_genealogy.strides[0]; __pyx_bstride_1_genealogy = __pyx_bstruct_genealogy.strides[1]; + __pyx_bshape_0_genealogy = __pyx_bstruct_genealogy.shape[0]; __pyx_bshape_1_genealogy = __pyx_bstruct_genealogy.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_corners, (PyObject*)__pyx_v_corners, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_corners = __pyx_bstruct_corners.strides[0]; __pyx_bstride_1_corners = __pyx_bstruct_corners.strides[1]; + __pyx_bshape_0_corners = __pyx_bstruct_corners.shape[0]; __pyx_bshape_1_corners = __pyx_bstruct_corners.shape[1]; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":121 + * 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 + */ + __pyx_t_1 = (__pyx_v_gi - 1); + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_grids), __pyx_t_1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_2yt_9amr_utils_OctreeGrid))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_grid = ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":122 + * 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/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":123 + * 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 (!(likely(((__pyx_v_grid->child_indices) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_grid->child_indices, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((PyArrayObject *)__pyx_v_grid->child_indices); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_child_indices, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) { + __pyx_v_child_indices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_child_indices.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_bstride_0_child_indices = __pyx_bstruct_child_indices.strides[0]; __pyx_bstride_1_child_indices = __pyx_bstruct_child_indices.strides[1]; __pyx_bstride_2_child_indices = __pyx_bstruct_child_indices.strides[2]; + __pyx_bshape_0_child_indices = __pyx_bstruct_child_indices.shape[0]; __pyx_bshape_1_child_indices = __pyx_bstruct_child_indices.shape[1]; __pyx_bshape_2_child_indices = __pyx_bstruct_child_indices.shape[2]; + } + } + __pyx_t_3 = 0; + __Pyx_INCREF(__pyx_v_grid->child_indices); + __pyx_v_child_indices = ((PyArrayObject *)__pyx_v_grid->child_indices); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":124 + * 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 (!(likely(((__pyx_v_grid->dimensions) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_grid->dimensions, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = ((PyArrayObject *)__pyx_v_grid->dimensions); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dimensions, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_dimensions = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_dimensions.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_bstride_0_dimensions = __pyx_bstruct_dimensions.strides[0]; + __pyx_bshape_0_dimensions = __pyx_bstruct_dimensions.shape[0]; + } + } + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_v_grid->dimensions); + __pyx_v_dimensions = ((PyArrayObject *)__pyx_v_grid->dimensions); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":125 + * 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.float64_t dx = grid.dx[0] + */ + if (!(likely(((__pyx_v_grid->fields) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_grid->fields, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = ((PyArrayObject *)__pyx_v_grid->fields); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_fields, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) { + __pyx_v_fields = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_fields.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_bstride_0_fields = __pyx_bstruct_fields.strides[0]; __pyx_bstride_1_fields = __pyx_bstruct_fields.strides[1]; __pyx_bstride_2_fields = __pyx_bstruct_fields.strides[2]; __pyx_bstride_3_fields = __pyx_bstruct_fields.strides[3]; + __pyx_bshape_0_fields = __pyx_bstruct_fields.shape[0]; __pyx_bshape_1_fields = __pyx_bstruct_fields.shape[1]; __pyx_bshape_2_fields = __pyx_bstruct_fields.shape[2]; __pyx_bshape_3_fields = __pyx_bstruct_fields.shape[3]; + } + } + __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_v_grid->fields); + __pyx_v_fields = ((PyArrayObject *)__pyx_v_grid->fields); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":126 + * 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.float64_t dx = grid.dx[0] + * cdef np.float64_t child_dx + */ + if (!(likely(((__pyx_v_grid->left_edges) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_grid->left_edges, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = ((PyArrayObject *)__pyx_v_grid->left_edges); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_leftedges, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_leftedges = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_leftedges.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_bstride_0_leftedges = __pyx_bstruct_leftedges.strides[0]; + __pyx_bshape_0_leftedges = __pyx_bstruct_leftedges.shape[0]; + } + } + __pyx_t_6 = 0; + __Pyx_INCREF(__pyx_v_grid->left_edges); + __pyx_v_leftedges = ((PyArrayObject *)__pyx_v_grid->left_edges); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":127 + * 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.float64_t dx = grid.dx[0] # <<<<<<<<<<<<<< + * cdef np.float64_t child_dx + * cdef np.ndarray[np.float64_t, ndim=1] child_leftedges + */ + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_grid->dx, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_7 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_dx = __pyx_t_7; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":132 + * cdef np.float64_t cx, cy, cz + * cdef int cp + * for i_off in range(i_f): # <<<<<<<<<<<<<< + * i = i_off + i_i + * cx = (leftedges[0] + i*dx) + */ + __pyx_t_8 = __pyx_v_i_f; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i_off = __pyx_t_9; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":133 + * cdef int cp + * for i_off in range(i_f): + * i = i_off + i_i # <<<<<<<<<<<<<< + * cx = (leftedges[0] + i*dx) + * if i_f > 2: print k, cz + */ + __pyx_v_i = (__pyx_v_i_off + __pyx_v_i_i); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":134 + * for i_off in range(i_f): + * i = i_off + i_i + * cx = (leftedges[0] + i*dx) # <<<<<<<<<<<<<< + * if i_f > 2: print k, cz + * for j_off in range(j_f): + */ + __pyx_t_1 = 0; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_bshape_0_leftedges; + __pyx_v_cx = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_leftedges.buf, __pyx_t_1, __pyx_bstride_0_leftedges)) + (__pyx_v_i * __pyx_v_dx)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":135 + * i = i_off + i_i + * cx = (leftedges[0] + i*dx) + * if i_f > 2: print k, cz # <<<<<<<<<<<<<< + * for j_off in range(j_f): + * j = j_off + j_i + */ + __pyx_t_10 = (__pyx_v_i_f > 2); + if (__pyx_t_10) { + __pyx_t_2 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_11 = PyFloat_FromDouble(__pyx_v_cz); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + __pyx_t_2 = 0; + __pyx_t_11 = 0; + if (__Pyx_Print(0, __pyx_t_12, 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + goto __pyx_L8; + } + __pyx_L8:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":136 + * cx = (leftedges[0] + i*dx) + * if i_f > 2: print k, cz + * for j_off in range(j_f): # <<<<<<<<<<<<<< + * j = j_off + j_i + * cy = (leftedges[1] + j*dx) + */ + __pyx_t_13 = __pyx_v_j_f; + for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { + __pyx_v_j_off = __pyx_t_14; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":137 + * if i_f > 2: print k, cz + * for j_off in range(j_f): + * j = j_off + j_i # <<<<<<<<<<<<<< + * cy = (leftedges[1] + j*dx) + * for k_off in range(k_f): + */ + __pyx_v_j = (__pyx_v_j_off + __pyx_v_j_i); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":138 + * for j_off in range(j_f): + * j = j_off + j_i + * cy = (leftedges[1] + j*dx) # <<<<<<<<<<<<<< + * for k_off in range(k_f): + * k = k_off + k_i + */ + __pyx_t_15 = 1; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_0_leftedges; + __pyx_v_cy = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_leftedges.buf, __pyx_t_15, __pyx_bstride_0_leftedges)) + (__pyx_v_j * __pyx_v_dx)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":139 + * j = j_off + j_i + * cy = (leftedges[1] + j*dx) + * for k_off in range(k_f): # <<<<<<<<<<<<<< + * k = k_off + k_i + * cz = (leftedges[2] + k*dx) + */ + __pyx_t_16 = __pyx_v_k_f; + for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { + __pyx_v_k_off = __pyx_t_17; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":140 + * cy = (leftedges[1] + j*dx) + * for k_off in range(k_f): + * k = k_off + k_i # <<<<<<<<<<<<<< + * cz = (leftedges[2] + k*dx) + * cp = curpos[level] + */ + __pyx_v_k = (__pyx_v_k_off + __pyx_v_k_i); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":141 + * for k_off in range(k_f): + * k = k_off + k_i + * cz = (leftedges[2] + k*dx) # <<<<<<<<<<<<<< + * cp = curpos[level] + * corners[cp, 0] = cx + */ + __pyx_t_18 = 2; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_bshape_0_leftedges; + __pyx_v_cz = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_leftedges.buf, __pyx_t_18, __pyx_bstride_0_leftedges)) + (__pyx_v_k * __pyx_v_dx)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":142 + * k = k_off + k_i + * cz = (leftedges[2] + k*dx) + * cp = curpos[level] # <<<<<<<<<<<<<< + * corners[cp, 0] = cx + * corners[cp, 1] = cy + */ + __pyx_t_19 = __pyx_v_level; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_bshape_0_curpos; + __pyx_v_cp = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_curpos.buf, __pyx_t_19, __pyx_bstride_0_curpos)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":143 + * cz = (leftedges[2] + k*dx) + * cp = curpos[level] + * corners[cp, 0] = cx # <<<<<<<<<<<<<< + * corners[cp, 1] = cy + * corners[cp, 2] = cz + */ + __pyx_t_20 = __pyx_v_cp; + __pyx_t_21 = 0; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_bshape_0_corners; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_bshape_1_corners; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_corners.buf, __pyx_t_20, __pyx_bstride_0_corners, __pyx_t_21, __pyx_bstride_1_corners) = __pyx_v_cx; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":144 + * cp = curpos[level] + * corners[cp, 0] = cx + * corners[cp, 1] = cy # <<<<<<<<<<<<<< + * corners[cp, 2] = cz + * genealogy[curpos[level], 2] = level + */ + __pyx_t_22 = __pyx_v_cp; + __pyx_t_23 = 1; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_bshape_0_corners; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_bshape_1_corners; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_corners.buf, __pyx_t_22, __pyx_bstride_0_corners, __pyx_t_23, __pyx_bstride_1_corners) = __pyx_v_cy; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":145 + * corners[cp, 0] = cx + * corners[cp, 1] = cy + * corners[cp, 2] = cz # <<<<<<<<<<<<<< + * genealogy[curpos[level], 2] = level + * # always output data + */ + __pyx_t_24 = __pyx_v_cp; + __pyx_t_25 = 2; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_bshape_0_corners; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_bshape_1_corners; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_corners.buf, __pyx_t_24, __pyx_bstride_0_corners, __pyx_t_25, __pyx_bstride_1_corners) = __pyx_v_cz; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":146 + * corners[cp, 1] = cy + * corners[cp, 2] = cz + * genealogy[curpos[level], 2] = level # <<<<<<<<<<<<<< + * # always output data + * for fi in range(fields.shape[0]): + */ + __pyx_t_26 = __pyx_v_level; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_bshape_0_curpos; + __pyx_t_27 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_curpos.buf, __pyx_t_26, __pyx_bstride_0_curpos)); + __pyx_t_28 = 2; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_bshape_0_genealogy; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_bshape_1_genealogy; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_genealogy.buf, __pyx_t_27, __pyx_bstride_0_genealogy, __pyx_t_28, __pyx_bstride_1_genealogy) = __pyx_v_level; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":148 + * genealogy[curpos[level], 2] = level + * # always output data + * for fi in range(fields.shape[0]): # <<<<<<<<<<<<<< + * output[cp,fi] = fields[fi,i,j,k] + * ci = child_indices[i,j,k] + */ + __pyx_t_29 = (__pyx_v_fields->dimensions[0]); + for (__pyx_t_30 = 0; __pyx_t_30 < __pyx_t_29; __pyx_t_30+=1) { + __pyx_v_fi = __pyx_t_30; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":149 + * # always output data + * for fi in range(fields.shape[0]): + * output[cp,fi] = fields[fi,i,j,k] # <<<<<<<<<<<<<< + * ci = child_indices[i,j,k] + * if ci > -1: + */ + __pyx_t_31 = __pyx_v_fi; + __pyx_t_32 = __pyx_v_i; + __pyx_t_33 = __pyx_v_j; + __pyx_t_34 = __pyx_v_k; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_bshape_0_fields; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_bshape_1_fields; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_bshape_2_fields; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_bshape_3_fields; + __pyx_t_35 = __pyx_v_cp; + __pyx_t_36 = __pyx_v_fi; + if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_bshape_0_output; + if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_bshape_1_output; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_output.buf, __pyx_t_35, __pyx_bstride_0_output, __pyx_t_36, __pyx_bstride_1_output) = (*__Pyx_BufPtrStrided4d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_fields.buf, __pyx_t_31, __pyx_bstride_0_fields, __pyx_t_32, __pyx_bstride_1_fields, __pyx_t_33, __pyx_bstride_2_fields, __pyx_t_34, __pyx_bstride_3_fields)); + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":150 + * for fi in range(fields.shape[0]): + * output[cp,fi] = fields[fi,i,j,k] + * ci = child_indices[i,j,k] # <<<<<<<<<<<<<< + * if ci > -1: + * child_grid = grids[ci-1] + */ + __pyx_t_30 = __pyx_v_i; + __pyx_t_37 = __pyx_v_j; + __pyx_t_38 = __pyx_v_k; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_bshape_0_child_indices; + if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_bshape_1_child_indices; + if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_bshape_2_child_indices; + __pyx_v_ci = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_child_indices.buf, __pyx_t_30, __pyx_bstride_0_child_indices, __pyx_t_37, __pyx_bstride_1_child_indices, __pyx_t_38, __pyx_bstride_2_child_indices)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":151 + * output[cp,fi] = fields[fi,i,j,k] + * ci = child_indices[i,j,k] + * if ci > -1: # <<<<<<<<<<<<<< + * child_grid = grids[ci-1] + * child_dx = child_grid.dx[0] + */ + __pyx_t_10 = (__pyx_v_ci > -1); + if (__pyx_t_10) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":152 + * ci = child_indices[i,j,k] + * if ci > -1: + * child_grid = grids[ci-1] # <<<<<<<<<<<<<< + * child_dx = child_grid.dx[0] + * child_leftedges = child_grid.left_edges + */ + __pyx_t_39 = (__pyx_v_ci - 1); + __pyx_t_12 = __Pyx_GetItemInt(((PyObject *)__pyx_v_grids), __pyx_t_39, sizeof(long), PyInt_FromLong); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_2yt_9amr_utils_OctreeGrid))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_child_grid)); + __pyx_v_child_grid = ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)__pyx_t_12); + __pyx_t_12 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":153 + * if ci > -1: + * child_grid = grids[ci-1] + * child_dx = child_grid.dx[0] # <<<<<<<<<<<<<< + * child_leftedges = child_grid.left_edges + * child_i = int((cx-child_leftedges[0])/child_dx) + */ + __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_child_grid->dx, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_7 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_v_child_dx = __pyx_t_7; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":154 + * child_grid = grids[ci-1] + * child_dx = child_grid.dx[0] + * child_leftedges = child_grid.left_edges # <<<<<<<<<<<<<< + * child_i = int((cx-child_leftedges[0])/child_dx) + * child_j = int((cy-child_leftedges[1])/child_dx) + */ + if (!(likely(((__pyx_v_child_grid->left_edges) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_child_grid->left_edges, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_40 = ((PyArrayObject *)__pyx_v_child_grid->left_edges); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_child_leftedges); + __pyx_t_41 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_child_leftedges, (PyObject*)__pyx_t_40, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_41 < 0)) { + PyErr_Fetch(&__pyx_t_42, &__pyx_t_43, &__pyx_t_44); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_child_leftedges, (PyObject*)__pyx_v_child_leftedges, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_42); Py_XDECREF(__pyx_t_43); Py_XDECREF(__pyx_t_44); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_42, __pyx_t_43, __pyx_t_44); + } + } + __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_41 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_40 = 0; + __Pyx_INCREF(__pyx_v_child_grid->left_edges); + __Pyx_DECREF(((PyObject *)__pyx_v_child_leftedges)); + __pyx_v_child_leftedges = ((PyArrayObject *)__pyx_v_child_grid->left_edges); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":155 + * child_dx = child_grid.dx[0] + * child_leftedges = child_grid.left_edges + * child_i = int((cx-child_leftedges[0])/child_dx) # <<<<<<<<<<<<<< + * child_j = int((cy-child_leftedges[1])/child_dx) + * child_k = int((cz-child_leftedges[2])/child_dx) + */ + __pyx_t_39 = 0; + if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_bshape_0_child_leftedges; + __pyx_t_7 = (__pyx_v_cx - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_child_leftedges.buf, __pyx_t_39, __pyx_bstride_0_child_leftedges))); + if (unlikely(__pyx_v_child_dx == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_child_i = ((int)(__pyx_t_7 / __pyx_v_child_dx)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":156 + * child_leftedges = child_grid.left_edges + * child_i = int((cx-child_leftedges[0])/child_dx) + * child_j = int((cy-child_leftedges[1])/child_dx) # <<<<<<<<<<<<<< + * child_k = int((cz-child_leftedges[2])/child_dx) + * # set current child id to id of next cell to examine + */ + __pyx_t_45 = 1; + if (__pyx_t_45 < 0) __pyx_t_45 += __pyx_bshape_0_child_leftedges; + __pyx_t_7 = (__pyx_v_cy - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_child_leftedges.buf, __pyx_t_45, __pyx_bstride_0_child_leftedges))); + if (unlikely(__pyx_v_child_dx == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_child_j = ((int)(__pyx_t_7 / __pyx_v_child_dx)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":157 + * child_i = int((cx-child_leftedges[0])/child_dx) + * child_j = int((cy-child_leftedges[1])/child_dx) + * child_k = int((cz-child_leftedges[2])/child_dx) # <<<<<<<<<<<<<< + * # set current child id to id of next cell to examine + * genealogy[cp, 0] = curpos[level+1] + */ + __pyx_t_46 = 2; + if (__pyx_t_46 < 0) __pyx_t_46 += __pyx_bshape_0_child_leftedges; + __pyx_t_7 = (__pyx_v_cz - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_child_leftedges.buf, __pyx_t_46, __pyx_bstride_0_child_leftedges))); + if (unlikely(__pyx_v_child_dx == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_child_k = ((int)(__pyx_t_7 / __pyx_v_child_dx)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":159 + * child_k = int((cz-child_leftedges[2])/child_dx) + * # set current child id to id of next cell to examine + * genealogy[cp, 0] = curpos[level+1] # <<<<<<<<<<<<<< + * # set next parent id to id of current cell + * genealogy[curpos[level+1]:curpos[level+1]+8, 1] = cp + */ + __pyx_t_47 = (__pyx_v_level + 1); + if (__pyx_t_47 < 0) __pyx_t_47 += __pyx_bshape_0_curpos; + __pyx_t_41 = __pyx_v_cp; + __pyx_t_48 = 0; + if (__pyx_t_41 < 0) __pyx_t_41 += __pyx_bshape_0_genealogy; + if (__pyx_t_48 < 0) __pyx_t_48 += __pyx_bshape_1_genealogy; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_genealogy.buf, __pyx_t_41, __pyx_bstride_0_genealogy, __pyx_t_48, __pyx_bstride_1_genealogy) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_curpos.buf, __pyx_t_47, __pyx_bstride_0_curpos)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":161 + * genealogy[cp, 0] = curpos[level+1] + * # set next parent id to id of current cell + * genealogy[curpos[level+1]:curpos[level+1]+8, 1] = cp # <<<<<<<<<<<<<< + * s = RecurseOctreeByLevels(child_i, child_j, child_k, 2, 2, 2, + * curpos, ci, output, genealogy, + */ + __pyx_t_12 = PyInt_FromLong(__pyx_v_cp); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_49 = (__pyx_v_level + 1); + if (__pyx_t_49 < 0) __pyx_t_49 += __pyx_bshape_0_curpos; + __pyx_t_11 = __Pyx_PyInt_to_py_npy_int32((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_curpos.buf, __pyx_t_49, __pyx_bstride_0_curpos))); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_50 = (__pyx_v_level + 1); + if (__pyx_t_50 < 0) __pyx_t_50 += __pyx_bshape_0_curpos; + __pyx_t_2 = PyInt_FromLong(((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_curpos.buf, __pyx_t_50, __pyx_bstride_0_curpos)) + 8)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_51 = PySlice_New(__pyx_t_11, __pyx_t_2, Py_None); if (unlikely(!__pyx_t_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_51); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_51); + __Pyx_GIVEREF(__pyx_t_51); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __pyx_t_51 = 0; + if (PyObject_SetItem(((PyObject *)__pyx_v_genealogy), __pyx_t_2, __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":162 + * # set next parent id to id of current cell + * genealogy[curpos[level+1]:curpos[level+1]+8, 1] = cp + * s = RecurseOctreeByLevels(child_i, child_j, child_k, 2, 2, 2, # <<<<<<<<<<<<<< + * curpos, ci, output, genealogy, + * corners, grids) + */ + __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s_2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_2 = PyInt_FromLong(__pyx_v_child_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_51 = PyInt_FromLong(__pyx_v_child_j); if (unlikely(!__pyx_t_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_51); + __pyx_t_11 = PyInt_FromLong(__pyx_v_child_k); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":163 + * genealogy[curpos[level+1]:curpos[level+1]+8, 1] = cp + * s = RecurseOctreeByLevels(child_i, child_j, child_k, 2, 2, 2, + * curpos, ci, output, genealogy, # <<<<<<<<<<<<<< + * corners, grids) + * curpos[level] += 1 + */ + __pyx_t_52 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_ci); if (unlikely(!__pyx_t_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_52); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":164 + * s = RecurseOctreeByLevels(child_i, child_j, child_k, 2, 2, 2, + * curpos, ci, output, genealogy, + * corners, grids) # <<<<<<<<<<<<<< + * curpos[level] += 1 + * return s + */ + __pyx_t_53 = PyTuple_New(12); if (unlikely(!__pyx_t_53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_53); + PyTuple_SET_ITEM(__pyx_t_53, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_53, 1, __pyx_t_51); + __Pyx_GIVEREF(__pyx_t_51); + PyTuple_SET_ITEM(__pyx_t_53, 2, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + __Pyx_INCREF(__pyx_int_2); + PyTuple_SET_ITEM(__pyx_t_53, 3, __pyx_int_2); + __Pyx_GIVEREF(__pyx_int_2); + __Pyx_INCREF(__pyx_int_2); + PyTuple_SET_ITEM(__pyx_t_53, 4, __pyx_int_2); + __Pyx_GIVEREF(__pyx_int_2); + __Pyx_INCREF(__pyx_int_2); + PyTuple_SET_ITEM(__pyx_t_53, 5, __pyx_int_2); + __Pyx_GIVEREF(__pyx_int_2); + __Pyx_INCREF(((PyObject *)__pyx_v_curpos)); + PyTuple_SET_ITEM(__pyx_t_53, 6, ((PyObject *)__pyx_v_curpos)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_curpos)); + PyTuple_SET_ITEM(__pyx_t_53, 7, __pyx_t_52); + __Pyx_GIVEREF(__pyx_t_52); + __Pyx_INCREF(((PyObject *)__pyx_v_output)); + PyTuple_SET_ITEM(__pyx_t_53, 8, ((PyObject *)__pyx_v_output)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_output)); + __Pyx_INCREF(((PyObject *)__pyx_v_genealogy)); + PyTuple_SET_ITEM(__pyx_t_53, 9, ((PyObject *)__pyx_v_genealogy)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_genealogy)); + __Pyx_INCREF(((PyObject *)__pyx_v_corners)); + PyTuple_SET_ITEM(__pyx_t_53, 10, ((PyObject *)__pyx_v_corners)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_corners)); + __Pyx_INCREF(((PyObject *)__pyx_v_grids)); + PyTuple_SET_ITEM(__pyx_t_53, 11, ((PyObject *)__pyx_v_grids)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_grids)); + __pyx_t_2 = 0; + __pyx_t_51 = 0; + __pyx_t_11 = 0; + __pyx_t_52 = 0; + __pyx_t_52 = PyObject_Call(__pyx_t_12, __pyx_t_53, NULL); if (unlikely(!__pyx_t_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_52); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_53); __pyx_t_53 = 0; + __Pyx_DECREF(__pyx_v_s); + __pyx_v_s = __pyx_t_52; + __pyx_t_52 = 0; + goto __pyx_L15; + } + __pyx_L15:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":165 + * curpos, ci, output, genealogy, + * corners, grids) + * curpos[level] += 1 # <<<<<<<<<<<<<< + * return s + * + */ + __pyx_t_54 = __pyx_v_level; + if (__pyx_t_54 < 0) __pyx_t_54 += __pyx_bshape_0_curpos; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_curpos.buf, __pyx_t_54, __pyx_bstride_0_curpos) += 1; + } + } + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":166 + * corners, grids) + * curpos[level] += 1 + * return s # <<<<<<<<<<<<<< + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_s); + __pyx_r = __pyx_v_s; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_51); + __Pyx_XDECREF(__pyx_t_52); + __Pyx_XDECREF(__pyx_t_53); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_leftedges); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_curpos); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_child_leftedges); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dimensions); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_child_indices); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_genealogy); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_corners); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fields); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.amr_utils.RecurseOctreeByLevels"); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_leftedges); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_curpos); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_child_leftedges); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dimensions); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_child_indices); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_genealogy); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_corners); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fields); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output); + __pyx_L2:; + __Pyx_DECREF((PyObject *)__pyx_v_child_grid); + __Pyx_XDECREF((PyObject *)__pyx_v_grid); + __Pyx_XDECREF((PyObject *)__pyx_v_child_indices); + __Pyx_XDECREF((PyObject *)__pyx_v_dimensions); + __Pyx_XDECREF((PyObject *)__pyx_v_fields); + __Pyx_XDECREF((PyObject *)__pyx_v_leftedges); + __Pyx_DECREF((PyObject *)__pyx_v_child_leftedges); + __Pyx_DECREF(__pyx_v_s); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":31 + * + * @cython.boundscheck(False) + * def UnilinearlyInterpolate(np.ndarray[np.float64_t, ndim=1] table, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t, ndim=1] x_vals, + * np.ndarray[np.float64_t, ndim=1] x_bins, + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_UnilinearlyInterpolate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_UnilinearlyInterpolate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_table = 0; + PyArrayObject *__pyx_v_x_vals = 0; + PyArrayObject *__pyx_v_x_bins = 0; + PyArrayObject *__pyx_v_x_is = 0; + PyArrayObject *__pyx_v_output = 0; + double __pyx_v_x; + double __pyx_v_xp; + double __pyx_v_xm; + int __pyx_v_i; + int __pyx_v_x_i; + PyObject *__pyx_v_dx_inv; + Py_buffer __pyx_bstruct_x_is; + Py_ssize_t __pyx_bstride_0_x_is = 0; + Py_ssize_t __pyx_bshape_0_x_is = 0; + Py_buffer __pyx_bstruct_output; + Py_ssize_t __pyx_bstride_0_output = 0; + Py_ssize_t __pyx_bshape_0_output = 0; + Py_buffer __pyx_bstruct_x_vals; + Py_ssize_t __pyx_bstride_0_x_vals = 0; + Py_ssize_t __pyx_bshape_0_x_vals = 0; + Py_buffer __pyx_bstruct_table; + Py_ssize_t __pyx_bstride_0_table = 0; + Py_ssize_t __pyx_bshape_0_table = 0; + Py_buffer __pyx_bstruct_x_bins; + Py_ssize_t __pyx_bstride_0_x_bins = 0; + Py_ssize_t __pyx_bshape_0_x_bins = 0; + PyObject *__pyx_r = NULL; + npy_intp __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + long __pyx_t_5; + int __pyx_t_6; + __pyx_t_5numpy_float64_t __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + double __pyx_t_11; + long __pyx_t_12; + int __pyx_t_13; + long __pyx_t_14; + int __pyx_t_15; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__table,&__pyx_n_s__x_vals,&__pyx_n_s__x_bins,&__pyx_n_s__x_is,&__pyx_n_s__output,0}; + __Pyx_RefNannySetupContext("UnilinearlyInterpolate"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[5] = {0,0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__table); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x_vals); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("UnilinearlyInterpolate", 1, 5, 5, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x_bins); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("UnilinearlyInterpolate", 1, 5, 5, 2); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x_is); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("UnilinearlyInterpolate", 1, 5, 5, 3); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__output); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("UnilinearlyInterpolate", 1, 5, 5, 4); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "UnilinearlyInterpolate") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_table = ((PyArrayObject *)values[0]); + __pyx_v_x_vals = ((PyArrayObject *)values[1]); + __pyx_v_x_bins = ((PyArrayObject *)values[2]); + __pyx_v_x_is = ((PyArrayObject *)values[3]); + __pyx_v_output = ((PyArrayObject *)values[4]); + } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_table = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); + __pyx_v_x_vals = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); + __pyx_v_x_bins = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); + __pyx_v_x_is = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); + __pyx_v_output = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("UnilinearlyInterpolate", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.UnilinearlyInterpolate"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_dx_inv = Py_None; __Pyx_INCREF(Py_None); + __pyx_bstruct_table.buf = NULL; + __pyx_bstruct_x_vals.buf = NULL; + __pyx_bstruct_x_bins.buf = NULL; + __pyx_bstruct_x_is.buf = NULL; + __pyx_bstruct_output.buf = NULL; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_table), __pyx_ptype_5numpy_ndarray, 1, "table", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x_vals), __pyx_ptype_5numpy_ndarray, 1, "x_vals", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x_bins), __pyx_ptype_5numpy_ndarray, 1, "x_bins", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x_is), __pyx_ptype_5numpy_ndarray, 1, "x_is", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 34; __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[3]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_table, (PyObject*)__pyx_v_table, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_table = __pyx_bstruct_table.strides[0]; + __pyx_bshape_0_table = __pyx_bstruct_table.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x_vals, (PyObject*)__pyx_v_x_vals, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_x_vals = __pyx_bstruct_x_vals.strides[0]; + __pyx_bshape_0_x_vals = __pyx_bstruct_x_vals.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x_bins, (PyObject*)__pyx_v_x_bins, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_x_bins = __pyx_bstruct_x_bins.strides[0]; + __pyx_bshape_0_x_bins = __pyx_bstruct_x_bins.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x_is, (PyObject*)__pyx_v_x_is, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_x_is = __pyx_bstruct_x_is.strides[0]; + __pyx_bshape_0_x_is = __pyx_bstruct_x_is.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_output, (PyObject*)__pyx_v_output, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_output = __pyx_bstruct_output.strides[0]; + __pyx_bshape_0_output = __pyx_bstruct_output.shape[0]; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":38 + * cdef double x, xp, xm + * cdef int i, x_i, y_i + * for i in range(x_vals.shape[0]): # <<<<<<<<<<<<<< + * x_i = x_is[i] + * x = x_vals[i] + */ + __pyx_t_1 = (__pyx_v_x_vals->dimensions[0]); + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":39 + * cdef int i, x_i, y_i + * for i in range(x_vals.shape[0]): + * x_i = x_is[i] # <<<<<<<<<<<<<< + * x = x_vals[i] + * dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) + */ + __pyx_t_3 = __pyx_v_i; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_bshape_0_x_is; + __pyx_v_x_i = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_x_is.buf, __pyx_t_3, __pyx_bstride_0_x_is)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":40 + * for i in range(x_vals.shape[0]): + * x_i = x_is[i] + * x = x_vals[i] # <<<<<<<<<<<<<< + * dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) + * xp = (x - x_bins[x_i]) * dx_inv + */ + __pyx_t_4 = __pyx_v_i; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_bshape_0_x_vals; + __pyx_v_x = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x_vals.buf, __pyx_t_4, __pyx_bstride_0_x_vals)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":41 + * x_i = x_is[i] + * x = x_vals[i] + * dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) # <<<<<<<<<<<<<< + * xp = (x - x_bins[x_i]) * dx_inv + * xm = (x_bins[x_i+1] - x) * dx_inv + */ + __pyx_t_5 = (__pyx_v_x_i + 1); + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_bshape_0_x_bins; + __pyx_t_6 = __pyx_v_x_i; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_bshape_0_x_bins; + __pyx_t_7 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x_bins.buf, __pyx_t_5, __pyx_bstride_0_x_bins)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x_bins.buf, __pyx_t_6, __pyx_bstride_0_x_bins))); + if (unlikely(__pyx_t_7 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_8 = PyFloat_FromDouble((1.0 / __pyx_t_7)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_v_dx_inv); + __pyx_v_dx_inv = __pyx_t_8; + __pyx_t_8 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":42 + * x = x_vals[i] + * dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) + * xp = (x - x_bins[x_i]) * dx_inv # <<<<<<<<<<<<<< + * xm = (x_bins[x_i+1] - x) * dx_inv + * output[i] = table[x_i ] * (xm) \ + */ + __pyx_t_9 = __pyx_v_x_i; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_bshape_0_x_bins; + __pyx_t_8 = PyFloat_FromDouble((__pyx_v_x - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x_bins.buf, __pyx_t_9, __pyx_bstride_0_x_bins)))); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_10 = PyNumber_Multiply(__pyx_t_8, __pyx_v_dx_inv); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_10); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_v_xp = __pyx_t_11; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":43 + * dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) + * xp = (x - x_bins[x_i]) * dx_inv + * xm = (x_bins[x_i+1] - x) * dx_inv # <<<<<<<<<<<<<< + * output[i] = table[x_i ] * (xm) \ + * + table[x_i+1] * (xp) + */ + __pyx_t_12 = (__pyx_v_x_i + 1); + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_bshape_0_x_bins; + __pyx_t_10 = PyFloat_FromDouble(((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x_bins.buf, __pyx_t_12, __pyx_bstride_0_x_bins)) - __pyx_v_x)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_8 = PyNumber_Multiply(__pyx_t_10, __pyx_v_dx_inv); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_xm = __pyx_t_11; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":44 + * xp = (x - x_bins[x_i]) * dx_inv + * xm = (x_bins[x_i+1] - x) * dx_inv + * output[i] = table[x_i ] * (xm) \ # <<<<<<<<<<<<<< + * + table[x_i+1] * (xp) + * + */ + __pyx_t_13 = __pyx_v_x_i; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_bshape_0_table; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":45 + * xm = (x_bins[x_i+1] - x) * dx_inv + * output[i] = table[x_i ] * (xm) \ + * + table[x_i+1] * (xp) # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + __pyx_t_14 = (__pyx_v_x_i + 1); + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_0_table; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":44 + * xp = (x - x_bins[x_i]) * dx_inv + * xm = (x_bins[x_i+1] - x) * dx_inv + * output[i] = table[x_i ] * (xm) \ # <<<<<<<<<<<<<< + * + table[x_i+1] * (xp) + * + */ + __pyx_t_15 = __pyx_v_i; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_0_output; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_output.buf, __pyx_t_15, __pyx_bstride_0_output) = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_table.buf, __pyx_t_13, __pyx_bstride_0_table)) * __pyx_v_xm) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_table.buf, __pyx_t_14, __pyx_bstride_0_table)) * __pyx_v_xp)); + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_10); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_is); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_vals); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_table); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_bins); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.amr_utils.UnilinearlyInterpolate"); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_is); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_vals); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_table); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_bins); + __pyx_L2:; + __Pyx_DECREF(__pyx_v_dx_inv); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":48 + * + * @cython.boundscheck(False) + * def BilinearlyInterpolate(np.ndarray[np.float64_t, ndim=2] table, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t, ndim=1] x_vals, + * np.ndarray[np.float64_t, ndim=1] y_vals, + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_BilinearlyInterpolate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_BilinearlyInterpolate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_table = 0; + PyArrayObject *__pyx_v_x_vals = 0; + PyArrayObject *__pyx_v_y_vals = 0; + PyArrayObject *__pyx_v_x_bins = 0; + PyArrayObject *__pyx_v_y_bins = 0; + PyArrayObject *__pyx_v_x_is = 0; + PyArrayObject *__pyx_v_y_is = 0; + PyArrayObject *__pyx_v_output = 0; + double __pyx_v_x; + double __pyx_v_xp; + double __pyx_v_xm; + double __pyx_v_y; + double __pyx_v_yp; + double __pyx_v_ym; + double __pyx_v_dx_inv; + double __pyx_v_dy_inv; + int __pyx_v_i; + int __pyx_v_x_i; + int __pyx_v_y_i; + Py_buffer __pyx_bstruct_y_vals; + Py_ssize_t __pyx_bstride_0_y_vals = 0; + Py_ssize_t __pyx_bshape_0_y_vals = 0; + Py_buffer __pyx_bstruct_output; + Py_ssize_t __pyx_bstride_0_output = 0; + Py_ssize_t __pyx_bshape_0_output = 0; + Py_buffer __pyx_bstruct_y_is; + Py_ssize_t __pyx_bstride_0_y_is = 0; + Py_ssize_t __pyx_bshape_0_y_is = 0; + Py_buffer __pyx_bstruct_y_bins; + Py_ssize_t __pyx_bstride_0_y_bins = 0; + Py_ssize_t __pyx_bshape_0_y_bins = 0; + Py_buffer __pyx_bstruct_x_is; + Py_ssize_t __pyx_bstride_0_x_is = 0; + Py_ssize_t __pyx_bshape_0_x_is = 0; + Py_buffer __pyx_bstruct_x_vals; + Py_ssize_t __pyx_bstride_0_x_vals = 0; + Py_ssize_t __pyx_bshape_0_x_vals = 0; + Py_buffer __pyx_bstruct_table; + Py_ssize_t __pyx_bstride_0_table = 0; + Py_ssize_t __pyx_bstride_1_table = 0; + Py_ssize_t __pyx_bshape_0_table = 0; + Py_ssize_t __pyx_bshape_1_table = 0; + Py_buffer __pyx_bstruct_x_bins; + Py_ssize_t __pyx_bstride_0_x_bins = 0; + Py_ssize_t __pyx_bshape_0_x_bins = 0; + PyObject *__pyx_r = NULL; + npy_intp __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + long __pyx_t_7; + int __pyx_t_8; + __pyx_t_5numpy_float64_t __pyx_t_9; + long __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + long __pyx_t_14; + long __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + long __pyx_t_18; + int __pyx_t_19; + int __pyx_t_20; + long __pyx_t_21; + long __pyx_t_22; + long __pyx_t_23; + int __pyx_t_24; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__table,&__pyx_n_s__x_vals,&__pyx_n_s__y_vals,&__pyx_n_s__x_bins,&__pyx_n_s__y_bins,&__pyx_n_s__x_is,&__pyx_n_s__y_is,&__pyx_n_s__output,0}; + __Pyx_RefNannySetupContext("BilinearlyInterpolate"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[8] = {0,0,0,0,0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__table); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x_vals); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("BilinearlyInterpolate", 1, 8, 8, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y_vals); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("BilinearlyInterpolate", 1, 8, 8, 2); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x_bins); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("BilinearlyInterpolate", 1, 8, 8, 3); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y_bins); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("BilinearlyInterpolate", 1, 8, 8, 4); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x_is); + if (likely(values[5])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("BilinearlyInterpolate", 1, 8, 8, 5); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 6: + values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y_is); + if (likely(values[6])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("BilinearlyInterpolate", 1, 8, 8, 6); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 7: + values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__output); + if (likely(values[7])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("BilinearlyInterpolate", 1, 8, 8, 7); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "BilinearlyInterpolate") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_table = ((PyArrayObject *)values[0]); + __pyx_v_x_vals = ((PyArrayObject *)values[1]); + __pyx_v_y_vals = ((PyArrayObject *)values[2]); + __pyx_v_x_bins = ((PyArrayObject *)values[3]); + __pyx_v_y_bins = ((PyArrayObject *)values[4]); + __pyx_v_x_is = ((PyArrayObject *)values[5]); + __pyx_v_y_is = ((PyArrayObject *)values[6]); + __pyx_v_output = ((PyArrayObject *)values[7]); + } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_table = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); + __pyx_v_x_vals = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); + __pyx_v_y_vals = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); + __pyx_v_x_bins = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); + __pyx_v_y_bins = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); + __pyx_v_x_is = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 5)); + __pyx_v_y_is = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 6)); + __pyx_v_output = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 7)); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("BilinearlyInterpolate", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.BilinearlyInterpolate"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_bstruct_table.buf = NULL; + __pyx_bstruct_x_vals.buf = NULL; + __pyx_bstruct_y_vals.buf = NULL; + __pyx_bstruct_x_bins.buf = NULL; + __pyx_bstruct_y_bins.buf = NULL; + __pyx_bstruct_x_is.buf = NULL; + __pyx_bstruct_y_is.buf = NULL; + __pyx_bstruct_output.buf = NULL; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_table), __pyx_ptype_5numpy_ndarray, 1, "table", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x_vals), __pyx_ptype_5numpy_ndarray, 1, "x_vals", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y_vals), __pyx_ptype_5numpy_ndarray, 1, "y_vals", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x_bins), __pyx_ptype_5numpy_ndarray, 1, "x_bins", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y_bins), __pyx_ptype_5numpy_ndarray, 1, "y_bins", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x_is), __pyx_ptype_5numpy_ndarray, 1, "x_is", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y_is), __pyx_ptype_5numpy_ndarray, 1, "y_is", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 54; __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[3]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_table, (PyObject*)__pyx_v_table, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_table = __pyx_bstruct_table.strides[0]; __pyx_bstride_1_table = __pyx_bstruct_table.strides[1]; + __pyx_bshape_0_table = __pyx_bstruct_table.shape[0]; __pyx_bshape_1_table = __pyx_bstruct_table.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x_vals, (PyObject*)__pyx_v_x_vals, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_x_vals = __pyx_bstruct_x_vals.strides[0]; + __pyx_bshape_0_x_vals = __pyx_bstruct_x_vals.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_y_vals, (PyObject*)__pyx_v_y_vals, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_y_vals = __pyx_bstruct_y_vals.strides[0]; + __pyx_bshape_0_y_vals = __pyx_bstruct_y_vals.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x_bins, (PyObject*)__pyx_v_x_bins, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_x_bins = __pyx_bstruct_x_bins.strides[0]; + __pyx_bshape_0_x_bins = __pyx_bstruct_x_bins.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_y_bins, (PyObject*)__pyx_v_y_bins, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_y_bins = __pyx_bstruct_y_bins.strides[0]; + __pyx_bshape_0_y_bins = __pyx_bstruct_y_bins.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x_is, (PyObject*)__pyx_v_x_is, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_x_is = __pyx_bstruct_x_is.strides[0]; + __pyx_bshape_0_x_is = __pyx_bstruct_x_is.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_y_is, (PyObject*)__pyx_v_y_is, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_y_is = __pyx_bstruct_y_is.strides[0]; + __pyx_bshape_0_y_is = __pyx_bstruct_y_is.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_output, (PyObject*)__pyx_v_output, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_output = __pyx_bstruct_output.strides[0]; + __pyx_bshape_0_output = __pyx_bstruct_output.shape[0]; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":60 + * cdef double dx_inv, dy_inv + * cdef int i, x_i, y_i + * for i in range(x_vals.shape[0]): # <<<<<<<<<<<<<< + * x_i = x_is[i] + * y_i = y_is[i] + */ + __pyx_t_1 = (__pyx_v_x_vals->dimensions[0]); + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":61 + * cdef int i, x_i, y_i + * for i in range(x_vals.shape[0]): + * x_i = x_is[i] # <<<<<<<<<<<<<< + * y_i = y_is[i] + * x = x_vals[i] + */ + __pyx_t_3 = __pyx_v_i; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_bshape_0_x_is; + __pyx_v_x_i = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_x_is.buf, __pyx_t_3, __pyx_bstride_0_x_is)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":62 + * for i in range(x_vals.shape[0]): + * x_i = x_is[i] + * y_i = y_is[i] # <<<<<<<<<<<<<< + * x = x_vals[i] + * y = y_vals[i] + */ + __pyx_t_4 = __pyx_v_i; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_bshape_0_y_is; + __pyx_v_y_i = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_y_is.buf, __pyx_t_4, __pyx_bstride_0_y_is)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":63 + * x_i = x_is[i] + * y_i = y_is[i] + * x = x_vals[i] # <<<<<<<<<<<<<< + * y = y_vals[i] + * dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) + */ + __pyx_t_5 = __pyx_v_i; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_bshape_0_x_vals; + __pyx_v_x = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x_vals.buf, __pyx_t_5, __pyx_bstride_0_x_vals)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":64 + * y_i = y_is[i] + * x = x_vals[i] + * y = y_vals[i] # <<<<<<<<<<<<<< + * dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) + * dy_inv = 1.0 / (y_bins[y_i+1] - y_bins[y_i]) + */ + __pyx_t_6 = __pyx_v_i; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_bshape_0_y_vals; + __pyx_v_y = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y_vals.buf, __pyx_t_6, __pyx_bstride_0_y_vals)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":65 + * x = x_vals[i] + * y = y_vals[i] + * dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) # <<<<<<<<<<<<<< + * dy_inv = 1.0 / (y_bins[y_i+1] - y_bins[y_i]) + * xp = (x - x_bins[x_i]) * dx_inv + */ + __pyx_t_7 = (__pyx_v_x_i + 1); + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_bshape_0_x_bins; + __pyx_t_8 = __pyx_v_x_i; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_bshape_0_x_bins; + __pyx_t_9 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x_bins.buf, __pyx_t_7, __pyx_bstride_0_x_bins)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x_bins.buf, __pyx_t_8, __pyx_bstride_0_x_bins))); + if (unlikely(__pyx_t_9 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_dx_inv = (1.0 / __pyx_t_9); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":66 + * y = y_vals[i] + * dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) + * dy_inv = 1.0 / (y_bins[y_i+1] - y_bins[y_i]) # <<<<<<<<<<<<<< + * xp = (x - x_bins[x_i]) * dx_inv + * yp = (y - y_bins[y_i]) * dy_inv + */ + __pyx_t_10 = (__pyx_v_y_i + 1); + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_bshape_0_y_bins; + __pyx_t_11 = __pyx_v_y_i; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_bshape_0_y_bins; + __pyx_t_9 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y_bins.buf, __pyx_t_10, __pyx_bstride_0_y_bins)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y_bins.buf, __pyx_t_11, __pyx_bstride_0_y_bins))); + if (unlikely(__pyx_t_9 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_dy_inv = (1.0 / __pyx_t_9); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":67 + * dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) + * dy_inv = 1.0 / (y_bins[y_i+1] - y_bins[y_i]) + * xp = (x - x_bins[x_i]) * dx_inv # <<<<<<<<<<<<<< + * yp = (y - y_bins[y_i]) * dy_inv + * xm = (x_bins[x_i+1] - x) * dx_inv + */ + __pyx_t_12 = __pyx_v_x_i; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_bshape_0_x_bins; + __pyx_v_xp = ((__pyx_v_x - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x_bins.buf, __pyx_t_12, __pyx_bstride_0_x_bins))) * __pyx_v_dx_inv); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":68 + * dy_inv = 1.0 / (y_bins[y_i+1] - y_bins[y_i]) + * xp = (x - x_bins[x_i]) * dx_inv + * yp = (y - y_bins[y_i]) * dy_inv # <<<<<<<<<<<<<< + * xm = (x_bins[x_i+1] - x) * dx_inv + * ym = (y_bins[y_i+1] - y) * dy_inv + */ + __pyx_t_13 = __pyx_v_y_i; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_bshape_0_y_bins; + __pyx_v_yp = ((__pyx_v_y - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y_bins.buf, __pyx_t_13, __pyx_bstride_0_y_bins))) * __pyx_v_dy_inv); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":69 + * xp = (x - x_bins[x_i]) * dx_inv + * yp = (y - y_bins[y_i]) * dy_inv + * xm = (x_bins[x_i+1] - x) * dx_inv # <<<<<<<<<<<<<< + * ym = (y_bins[y_i+1] - y) * dy_inv + * output[i] = table[x_i , y_i ] * (xm*ym) \ + */ + __pyx_t_14 = (__pyx_v_x_i + 1); + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_0_x_bins; + __pyx_v_xm = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x_bins.buf, __pyx_t_14, __pyx_bstride_0_x_bins)) - __pyx_v_x) * __pyx_v_dx_inv); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":70 + * yp = (y - y_bins[y_i]) * dy_inv + * xm = (x_bins[x_i+1] - x) * dx_inv + * ym = (y_bins[y_i+1] - y) * dy_inv # <<<<<<<<<<<<<< + * output[i] = table[x_i , y_i ] * (xm*ym) \ + * + table[x_i+1, y_i ] * (xp*ym) \ + */ + __pyx_t_15 = (__pyx_v_y_i + 1); + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_0_y_bins; + __pyx_v_ym = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y_bins.buf, __pyx_t_15, __pyx_bstride_0_y_bins)) - __pyx_v_y) * __pyx_v_dy_inv); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":71 + * xm = (x_bins[x_i+1] - x) * dx_inv + * ym = (y_bins[y_i+1] - y) * dy_inv + * output[i] = table[x_i , y_i ] * (xm*ym) \ # <<<<<<<<<<<<<< + * + table[x_i+1, y_i ] * (xp*ym) \ + * + table[x_i , y_i+1] * (xm*yp) \ + */ + __pyx_t_16 = __pyx_v_x_i; + __pyx_t_17 = __pyx_v_y_i; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_bshape_0_table; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_bshape_1_table; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":72 + * ym = (y_bins[y_i+1] - y) * dy_inv + * output[i] = table[x_i , y_i ] * (xm*ym) \ + * + table[x_i+1, y_i ] * (xp*ym) \ # <<<<<<<<<<<<<< + * + table[x_i , y_i+1] * (xm*yp) \ + * + table[x_i+1, y_i+1] * (xp*yp) + */ + __pyx_t_18 = (__pyx_v_x_i + 1); + __pyx_t_19 = __pyx_v_y_i; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_bshape_0_table; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_bshape_1_table; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":73 + * output[i] = table[x_i , y_i ] * (xm*ym) \ + * + table[x_i+1, y_i ] * (xp*ym) \ + * + table[x_i , y_i+1] * (xm*yp) \ # <<<<<<<<<<<<<< + * + table[x_i+1, y_i+1] * (xp*yp) + * + */ + __pyx_t_20 = __pyx_v_x_i; + __pyx_t_21 = (__pyx_v_y_i + 1); + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_bshape_0_table; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_bshape_1_table; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":74 + * + table[x_i+1, y_i ] * (xp*ym) \ + * + table[x_i , y_i+1] * (xm*yp) \ + * + table[x_i+1, y_i+1] * (xp*yp) # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + __pyx_t_22 = (__pyx_v_x_i + 1); + __pyx_t_23 = (__pyx_v_y_i + 1); + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_bshape_0_table; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_bshape_1_table; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":71 + * xm = (x_bins[x_i+1] - x) * dx_inv + * ym = (y_bins[y_i+1] - y) * dy_inv + * output[i] = table[x_i , y_i ] * (xm*ym) \ # <<<<<<<<<<<<<< + * + table[x_i+1, y_i ] * (xp*ym) \ + * + table[x_i , y_i+1] * (xm*yp) \ + */ + __pyx_t_24 = __pyx_v_i; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_bshape_0_output; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_output.buf, __pyx_t_24, __pyx_bstride_0_output) = (((((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_table.buf, __pyx_t_16, __pyx_bstride_0_table, __pyx_t_17, __pyx_bstride_1_table)) * (__pyx_v_xm * __pyx_v_ym)) + ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_table.buf, __pyx_t_18, __pyx_bstride_0_table, __pyx_t_19, __pyx_bstride_1_table)) * (__pyx_v_xp * __pyx_v_ym))) + ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_table.buf, __pyx_t_20, __pyx_bstride_0_table, __pyx_t_21, __pyx_bstride_1_table)) * (__pyx_v_xm * __pyx_v_yp))) + ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_table.buf, __pyx_t_22, __pyx_bstride_0_table, __pyx_t_23, __pyx_bstride_1_table)) * (__pyx_v_xp * __pyx_v_yp))); + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y_vals); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y_is); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y_bins); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_is); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_vals); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_table); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_bins); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.amr_utils.BilinearlyInterpolate"); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y_vals); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y_is); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y_bins); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_is); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_vals); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_table); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_bins); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":77 + * + * @cython.boundscheck(False) + * def TrilinearlyInterpolate(np.ndarray[np.float64_t, ndim=3] table, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t, ndim=1] x_vals, + * np.ndarray[np.float64_t, ndim=1] y_vals, + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_TrilinearlyInterpolate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_TrilinearlyInterpolate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_table = 0; + PyArrayObject *__pyx_v_x_vals = 0; + PyArrayObject *__pyx_v_y_vals = 0; + PyArrayObject *__pyx_v_z_vals = 0; + PyArrayObject *__pyx_v_x_bins = 0; + PyArrayObject *__pyx_v_y_bins = 0; + PyArrayObject *__pyx_v_z_bins = 0; + PyArrayObject *__pyx_v_x_is = 0; + PyArrayObject *__pyx_v_y_is = 0; + PyArrayObject *__pyx_v_z_is = 0; + PyArrayObject *__pyx_v_output = 0; + double __pyx_v_x; + double __pyx_v_xp; + double __pyx_v_xm; + double __pyx_v_y; + double __pyx_v_yp; + double __pyx_v_ym; + double __pyx_v_z; + double __pyx_v_zp; + double __pyx_v_zm; + double __pyx_v_dx_inv; + double __pyx_v_dy_inv; + double __pyx_v_dz_inv; + int __pyx_v_i; + int __pyx_v_x_i; + int __pyx_v_y_i; + int __pyx_v_z_i; + Py_buffer __pyx_bstruct_z_is; + Py_ssize_t __pyx_bstride_0_z_is = 0; + Py_ssize_t __pyx_bshape_0_z_is = 0; + Py_buffer __pyx_bstruct_x_vals; + Py_ssize_t __pyx_bstride_0_x_vals = 0; + Py_ssize_t __pyx_bshape_0_x_vals = 0; + Py_buffer __pyx_bstruct_y_is; + Py_ssize_t __pyx_bstride_0_y_is = 0; + Py_ssize_t __pyx_bshape_0_y_is = 0; + Py_buffer __pyx_bstruct_y_bins; + Py_ssize_t __pyx_bstride_0_y_bins = 0; + Py_ssize_t __pyx_bshape_0_y_bins = 0; + Py_buffer __pyx_bstruct_z_bins; + Py_ssize_t __pyx_bstride_0_z_bins = 0; + Py_ssize_t __pyx_bshape_0_z_bins = 0; + Py_buffer __pyx_bstruct_x_is; + Py_ssize_t __pyx_bstride_0_x_is = 0; + Py_ssize_t __pyx_bshape_0_x_is = 0; + Py_buffer __pyx_bstruct_output; + Py_ssize_t __pyx_bstride_0_output = 0; + Py_ssize_t __pyx_bshape_0_output = 0; + Py_buffer __pyx_bstruct_table; + Py_ssize_t __pyx_bstride_0_table = 0; + Py_ssize_t __pyx_bstride_1_table = 0; + Py_ssize_t __pyx_bstride_2_table = 0; + Py_ssize_t __pyx_bshape_0_table = 0; + Py_ssize_t __pyx_bshape_1_table = 0; + Py_ssize_t __pyx_bshape_2_table = 0; + Py_buffer __pyx_bstruct_x_bins; + Py_ssize_t __pyx_bstride_0_x_bins = 0; + Py_ssize_t __pyx_bshape_0_x_bins = 0; + Py_buffer __pyx_bstruct_y_vals; + Py_ssize_t __pyx_bstride_0_y_vals = 0; + Py_ssize_t __pyx_bshape_0_y_vals = 0; + Py_buffer __pyx_bstruct_z_vals; + Py_ssize_t __pyx_bstride_0_z_vals = 0; + Py_ssize_t __pyx_bshape_0_z_vals = 0; + PyObject *__pyx_r = NULL; + npy_intp __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + long __pyx_t_9; + int __pyx_t_10; + __pyx_t_5numpy_float64_t __pyx_t_11; + long __pyx_t_12; + int __pyx_t_13; + long __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + int __pyx_t_18; + long __pyx_t_19; + long __pyx_t_20; + long __pyx_t_21; + int __pyx_t_22; + int __pyx_t_23; + int __pyx_t_24; + long __pyx_t_25; + int __pyx_t_26; + int __pyx_t_27; + int __pyx_t_28; + long __pyx_t_29; + int __pyx_t_30; + int __pyx_t_31; + int __pyx_t_32; + long __pyx_t_33; + long __pyx_t_34; + int __pyx_t_35; + long __pyx_t_36; + int __pyx_t_37; + long __pyx_t_38; + long __pyx_t_39; + long __pyx_t_40; + long __pyx_t_41; + int __pyx_t_42; + long __pyx_t_43; + long __pyx_t_44; + long __pyx_t_45; + int __pyx_t_46; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__table,&__pyx_n_s__x_vals,&__pyx_n_s__y_vals,&__pyx_n_s__z_vals,&__pyx_n_s__x_bins,&__pyx_n_s__y_bins,&__pyx_n_s__z_bins,&__pyx_n_s__x_is,&__pyx_n_s__y_is,&__pyx_n_s__z_is,&__pyx_n_s__output,0}; + __Pyx_RefNannySetupContext("TrilinearlyInterpolate"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); + case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); + case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__table); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x_vals); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("TrilinearlyInterpolate", 1, 11, 11, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y_vals); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("TrilinearlyInterpolate", 1, 11, 11, 2); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__z_vals); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("TrilinearlyInterpolate", 1, 11, 11, 3); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x_bins); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("TrilinearlyInterpolate", 1, 11, 11, 4); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y_bins); + if (likely(values[5])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("TrilinearlyInterpolate", 1, 11, 11, 5); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 6: + values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__z_bins); + if (likely(values[6])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("TrilinearlyInterpolate", 1, 11, 11, 6); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 7: + values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x_is); + if (likely(values[7])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("TrilinearlyInterpolate", 1, 11, 11, 7); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 8: + values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y_is); + if (likely(values[8])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("TrilinearlyInterpolate", 1, 11, 11, 8); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 9: + values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__z_is); + if (likely(values[9])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("TrilinearlyInterpolate", 1, 11, 11, 9); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 10: + values[10] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__output); + if (likely(values[10])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("TrilinearlyInterpolate", 1, 11, 11, 10); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "TrilinearlyInterpolate") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_table = ((PyArrayObject *)values[0]); + __pyx_v_x_vals = ((PyArrayObject *)values[1]); + __pyx_v_y_vals = ((PyArrayObject *)values[2]); + __pyx_v_z_vals = ((PyArrayObject *)values[3]); + __pyx_v_x_bins = ((PyArrayObject *)values[4]); + __pyx_v_y_bins = ((PyArrayObject *)values[5]); + __pyx_v_z_bins = ((PyArrayObject *)values[6]); + __pyx_v_x_is = ((PyArrayObject *)values[7]); + __pyx_v_y_is = ((PyArrayObject *)values[8]); + __pyx_v_z_is = ((PyArrayObject *)values[9]); + __pyx_v_output = ((PyArrayObject *)values[10]); + } else if (PyTuple_GET_SIZE(__pyx_args) != 11) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_table = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); + __pyx_v_x_vals = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); + __pyx_v_y_vals = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); + __pyx_v_z_vals = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); + __pyx_v_x_bins = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); + __pyx_v_y_bins = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 5)); + __pyx_v_z_bins = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 6)); + __pyx_v_x_is = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 7)); + __pyx_v_y_is = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 8)); + __pyx_v_z_is = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 9)); + __pyx_v_output = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 10)); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("TrilinearlyInterpolate", 1, 11, 11, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.TrilinearlyInterpolate"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_bstruct_table.buf = NULL; + __pyx_bstruct_x_vals.buf = NULL; + __pyx_bstruct_y_vals.buf = NULL; + __pyx_bstruct_z_vals.buf = NULL; + __pyx_bstruct_x_bins.buf = NULL; + __pyx_bstruct_y_bins.buf = NULL; + __pyx_bstruct_z_bins.buf = NULL; + __pyx_bstruct_x_is.buf = NULL; + __pyx_bstruct_y_is.buf = NULL; + __pyx_bstruct_z_is.buf = NULL; + __pyx_bstruct_output.buf = NULL; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_table), __pyx_ptype_5numpy_ndarray, 1, "table", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x_vals), __pyx_ptype_5numpy_ndarray, 1, "x_vals", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y_vals), __pyx_ptype_5numpy_ndarray, 1, "y_vals", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_z_vals), __pyx_ptype_5numpy_ndarray, 1, "z_vals", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x_bins), __pyx_ptype_5numpy_ndarray, 1, "x_bins", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y_bins), __pyx_ptype_5numpy_ndarray, 1, "y_bins", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_z_bins), __pyx_ptype_5numpy_ndarray, 1, "z_bins", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x_is), __pyx_ptype_5numpy_ndarray, 1, "x_is", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y_is), __pyx_ptype_5numpy_ndarray, 1, "y_is", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_z_is), __pyx_ptype_5numpy_ndarray, 1, "z_is", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 86; __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[3]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_table, (PyObject*)__pyx_v_table, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_table = __pyx_bstruct_table.strides[0]; __pyx_bstride_1_table = __pyx_bstruct_table.strides[1]; __pyx_bstride_2_table = __pyx_bstruct_table.strides[2]; + __pyx_bshape_0_table = __pyx_bstruct_table.shape[0]; __pyx_bshape_1_table = __pyx_bstruct_table.shape[1]; __pyx_bshape_2_table = __pyx_bstruct_table.shape[2]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x_vals, (PyObject*)__pyx_v_x_vals, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_x_vals = __pyx_bstruct_x_vals.strides[0]; + __pyx_bshape_0_x_vals = __pyx_bstruct_x_vals.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_y_vals, (PyObject*)__pyx_v_y_vals, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_y_vals = __pyx_bstruct_y_vals.strides[0]; + __pyx_bshape_0_y_vals = __pyx_bstruct_y_vals.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_z_vals, (PyObject*)__pyx_v_z_vals, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_z_vals = __pyx_bstruct_z_vals.strides[0]; + __pyx_bshape_0_z_vals = __pyx_bstruct_z_vals.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x_bins, (PyObject*)__pyx_v_x_bins, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_x_bins = __pyx_bstruct_x_bins.strides[0]; + __pyx_bshape_0_x_bins = __pyx_bstruct_x_bins.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_y_bins, (PyObject*)__pyx_v_y_bins, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_y_bins = __pyx_bstruct_y_bins.strides[0]; + __pyx_bshape_0_y_bins = __pyx_bstruct_y_bins.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_z_bins, (PyObject*)__pyx_v_z_bins, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_z_bins = __pyx_bstruct_z_bins.strides[0]; + __pyx_bshape_0_z_bins = __pyx_bstruct_z_bins.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x_is, (PyObject*)__pyx_v_x_is, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_x_is = __pyx_bstruct_x_is.strides[0]; + __pyx_bshape_0_x_is = __pyx_bstruct_x_is.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_y_is, (PyObject*)__pyx_v_y_is, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_y_is = __pyx_bstruct_y_is.strides[0]; + __pyx_bshape_0_y_is = __pyx_bstruct_y_is.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_z_is, (PyObject*)__pyx_v_z_is, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_z_is = __pyx_bstruct_z_is.strides[0]; + __pyx_bshape_0_z_is = __pyx_bstruct_z_is.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_output, (PyObject*)__pyx_v_output, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_output = __pyx_bstruct_output.strides[0]; + __pyx_bshape_0_output = __pyx_bstruct_output.shape[0]; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":93 + * cdef double dx_inv, dy_inv, dz_inv + * cdef int i, x_i, y_i, z_i + * for i in range(x_vals.shape[0]): # <<<<<<<<<<<<<< + * x_i = x_is[i] + * y_i = y_is[i] + */ + __pyx_t_1 = (__pyx_v_x_vals->dimensions[0]); + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":94 + * cdef int i, x_i, y_i, z_i + * for i in range(x_vals.shape[0]): + * x_i = x_is[i] # <<<<<<<<<<<<<< + * y_i = y_is[i] + * z_i = z_is[i] + */ + __pyx_t_3 = __pyx_v_i; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_bshape_0_x_is; + __pyx_v_x_i = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int_t *, __pyx_bstruct_x_is.buf, __pyx_t_3, __pyx_bstride_0_x_is)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":95 + * for i in range(x_vals.shape[0]): + * x_i = x_is[i] + * y_i = y_is[i] # <<<<<<<<<<<<<< + * z_i = z_is[i] + * x = x_vals[i] + */ + __pyx_t_4 = __pyx_v_i; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_bshape_0_y_is; + __pyx_v_y_i = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int_t *, __pyx_bstruct_y_is.buf, __pyx_t_4, __pyx_bstride_0_y_is)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":96 + * x_i = x_is[i] + * y_i = y_is[i] + * z_i = z_is[i] # <<<<<<<<<<<<<< + * x = x_vals[i] + * y = y_vals[i] + */ + __pyx_t_5 = __pyx_v_i; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_bshape_0_z_is; + __pyx_v_z_i = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int_t *, __pyx_bstruct_z_is.buf, __pyx_t_5, __pyx_bstride_0_z_is)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":97 + * y_i = y_is[i] + * z_i = z_is[i] + * x = x_vals[i] # <<<<<<<<<<<<<< + * y = y_vals[i] + * z = z_vals[i] + */ + __pyx_t_6 = __pyx_v_i; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_bshape_0_x_vals; + __pyx_v_x = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x_vals.buf, __pyx_t_6, __pyx_bstride_0_x_vals)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":98 + * z_i = z_is[i] + * x = x_vals[i] + * y = y_vals[i] # <<<<<<<<<<<<<< + * z = z_vals[i] + * dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) + */ + __pyx_t_7 = __pyx_v_i; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_bshape_0_y_vals; + __pyx_v_y = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y_vals.buf, __pyx_t_7, __pyx_bstride_0_y_vals)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":99 + * x = x_vals[i] + * y = y_vals[i] + * z = z_vals[i] # <<<<<<<<<<<<<< + * dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) + * dy_inv = 1.0 / (y_bins[y_i+1] - y_bins[y_i]) + */ + __pyx_t_8 = __pyx_v_i; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_bshape_0_z_vals; + __pyx_v_z = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_z_vals.buf, __pyx_t_8, __pyx_bstride_0_z_vals)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":100 + * y = y_vals[i] + * z = z_vals[i] + * dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) # <<<<<<<<<<<<<< + * dy_inv = 1.0 / (y_bins[y_i+1] - y_bins[y_i]) + * dz_inv = 1.0 / (z_bins[z_i+1] - z_bins[z_i]) + */ + __pyx_t_9 = (__pyx_v_x_i + 1); + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_bshape_0_x_bins; + __pyx_t_10 = __pyx_v_x_i; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_bshape_0_x_bins; + __pyx_t_11 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x_bins.buf, __pyx_t_9, __pyx_bstride_0_x_bins)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x_bins.buf, __pyx_t_10, __pyx_bstride_0_x_bins))); + if (unlikely(__pyx_t_11 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_dx_inv = (1.0 / __pyx_t_11); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":101 + * z = z_vals[i] + * dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) + * dy_inv = 1.0 / (y_bins[y_i+1] - y_bins[y_i]) # <<<<<<<<<<<<<< + * dz_inv = 1.0 / (z_bins[z_i+1] - z_bins[z_i]) + * xp = (x - x_bins[x_i]) * dx_inv + */ + __pyx_t_12 = (__pyx_v_y_i + 1); + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_bshape_0_y_bins; + __pyx_t_13 = __pyx_v_y_i; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_bshape_0_y_bins; + __pyx_t_11 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y_bins.buf, __pyx_t_12, __pyx_bstride_0_y_bins)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y_bins.buf, __pyx_t_13, __pyx_bstride_0_y_bins))); + if (unlikely(__pyx_t_11 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_dy_inv = (1.0 / __pyx_t_11); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":102 + * dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i]) + * dy_inv = 1.0 / (y_bins[y_i+1] - y_bins[y_i]) + * dz_inv = 1.0 / (z_bins[z_i+1] - z_bins[z_i]) # <<<<<<<<<<<<<< + * xp = (x - x_bins[x_i]) * dx_inv + * yp = (y - y_bins[y_i]) * dy_inv + */ + __pyx_t_14 = (__pyx_v_z_i + 1); + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_0_z_bins; + __pyx_t_15 = __pyx_v_z_i; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_0_z_bins; + __pyx_t_11 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_z_bins.buf, __pyx_t_14, __pyx_bstride_0_z_bins)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_z_bins.buf, __pyx_t_15, __pyx_bstride_0_z_bins))); + if (unlikely(__pyx_t_11 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_dz_inv = (1.0 / __pyx_t_11); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":103 + * dy_inv = 1.0 / (y_bins[y_i+1] - y_bins[y_i]) + * dz_inv = 1.0 / (z_bins[z_i+1] - z_bins[z_i]) + * xp = (x - x_bins[x_i]) * dx_inv # <<<<<<<<<<<<<< + * yp = (y - y_bins[y_i]) * dy_inv + * zp = (z - z_bins[z_i]) * dz_inv + */ + __pyx_t_16 = __pyx_v_x_i; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_bshape_0_x_bins; + __pyx_v_xp = ((__pyx_v_x - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x_bins.buf, __pyx_t_16, __pyx_bstride_0_x_bins))) * __pyx_v_dx_inv); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":104 + * dz_inv = 1.0 / (z_bins[z_i+1] - z_bins[z_i]) + * xp = (x - x_bins[x_i]) * dx_inv + * yp = (y - y_bins[y_i]) * dy_inv # <<<<<<<<<<<<<< + * zp = (z - z_bins[z_i]) * dz_inv + * xm = (x_bins[x_i+1] - x) * dx_inv + */ + __pyx_t_17 = __pyx_v_y_i; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_bshape_0_y_bins; + __pyx_v_yp = ((__pyx_v_y - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y_bins.buf, __pyx_t_17, __pyx_bstride_0_y_bins))) * __pyx_v_dy_inv); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":105 + * xp = (x - x_bins[x_i]) * dx_inv + * yp = (y - y_bins[y_i]) * dy_inv + * zp = (z - z_bins[z_i]) * dz_inv # <<<<<<<<<<<<<< + * xm = (x_bins[x_i+1] - x) * dx_inv + * ym = (y_bins[y_i+1] - y) * dy_inv + */ + __pyx_t_18 = __pyx_v_z_i; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_bshape_0_z_bins; + __pyx_v_zp = ((__pyx_v_z - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_z_bins.buf, __pyx_t_18, __pyx_bstride_0_z_bins))) * __pyx_v_dz_inv); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":106 + * yp = (y - y_bins[y_i]) * dy_inv + * zp = (z - z_bins[z_i]) * dz_inv + * xm = (x_bins[x_i+1] - x) * dx_inv # <<<<<<<<<<<<<< + * ym = (y_bins[y_i+1] - y) * dy_inv + * zm = (z_bins[z_i+1] - z) * dz_inv + */ + __pyx_t_19 = (__pyx_v_x_i + 1); + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_bshape_0_x_bins; + __pyx_v_xm = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x_bins.buf, __pyx_t_19, __pyx_bstride_0_x_bins)) - __pyx_v_x) * __pyx_v_dx_inv); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":107 + * zp = (z - z_bins[z_i]) * dz_inv + * xm = (x_bins[x_i+1] - x) * dx_inv + * ym = (y_bins[y_i+1] - y) * dy_inv # <<<<<<<<<<<<<< + * zm = (z_bins[z_i+1] - z) * dz_inv + * output[i] = table[x_i ,y_i ,z_i ] * (xm*ym*zm) \ + */ + __pyx_t_20 = (__pyx_v_y_i + 1); + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_bshape_0_y_bins; + __pyx_v_ym = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y_bins.buf, __pyx_t_20, __pyx_bstride_0_y_bins)) - __pyx_v_y) * __pyx_v_dy_inv); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":108 + * xm = (x_bins[x_i+1] - x) * dx_inv + * ym = (y_bins[y_i+1] - y) * dy_inv + * zm = (z_bins[z_i+1] - z) * dz_inv # <<<<<<<<<<<<<< + * output[i] = table[x_i ,y_i ,z_i ] * (xm*ym*zm) \ + * + table[x_i+1,y_i ,z_i ] * (xp*ym*zm) \ + */ + __pyx_t_21 = (__pyx_v_z_i + 1); + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_bshape_0_z_bins; + __pyx_v_zm = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_z_bins.buf, __pyx_t_21, __pyx_bstride_0_z_bins)) - __pyx_v_z) * __pyx_v_dz_inv); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":109 + * ym = (y_bins[y_i+1] - y) * dy_inv + * zm = (z_bins[z_i+1] - z) * dz_inv + * output[i] = table[x_i ,y_i ,z_i ] * (xm*ym*zm) \ # <<<<<<<<<<<<<< + * + table[x_i+1,y_i ,z_i ] * (xp*ym*zm) \ + * + table[x_i ,y_i+1,z_i ] * (xm*yp*zm) \ + */ + __pyx_t_22 = __pyx_v_x_i; + __pyx_t_23 = __pyx_v_y_i; + __pyx_t_24 = __pyx_v_z_i; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_bshape_0_table; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_bshape_1_table; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_bshape_2_table; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":110 + * zm = (z_bins[z_i+1] - z) * dz_inv + * output[i] = table[x_i ,y_i ,z_i ] * (xm*ym*zm) \ + * + table[x_i+1,y_i ,z_i ] * (xp*ym*zm) \ # <<<<<<<<<<<<<< + * + table[x_i ,y_i+1,z_i ] * (xm*yp*zm) \ + * + table[x_i ,y_i ,z_i+1] * (xm*ym*zp) \ + */ + __pyx_t_25 = (__pyx_v_x_i + 1); + __pyx_t_26 = __pyx_v_y_i; + __pyx_t_27 = __pyx_v_z_i; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_bshape_0_table; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_bshape_1_table; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_bshape_2_table; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":111 + * output[i] = table[x_i ,y_i ,z_i ] * (xm*ym*zm) \ + * + table[x_i+1,y_i ,z_i ] * (xp*ym*zm) \ + * + table[x_i ,y_i+1,z_i ] * (xm*yp*zm) \ # <<<<<<<<<<<<<< + * + table[x_i ,y_i ,z_i+1] * (xm*ym*zp) \ + * + table[x_i+1,y_i ,z_i+1] * (xp*ym*zp) \ + */ + __pyx_t_28 = __pyx_v_x_i; + __pyx_t_29 = (__pyx_v_y_i + 1); + __pyx_t_30 = __pyx_v_z_i; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_bshape_0_table; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_bshape_1_table; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_bshape_2_table; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":112 + * + table[x_i+1,y_i ,z_i ] * (xp*ym*zm) \ + * + table[x_i ,y_i+1,z_i ] * (xm*yp*zm) \ + * + table[x_i ,y_i ,z_i+1] * (xm*ym*zp) \ # <<<<<<<<<<<<<< + * + table[x_i+1,y_i ,z_i+1] * (xp*ym*zp) \ + * + table[x_i ,y_i+1,z_i+1] * (xm*yp*zp) \ + */ + __pyx_t_31 = __pyx_v_x_i; + __pyx_t_32 = __pyx_v_y_i; + __pyx_t_33 = (__pyx_v_z_i + 1); + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_bshape_0_table; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_bshape_1_table; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_bshape_2_table; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":113 + * + table[x_i ,y_i+1,z_i ] * (xm*yp*zm) \ + * + table[x_i ,y_i ,z_i+1] * (xm*ym*zp) \ + * + table[x_i+1,y_i ,z_i+1] * (xp*ym*zp) \ # <<<<<<<<<<<<<< + * + table[x_i ,y_i+1,z_i+1] * (xm*yp*zp) \ + * + table[x_i+1,y_i+1,z_i ] * (xp*yp*zm) \ + */ + __pyx_t_34 = (__pyx_v_x_i + 1); + __pyx_t_35 = __pyx_v_y_i; + __pyx_t_36 = (__pyx_v_z_i + 1); + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_bshape_0_table; + if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_bshape_1_table; + if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_bshape_2_table; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":114 + * + table[x_i ,y_i ,z_i+1] * (xm*ym*zp) \ + * + table[x_i+1,y_i ,z_i+1] * (xp*ym*zp) \ + * + table[x_i ,y_i+1,z_i+1] * (xm*yp*zp) \ # <<<<<<<<<<<<<< + * + table[x_i+1,y_i+1,z_i ] * (xp*yp*zm) \ + * + table[x_i+1,y_i+1,z_i+1] * (xp*yp*zp) + */ + __pyx_t_37 = __pyx_v_x_i; + __pyx_t_38 = (__pyx_v_y_i + 1); + __pyx_t_39 = (__pyx_v_z_i + 1); + if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_bshape_0_table; + if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_bshape_1_table; + if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_bshape_2_table; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":115 + * + table[x_i+1,y_i ,z_i+1] * (xp*ym*zp) \ + * + table[x_i ,y_i+1,z_i+1] * (xm*yp*zp) \ + * + table[x_i+1,y_i+1,z_i ] * (xp*yp*zm) \ # <<<<<<<<<<<<<< + * + table[x_i+1,y_i+1,z_i+1] * (xp*yp*zp) + */ + __pyx_t_40 = (__pyx_v_x_i + 1); + __pyx_t_41 = (__pyx_v_y_i + 1); + __pyx_t_42 = __pyx_v_z_i; + if (__pyx_t_40 < 0) __pyx_t_40 += __pyx_bshape_0_table; + if (__pyx_t_41 < 0) __pyx_t_41 += __pyx_bshape_1_table; + if (__pyx_t_42 < 0) __pyx_t_42 += __pyx_bshape_2_table; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":116 + * + table[x_i ,y_i+1,z_i+1] * (xm*yp*zp) \ + * + table[x_i+1,y_i+1,z_i ] * (xp*yp*zm) \ + * + table[x_i+1,y_i+1,z_i+1] * (xp*yp*zp) # <<<<<<<<<<<<<< + */ + __pyx_t_43 = (__pyx_v_x_i + 1); + __pyx_t_44 = (__pyx_v_y_i + 1); + __pyx_t_45 = (__pyx_v_z_i + 1); + if (__pyx_t_43 < 0) __pyx_t_43 += __pyx_bshape_0_table; + if (__pyx_t_44 < 0) __pyx_t_44 += __pyx_bshape_1_table; + if (__pyx_t_45 < 0) __pyx_t_45 += __pyx_bshape_2_table; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":109 + * ym = (y_bins[y_i+1] - y) * dy_inv + * zm = (z_bins[z_i+1] - z) * dz_inv + * output[i] = table[x_i ,y_i ,z_i ] * (xm*ym*zm) \ # <<<<<<<<<<<<<< + * + table[x_i+1,y_i ,z_i ] * (xp*ym*zm) \ + * + table[x_i ,y_i+1,z_i ] * (xm*yp*zm) \ + */ + __pyx_t_46 = __pyx_v_i; + if (__pyx_t_46 < 0) __pyx_t_46 += __pyx_bshape_0_output; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_output.buf, __pyx_t_46, __pyx_bstride_0_output) = (((((((((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_table.buf, __pyx_t_22, __pyx_bstride_0_table, __pyx_t_23, __pyx_bstride_1_table, __pyx_t_24, __pyx_bstride_2_table)) * ((__pyx_v_xm * __pyx_v_ym) * __pyx_v_zm)) + ((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_table.buf, __pyx_t_25, __pyx_bstride_0_table, __pyx_t_26, __pyx_bstride_1_table, __pyx_t_27, __pyx_bstride_2_table)) * ((__pyx_v_xp * __pyx_v_ym) * __pyx_v_zm))) + ((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_table.buf, __pyx_t_28, __pyx_bstride_0_table, __pyx_t_29, __pyx_bstride_1_table, __pyx_t_30, __pyx_bstride_2_table)) * ((__pyx_v_xm * __pyx_v_yp) * __pyx_v_zm))) + ((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_table.buf, __pyx_t_31, __pyx_bstride_0_table, __pyx_t_32, __pyx_bstride_1_table, __pyx_t_33, __pyx_bstride_2_table)) * ((__pyx_v_xm * __pyx_v_ym) * __pyx_v_zp))) + ((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_table.buf, __pyx_t_34, __pyx_bstride_0_table, __pyx_t_35, __pyx_bstride_1_table, __pyx_t_36, __pyx_bstride_2_table)) * ((__pyx_v_xp * __pyx_v_ym) * __pyx_v_zp))) + ((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_table.buf, __pyx_t_37, __pyx_bstride_0_table, __pyx_t_38, __pyx_bstride_1_table, __pyx_t_39, __pyx_bstride_2_table)) * ((__pyx_v_xm * __pyx_v_yp) * __pyx_v_zp))) + ((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_table.buf, __pyx_t_40, __pyx_bstride_0_table, __pyx_t_41, __pyx_bstride_1_table, __pyx_t_42, __pyx_bstride_2_table)) * ((__pyx_v_xp * __pyx_v_yp) * __pyx_v_zm))) + ((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_table.buf, __pyx_t_43, __pyx_bstride_0_table, __pyx_t_44, __pyx_bstride_1_table, __pyx_t_45, __pyx_bstride_2_table)) * ((__pyx_v_xp * __pyx_v_yp) * __pyx_v_zp))); + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_z_is); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_vals); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y_is); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y_bins); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_z_bins); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_is); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_table); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_bins); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y_vals); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_z_vals); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.amr_utils.TrilinearlyInterpolate"); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_z_is); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_vals); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y_is); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y_bins); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_z_bins); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_is); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_output); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_table); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_bins); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y_vals); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_z_vals); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":36 + * @cython.wraparound(False) + * @cython.boundscheck(False) + * def planar_points_in_volume( # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t, ndim=2] points, + * np.ndarray[np.int8_t, ndim=1] pmask, # pixel mask + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_planar_points_in_volume(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_planar_points_in_volume(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_points = 0; + PyArrayObject *__pyx_v_pmask = 0; + PyArrayObject *__pyx_v_left_edge = 0; + PyArrayObject *__pyx_v_right_edge = 0; + PyArrayObject *__pyx_v_mask = 0; + float __pyx_v_dx; + PyArrayObject *__pyx_v_valid = 0; + int __pyx_v_i; + int __pyx_v_dim; + int __pyx_v_count; + int __pyx_v_ex; + double __pyx_v_dx_inv; + unsigned int __pyx_v_idx[3]; + PyArrayObject *__pyx_v_result = 0; + Py_buffer __pyx_bstruct_valid; + Py_ssize_t __pyx_bstride_0_valid = 0; + Py_ssize_t __pyx_bshape_0_valid = 0; + Py_buffer __pyx_bstruct_right_edge; + Py_ssize_t __pyx_bstride_0_right_edge = 0; + Py_ssize_t __pyx_bshape_0_right_edge = 0; + Py_buffer __pyx_bstruct_mask; + Py_ssize_t __pyx_bstride_0_mask = 0; + Py_ssize_t __pyx_bstride_1_mask = 0; + Py_ssize_t __pyx_bstride_2_mask = 0; + Py_ssize_t __pyx_bshape_0_mask = 0; + Py_ssize_t __pyx_bshape_1_mask = 0; + Py_ssize_t __pyx_bshape_2_mask = 0; + Py_buffer __pyx_bstruct_points; + Py_ssize_t __pyx_bstride_0_points = 0; + Py_ssize_t __pyx_bstride_1_points = 0; + Py_ssize_t __pyx_bshape_0_points = 0; + Py_ssize_t __pyx_bshape_1_points = 0; + Py_buffer __pyx_bstruct_left_edge; + Py_ssize_t __pyx_bstride_0_left_edge = 0; + Py_ssize_t __pyx_bshape_0_left_edge = 0; + Py_buffer __pyx_bstruct_pmask; + Py_ssize_t __pyx_bstride_0_pmask = 0; + Py_ssize_t __pyx_bshape_0_pmask = 0; + Py_buffer __pyx_bstruct_result; + Py_ssize_t __pyx_bstride_0_result = 0; + Py_ssize_t __pyx_bshape_0_result = 0; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyArrayObject *__pyx_t_5 = NULL; + npy_intp __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; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + int __pyx_t_18; + int __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; + unsigned int __pyx_t_23; + unsigned int __pyx_t_24; + unsigned int __pyx_t_25; + PyArrayObject *__pyx_t_26 = NULL; + int __pyx_t_27; + int __pyx_t_28; + int __pyx_t_29; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__points,&__pyx_n_s__pmask,&__pyx_n_s__left_edge,&__pyx_n_s__right_edge,&__pyx_n_s__mask,&__pyx_n_s__dx,0}; + __Pyx_RefNannySetupContext("planar_points_in_volume"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[6] = {0,0,0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__points); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pmask); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("planar_points_in_volume", 1, 6, 6, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left_edge); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("planar_points_in_volume", 1, 6, 6, 2); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right_edge); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("planar_points_in_volume", 1, 6, 6, 3); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("planar_points_in_volume", 1, 6, 6, 4); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dx); + if (likely(values[5])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("planar_points_in_volume", 1, 6, 6, 5); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "planar_points_in_volume") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_points = ((PyArrayObject *)values[0]); + __pyx_v_pmask = ((PyArrayObject *)values[1]); + __pyx_v_left_edge = ((PyArrayObject *)values[2]); + __pyx_v_right_edge = ((PyArrayObject *)values[3]); + __pyx_v_mask = ((PyArrayObject *)values[4]); + __pyx_v_dx = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_dx == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_points = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); + __pyx_v_pmask = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); + __pyx_v_left_edge = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); + __pyx_v_right_edge = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); + __pyx_v_mask = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); + __pyx_v_dx = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_dx == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("planar_points_in_volume", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.planar_points_in_volume"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_bstruct_valid.buf = NULL; + __pyx_bstruct_result.buf = NULL; + __pyx_bstruct_points.buf = NULL; + __pyx_bstruct_pmask.buf = NULL; + __pyx_bstruct_left_edge.buf = NULL; + __pyx_bstruct_right_edge.buf = NULL; + __pyx_bstruct_mask.buf = NULL; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_points), __pyx_ptype_5numpy_ndarray, 1, "points", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pmask), __pyx_ptype_5numpy_ndarray, 1, "pmask", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left_edge), __pyx_ptype_5numpy_ndarray, 1, "left_edge", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right_edge), __pyx_ptype_5numpy_ndarray, 1, "right_edge", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_points, (PyObject*)__pyx_v_points, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_points = __pyx_bstruct_points.strides[0]; __pyx_bstride_1_points = __pyx_bstruct_points.strides[1]; + __pyx_bshape_0_points = __pyx_bstruct_points.shape[0]; __pyx_bshape_1_points = __pyx_bstruct_points.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_pmask, (PyObject*)__pyx_v_pmask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_pmask = __pyx_bstruct_pmask.strides[0]; + __pyx_bshape_0_pmask = __pyx_bstruct_pmask.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_left_edge, (PyObject*)__pyx_v_left_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_left_edge = __pyx_bstruct_left_edge.strides[0]; + __pyx_bshape_0_left_edge = __pyx_bstruct_left_edge.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_right_edge, (PyObject*)__pyx_v_right_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_right_edge = __pyx_bstruct_right_edge.strides[0]; + __pyx_bshape_0_right_edge = __pyx_bstruct_right_edge.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_mask, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_mask = __pyx_bstruct_mask.strides[0]; __pyx_bstride_1_mask = __pyx_bstruct_mask.strides[1]; __pyx_bstride_2_mask = __pyx_bstruct_mask.strides[2]; + __pyx_bshape_0_mask = __pyx_bstruct_mask.shape[0]; __pyx_bshape_1_mask = __pyx_bstruct_mask.shape[1]; __pyx_bshape_2_mask = __pyx_bstruct_mask.shape[2]; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":44 + * float dx): + * cdef np.ndarray[np.int8_t, ndim=1] \ + * valid = np.zeros(points.shape[0], dtype='int8') # <<<<<<<<<<<<<< + * cdef int i, dim, count + * cdef int ex + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_to_py_npy_intp((__pyx_v_points->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__int8)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_valid, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_valid = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_valid.buf = NULL; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_bstride_0_valid = __pyx_bstruct_valid.strides[0]; + __pyx_bshape_0_valid = __pyx_bstruct_valid.shape[0]; + } + } + __pyx_t_5 = 0; + __pyx_v_valid = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":49 + * cdef double dx_inv + * cdef unsigned int idx[3] + * count = 0 # <<<<<<<<<<<<<< + * dx_inv = 1.0 / dx + * for i in xrange(points.shape[0]): + */ + __pyx_v_count = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":50 + * cdef unsigned int idx[3] + * count = 0 + * dx_inv = 1.0 / dx # <<<<<<<<<<<<<< + * for i in xrange(points.shape[0]): + * if pmask[i] == 0: + */ + if (unlikely(__pyx_v_dx == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_dx_inv = (1.0 / __pyx_v_dx); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":51 + * count = 0 + * dx_inv = 1.0 / dx + * for i in xrange(points.shape[0]): # <<<<<<<<<<<<<< + * if pmask[i] == 0: + * continue + */ + __pyx_t_6 = (__pyx_v_points->dimensions[0]); + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":52 + * dx_inv = 1.0 / dx + * for i in xrange(points.shape[0]): + * if pmask[i] == 0: # <<<<<<<<<<<<<< + * continue + * ex = 1 + */ + __pyx_t_8 = __pyx_v_i; + __pyx_t_9 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_bstruct_pmask.buf, __pyx_t_8, __pyx_bstride_0_pmask)) == 0); + if (__pyx_t_9) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":53 + * for i in xrange(points.shape[0]): + * if pmask[i] == 0: + * continue # <<<<<<<<<<<<<< + * ex = 1 + * for dim in xrange(3): + */ + goto __pyx_L6_continue; + goto __pyx_L8; + } + __pyx_L8:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":54 + * if pmask[i] == 0: + * continue + * ex = 1 # <<<<<<<<<<<<<< + * for dim in xrange(3): + * if points[i,dim] < left_edge[dim] or points[i,dim] > right_edge[dim]: + */ + __pyx_v_ex = 1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":55 + * continue + * ex = 1 + * for dim in xrange(3): # <<<<<<<<<<<<<< + * if points[i,dim] < left_edge[dim] or points[i,dim] > right_edge[dim]: + * valid[i] = ex = 0 + */ + for (__pyx_t_10 = 0; __pyx_t_10 < 3; __pyx_t_10+=1) { + __pyx_v_dim = __pyx_t_10; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":56 + * ex = 1 + * for dim in xrange(3): + * if points[i,dim] < left_edge[dim] or points[i,dim] > right_edge[dim]: # <<<<<<<<<<<<<< + * valid[i] = ex = 0 + * break + */ + __pyx_t_11 = __pyx_v_i; + __pyx_t_12 = __pyx_v_dim; + __pyx_t_13 = __pyx_v_dim; + __pyx_t_9 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_points.buf, __pyx_t_11, __pyx_bstride_0_points, __pyx_t_12, __pyx_bstride_1_points)) < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_13, __pyx_bstride_0_left_edge))); + if (!__pyx_t_9) { + __pyx_t_14 = __pyx_v_i; + __pyx_t_15 = __pyx_v_dim; + __pyx_t_16 = __pyx_v_dim; + __pyx_t_17 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_points.buf, __pyx_t_14, __pyx_bstride_0_points, __pyx_t_15, __pyx_bstride_1_points)) > (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_16, __pyx_bstride_0_right_edge))); + __pyx_t_18 = __pyx_t_17; + } else { + __pyx_t_18 = __pyx_t_9; + } + if (__pyx_t_18) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":57 + * for dim in xrange(3): + * if points[i,dim] < left_edge[dim] or points[i,dim] > right_edge[dim]: + * valid[i] = ex = 0 # <<<<<<<<<<<<<< + * break + * if ex == 1: + */ + __pyx_t_19 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_bstruct_valid.buf, __pyx_t_19, __pyx_bstride_0_valid) = 0; + __pyx_v_ex = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":58 + * if points[i,dim] < left_edge[dim] or points[i,dim] > right_edge[dim]: + * valid[i] = ex = 0 + * break # <<<<<<<<<<<<<< + * if ex == 1: + * for dim in xrange(3): + */ + goto __pyx_L10_break; + goto __pyx_L11; + } + __pyx_L11:; + } + __pyx_L10_break:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":59 + * valid[i] = ex = 0 + * break + * if ex == 1: # <<<<<<<<<<<<<< + * for dim in xrange(3): + * idx[dim] = \ + */ + __pyx_t_18 = (__pyx_v_ex == 1); + if (__pyx_t_18) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":60 + * break + * if ex == 1: + * for dim in xrange(3): # <<<<<<<<<<<<<< + * idx[dim] = \ + * ((points[i,dim] - left_edge[dim]) * dx_inv) + */ + for (__pyx_t_10 = 0; __pyx_t_10 < 3; __pyx_t_10+=1) { + __pyx_v_dim = __pyx_t_10; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":62 + * for dim in xrange(3): + * idx[dim] = \ + * ((points[i,dim] - left_edge[dim]) * dx_inv) # <<<<<<<<<<<<<< + * if mask[idx[0], idx[1], idx[2]] == 1: + * valid[i] = 1 + */ + __pyx_t_20 = __pyx_v_i; + __pyx_t_21 = __pyx_v_dim; + __pyx_t_22 = __pyx_v_dim; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":61 + * if ex == 1: + * for dim in xrange(3): + * idx[dim] = \ # <<<<<<<<<<<<<< + * ((points[i,dim] - left_edge[dim]) * dx_inv) + * if mask[idx[0], idx[1], idx[2]] == 1: + */ + (__pyx_v_idx[__pyx_v_dim]) = ((unsigned int)(((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_points.buf, __pyx_t_20, __pyx_bstride_0_points, __pyx_t_21, __pyx_bstride_1_points)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_22, __pyx_bstride_0_left_edge))) * __pyx_v_dx_inv)); + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":63 + * idx[dim] = \ + * ((points[i,dim] - left_edge[dim]) * dx_inv) + * if mask[idx[0], idx[1], idx[2]] == 1: # <<<<<<<<<<<<<< + * valid[i] = 1 + * count += 1 + */ + __pyx_t_23 = (__pyx_v_idx[0]); + __pyx_t_24 = (__pyx_v_idx[1]); + __pyx_t_25 = (__pyx_v_idx[2]); + __pyx_t_18 = ((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_mask.buf, __pyx_t_23, __pyx_bstride_0_mask, __pyx_t_24, __pyx_bstride_1_mask, __pyx_t_25, __pyx_bstride_2_mask)) == 1); + if (__pyx_t_18) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":64 + * ((points[i,dim] - left_edge[dim]) * dx_inv) + * if mask[idx[0], idx[1], idx[2]] == 1: + * valid[i] = 1 # <<<<<<<<<<<<<< + * count += 1 + * + */ + __pyx_t_10 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_bstruct_valid.buf, __pyx_t_10, __pyx_bstride_0_valid) = 1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":65 + * if mask[idx[0], idx[1], idx[2]] == 1: + * valid[i] = 1 + * count += 1 # <<<<<<<<<<<<<< + * + * cdef np.ndarray[np.int32_t, ndim=1] result = np.empty(count, dtype='int32') + */ + __pyx_v_count += 1; + goto __pyx_L15; + } + __pyx_L15:; + goto __pyx_L12; + } + __pyx_L12:; + __pyx_L6_continue:; + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":67 + * count += 1 + * + * cdef np.ndarray[np.int32_t, ndim=1] result = np.empty(count, dtype='int32') # <<<<<<<<<<<<<< + * count = 0 + * for i in xrange(points.shape[0]): + */ + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyInt_FromLong(__pyx_v_count); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__int32)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_3, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_26 = ((PyArrayObject *)__pyx_t_2); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_result, (PyObject*)__pyx_t_26, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_result = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_result.buf = NULL; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_bstride_0_result = __pyx_bstruct_result.strides[0]; + __pyx_bshape_0_result = __pyx_bstruct_result.shape[0]; + } + } + __pyx_t_26 = 0; + __pyx_v_result = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":68 + * + * cdef np.ndarray[np.int32_t, ndim=1] result = np.empty(count, dtype='int32') + * count = 0 # <<<<<<<<<<<<<< + * for i in xrange(points.shape[0]): + * if valid[i] == 1 and pmask[i] == 1: + */ + __pyx_v_count = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":69 + * cdef np.ndarray[np.int32_t, ndim=1] result = np.empty(count, dtype='int32') + * count = 0 + * for i in xrange(points.shape[0]): # <<<<<<<<<<<<<< + * if valid[i] == 1 and pmask[i] == 1: + * result[count] = i + */ + __pyx_t_6 = (__pyx_v_points->dimensions[0]); + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":70 + * count = 0 + * for i in xrange(points.shape[0]): + * if valid[i] == 1 and pmask[i] == 1: # <<<<<<<<<<<<<< + * result[count] = i + * count += 1 + */ + __pyx_t_27 = __pyx_v_i; + __pyx_t_18 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_bstruct_valid.buf, __pyx_t_27, __pyx_bstride_0_valid)) == 1); + if (__pyx_t_18) { + __pyx_t_28 = __pyx_v_i; + __pyx_t_9 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_bstruct_pmask.buf, __pyx_t_28, __pyx_bstride_0_pmask)) == 1); + __pyx_t_17 = __pyx_t_9; + } else { + __pyx_t_17 = __pyx_t_18; + } + if (__pyx_t_17) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":71 + * for i in xrange(points.shape[0]): + * if valid[i] == 1 and pmask[i] == 1: + * result[count] = i # <<<<<<<<<<<<<< + * count += 1 + * + */ + __pyx_t_29 = __pyx_v_count; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_result.buf, __pyx_t_29, __pyx_bstride_0_result) = __pyx_v_i; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":72 + * if valid[i] == 1 and pmask[i] == 1: + * result[count] = i + * count += 1 # <<<<<<<<<<<<<< + * + * return result + */ + __pyx_v_count += 1; + goto __pyx_L18; + } + __pyx_L18:; + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":74 + * count += 1 + * + * return result # <<<<<<<<<<<<<< + * + * cdef inline void set_rotated_pos( + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_valid); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_right_edge); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_points); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edge); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_pmask); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.amr_utils.planar_points_in_volume"); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_valid); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_right_edge); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_points); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edge); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_pmask); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_valid); + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":76 + * return result + * + * cdef inline void set_rotated_pos( # <<<<<<<<<<<<<< + * np.float64_t cp[3], np.float64_t rdds[3][3], + * np.float64_t rorigin[3], int i, int j, int k): + */ + +static CYTHON_INLINE void __pyx_f_2yt_9amr_utils_set_rotated_pos(__pyx_t_5numpy_float64_t *__pyx_v_cp, __pyx_t_5numpy_float64_t (*__pyx_v_rdds)[3], __pyx_t_5numpy_float64_t *__pyx_v_rorigin, int __pyx_v_i, int __pyx_v_j, int __pyx_v_k) { + int __pyx_v_oi; + int __pyx_t_1; + __Pyx_RefNannySetupContext("set_rotated_pos"); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":80 + * np.float64_t rorigin[3], int i, int j, int k): + * cdef int oi + * for oi in range(3): # <<<<<<<<<<<<<< + * cp[oi] = rdds[0][oi] * (0.5 + i) \ + * + rdds[1][oi] * (0.5 + j) \ + */ + for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { + __pyx_v_oi = __pyx_t_1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":81 + * cdef int oi + * for oi in range(3): + * cp[oi] = rdds[0][oi] * (0.5 + i) \ # <<<<<<<<<<<<<< + * + rdds[1][oi] * (0.5 + j) \ + * + rdds[2][oi] * (0.5 + k) \ + */ + (__pyx_v_cp[__pyx_v_oi]) = ((((((__pyx_v_rdds[0])[__pyx_v_oi]) * (0.5 + __pyx_v_i)) + (((__pyx_v_rdds[1])[__pyx_v_oi]) * (0.5 + __pyx_v_j))) + (((__pyx_v_rdds[2])[__pyx_v_oi]) * (0.5 + __pyx_v_k))) + (__pyx_v_rorigin[__pyx_v_oi])); + } + + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":88 + * #@cython.wraparound(False) + * #@cython.boundscheck(False) + * def grid_points_in_volume( # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t, ndim=1] box_lengths, + * np.ndarray[np.float64_t, ndim=1] box_origin, + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_grid_points_in_volume(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_grid_points_in_volume(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_box_lengths = 0; + PyArrayObject *__pyx_v_box_origin = 0; + PyArrayObject *__pyx_v_rot_mat = 0; + PyArrayObject *__pyx_v_grid_left_edge = 0; + PyArrayObject *__pyx_v_grid_right_edge = 0; + PyArrayObject *__pyx_v_dds = 0; + PyArrayObject *__pyx_v_mask = 0; + int __pyx_v_break_first; + int __pyx_v_n[3]; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_k; + __pyx_t_5numpy_float64_t __pyx_v_rds[3][3]; + __pyx_t_5numpy_float64_t __pyx_v_cur_pos[3]; + __pyx_t_5numpy_float64_t __pyx_v_rorigin[3]; + Py_buffer __pyx_bstruct_dds; + Py_ssize_t __pyx_bstride_0_dds = 0; + Py_ssize_t __pyx_bshape_0_dds = 0; + Py_buffer __pyx_bstruct_grid_right_edge; + Py_ssize_t __pyx_bstride_0_grid_right_edge = 0; + Py_ssize_t __pyx_bshape_0_grid_right_edge = 0; + Py_buffer __pyx_bstruct_mask; + Py_ssize_t __pyx_bstride_0_mask = 0; + Py_ssize_t __pyx_bstride_1_mask = 0; + Py_ssize_t __pyx_bstride_2_mask = 0; + Py_ssize_t __pyx_bshape_0_mask = 0; + Py_ssize_t __pyx_bshape_1_mask = 0; + Py_ssize_t __pyx_bshape_2_mask = 0; + Py_buffer __pyx_bstruct_box_lengths; + Py_ssize_t __pyx_bstride_0_box_lengths = 0; + Py_ssize_t __pyx_bshape_0_box_lengths = 0; + Py_buffer __pyx_bstruct_rot_mat; + Py_ssize_t __pyx_bstride_0_rot_mat = 0; + Py_ssize_t __pyx_bstride_1_rot_mat = 0; + Py_ssize_t __pyx_bshape_0_rot_mat = 0; + Py_ssize_t __pyx_bshape_1_rot_mat = 0; + Py_buffer __pyx_bstruct_box_origin; + Py_ssize_t __pyx_bstride_0_box_origin = 0; + Py_ssize_t __pyx_bshape_0_box_origin = 0; + Py_buffer __pyx_bstruct_grid_left_edge; + Py_ssize_t __pyx_bstride_0_grid_left_edge = 0; + Py_ssize_t __pyx_bshape_0_grid_left_edge = 0; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + 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; + long __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + long __pyx_t_17; + long __pyx_t_18; + int __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + __pyx_t_5numpy_int32_t __pyx_t_22; + int __pyx_t_23; + int __pyx_t_24; + int __pyx_t_25; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__box_lengths,&__pyx_n_s__box_origin,&__pyx_n_s__rot_mat,&__pyx_n_s__grid_left_edge,&__pyx_n_s__grid_right_edge,&__pyx_n_s__dds,&__pyx_n_s__mask,&__pyx_n_s__break_first,0}; + __Pyx_RefNannySetupContext("grid_points_in_volume"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[8] = {0,0,0,0,0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__box_lengths); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__box_origin); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("grid_points_in_volume", 1, 8, 8, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rot_mat); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("grid_points_in_volume", 1, 8, 8, 2); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid_left_edge); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("grid_points_in_volume", 1, 8, 8, 3); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid_right_edge); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("grid_points_in_volume", 1, 8, 8, 4); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dds); + if (likely(values[5])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("grid_points_in_volume", 1, 8, 8, 5); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 6: + values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask); + if (likely(values[6])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("grid_points_in_volume", 1, 8, 8, 6); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 7: + values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__break_first); + if (likely(values[7])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("grid_points_in_volume", 1, 8, 8, 7); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "grid_points_in_volume") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_box_lengths = ((PyArrayObject *)values[0]); + __pyx_v_box_origin = ((PyArrayObject *)values[1]); + __pyx_v_rot_mat = ((PyArrayObject *)values[2]); + __pyx_v_grid_left_edge = ((PyArrayObject *)values[3]); + __pyx_v_grid_right_edge = ((PyArrayObject *)values[4]); + __pyx_v_dds = ((PyArrayObject *)values[5]); + __pyx_v_mask = ((PyArrayObject *)values[6]); + __pyx_v_break_first = __Pyx_PyInt_AsInt(values[7]); if (unlikely((__pyx_v_break_first == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_box_lengths = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); + __pyx_v_box_origin = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); + __pyx_v_rot_mat = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); + __pyx_v_grid_left_edge = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); + __pyx_v_grid_right_edge = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); + __pyx_v_dds = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 5)); + __pyx_v_mask = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 6)); + __pyx_v_break_first = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 7)); if (unlikely((__pyx_v_break_first == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("grid_points_in_volume", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.grid_points_in_volume"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_bstruct_box_lengths.buf = NULL; + __pyx_bstruct_box_origin.buf = NULL; + __pyx_bstruct_rot_mat.buf = NULL; + __pyx_bstruct_grid_left_edge.buf = NULL; + __pyx_bstruct_grid_right_edge.buf = NULL; + __pyx_bstruct_dds.buf = NULL; + __pyx_bstruct_mask.buf = NULL; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_box_lengths), __pyx_ptype_5numpy_ndarray, 1, "box_lengths", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_box_origin), __pyx_ptype_5numpy_ndarray, 1, "box_origin", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rot_mat), __pyx_ptype_5numpy_ndarray, 1, "rot_mat", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grid_left_edge), __pyx_ptype_5numpy_ndarray, 1, "grid_left_edge", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grid_right_edge), __pyx_ptype_5numpy_ndarray, 1, "grid_right_edge", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dds), __pyx_ptype_5numpy_ndarray, 1, "dds", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_box_lengths, (PyObject*)__pyx_v_box_lengths, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_box_lengths = __pyx_bstruct_box_lengths.strides[0]; + __pyx_bshape_0_box_lengths = __pyx_bstruct_box_lengths.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_box_origin, (PyObject*)__pyx_v_box_origin, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_box_origin = __pyx_bstruct_box_origin.strides[0]; + __pyx_bshape_0_box_origin = __pyx_bstruct_box_origin.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_rot_mat, (PyObject*)__pyx_v_rot_mat, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_rot_mat = __pyx_bstruct_rot_mat.strides[0]; __pyx_bstride_1_rot_mat = __pyx_bstruct_rot_mat.strides[1]; + __pyx_bshape_0_rot_mat = __pyx_bstruct_rot_mat.shape[0]; __pyx_bshape_1_rot_mat = __pyx_bstruct_rot_mat.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_grid_left_edge, (PyObject*)__pyx_v_grid_left_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_grid_left_edge = __pyx_bstruct_grid_left_edge.strides[0]; + __pyx_bshape_0_grid_left_edge = __pyx_bstruct_grid_left_edge.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_grid_right_edge, (PyObject*)__pyx_v_grid_right_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_grid_right_edge = __pyx_bstruct_grid_right_edge.strides[0]; + __pyx_bshape_0_grid_right_edge = __pyx_bstruct_grid_right_edge.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dds, (PyObject*)__pyx_v_dds, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_dds = __pyx_bstruct_dds.strides[0]; + __pyx_bshape_0_dds = __pyx_bstruct_dds.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_mask, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_mask = __pyx_bstruct_mask.strides[0]; __pyx_bstride_1_mask = __pyx_bstruct_mask.strides[1]; __pyx_bstride_2_mask = __pyx_bstruct_mask.strides[2]; + __pyx_bshape_0_mask = __pyx_bstruct_mask.shape[0]; __pyx_bshape_1_mask = __pyx_bstruct_mask.shape[1]; __pyx_bshape_2_mask = __pyx_bstruct_mask.shape[2]; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":99 + * cdef int n[3], i, j, k, ax + * cdef np.float64_t rds[3][3], cur_pos[3], rorigin[3] + * for i in range(3): # <<<<<<<<<<<<<< + * rorigin[i] = 0.0 + * for i in range(3): + */ + for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":100 + * cdef np.float64_t rds[3][3], cur_pos[3], rorigin[3] + * for i in range(3): + * rorigin[i] = 0.0 # <<<<<<<<<<<<<< + * for i in range(3): + * n[i] = mask.shape[i] + */ + (__pyx_v_rorigin[__pyx_v_i]) = 0.0; + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":101 + * for i in range(3): + * rorigin[i] = 0.0 + * for i in range(3): # <<<<<<<<<<<<<< + * n[i] = mask.shape[i] + * for j in range(3): + */ + for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":102 + * rorigin[i] = 0.0 + * for i in range(3): + * n[i] = mask.shape[i] # <<<<<<<<<<<<<< + * for j in range(3): + * # Set up our transposed dx, which has a component in every + */ + (__pyx_v_n[__pyx_v_i]) = (__pyx_v_mask->dimensions[__pyx_v_i]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":103 + * for i in range(3): + * n[i] = mask.shape[i] + * for j in range(3): # <<<<<<<<<<<<<< + * # Set up our transposed dx, which has a component in every + * # direction + */ + for (__pyx_t_2 = 0; __pyx_t_2 < 3; __pyx_t_2+=1) { + __pyx_v_j = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":106 + * # Set up our transposed dx, which has a component in every + * # direction + * rds[i][j] = dds[i] * rot_mat[j,i] # <<<<<<<<<<<<<< + * # In our rotated coordinate system, the box origin is 0,0,0 + * # so we subtract the box_origin from the grid_origin and rotate + */ + __pyx_t_3 = __pyx_v_i; + __pyx_t_4 = -1; + if (__pyx_t_3 < 0) { + __pyx_t_3 += __pyx_bshape_0_dds; + if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 0; + } else if (unlikely(__pyx_t_3 >= __pyx_bshape_0_dds)) __pyx_t_4 = 0; + if (unlikely(__pyx_t_4 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_4); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = __pyx_v_j; + __pyx_t_5 = __pyx_v_i; + __pyx_t_6 = -1; + if (__pyx_t_4 < 0) { + __pyx_t_4 += __pyx_bshape_0_rot_mat; + if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0; + } else if (unlikely(__pyx_t_4 >= __pyx_bshape_0_rot_mat)) __pyx_t_6 = 0; + if (__pyx_t_5 < 0) { + __pyx_t_5 += __pyx_bshape_1_rot_mat; + if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1; + } else if (unlikely(__pyx_t_5 >= __pyx_bshape_1_rot_mat)) __pyx_t_6 = 1; + if (unlikely(__pyx_t_6 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_6); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + ((__pyx_v_rds[__pyx_v_i])[__pyx_v_j]) = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dds.buf, __pyx_t_3, __pyx_bstride_0_dds)) * (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_rot_mat.buf, __pyx_t_4, __pyx_bstride_0_rot_mat, __pyx_t_5, __pyx_bstride_1_rot_mat))); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":110 + * # so we subtract the box_origin from the grid_origin and rotate + * # that + * rorigin[j] += (grid_left_edge[i] - box_origin[i]) * rot_mat[j,i] # <<<<<<<<<<<<<< + * + * for i in range(n[0]): + */ + __pyx_t_6 = __pyx_v_i; + __pyx_t_7 = -1; + if (__pyx_t_6 < 0) { + __pyx_t_6 += __pyx_bshape_0_grid_left_edge; + if (unlikely(__pyx_t_6 < 0)) __pyx_t_7 = 0; + } else if (unlikely(__pyx_t_6 >= __pyx_bshape_0_grid_left_edge)) __pyx_t_7 = 0; + if (unlikely(__pyx_t_7 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_7); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_7 = __pyx_v_i; + __pyx_t_8 = -1; + if (__pyx_t_7 < 0) { + __pyx_t_7 += __pyx_bshape_0_box_origin; + if (unlikely(__pyx_t_7 < 0)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_7 >= __pyx_bshape_0_box_origin)) __pyx_t_8 = 0; + if (unlikely(__pyx_t_8 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_8); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_8 = __pyx_v_j; + __pyx_t_9 = __pyx_v_i; + __pyx_t_10 = -1; + if (__pyx_t_8 < 0) { + __pyx_t_8 += __pyx_bshape_0_rot_mat; + if (unlikely(__pyx_t_8 < 0)) __pyx_t_10 = 0; + } else if (unlikely(__pyx_t_8 >= __pyx_bshape_0_rot_mat)) __pyx_t_10 = 0; + if (__pyx_t_9 < 0) { + __pyx_t_9 += __pyx_bshape_1_rot_mat; + if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 1; + } else if (unlikely(__pyx_t_9 >= __pyx_bshape_1_rot_mat)) __pyx_t_10 = 1; + if (unlikely(__pyx_t_10 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_10); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + (__pyx_v_rorigin[__pyx_v_j]) += (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_grid_left_edge.buf, __pyx_t_6, __pyx_bstride_0_grid_left_edge)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_box_origin.buf, __pyx_t_7, __pyx_bstride_0_box_origin))) * (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_rot_mat.buf, __pyx_t_8, __pyx_bstride_0_rot_mat, __pyx_t_9, __pyx_bstride_1_rot_mat))); + } + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":112 + * rorigin[j] += (grid_left_edge[i] - box_origin[i]) * rot_mat[j,i] + * + * for i in range(n[0]): # <<<<<<<<<<<<<< + * for j in range(n[1]): + * for k in range(n[2]): + */ + __pyx_t_1 = (__pyx_v_n[0]); + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":113 + * + * for i in range(n[0]): + * for j in range(n[1]): # <<<<<<<<<<<<<< + * for k in range(n[2]): + * set_rotated_pos(cur_pos, rds, rorigin, i, j, k) + */ + __pyx_t_10 = (__pyx_v_n[1]); + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { + __pyx_v_j = __pyx_t_11; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":114 + * for i in range(n[0]): + * for j in range(n[1]): + * for k in range(n[2]): # <<<<<<<<<<<<<< + * set_rotated_pos(cur_pos, rds, rorigin, i, j, k) + * if (cur_pos[0] > box_lengths[0]): continue + */ + __pyx_t_12 = (__pyx_v_n[2]); + for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { + __pyx_v_k = __pyx_t_13; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":115 + * for j in range(n[1]): + * for k in range(n[2]): + * set_rotated_pos(cur_pos, rds, rorigin, i, j, k) # <<<<<<<<<<<<<< + * if (cur_pos[0] > box_lengths[0]): continue + * if (cur_pos[1] > box_lengths[1]): continue + */ + __pyx_f_2yt_9amr_utils_set_rotated_pos(__pyx_v_cur_pos, __pyx_v_rds, __pyx_v_rorigin, __pyx_v_i, __pyx_v_j, __pyx_v_k); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":116 + * for k in range(n[2]): + * set_rotated_pos(cur_pos, rds, rorigin, i, j, k) + * if (cur_pos[0] > box_lengths[0]): continue # <<<<<<<<<<<<<< + * if (cur_pos[1] > box_lengths[1]): continue + * if (cur_pos[2] > box_lengths[2]): continue + */ + __pyx_t_14 = 0; + __pyx_t_15 = -1; + if (__pyx_t_14 < 0) { + __pyx_t_14 += __pyx_bshape_0_box_lengths; + if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 0; + } else if (unlikely(__pyx_t_14 >= __pyx_bshape_0_box_lengths)) __pyx_t_15 = 0; + if (unlikely(__pyx_t_15 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_15); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_16 = ((__pyx_v_cur_pos[0]) > (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_box_lengths.buf, __pyx_t_14, __pyx_bstride_0_box_lengths))); + if (__pyx_t_16) { + goto __pyx_L16_continue; + goto __pyx_L18; + } + __pyx_L18:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":117 + * set_rotated_pos(cur_pos, rds, rorigin, i, j, k) + * if (cur_pos[0] > box_lengths[0]): continue + * if (cur_pos[1] > box_lengths[1]): continue # <<<<<<<<<<<<<< + * if (cur_pos[2] > box_lengths[2]): continue + * if (cur_pos[0] < 0.0): continue + */ + __pyx_t_17 = 1; + __pyx_t_15 = -1; + if (__pyx_t_17 < 0) { + __pyx_t_17 += __pyx_bshape_0_box_lengths; + if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 0; + } else if (unlikely(__pyx_t_17 >= __pyx_bshape_0_box_lengths)) __pyx_t_15 = 0; + if (unlikely(__pyx_t_15 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_15); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_16 = ((__pyx_v_cur_pos[1]) > (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_box_lengths.buf, __pyx_t_17, __pyx_bstride_0_box_lengths))); + if (__pyx_t_16) { + goto __pyx_L16_continue; + goto __pyx_L19; + } + __pyx_L19:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":118 + * if (cur_pos[0] > box_lengths[0]): continue + * if (cur_pos[1] > box_lengths[1]): continue + * if (cur_pos[2] > box_lengths[2]): continue # <<<<<<<<<<<<<< + * if (cur_pos[0] < 0.0): continue + * if (cur_pos[1] < 0.0): continue + */ + __pyx_t_18 = 2; + __pyx_t_15 = -1; + if (__pyx_t_18 < 0) { + __pyx_t_18 += __pyx_bshape_0_box_lengths; + if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 0; + } else if (unlikely(__pyx_t_18 >= __pyx_bshape_0_box_lengths)) __pyx_t_15 = 0; + if (unlikely(__pyx_t_15 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_15); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_16 = ((__pyx_v_cur_pos[2]) > (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_box_lengths.buf, __pyx_t_18, __pyx_bstride_0_box_lengths))); + if (__pyx_t_16) { + goto __pyx_L16_continue; + goto __pyx_L20; + } + __pyx_L20:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":119 + * if (cur_pos[1] > box_lengths[1]): continue + * if (cur_pos[2] > box_lengths[2]): continue + * if (cur_pos[0] < 0.0): continue # <<<<<<<<<<<<<< + * if (cur_pos[1] < 0.0): continue + * if (cur_pos[2] < 0.0): continue + */ + __pyx_t_16 = ((__pyx_v_cur_pos[0]) < 0.0); + if (__pyx_t_16) { + goto __pyx_L16_continue; + goto __pyx_L21; + } + __pyx_L21:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":120 + * if (cur_pos[2] > box_lengths[2]): continue + * if (cur_pos[0] < 0.0): continue + * if (cur_pos[1] < 0.0): continue # <<<<<<<<<<<<<< + * if (cur_pos[2] < 0.0): continue + * if break_first: + */ + __pyx_t_16 = ((__pyx_v_cur_pos[1]) < 0.0); + if (__pyx_t_16) { + goto __pyx_L16_continue; + goto __pyx_L22; + } + __pyx_L22:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":121 + * if (cur_pos[0] < 0.0): continue + * if (cur_pos[1] < 0.0): continue + * if (cur_pos[2] < 0.0): continue # <<<<<<<<<<<<<< + * if break_first: + * if mask[i,j,k]: return 1 + */ + __pyx_t_16 = ((__pyx_v_cur_pos[2]) < 0.0); + if (__pyx_t_16) { + goto __pyx_L16_continue; + goto __pyx_L23; + } + __pyx_L23:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":122 + * if (cur_pos[1] < 0.0): continue + * if (cur_pos[2] < 0.0): continue + * if break_first: # <<<<<<<<<<<<<< + * if mask[i,j,k]: return 1 + * else: + */ + if (__pyx_v_break_first) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":123 + * if (cur_pos[2] < 0.0): continue + * if break_first: + * if mask[i,j,k]: return 1 # <<<<<<<<<<<<<< + * else: + * mask[i,j,k] = 1 + */ + __pyx_t_15 = __pyx_v_i; + __pyx_t_19 = __pyx_v_j; + __pyx_t_20 = __pyx_v_k; + __pyx_t_21 = -1; + if (__pyx_t_15 < 0) { + __pyx_t_15 += __pyx_bshape_0_mask; + if (unlikely(__pyx_t_15 < 0)) __pyx_t_21 = 0; + } else if (unlikely(__pyx_t_15 >= __pyx_bshape_0_mask)) __pyx_t_21 = 0; + if (__pyx_t_19 < 0) { + __pyx_t_19 += __pyx_bshape_1_mask; + if (unlikely(__pyx_t_19 < 0)) __pyx_t_21 = 1; + } else if (unlikely(__pyx_t_19 >= __pyx_bshape_1_mask)) __pyx_t_21 = 1; + if (__pyx_t_20 < 0) { + __pyx_t_20 += __pyx_bshape_2_mask; + if (unlikely(__pyx_t_20 < 0)) __pyx_t_21 = 2; + } else if (unlikely(__pyx_t_20 >= __pyx_bshape_2_mask)) __pyx_t_21 = 2; + if (unlikely(__pyx_t_21 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_21); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_22 = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_mask.buf, __pyx_t_15, __pyx_bstride_0_mask, __pyx_t_19, __pyx_bstride_1_mask, __pyx_t_20, __pyx_bstride_2_mask)); + if (__pyx_t_22) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_int_1); + __pyx_r = __pyx_int_1; + goto __pyx_L0; + goto __pyx_L25; + } + __pyx_L25:; + goto __pyx_L24; + } + /*else*/ { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":125 + * if mask[i,j,k]: return 1 + * else: + * mask[i,j,k] = 1 # <<<<<<<<<<<<<< + * return 0 + * + */ + __pyx_t_21 = __pyx_v_i; + __pyx_t_23 = __pyx_v_j; + __pyx_t_24 = __pyx_v_k; + __pyx_t_25 = -1; + if (__pyx_t_21 < 0) { + __pyx_t_21 += __pyx_bshape_0_mask; + if (unlikely(__pyx_t_21 < 0)) __pyx_t_25 = 0; + } else if (unlikely(__pyx_t_21 >= __pyx_bshape_0_mask)) __pyx_t_25 = 0; + if (__pyx_t_23 < 0) { + __pyx_t_23 += __pyx_bshape_1_mask; + if (unlikely(__pyx_t_23 < 0)) __pyx_t_25 = 1; + } else if (unlikely(__pyx_t_23 >= __pyx_bshape_1_mask)) __pyx_t_25 = 1; + if (__pyx_t_24 < 0) { + __pyx_t_24 += __pyx_bshape_2_mask; + if (unlikely(__pyx_t_24 < 0)) __pyx_t_25 = 2; + } else if (unlikely(__pyx_t_24 >= __pyx_bshape_2_mask)) __pyx_t_25 = 2; + if (unlikely(__pyx_t_25 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_25); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_mask.buf, __pyx_t_21, __pyx_bstride_0_mask, __pyx_t_23, __pyx_bstride_1_mask, __pyx_t_24, __pyx_bstride_2_mask) = 1; + } + __pyx_L24:; + __pyx_L16_continue:; + } + } + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":126 + * else: + * mask[i,j,k] = 1 + * return 0 # <<<<<<<<<<<<<< + * + * cdef void normalize_vector(np.float64_t vec[3]): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_int_0); + __pyx_r = __pyx_int_0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dds); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_right_edge); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_box_lengths); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_rot_mat); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_box_origin); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_left_edge); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.amr_utils.grid_points_in_volume"); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dds); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_right_edge); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_box_lengths); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_rot_mat); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_box_origin); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_left_edge); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":128 + * return 0 + * + * cdef void normalize_vector(np.float64_t vec[3]): # <<<<<<<<<<<<<< + * cdef int i + * cdef np.float64_t norm = 0.0 + */ + +static void __pyx_f_2yt_9amr_utils_normalize_vector(__pyx_t_5numpy_float64_t *__pyx_v_vec) { + int __pyx_v_i; + __pyx_t_5numpy_float64_t __pyx_v_norm; + int __pyx_t_1; + __Pyx_RefNannySetupContext("normalize_vector"); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":130 + * cdef void normalize_vector(np.float64_t vec[3]): + * cdef int i + * cdef np.float64_t norm = 0.0 # <<<<<<<<<<<<<< + * for i in range(3): + * norm += vec[i]*vec[i] + */ + __pyx_v_norm = 0.0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":131 + * cdef int i + * cdef np.float64_t norm = 0.0 + * for i in range(3): # <<<<<<<<<<<<<< + * norm += vec[i]*vec[i] + * norm = norm**0.5 + */ + for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":132 + * cdef np.float64_t norm = 0.0 + * for i in range(3): + * norm += vec[i]*vec[i] # <<<<<<<<<<<<<< + * norm = norm**0.5 + * for i in range(3): + */ + __pyx_v_norm += ((__pyx_v_vec[__pyx_v_i]) * (__pyx_v_vec[__pyx_v_i])); + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":133 + * for i in range(3): + * norm += vec[i]*vec[i] + * norm = norm**0.5 # <<<<<<<<<<<<<< + * for i in range(3): + * vec[i] /= norm + */ + __pyx_v_norm = pow(__pyx_v_norm, 0.5); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":134 + * norm += vec[i]*vec[i] + * norm = norm**0.5 + * for i in range(3): # <<<<<<<<<<<<<< + * vec[i] /= norm + * + */ + for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":135 + * norm = norm**0.5 + * for i in range(3): + * vec[i] /= norm # <<<<<<<<<<<<<< + * + * cdef void get_cross_product(np.float64_t v1[3], + */ + (__pyx_v_vec[__pyx_v_i]) /= __pyx_v_norm; + } + + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":137 + * vec[i] /= norm + * + * cdef void get_cross_product(np.float64_t v1[3], # <<<<<<<<<<<<<< + * np.float64_t v2[3], + * np.float64_t cp[3]): + */ + +static void __pyx_f_2yt_9amr_utils_get_cross_product(__pyx_t_5numpy_float64_t *__pyx_v_v1, __pyx_t_5numpy_float64_t *__pyx_v_v2, __pyx_t_5numpy_float64_t *__pyx_v_cp) { + __Pyx_RefNannySetupContext("get_cross_product"); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":140 + * np.float64_t v2[3], + * np.float64_t cp[3]): + * cp[0] = v1[1]*v2[2] - v1[2]*v2[1] # <<<<<<<<<<<<<< + * cp[1] = v1[3]*v2[0] - v1[0]*v2[3] + * cp[2] = v1[0]*v2[1] - v1[1]*v2[0] + */ + (__pyx_v_cp[0]) = (((__pyx_v_v1[1]) * (__pyx_v_v2[2])) - ((__pyx_v_v1[2]) * (__pyx_v_v2[1]))); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":141 + * np.float64_t cp[3]): + * cp[0] = v1[1]*v2[2] - v1[2]*v2[1] + * cp[1] = v1[3]*v2[0] - v1[0]*v2[3] # <<<<<<<<<<<<<< + * cp[2] = v1[0]*v2[1] - v1[1]*v2[0] + * #print cp[0], cp[1], cp[2] + */ + (__pyx_v_cp[1]) = (((__pyx_v_v1[3]) * (__pyx_v_v2[0])) - ((__pyx_v_v1[0]) * (__pyx_v_v2[3]))); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":142 + * cp[0] = v1[1]*v2[2] - v1[2]*v2[1] + * cp[1] = v1[3]*v2[0] - v1[0]*v2[3] + * cp[2] = v1[0]*v2[1] - v1[1]*v2[0] # <<<<<<<<<<<<<< + * #print cp[0], cp[1], cp[2] + * + */ + (__pyx_v_cp[2]) = (((__pyx_v_v1[0]) * (__pyx_v_v2[1])) - ((__pyx_v_v1[1]) * (__pyx_v_v2[0]))); + + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":145 + * #print cp[0], cp[1], cp[2] + * + * cdef int check_projected_overlap( # <<<<<<<<<<<<<< + * np.float64_t sep_ax[3], np.float64_t sep_vec[3], int gi, + * np.float64_t b_vec[3][3], np.float64_t g_vec[3][3]): + */ + +static int __pyx_f_2yt_9amr_utils_check_projected_overlap(__pyx_t_5numpy_float64_t *__pyx_v_sep_ax, __pyx_t_5numpy_float64_t *__pyx_v_sep_vec, int __pyx_v_gi, __pyx_t_5numpy_float64_t (*__pyx_v_b_vec)[3], __pyx_t_5numpy_float64_t (*__pyx_v_g_vec)[3]) { + int __pyx_v_g_ax; + int __pyx_v_b_ax; + __pyx_t_5numpy_float64_t __pyx_v_tba; + __pyx_t_5numpy_float64_t __pyx_v_tga; + __pyx_t_5numpy_float64_t __pyx_v_ba; + __pyx_t_5numpy_float64_t __pyx_v_ga; + __pyx_t_5numpy_float64_t __pyx_v_sep_dot; + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + __Pyx_RefNannySetupContext("check_projected_overlap"); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":150 + * cdef int g_ax, b_ax + * cdef np.float64_t tba, tga, ba, ga, sep_dot + * ba = ga = sep_dot = 0.0 # <<<<<<<<<<<<<< + * for g_ax in range(3): + * # We need the grid vectors, which we'll precompute here + */ + __pyx_v_ba = 0.0; + __pyx_v_ga = 0.0; + __pyx_v_sep_dot = 0.0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":151 + * cdef np.float64_t tba, tga, ba, ga, sep_dot + * ba = ga = sep_dot = 0.0 + * for g_ax in range(3): # <<<<<<<<<<<<<< + * # We need the grid vectors, which we'll precompute here + * tba = tga = 0.0 + */ + for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { + __pyx_v_g_ax = __pyx_t_1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":153 + * for g_ax in range(3): + * # We need the grid vectors, which we'll precompute here + * tba = tga = 0.0 # <<<<<<<<<<<<<< + * for b_ax in range(3): + * tba += b_vec[g_ax][b_ax] * sep_vec[b_ax] + */ + __pyx_v_tba = 0.0; + __pyx_v_tga = 0.0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":154 + * # We need the grid vectors, which we'll precompute here + * tba = tga = 0.0 + * for b_ax in range(3): # <<<<<<<<<<<<<< + * tba += b_vec[g_ax][b_ax] * sep_vec[b_ax] + * tga += g_vec[g_ax][b_ax] * sep_vec[b_ax] + */ + for (__pyx_t_2 = 0; __pyx_t_2 < 3; __pyx_t_2+=1) { + __pyx_v_b_ax = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":155 + * tba = tga = 0.0 + * for b_ax in range(3): + * tba += b_vec[g_ax][b_ax] * sep_vec[b_ax] # <<<<<<<<<<<<<< + * tga += g_vec[g_ax][b_ax] * sep_vec[b_ax] + * ba += fabs(tba) + */ + __pyx_v_tba += (((__pyx_v_b_vec[__pyx_v_g_ax])[__pyx_v_b_ax]) * (__pyx_v_sep_vec[__pyx_v_b_ax])); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":156 + * for b_ax in range(3): + * tba += b_vec[g_ax][b_ax] * sep_vec[b_ax] + * tga += g_vec[g_ax][b_ax] * sep_vec[b_ax] # <<<<<<<<<<<<<< + * ba += fabs(tba) + * ga += fabs(tga) + */ + __pyx_v_tga += (((__pyx_v_g_vec[__pyx_v_g_ax])[__pyx_v_b_ax]) * (__pyx_v_sep_vec[__pyx_v_b_ax])); + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":157 + * tba += b_vec[g_ax][b_ax] * sep_vec[b_ax] + * tga += g_vec[g_ax][b_ax] * sep_vec[b_ax] + * ba += fabs(tba) # <<<<<<<<<<<<<< + * ga += fabs(tga) + * sep_dot += sep_vec[g_ax] * sep_ax[g_ax] + */ + __pyx_v_ba += fabs(__pyx_v_tba); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":158 + * tga += g_vec[g_ax][b_ax] * sep_vec[b_ax] + * ba += fabs(tba) + * ga += fabs(tga) # <<<<<<<<<<<<<< + * sep_dot += sep_vec[g_ax] * sep_ax[g_ax] + * #print sep_vec[0], sep_vec[1], sep_vec[2], + */ + __pyx_v_ga += fabs(__pyx_v_tga); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":159 + * ba += fabs(tba) + * ga += fabs(tga) + * sep_dot += sep_vec[g_ax] * sep_ax[g_ax] # <<<<<<<<<<<<<< + * #print sep_vec[0], sep_vec[1], sep_vec[2], + * #print sep_ax[0], sep_ax[1], sep_ax[2] + */ + __pyx_v_sep_dot += ((__pyx_v_sep_vec[__pyx_v_g_ax]) * (__pyx_v_sep_ax[__pyx_v_g_ax])); + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":162 + * #print sep_vec[0], sep_vec[1], sep_vec[2], + * #print sep_ax[0], sep_ax[1], sep_ax[2] + * return (fabs(sep_dot) > ba+ga) # <<<<<<<<<<<<<< + * # Now we do + * + */ + __pyx_r = (fabs(__pyx_v_sep_dot) > (__pyx_v_ba + __pyx_v_ga)); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":167 + * @cython.wraparound(False) + * @cython.boundscheck(False) + * def find_grids_in_inclined_box( # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t, ndim=2] box_vectors, + * np.ndarray[np.float64_t, ndim=1] box_center, + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_find_grids_in_inclined_box(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_find_grids_in_inclined_box(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_box_vectors = 0; + PyArrayObject *__pyx_v_box_center = 0; + PyArrayObject *__pyx_v_grid_left_edges = 0; + PyArrayObject *__pyx_v_grid_right_edges = 0; + int __pyx_v_n; + int __pyx_v_g_ax; + int __pyx_v_b_ax; + int __pyx_v_gi; + __pyx_t_5numpy_float64_t __pyx_v_b_vec[3][3]; + __pyx_t_5numpy_float64_t __pyx_v_g_vec[3][3]; + __pyx_t_5numpy_float64_t __pyx_v_a_vec[3][3]; + __pyx_t_5numpy_float64_t __pyx_v_sep_ax[15][3]; + __pyx_t_5numpy_float64_t __pyx_v_sep_vec[3]; + PyArrayObject *__pyx_v_good = 0; + PyArrayObject *__pyx_v_grid_centers; + Py_buffer __pyx_bstruct_grid_left_edges; + Py_ssize_t __pyx_bstride_0_grid_left_edges = 0; + Py_ssize_t __pyx_bstride_1_grid_left_edges = 0; + Py_ssize_t __pyx_bshape_0_grid_left_edges = 0; + Py_ssize_t __pyx_bshape_1_grid_left_edges = 0; + Py_buffer __pyx_bstruct_box_vectors; + Py_ssize_t __pyx_bstride_0_box_vectors = 0; + Py_ssize_t __pyx_bstride_1_box_vectors = 0; + Py_ssize_t __pyx_bshape_0_box_vectors = 0; + Py_ssize_t __pyx_bshape_1_box_vectors = 0; + Py_buffer __pyx_bstruct_good; + Py_ssize_t __pyx_bstride_0_good = 0; + Py_ssize_t __pyx_bshape_0_good = 0; + Py_buffer __pyx_bstruct_grid_right_edges; + Py_ssize_t __pyx_bstride_0_grid_right_edges = 0; + Py_ssize_t __pyx_bstride_1_grid_right_edges = 0; + Py_ssize_t __pyx_bshape_0_grid_right_edges = 0; + Py_ssize_t __pyx_bshape_1_grid_right_edges = 0; + Py_buffer __pyx_bstruct_grid_centers; + Py_ssize_t __pyx_bstride_0_grid_centers = 0; + Py_ssize_t __pyx_bstride_1_grid_centers = 0; + Py_ssize_t __pyx_bshape_0_grid_centers = 0; + Py_ssize_t __pyx_bshape_1_grid_centers = 0; + Py_buffer __pyx_bstruct_box_center; + Py_ssize_t __pyx_bstride_0_box_center = 0; + Py_ssize_t __pyx_bshape_0_box_center = 0; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyArrayObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + PyArrayObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + int __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + int __pyx_t_18; + int __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__box_vectors,&__pyx_n_s__box_center,&__pyx_n_s__grid_left_edges,&__pyx_n_s__grid_right_edges,0}; + __Pyx_RefNannySetupContext("find_grids_in_inclined_box"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[4] = {0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__box_vectors); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__box_center); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("find_grids_in_inclined_box", 1, 4, 4, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid_left_edges); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("find_grids_in_inclined_box", 1, 4, 4, 2); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid_right_edges); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("find_grids_in_inclined_box", 1, 4, 4, 3); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "find_grids_in_inclined_box") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_box_vectors = ((PyArrayObject *)values[0]); + __pyx_v_box_center = ((PyArrayObject *)values[1]); + __pyx_v_grid_left_edges = ((PyArrayObject *)values[2]); + __pyx_v_grid_right_edges = ((PyArrayObject *)values[3]); + } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_box_vectors = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); + __pyx_v_box_center = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); + __pyx_v_grid_left_edges = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); + __pyx_v_grid_right_edges = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("find_grids_in_inclined_box", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.find_grids_in_inclined_box"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_grid_centers = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_bstruct_good.buf = NULL; + __pyx_bstruct_grid_centers.buf = NULL; + __pyx_bstruct_box_vectors.buf = NULL; + __pyx_bstruct_box_center.buf = NULL; + __pyx_bstruct_grid_left_edges.buf = NULL; + __pyx_bstruct_grid_right_edges.buf = NULL; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_box_vectors), __pyx_ptype_5numpy_ndarray, 1, "box_vectors", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_box_center), __pyx_ptype_5numpy_ndarray, 1, "box_center", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grid_left_edges), __pyx_ptype_5numpy_ndarray, 1, "grid_left_edges", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grid_right_edges), __pyx_ptype_5numpy_ndarray, 1, "grid_right_edges", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_box_vectors, (PyObject*)__pyx_v_box_vectors, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_box_vectors = __pyx_bstruct_box_vectors.strides[0]; __pyx_bstride_1_box_vectors = __pyx_bstruct_box_vectors.strides[1]; + __pyx_bshape_0_box_vectors = __pyx_bstruct_box_vectors.shape[0]; __pyx_bshape_1_box_vectors = __pyx_bstruct_box_vectors.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_box_center, (PyObject*)__pyx_v_box_center, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_box_center = __pyx_bstruct_box_center.strides[0]; + __pyx_bshape_0_box_center = __pyx_bstruct_box_center.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_grid_left_edges, (PyObject*)__pyx_v_grid_left_edges, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_grid_left_edges = __pyx_bstruct_grid_left_edges.strides[0]; __pyx_bstride_1_grid_left_edges = __pyx_bstruct_grid_left_edges.strides[1]; + __pyx_bshape_0_grid_left_edges = __pyx_bstruct_grid_left_edges.shape[0]; __pyx_bshape_1_grid_left_edges = __pyx_bstruct_grid_left_edges.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_grid_right_edges, (PyObject*)__pyx_v_grid_right_edges, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_grid_right_edges = __pyx_bstruct_grid_right_edges.strides[0]; __pyx_bstride_1_grid_right_edges = __pyx_bstruct_grid_right_edges.strides[1]; + __pyx_bshape_0_grid_right_edges = __pyx_bstruct_grid_right_edges.shape[0]; __pyx_bshape_1_grid_right_edges = __pyx_bstruct_grid_right_edges.shape[1]; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":174 + * + * # http://www.gamasutra.com/view/feature/3383/simple_intersection_tests_for_games.php?page=5 + * cdef int n = grid_right_edges.shape[0] # <<<<<<<<<<<<<< + * cdef int g_ax, b_ax, gi + * cdef np.float64_t b_vec[3][3], g_vec[3][3], a_vec[3][3], sep_ax[15][3] + */ + __pyx_v_n = (__pyx_v_grid_right_edges->dimensions[0]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":178 + * cdef np.float64_t b_vec[3][3], g_vec[3][3], a_vec[3][3], sep_ax[15][3] + * cdef np.float64_t sep_vec[3], norm + * cdef np.ndarray[np.int32_t, ndim=1] good = np.zeros(n, dtype='int32') # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t, ndim=2] grid_centers + * # Fill in our axis unit vectors + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyInt_FromLong(__pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__int32)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_good, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_good = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_good.buf = NULL; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_bstride_0_good = __pyx_bstruct_good.strides[0]; + __pyx_bshape_0_good = __pyx_bstruct_good.shape[0]; + } + } + __pyx_t_5 = 0; + __pyx_v_good = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":181 + * cdef np.ndarray[np.float64_t, ndim=2] grid_centers + * # Fill in our axis unit vectors + * for b_ax in range(3): # <<<<<<<<<<<<<< + * for g_ax in range(3): + * a_vec[b_ax][g_ax] = (b_ax == g_ax) + */ + for (__pyx_t_6 = 0; __pyx_t_6 < 3; __pyx_t_6+=1) { + __pyx_v_b_ax = __pyx_t_6; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":182 + * # Fill in our axis unit vectors + * for b_ax in range(3): + * for g_ax in range(3): # <<<<<<<<<<<<<< + * a_vec[b_ax][g_ax] = (b_ax == g_ax) + * grid_centers = (grid_right_edges + grid_left_edges)/2.0 + */ + for (__pyx_t_7 = 0; __pyx_t_7 < 3; __pyx_t_7+=1) { + __pyx_v_g_ax = __pyx_t_7; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":183 + * for b_ax in range(3): + * for g_ax in range(3): + * a_vec[b_ax][g_ax] = (b_ax == g_ax) # <<<<<<<<<<<<<< + * grid_centers = (grid_right_edges + grid_left_edges)/2.0 + * + */ + ((__pyx_v_a_vec[__pyx_v_b_ax])[__pyx_v_g_ax]) = ((__pyx_t_5numpy_float64_t)(__pyx_v_b_ax == __pyx_v_g_ax)); + } + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":184 + * for g_ax in range(3): + * a_vec[b_ax][g_ax] = (b_ax == g_ax) + * grid_centers = (grid_right_edges + grid_left_edges)/2.0 # <<<<<<<<<<<<<< + * + * # Now we pre-compute our candidate separating axes, because the unit + */ + __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_v_grid_right_edges), ((PyObject *)__pyx_v_grid_left_edges)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = ((PyArrayObject *)__pyx_t_3); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_centers); + __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_grid_centers, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + if (unlikely(__pyx_t_6 < 0)) { + PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_grid_centers, (PyObject*)__pyx_v_grid_centers, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11); + } + } + __pyx_bstride_0_grid_centers = __pyx_bstruct_grid_centers.strides[0]; __pyx_bstride_1_grid_centers = __pyx_bstruct_grid_centers.strides[1]; + __pyx_bshape_0_grid_centers = __pyx_bstruct_grid_centers.shape[0]; __pyx_bshape_1_grid_centers = __pyx_bstruct_grid_centers.shape[1]; + if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_8 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_grid_centers)); + __pyx_v_grid_centers = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":188 + * # Now we pre-compute our candidate separating axes, because the unit + * # vectors for all the grids are identical + * for b_ax in range(3): # <<<<<<<<<<<<<< + * # We have 6 principal axes we already know, which are the grid (domain) + * # principal axes and the box axes + */ + for (__pyx_t_6 = 0; __pyx_t_6 < 3; __pyx_t_6+=1) { + __pyx_v_b_ax = __pyx_t_6; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":191 + * # We have 6 principal axes we already know, which are the grid (domain) + * # principal axes and the box axes + * sep_ax[b_ax][0] = sep_ax[b_ax][1] = sep_ax[b_ax][2] = 0.0 # <<<<<<<<<<<<<< + * sep_ax[b_ax][b_ax] = 1.0 # delta_ijk, for grid axes + * for g_ax in range(3): + */ + ((__pyx_v_sep_ax[__pyx_v_b_ax])[0]) = 0.0; + ((__pyx_v_sep_ax[__pyx_v_b_ax])[1]) = 0.0; + ((__pyx_v_sep_ax[__pyx_v_b_ax])[2]) = 0.0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":192 + * # principal axes and the box axes + * sep_ax[b_ax][0] = sep_ax[b_ax][1] = sep_ax[b_ax][2] = 0.0 + * sep_ax[b_ax][b_ax] = 1.0 # delta_ijk, for grid axes # <<<<<<<<<<<<<< + * for g_ax in range(3): + * b_vec[b_ax][g_ax] = 0.5*box_vectors[b_ax,g_ax] + */ + ((__pyx_v_sep_ax[__pyx_v_b_ax])[__pyx_v_b_ax]) = 1.0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":193 + * sep_ax[b_ax][0] = sep_ax[b_ax][1] = sep_ax[b_ax][2] = 0.0 + * sep_ax[b_ax][b_ax] = 1.0 # delta_ijk, for grid axes + * for g_ax in range(3): # <<<<<<<<<<<<<< + * b_vec[b_ax][g_ax] = 0.5*box_vectors[b_ax,g_ax] + * sep_ax[b_ax + 3][g_ax] = b_vec[b_ax][g_ax] # box axes + */ + for (__pyx_t_7 = 0; __pyx_t_7 < 3; __pyx_t_7+=1) { + __pyx_v_g_ax = __pyx_t_7; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":194 + * sep_ax[b_ax][b_ax] = 1.0 # delta_ijk, for grid axes + * for g_ax in range(3): + * b_vec[b_ax][g_ax] = 0.5*box_vectors[b_ax,g_ax] # <<<<<<<<<<<<<< + * sep_ax[b_ax + 3][g_ax] = b_vec[b_ax][g_ax] # box axes + * normalize_vector(sep_ax[b_ax + 3]) + */ + __pyx_t_12 = __pyx_v_b_ax; + __pyx_t_13 = __pyx_v_g_ax; + ((__pyx_v_b_vec[__pyx_v_b_ax])[__pyx_v_g_ax]) = (0.5 * (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_box_vectors.buf, __pyx_t_12, __pyx_bstride_0_box_vectors, __pyx_t_13, __pyx_bstride_1_box_vectors))); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":195 + * for g_ax in range(3): + * b_vec[b_ax][g_ax] = 0.5*box_vectors[b_ax,g_ax] + * sep_ax[b_ax + 3][g_ax] = b_vec[b_ax][g_ax] # box axes # <<<<<<<<<<<<<< + * normalize_vector(sep_ax[b_ax + 3]) + * for g_ax in range(3): + */ + ((__pyx_v_sep_ax[(__pyx_v_b_ax + 3)])[__pyx_v_g_ax]) = ((__pyx_v_b_vec[__pyx_v_b_ax])[__pyx_v_g_ax]); + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":196 + * b_vec[b_ax][g_ax] = 0.5*box_vectors[b_ax,g_ax] + * sep_ax[b_ax + 3][g_ax] = b_vec[b_ax][g_ax] # box axes + * normalize_vector(sep_ax[b_ax + 3]) # <<<<<<<<<<<<<< + * for g_ax in range(3): + * get_cross_product(b_vec[b_ax], a_vec[g_ax], sep_ax[b_ax*3 + g_ax + 6]) + */ + __pyx_f_2yt_9amr_utils_normalize_vector((__pyx_v_sep_ax[(__pyx_v_b_ax + 3)])); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":197 + * sep_ax[b_ax + 3][g_ax] = b_vec[b_ax][g_ax] # box axes + * normalize_vector(sep_ax[b_ax + 3]) + * for g_ax in range(3): # <<<<<<<<<<<<<< + * get_cross_product(b_vec[b_ax], a_vec[g_ax], sep_ax[b_ax*3 + g_ax + 6]) + * normalize_vector(sep_ax[b_ax*3 + g_ax + 6]) + */ + for (__pyx_t_7 = 0; __pyx_t_7 < 3; __pyx_t_7+=1) { + __pyx_v_g_ax = __pyx_t_7; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":198 + * normalize_vector(sep_ax[b_ax + 3]) + * for g_ax in range(3): + * get_cross_product(b_vec[b_ax], a_vec[g_ax], sep_ax[b_ax*3 + g_ax + 6]) # <<<<<<<<<<<<<< + * normalize_vector(sep_ax[b_ax*3 + g_ax + 6]) + * + */ + __pyx_f_2yt_9amr_utils_get_cross_product((__pyx_v_b_vec[__pyx_v_b_ax]), (__pyx_v_a_vec[__pyx_v_g_ax]), (__pyx_v_sep_ax[(((__pyx_v_b_ax * 3) + __pyx_v_g_ax) + 6)])); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":199 + * for g_ax in range(3): + * get_cross_product(b_vec[b_ax], a_vec[g_ax], sep_ax[b_ax*3 + g_ax + 6]) + * normalize_vector(sep_ax[b_ax*3 + g_ax + 6]) # <<<<<<<<<<<<<< + * + * for gi in range(n): + */ + __pyx_f_2yt_9amr_utils_normalize_vector((__pyx_v_sep_ax[(((__pyx_v_b_ax * 3) + __pyx_v_g_ax) + 6)])); + } + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":201 + * normalize_vector(sep_ax[b_ax*3 + g_ax + 6]) + * + * for gi in range(n): # <<<<<<<<<<<<<< + * for g_ax in range(3): + * # Calculate the separation vector + */ + __pyx_t_6 = __pyx_v_n; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_gi = __pyx_t_7; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":202 + * + * for gi in range(n): + * for g_ax in range(3): # <<<<<<<<<<<<<< + * # Calculate the separation vector + * sep_vec[g_ax] = grid_centers[gi, g_ax] - box_center[g_ax] + */ + for (__pyx_t_14 = 0; __pyx_t_14 < 3; __pyx_t_14+=1) { + __pyx_v_g_ax = __pyx_t_14; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":204 + * for g_ax in range(3): + * # Calculate the separation vector + * sep_vec[g_ax] = grid_centers[gi, g_ax] - box_center[g_ax] # <<<<<<<<<<<<<< + * # Calculate the grid axis lengths + * g_vec[g_ax][0] = g_vec[g_ax][1] = g_vec[g_ax][2] = 0.0 + */ + __pyx_t_15 = __pyx_v_gi; + __pyx_t_16 = __pyx_v_g_ax; + __pyx_t_17 = __pyx_v_g_ax; + (__pyx_v_sep_vec[__pyx_v_g_ax]) = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_grid_centers.buf, __pyx_t_15, __pyx_bstride_0_grid_centers, __pyx_t_16, __pyx_bstride_1_grid_centers)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_box_center.buf, __pyx_t_17, __pyx_bstride_0_box_center))); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":206 + * sep_vec[g_ax] = grid_centers[gi, g_ax] - box_center[g_ax] + * # Calculate the grid axis lengths + * g_vec[g_ax][0] = g_vec[g_ax][1] = g_vec[g_ax][2] = 0.0 # <<<<<<<<<<<<<< + * g_vec[g_ax][g_ax] = 0.5 * (grid_right_edges[gi, g_ax] + * - grid_left_edges[gi, g_ax]) + */ + ((__pyx_v_g_vec[__pyx_v_g_ax])[0]) = 0.0; + ((__pyx_v_g_vec[__pyx_v_g_ax])[1]) = 0.0; + ((__pyx_v_g_vec[__pyx_v_g_ax])[2]) = 0.0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":207 + * # Calculate the grid axis lengths + * g_vec[g_ax][0] = g_vec[g_ax][1] = g_vec[g_ax][2] = 0.0 + * g_vec[g_ax][g_ax] = 0.5 * (grid_right_edges[gi, g_ax] # <<<<<<<<<<<<<< + * - grid_left_edges[gi, g_ax]) + * for b_ax in range(15): + */ + __pyx_t_18 = __pyx_v_gi; + __pyx_t_19 = __pyx_v_g_ax; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":208 + * g_vec[g_ax][0] = g_vec[g_ax][1] = g_vec[g_ax][2] = 0.0 + * g_vec[g_ax][g_ax] = 0.5 * (grid_right_edges[gi, g_ax] + * - grid_left_edges[gi, g_ax]) # <<<<<<<<<<<<<< + * for b_ax in range(15): + * #print b_ax, + */ + __pyx_t_20 = __pyx_v_gi; + __pyx_t_21 = __pyx_v_g_ax; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":207 + * # Calculate the grid axis lengths + * g_vec[g_ax][0] = g_vec[g_ax][1] = g_vec[g_ax][2] = 0.0 + * g_vec[g_ax][g_ax] = 0.5 * (grid_right_edges[gi, g_ax] # <<<<<<<<<<<<<< + * - grid_left_edges[gi, g_ax]) + * for b_ax in range(15): + */ + ((__pyx_v_g_vec[__pyx_v_g_ax])[__pyx_v_g_ax]) = (0.5 * ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_grid_right_edges.buf, __pyx_t_18, __pyx_bstride_0_grid_right_edges, __pyx_t_19, __pyx_bstride_1_grid_right_edges)) - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_grid_left_edges.buf, __pyx_t_20, __pyx_bstride_0_grid_left_edges, __pyx_t_21, __pyx_bstride_1_grid_left_edges)))); + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":209 + * g_vec[g_ax][g_ax] = 0.5 * (grid_right_edges[gi, g_ax] + * - grid_left_edges[gi, g_ax]) + * for b_ax in range(15): # <<<<<<<<<<<<<< + * #print b_ax, + * if check_projected_overlap( + */ + for (__pyx_t_14 = 0; __pyx_t_14 < 15; __pyx_t_14+=1) { + __pyx_v_b_ax = __pyx_t_14; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":213 + * if check_projected_overlap( + * sep_ax[b_ax], sep_vec, gi, + * b_vec, g_vec): # <<<<<<<<<<<<<< + * good[gi] = 1 + * break + */ + __pyx_t_22 = __pyx_f_2yt_9amr_utils_check_projected_overlap((__pyx_v_sep_ax[__pyx_v_b_ax]), __pyx_v_sep_vec, __pyx_v_gi, __pyx_v_b_vec, __pyx_v_g_vec); + if (__pyx_t_22) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":214 + * sep_ax[b_ax], sep_vec, gi, + * b_vec, g_vec): + * good[gi] = 1 # <<<<<<<<<<<<<< + * break + * return good + */ + __pyx_t_22 = __pyx_v_gi; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_good.buf, __pyx_t_22, __pyx_bstride_0_good) = 1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":215 + * b_vec, g_vec): + * good[gi] = 1 + * break # <<<<<<<<<<<<<< + * return good + * + */ + goto __pyx_L21_break; + goto __pyx_L22; + } + __pyx_L22:; + } + __pyx_L21_break:; + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":216 + * good[gi] = 1 + * break + * return good # <<<<<<<<<<<<<< + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_good)); + __pyx_r = ((PyObject *)__pyx_v_good); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_left_edges); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_box_vectors); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_good); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_right_edges); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_centers); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_box_center); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.amr_utils.find_grids_in_inclined_box"); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_left_edges); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_box_vectors); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_good); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_right_edges); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_centers); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_box_center); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_good); + __Pyx_DECREF((PyObject *)__pyx_v_grid_centers); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":36 + * + * @cython.boundscheck(False) + * def Transfer3D(np.ndarray[np.float64_t, ndim=3] i_s, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t, ndim=4] o_s, + * np.ndarray[np.float64_t, ndim=4] e, + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_Transfer3D(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2yt_9amr_utils_Transfer3D[] = "\n This function accepts an incoming slab (*i_s*), a buffer\n for an outgoing set of values at every point in the grid (*o_s*),\n an emission array (*e*), an absorption array (*a*), and dimensions of\n the grid (*imin*, *imax*, *jmin*, *jmax*, *kmin*, *kmax*) as well\n as strides in the *i* and *j* directions, and a *dx* of the grid being\n integrated.\n "; +static PyObject *__pyx_pf_2yt_9amr_utils_Transfer3D(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_i_s = 0; + PyArrayObject *__pyx_v_o_s = 0; + PyArrayObject *__pyx_v_e = 0; + PyArrayObject *__pyx_v_a = 0; + int __pyx_v_imin; + int __pyx_v_imax; + int __pyx_v_jmin; + int __pyx_v_jmax; + int __pyx_v_kmin; + int __pyx_v_kmax; + int __pyx_v_istride; + int __pyx_v_jstride; + __pyx_t_5numpy_float64_t __pyx_v_dx; + int __pyx_v_i; + int __pyx_v_ii; + int __pyx_v_j; + int __pyx_v_jj; + int __pyx_v_k; + int __pyx_v_kk; + int __pyx_v_n; + int __pyx_v_nn; + __pyx_t_5numpy_float64_t *__pyx_v_temp; + Py_buffer __pyx_bstruct_o_s; + Py_ssize_t __pyx_bstride_0_o_s = 0; + Py_ssize_t __pyx_bstride_1_o_s = 0; + Py_ssize_t __pyx_bstride_2_o_s = 0; + Py_ssize_t __pyx_bstride_3_o_s = 0; + Py_ssize_t __pyx_bshape_0_o_s = 0; + Py_ssize_t __pyx_bshape_1_o_s = 0; + Py_ssize_t __pyx_bshape_2_o_s = 0; + Py_ssize_t __pyx_bshape_3_o_s = 0; + Py_buffer __pyx_bstruct_i_s; + Py_ssize_t __pyx_bstride_0_i_s = 0; + Py_ssize_t __pyx_bstride_1_i_s = 0; + Py_ssize_t __pyx_bstride_2_i_s = 0; + Py_ssize_t __pyx_bshape_0_i_s = 0; + Py_ssize_t __pyx_bshape_1_i_s = 0; + Py_ssize_t __pyx_bshape_2_i_s = 0; + Py_buffer __pyx_bstruct_a; + Py_ssize_t __pyx_bstride_0_a = 0; + Py_ssize_t __pyx_bstride_1_a = 0; + Py_ssize_t __pyx_bstride_2_a = 0; + Py_ssize_t __pyx_bstride_3_a = 0; + Py_ssize_t __pyx_bshape_0_a = 0; + Py_ssize_t __pyx_bshape_1_a = 0; + Py_ssize_t __pyx_bshape_2_a = 0; + Py_ssize_t __pyx_bshape_3_a = 0; + Py_buffer __pyx_bstruct_e; + Py_ssize_t __pyx_bstride_0_e = 0; + Py_ssize_t __pyx_bstride_1_e = 0; + Py_ssize_t __pyx_bstride_2_e = 0; + Py_ssize_t __pyx_bstride_3_e = 0; + Py_ssize_t __pyx_bshape_0_e = 0; + Py_ssize_t __pyx_bshape_1_e = 0; + Py_ssize_t __pyx_bshape_2_e = 0; + Py_ssize_t __pyx_bshape_3_e = 0; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + 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; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + int __pyx_t_18; + int __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; + int __pyx_t_23; + int __pyx_t_24; + int __pyx_t_25; + int __pyx_t_26; + int __pyx_t_27; + int __pyx_t_28; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__i_s,&__pyx_n_s__o_s,&__pyx_n_s__e,&__pyx_n_s__a,&__pyx_n_s__imin,&__pyx_n_s__imax,&__pyx_n_s__jmin,&__pyx_n_s__jmax,&__pyx_n_s__kmin,&__pyx_n_s__kmax,&__pyx_n_s__istride,&__pyx_n_s__jstride,&__pyx_n_s__dx,0}; + __Pyx_RefNannySetupContext("Transfer3D"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[13] = {0,0,0,0,0,0,0,0,0,0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); + case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); + case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); + case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); + case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i_s); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__o_s); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 1); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__e); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 2); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 3); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__imin); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 4); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__imax); + if (likely(values[5])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 5); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 6: + values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__jmin); + if (likely(values[6])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 6); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 7: + values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__jmax); + if (likely(values[7])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 7); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 8: + values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__kmin); + if (likely(values[8])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 8); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 9: + values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__kmax); + if (likely(values[9])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 9); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 10: + values[10] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__istride); + if (likely(values[10])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 10); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 11: + values[11] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__jstride); + if (likely(values[11])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 11); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 12: + values[12] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dx); + if (likely(values[12])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 12); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "Transfer3D") < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_i_s = ((PyArrayObject *)values[0]); + __pyx_v_o_s = ((PyArrayObject *)values[1]); + __pyx_v_e = ((PyArrayObject *)values[2]); + __pyx_v_a = ((PyArrayObject *)values[3]); + __pyx_v_imin = __Pyx_PyInt_AsInt(values[4]); if (unlikely((__pyx_v_imin == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_imax = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_imax == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_jmin = __Pyx_PyInt_AsInt(values[6]); if (unlikely((__pyx_v_jmin == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_jmax = __Pyx_PyInt_AsInt(values[7]); if (unlikely((__pyx_v_jmax == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_kmin = __Pyx_PyInt_AsInt(values[8]); if (unlikely((__pyx_v_kmin == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_kmax = __Pyx_PyInt_AsInt(values[9]); if (unlikely((__pyx_v_kmax == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_istride = __Pyx_PyInt_AsInt(values[10]); if (unlikely((__pyx_v_istride == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_jstride = __Pyx_PyInt_AsInt(values[11]); if (unlikely((__pyx_v_jstride == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_dx = __pyx_PyFloat_AsDouble(values[12]); if (unlikely((__pyx_v_dx == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else if (PyTuple_GET_SIZE(__pyx_args) != 13) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_i_s = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); + __pyx_v_o_s = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); + __pyx_v_e = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); + __pyx_v_a = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); + __pyx_v_imin = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_imin == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_imax = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_imax == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_jmin = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 6)); if (unlikely((__pyx_v_jmin == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_jmax = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 7)); if (unlikely((__pyx_v_jmax == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_kmin = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 8)); if (unlikely((__pyx_v_kmin == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_kmax = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 9)); if (unlikely((__pyx_v_kmax == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_istride = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 10)); if (unlikely((__pyx_v_istride == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_jstride = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 11)); if (unlikely((__pyx_v_jstride == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_dx = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 12)); if (unlikely((__pyx_v_dx == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.Transfer3D"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_bstruct_i_s.buf = NULL; + __pyx_bstruct_o_s.buf = NULL; + __pyx_bstruct_e.buf = NULL; + __pyx_bstruct_a.buf = NULL; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_i_s), __pyx_ptype_5numpy_ndarray, 1, "i_s", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_o_s), __pyx_ptype_5numpy_ndarray, 1, "o_s", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_e), __pyx_ptype_5numpy_ndarray, 1, "e", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_5numpy_ndarray, 1, "a", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_i_s, (PyObject*)__pyx_v_i_s, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_i_s = __pyx_bstruct_i_s.strides[0]; __pyx_bstride_1_i_s = __pyx_bstruct_i_s.strides[1]; __pyx_bstride_2_i_s = __pyx_bstruct_i_s.strides[2]; + __pyx_bshape_0_i_s = __pyx_bstruct_i_s.shape[0]; __pyx_bshape_1_i_s = __pyx_bstruct_i_s.shape[1]; __pyx_bshape_2_i_s = __pyx_bstruct_i_s.shape[2]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_o_s, (PyObject*)__pyx_v_o_s, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_o_s = __pyx_bstruct_o_s.strides[0]; __pyx_bstride_1_o_s = __pyx_bstruct_o_s.strides[1]; __pyx_bstride_2_o_s = __pyx_bstruct_o_s.strides[2]; __pyx_bstride_3_o_s = __pyx_bstruct_o_s.strides[3]; + __pyx_bshape_0_o_s = __pyx_bstruct_o_s.shape[0]; __pyx_bshape_1_o_s = __pyx_bstruct_o_s.shape[1]; __pyx_bshape_2_o_s = __pyx_bstruct_o_s.shape[2]; __pyx_bshape_3_o_s = __pyx_bstruct_o_s.shape[3]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_e, (PyObject*)__pyx_v_e, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_e = __pyx_bstruct_e.strides[0]; __pyx_bstride_1_e = __pyx_bstruct_e.strides[1]; __pyx_bstride_2_e = __pyx_bstruct_e.strides[2]; __pyx_bstride_3_e = __pyx_bstruct_e.strides[3]; + __pyx_bshape_0_e = __pyx_bstruct_e.shape[0]; __pyx_bshape_1_e = __pyx_bstruct_e.shape[1]; __pyx_bshape_2_e = __pyx_bstruct_e.shape[2]; __pyx_bshape_3_e = __pyx_bstruct_e.shape[3]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_a, (PyObject*)__pyx_v_a, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_a = __pyx_bstruct_a.strides[0]; __pyx_bstride_1_a = __pyx_bstruct_a.strides[1]; __pyx_bstride_2_a = __pyx_bstruct_a.strides[2]; __pyx_bstride_3_a = __pyx_bstruct_a.strides[3]; + __pyx_bshape_0_a = __pyx_bstruct_a.shape[0]; __pyx_bshape_1_a = __pyx_bstruct_a.shape[1]; __pyx_bshape_2_a = __pyx_bstruct_a.shape[2]; __pyx_bshape_3_a = __pyx_bstruct_a.shape[3]; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":55 + * cdef int k, kk + * cdef int n, nn + * nn = o_s.shape[3] # This might be slow # <<<<<<<<<<<<<< + * cdef np.float64_t *temp = malloc(sizeof(np.float64_t) * nn) + * for i in range((imax-imin)*istride): + */ + __pyx_v_nn = (__pyx_v_o_s->dimensions[3]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":56 + * cdef int n, nn + * nn = o_s.shape[3] # This might be slow + * cdef np.float64_t *temp = malloc(sizeof(np.float64_t) * nn) # <<<<<<<<<<<<<< + * for i in range((imax-imin)*istride): + * ii = i + imin*istride + */ + __pyx_v_temp = ((__pyx_t_5numpy_float64_t *)malloc(((sizeof(__pyx_t_5numpy_float64_t)) * __pyx_v_nn))); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":57 + * nn = o_s.shape[3] # This might be slow + * cdef np.float64_t *temp = malloc(sizeof(np.float64_t) * nn) + * for i in range((imax-imin)*istride): # <<<<<<<<<<<<<< + * ii = i + imin*istride + * for j in range((jmax-jmin)*jstride): + */ + __pyx_t_1 = ((__pyx_v_imax - __pyx_v_imin) * __pyx_v_istride); + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":58 + * cdef np.float64_t *temp = malloc(sizeof(np.float64_t) * nn) + * for i in range((imax-imin)*istride): + * ii = i + imin*istride # <<<<<<<<<<<<<< + * for j in range((jmax-jmin)*jstride): + * jj = j + jmin*jstride + */ + __pyx_v_ii = (__pyx_v_i + (__pyx_v_imin * __pyx_v_istride)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":59 + * for i in range((imax-imin)*istride): + * ii = i + imin*istride + * for j in range((jmax-jmin)*jstride): # <<<<<<<<<<<<<< + * jj = j + jmin*jstride + * # Not sure about the ordering of the loops here + */ + __pyx_t_3 = ((__pyx_v_jmax - __pyx_v_jmin) * __pyx_v_jstride); + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_j = __pyx_t_4; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":60 + * ii = i + imin*istride + * for j in range((jmax-jmin)*jstride): + * jj = j + jmin*jstride # <<<<<<<<<<<<<< + * # Not sure about the ordering of the loops here + * for n in range(nn): + */ + __pyx_v_jj = (__pyx_v_j + (__pyx_v_jmin * __pyx_v_jstride)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":62 + * jj = j + jmin*jstride + * # Not sure about the ordering of the loops here + * for n in range(nn): # <<<<<<<<<<<<<< + * temp[n] = i_s[ii,jj,n] + * for k in range(kmax-kmin): + */ + __pyx_t_5 = __pyx_v_nn; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_n = __pyx_t_6; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":63 + * # Not sure about the ordering of the loops here + * for n in range(nn): + * temp[n] = i_s[ii,jj,n] # <<<<<<<<<<<<<< + * for k in range(kmax-kmin): + * kk = k + kmin#*kstride, which doesn't make any sense + */ + __pyx_t_7 = __pyx_v_ii; + __pyx_t_8 = __pyx_v_jj; + __pyx_t_9 = __pyx_v_n; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_bshape_0_i_s; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_bshape_1_i_s; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_bshape_2_i_s; + (__pyx_v_temp[__pyx_v_n]) = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_i_s.buf, __pyx_t_7, __pyx_bstride_0_i_s, __pyx_t_8, __pyx_bstride_1_i_s, __pyx_t_9, __pyx_bstride_2_i_s)); + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":64 + * for n in range(nn): + * temp[n] = i_s[ii,jj,n] + * for k in range(kmax-kmin): # <<<<<<<<<<<<<< + * kk = k + kmin#*kstride, which doesn't make any sense + * for n in range(nn): + */ + __pyx_t_5 = (__pyx_v_kmax - __pyx_v_kmin); + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_k = __pyx_t_6; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":65 + * temp[n] = i_s[ii,jj,n] + * for k in range(kmax-kmin): + * kk = k + kmin#*kstride, which doesn't make any sense # <<<<<<<<<<<<<< + * for n in range(nn): + * o_s[i,j,k,n] = temp[n] + dx*(e[i,j,k,n] - temp[n]*a[i,j,k,n]) + */ + __pyx_v_kk = (__pyx_v_k + __pyx_v_kmin); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":66 + * for k in range(kmax-kmin): + * kk = k + kmin#*kstride, which doesn't make any sense + * for n in range(nn): # <<<<<<<<<<<<<< + * o_s[i,j,k,n] = temp[n] + dx*(e[i,j,k,n] - temp[n]*a[i,j,k,n]) + * temp[n] = o_s[i,j,k,n] + */ + __pyx_t_10 = __pyx_v_nn; + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { + __pyx_v_n = __pyx_t_11; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":67 + * kk = k + kmin#*kstride, which doesn't make any sense + * for n in range(nn): + * o_s[i,j,k,n] = temp[n] + dx*(e[i,j,k,n] - temp[n]*a[i,j,k,n]) # <<<<<<<<<<<<<< + * temp[n] = o_s[i,j,k,n] + * for n in range(nn): + */ + __pyx_t_12 = __pyx_v_i; + __pyx_t_13 = __pyx_v_j; + __pyx_t_14 = __pyx_v_k; + __pyx_t_15 = __pyx_v_n; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_bshape_0_e; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_bshape_1_e; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_2_e; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_3_e; + __pyx_t_16 = __pyx_v_i; + __pyx_t_17 = __pyx_v_j; + __pyx_t_18 = __pyx_v_k; + __pyx_t_19 = __pyx_v_n; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_bshape_0_a; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_bshape_1_a; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_bshape_2_a; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_bshape_3_a; + __pyx_t_20 = __pyx_v_i; + __pyx_t_21 = __pyx_v_j; + __pyx_t_22 = __pyx_v_k; + __pyx_t_23 = __pyx_v_n; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_bshape_0_o_s; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_bshape_1_o_s; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_bshape_2_o_s; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_bshape_3_o_s; + *__Pyx_BufPtrStrided4d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_o_s.buf, __pyx_t_20, __pyx_bstride_0_o_s, __pyx_t_21, __pyx_bstride_1_o_s, __pyx_t_22, __pyx_bstride_2_o_s, __pyx_t_23, __pyx_bstride_3_o_s) = ((__pyx_v_temp[__pyx_v_n]) + (__pyx_v_dx * ((*__Pyx_BufPtrStrided4d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_e.buf, __pyx_t_12, __pyx_bstride_0_e, __pyx_t_13, __pyx_bstride_1_e, __pyx_t_14, __pyx_bstride_2_e, __pyx_t_15, __pyx_bstride_3_e)) - ((__pyx_v_temp[__pyx_v_n]) * (*__Pyx_BufPtrStrided4d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_a.buf, __pyx_t_16, __pyx_bstride_0_a, __pyx_t_17, __pyx_bstride_1_a, __pyx_t_18, __pyx_bstride_2_a, __pyx_t_19, __pyx_bstride_3_a)))))); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":68 + * for n in range(nn): + * o_s[i,j,k,n] = temp[n] + dx*(e[i,j,k,n] - temp[n]*a[i,j,k,n]) + * temp[n] = o_s[i,j,k,n] # <<<<<<<<<<<<<< + * for n in range(nn): + * i_s[ii,jj,n] = temp[n] + */ + __pyx_t_24 = __pyx_v_i; + __pyx_t_25 = __pyx_v_j; + __pyx_t_26 = __pyx_v_k; + __pyx_t_27 = __pyx_v_n; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_bshape_0_o_s; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_bshape_1_o_s; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_bshape_2_o_s; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_bshape_3_o_s; + (__pyx_v_temp[__pyx_v_n]) = (*__Pyx_BufPtrStrided4d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_o_s.buf, __pyx_t_24, __pyx_bstride_0_o_s, __pyx_t_25, __pyx_bstride_1_o_s, __pyx_t_26, __pyx_bstride_2_o_s, __pyx_t_27, __pyx_bstride_3_o_s)); + } + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":69 + * o_s[i,j,k,n] = temp[n] + dx*(e[i,j,k,n] - temp[n]*a[i,j,k,n]) + * temp[n] = o_s[i,j,k,n] + * for n in range(nn): # <<<<<<<<<<<<<< + * i_s[ii,jj,n] = temp[n] + * free(temp) + */ + __pyx_t_5 = __pyx_v_nn; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_n = __pyx_t_6; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":70 + * temp[n] = o_s[i,j,k,n] + * for n in range(nn): + * i_s[ii,jj,n] = temp[n] # <<<<<<<<<<<<<< + * free(temp) + * + */ + __pyx_t_10 = __pyx_v_ii; + __pyx_t_11 = __pyx_v_jj; + __pyx_t_28 = __pyx_v_n; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_bshape_0_i_s; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_bshape_1_i_s; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_bshape_2_i_s; + *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_i_s.buf, __pyx_t_10, __pyx_bstride_0_i_s, __pyx_t_11, __pyx_bstride_1_i_s, __pyx_t_28, __pyx_bstride_2_i_s) = (__pyx_v_temp[__pyx_v_n]); + } + } + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":71 + * for n in range(nn): + * i_s[ii,jj,n] = temp[n] + * free(temp) # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + free(__pyx_v_temp); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_o_s); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_i_s); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_a); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_e); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.amr_utils.Transfer3D"); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_o_s); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_i_s); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_a); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_e); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":74 + * + * @cython.boundscheck(False) + * def TransferShells(np.ndarray[np.float64_t, ndim=3] i_s, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t, ndim=3] data, + * np.ndarray[np.float64_t, ndim=2] shells): + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_TransferShells(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2yt_9amr_utils_TransferShells[] = "\n This function accepts an incoming slab (*i_s*), a buffer of *data*,\n and a list of shells specified as [ (value, tolerance, r, g, b), ... ].\n "; +static PyObject *__pyx_pf_2yt_9amr_utils_TransferShells(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_i_s = 0; + PyArrayObject *__pyx_v_data = 0; + PyArrayObject *__pyx_v_shells = 0; + int __pyx_v_i; + int __pyx_v_ii; + int __pyx_v_j; + int __pyx_v_jj; + int __pyx_v_k; + int __pyx_v_kk; + int __pyx_v_n; + int __pyx_v_nn; + __pyx_t_5numpy_float64_t __pyx_v_dist; + float __pyx_v_rgba[4]; + float __pyx_v_alpha; + Py_buffer __pyx_bstruct_shells; + Py_ssize_t __pyx_bstride_0_shells = 0; + Py_ssize_t __pyx_bstride_1_shells = 0; + Py_ssize_t __pyx_bshape_0_shells = 0; + Py_ssize_t __pyx_bshape_1_shells = 0; + Py_buffer __pyx_bstruct_i_s; + Py_ssize_t __pyx_bstride_0_i_s = 0; + Py_ssize_t __pyx_bstride_1_i_s = 0; + Py_ssize_t __pyx_bstride_2_i_s = 0; + Py_ssize_t __pyx_bshape_0_i_s = 0; + Py_ssize_t __pyx_bshape_1_i_s = 0; + Py_ssize_t __pyx_bshape_2_i_s = 0; + Py_buffer __pyx_bstruct_data; + Py_ssize_t __pyx_bstride_0_data = 0; + Py_ssize_t __pyx_bstride_1_data = 0; + Py_ssize_t __pyx_bstride_2_data = 0; + Py_ssize_t __pyx_bshape_0_data = 0; + Py_ssize_t __pyx_bshape_1_data = 0; + Py_ssize_t __pyx_bshape_2_data = 0; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + long __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + long __pyx_t_16; + int __pyx_t_17; + long __pyx_t_18; + int __pyx_t_19; + long __pyx_t_20; + int __pyx_t_21; + long __pyx_t_22; + int __pyx_t_23; + long __pyx_t_24; + int __pyx_t_25; + int __pyx_t_26; + long __pyx_t_27; + int __pyx_t_28; + int __pyx_t_29; + long __pyx_t_30; + int __pyx_t_31; + int __pyx_t_32; + long __pyx_t_33; + int __pyx_t_34; + int __pyx_t_35; + long __pyx_t_36; + int __pyx_t_37; + int __pyx_t_38; + long __pyx_t_39; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__i_s,&__pyx_n_s__data,&__pyx_n_s__shells,0}; + __Pyx_RefNannySetupContext("TransferShells"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[3] = {0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i_s); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("TransferShells", 1, 3, 3, 1); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__shells); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("TransferShells", 1, 3, 3, 2); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "TransferShells") < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_i_s = ((PyArrayObject *)values[0]); + __pyx_v_data = ((PyArrayObject *)values[1]); + __pyx_v_shells = ((PyArrayObject *)values[2]); + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_i_s = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); + __pyx_v_data = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); + __pyx_v_shells = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("TransferShells", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.TransferShells"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_bstruct_i_s.buf = NULL; + __pyx_bstruct_data.buf = NULL; + __pyx_bstruct_shells.buf = NULL; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_i_s), __pyx_ptype_5numpy_ndarray, 1, "i_s", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), __pyx_ptype_5numpy_ndarray, 1, "data", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shells), __pyx_ptype_5numpy_ndarray, 1, "shells", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_i_s, (PyObject*)__pyx_v_i_s, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_i_s = __pyx_bstruct_i_s.strides[0]; __pyx_bstride_1_i_s = __pyx_bstruct_i_s.strides[1]; __pyx_bstride_2_i_s = __pyx_bstruct_i_s.strides[2]; + __pyx_bshape_0_i_s = __pyx_bstruct_i_s.shape[0]; __pyx_bshape_1_i_s = __pyx_bstruct_i_s.shape[1]; __pyx_bshape_2_i_s = __pyx_bstruct_i_s.shape[2]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_data, (PyObject*)__pyx_v_data, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_data = __pyx_bstruct_data.strides[0]; __pyx_bstride_1_data = __pyx_bstruct_data.strides[1]; __pyx_bstride_2_data = __pyx_bstruct_data.strides[2]; + __pyx_bshape_0_data = __pyx_bstruct_data.shape[0]; __pyx_bshape_1_data = __pyx_bstruct_data.shape[1]; __pyx_bshape_2_data = __pyx_bstruct_data.shape[2]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_shells, (PyObject*)__pyx_v_shells, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_shells = __pyx_bstruct_shells.strides[0]; __pyx_bstride_1_shells = __pyx_bstruct_shells.strides[1]; + __pyx_bshape_0_shells = __pyx_bstruct_shells.shape[0]; __pyx_bshape_1_shells = __pyx_bstruct_shells.shape[1]; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":86 + * cdef int n, nn + * cdef np.float64_t dist + * ii = data.shape[0] # <<<<<<<<<<<<<< + * jj = data.shape[1] + * kk = data.shape[2] + */ + __pyx_v_ii = (__pyx_v_data->dimensions[0]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":87 + * cdef np.float64_t dist + * ii = data.shape[0] + * jj = data.shape[1] # <<<<<<<<<<<<<< + * kk = data.shape[2] + * nn = shells.shape[0] + */ + __pyx_v_jj = (__pyx_v_data->dimensions[1]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":88 + * ii = data.shape[0] + * jj = data.shape[1] + * kk = data.shape[2] # <<<<<<<<<<<<<< + * nn = shells.shape[0] + * cdef float rgba[4] + */ + __pyx_v_kk = (__pyx_v_data->dimensions[2]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":89 + * jj = data.shape[1] + * kk = data.shape[2] + * nn = shells.shape[0] # <<<<<<<<<<<<<< + * cdef float rgba[4] + * cdef float alpha + */ + __pyx_v_nn = (__pyx_v_shells->dimensions[0]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":92 + * cdef float rgba[4] + * cdef float alpha + * for i in range(ii): # <<<<<<<<<<<<<< + * for j in range(jj): + * # Not sure about the ordering of the loops here + */ + __pyx_t_1 = __pyx_v_ii; + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":93 + * cdef float alpha + * for i in range(ii): + * for j in range(jj): # <<<<<<<<<<<<<< + * # Not sure about the ordering of the loops here + * for k in range(kk): + */ + __pyx_t_3 = __pyx_v_jj; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_j = __pyx_t_4; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":95 + * for j in range(jj): + * # Not sure about the ordering of the loops here + * for k in range(kk): # <<<<<<<<<<<<<< + * for n in range(nn): + * dist = shells[n, 0] - data[i,j,k] + */ + __pyx_t_5 = __pyx_v_kk; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_k = __pyx_t_6; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":96 + * # Not sure about the ordering of the loops here + * for k in range(kk): + * for n in range(nn): # <<<<<<<<<<<<<< + * dist = shells[n, 0] - data[i,j,k] + * if dist < 0: dist *= -1.0 + */ + __pyx_t_7 = __pyx_v_nn; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { + __pyx_v_n = __pyx_t_8; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":97 + * for k in range(kk): + * for n in range(nn): + * dist = shells[n, 0] - data[i,j,k] # <<<<<<<<<<<<<< + * if dist < 0: dist *= -1.0 + * if dist < shells[n,1]: + */ + __pyx_t_9 = __pyx_v_n; + __pyx_t_10 = 0; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_bshape_0_shells; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_bshape_1_shells; + __pyx_t_11 = __pyx_v_i; + __pyx_t_12 = __pyx_v_j; + __pyx_t_13 = __pyx_v_k; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_bshape_0_data; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_bshape_1_data; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_bshape_2_data; + __pyx_v_dist = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_shells.buf, __pyx_t_9, __pyx_bstride_0_shells, __pyx_t_10, __pyx_bstride_1_shells)) - (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_data.buf, __pyx_t_11, __pyx_bstride_0_data, __pyx_t_12, __pyx_bstride_1_data, __pyx_t_13, __pyx_bstride_2_data))); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":98 + * for n in range(nn): + * dist = shells[n, 0] - data[i,j,k] + * if dist < 0: dist *= -1.0 # <<<<<<<<<<<<<< + * if dist < shells[n,1]: + * dist = exp(-dist/8.0) + */ + __pyx_t_14 = (__pyx_v_dist < 0.0); + if (__pyx_t_14) { + __pyx_v_dist *= (-1.0); + goto __pyx_L14; + } + __pyx_L14:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":99 + * dist = shells[n, 0] - data[i,j,k] + * if dist < 0: dist *= -1.0 + * if dist < shells[n,1]: # <<<<<<<<<<<<<< + * dist = exp(-dist/8.0) + * rgba[0] = shells[n,2] + */ + __pyx_t_15 = __pyx_v_n; + __pyx_t_16 = 1; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_0_shells; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_bshape_1_shells; + __pyx_t_14 = (__pyx_v_dist < (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_shells.buf, __pyx_t_15, __pyx_bstride_0_shells, __pyx_t_16, __pyx_bstride_1_shells))); + if (__pyx_t_14) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":100 + * if dist < 0: dist *= -1.0 + * if dist < shells[n,1]: + * dist = exp(-dist/8.0) # <<<<<<<<<<<<<< + * rgba[0] = shells[n,2] + * rgba[1] = shells[n,3] + */ + __pyx_v_dist = exp(((-__pyx_v_dist) / 8.0)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":101 + * if dist < shells[n,1]: + * dist = exp(-dist/8.0) + * rgba[0] = shells[n,2] # <<<<<<<<<<<<<< + * rgba[1] = shells[n,3] + * rgba[2] = shells[n,4] + */ + __pyx_t_17 = __pyx_v_n; + __pyx_t_18 = 2; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_bshape_0_shells; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_bshape_1_shells; + (__pyx_v_rgba[0]) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_shells.buf, __pyx_t_17, __pyx_bstride_0_shells, __pyx_t_18, __pyx_bstride_1_shells)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":102 + * dist = exp(-dist/8.0) + * rgba[0] = shells[n,2] + * rgba[1] = shells[n,3] # <<<<<<<<<<<<<< + * rgba[2] = shells[n,4] + * rgba[3] = shells[n,5] + */ + __pyx_t_19 = __pyx_v_n; + __pyx_t_20 = 3; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_bshape_0_shells; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_bshape_1_shells; + (__pyx_v_rgba[1]) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_shells.buf, __pyx_t_19, __pyx_bstride_0_shells, __pyx_t_20, __pyx_bstride_1_shells)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":103 + * rgba[0] = shells[n,2] + * rgba[1] = shells[n,3] + * rgba[2] = shells[n,4] # <<<<<<<<<<<<<< + * rgba[3] = shells[n,5] + * alpha = i_s[i,j,3] + */ + __pyx_t_21 = __pyx_v_n; + __pyx_t_22 = 4; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_bshape_0_shells; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_bshape_1_shells; + (__pyx_v_rgba[2]) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_shells.buf, __pyx_t_21, __pyx_bstride_0_shells, __pyx_t_22, __pyx_bstride_1_shells)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":104 + * rgba[1] = shells[n,3] + * rgba[2] = shells[n,4] + * rgba[3] = shells[n,5] # <<<<<<<<<<<<<< + * alpha = i_s[i,j,3] + * dist *= dist # This might improve appearance + */ + __pyx_t_23 = __pyx_v_n; + __pyx_t_24 = 5; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_bshape_0_shells; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_bshape_1_shells; + (__pyx_v_rgba[3]) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_shells.buf, __pyx_t_23, __pyx_bstride_0_shells, __pyx_t_24, __pyx_bstride_1_shells)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":105 + * rgba[2] = shells[n,4] + * rgba[3] = shells[n,5] + * alpha = i_s[i,j,3] # <<<<<<<<<<<<<< + * dist *= dist # This might improve appearance + * i_s[i,j,0] += (1.0 - alpha)*rgba[0]*dist*rgba[3] + */ + __pyx_t_25 = __pyx_v_i; + __pyx_t_26 = __pyx_v_j; + __pyx_t_27 = 3; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_bshape_0_i_s; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_bshape_1_i_s; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_bshape_2_i_s; + __pyx_v_alpha = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_i_s.buf, __pyx_t_25, __pyx_bstride_0_i_s, __pyx_t_26, __pyx_bstride_1_i_s, __pyx_t_27, __pyx_bstride_2_i_s)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":106 + * rgba[3] = shells[n,5] + * alpha = i_s[i,j,3] + * dist *= dist # This might improve appearance # <<<<<<<<<<<<<< + * i_s[i,j,0] += (1.0 - alpha)*rgba[0]*dist*rgba[3] + * i_s[i,j,1] += (1.0 - alpha)*rgba[1]*dist*rgba[3] + */ + __pyx_v_dist *= __pyx_v_dist; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":107 + * alpha = i_s[i,j,3] + * dist *= dist # This might improve appearance + * i_s[i,j,0] += (1.0 - alpha)*rgba[0]*dist*rgba[3] # <<<<<<<<<<<<<< + * i_s[i,j,1] += (1.0 - alpha)*rgba[1]*dist*rgba[3] + * i_s[i,j,2] += (1.0 - alpha)*rgba[2]*dist*rgba[3] + */ + __pyx_t_28 = __pyx_v_i; + __pyx_t_29 = __pyx_v_j; + __pyx_t_30 = 0; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_bshape_0_i_s; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_bshape_1_i_s; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_bshape_2_i_s; + *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_i_s.buf, __pyx_t_28, __pyx_bstride_0_i_s, __pyx_t_29, __pyx_bstride_1_i_s, __pyx_t_30, __pyx_bstride_2_i_s) += ((((1.0 - __pyx_v_alpha) * (__pyx_v_rgba[0])) * __pyx_v_dist) * (__pyx_v_rgba[3])); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":108 + * dist *= dist # This might improve appearance + * i_s[i,j,0] += (1.0 - alpha)*rgba[0]*dist*rgba[3] + * i_s[i,j,1] += (1.0 - alpha)*rgba[1]*dist*rgba[3] # <<<<<<<<<<<<<< + * i_s[i,j,2] += (1.0 - alpha)*rgba[2]*dist*rgba[3] + * i_s[i,j,3] += (1.0 - alpha)*rgba[3]*dist*rgba[3] + */ + __pyx_t_31 = __pyx_v_i; + __pyx_t_32 = __pyx_v_j; + __pyx_t_33 = 1; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_bshape_0_i_s; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_bshape_1_i_s; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_bshape_2_i_s; + *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_i_s.buf, __pyx_t_31, __pyx_bstride_0_i_s, __pyx_t_32, __pyx_bstride_1_i_s, __pyx_t_33, __pyx_bstride_2_i_s) += ((((1.0 - __pyx_v_alpha) * (__pyx_v_rgba[1])) * __pyx_v_dist) * (__pyx_v_rgba[3])); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":109 + * i_s[i,j,0] += (1.0 - alpha)*rgba[0]*dist*rgba[3] + * i_s[i,j,1] += (1.0 - alpha)*rgba[1]*dist*rgba[3] + * i_s[i,j,2] += (1.0 - alpha)*rgba[2]*dist*rgba[3] # <<<<<<<<<<<<<< + * i_s[i,j,3] += (1.0 - alpha)*rgba[3]*dist*rgba[3] + * break + */ + __pyx_t_34 = __pyx_v_i; + __pyx_t_35 = __pyx_v_j; + __pyx_t_36 = 2; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_bshape_0_i_s; + if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_bshape_1_i_s; + if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_bshape_2_i_s; + *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_i_s.buf, __pyx_t_34, __pyx_bstride_0_i_s, __pyx_t_35, __pyx_bstride_1_i_s, __pyx_t_36, __pyx_bstride_2_i_s) += ((((1.0 - __pyx_v_alpha) * (__pyx_v_rgba[2])) * __pyx_v_dist) * (__pyx_v_rgba[3])); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":110 + * i_s[i,j,1] += (1.0 - alpha)*rgba[1]*dist*rgba[3] + * i_s[i,j,2] += (1.0 - alpha)*rgba[2]*dist*rgba[3] + * i_s[i,j,3] += (1.0 - alpha)*rgba[3]*dist*rgba[3] # <<<<<<<<<<<<<< + * break + * + */ + __pyx_t_37 = __pyx_v_i; + __pyx_t_38 = __pyx_v_j; + __pyx_t_39 = 3; + if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_bshape_0_i_s; + if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_bshape_1_i_s; + if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_bshape_2_i_s; + *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_i_s.buf, __pyx_t_37, __pyx_bstride_0_i_s, __pyx_t_38, __pyx_bstride_1_i_s, __pyx_t_39, __pyx_bstride_2_i_s) += ((((1.0 - __pyx_v_alpha) * (__pyx_v_rgba[3])) * __pyx_v_dist) * (__pyx_v_rgba[3])); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":111 + * i_s[i,j,2] += (1.0 - alpha)*rgba[2]*dist*rgba[3] + * i_s[i,j,3] += (1.0 - alpha)*rgba[3]*dist*rgba[3] + * break # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + goto __pyx_L13_break; + goto __pyx_L15; + } + __pyx_L15:; + } + __pyx_L13_break:; + } + } + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_shells); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_i_s); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.amr_utils.TransferShells"); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_shells); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_i_s); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":114 + * + * @cython.boundscheck(False) + * def Transfer1D(float i_s, # <<<<<<<<<<<<<< + * np.ndarray[np.float_t, ndim=1] o_s, + * np.ndarray[np.float_t, ndim=1] e, + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_Transfer1D(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_Transfer1D(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + float __pyx_v_i_s; + PyArrayObject *__pyx_v_o_s = 0; + PyArrayObject *__pyx_v_e = 0; + PyArrayObject *__pyx_v_a = 0; + PyArrayObject *__pyx_v_dx = 0; + int __pyx_v_imin; + int __pyx_v_imax; + int __pyx_v_i; + Py_buffer __pyx_bstruct_a; + Py_ssize_t __pyx_bstride_0_a = 0; + Py_ssize_t __pyx_bshape_0_a = 0; + Py_buffer __pyx_bstruct_e; + Py_ssize_t __pyx_bstride_0_e = 0; + Py_ssize_t __pyx_bshape_0_e = 0; + Py_buffer __pyx_bstruct_o_s; + Py_ssize_t __pyx_bstride_0_o_s = 0; + Py_ssize_t __pyx_bshape_0_o_s = 0; + Py_buffer __pyx_bstruct_dx; + Py_ssize_t __pyx_bstride_0_dx = 0; + Py_ssize_t __pyx_bshape_0_dx = 0; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__i_s,&__pyx_n_s__o_s,&__pyx_n_s__e,&__pyx_n_s__a,&__pyx_n_s__dx,&__pyx_n_s__imin,&__pyx_n_s__imax,0}; + __Pyx_RefNannySetupContext("Transfer1D"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[7] = {0,0,0,0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i_s); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__o_s); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer1D", 1, 7, 7, 1); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__e); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer1D", 1, 7, 7, 2); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer1D", 1, 7, 7, 3); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dx); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer1D", 1, 7, 7, 4); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__imin); + if (likely(values[5])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer1D", 1, 7, 7, 5); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 6: + values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__imax); + if (likely(values[6])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer1D", 1, 7, 7, 6); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "Transfer1D") < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_i_s = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_i_s == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_o_s = ((PyArrayObject *)values[1]); + __pyx_v_e = ((PyArrayObject *)values[2]); + __pyx_v_a = ((PyArrayObject *)values[3]); + __pyx_v_dx = ((PyArrayObject *)values[4]); + __pyx_v_imin = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_imin == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_imax = __Pyx_PyInt_AsInt(values[6]); if (unlikely((__pyx_v_imax == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_i_s = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_i_s == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_o_s = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); + __pyx_v_e = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); + __pyx_v_a = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); + __pyx_v_dx = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); + __pyx_v_imin = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_imin == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_imax = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 6)); if (unlikely((__pyx_v_imax == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("Transfer1D", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.Transfer1D"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_bstruct_o_s.buf = NULL; + __pyx_bstruct_e.buf = NULL; + __pyx_bstruct_a.buf = NULL; + __pyx_bstruct_dx.buf = NULL; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_o_s), __pyx_ptype_5numpy_ndarray, 1, "o_s", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_e), __pyx_ptype_5numpy_ndarray, 1, "e", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_5numpy_ndarray, 1, "a", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 117; __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[4]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_o_s, (PyObject*)__pyx_v_o_s, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_o_s = __pyx_bstruct_o_s.strides[0]; + __pyx_bshape_0_o_s = __pyx_bstruct_o_s.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_e, (PyObject*)__pyx_v_e, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_e = __pyx_bstruct_e.strides[0]; + __pyx_bshape_0_e = __pyx_bstruct_e.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_a, (PyObject*)__pyx_v_a, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_a = __pyx_bstruct_a.strides[0]; + __pyx_bshape_0_a = __pyx_bstruct_a.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dx, (PyObject*)__pyx_v_dx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_dx = __pyx_bstruct_dx.strides[0]; + __pyx_bshape_0_dx = __pyx_bstruct_dx.shape[0]; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":121 + * int imin, int imax): + * cdef int i + * for i in range(imin, imax): # <<<<<<<<<<<<<< + * o_s[i] = i_s + dx[i]*(e[i] - i_s*a[i]) + * i_s = o_s[i] + */ + __pyx_t_1 = __pyx_v_imax; + for (__pyx_t_2 = __pyx_v_imin; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":122 + * cdef int i + * for i in range(imin, imax): + * o_s[i] = i_s + dx[i]*(e[i] - i_s*a[i]) # <<<<<<<<<<<<<< + * i_s = o_s[i] + * return i_s + */ + __pyx_t_3 = __pyx_v_i; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_bshape_0_dx; + __pyx_t_4 = __pyx_v_i; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_bshape_0_e; + __pyx_t_5 = __pyx_v_i; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_bshape_0_a; + __pyx_t_6 = __pyx_v_i; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_bshape_0_o_s; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float_t *, __pyx_bstruct_o_s.buf, __pyx_t_6, __pyx_bstride_0_o_s) = (__pyx_v_i_s + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float_t *, __pyx_bstruct_dx.buf, __pyx_t_3, __pyx_bstride_0_dx)) * ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float_t *, __pyx_bstruct_e.buf, __pyx_t_4, __pyx_bstride_0_e)) - (__pyx_v_i_s * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float_t *, __pyx_bstruct_a.buf, __pyx_t_5, __pyx_bstride_0_a)))))); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":123 + * for i in range(imin, imax): + * o_s[i] = i_s + dx[i]*(e[i] - i_s*a[i]) + * i_s = o_s[i] # <<<<<<<<<<<<<< + * return i_s + * + */ + __pyx_t_7 = __pyx_v_i; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_bshape_0_o_s; + __pyx_v_i_s = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float_t *, __pyx_bstruct_o_s.buf, __pyx_t_7, __pyx_bstride_0_o_s)); + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":124 + * o_s[i] = i_s + dx[i]*(e[i] - i_s*a[i]) + * i_s = o_s[i] + * return i_s # <<<<<<<<<<<<<< + * + * @cython.wraparound(False) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_8 = PyFloat_FromDouble(__pyx_v_i_s); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_r = __pyx_t_8; + __pyx_t_8 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_8); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_a); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_e); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_o_s); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dx); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.amr_utils.Transfer1D"); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_a); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_e); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_o_s); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dx); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":128 + * @cython.wraparound(False) + * @cython.boundscheck(False) + * def VoxelTraversal(np.ndarray[np.int_t, ndim=3] grid_mask, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t, ndim=3] grid_t, + * np.ndarray[np.float64_t, ndim=3] grid_dt, + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_VoxelTraversal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_VoxelTraversal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_grid_mask = 0; + PyArrayObject *__pyx_v_grid_t = 0; + PyArrayObject *__pyx_v_grid_dt = 0; + PyArrayObject *__pyx_v_left_edge = 0; + PyArrayObject *__pyx_v_right_edge = 0; + PyArrayObject *__pyx_v_dx = 0; + PyArrayObject *__pyx_v_u = 0; + PyArrayObject *__pyx_v_v = 0; + int __pyx_v_i; + int __pyx_v_x; + int __pyx_v_y; + __pyx_t_5numpy_float64_t __pyx_v_tl; + __pyx_t_5numpy_float64_t __pyx_v_tr; + __pyx_t_5numpy_float64_t __pyx_v_intersect_t; + __pyx_t_5numpy_float64_t __pyx_v_enter_t; + __pyx_t_5numpy_float64_t __pyx_v_dt_tolerance; + PyArrayObject *__pyx_v_step = 0; + PyArrayObject *__pyx_v_cur_ind = 0; + PyArrayObject *__pyx_v_tdelta = 0; + PyArrayObject *__pyx_v_tmax = 0; + PyArrayObject *__pyx_v_intersect = 0; + Py_buffer __pyx_bstruct_right_edge; + Py_ssize_t __pyx_bstride_0_right_edge = 0; + Py_ssize_t __pyx_bshape_0_right_edge = 0; + Py_buffer __pyx_bstruct_intersect; + Py_ssize_t __pyx_bstride_0_intersect = 0; + Py_ssize_t __pyx_bshape_0_intersect = 0; + Py_buffer __pyx_bstruct_grid_t; + Py_ssize_t __pyx_bstride_0_grid_t = 0; + Py_ssize_t __pyx_bstride_1_grid_t = 0; + Py_ssize_t __pyx_bstride_2_grid_t = 0; + Py_ssize_t __pyx_bshape_0_grid_t = 0; + Py_ssize_t __pyx_bshape_1_grid_t = 0; + Py_ssize_t __pyx_bshape_2_grid_t = 0; + Py_buffer __pyx_bstruct_grid_dt; + Py_ssize_t __pyx_bstride_0_grid_dt = 0; + Py_ssize_t __pyx_bstride_1_grid_dt = 0; + Py_ssize_t __pyx_bstride_2_grid_dt = 0; + Py_ssize_t __pyx_bshape_0_grid_dt = 0; + Py_ssize_t __pyx_bshape_1_grid_dt = 0; + Py_ssize_t __pyx_bshape_2_grid_dt = 0; + Py_buffer __pyx_bstruct_cur_ind; + Py_ssize_t __pyx_bstride_0_cur_ind = 0; + Py_ssize_t __pyx_bshape_0_cur_ind = 0; + Py_buffer __pyx_bstruct_left_edge; + Py_ssize_t __pyx_bstride_0_left_edge = 0; + Py_ssize_t __pyx_bshape_0_left_edge = 0; + Py_buffer __pyx_bstruct_step; + Py_ssize_t __pyx_bstride_0_step = 0; + Py_ssize_t __pyx_bshape_0_step = 0; + 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_tdelta; + Py_ssize_t __pyx_bstride_0_tdelta = 0; + Py_ssize_t __pyx_bshape_0_tdelta = 0; + Py_buffer __pyx_bstruct_tmax; + Py_ssize_t __pyx_bstride_0_tmax = 0; + Py_ssize_t __pyx_bshape_0_tmax = 0; + Py_buffer __pyx_bstruct_grid_mask; + Py_ssize_t __pyx_bstride_0_grid_mask = 0; + Py_ssize_t __pyx_bstride_1_grid_mask = 0; + Py_ssize_t __pyx_bstride_2_grid_mask = 0; + Py_ssize_t __pyx_bshape_0_grid_mask = 0; + Py_ssize_t __pyx_bshape_1_grid_mask = 0; + Py_ssize_t __pyx_bshape_2_grid_mask = 0; + Py_buffer __pyx_bstruct_u; + Py_ssize_t __pyx_bstride_0_u = 0; + Py_ssize_t __pyx_bshape_0_u = 0; + Py_buffer __pyx_bstruct_v; + Py_ssize_t __pyx_bstride_0_v = 0; + Py_ssize_t __pyx_bshape_0_v = 0; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyArrayObject *__pyx_t_6 = NULL; + PyArrayObject *__pyx_t_7 = NULL; + PyArrayObject *__pyx_t_8 = NULL; + PyArrayObject *__pyx_t_9 = NULL; + PyArrayObject *__pyx_t_10 = NULL; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + __pyx_t_5numpy_float64_t __pyx_t_18; + int __pyx_t_19; + __pyx_t_5numpy_float64_t __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; + int __pyx_t_23; + int __pyx_t_24; + int __pyx_t_25; + int __pyx_t_26; + int __pyx_t_27; + int __pyx_t_28; + int __pyx_t_29; + int __pyx_t_30; + int __pyx_t_31; + int __pyx_t_32; + int __pyx_t_33; + int __pyx_t_34; + int __pyx_t_35; + int __pyx_t_36; + int __pyx_t_37; + int __pyx_t_38; + int __pyx_t_39; + int __pyx_t_40; + int __pyx_t_41; + int __pyx_t_42; + long __pyx_t_43; + long __pyx_t_44; + long __pyx_t_45; + long __pyx_t_46; + long __pyx_t_47; + long __pyx_t_48; + long __pyx_t_49; + long __pyx_t_50; + long __pyx_t_51; + PyObject *__pyx_t_52 = NULL; + PyObject *__pyx_t_53 = NULL; + PyObject *__pyx_t_54 = NULL; + int __pyx_t_55; + int __pyx_t_56; + int __pyx_t_57; + int __pyx_t_58; + __pyx_t_5numpy_int64_t __pyx_t_59; + int __pyx_t_60; + int __pyx_t_61; + int __pyx_t_62; + int __pyx_t_63; + int __pyx_t_64; + int __pyx_t_65; + int __pyx_t_66; + int __pyx_t_67; + int __pyx_t_68; + int __pyx_t_69; + int __pyx_t_70; + int __pyx_t_71; + int __pyx_t_72; + int __pyx_t_73; + int __pyx_t_74; + int __pyx_t_75; + int __pyx_t_76; + int __pyx_t_77; + int __pyx_t_78; + int __pyx_t_79; + int __pyx_t_80; + int __pyx_t_81; + int __pyx_t_82; + int __pyx_t_83; + int __pyx_t_84; + int __pyx_t_85; + int __pyx_t_86; + int __pyx_t_87; + int __pyx_t_88; + int __pyx_t_89; + long __pyx_t_90; + long __pyx_t_91; + long __pyx_t_92; + long __pyx_t_93; + long __pyx_t_94; + long __pyx_t_95; + __pyx_t_5numpy_int64_t __pyx_t_96; + __pyx_t_5numpy_int64_t __pyx_t_97; + long __pyx_t_98; + long __pyx_t_99; + long __pyx_t_100; + long __pyx_t_101; + long __pyx_t_102; + long __pyx_t_103; + __pyx_t_5numpy_int64_t __pyx_t_104; + __pyx_t_5numpy_int64_t __pyx_t_105; + __pyx_t_5numpy_int64_t __pyx_t_106; + long __pyx_t_107; + long __pyx_t_108; + long __pyx_t_109; + long __pyx_t_110; + long __pyx_t_111; + long __pyx_t_112; + long __pyx_t_113; + __pyx_t_5numpy_int64_t __pyx_t_114; + __pyx_t_5numpy_int64_t __pyx_t_115; + __pyx_t_5numpy_int64_t __pyx_t_116; + long __pyx_t_117; + long __pyx_t_118; + long __pyx_t_119; + long __pyx_t_120; + __pyx_t_5numpy_int64_t __pyx_t_121; + __pyx_t_5numpy_int64_t __pyx_t_122; + __pyx_t_5numpy_int64_t __pyx_t_123; + long __pyx_t_124; + long __pyx_t_125; + long __pyx_t_126; + long __pyx_t_127; + long __pyx_t_128; + long __pyx_t_129; + long __pyx_t_130; + long __pyx_t_131; + __pyx_t_5numpy_int64_t __pyx_t_132; + __pyx_t_5numpy_int64_t __pyx_t_133; + __pyx_t_5numpy_int64_t __pyx_t_134; + long __pyx_t_135; + long __pyx_t_136; + long __pyx_t_137; + long __pyx_t_138; + __pyx_t_5numpy_int64_t __pyx_t_139; + __pyx_t_5numpy_int64_t __pyx_t_140; + __pyx_t_5numpy_int64_t __pyx_t_141; + long __pyx_t_142; + long __pyx_t_143; + long __pyx_t_144; + long __pyx_t_145; + long __pyx_t_146; + long __pyx_t_147; + long __pyx_t_148; + long __pyx_t_149; + long __pyx_t_150; + long __pyx_t_151; + __pyx_t_5numpy_int64_t __pyx_t_152; + __pyx_t_5numpy_int64_t __pyx_t_153; + __pyx_t_5numpy_int64_t __pyx_t_154; + long __pyx_t_155; + long __pyx_t_156; + long __pyx_t_157; + long __pyx_t_158; + __pyx_t_5numpy_int64_t __pyx_t_159; + __pyx_t_5numpy_int64_t __pyx_t_160; + __pyx_t_5numpy_int64_t __pyx_t_161; + long __pyx_t_162; + long __pyx_t_163; + long __pyx_t_164; + long __pyx_t_165; + long __pyx_t_166; + long __pyx_t_167; + long __pyx_t_168; + long __pyx_t_169; + __pyx_t_5numpy_int64_t __pyx_t_170; + __pyx_t_5numpy_int64_t __pyx_t_171; + __pyx_t_5numpy_int64_t __pyx_t_172; + long __pyx_t_173; + long __pyx_t_174; + long __pyx_t_175; + long __pyx_t_176; + __pyx_t_5numpy_int64_t __pyx_t_177; + __pyx_t_5numpy_int64_t __pyx_t_178; + __pyx_t_5numpy_int64_t __pyx_t_179; + long __pyx_t_180; + long __pyx_t_181; + long __pyx_t_182; + long __pyx_t_183; + long __pyx_t_184; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__grid_mask,&__pyx_n_s__grid_t,&__pyx_n_s__grid_dt,&__pyx_n_s__left_edge,&__pyx_n_s__right_edge,&__pyx_n_s__dx,&__pyx_n_s__u,&__pyx_n_s__v,0}; + __Pyx_RefNannySetupContext("VoxelTraversal"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[8] = {0,0,0,0,0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid_mask); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid_t); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("VoxelTraversal", 1, 8, 8, 1); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid_dt); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("VoxelTraversal", 1, 8, 8, 2); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left_edge); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("VoxelTraversal", 1, 8, 8, 3); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right_edge); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("VoxelTraversal", 1, 8, 8, 4); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dx); + if (likely(values[5])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("VoxelTraversal", 1, 8, 8, 5); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 6: + values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__u); + if (likely(values[6])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("VoxelTraversal", 1, 8, 8, 6); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 7: + values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__v); + if (likely(values[7])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("VoxelTraversal", 1, 8, 8, 7); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "VoxelTraversal") < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_grid_mask = ((PyArrayObject *)values[0]); + __pyx_v_grid_t = ((PyArrayObject *)values[1]); + __pyx_v_grid_dt = ((PyArrayObject *)values[2]); + __pyx_v_left_edge = ((PyArrayObject *)values[3]); + __pyx_v_right_edge = ((PyArrayObject *)values[4]); + __pyx_v_dx = ((PyArrayObject *)values[5]); + __pyx_v_u = ((PyArrayObject *)values[6]); + __pyx_v_v = ((PyArrayObject *)values[7]); + } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_grid_mask = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); + __pyx_v_grid_t = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); + __pyx_v_grid_dt = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); + __pyx_v_left_edge = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); + __pyx_v_right_edge = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); + __pyx_v_dx = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 5)); + __pyx_v_u = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 6)); + __pyx_v_v = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 7)); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("VoxelTraversal", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.VoxelTraversal"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_bstruct_step.buf = NULL; + __pyx_bstruct_cur_ind.buf = NULL; + __pyx_bstruct_tdelta.buf = NULL; + __pyx_bstruct_tmax.buf = NULL; + __pyx_bstruct_intersect.buf = NULL; + __pyx_bstruct_grid_mask.buf = NULL; + __pyx_bstruct_grid_t.buf = NULL; + __pyx_bstruct_grid_dt.buf = NULL; + __pyx_bstruct_left_edge.buf = NULL; + __pyx_bstruct_right_edge.buf = NULL; + __pyx_bstruct_dx.buf = NULL; + __pyx_bstruct_u.buf = NULL; + __pyx_bstruct_v.buf = NULL; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grid_mask), __pyx_ptype_5numpy_ndarray, 1, "grid_mask", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grid_t), __pyx_ptype_5numpy_ndarray, 1, "grid_t", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grid_dt), __pyx_ptype_5numpy_ndarray, 1, "grid_dt", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left_edge), __pyx_ptype_5numpy_ndarray, 1, "left_edge", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right_edge), __pyx_ptype_5numpy_ndarray, 1, "right_edge", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 132; __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[4]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_u), __pyx_ptype_5numpy_ndarray, 1, "u", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_grid_mask, (PyObject*)__pyx_v_grid_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_grid_mask = __pyx_bstruct_grid_mask.strides[0]; __pyx_bstride_1_grid_mask = __pyx_bstruct_grid_mask.strides[1]; __pyx_bstride_2_grid_mask = __pyx_bstruct_grid_mask.strides[2]; + __pyx_bshape_0_grid_mask = __pyx_bstruct_grid_mask.shape[0]; __pyx_bshape_1_grid_mask = __pyx_bstruct_grid_mask.shape[1]; __pyx_bshape_2_grid_mask = __pyx_bstruct_grid_mask.shape[2]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_grid_t, (PyObject*)__pyx_v_grid_t, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_grid_t = __pyx_bstruct_grid_t.strides[0]; __pyx_bstride_1_grid_t = __pyx_bstruct_grid_t.strides[1]; __pyx_bstride_2_grid_t = __pyx_bstruct_grid_t.strides[2]; + __pyx_bshape_0_grid_t = __pyx_bstruct_grid_t.shape[0]; __pyx_bshape_1_grid_t = __pyx_bstruct_grid_t.shape[1]; __pyx_bshape_2_grid_t = __pyx_bstruct_grid_t.shape[2]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_grid_dt, (PyObject*)__pyx_v_grid_dt, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_grid_dt = __pyx_bstruct_grid_dt.strides[0]; __pyx_bstride_1_grid_dt = __pyx_bstruct_grid_dt.strides[1]; __pyx_bstride_2_grid_dt = __pyx_bstruct_grid_dt.strides[2]; + __pyx_bshape_0_grid_dt = __pyx_bstruct_grid_dt.shape[0]; __pyx_bshape_1_grid_dt = __pyx_bstruct_grid_dt.shape[1]; __pyx_bshape_2_grid_dt = __pyx_bstruct_grid_dt.shape[2]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_left_edge, (PyObject*)__pyx_v_left_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_left_edge = __pyx_bstruct_left_edge.strides[0]; + __pyx_bshape_0_left_edge = __pyx_bstruct_left_edge.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_right_edge, (PyObject*)__pyx_v_right_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_right_edge = __pyx_bstruct_right_edge.strides[0]; + __pyx_bshape_0_right_edge = __pyx_bstruct_right_edge.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dx, (PyObject*)__pyx_v_dx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __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]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_u, (PyObject*)__pyx_v_u, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_u = __pyx_bstruct_u.strides[0]; + __pyx_bshape_0_u = __pyx_bstruct_u.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_v, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_v = __pyx_bstruct_v.strides[0]; + __pyx_bshape_0_v = __pyx_bstruct_v.shape[0]; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":141 + * cdef int i, x, y + * cdef np.float64_t tl, tr, intersect_t, enter_t, exit_t, dt_tolerance + * cdef np.ndarray[np.int64_t, ndim=1] step = np.empty((3,), dtype=np.int64) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.int64_t, ndim=1] cur_ind = np.empty((3,), dtype=np.int64) + * cdef np.ndarray[np.float64_t, ndim=1] tdelta = np.empty((3,), dtype=np.float64) + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_int_3); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = ((PyArrayObject *)__pyx_t_5); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_step, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_step = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_step.buf = NULL; + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_bstride_0_step = __pyx_bstruct_step.strides[0]; + __pyx_bshape_0_step = __pyx_bstruct_step.shape[0]; + } + } + __pyx_t_6 = 0; + __pyx_v_step = ((PyArrayObject *)__pyx_t_5); + __pyx_t_5 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":142 + * cdef np.float64_t tl, tr, intersect_t, enter_t, exit_t, dt_tolerance + * cdef np.ndarray[np.int64_t, ndim=1] step = np.empty((3,), dtype=np.int64) + * cdef np.ndarray[np.int64_t, ndim=1] cur_ind = np.empty((3,), dtype=np.int64) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t, ndim=1] tdelta = np.empty((3,), dtype=np.float64) + * cdef np.ndarray[np.float64_t, ndim=1] tmax = np.empty((3,), dtype=np.float64) + */ + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_int_3); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__int64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_3, ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = ((PyArrayObject *)__pyx_t_4); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_cur_ind, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_cur_ind = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_cur_ind.buf = NULL; + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_bstride_0_cur_ind = __pyx_bstruct_cur_ind.strides[0]; + __pyx_bshape_0_cur_ind = __pyx_bstruct_cur_ind.shape[0]; + } + } + __pyx_t_7 = 0; + __pyx_v_cur_ind = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":143 + * cdef np.ndarray[np.int64_t, ndim=1] step = np.empty((3,), dtype=np.int64) + * cdef np.ndarray[np.int64_t, ndim=1] cur_ind = np.empty((3,), dtype=np.int64) + * cdef np.ndarray[np.float64_t, ndim=1] tdelta = np.empty((3,), dtype=np.float64) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t, ndim=1] tmax = np.empty((3,), dtype=np.float64) + * cdef np.ndarray[np.float64_t, ndim=1] intersect = np.empty((3,), dtype=np.float64) + */ + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_int_3); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_5, __pyx_t_3, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = ((PyArrayObject *)__pyx_t_2); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_tdelta, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_tdelta = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_tdelta.buf = NULL; + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_bstride_0_tdelta = __pyx_bstruct_tdelta.strides[0]; + __pyx_bshape_0_tdelta = __pyx_bstruct_tdelta.shape[0]; + } + } + __pyx_t_8 = 0; + __pyx_v_tdelta = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":144 + * cdef np.ndarray[np.int64_t, ndim=1] cur_ind = np.empty((3,), dtype=np.int64) + * cdef np.ndarray[np.float64_t, ndim=1] tdelta = np.empty((3,), dtype=np.float64) + * cdef np.ndarray[np.float64_t, ndim=1] tmax = np.empty((3,), dtype=np.float64) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t, ndim=1] intersect = np.empty((3,), dtype=np.float64) + * intersect_t = 1 + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_int_3); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_4, __pyx_t_3, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = ((PyArrayObject *)__pyx_t_1); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_tmax, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_tmax = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_tmax.buf = NULL; + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_bstride_0_tmax = __pyx_bstruct_tmax.strides[0]; + __pyx_bshape_0_tmax = __pyx_bstruct_tmax.shape[0]; + } + } + __pyx_t_9 = 0; + __pyx_v_tmax = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":145 + * cdef np.ndarray[np.float64_t, ndim=1] tdelta = np.empty((3,), dtype=np.float64) + * cdef np.ndarray[np.float64_t, ndim=1] tmax = np.empty((3,), dtype=np.float64) + * cdef np.ndarray[np.float64_t, ndim=1] intersect = np.empty((3,), dtype=np.float64) # <<<<<<<<<<<<<< + * intersect_t = 1 + * dt_tolerance = 1e-6 + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_int_3); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = ((PyArrayObject *)__pyx_t_5); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_intersect, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_intersect = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_intersect.buf = NULL; + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_bstride_0_intersect = __pyx_bstruct_intersect.strides[0]; + __pyx_bshape_0_intersect = __pyx_bstruct_intersect.shape[0]; + } + } + __pyx_t_10 = 0; + __pyx_v_intersect = ((PyArrayObject *)__pyx_t_5); + __pyx_t_5 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":146 + * cdef np.ndarray[np.float64_t, ndim=1] tmax = np.empty((3,), dtype=np.float64) + * cdef np.ndarray[np.float64_t, ndim=1] intersect = np.empty((3,), dtype=np.float64) + * intersect_t = 1 # <<<<<<<<<<<<<< + * dt_tolerance = 1e-6 + * # recall p = v * t + u + */ + __pyx_v_intersect_t = 1.0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":147 + * cdef np.ndarray[np.float64_t, ndim=1] intersect = np.empty((3,), dtype=np.float64) + * intersect_t = 1 + * dt_tolerance = 1e-6 # <<<<<<<<<<<<<< + * # recall p = v * t + u + * # where p is position, v is our vector, u is the start point + */ + __pyx_v_dt_tolerance = 1e-6; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":150 + * # recall p = v * t + u + * # where p is position, v is our vector, u is the start point + * for i in range(3): # <<<<<<<<<<<<<< + * # As long as we're iterating, set some other stuff, too + * if(v[i] < 0): step[i] = -1 + */ + for (__pyx_t_11 = 0; __pyx_t_11 < 3; __pyx_t_11+=1) { + __pyx_v_i = __pyx_t_11; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":152 + * for i in range(3): + * # As long as we're iterating, set some other stuff, too + * if(v[i] < 0): step[i] = -1 # <<<<<<<<<<<<<< + * else: step[i] = 1 + * x = (i+1)%3 + */ + __pyx_t_12 = __pyx_v_i; + __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_12, __pyx_bstride_0_v)) < 0.0); + if (__pyx_t_13) { + __pyx_t_14 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_step.buf, __pyx_t_14, __pyx_bstride_0_step) = -1; + goto __pyx_L8; + } + /*else*/ { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":153 + * # As long as we're iterating, set some other stuff, too + * if(v[i] < 0): step[i] = -1 + * else: step[i] = 1 # <<<<<<<<<<<<<< + * x = (i+1)%3 + * y = (i+2)%3 + */ + __pyx_t_15 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_step.buf, __pyx_t_15, __pyx_bstride_0_step) = 1; + } + __pyx_L8:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":154 + * if(v[i] < 0): step[i] = -1 + * else: step[i] = 1 + * x = (i+1)%3 # <<<<<<<<<<<<<< + * y = (i+2)%3 + * tl = (left_edge[i] - u[i])/v[i] + */ + __pyx_v_x = __Pyx_mod_long((__pyx_v_i + 1), 3); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":155 + * else: step[i] = 1 + * x = (i+1)%3 + * y = (i+2)%3 # <<<<<<<<<<<<<< + * tl = (left_edge[i] - u[i])/v[i] + * tr = (right_edge[i] - u[i])/v[i] + */ + __pyx_v_y = __Pyx_mod_long((__pyx_v_i + 2), 3); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":156 + * x = (i+1)%3 + * y = (i+2)%3 + * tl = (left_edge[i] - u[i])/v[i] # <<<<<<<<<<<<<< + * tr = (right_edge[i] - u[i])/v[i] + * if (left_edge[x] <= (u[x] + tl*v[x]) <= right_edge[x]) and \ + */ + __pyx_t_16 = __pyx_v_i; + __pyx_t_17 = __pyx_v_i; + __pyx_t_18 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_16, __pyx_bstride_0_left_edge)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_17, __pyx_bstride_0_u))); + __pyx_t_19 = __pyx_v_i; + __pyx_t_20 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_19, __pyx_bstride_0_v)); + if (unlikely(__pyx_t_20 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_tl = (__pyx_t_18 / __pyx_t_20); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":157 + * y = (i+2)%3 + * tl = (left_edge[i] - u[i])/v[i] + * tr = (right_edge[i] - u[i])/v[i] # <<<<<<<<<<<<<< + * if (left_edge[x] <= (u[x] + tl*v[x]) <= right_edge[x]) and \ + * (left_edge[y] <= (u[y] + tl*v[y]) <= right_edge[y]) and \ + */ + __pyx_t_21 = __pyx_v_i; + __pyx_t_22 = __pyx_v_i; + __pyx_t_20 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_21, __pyx_bstride_0_right_edge)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_22, __pyx_bstride_0_u))); + __pyx_t_23 = __pyx_v_i; + __pyx_t_18 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_23, __pyx_bstride_0_v)); + if (unlikely(__pyx_t_18 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_tr = (__pyx_t_20 / __pyx_t_18); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":158 + * tl = (left_edge[i] - u[i])/v[i] + * tr = (right_edge[i] - u[i])/v[i] + * if (left_edge[x] <= (u[x] + tl*v[x]) <= right_edge[x]) and \ # <<<<<<<<<<<<<< + * (left_edge[y] <= (u[y] + tl*v[y]) <= right_edge[y]) and \ + * (0.0 <= tl < intersect_t): + */ + __pyx_t_24 = __pyx_v_x; + __pyx_t_25 = __pyx_v_x; + __pyx_t_26 = __pyx_v_x; + __pyx_t_18 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_25, __pyx_bstride_0_u)) + (__pyx_v_tl * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_26, __pyx_bstride_0_v)))); + __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_24, __pyx_bstride_0_left_edge)) <= __pyx_t_18); + if (__pyx_t_13) { + __pyx_t_27 = __pyx_v_x; + __pyx_t_13 = (__pyx_t_18 <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_27, __pyx_bstride_0_right_edge))); + } + if (__pyx_t_13) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":159 + * tr = (right_edge[i] - u[i])/v[i] + * if (left_edge[x] <= (u[x] + tl*v[x]) <= right_edge[x]) and \ + * (left_edge[y] <= (u[y] + tl*v[y]) <= right_edge[y]) and \ # <<<<<<<<<<<<<< + * (0.0 <= tl < intersect_t): + * intersect_t = tl + */ + __pyx_t_28 = __pyx_v_y; + __pyx_t_29 = __pyx_v_y; + __pyx_t_30 = __pyx_v_y; + __pyx_t_18 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_29, __pyx_bstride_0_u)) + (__pyx_v_tl * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_30, __pyx_bstride_0_v)))); + __pyx_t_31 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_28, __pyx_bstride_0_left_edge)) <= __pyx_t_18); + if (__pyx_t_31) { + __pyx_t_32 = __pyx_v_y; + __pyx_t_31 = (__pyx_t_18 <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_32, __pyx_bstride_0_right_edge))); + } + if (__pyx_t_31) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":160 + * if (left_edge[x] <= (u[x] + tl*v[x]) <= right_edge[x]) and \ + * (left_edge[y] <= (u[y] + tl*v[y]) <= right_edge[y]) and \ + * (0.0 <= tl < intersect_t): # <<<<<<<<<<<<<< + * intersect_t = tl + * if (left_edge[x] <= (u[x] + tr*v[x]) <= right_edge[x]) and \ + */ + __pyx_t_33 = (0.0 <= __pyx_v_tl); + if (__pyx_t_33) { + __pyx_t_33 = (__pyx_v_tl < __pyx_v_intersect_t); + } + __pyx_t_34 = __pyx_t_33; + } else { + __pyx_t_34 = __pyx_t_31; + } + __pyx_t_31 = __pyx_t_34; + } else { + __pyx_t_31 = __pyx_t_13; + } + if (__pyx_t_31) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":161 + * (left_edge[y] <= (u[y] + tl*v[y]) <= right_edge[y]) and \ + * (0.0 <= tl < intersect_t): + * intersect_t = tl # <<<<<<<<<<<<<< + * if (left_edge[x] <= (u[x] + tr*v[x]) <= right_edge[x]) and \ + * (left_edge[y] <= (u[y] + tr*v[y]) <= right_edge[y]) and \ + */ + __pyx_v_intersect_t = __pyx_v_tl; + goto __pyx_L9; + } + __pyx_L9:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":162 + * (0.0 <= tl < intersect_t): + * intersect_t = tl + * if (left_edge[x] <= (u[x] + tr*v[x]) <= right_edge[x]) and \ # <<<<<<<<<<<<<< + * (left_edge[y] <= (u[y] + tr*v[y]) <= right_edge[y]) and \ + * (0.0 <= tr < intersect_t): + */ + __pyx_t_35 = __pyx_v_x; + __pyx_t_36 = __pyx_v_x; + __pyx_t_37 = __pyx_v_x; + __pyx_t_18 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_36, __pyx_bstride_0_u)) + (__pyx_v_tr * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_37, __pyx_bstride_0_v)))); + __pyx_t_31 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_35, __pyx_bstride_0_left_edge)) <= __pyx_t_18); + if (__pyx_t_31) { + __pyx_t_38 = __pyx_v_x; + __pyx_t_31 = (__pyx_t_18 <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_38, __pyx_bstride_0_right_edge))); + } + if (__pyx_t_31) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":163 + * intersect_t = tl + * if (left_edge[x] <= (u[x] + tr*v[x]) <= right_edge[x]) and \ + * (left_edge[y] <= (u[y] + tr*v[y]) <= right_edge[y]) and \ # <<<<<<<<<<<<<< + * (0.0 <= tr < intersect_t): + * intersect_t = tr + */ + __pyx_t_39 = __pyx_v_y; + __pyx_t_40 = __pyx_v_y; + __pyx_t_41 = __pyx_v_y; + __pyx_t_18 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_40, __pyx_bstride_0_u)) + (__pyx_v_tr * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_41, __pyx_bstride_0_v)))); + __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_39, __pyx_bstride_0_left_edge)) <= __pyx_t_18); + if (__pyx_t_13) { + __pyx_t_42 = __pyx_v_y; + __pyx_t_13 = (__pyx_t_18 <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_42, __pyx_bstride_0_right_edge))); + } + if (__pyx_t_13) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":164 + * if (left_edge[x] <= (u[x] + tr*v[x]) <= right_edge[x]) and \ + * (left_edge[y] <= (u[y] + tr*v[y]) <= right_edge[y]) and \ + * (0.0 <= tr < intersect_t): # <<<<<<<<<<<<<< + * intersect_t = tr + * # if fully enclosed + */ + __pyx_t_34 = (0.0 <= __pyx_v_tr); + if (__pyx_t_34) { + __pyx_t_34 = (__pyx_v_tr < __pyx_v_intersect_t); + } + __pyx_t_33 = __pyx_t_34; + } else { + __pyx_t_33 = __pyx_t_13; + } + __pyx_t_13 = __pyx_t_33; + } else { + __pyx_t_13 = __pyx_t_31; + } + if (__pyx_t_13) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":165 + * (left_edge[y] <= (u[y] + tr*v[y]) <= right_edge[y]) and \ + * (0.0 <= tr < intersect_t): + * intersect_t = tr # <<<<<<<<<<<<<< + * # if fully enclosed + * if (left_edge[0] <= u[0] <= right_edge[0]) and \ + */ + __pyx_v_intersect_t = __pyx_v_tr; + goto __pyx_L10; + } + __pyx_L10:; + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":167 + * intersect_t = tr + * # if fully enclosed + * if (left_edge[0] <= u[0] <= right_edge[0]) and \ # <<<<<<<<<<<<<< + * (left_edge[1] <= u[1] <= right_edge[1]) and \ + * (left_edge[2] <= u[2] <= right_edge[2]): + */ + __pyx_t_43 = 0; + __pyx_t_44 = 0; + __pyx_t_18 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_44, __pyx_bstride_0_u)); + __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_43, __pyx_bstride_0_left_edge)) <= __pyx_t_18); + if (__pyx_t_13) { + __pyx_t_45 = 0; + __pyx_t_13 = (__pyx_t_18 <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_45, __pyx_bstride_0_right_edge))); + } + if (__pyx_t_13) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":168 + * # if fully enclosed + * if (left_edge[0] <= u[0] <= right_edge[0]) and \ + * (left_edge[1] <= u[1] <= right_edge[1]) and \ # <<<<<<<<<<<<<< + * (left_edge[2] <= u[2] <= right_edge[2]): + * intersect_t = 0.0 + */ + __pyx_t_46 = 1; + __pyx_t_47 = 1; + __pyx_t_18 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_47, __pyx_bstride_0_u)); + __pyx_t_31 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_46, __pyx_bstride_0_left_edge)) <= __pyx_t_18); + if (__pyx_t_31) { + __pyx_t_48 = 1; + __pyx_t_31 = (__pyx_t_18 <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_48, __pyx_bstride_0_right_edge))); + } + if (__pyx_t_31) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":169 + * if (left_edge[0] <= u[0] <= right_edge[0]) and \ + * (left_edge[1] <= u[1] <= right_edge[1]) and \ + * (left_edge[2] <= u[2] <= right_edge[2]): # <<<<<<<<<<<<<< + * intersect_t = 0.0 + * if not (0 <= intersect_t <= 1): return + */ + __pyx_t_49 = 2; + __pyx_t_50 = 2; + __pyx_t_18 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_50, __pyx_bstride_0_u)); + __pyx_t_33 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_49, __pyx_bstride_0_left_edge)) <= __pyx_t_18); + if (__pyx_t_33) { + __pyx_t_51 = 2; + __pyx_t_33 = (__pyx_t_18 <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_51, __pyx_bstride_0_right_edge))); + } + __pyx_t_34 = __pyx_t_33; + } else { + __pyx_t_34 = __pyx_t_31; + } + __pyx_t_31 = __pyx_t_34; + } else { + __pyx_t_31 = __pyx_t_13; + } + if (__pyx_t_31) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":170 + * (left_edge[1] <= u[1] <= right_edge[1]) and \ + * (left_edge[2] <= u[2] <= right_edge[2]): + * intersect_t = 0.0 # <<<<<<<<<<<<<< + * if not (0 <= intersect_t <= 1): return + * # Now get the indices of the intersection + */ + __pyx_v_intersect_t = 0.0; + goto __pyx_L11; + } + __pyx_L11:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":171 + * (left_edge[2] <= u[2] <= right_edge[2]): + * intersect_t = 0.0 + * if not (0 <= intersect_t <= 1): return # <<<<<<<<<<<<<< + * # Now get the indices of the intersection + * intersect = u + intersect_t * v + */ + __pyx_t_31 = (0.0 <= __pyx_v_intersect_t); + if (__pyx_t_31) { + __pyx_t_31 = (__pyx_v_intersect_t <= 1.0); + } + __pyx_t_13 = (!__pyx_t_31); + if (__pyx_t_13) { + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L12; + } + __pyx_L12:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":173 + * if not (0 <= intersect_t <= 1): return + * # Now get the indices of the intersection + * intersect = u + intersect_t * v # <<<<<<<<<<<<<< + * for i in range(3): + * cur_ind[i] = np.floor((intersect[i] + 1e-8*dx[i] - left_edge[i])/dx[i]) + */ + __pyx_t_5 = PyFloat_FromDouble(__pyx_v_intersect_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyNumber_Multiply(__pyx_t_5, ((PyObject *)__pyx_v_v)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_v_u), __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = ((PyArrayObject *)__pyx_t_5); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_intersect); + __pyx_t_11 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_intersect, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_11 < 0)) { + PyErr_Fetch(&__pyx_t_52, &__pyx_t_53, &__pyx_t_54); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_intersect, (PyObject*)__pyx_v_intersect, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_52); Py_XDECREF(__pyx_t_53); Py_XDECREF(__pyx_t_54); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_52, __pyx_t_53, __pyx_t_54); + } + } + __pyx_bstride_0_intersect = __pyx_bstruct_intersect.strides[0]; + __pyx_bshape_0_intersect = __pyx_bstruct_intersect.shape[0]; + if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_intersect)); + __pyx_v_intersect = ((PyArrayObject *)__pyx_t_5); + __pyx_t_5 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":174 + * # Now get the indices of the intersection + * intersect = u + intersect_t * v + * for i in range(3): # <<<<<<<<<<<<<< + * cur_ind[i] = np.floor((intersect[i] + 1e-8*dx[i] - left_edge[i])/dx[i]) + * tmax[i] = (((cur_ind[i]+step[i])*dx[i])+left_edge[i]-u[i])/v[i] + */ + for (__pyx_t_11 = 0; __pyx_t_11 < 3; __pyx_t_11+=1) { + __pyx_v_i = __pyx_t_11; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":175 + * intersect = u + intersect_t * v + * for i in range(3): + * cur_ind[i] = np.floor((intersect[i] + 1e-8*dx[i] - left_edge[i])/dx[i]) # <<<<<<<<<<<<<< + * tmax[i] = (((cur_ind[i]+step[i])*dx[i])+left_edge[i]-u[i])/v[i] + * if cur_ind[i] == grid_mask.shape[i] and step[i] < 0: + */ + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__floor); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_55 = __pyx_v_i; + __pyx_t_56 = __pyx_v_i; + __pyx_t_57 = __pyx_v_i; + __pyx_t_18 = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_intersect.buf, __pyx_t_55, __pyx_bstride_0_intersect)) + (1e-8 * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dx.buf, __pyx_t_56, __pyx_bstride_0_dx)))) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_57, __pyx_bstride_0_left_edge))); + __pyx_t_58 = __pyx_v_i; + __pyx_t_20 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dx.buf, __pyx_t_58, __pyx_bstride_0_dx)); + if (unlikely(__pyx_t_20 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_5 = PyFloat_FromDouble((__pyx_t_18 / __pyx_t_20)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_59 = __Pyx_PyInt_from_py_npy_int64(__pyx_t_5); if (unlikely((__pyx_t_59 == (npy_int64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_60 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_60, __pyx_bstride_0_cur_ind) = __pyx_t_59; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":176 + * for i in range(3): + * cur_ind[i] = np.floor((intersect[i] + 1e-8*dx[i] - left_edge[i])/dx[i]) + * tmax[i] = (((cur_ind[i]+step[i])*dx[i])+left_edge[i]-u[i])/v[i] # <<<<<<<<<<<<<< + * if cur_ind[i] == grid_mask.shape[i] and step[i] < 0: + * cur_ind[i] = grid_mask.shape[i] - 1 + */ + __pyx_t_61 = __pyx_v_i; + __pyx_t_62 = __pyx_v_i; + __pyx_t_63 = __pyx_v_i; + __pyx_t_64 = __pyx_v_i; + __pyx_t_65 = __pyx_v_i; + __pyx_t_20 = (((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_61, __pyx_bstride_0_cur_ind)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_step.buf, __pyx_t_62, __pyx_bstride_0_step))) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dx.buf, __pyx_t_63, __pyx_bstride_0_dx))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_64, __pyx_bstride_0_left_edge))) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_65, __pyx_bstride_0_u))); + __pyx_t_66 = __pyx_v_i; + __pyx_t_18 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_66, __pyx_bstride_0_v)); + if (unlikely(__pyx_t_18 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_67 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_67, __pyx_bstride_0_tmax) = (__pyx_t_20 / __pyx_t_18); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":177 + * cur_ind[i] = np.floor((intersect[i] + 1e-8*dx[i] - left_edge[i])/dx[i]) + * tmax[i] = (((cur_ind[i]+step[i])*dx[i])+left_edge[i]-u[i])/v[i] + * if cur_ind[i] == grid_mask.shape[i] and step[i] < 0: # <<<<<<<<<<<<<< + * cur_ind[i] = grid_mask.shape[i] - 1 + * if step[i] > 0: tmax[i] = (((cur_ind[i]+1)*dx[i])+left_edge[i]-u[i])/v[i] + */ + __pyx_t_68 = __pyx_v_i; + __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_68, __pyx_bstride_0_cur_ind)) == (__pyx_v_grid_mask->dimensions[__pyx_v_i])); + if (__pyx_t_13) { + __pyx_t_69 = __pyx_v_i; + __pyx_t_31 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_step.buf, __pyx_t_69, __pyx_bstride_0_step)) < 0); + __pyx_t_34 = __pyx_t_31; + } else { + __pyx_t_34 = __pyx_t_13; + } + if (__pyx_t_34) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":178 + * tmax[i] = (((cur_ind[i]+step[i])*dx[i])+left_edge[i]-u[i])/v[i] + * if cur_ind[i] == grid_mask.shape[i] and step[i] < 0: + * cur_ind[i] = grid_mask.shape[i] - 1 # <<<<<<<<<<<<<< + * if step[i] > 0: tmax[i] = (((cur_ind[i]+1)*dx[i])+left_edge[i]-u[i])/v[i] + * if step[i] < 0: tmax[i] = (((cur_ind[i]+0)*dx[i])+left_edge[i]-u[i])/v[i] + */ + __pyx_t_70 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_70, __pyx_bstride_0_cur_ind) = ((__pyx_v_grid_mask->dimensions[__pyx_v_i]) - 1); + goto __pyx_L15; + } + __pyx_L15:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":179 + * if cur_ind[i] == grid_mask.shape[i] and step[i] < 0: + * cur_ind[i] = grid_mask.shape[i] - 1 + * if step[i] > 0: tmax[i] = (((cur_ind[i]+1)*dx[i])+left_edge[i]-u[i])/v[i] # <<<<<<<<<<<<<< + * if step[i] < 0: tmax[i] = (((cur_ind[i]+0)*dx[i])+left_edge[i]-u[i])/v[i] + * tdelta[i] = (dx[i]/v[i]) + */ + __pyx_t_71 = __pyx_v_i; + __pyx_t_34 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_step.buf, __pyx_t_71, __pyx_bstride_0_step)) > 0); + if (__pyx_t_34) { + __pyx_t_72 = __pyx_v_i; + __pyx_t_73 = __pyx_v_i; + __pyx_t_74 = __pyx_v_i; + __pyx_t_75 = __pyx_v_i; + __pyx_t_18 = (((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_72, __pyx_bstride_0_cur_ind)) + 1) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dx.buf, __pyx_t_73, __pyx_bstride_0_dx))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_74, __pyx_bstride_0_left_edge))) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_75, __pyx_bstride_0_u))); + __pyx_t_76 = __pyx_v_i; + __pyx_t_20 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_76, __pyx_bstride_0_v)); + if (unlikely(__pyx_t_20 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_77 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_77, __pyx_bstride_0_tmax) = (__pyx_t_18 / __pyx_t_20); + goto __pyx_L16; + } + __pyx_L16:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":180 + * cur_ind[i] = grid_mask.shape[i] - 1 + * if step[i] > 0: tmax[i] = (((cur_ind[i]+1)*dx[i])+left_edge[i]-u[i])/v[i] + * if step[i] < 0: tmax[i] = (((cur_ind[i]+0)*dx[i])+left_edge[i]-u[i])/v[i] # <<<<<<<<<<<<<< + * tdelta[i] = (dx[i]/v[i]) + * if tdelta[i] < 0: tdelta[i] *= -1 + */ + __pyx_t_78 = __pyx_v_i; + __pyx_t_34 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_step.buf, __pyx_t_78, __pyx_bstride_0_step)) < 0); + if (__pyx_t_34) { + __pyx_t_79 = __pyx_v_i; + __pyx_t_80 = __pyx_v_i; + __pyx_t_81 = __pyx_v_i; + __pyx_t_82 = __pyx_v_i; + __pyx_t_20 = (((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_79, __pyx_bstride_0_cur_ind)) + 0) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dx.buf, __pyx_t_80, __pyx_bstride_0_dx))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_81, __pyx_bstride_0_left_edge))) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_82, __pyx_bstride_0_u))); + __pyx_t_83 = __pyx_v_i; + __pyx_t_18 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_83, __pyx_bstride_0_v)); + if (unlikely(__pyx_t_18 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_84 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_84, __pyx_bstride_0_tmax) = (__pyx_t_20 / __pyx_t_18); + goto __pyx_L17; + } + __pyx_L17:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":181 + * if step[i] > 0: tmax[i] = (((cur_ind[i]+1)*dx[i])+left_edge[i]-u[i])/v[i] + * if step[i] < 0: tmax[i] = (((cur_ind[i]+0)*dx[i])+left_edge[i]-u[i])/v[i] + * tdelta[i] = (dx[i]/v[i]) # <<<<<<<<<<<<<< + * if tdelta[i] < 0: tdelta[i] *= -1 + * # The variable intersect contains the point we first pierce the grid + */ + __pyx_t_85 = __pyx_v_i; + __pyx_t_18 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dx.buf, __pyx_t_85, __pyx_bstride_0_dx)); + __pyx_t_86 = __pyx_v_i; + __pyx_t_20 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_86, __pyx_bstride_0_v)); + if (unlikely(__pyx_t_20 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_87 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tdelta.buf, __pyx_t_87, __pyx_bstride_0_tdelta) = (__pyx_t_18 / __pyx_t_20); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":182 + * if step[i] < 0: tmax[i] = (((cur_ind[i]+0)*dx[i])+left_edge[i]-u[i])/v[i] + * tdelta[i] = (dx[i]/v[i]) + * if tdelta[i] < 0: tdelta[i] *= -1 # <<<<<<<<<<<<<< + * # The variable intersect contains the point we first pierce the grid + * enter_t = intersect_t + */ + __pyx_t_88 = __pyx_v_i; + __pyx_t_34 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tdelta.buf, __pyx_t_88, __pyx_bstride_0_tdelta)) < 0.0); + if (__pyx_t_34) { + __pyx_t_89 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tdelta.buf, __pyx_t_89, __pyx_bstride_0_tdelta) *= -1.0; + goto __pyx_L18; + } + __pyx_L18:; + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":184 + * if tdelta[i] < 0: tdelta[i] *= -1 + * # The variable intersect contains the point we first pierce the grid + * enter_t = intersect_t # <<<<<<<<<<<<<< + * while 1: + * if (not (0 <= cur_ind[0] < grid_mask.shape[0])) or \ + */ + __pyx_v_enter_t = __pyx_v_intersect_t; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":185 + * # The variable intersect contains the point we first pierce the grid + * enter_t = intersect_t + * while 1: # <<<<<<<<<<<<<< + * if (not (0 <= cur_ind[0] < grid_mask.shape[0])) or \ + * (not (0 <= cur_ind[1] < grid_mask.shape[1])) or \ + */ + while (1) { + if (!1) break; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":186 + * enter_t = intersect_t + * while 1: + * if (not (0 <= cur_ind[0] < grid_mask.shape[0])) or \ # <<<<<<<<<<<<<< + * (not (0 <= cur_ind[1] < grid_mask.shape[1])) or \ + * (not (0 <= cur_ind[2] < grid_mask.shape[2])): + */ + __pyx_t_90 = 0; + __pyx_t_59 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_90, __pyx_bstride_0_cur_ind)); + __pyx_t_34 = (0 <= __pyx_t_59); + if (__pyx_t_34) { + __pyx_t_34 = (__pyx_t_59 < (__pyx_v_grid_mask->dimensions[0])); + } + __pyx_t_13 = (!__pyx_t_34); + if (!__pyx_t_13) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":187 + * while 1: + * if (not (0 <= cur_ind[0] < grid_mask.shape[0])) or \ + * (not (0 <= cur_ind[1] < grid_mask.shape[1])) or \ # <<<<<<<<<<<<<< + * (not (0 <= cur_ind[2] < grid_mask.shape[2])): + * break + */ + __pyx_t_91 = 1; + __pyx_t_59 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_91, __pyx_bstride_0_cur_ind)); + __pyx_t_34 = (0 <= __pyx_t_59); + if (__pyx_t_34) { + __pyx_t_34 = (__pyx_t_59 < (__pyx_v_grid_mask->dimensions[1])); + } + __pyx_t_31 = (!__pyx_t_34); + if (!__pyx_t_31) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":188 + * if (not (0 <= cur_ind[0] < grid_mask.shape[0])) or \ + * (not (0 <= cur_ind[1] < grid_mask.shape[1])) or \ + * (not (0 <= cur_ind[2] < grid_mask.shape[2])): # <<<<<<<<<<<<<< + * break + * # Note that we are calculating t on the fly, but we get *negative* t + */ + __pyx_t_92 = 2; + __pyx_t_59 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_92, __pyx_bstride_0_cur_ind)); + __pyx_t_34 = (0 <= __pyx_t_59); + if (__pyx_t_34) { + __pyx_t_34 = (__pyx_t_59 < (__pyx_v_grid_mask->dimensions[2])); + } + __pyx_t_33 = (!__pyx_t_34); + __pyx_t_34 = __pyx_t_33; + } else { + __pyx_t_34 = __pyx_t_31; + } + __pyx_t_31 = __pyx_t_34; + } else { + __pyx_t_31 = __pyx_t_13; + } + if (__pyx_t_31) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":189 + * (not (0 <= cur_ind[1] < grid_mask.shape[1])) or \ + * (not (0 <= cur_ind[2] < grid_mask.shape[2])): + * break # <<<<<<<<<<<<<< + * # Note that we are calculating t on the fly, but we get *negative* t + * # values from what they should be. + */ + goto __pyx_L20_break; + goto __pyx_L21; + } + __pyx_L21:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":193 + * # values from what they should be. + * # If we've reached t = 1, we are done. + * grid_mask[cur_ind[0], cur_ind[1], cur_ind[2]] = 1 # <<<<<<<<<<<<<< + * if (tmax[0] > 1.0) and (tmax[1] > 1.0) and (tmax[2] > 1.0): + * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = 1.0 - enter_t + */ + __pyx_t_93 = 0; + __pyx_t_94 = 1; + __pyx_t_95 = 2; + __pyx_t_59 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_93, __pyx_bstride_0_cur_ind)); + __pyx_t_96 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_94, __pyx_bstride_0_cur_ind)); + __pyx_t_97 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_95, __pyx_bstride_0_cur_ind)); + *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int_t *, __pyx_bstruct_grid_mask.buf, __pyx_t_59, __pyx_bstride_0_grid_mask, __pyx_t_96, __pyx_bstride_1_grid_mask, __pyx_t_97, __pyx_bstride_2_grid_mask) = 1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":194 + * # If we've reached t = 1, we are done. + * grid_mask[cur_ind[0], cur_ind[1], cur_ind[2]] = 1 + * if (tmax[0] > 1.0) and (tmax[1] > 1.0) and (tmax[2] > 1.0): # <<<<<<<<<<<<<< + * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = 1.0 - enter_t + * break + */ + __pyx_t_98 = 0; + __pyx_t_31 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_98, __pyx_bstride_0_tmax)) > 1.0); + if (__pyx_t_31) { + __pyx_t_99 = 1; + __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_99, __pyx_bstride_0_tmax)) > 1.0); + if (__pyx_t_13) { + __pyx_t_100 = 2; + __pyx_t_34 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_100, __pyx_bstride_0_tmax)) > 1.0); + __pyx_t_33 = __pyx_t_34; + } else { + __pyx_t_33 = __pyx_t_13; + } + __pyx_t_13 = __pyx_t_33; + } else { + __pyx_t_13 = __pyx_t_31; + } + if (__pyx_t_13) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":195 + * grid_mask[cur_ind[0], cur_ind[1], cur_ind[2]] = 1 + * if (tmax[0] > 1.0) and (tmax[1] > 1.0) and (tmax[2] > 1.0): + * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = 1.0 - enter_t # <<<<<<<<<<<<<< + * break + * if tmax[0] < tmax[1]: + */ + __pyx_t_101 = 0; + __pyx_t_102 = 1; + __pyx_t_103 = 2; + __pyx_t_104 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_101, __pyx_bstride_0_cur_ind)); + __pyx_t_105 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_102, __pyx_bstride_0_cur_ind)); + __pyx_t_106 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_103, __pyx_bstride_0_cur_ind)); + *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_grid_dt.buf, __pyx_t_104, __pyx_bstride_0_grid_dt, __pyx_t_105, __pyx_bstride_1_grid_dt, __pyx_t_106, __pyx_bstride_2_grid_dt) = (1.0 - __pyx_v_enter_t); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":196 + * if (tmax[0] > 1.0) and (tmax[1] > 1.0) and (tmax[2] > 1.0): + * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = 1.0 - enter_t + * break # <<<<<<<<<<<<<< + * if tmax[0] < tmax[1]: + * if tmax[0] < tmax[2]: + */ + goto __pyx_L20_break; + goto __pyx_L22; + } + __pyx_L22:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":197 + * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = 1.0 - enter_t + * break + * if tmax[0] < tmax[1]: # <<<<<<<<<<<<<< + * if tmax[0] < tmax[2]: + * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t + */ + __pyx_t_107 = 0; + __pyx_t_108 = 1; + __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_107, __pyx_bstride_0_tmax)) < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_108, __pyx_bstride_0_tmax))); + if (__pyx_t_13) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":198 + * break + * if tmax[0] < tmax[1]: + * if tmax[0] < tmax[2]: # <<<<<<<<<<<<<< + * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t + * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[0] - enter_t + */ + __pyx_t_109 = 0; + __pyx_t_110 = 2; + __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_109, __pyx_bstride_0_tmax)) < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_110, __pyx_bstride_0_tmax))); + if (__pyx_t_13) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":199 + * if tmax[0] < tmax[1]: + * if tmax[0] < tmax[2]: + * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t # <<<<<<<<<<<<<< + * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[0] - enter_t + * enter_t = tmax[0] + */ + __pyx_t_111 = 0; + __pyx_t_112 = 1; + __pyx_t_113 = 2; + __pyx_t_114 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_111, __pyx_bstride_0_cur_ind)); + __pyx_t_115 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_112, __pyx_bstride_0_cur_ind)); + __pyx_t_116 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_113, __pyx_bstride_0_cur_ind)); + *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_grid_t.buf, __pyx_t_114, __pyx_bstride_0_grid_t, __pyx_t_115, __pyx_bstride_1_grid_t, __pyx_t_116, __pyx_bstride_2_grid_t) = __pyx_v_enter_t; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":200 + * if tmax[0] < tmax[2]: + * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t + * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[0] - enter_t # <<<<<<<<<<<<<< + * enter_t = tmax[0] + * tmax[0] += tdelta[0] + */ + __pyx_t_117 = 0; + __pyx_t_118 = 0; + __pyx_t_119 = 1; + __pyx_t_120 = 2; + __pyx_t_121 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_118, __pyx_bstride_0_cur_ind)); + __pyx_t_122 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_119, __pyx_bstride_0_cur_ind)); + __pyx_t_123 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_120, __pyx_bstride_0_cur_ind)); + *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_grid_dt.buf, __pyx_t_121, __pyx_bstride_0_grid_dt, __pyx_t_122, __pyx_bstride_1_grid_dt, __pyx_t_123, __pyx_bstride_2_grid_dt) = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_117, __pyx_bstride_0_tmax)) - __pyx_v_enter_t); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":201 + * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t + * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[0] - enter_t + * enter_t = tmax[0] # <<<<<<<<<<<<<< + * tmax[0] += tdelta[0] + * cur_ind[0] += step[0] + */ + __pyx_t_124 = 0; + __pyx_v_enter_t = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_124, __pyx_bstride_0_tmax)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":202 + * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[0] - enter_t + * enter_t = tmax[0] + * tmax[0] += tdelta[0] # <<<<<<<<<<<<<< + * cur_ind[0] += step[0] + * else: + */ + __pyx_t_125 = 0; + __pyx_t_126 = 0; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_126, __pyx_bstride_0_tmax) += (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tdelta.buf, __pyx_t_125, __pyx_bstride_0_tdelta)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":203 + * enter_t = tmax[0] + * tmax[0] += tdelta[0] + * cur_ind[0] += step[0] # <<<<<<<<<<<<<< + * else: + * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t + */ + __pyx_t_127 = 0; + __pyx_t_128 = 0; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_128, __pyx_bstride_0_cur_ind) += (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_step.buf, __pyx_t_127, __pyx_bstride_0_step)); + goto __pyx_L24; + } + /*else*/ { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":205 + * cur_ind[0] += step[0] + * else: + * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t # <<<<<<<<<<<<<< + * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[2] - enter_t + * enter_t = tmax[2] + */ + __pyx_t_129 = 0; + __pyx_t_130 = 1; + __pyx_t_131 = 2; + __pyx_t_132 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_129, __pyx_bstride_0_cur_ind)); + __pyx_t_133 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_130, __pyx_bstride_0_cur_ind)); + __pyx_t_134 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_131, __pyx_bstride_0_cur_ind)); + *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_grid_t.buf, __pyx_t_132, __pyx_bstride_0_grid_t, __pyx_t_133, __pyx_bstride_1_grid_t, __pyx_t_134, __pyx_bstride_2_grid_t) = __pyx_v_enter_t; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":206 + * else: + * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t + * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[2] - enter_t # <<<<<<<<<<<<<< + * enter_t = tmax[2] + * tmax[2] += tdelta[2] + */ + __pyx_t_135 = 2; + __pyx_t_136 = 0; + __pyx_t_137 = 1; + __pyx_t_138 = 2; + __pyx_t_139 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_136, __pyx_bstride_0_cur_ind)); + __pyx_t_140 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_137, __pyx_bstride_0_cur_ind)); + __pyx_t_141 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_138, __pyx_bstride_0_cur_ind)); + *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_grid_dt.buf, __pyx_t_139, __pyx_bstride_0_grid_dt, __pyx_t_140, __pyx_bstride_1_grid_dt, __pyx_t_141, __pyx_bstride_2_grid_dt) = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_135, __pyx_bstride_0_tmax)) - __pyx_v_enter_t); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":207 + * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t + * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[2] - enter_t + * enter_t = tmax[2] # <<<<<<<<<<<<<< + * tmax[2] += tdelta[2] + * cur_ind[2] += step[2] + */ + __pyx_t_142 = 2; + __pyx_v_enter_t = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_142, __pyx_bstride_0_tmax)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":208 + * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[2] - enter_t + * enter_t = tmax[2] + * tmax[2] += tdelta[2] # <<<<<<<<<<<<<< + * cur_ind[2] += step[2] + * else: + */ + __pyx_t_143 = 2; + __pyx_t_144 = 2; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_144, __pyx_bstride_0_tmax) += (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tdelta.buf, __pyx_t_143, __pyx_bstride_0_tdelta)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":209 + * enter_t = tmax[2] + * tmax[2] += tdelta[2] + * cur_ind[2] += step[2] # <<<<<<<<<<<<<< + * else: + * if tmax[1] < tmax[2]: + */ + __pyx_t_145 = 2; + __pyx_t_146 = 2; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_146, __pyx_bstride_0_cur_ind) += (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_step.buf, __pyx_t_145, __pyx_bstride_0_step)); + } + __pyx_L24:; + goto __pyx_L23; + } + /*else*/ { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":211 + * cur_ind[2] += step[2] + * else: + * if tmax[1] < tmax[2]: # <<<<<<<<<<<<<< + * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t + * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[1] - enter_t + */ + __pyx_t_147 = 1; + __pyx_t_148 = 2; + __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_147, __pyx_bstride_0_tmax)) < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_148, __pyx_bstride_0_tmax))); + if (__pyx_t_13) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":212 + * else: + * if tmax[1] < tmax[2]: + * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t # <<<<<<<<<<<<<< + * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[1] - enter_t + * enter_t = tmax[1] + */ + __pyx_t_149 = 0; + __pyx_t_150 = 1; + __pyx_t_151 = 2; + __pyx_t_152 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_149, __pyx_bstride_0_cur_ind)); + __pyx_t_153 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_150, __pyx_bstride_0_cur_ind)); + __pyx_t_154 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_151, __pyx_bstride_0_cur_ind)); + *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_grid_t.buf, __pyx_t_152, __pyx_bstride_0_grid_t, __pyx_t_153, __pyx_bstride_1_grid_t, __pyx_t_154, __pyx_bstride_2_grid_t) = __pyx_v_enter_t; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":213 + * if tmax[1] < tmax[2]: + * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t + * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[1] - enter_t # <<<<<<<<<<<<<< + * enter_t = tmax[1] + * tmax[1] += tdelta[1] + */ + __pyx_t_155 = 1; + __pyx_t_156 = 0; + __pyx_t_157 = 1; + __pyx_t_158 = 2; + __pyx_t_159 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_156, __pyx_bstride_0_cur_ind)); + __pyx_t_160 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_157, __pyx_bstride_0_cur_ind)); + __pyx_t_161 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_158, __pyx_bstride_0_cur_ind)); + *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_grid_dt.buf, __pyx_t_159, __pyx_bstride_0_grid_dt, __pyx_t_160, __pyx_bstride_1_grid_dt, __pyx_t_161, __pyx_bstride_2_grid_dt) = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_155, __pyx_bstride_0_tmax)) - __pyx_v_enter_t); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":214 + * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t + * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[1] - enter_t + * enter_t = tmax[1] # <<<<<<<<<<<<<< + * tmax[1] += tdelta[1] + * cur_ind[1] += step[1] + */ + __pyx_t_162 = 1; + __pyx_v_enter_t = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_162, __pyx_bstride_0_tmax)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":215 + * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[1] - enter_t + * enter_t = tmax[1] + * tmax[1] += tdelta[1] # <<<<<<<<<<<<<< + * cur_ind[1] += step[1] + * else: + */ + __pyx_t_163 = 1; + __pyx_t_164 = 1; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_164, __pyx_bstride_0_tmax) += (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tdelta.buf, __pyx_t_163, __pyx_bstride_0_tdelta)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":216 + * enter_t = tmax[1] + * tmax[1] += tdelta[1] + * cur_ind[1] += step[1] # <<<<<<<<<<<<<< + * else: + * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t + */ + __pyx_t_165 = 1; + __pyx_t_166 = 1; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_166, __pyx_bstride_0_cur_ind) += (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_step.buf, __pyx_t_165, __pyx_bstride_0_step)); + goto __pyx_L25; + } + /*else*/ { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":218 + * cur_ind[1] += step[1] + * else: + * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t # <<<<<<<<<<<<<< + * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[2] - enter_t + * enter_t = tmax[2] + */ + __pyx_t_167 = 0; + __pyx_t_168 = 1; + __pyx_t_169 = 2; + __pyx_t_170 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_167, __pyx_bstride_0_cur_ind)); + __pyx_t_171 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_168, __pyx_bstride_0_cur_ind)); + __pyx_t_172 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_169, __pyx_bstride_0_cur_ind)); + *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_grid_t.buf, __pyx_t_170, __pyx_bstride_0_grid_t, __pyx_t_171, __pyx_bstride_1_grid_t, __pyx_t_172, __pyx_bstride_2_grid_t) = __pyx_v_enter_t; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":219 + * else: + * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t + * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[2] - enter_t # <<<<<<<<<<<<<< + * enter_t = tmax[2] + * tmax[2] += tdelta[2] + */ + __pyx_t_173 = 2; + __pyx_t_174 = 0; + __pyx_t_175 = 1; + __pyx_t_176 = 2; + __pyx_t_177 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_174, __pyx_bstride_0_cur_ind)); + __pyx_t_178 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_175, __pyx_bstride_0_cur_ind)); + __pyx_t_179 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_176, __pyx_bstride_0_cur_ind)); + *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_grid_dt.buf, __pyx_t_177, __pyx_bstride_0_grid_dt, __pyx_t_178, __pyx_bstride_1_grid_dt, __pyx_t_179, __pyx_bstride_2_grid_dt) = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_173, __pyx_bstride_0_tmax)) - __pyx_v_enter_t); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":220 + * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = enter_t + * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[2] - enter_t + * enter_t = tmax[2] # <<<<<<<<<<<<<< + * tmax[2] += tdelta[2] + * cur_ind[2] += step[2] + */ + __pyx_t_180 = 2; + __pyx_v_enter_t = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_180, __pyx_bstride_0_tmax)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":221 + * grid_dt[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[2] - enter_t + * enter_t = tmax[2] + * tmax[2] += tdelta[2] # <<<<<<<<<<<<<< + * cur_ind[2] += step[2] + * return + */ + __pyx_t_181 = 2; + __pyx_t_182 = 2; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tmax.buf, __pyx_t_182, __pyx_bstride_0_tmax) += (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_tdelta.buf, __pyx_t_181, __pyx_bstride_0_tdelta)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":222 + * enter_t = tmax[2] + * tmax[2] += tdelta[2] + * cur_ind[2] += step[2] # <<<<<<<<<<<<<< + * return + * + */ + __pyx_t_183 = 2; + __pyx_t_184 = 2; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_cur_ind.buf, __pyx_t_184, __pyx_bstride_0_cur_ind) += (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_step.buf, __pyx_t_183, __pyx_bstride_0_step)); + } + __pyx_L25:; + } + __pyx_L23:; + } + __pyx_L20_break:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":223 + * tmax[2] += tdelta[2] + * cur_ind[2] += step[2] + * return # <<<<<<<<<<<<<< + * + * @cython.wraparound(False) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_right_edge); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_intersect); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_t); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_dt); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cur_ind); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edge); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_step); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dx); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_tdelta); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_tmax); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_mask); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_u); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_v); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.amr_utils.VoxelTraversal"); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_right_edge); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_intersect); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_t); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_dt); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cur_ind); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edge); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_step); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dx); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_tdelta); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_tmax); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_mask); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_u); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_v); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_step); + __Pyx_XDECREF((PyObject *)__pyx_v_cur_ind); + __Pyx_XDECREF((PyObject *)__pyx_v_tdelta); + __Pyx_XDECREF((PyObject *)__pyx_v_tmax); + __Pyx_XDECREF((PyObject *)__pyx_v_intersect); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":227 + * @cython.wraparound(False) + * @cython.boundscheck(False) + * def PlaneVoxelIntegration(np.ndarray[np.float64_t, ndim=1] left_edge, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t, ndim=1] right_edge, + * np.ndarray[np.float64_t, ndim=1] dx, + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_PlaneVoxelIntegration(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_PlaneVoxelIntegration(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_left_edge = 0; + PyArrayObject *__pyx_v_right_edge = 0; + PyArrayObject *__pyx_v_dx = 0; + PyArrayObject *__pyx_v_ug = 0; + PyArrayObject *__pyx_v_v = 0; + PyArrayObject *__pyx_v_image = 0; + PyArrayObject *__pyx_v_data = 0; + PyArrayObject *__pyx_v_shells = 0; + int __pyx_v_i; + int __pyx_v_vi; + long __pyx_v_intersect_t; + double __pyx_v_dt_tolerance; + int __pyx_v_nv; + int __pyx_v_nshells; + PyArrayObject *__pyx_v_u = 0; + Py_buffer __pyx_bstruct_u; + Py_ssize_t __pyx_bstride_0_u = 0; + Py_ssize_t __pyx_bshape_0_u = 0; + Py_buffer __pyx_bstruct_shells; + Py_ssize_t __pyx_bstride_0_shells = 0; + Py_ssize_t __pyx_bstride_1_shells = 0; + Py_ssize_t __pyx_bshape_0_shells = 0; + Py_ssize_t __pyx_bshape_1_shells = 0; + Py_buffer __pyx_bstruct_image; + Py_ssize_t __pyx_bstride_0_image = 0; + Py_ssize_t __pyx_bstride_1_image = 0; + Py_ssize_t __pyx_bshape_0_image = 0; + Py_ssize_t __pyx_bshape_1_image = 0; + Py_buffer __pyx_bstruct_right_edge; + Py_ssize_t __pyx_bstride_0_right_edge = 0; + Py_ssize_t __pyx_bshape_0_right_edge = 0; + 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_v; + Py_ssize_t __pyx_bstride_0_v = 0; + Py_ssize_t __pyx_bshape_0_v = 0; + Py_buffer __pyx_bstruct_left_edge; + Py_ssize_t __pyx_bstride_0_left_edge = 0; + Py_ssize_t __pyx_bshape_0_left_edge = 0; + Py_buffer __pyx_bstruct_ug; + Py_ssize_t __pyx_bstride_0_ug = 0; + Py_ssize_t __pyx_bstride_1_ug = 0; + Py_ssize_t __pyx_bshape_0_ug = 0; + Py_ssize_t __pyx_bshape_1_ug = 0; + Py_buffer __pyx_bstruct_data; + Py_ssize_t __pyx_bstride_0_data = 0; + Py_ssize_t __pyx_bstride_1_data = 0; + Py_ssize_t __pyx_bstride_2_data = 0; + Py_ssize_t __pyx_bshape_0_data = 0; + Py_ssize_t __pyx_bshape_1_data = 0; + Py_ssize_t __pyx_bshape_2_data = 0; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyArrayObject *__pyx_t_6 = NULL; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__left_edge,&__pyx_n_s__right_edge,&__pyx_n_s__dx,&__pyx_n_s__ug,&__pyx_n_s__v,&__pyx_n_s__image,&__pyx_n_s__data,&__pyx_n_s__shells,0}; + __Pyx_RefNannySetupContext("PlaneVoxelIntegration"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[8] = {0,0,0,0,0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left_edge); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right_edge); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("PlaneVoxelIntegration", 1, 8, 8, 1); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dx); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("PlaneVoxelIntegration", 1, 8, 8, 2); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ug); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("PlaneVoxelIntegration", 1, 8, 8, 3); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__v); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("PlaneVoxelIntegration", 1, 8, 8, 4); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__image); + if (likely(values[5])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("PlaneVoxelIntegration", 1, 8, 8, 5); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 6: + values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data); + if (likely(values[6])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("PlaneVoxelIntegration", 1, 8, 8, 6); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 7: + values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__shells); + if (likely(values[7])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("PlaneVoxelIntegration", 1, 8, 8, 7); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "PlaneVoxelIntegration") < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_left_edge = ((PyArrayObject *)values[0]); + __pyx_v_right_edge = ((PyArrayObject *)values[1]); + __pyx_v_dx = ((PyArrayObject *)values[2]); + __pyx_v_ug = ((PyArrayObject *)values[3]); + __pyx_v_v = ((PyArrayObject *)values[4]); + __pyx_v_image = ((PyArrayObject *)values[5]); + __pyx_v_data = ((PyArrayObject *)values[6]); + __pyx_v_shells = ((PyArrayObject *)values[7]); + } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_left_edge = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); + __pyx_v_right_edge = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); + __pyx_v_dx = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); + __pyx_v_ug = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); + __pyx_v_v = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); + __pyx_v_image = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 5)); + __pyx_v_data = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 6)); + __pyx_v_shells = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 7)); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("PlaneVoxelIntegration", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.PlaneVoxelIntegration"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_bstruct_u.buf = NULL; + __pyx_bstruct_left_edge.buf = NULL; + __pyx_bstruct_right_edge.buf = NULL; + __pyx_bstruct_dx.buf = NULL; + __pyx_bstruct_ug.buf = NULL; + __pyx_bstruct_v.buf = NULL; + __pyx_bstruct_image.buf = NULL; + __pyx_bstruct_data.buf = NULL; + __pyx_bstruct_shells.buf = NULL; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left_edge), __pyx_ptype_5numpy_ndarray, 1, "left_edge", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right_edge), __pyx_ptype_5numpy_ndarray, 1, "right_edge", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 228; __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[4]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ug), __pyx_ptype_5numpy_ndarray, 1, "ug", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_image), __pyx_ptype_5numpy_ndarray, 1, "image", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), __pyx_ptype_5numpy_ndarray, 1, "data", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shells), __pyx_ptype_5numpy_ndarray, 1, "shells", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_left_edge, (PyObject*)__pyx_v_left_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_left_edge = __pyx_bstruct_left_edge.strides[0]; + __pyx_bshape_0_left_edge = __pyx_bstruct_left_edge.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_right_edge, (PyObject*)__pyx_v_right_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_right_edge = __pyx_bstruct_right_edge.strides[0]; + __pyx_bshape_0_right_edge = __pyx_bstruct_right_edge.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dx, (PyObject*)__pyx_v_dx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __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]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_ug, (PyObject*)__pyx_v_ug, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_ug = __pyx_bstruct_ug.strides[0]; __pyx_bstride_1_ug = __pyx_bstruct_ug.strides[1]; + __pyx_bshape_0_ug = __pyx_bstruct_ug.shape[0]; __pyx_bshape_1_ug = __pyx_bstruct_ug.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_v, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_v = __pyx_bstruct_v.strides[0]; + __pyx_bshape_0_v = __pyx_bstruct_v.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_image, (PyObject*)__pyx_v_image, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_image = __pyx_bstruct_image.strides[0]; __pyx_bstride_1_image = __pyx_bstruct_image.strides[1]; + __pyx_bshape_0_image = __pyx_bstruct_image.shape[0]; __pyx_bshape_1_image = __pyx_bstruct_image.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_data, (PyObject*)__pyx_v_data, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_data = __pyx_bstruct_data.strides[0]; __pyx_bstride_1_data = __pyx_bstruct_data.strides[1]; __pyx_bstride_2_data = __pyx_bstruct_data.strides[2]; + __pyx_bshape_0_data = __pyx_bstruct_data.shape[0]; __pyx_bshape_1_data = __pyx_bstruct_data.shape[1]; __pyx_bshape_2_data = __pyx_bstruct_data.shape[2]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_shells, (PyObject*)__pyx_v_shells, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_shells = __pyx_bstruct_shells.strides[0]; __pyx_bstride_1_shells = __pyx_bstruct_shells.strides[1]; + __pyx_bshape_0_shells = __pyx_bstruct_shells.shape[0]; __pyx_bshape_1_shells = __pyx_bstruct_shells.shape[1]; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":239 + * # generalized to transfer functions + * cdef int i, x, y, vi + * intersect_t = 1 # <<<<<<<<<<<<<< + * dt_tolerance = 1e-6 + * cdef int nv = ug.shape[0] + */ + __pyx_v_intersect_t = 1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":240 + * cdef int i, x, y, vi + * intersect_t = 1 + * dt_tolerance = 1e-6 # <<<<<<<<<<<<<< + * cdef int nv = ug.shape[0] + * cdef int nshells = shells.shape[0] + */ + __pyx_v_dt_tolerance = 1e-6; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":241 + * intersect_t = 1 + * dt_tolerance = 1e-6 + * cdef int nv = ug.shape[0] # <<<<<<<<<<<<<< + * cdef int nshells = shells.shape[0] + * cdef np.ndarray[np.float64_t, ndim=1] u = np.empty((3,), dtype=np.float64) + */ + __pyx_v_nv = (__pyx_v_ug->dimensions[0]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":242 + * dt_tolerance = 1e-6 + * cdef int nv = ug.shape[0] + * cdef int nshells = shells.shape[0] # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t, ndim=1] u = np.empty((3,), dtype=np.float64) + * # Copy things into temporary location for passing between functions + */ + __pyx_v_nshells = (__pyx_v_shells->dimensions[0]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":243 + * cdef int nv = ug.shape[0] + * cdef int nshells = shells.shape[0] + * cdef np.ndarray[np.float64_t, ndim=1] u = np.empty((3,), dtype=np.float64) # <<<<<<<<<<<<<< + * # Copy things into temporary location for passing between functions + * for vi in range(nv): + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_int_3); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = ((PyArrayObject *)__pyx_t_5); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_u, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_u = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_u.buf = NULL; + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_bstride_0_u = __pyx_bstruct_u.strides[0]; + __pyx_bshape_0_u = __pyx_bstruct_u.shape[0]; + } + } + __pyx_t_6 = 0; + __pyx_v_u = ((PyArrayObject *)__pyx_t_5); + __pyx_t_5 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":245 + * cdef np.ndarray[np.float64_t, ndim=1] u = np.empty((3,), dtype=np.float64) + * # Copy things into temporary location for passing between functions + * for vi in range(nv): # <<<<<<<<<<<<<< + * for i in range(3): u[i] = ug[vi, i] + * integrate_ray(u, v, left_edge, right_edge, dx, + */ + __pyx_t_7 = __pyx_v_nv; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { + __pyx_v_vi = __pyx_t_8; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":246 + * # Copy things into temporary location for passing between functions + * for vi in range(nv): + * for i in range(3): u[i] = ug[vi, i] # <<<<<<<<<<<<<< + * integrate_ray(u, v, left_edge, right_edge, dx, + * nshells, vi, data, shells, image) + */ + for (__pyx_t_9 = 0; __pyx_t_9 < 3; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; + __pyx_t_10 = __pyx_v_vi; + __pyx_t_11 = __pyx_v_i; + __pyx_t_12 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_12, __pyx_bstride_0_u) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_ug.buf, __pyx_t_10, __pyx_bstride_0_ug, __pyx_t_11, __pyx_bstride_1_ug)); + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":247 + * for vi in range(nv): + * for i in range(3): u[i] = ug[vi, i] + * integrate_ray(u, v, left_edge, right_edge, dx, # <<<<<<<<<<<<<< + * nshells, vi, data, shells, image) + * + */ + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__integrate_ray); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":248 + * for i in range(3): u[i] = ug[vi, i] + * integrate_ray(u, v, left_edge, right_edge, dx, + * nshells, vi, data, shells, image) # <<<<<<<<<<<<<< + * + * @cython.wraparound(False) + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_nshells); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyInt_FromLong(__pyx_v_vi); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_u)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_u)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_u)); + __Pyx_INCREF(((PyObject *)__pyx_v_v)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_v)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_v)); + __Pyx_INCREF(((PyObject *)__pyx_v_left_edge)); + PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_left_edge)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_left_edge)); + __Pyx_INCREF(((PyObject *)__pyx_v_right_edge)); + PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_v_right_edge)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_right_edge)); + __Pyx_INCREF(((PyObject *)__pyx_v_dx)); + PyTuple_SET_ITEM(__pyx_t_2, 4, ((PyObject *)__pyx_v_dx)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dx)); + PyTuple_SET_ITEM(__pyx_t_2, 5, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_2, 6, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_data)); + PyTuple_SET_ITEM(__pyx_t_2, 7, ((PyObject *)__pyx_v_data)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_data)); + __Pyx_INCREF(((PyObject *)__pyx_v_shells)); + PyTuple_SET_ITEM(__pyx_t_2, 8, ((PyObject *)__pyx_v_shells)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_shells)); + __Pyx_INCREF(((PyObject *)__pyx_v_image)); + PyTuple_SET_ITEM(__pyx_t_2, 9, ((PyObject *)__pyx_v_image)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_image)); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_u); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_shells); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_image); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_right_edge); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dx); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_v); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edge); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ug); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.amr_utils.PlaneVoxelIntegration"); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_u); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_shells); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_image); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_right_edge); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dx); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_v); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edge); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ug); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_u); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":252 + * @cython.wraparound(False) + * @cython.boundscheck(False) + * def integrate_ray(np.ndarray[np.float64_t, ndim=1] u, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t, ndim=1] v, + * np.ndarray[np.float64_t, ndim=1] left_edge, + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_integrate_ray(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_integrate_ray(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_u = 0; + PyArrayObject *__pyx_v_v = 0; + PyArrayObject *__pyx_v_left_edge = 0; + PyArrayObject *__pyx_v_right_edge = 0; + PyArrayObject *__pyx_v_dx = 0; + int __pyx_v_nshells; + int __pyx_v_ind; + PyArrayObject *__pyx_v_data = 0; + PyArrayObject *__pyx_v_shells = 0; + PyArrayObject *__pyx_v_image = 0; + int __pyx_v_step[3]; + int __pyx_v_x; + int __pyx_v_y; + int __pyx_v_i; + int __pyx_v_n; + __pyx_t_5numpy_float64_t __pyx_v_intersect_t; + __pyx_t_5numpy_float64_t __pyx_v_dt_tolerance; + __pyx_t_5numpy_float64_t __pyx_v_tl; + __pyx_t_5numpy_float64_t __pyx_v_tr; + __pyx_t_5numpy_float64_t __pyx_v_enter_t; + __pyx_t_5numpy_int64_t __pyx_v_cur_ind[3]; + __pyx_t_5numpy_float64_t __pyx_v_tdelta[3]; + __pyx_t_5numpy_float64_t __pyx_v_tmax[3]; + __pyx_t_5numpy_float64_t __pyx_v_intersect[3]; + __pyx_t_5numpy_float64_t __pyx_v_dt; + __pyx_t_5numpy_float64_t __pyx_v_dv; + __pyx_t_5numpy_float64_t __pyx_v_dist; + __pyx_t_5numpy_float64_t __pyx_v_alpha; + __pyx_t_5numpy_float64_t __pyx_v_one; + int __pyx_v_dims[3]; + __pyx_t_5numpy_float64_t __pyx_v_temp_x; + __pyx_t_5numpy_float64_t __pyx_v_temp_y; + int __pyx_v_ncells; + Py_buffer __pyx_bstruct_image; + Py_ssize_t __pyx_bstride_0_image = 0; + Py_ssize_t __pyx_bstride_1_image = 0; + Py_ssize_t __pyx_bshape_0_image = 0; + Py_ssize_t __pyx_bshape_1_image = 0; + Py_buffer __pyx_bstruct_shells; + Py_ssize_t __pyx_bstride_0_shells = 0; + Py_ssize_t __pyx_bstride_1_shells = 0; + Py_ssize_t __pyx_bshape_0_shells = 0; + Py_ssize_t __pyx_bshape_1_shells = 0; + Py_buffer __pyx_bstruct_right_edge; + Py_ssize_t __pyx_bstride_0_right_edge = 0; + Py_ssize_t __pyx_bshape_0_right_edge = 0; + Py_buffer __pyx_bstruct_left_edge; + Py_ssize_t __pyx_bstride_0_left_edge = 0; + Py_ssize_t __pyx_bshape_0_left_edge = 0; + 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_data; + Py_ssize_t __pyx_bstride_0_data = 0; + Py_ssize_t __pyx_bstride_1_data = 0; + Py_ssize_t __pyx_bstride_2_data = 0; + Py_ssize_t __pyx_bshape_0_data = 0; + Py_ssize_t __pyx_bshape_1_data = 0; + Py_ssize_t __pyx_bshape_2_data = 0; + Py_buffer __pyx_bstruct_u; + Py_ssize_t __pyx_bstride_0_u = 0; + Py_ssize_t __pyx_bshape_0_u = 0; + Py_buffer __pyx_bstruct_v; + Py_ssize_t __pyx_bstride_0_v = 0; + Py_ssize_t __pyx_bshape_0_v = 0; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + __pyx_t_5numpy_float64_t __pyx_t_6; + int __pyx_t_7; + __pyx_t_5numpy_float64_t __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; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + int __pyx_t_18; + int __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; + int __pyx_t_23; + int __pyx_t_24; + int __pyx_t_25; + int __pyx_t_26; + int __pyx_t_27; + int __pyx_t_28; + int __pyx_t_29; + int __pyx_t_30; + int __pyx_t_31; + int __pyx_t_32; + int __pyx_t_33; + long __pyx_t_34; + long __pyx_t_35; + long __pyx_t_36; + long __pyx_t_37; + long __pyx_t_38; + long __pyx_t_39; + long __pyx_t_40; + long __pyx_t_41; + long __pyx_t_42; + int __pyx_t_43; + int __pyx_t_44; + PyObject *__pyx_t_45 = NULL; + PyObject *__pyx_t_46 = NULL; + int __pyx_t_47; + int __pyx_t_48; + int __pyx_t_49; + PyObject *__pyx_t_50 = NULL; + __pyx_t_5numpy_int64_t __pyx_t_51; + int __pyx_t_52; + int __pyx_t_53; + int __pyx_t_54; + int __pyx_t_55; + int __pyx_t_56; + int __pyx_t_57; + int __pyx_t_58; + int __pyx_t_59; + int __pyx_t_60; + int __pyx_t_61; + int __pyx_t_62; + int __pyx_t_63; + int __pyx_t_64; + int __pyx_t_65; + __pyx_t_5numpy_int64_t __pyx_t_66; + __pyx_t_5numpy_int64_t __pyx_t_67; + long __pyx_t_68; + __pyx_t_5numpy_int64_t __pyx_t_69; + int __pyx_t_70; + int __pyx_t_71; + int __pyx_t_72; + long __pyx_t_73; + int __pyx_t_74; + long __pyx_t_75; + int __pyx_t_76; + long __pyx_t_77; + int __pyx_t_78; + long __pyx_t_79; + int __pyx_t_80; + long __pyx_t_81; + int __pyx_t_82; + long __pyx_t_83; + int __pyx_t_84; + long __pyx_t_85; + int __pyx_t_86; + long __pyx_t_87; + int __pyx_t_88; + long __pyx_t_89; + int __pyx_t_90; + long __pyx_t_91; + int __pyx_t_92; + long __pyx_t_93; + int __pyx_t_94; + long __pyx_t_95; + __pyx_t_5numpy_int64_t __pyx_t_96; + __pyx_t_5numpy_int64_t __pyx_t_97; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__u,&__pyx_n_s__v,&__pyx_n_s__left_edge,&__pyx_n_s__right_edge,&__pyx_n_s__dx,&__pyx_n_s__nshells,&__pyx_n_s__ind,&__pyx_n_s__data,&__pyx_n_s__shells,&__pyx_n_s__image,0}; + __Pyx_RefNannySetupContext("integrate_ray"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); + case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__u); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__v); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("integrate_ray", 1, 10, 10, 1); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left_edge); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("integrate_ray", 1, 10, 10, 2); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right_edge); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("integrate_ray", 1, 10, 10, 3); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dx); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("integrate_ray", 1, 10, 10, 4); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nshells); + if (likely(values[5])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("integrate_ray", 1, 10, 10, 5); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 6: + values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ind); + if (likely(values[6])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("integrate_ray", 1, 10, 10, 6); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 7: + values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data); + if (likely(values[7])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("integrate_ray", 1, 10, 10, 7); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 8: + values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__shells); + if (likely(values[8])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("integrate_ray", 1, 10, 10, 8); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 9: + values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__image); + if (likely(values[9])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("integrate_ray", 1, 10, 10, 9); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "integrate_ray") < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_u = ((PyArrayObject *)values[0]); + __pyx_v_v = ((PyArrayObject *)values[1]); + __pyx_v_left_edge = ((PyArrayObject *)values[2]); + __pyx_v_right_edge = ((PyArrayObject *)values[3]); + __pyx_v_dx = ((PyArrayObject *)values[4]); + __pyx_v_nshells = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_nshells == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_ind = __Pyx_PyInt_AsInt(values[6]); if (unlikely((__pyx_v_ind == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_data = ((PyArrayObject *)values[7]); + __pyx_v_shells = ((PyArrayObject *)values[8]); + __pyx_v_image = ((PyArrayObject *)values[9]); + } else if (PyTuple_GET_SIZE(__pyx_args) != 10) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_u = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); + __pyx_v_v = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); + __pyx_v_left_edge = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); + __pyx_v_right_edge = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); + __pyx_v_dx = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); + __pyx_v_nshells = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_nshells == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_ind = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 6)); if (unlikely((__pyx_v_ind == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_data = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 7)); + __pyx_v_shells = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 8)); + __pyx_v_image = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 9)); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("integrate_ray", 1, 10, 10, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.integrate_ray"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_bstruct_u.buf = NULL; + __pyx_bstruct_v.buf = NULL; + __pyx_bstruct_left_edge.buf = NULL; + __pyx_bstruct_right_edge.buf = NULL; + __pyx_bstruct_dx.buf = NULL; + __pyx_bstruct_data.buf = NULL; + __pyx_bstruct_shells.buf = NULL; + __pyx_bstruct_image.buf = NULL; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_u), __pyx_ptype_5numpy_ndarray, 1, "u", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left_edge), __pyx_ptype_5numpy_ndarray, 1, "left_edge", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right_edge), __pyx_ptype_5numpy_ndarray, 1, "right_edge", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 255; __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[4]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), __pyx_ptype_5numpy_ndarray, 1, "data", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shells), __pyx_ptype_5numpy_ndarray, 1, "shells", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_image), __pyx_ptype_5numpy_ndarray, 1, "image", 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_u, (PyObject*)__pyx_v_u, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_u = __pyx_bstruct_u.strides[0]; + __pyx_bshape_0_u = __pyx_bstruct_u.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_v, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_v = __pyx_bstruct_v.strides[0]; + __pyx_bshape_0_v = __pyx_bstruct_v.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_left_edge, (PyObject*)__pyx_v_left_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_left_edge = __pyx_bstruct_left_edge.strides[0]; + __pyx_bshape_0_left_edge = __pyx_bstruct_left_edge.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_right_edge, (PyObject*)__pyx_v_right_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_right_edge = __pyx_bstruct_right_edge.strides[0]; + __pyx_bshape_0_right_edge = __pyx_bstruct_right_edge.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dx, (PyObject*)__pyx_v_dx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __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]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_data, (PyObject*)__pyx_v_data, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_data = __pyx_bstruct_data.strides[0]; __pyx_bstride_1_data = __pyx_bstruct_data.strides[1]; __pyx_bstride_2_data = __pyx_bstruct_data.strides[2]; + __pyx_bshape_0_data = __pyx_bstruct_data.shape[0]; __pyx_bshape_1_data = __pyx_bstruct_data.shape[1]; __pyx_bshape_2_data = __pyx_bstruct_data.shape[2]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_shells, (PyObject*)__pyx_v_shells, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_shells = __pyx_bstruct_shells.strides[0]; __pyx_bstride_1_shells = __pyx_bstruct_shells.strides[1]; + __pyx_bshape_0_shells = __pyx_bstruct_shells.shape[0]; __pyx_bshape_1_shells = __pyx_bstruct_shells.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_image, (PyObject*)__pyx_v_image, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_image = __pyx_bstruct_image.strides[0]; __pyx_bstride_1_image = __pyx_bstruct_image.strides[1]; + __pyx_bshape_0_image = __pyx_bstruct_image.shape[0]; __pyx_bshape_1_image = __pyx_bstruct_image.shape[1]; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":262 + * np.ndarray[np.float64_t, ndim=2] image): + * cdef int step[3], x, y, i, n + * cdef np.float64_t intersect_t = 1 # <<<<<<<<<<<<<< + * cdef np.float64_t dt_tolerance = 1e-6 + * cdef np.float64_t tl, tr, enter_t, exit_t + */ + __pyx_v_intersect_t = 1.0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":263 + * cdef int step[3], x, y, i, n + * cdef np.float64_t intersect_t = 1 + * cdef np.float64_t dt_tolerance = 1e-6 # <<<<<<<<<<<<<< + * cdef np.float64_t tl, tr, enter_t, exit_t + * cdef np.int64_t cur_ind[3] + */ + __pyx_v_dt_tolerance = 1e-6; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":271 + * cdef np.float64_t dt, dv + * cdef np.float64_t dist, alpha + * cdef np.float64_t one = 1.0 # <<<<<<<<<<<<<< + * cdef int dims[3] + * cdef np.float64_t rgba[4], temp_x, temp_y + */ + __pyx_v_one = 1.0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":274 + * cdef int dims[3] + * cdef np.float64_t rgba[4], temp_x, temp_y + * for i in range(3): # <<<<<<<<<<<<<< + * # As long as we're iterating, set some other stuff, too + * dims[i] = data.shape[i] + */ + for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":276 + * for i in range(3): + * # As long as we're iterating, set some other stuff, too + * dims[i] = data.shape[i] # <<<<<<<<<<<<<< + * if(v[i] < 0): step[i] = -1 + * else: step[i] = 1 + */ + (__pyx_v_dims[__pyx_v_i]) = (__pyx_v_data->dimensions[__pyx_v_i]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":277 + * # As long as we're iterating, set some other stuff, too + * dims[i] = data.shape[i] + * if(v[i] < 0): step[i] = -1 # <<<<<<<<<<<<<< + * else: step[i] = 1 + * x = (i+1)%3 + */ + __pyx_t_2 = __pyx_v_i; + __pyx_t_3 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_2, __pyx_bstride_0_v)) < 0.0); + if (__pyx_t_3) { + (__pyx_v_step[__pyx_v_i]) = -1; + goto __pyx_L8; + } + /*else*/ { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":278 + * dims[i] = data.shape[i] + * if(v[i] < 0): step[i] = -1 + * else: step[i] = 1 # <<<<<<<<<<<<<< + * x = (i+1)%3 + * y = (i+2)%3 + */ + (__pyx_v_step[__pyx_v_i]) = 1; + } + __pyx_L8:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":279 + * if(v[i] < 0): step[i] = -1 + * else: step[i] = 1 + * x = (i+1)%3 # <<<<<<<<<<<<<< + * y = (i+2)%3 + * tl = (left_edge[i] - u[i])/v[i] + */ + __pyx_v_x = __Pyx_mod_long((__pyx_v_i + 1), 3); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":280 + * else: step[i] = 1 + * x = (i+1)%3 + * y = (i+2)%3 # <<<<<<<<<<<<<< + * tl = (left_edge[i] - u[i])/v[i] + * tr = (right_edge[i] - u[i])/v[i] + */ + __pyx_v_y = __Pyx_mod_long((__pyx_v_i + 2), 3); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":281 + * x = (i+1)%3 + * y = (i+2)%3 + * tl = (left_edge[i] - u[i])/v[i] # <<<<<<<<<<<<<< + * tr = (right_edge[i] - u[i])/v[i] + * temp_x = (u[x] + tl*v[x]) + */ + __pyx_t_4 = __pyx_v_i; + __pyx_t_5 = __pyx_v_i; + __pyx_t_6 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_4, __pyx_bstride_0_left_edge)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_5, __pyx_bstride_0_u))); + __pyx_t_7 = __pyx_v_i; + __pyx_t_8 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_7, __pyx_bstride_0_v)); + if (unlikely(__pyx_t_8 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_tl = (__pyx_t_6 / __pyx_t_8); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":282 + * y = (i+2)%3 + * tl = (left_edge[i] - u[i])/v[i] + * tr = (right_edge[i] - u[i])/v[i] # <<<<<<<<<<<<<< + * temp_x = (u[x] + tl*v[x]) + * temp_y = (u[y] + tl*v[y]) + */ + __pyx_t_9 = __pyx_v_i; + __pyx_t_10 = __pyx_v_i; + __pyx_t_8 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_9, __pyx_bstride_0_right_edge)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_10, __pyx_bstride_0_u))); + __pyx_t_11 = __pyx_v_i; + __pyx_t_6 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_11, __pyx_bstride_0_v)); + if (unlikely(__pyx_t_6 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_tr = (__pyx_t_8 / __pyx_t_6); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":283 + * tl = (left_edge[i] - u[i])/v[i] + * tr = (right_edge[i] - u[i])/v[i] + * temp_x = (u[x] + tl*v[x]) # <<<<<<<<<<<<<< + * temp_y = (u[y] + tl*v[y]) + * if (left_edge[x] <= temp_x) and (temp_x <= right_edge[x]) and \ + */ + __pyx_t_12 = __pyx_v_x; + __pyx_t_13 = __pyx_v_x; + __pyx_v_temp_x = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_12, __pyx_bstride_0_u)) + (__pyx_v_tl * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_13, __pyx_bstride_0_v)))); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":284 + * tr = (right_edge[i] - u[i])/v[i] + * temp_x = (u[x] + tl*v[x]) + * temp_y = (u[y] + tl*v[y]) # <<<<<<<<<<<<<< + * if (left_edge[x] <= temp_x) and (temp_x <= right_edge[x]) and \ + * (left_edge[y] <= temp_y) and (temp_y <= right_edge[y]) and \ + */ + __pyx_t_14 = __pyx_v_y; + __pyx_t_15 = __pyx_v_y; + __pyx_v_temp_y = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_14, __pyx_bstride_0_u)) + (__pyx_v_tl * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_15, __pyx_bstride_0_v)))); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":285 + * temp_x = (u[x] + tl*v[x]) + * temp_y = (u[y] + tl*v[y]) + * if (left_edge[x] <= temp_x) and (temp_x <= right_edge[x]) and \ # <<<<<<<<<<<<<< + * (left_edge[y] <= temp_y) and (temp_y <= right_edge[y]) and \ + * (0.0 <= tl) and (tl < intersect_t): + */ + __pyx_t_16 = __pyx_v_x; + __pyx_t_3 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_16, __pyx_bstride_0_left_edge)) <= __pyx_v_temp_x); + if (__pyx_t_3) { + __pyx_t_17 = __pyx_v_x; + __pyx_t_18 = (__pyx_v_temp_x <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_17, __pyx_bstride_0_right_edge))); + if (__pyx_t_18) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":286 + * temp_y = (u[y] + tl*v[y]) + * if (left_edge[x] <= temp_x) and (temp_x <= right_edge[x]) and \ + * (left_edge[y] <= temp_y) and (temp_y <= right_edge[y]) and \ # <<<<<<<<<<<<<< + * (0.0 <= tl) and (tl < intersect_t): + * intersect_t = tl + */ + __pyx_t_19 = __pyx_v_y; + __pyx_t_20 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_19, __pyx_bstride_0_left_edge)) <= __pyx_v_temp_y); + if (__pyx_t_20) { + __pyx_t_21 = __pyx_v_y; + __pyx_t_22 = (__pyx_v_temp_y <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_21, __pyx_bstride_0_right_edge))); + if (__pyx_t_22) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":287 + * if (left_edge[x] <= temp_x) and (temp_x <= right_edge[x]) and \ + * (left_edge[y] <= temp_y) and (temp_y <= right_edge[y]) and \ + * (0.0 <= tl) and (tl < intersect_t): # <<<<<<<<<<<<<< + * intersect_t = tl + * temp_x = (u[x] + tr*v[x]) + */ + __pyx_t_23 = (0.0 <= __pyx_v_tl); + if (__pyx_t_23) { + __pyx_t_24 = (__pyx_v_tl < __pyx_v_intersect_t); + __pyx_t_25 = __pyx_t_24; + } else { + __pyx_t_25 = __pyx_t_23; + } + __pyx_t_23 = __pyx_t_25; + } else { + __pyx_t_23 = __pyx_t_22; + } + __pyx_t_22 = __pyx_t_23; + } else { + __pyx_t_22 = __pyx_t_20; + } + __pyx_t_20 = __pyx_t_22; + } else { + __pyx_t_20 = __pyx_t_18; + } + __pyx_t_18 = __pyx_t_20; + } else { + __pyx_t_18 = __pyx_t_3; + } + if (__pyx_t_18) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":288 + * (left_edge[y] <= temp_y) and (temp_y <= right_edge[y]) and \ + * (0.0 <= tl) and (tl < intersect_t): + * intersect_t = tl # <<<<<<<<<<<<<< + * temp_x = (u[x] + tr*v[x]) + * temp_y = (u[y] + tr*v[y]) + */ + __pyx_v_intersect_t = __pyx_v_tl; + goto __pyx_L9; + } + __pyx_L9:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":289 + * (0.0 <= tl) and (tl < intersect_t): + * intersect_t = tl + * temp_x = (u[x] + tr*v[x]) # <<<<<<<<<<<<<< + * temp_y = (u[y] + tr*v[y]) + * if (left_edge[x] <= temp_x) and (temp_x <= right_edge[x]) and \ + */ + __pyx_t_26 = __pyx_v_x; + __pyx_t_27 = __pyx_v_x; + __pyx_v_temp_x = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_26, __pyx_bstride_0_u)) + (__pyx_v_tr * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_27, __pyx_bstride_0_v)))); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":290 + * intersect_t = tl + * temp_x = (u[x] + tr*v[x]) + * temp_y = (u[y] + tr*v[y]) # <<<<<<<<<<<<<< + * if (left_edge[x] <= temp_x) and (temp_x <= right_edge[x]) and \ + * (left_edge[y] <= temp_y) and (temp_y <= right_edge[y]) and \ + */ + __pyx_t_28 = __pyx_v_y; + __pyx_t_29 = __pyx_v_y; + __pyx_v_temp_y = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_28, __pyx_bstride_0_u)) + (__pyx_v_tr * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_29, __pyx_bstride_0_v)))); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":291 + * temp_x = (u[x] + tr*v[x]) + * temp_y = (u[y] + tr*v[y]) + * if (left_edge[x] <= temp_x) and (temp_x <= right_edge[x]) and \ # <<<<<<<<<<<<<< + * (left_edge[y] <= temp_y) and (temp_y <= right_edge[y]) and \ + * (0.0 <= tr) and (tr < intersect_t): + */ + __pyx_t_30 = __pyx_v_x; + __pyx_t_18 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_30, __pyx_bstride_0_left_edge)) <= __pyx_v_temp_x); + if (__pyx_t_18) { + __pyx_t_31 = __pyx_v_x; + __pyx_t_3 = (__pyx_v_temp_x <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_31, __pyx_bstride_0_right_edge))); + if (__pyx_t_3) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":292 + * temp_y = (u[y] + tr*v[y]) + * if (left_edge[x] <= temp_x) and (temp_x <= right_edge[x]) and \ + * (left_edge[y] <= temp_y) and (temp_y <= right_edge[y]) and \ # <<<<<<<<<<<<<< + * (0.0 <= tr) and (tr < intersect_t): + * intersect_t = tr + */ + __pyx_t_32 = __pyx_v_y; + __pyx_t_20 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_32, __pyx_bstride_0_left_edge)) <= __pyx_v_temp_y); + if (__pyx_t_20) { + __pyx_t_33 = __pyx_v_y; + __pyx_t_22 = (__pyx_v_temp_y <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_33, __pyx_bstride_0_right_edge))); + if (__pyx_t_22) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":293 + * if (left_edge[x] <= temp_x) and (temp_x <= right_edge[x]) and \ + * (left_edge[y] <= temp_y) and (temp_y <= right_edge[y]) and \ + * (0.0 <= tr) and (tr < intersect_t): # <<<<<<<<<<<<<< + * intersect_t = tr + * # if fully enclosed + */ + __pyx_t_23 = (0.0 <= __pyx_v_tr); + if (__pyx_t_23) { + __pyx_t_25 = (__pyx_v_tr < __pyx_v_intersect_t); + __pyx_t_24 = __pyx_t_25; + } else { + __pyx_t_24 = __pyx_t_23; + } + __pyx_t_23 = __pyx_t_24; + } else { + __pyx_t_23 = __pyx_t_22; + } + __pyx_t_22 = __pyx_t_23; + } else { + __pyx_t_22 = __pyx_t_20; + } + __pyx_t_20 = __pyx_t_22; + } else { + __pyx_t_20 = __pyx_t_3; + } + __pyx_t_3 = __pyx_t_20; + } else { + __pyx_t_3 = __pyx_t_18; + } + if (__pyx_t_3) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":294 + * (left_edge[y] <= temp_y) and (temp_y <= right_edge[y]) and \ + * (0.0 <= tr) and (tr < intersect_t): + * intersect_t = tr # <<<<<<<<<<<<<< + * # if fully enclosed + * if (left_edge[0] <= u[0] <= right_edge[0]) and \ + */ + __pyx_v_intersect_t = __pyx_v_tr; + goto __pyx_L10; + } + __pyx_L10:; + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":296 + * intersect_t = tr + * # if fully enclosed + * if (left_edge[0] <= u[0] <= right_edge[0]) and \ # <<<<<<<<<<<<<< + * (left_edge[1] <= u[1] <= right_edge[1]) and \ + * (left_edge[2] <= u[2] <= right_edge[2]): + */ + __pyx_t_34 = 0; + __pyx_t_35 = 0; + __pyx_t_6 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_35, __pyx_bstride_0_u)); + __pyx_t_3 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_34, __pyx_bstride_0_left_edge)) <= __pyx_t_6); + if (__pyx_t_3) { + __pyx_t_36 = 0; + __pyx_t_3 = (__pyx_t_6 <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_36, __pyx_bstride_0_right_edge))); + } + if (__pyx_t_3) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":297 + * # if fully enclosed + * if (left_edge[0] <= u[0] <= right_edge[0]) and \ + * (left_edge[1] <= u[1] <= right_edge[1]) and \ # <<<<<<<<<<<<<< + * (left_edge[2] <= u[2] <= right_edge[2]): + * intersect_t = 0.0 + */ + __pyx_t_37 = 1; + __pyx_t_38 = 1; + __pyx_t_6 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_38, __pyx_bstride_0_u)); + __pyx_t_18 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_37, __pyx_bstride_0_left_edge)) <= __pyx_t_6); + if (__pyx_t_18) { + __pyx_t_39 = 1; + __pyx_t_18 = (__pyx_t_6 <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_39, __pyx_bstride_0_right_edge))); + } + if (__pyx_t_18) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":298 + * if (left_edge[0] <= u[0] <= right_edge[0]) and \ + * (left_edge[1] <= u[1] <= right_edge[1]) and \ + * (left_edge[2] <= u[2] <= right_edge[2]): # <<<<<<<<<<<<<< + * intersect_t = 0.0 + * if not (0 <= intersect_t <= 1): + */ + __pyx_t_40 = 2; + __pyx_t_41 = 2; + __pyx_t_6 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_41, __pyx_bstride_0_u)); + __pyx_t_20 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_40, __pyx_bstride_0_left_edge)) <= __pyx_t_6); + if (__pyx_t_20) { + __pyx_t_42 = 2; + __pyx_t_20 = (__pyx_t_6 <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_42, __pyx_bstride_0_right_edge))); + } + __pyx_t_22 = __pyx_t_20; + } else { + __pyx_t_22 = __pyx_t_18; + } + __pyx_t_18 = __pyx_t_22; + } else { + __pyx_t_18 = __pyx_t_3; + } + if (__pyx_t_18) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":299 + * (left_edge[1] <= u[1] <= right_edge[1]) and \ + * (left_edge[2] <= u[2] <= right_edge[2]): + * intersect_t = 0.0 # <<<<<<<<<<<<<< + * if not (0 <= intersect_t <= 1): + * #print "Returning: intersect_t ==", intersect_t + */ + __pyx_v_intersect_t = 0.0; + goto __pyx_L11; + } + __pyx_L11:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":300 + * (left_edge[2] <= u[2] <= right_edge[2]): + * intersect_t = 0.0 + * if not (0 <= intersect_t <= 1): # <<<<<<<<<<<<<< + * #print "Returning: intersect_t ==", intersect_t + * return + */ + __pyx_t_18 = (0.0 <= __pyx_v_intersect_t); + if (__pyx_t_18) { + __pyx_t_18 = (__pyx_v_intersect_t <= 1.0); + } + __pyx_t_3 = (!__pyx_t_18); + if (__pyx_t_3) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":302 + * if not (0 <= intersect_t <= 1): + * #print "Returning: intersect_t ==", intersect_t + * return # <<<<<<<<<<<<<< + * # Now get the indices of the intersection + * for i in range(3): intersect[i] = u[i] + intersect_t * v[i] + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L12; + } + __pyx_L12:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":304 + * return + * # Now get the indices of the intersection + * for i in range(3): intersect[i] = u[i] + intersect_t * v[i] # <<<<<<<<<<<<<< + * cdef int ncells = 0 + * for i in range(3): + */ + for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + __pyx_t_43 = __pyx_v_i; + __pyx_t_44 = __pyx_v_i; + (__pyx_v_intersect[__pyx_v_i]) = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_43, __pyx_bstride_0_u)) + (__pyx_v_intersect_t * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_44, __pyx_bstride_0_v)))); + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":305 + * # Now get the indices of the intersection + * for i in range(3): intersect[i] = u[i] + intersect_t * v[i] + * cdef int ncells = 0 # <<<<<<<<<<<<<< + * for i in range(3): + * cur_ind[i] = np.floor((intersect[i] + 1e-8*dx[i] - left_edge[i])/dx[i]) + */ + __pyx_v_ncells = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":306 + * for i in range(3): intersect[i] = u[i] + intersect_t * v[i] + * cdef int ncells = 0 + * for i in range(3): # <<<<<<<<<<<<<< + * cur_ind[i] = np.floor((intersect[i] + 1e-8*dx[i] - left_edge[i])/dx[i]) + * tmax[i] = (((cur_ind[i]+step[i])*dx[i])+left_edge[i]-u[i])/v[i] + */ + for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":307 + * cdef int ncells = 0 + * for i in range(3): + * cur_ind[i] = np.floor((intersect[i] + 1e-8*dx[i] - left_edge[i])/dx[i]) # <<<<<<<<<<<<<< + * tmax[i] = (((cur_ind[i]+step[i])*dx[i])+left_edge[i]-u[i])/v[i] + * if cur_ind[i] == dims[i] and step[i] < 0: + */ + __pyx_t_45 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_45)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_45); + __pyx_t_46 = PyObject_GetAttr(__pyx_t_45, __pyx_n_s__floor); if (unlikely(!__pyx_t_46)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_46); + __Pyx_DECREF(__pyx_t_45); __pyx_t_45 = 0; + __pyx_t_47 = __pyx_v_i; + __pyx_t_48 = __pyx_v_i; + __pyx_t_6 = (((__pyx_v_intersect[__pyx_v_i]) + (1e-8 * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dx.buf, __pyx_t_47, __pyx_bstride_0_dx)))) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_48, __pyx_bstride_0_left_edge))); + __pyx_t_49 = __pyx_v_i; + __pyx_t_8 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dx.buf, __pyx_t_49, __pyx_bstride_0_dx)); + if (unlikely(__pyx_t_8 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_45 = PyFloat_FromDouble((__pyx_t_6 / __pyx_t_8)); if (unlikely(!__pyx_t_45)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_45); + __pyx_t_50 = PyTuple_New(1); if (unlikely(!__pyx_t_50)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_50); + PyTuple_SET_ITEM(__pyx_t_50, 0, __pyx_t_45); + __Pyx_GIVEREF(__pyx_t_45); + __pyx_t_45 = 0; + __pyx_t_45 = PyObject_Call(__pyx_t_46, __pyx_t_50, NULL); if (unlikely(!__pyx_t_45)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_45); + __Pyx_DECREF(__pyx_t_46); __pyx_t_46 = 0; + __Pyx_DECREF(__pyx_t_50); __pyx_t_50 = 0; + __pyx_t_51 = __Pyx_PyInt_from_py_npy_int64(__pyx_t_45); if (unlikely((__pyx_t_51 == (npy_int64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_45); __pyx_t_45 = 0; + (__pyx_v_cur_ind[__pyx_v_i]) = __pyx_t_51; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":308 + * for i in range(3): + * cur_ind[i] = np.floor((intersect[i] + 1e-8*dx[i] - left_edge[i])/dx[i]) + * tmax[i] = (((cur_ind[i]+step[i])*dx[i])+left_edge[i]-u[i])/v[i] # <<<<<<<<<<<<<< + * if cur_ind[i] == dims[i] and step[i] < 0: + * cur_ind[i] = dims[i] - 1 + */ + __pyx_t_52 = __pyx_v_i; + __pyx_t_53 = __pyx_v_i; + __pyx_t_54 = __pyx_v_i; + __pyx_t_8 = (((((__pyx_v_cur_ind[__pyx_v_i]) + (__pyx_v_step[__pyx_v_i])) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dx.buf, __pyx_t_52, __pyx_bstride_0_dx))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_53, __pyx_bstride_0_left_edge))) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_54, __pyx_bstride_0_u))); + __pyx_t_55 = __pyx_v_i; + __pyx_t_6 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_55, __pyx_bstride_0_v)); + if (unlikely(__pyx_t_6 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + (__pyx_v_tmax[__pyx_v_i]) = (__pyx_t_8 / __pyx_t_6); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":309 + * cur_ind[i] = np.floor((intersect[i] + 1e-8*dx[i] - left_edge[i])/dx[i]) + * tmax[i] = (((cur_ind[i]+step[i])*dx[i])+left_edge[i]-u[i])/v[i] + * if cur_ind[i] == dims[i] and step[i] < 0: # <<<<<<<<<<<<<< + * cur_ind[i] = dims[i] - 1 + * if step[i] > 0: tmax[i] = (((cur_ind[i]+1)*dx[i])+left_edge[i]-u[i])/v[i] + */ + __pyx_t_3 = ((__pyx_v_cur_ind[__pyx_v_i]) == (__pyx_v_dims[__pyx_v_i])); + if (__pyx_t_3) { + __pyx_t_18 = ((__pyx_v_step[__pyx_v_i]) < 0); + __pyx_t_22 = __pyx_t_18; + } else { + __pyx_t_22 = __pyx_t_3; + } + if (__pyx_t_22) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":310 + * tmax[i] = (((cur_ind[i]+step[i])*dx[i])+left_edge[i]-u[i])/v[i] + * if cur_ind[i] == dims[i] and step[i] < 0: + * cur_ind[i] = dims[i] - 1 # <<<<<<<<<<<<<< + * if step[i] > 0: tmax[i] = (((cur_ind[i]+1)*dx[i])+left_edge[i]-u[i])/v[i] + * if step[i] < 0: tmax[i] = (((cur_ind[i]+0)*dx[i])+left_edge[i]-u[i])/v[i] + */ + (__pyx_v_cur_ind[__pyx_v_i]) = ((__pyx_v_dims[__pyx_v_i]) - 1); + goto __pyx_L17; + } + __pyx_L17:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":311 + * if cur_ind[i] == dims[i] and step[i] < 0: + * cur_ind[i] = dims[i] - 1 + * if step[i] > 0: tmax[i] = (((cur_ind[i]+1)*dx[i])+left_edge[i]-u[i])/v[i] # <<<<<<<<<<<<<< + * if step[i] < 0: tmax[i] = (((cur_ind[i]+0)*dx[i])+left_edge[i]-u[i])/v[i] + * tdelta[i] = (dx[i]/v[i]) + */ + __pyx_t_22 = ((__pyx_v_step[__pyx_v_i]) > 0); + if (__pyx_t_22) { + __pyx_t_56 = __pyx_v_i; + __pyx_t_57 = __pyx_v_i; + __pyx_t_58 = __pyx_v_i; + __pyx_t_6 = (((((__pyx_v_cur_ind[__pyx_v_i]) + 1) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dx.buf, __pyx_t_56, __pyx_bstride_0_dx))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_57, __pyx_bstride_0_left_edge))) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_58, __pyx_bstride_0_u))); + __pyx_t_59 = __pyx_v_i; + __pyx_t_8 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_59, __pyx_bstride_0_v)); + if (unlikely(__pyx_t_8 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + (__pyx_v_tmax[__pyx_v_i]) = (__pyx_t_6 / __pyx_t_8); + goto __pyx_L18; + } + __pyx_L18:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":312 + * cur_ind[i] = dims[i] - 1 + * if step[i] > 0: tmax[i] = (((cur_ind[i]+1)*dx[i])+left_edge[i]-u[i])/v[i] + * if step[i] < 0: tmax[i] = (((cur_ind[i]+0)*dx[i])+left_edge[i]-u[i])/v[i] # <<<<<<<<<<<<<< + * tdelta[i] = (dx[i]/v[i]) + * if tdelta[i] < 0: tdelta[i] *= -1 + */ + __pyx_t_22 = ((__pyx_v_step[__pyx_v_i]) < 0); + if (__pyx_t_22) { + __pyx_t_60 = __pyx_v_i; + __pyx_t_61 = __pyx_v_i; + __pyx_t_62 = __pyx_v_i; + __pyx_t_8 = (((((__pyx_v_cur_ind[__pyx_v_i]) + 0) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dx.buf, __pyx_t_60, __pyx_bstride_0_dx))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_61, __pyx_bstride_0_left_edge))) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_62, __pyx_bstride_0_u))); + __pyx_t_63 = __pyx_v_i; + __pyx_t_6 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_63, __pyx_bstride_0_v)); + if (unlikely(__pyx_t_6 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + (__pyx_v_tmax[__pyx_v_i]) = (__pyx_t_8 / __pyx_t_6); + goto __pyx_L19; + } + __pyx_L19:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":313 + * if step[i] > 0: tmax[i] = (((cur_ind[i]+1)*dx[i])+left_edge[i]-u[i])/v[i] + * if step[i] < 0: tmax[i] = (((cur_ind[i]+0)*dx[i])+left_edge[i]-u[i])/v[i] + * tdelta[i] = (dx[i]/v[i]) # <<<<<<<<<<<<<< + * if tdelta[i] < 0: tdelta[i] *= -1 + * # The variable intersect contains the point we first pierce the grid + */ + __pyx_t_64 = __pyx_v_i; + __pyx_t_6 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dx.buf, __pyx_t_64, __pyx_bstride_0_dx)); + __pyx_t_65 = __pyx_v_i; + __pyx_t_8 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_65, __pyx_bstride_0_v)); + if (unlikely(__pyx_t_8 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + (__pyx_v_tdelta[__pyx_v_i]) = (__pyx_t_6 / __pyx_t_8); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":314 + * if step[i] < 0: tmax[i] = (((cur_ind[i]+0)*dx[i])+left_edge[i]-u[i])/v[i] + * tdelta[i] = (dx[i]/v[i]) + * if tdelta[i] < 0: tdelta[i] *= -1 # <<<<<<<<<<<<<< + * # The variable intersect contains the point we first pierce the grid + * enter_t = intersect_t + */ + __pyx_t_22 = ((__pyx_v_tdelta[__pyx_v_i]) < 0.0); + if (__pyx_t_22) { + (__pyx_v_tdelta[__pyx_v_i]) *= -1.0; + goto __pyx_L20; + } + __pyx_L20:; + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":316 + * if tdelta[i] < 0: tdelta[i] *= -1 + * # The variable intersect contains the point we first pierce the grid + * enter_t = intersect_t # <<<<<<<<<<<<<< + * if (not (0 <= cur_ind[0] < dims[0])) or \ + * (not (0 <= cur_ind[1] < dims[1])) or \ + */ + __pyx_v_enter_t = __pyx_v_intersect_t; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":317 + * # The variable intersect contains the point we first pierce the grid + * enter_t = intersect_t + * if (not (0 <= cur_ind[0] < dims[0])) or \ # <<<<<<<<<<<<<< + * (not (0 <= cur_ind[1] < dims[1])) or \ + * (not (0 <= cur_ind[2] < dims[2])): + */ + __pyx_t_51 = (__pyx_v_cur_ind[0]); + __pyx_t_22 = (0 <= __pyx_t_51); + if (__pyx_t_22) { + __pyx_t_22 = (__pyx_t_51 < (__pyx_v_dims[0])); + } + __pyx_t_3 = (!__pyx_t_22); + if (!__pyx_t_3) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":318 + * enter_t = intersect_t + * if (not (0 <= cur_ind[0] < dims[0])) or \ + * (not (0 <= cur_ind[1] < dims[1])) or \ # <<<<<<<<<<<<<< + * (not (0 <= cur_ind[2] < dims[2])): + * #print "Returning: cur_ind", cur_ind[0], cur_ind[1], cur_ind[2] + */ + __pyx_t_51 = (__pyx_v_cur_ind[1]); + __pyx_t_22 = (0 <= __pyx_t_51); + if (__pyx_t_22) { + __pyx_t_22 = (__pyx_t_51 < (__pyx_v_dims[1])); + } + __pyx_t_18 = (!__pyx_t_22); + if (!__pyx_t_18) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":319 + * if (not (0 <= cur_ind[0] < dims[0])) or \ + * (not (0 <= cur_ind[1] < dims[1])) or \ + * (not (0 <= cur_ind[2] < dims[2])): # <<<<<<<<<<<<<< + * #print "Returning: cur_ind", cur_ind[0], cur_ind[1], cur_ind[2] + * #print " dims: ", dims[0], dims[1], dims[2] + */ + __pyx_t_51 = (__pyx_v_cur_ind[2]); + __pyx_t_22 = (0 <= __pyx_t_51); + if (__pyx_t_22) { + __pyx_t_22 = (__pyx_t_51 < (__pyx_v_dims[2])); + } + __pyx_t_20 = (!__pyx_t_22); + __pyx_t_22 = __pyx_t_20; + } else { + __pyx_t_22 = __pyx_t_18; + } + __pyx_t_18 = __pyx_t_22; + } else { + __pyx_t_18 = __pyx_t_3; + } + if (__pyx_t_18) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":326 + * #print " u :", u[0], u[1], u[2] + * # + * return # <<<<<<<<<<<<<< + * #print cur_ind[0], dims[0], cur_ind[1], dims[1], cur_ind[2], dims[2] + * dv = data[cur_ind[0], cur_ind[1], cur_ind[2]] + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L21; + } + __pyx_L21:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":328 + * return + * #print cur_ind[0], dims[0], cur_ind[1], dims[1], cur_ind[2], dims[2] + * dv = data[cur_ind[0], cur_ind[1], cur_ind[2]] # <<<<<<<<<<<<<< + * #dt = 1e300 + * while 1: + */ + __pyx_t_51 = (__pyx_v_cur_ind[0]); + __pyx_t_66 = (__pyx_v_cur_ind[1]); + __pyx_t_67 = (__pyx_v_cur_ind[2]); + __pyx_v_dv = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_data.buf, __pyx_t_51, __pyx_bstride_0_data, __pyx_t_66, __pyx_bstride_1_data, __pyx_t_67, __pyx_bstride_2_data)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":330 + * dv = data[cur_ind[0], cur_ind[1], cur_ind[2]] + * #dt = 1e300 + * while 1: # <<<<<<<<<<<<<< + * if image[ind,3] >= 1.0: break + * if (not (0 <= cur_ind[0] < dims[0])) or \ + */ + while (1) { + if (!1) break; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":331 + * #dt = 1e300 + * while 1: + * if image[ind,3] >= 1.0: break # <<<<<<<<<<<<<< + * if (not (0 <= cur_ind[0] < dims[0])) or \ + * (not (0 <= cur_ind[1] < dims[1])) or \ + */ + __pyx_t_1 = __pyx_v_ind; + __pyx_t_68 = 3; + __pyx_t_18 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_image.buf, __pyx_t_1, __pyx_bstride_0_image, __pyx_t_68, __pyx_bstride_1_image)) >= 1.0); + if (__pyx_t_18) { + goto __pyx_L23_break; + goto __pyx_L24; + } + __pyx_L24:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":332 + * while 1: + * if image[ind,3] >= 1.0: break + * if (not (0 <= cur_ind[0] < dims[0])) or \ # <<<<<<<<<<<<<< + * (not (0 <= cur_ind[1] < dims[1])) or \ + * (not (0 <= cur_ind[2] < dims[2])): + */ + __pyx_t_69 = (__pyx_v_cur_ind[0]); + __pyx_t_18 = (0 <= __pyx_t_69); + if (__pyx_t_18) { + __pyx_t_18 = (__pyx_t_69 < (__pyx_v_dims[0])); + } + __pyx_t_3 = (!__pyx_t_18); + if (!__pyx_t_3) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":333 + * if image[ind,3] >= 1.0: break + * if (not (0 <= cur_ind[0] < dims[0])) or \ + * (not (0 <= cur_ind[1] < dims[1])) or \ # <<<<<<<<<<<<<< + * (not (0 <= cur_ind[2] < dims[2])): + * break + */ + __pyx_t_69 = (__pyx_v_cur_ind[1]); + __pyx_t_18 = (0 <= __pyx_t_69); + if (__pyx_t_18) { + __pyx_t_18 = (__pyx_t_69 < (__pyx_v_dims[1])); + } + __pyx_t_22 = (!__pyx_t_18); + if (!__pyx_t_22) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":334 + * if (not (0 <= cur_ind[0] < dims[0])) or \ + * (not (0 <= cur_ind[1] < dims[1])) or \ + * (not (0 <= cur_ind[2] < dims[2])): # <<<<<<<<<<<<<< + * break + * # Do our transfer here + */ + __pyx_t_69 = (__pyx_v_cur_ind[2]); + __pyx_t_18 = (0 <= __pyx_t_69); + if (__pyx_t_18) { + __pyx_t_18 = (__pyx_t_69 < (__pyx_v_dims[2])); + } + __pyx_t_20 = (!__pyx_t_18); + __pyx_t_18 = __pyx_t_20; + } else { + __pyx_t_18 = __pyx_t_22; + } + __pyx_t_22 = __pyx_t_18; + } else { + __pyx_t_22 = __pyx_t_3; + } + if (__pyx_t_22) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":335 + * (not (0 <= cur_ind[1] < dims[1])) or \ + * (not (0 <= cur_ind[2] < dims[2])): + * break # <<<<<<<<<<<<<< + * # Do our transfer here + * for n in range(nshells): + */ + goto __pyx_L23_break; + goto __pyx_L25; + } + __pyx_L25:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":337 + * break + * # Do our transfer here + * for n in range(nshells): # <<<<<<<<<<<<<< + * dist = shells[n, 0] - dv + * if dist < shells[n,1]: + */ + __pyx_t_70 = __pyx_v_nshells; + for (__pyx_t_71 = 0; __pyx_t_71 < __pyx_t_70; __pyx_t_71+=1) { + __pyx_v_n = __pyx_t_71; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":338 + * # Do our transfer here + * for n in range(nshells): + * dist = shells[n, 0] - dv # <<<<<<<<<<<<<< + * if dist < shells[n,1]: + * dist = exp(-dist/8.0) + */ + __pyx_t_72 = __pyx_v_n; + __pyx_t_73 = 0; + __pyx_v_dist = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_shells.buf, __pyx_t_72, __pyx_bstride_0_shells, __pyx_t_73, __pyx_bstride_1_shells)) - __pyx_v_dv); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":339 + * for n in range(nshells): + * dist = shells[n, 0] - dv + * if dist < shells[n,1]: # <<<<<<<<<<<<<< + * dist = exp(-dist/8.0) + * alpha = (1.0 - shells[n,5])*shells[n,5]#*dt + */ + __pyx_t_74 = __pyx_v_n; + __pyx_t_75 = 1; + __pyx_t_22 = (__pyx_v_dist < (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_shells.buf, __pyx_t_74, __pyx_bstride_0_shells, __pyx_t_75, __pyx_bstride_1_shells))); + if (__pyx_t_22) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":340 + * dist = shells[n, 0] - dv + * if dist < shells[n,1]: + * dist = exp(-dist/8.0) # <<<<<<<<<<<<<< + * alpha = (1.0 - shells[n,5])*shells[n,5]#*dt + * image[ind,0] += alpha*shells[n,2]*dist + */ + __pyx_v_dist = exp(((-__pyx_v_dist) / 8.0)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":341 + * if dist < shells[n,1]: + * dist = exp(-dist/8.0) + * alpha = (1.0 - shells[n,5])*shells[n,5]#*dt # <<<<<<<<<<<<<< + * image[ind,0] += alpha*shells[n,2]*dist + * image[ind,1] += alpha*shells[n,3]*dist + */ + __pyx_t_76 = __pyx_v_n; + __pyx_t_77 = 5; + __pyx_t_78 = __pyx_v_n; + __pyx_t_79 = 5; + __pyx_v_alpha = ((1.0 - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_shells.buf, __pyx_t_76, __pyx_bstride_0_shells, __pyx_t_77, __pyx_bstride_1_shells))) * (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_shells.buf, __pyx_t_78, __pyx_bstride_0_shells, __pyx_t_79, __pyx_bstride_1_shells))); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":342 + * dist = exp(-dist/8.0) + * alpha = (1.0 - shells[n,5])*shells[n,5]#*dt + * image[ind,0] += alpha*shells[n,2]*dist # <<<<<<<<<<<<<< + * image[ind,1] += alpha*shells[n,3]*dist + * image[ind,2] += alpha*shells[n,4]*dist + */ + __pyx_t_80 = __pyx_v_n; + __pyx_t_81 = 2; + __pyx_t_82 = __pyx_v_ind; + __pyx_t_83 = 0; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_image.buf, __pyx_t_82, __pyx_bstride_0_image, __pyx_t_83, __pyx_bstride_1_image) += ((__pyx_v_alpha * (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_shells.buf, __pyx_t_80, __pyx_bstride_0_shells, __pyx_t_81, __pyx_bstride_1_shells))) * __pyx_v_dist); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":343 + * alpha = (1.0 - shells[n,5])*shells[n,5]#*dt + * image[ind,0] += alpha*shells[n,2]*dist + * image[ind,1] += alpha*shells[n,3]*dist # <<<<<<<<<<<<<< + * image[ind,2] += alpha*shells[n,4]*dist + * image[ind,3] += alpha*shells[n,5]*dist + */ + __pyx_t_84 = __pyx_v_n; + __pyx_t_85 = 3; + __pyx_t_86 = __pyx_v_ind; + __pyx_t_87 = 1; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_image.buf, __pyx_t_86, __pyx_bstride_0_image, __pyx_t_87, __pyx_bstride_1_image) += ((__pyx_v_alpha * (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_shells.buf, __pyx_t_84, __pyx_bstride_0_shells, __pyx_t_85, __pyx_bstride_1_shells))) * __pyx_v_dist); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":344 + * image[ind,0] += alpha*shells[n,2]*dist + * image[ind,1] += alpha*shells[n,3]*dist + * image[ind,2] += alpha*shells[n,4]*dist # <<<<<<<<<<<<<< + * image[ind,3] += alpha*shells[n,5]*dist + * #image[ind,i] += rgba[i]*dist*rgba[3]/dt + */ + __pyx_t_88 = __pyx_v_n; + __pyx_t_89 = 4; + __pyx_t_90 = __pyx_v_ind; + __pyx_t_91 = 2; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_image.buf, __pyx_t_90, __pyx_bstride_0_image, __pyx_t_91, __pyx_bstride_1_image) += ((__pyx_v_alpha * (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_shells.buf, __pyx_t_88, __pyx_bstride_0_shells, __pyx_t_89, __pyx_bstride_1_shells))) * __pyx_v_dist); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":345 + * image[ind,1] += alpha*shells[n,3]*dist + * image[ind,2] += alpha*shells[n,4]*dist + * image[ind,3] += alpha*shells[n,5]*dist # <<<<<<<<<<<<<< + * #image[ind,i] += rgba[i]*dist*rgba[3]/dt + * #print rgba[i], image[ind,i], dist, dt + */ + __pyx_t_92 = __pyx_v_n; + __pyx_t_93 = 5; + __pyx_t_94 = __pyx_v_ind; + __pyx_t_95 = 3; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_image.buf, __pyx_t_94, __pyx_bstride_0_image, __pyx_t_95, __pyx_bstride_1_image) += ((__pyx_v_alpha * (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_shells.buf, __pyx_t_92, __pyx_bstride_0_shells, __pyx_t_93, __pyx_bstride_1_shells))) * __pyx_v_dist); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":348 + * #image[ind,i] += rgba[i]*dist*rgba[3]/dt + * #print rgba[i], image[ind,i], dist, dt + * break # <<<<<<<<<<<<<< + * if (tmax[0] > 1.0) and (tmax[1] > 1.0) and (tmax[2] > 1.0): + * dt = 1.0 - enter_t + */ + goto __pyx_L27_break; + goto __pyx_L28; + } + __pyx_L28:; + } + __pyx_L27_break:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":349 + * #print rgba[i], image[ind,i], dist, dt + * break + * if (tmax[0] > 1.0) and (tmax[1] > 1.0) and (tmax[2] > 1.0): # <<<<<<<<<<<<<< + * dt = 1.0 - enter_t + * break + */ + __pyx_t_22 = ((__pyx_v_tmax[0]) > 1.0); + if (__pyx_t_22) { + __pyx_t_3 = ((__pyx_v_tmax[1]) > 1.0); + if (__pyx_t_3) { + __pyx_t_18 = ((__pyx_v_tmax[2]) > 1.0); + __pyx_t_20 = __pyx_t_18; + } else { + __pyx_t_20 = __pyx_t_3; + } + __pyx_t_3 = __pyx_t_20; + } else { + __pyx_t_3 = __pyx_t_22; + } + if (__pyx_t_3) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":350 + * break + * if (tmax[0] > 1.0) and (tmax[1] > 1.0) and (tmax[2] > 1.0): + * dt = 1.0 - enter_t # <<<<<<<<<<<<<< + * break + * if tmax[0] < tmax[1]: + */ + __pyx_v_dt = (1.0 - __pyx_v_enter_t); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":351 + * if (tmax[0] > 1.0) and (tmax[1] > 1.0) and (tmax[2] > 1.0): + * dt = 1.0 - enter_t + * break # <<<<<<<<<<<<<< + * if tmax[0] < tmax[1]: + * if tmax[0] < tmax[2]: + */ + goto __pyx_L23_break; + goto __pyx_L29; + } + __pyx_L29:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":352 + * dt = 1.0 - enter_t + * break + * if tmax[0] < tmax[1]: # <<<<<<<<<<<<<< + * if tmax[0] < tmax[2]: + * dt = tmax[0] - enter_t + */ + __pyx_t_3 = ((__pyx_v_tmax[0]) < (__pyx_v_tmax[1])); + if (__pyx_t_3) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":353 + * break + * if tmax[0] < tmax[1]: + * if tmax[0] < tmax[2]: # <<<<<<<<<<<<<< + * dt = tmax[0] - enter_t + * enter_t = tmax[0] + */ + __pyx_t_3 = ((__pyx_v_tmax[0]) < (__pyx_v_tmax[2])); + if (__pyx_t_3) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":354 + * if tmax[0] < tmax[1]: + * if tmax[0] < tmax[2]: + * dt = tmax[0] - enter_t # <<<<<<<<<<<<<< + * enter_t = tmax[0] + * tmax[0] += tdelta[0] + */ + __pyx_v_dt = ((__pyx_v_tmax[0]) - __pyx_v_enter_t); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":355 + * if tmax[0] < tmax[2]: + * dt = tmax[0] - enter_t + * enter_t = tmax[0] # <<<<<<<<<<<<<< + * tmax[0] += tdelta[0] + * cur_ind[0] += step[0] + */ + __pyx_v_enter_t = (__pyx_v_tmax[0]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":356 + * dt = tmax[0] - enter_t + * enter_t = tmax[0] + * tmax[0] += tdelta[0] # <<<<<<<<<<<<<< + * cur_ind[0] += step[0] + * else: + */ + (__pyx_v_tmax[0]) += (__pyx_v_tdelta[0]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":357 + * enter_t = tmax[0] + * tmax[0] += tdelta[0] + * cur_ind[0] += step[0] # <<<<<<<<<<<<<< + * else: + * dt = tmax[2] - enter_t + */ + (__pyx_v_cur_ind[0]) += (__pyx_v_step[0]); + goto __pyx_L31; + } + /*else*/ { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":359 + * cur_ind[0] += step[0] + * else: + * dt = tmax[2] - enter_t # <<<<<<<<<<<<<< + * enter_t = tmax[2] + * tmax[2] += tdelta[2] + */ + __pyx_v_dt = ((__pyx_v_tmax[2]) - __pyx_v_enter_t); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":360 + * else: + * dt = tmax[2] - enter_t + * enter_t = tmax[2] # <<<<<<<<<<<<<< + * tmax[2] += tdelta[2] + * cur_ind[2] += step[2] + */ + __pyx_v_enter_t = (__pyx_v_tmax[2]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":361 + * dt = tmax[2] - enter_t + * enter_t = tmax[2] + * tmax[2] += tdelta[2] # <<<<<<<<<<<<<< + * cur_ind[2] += step[2] + * else: + */ + (__pyx_v_tmax[2]) += (__pyx_v_tdelta[2]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":362 + * enter_t = tmax[2] + * tmax[2] += tdelta[2] + * cur_ind[2] += step[2] # <<<<<<<<<<<<<< + * else: + * if tmax[1] < tmax[2]: + */ + (__pyx_v_cur_ind[2]) += (__pyx_v_step[2]); + } + __pyx_L31:; + goto __pyx_L30; + } + /*else*/ { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":364 + * cur_ind[2] += step[2] + * else: + * if tmax[1] < tmax[2]: # <<<<<<<<<<<<<< + * dt = tmax[1] - enter_t + * enter_t = tmax[1] + */ + __pyx_t_3 = ((__pyx_v_tmax[1]) < (__pyx_v_tmax[2])); + if (__pyx_t_3) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":365 + * else: + * if tmax[1] < tmax[2]: + * dt = tmax[1] - enter_t # <<<<<<<<<<<<<< + * enter_t = tmax[1] + * tmax[1] += tdelta[1] + */ + __pyx_v_dt = ((__pyx_v_tmax[1]) - __pyx_v_enter_t); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":366 + * if tmax[1] < tmax[2]: + * dt = tmax[1] - enter_t + * enter_t = tmax[1] # <<<<<<<<<<<<<< + * tmax[1] += tdelta[1] + * cur_ind[1] += step[1] + */ + __pyx_v_enter_t = (__pyx_v_tmax[1]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":367 + * dt = tmax[1] - enter_t + * enter_t = tmax[1] + * tmax[1] += tdelta[1] # <<<<<<<<<<<<<< + * cur_ind[1] += step[1] + * else: + */ + (__pyx_v_tmax[1]) += (__pyx_v_tdelta[1]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":368 + * enter_t = tmax[1] + * tmax[1] += tdelta[1] + * cur_ind[1] += step[1] # <<<<<<<<<<<<<< + * else: + * dt = tmax[2] - enter_t + */ + (__pyx_v_cur_ind[1]) += (__pyx_v_step[1]); + goto __pyx_L32; + } + /*else*/ { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":370 + * cur_ind[1] += step[1] + * else: + * dt = tmax[2] - enter_t # <<<<<<<<<<<<<< + * enter_t = tmax[2] + * tmax[2] += tdelta[2] + */ + __pyx_v_dt = ((__pyx_v_tmax[2]) - __pyx_v_enter_t); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":371 + * else: + * dt = tmax[2] - enter_t + * enter_t = tmax[2] # <<<<<<<<<<<<<< + * tmax[2] += tdelta[2] + * cur_ind[2] += step[2] + */ + __pyx_v_enter_t = (__pyx_v_tmax[2]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":372 + * dt = tmax[2] - enter_t + * enter_t = tmax[2] + * tmax[2] += tdelta[2] # <<<<<<<<<<<<<< + * cur_ind[2] += step[2] + * dv = data[cur_ind[0], cur_ind[1], cur_ind[2]] + */ + (__pyx_v_tmax[2]) += (__pyx_v_tdelta[2]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":373 + * enter_t = tmax[2] + * tmax[2] += tdelta[2] + * cur_ind[2] += step[2] # <<<<<<<<<<<<<< + * dv = data[cur_ind[0], cur_ind[1], cur_ind[2]] + */ + (__pyx_v_cur_ind[2]) += (__pyx_v_step[2]); + } + __pyx_L32:; + } + __pyx_L30:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":374 + * tmax[2] += tdelta[2] + * cur_ind[2] += step[2] + * dv = data[cur_ind[0], cur_ind[1], cur_ind[2]] # <<<<<<<<<<<<<< + */ + __pyx_t_69 = (__pyx_v_cur_ind[0]); + __pyx_t_96 = (__pyx_v_cur_ind[1]); + __pyx_t_97 = (__pyx_v_cur_ind[2]); + __pyx_v_dv = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_data.buf, __pyx_t_69, __pyx_bstride_0_data, __pyx_t_96, __pyx_bstride_1_data, __pyx_t_97, __pyx_bstride_2_data)); + } + __pyx_L23_break:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_45); + __Pyx_XDECREF(__pyx_t_46); + __Pyx_XDECREF(__pyx_t_50); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_image); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_shells); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_right_edge); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edge); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dx); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_u); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_v); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.amr_utils.integrate_ray"); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_image); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_shells); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_right_edge); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edge); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dx); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_data); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_u); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_v); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":31 + * from stdlib cimport malloc, free, abs + * + * cdef inline int imax(int i0, int i1): # <<<<<<<<<<<<<< + * if i0 > i1: return i0 + * return i1 + */ + +static CYTHON_INLINE int __pyx_f_2yt_9amr_utils_imax(int __pyx_v_i0, int __pyx_v_i1) { + int __pyx_r; + int __pyx_t_1; + __Pyx_RefNannySetupContext("imax"); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":32 + * + * cdef inline int imax(int i0, int i1): + * if i0 > i1: return i0 # <<<<<<<<<<<<<< + * return i1 + * + */ + __pyx_t_1 = (__pyx_v_i0 > __pyx_v_i1); + if (__pyx_t_1) { + __pyx_r = __pyx_v_i0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":33 + * cdef inline int imax(int i0, int i1): + * if i0 > i1: return i0 + * return i1 # <<<<<<<<<<<<<< + * + * cdef inline np.float64_t fmax(np.float64_t f0, np.float64_t f1): + */ + __pyx_r = __pyx_v_i1; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":35 + * return i1 + * + * cdef inline np.float64_t fmax(np.float64_t f0, np.float64_t f1): # <<<<<<<<<<<<<< + * if f0 > f1: return f0 + * return f1 + */ + +static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9amr_utils_fmax(__pyx_t_5numpy_float64_t __pyx_v_f0, __pyx_t_5numpy_float64_t __pyx_v_f1) { + __pyx_t_5numpy_float64_t __pyx_r; + int __pyx_t_1; + __Pyx_RefNannySetupContext("fmax"); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":36 + * + * cdef inline np.float64_t fmax(np.float64_t f0, np.float64_t f1): + * if f0 > f1: return f0 # <<<<<<<<<<<<<< + * return f1 + * + */ + __pyx_t_1 = (__pyx_v_f0 > __pyx_v_f1); + if (__pyx_t_1) { + __pyx_r = __pyx_v_f0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":37 + * cdef inline np.float64_t fmax(np.float64_t f0, np.float64_t f1): + * if f0 > f1: return f0 + * return f1 # <<<<<<<<<<<<<< + * + * cdef inline int imin(int i0, int i1): + */ + __pyx_r = __pyx_v_f1; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":39 + * return f1 + * + * cdef inline int imin(int i0, int i1): # <<<<<<<<<<<<<< + * if i0 < i1: return i0 + * return i1 + */ + +static CYTHON_INLINE int __pyx_f_2yt_9amr_utils_imin(int __pyx_v_i0, int __pyx_v_i1) { + int __pyx_r; + int __pyx_t_1; + __Pyx_RefNannySetupContext("imin"); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":40 + * + * cdef inline int imin(int i0, int i1): + * if i0 < i1: return i0 # <<<<<<<<<<<<<< + * return i1 + * + */ + __pyx_t_1 = (__pyx_v_i0 < __pyx_v_i1); + if (__pyx_t_1) { + __pyx_r = __pyx_v_i0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":41 + * cdef inline int imin(int i0, int i1): + * if i0 < i1: return i0 + * return i1 # <<<<<<<<<<<<<< + * + * cdef inline np.float64_t fmin(np.float64_t f0, np.float64_t f1): + */ + __pyx_r = __pyx_v_i1; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":43 + * return i1 + * + * cdef inline np.float64_t fmin(np.float64_t f0, np.float64_t f1): # <<<<<<<<<<<<<< + * if f0 < f1: return f0 + * return f1 + */ + +static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9amr_utils_fmin(__pyx_t_5numpy_float64_t __pyx_v_f0, __pyx_t_5numpy_float64_t __pyx_v_f1) { + __pyx_t_5numpy_float64_t __pyx_r; + int __pyx_t_1; + __Pyx_RefNannySetupContext("fmin"); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":44 + * + * cdef inline np.float64_t fmin(np.float64_t f0, np.float64_t f1): + * if f0 < f1: return f0 # <<<<<<<<<<<<<< + * return f1 + * + */ + __pyx_t_1 = (__pyx_v_f0 < __pyx_v_f1); + if (__pyx_t_1) { + __pyx_r = __pyx_v_f0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":45 + * cdef inline np.float64_t fmin(np.float64_t f0, np.float64_t f1): + * if f0 < f1: return f0 + * return f1 # <<<<<<<<<<<<<< + * + * cdef inline int iclip(int i, int a, int b): + */ + __pyx_r = __pyx_v_f1; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":47 + * return f1 + * + * cdef inline int iclip(int i, int a, int b): # <<<<<<<<<<<<<< + * if i < a: return a + * if i > b: return b + */ + +static CYTHON_INLINE int __pyx_f_2yt_9amr_utils_iclip(int __pyx_v_i, int __pyx_v_a, int __pyx_v_b) { + int __pyx_r; + int __pyx_t_1; + __Pyx_RefNannySetupContext("iclip"); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":48 + * + * cdef inline int iclip(int i, int a, int b): + * if i < a: return a # <<<<<<<<<<<<<< + * if i > b: return b + * return i + */ + __pyx_t_1 = (__pyx_v_i < __pyx_v_a); + if (__pyx_t_1) { + __pyx_r = __pyx_v_a; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":49 + * cdef inline int iclip(int i, int a, int b): + * if i < a: return a + * if i > b: return b # <<<<<<<<<<<<<< + * return i + * + */ + __pyx_t_1 = (__pyx_v_i > __pyx_v_b); + if (__pyx_t_1) { + __pyx_r = __pyx_v_b; + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":50 + * if i < a: return a + * if i > b: return b + * return i # <<<<<<<<<<<<<< + * + * cdef inline np.float64_t fclip(np.float64_t f, + */ + __pyx_r = __pyx_v_i; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":52 + * return i + * + * cdef inline np.float64_t fclip(np.float64_t f, # <<<<<<<<<<<<<< + * np.float64_t a, np.float64_t b): + * return fmin(fmax(f, a), b) + */ + +static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9amr_utils_fclip(__pyx_t_5numpy_float64_t __pyx_v_f, __pyx_t_5numpy_float64_t __pyx_v_a, __pyx_t_5numpy_float64_t __pyx_v_b) { + __pyx_t_5numpy_float64_t __pyx_r; + __Pyx_RefNannySetupContext("fclip"); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":54 + * cdef inline np.float64_t fclip(np.float64_t f, + * np.float64_t a, np.float64_t b): + * return fmin(fmax(f, a), b) # <<<<<<<<<<<<<< + * + * cdef extern from "math.h": + */ + __pyx_r = __pyx_f_2yt_9amr_utils_fmin(__pyx_f_2yt_9amr_utils_fmax(__pyx_v_f, __pyx_v_a), __pyx_v_b); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":89 + * int pass_through + * + * cdef void FIT_initialize_table(FieldInterpolationTable *fit, int nbins, # <<<<<<<<<<<<<< + * np.float64_t *values, np.float64_t bounds1, np.float64_t bounds2, + * int field_id, int weight_field_id = -1, int weight_table_id = -1, + */ + +static void __pyx_f_2yt_9amr_utils_FIT_initialize_table(struct __pyx_t_2yt_9amr_utils_FieldInterpolationTable *__pyx_v_fit, int __pyx_v_nbins, __pyx_t_5numpy_float64_t *__pyx_v_values, __pyx_t_5numpy_float64_t __pyx_v_bounds1, __pyx_t_5numpy_float64_t __pyx_v_bounds2, int __pyx_v_field_id, struct __pyx_opt_args_2yt_9amr_utils_FIT_initialize_table *__pyx_optional_args) { + int __pyx_v_weight_field_id = ((int)-1); + int __pyx_v_weight_table_id = ((int)-1); + int __pyx_v_pass_through = ((int)0); + __pyx_t_5numpy_float64_t __pyx_t_1; + __Pyx_RefNannySetupContext("FIT_initialize_table"); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_weight_field_id = __pyx_optional_args->weight_field_id; + if (__pyx_optional_args->__pyx_n > 1) { + __pyx_v_weight_table_id = __pyx_optional_args->weight_table_id; + if (__pyx_optional_args->__pyx_n > 2) { + __pyx_v_pass_through = __pyx_optional_args->pass_through; + } + } + } + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":93 + * int field_id, int weight_field_id = -1, int weight_table_id = -1, + * int pass_through = 0): + * fit.bounds[0] = bounds1; fit.bounds[1] = bounds2 # <<<<<<<<<<<<<< + * fit.nbins = nbins + * fit.dbin = (fit.bounds[1] - fit.bounds[0])/fit.nbins + */ + (__pyx_v_fit->bounds[0]) = __pyx_v_bounds1; + (__pyx_v_fit->bounds[1]) = __pyx_v_bounds2; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":94 + * int pass_through = 0): + * fit.bounds[0] = bounds1; fit.bounds[1] = bounds2 + * fit.nbins = nbins # <<<<<<<<<<<<<< + * fit.dbin = (fit.bounds[1] - fit.bounds[0])/fit.nbins + * fit.idbin = 1.0/fit.dbin + */ + __pyx_v_fit->nbins = __pyx_v_nbins; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":95 + * fit.bounds[0] = bounds1; fit.bounds[1] = bounds2 + * fit.nbins = nbins + * fit.dbin = (fit.bounds[1] - fit.bounds[0])/fit.nbins # <<<<<<<<<<<<<< + * fit.idbin = 1.0/fit.dbin + * # Better not pull this out from under us, yo + */ + __pyx_t_1 = ((__pyx_v_fit->bounds[1]) - (__pyx_v_fit->bounds[0])); + if (unlikely(__pyx_v_fit->nbins == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_fit->dbin = (__pyx_t_1 / __pyx_v_fit->nbins); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":96 + * fit.nbins = nbins + * fit.dbin = (fit.bounds[1] - fit.bounds[0])/fit.nbins + * fit.idbin = 1.0/fit.dbin # <<<<<<<<<<<<<< + * # Better not pull this out from under us, yo + * fit.values = values + */ + if (unlikely(__pyx_v_fit->dbin == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_fit->idbin = (1.0 / __pyx_v_fit->dbin); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":98 + * fit.idbin = 1.0/fit.dbin + * # Better not pull this out from under us, yo + * fit.values = values # <<<<<<<<<<<<<< + * fit.field_id = field_id + * fit.weight_field_id = weight_field_id + */ + __pyx_v_fit->values = __pyx_v_values; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":99 + * # Better not pull this out from under us, yo + * fit.values = values + * fit.field_id = field_id # <<<<<<<<<<<<<< + * fit.weight_field_id = weight_field_id + * fit.weight_table_id = weight_table_id + */ + __pyx_v_fit->field_id = __pyx_v_field_id; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":100 + * fit.values = values + * fit.field_id = field_id + * fit.weight_field_id = weight_field_id # <<<<<<<<<<<<<< + * fit.weight_table_id = weight_table_id + * fit.pass_through = pass_through + */ + __pyx_v_fit->weight_field_id = __pyx_v_weight_field_id; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":101 + * fit.field_id = field_id + * fit.weight_field_id = weight_field_id + * fit.weight_table_id = weight_table_id # <<<<<<<<<<<<<< + * fit.pass_through = pass_through + * + */ + __pyx_v_fit->weight_table_id = __pyx_v_weight_table_id; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":102 + * fit.weight_field_id = weight_field_id + * fit.weight_table_id = weight_table_id + * fit.pass_through = pass_through # <<<<<<<<<<<<<< + * + * cdef np.float64_t FIT_get_value(FieldInterpolationTable *fit, + */ + __pyx_v_fit->pass_through = __pyx_v_pass_through; + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_WriteUnraisable("yt.amr_utils.FIT_initialize_table"); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":104 + * fit.pass_through = pass_through + * + * cdef np.float64_t FIT_get_value(FieldInterpolationTable *fit, # <<<<<<<<<<<<<< + * np.float64_t *dvs): + * cdef np.float64_t bv, dy, dd, tf + */ + +static __pyx_t_5numpy_float64_t __pyx_f_2yt_9amr_utils_FIT_get_value(struct __pyx_t_2yt_9amr_utils_FieldInterpolationTable *__pyx_v_fit, __pyx_t_5numpy_float64_t *__pyx_v_dvs) { + __pyx_t_5numpy_float64_t __pyx_v_bv; + __pyx_t_5numpy_float64_t __pyx_v_dy; + __pyx_t_5numpy_float64_t __pyx_v_dd; + int __pyx_v_bin_id; + __pyx_t_5numpy_float64_t __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + __Pyx_RefNannySetupContext("FIT_get_value"); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":108 + * cdef np.float64_t bv, dy, dd, tf + * cdef int bin_id + * if fit.pass_through == 1: return dvs[fit.field_id] # <<<<<<<<<<<<<< + * if dvs[fit.field_id] > fit.bounds[1] or dvs[fit.field_id] < fit.bounds[0]: return 0.0 + * bin_id = ((dvs[fit.field_id] - fit.bounds[0]) * fit.idbin) + */ + __pyx_t_1 = (__pyx_v_fit->pass_through == 1); + if (__pyx_t_1) { + __pyx_r = (__pyx_v_dvs[__pyx_v_fit->field_id]); + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":109 + * cdef int bin_id + * if fit.pass_through == 1: return dvs[fit.field_id] + * if dvs[fit.field_id] > fit.bounds[1] or dvs[fit.field_id] < fit.bounds[0]: return 0.0 # <<<<<<<<<<<<<< + * bin_id = ((dvs[fit.field_id] - fit.bounds[0]) * fit.idbin) + * dd = dvs[fit.field_id] - (fit.bounds[0] + bin_id * fit.dbin) # x - x0 + */ + __pyx_t_1 = ((__pyx_v_dvs[__pyx_v_fit->field_id]) > (__pyx_v_fit->bounds[1])); + if (!__pyx_t_1) { + __pyx_t_2 = ((__pyx_v_dvs[__pyx_v_fit->field_id]) < (__pyx_v_fit->bounds[0])); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + __pyx_r = 0.0; + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":110 + * if fit.pass_through == 1: return dvs[fit.field_id] + * if dvs[fit.field_id] > fit.bounds[1] or dvs[fit.field_id] < fit.bounds[0]: return 0.0 + * bin_id = ((dvs[fit.field_id] - fit.bounds[0]) * fit.idbin) # <<<<<<<<<<<<<< + * dd = dvs[fit.field_id] - (fit.bounds[0] + bin_id * fit.dbin) # x - x0 + * bv = fit.values[bin_id] + */ + __pyx_v_bin_id = ((int)(((__pyx_v_dvs[__pyx_v_fit->field_id]) - (__pyx_v_fit->bounds[0])) * __pyx_v_fit->idbin)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":111 + * if dvs[fit.field_id] > fit.bounds[1] or dvs[fit.field_id] < fit.bounds[0]: return 0.0 + * bin_id = ((dvs[fit.field_id] - fit.bounds[0]) * fit.idbin) + * dd = dvs[fit.field_id] - (fit.bounds[0] + bin_id * fit.dbin) # x - x0 # <<<<<<<<<<<<<< + * bv = fit.values[bin_id] + * dy = fit.values[bin_id + 1] - bv + */ + __pyx_v_dd = ((__pyx_v_dvs[__pyx_v_fit->field_id]) - ((__pyx_v_fit->bounds[0]) + (__pyx_v_bin_id * __pyx_v_fit->dbin))); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":112 + * bin_id = ((dvs[fit.field_id] - fit.bounds[0]) * fit.idbin) + * dd = dvs[fit.field_id] - (fit.bounds[0] + bin_id * fit.dbin) # x - x0 + * bv = fit.values[bin_id] # <<<<<<<<<<<<<< + * dy = fit.values[bin_id + 1] - bv + * if fit.weight_field_id != -1: + */ + __pyx_v_bv = (__pyx_v_fit->values[__pyx_v_bin_id]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":113 + * dd = dvs[fit.field_id] - (fit.bounds[0] + bin_id * fit.dbin) # x - x0 + * bv = fit.values[bin_id] + * dy = fit.values[bin_id + 1] - bv # <<<<<<<<<<<<<< + * if fit.weight_field_id != -1: + * return dvs[fit.weight_field_id] * (bv + dd*dy*fit.idbin) + */ + __pyx_v_dy = ((__pyx_v_fit->values[(__pyx_v_bin_id + 1)]) - __pyx_v_bv); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":114 + * bv = fit.values[bin_id] + * dy = fit.values[bin_id + 1] - bv + * if fit.weight_field_id != -1: # <<<<<<<<<<<<<< + * return dvs[fit.weight_field_id] * (bv + dd*dy*fit.idbin) + * return (bv + dd*dy*fit.idbin) + */ + __pyx_t_3 = (__pyx_v_fit->weight_field_id != -1); + if (__pyx_t_3) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":115 + * dy = fit.values[bin_id + 1] - bv + * if fit.weight_field_id != -1: + * return dvs[fit.weight_field_id] * (bv + dd*dy*fit.idbin) # <<<<<<<<<<<<<< + * return (bv + dd*dy*fit.idbin) + * + */ + __pyx_r = ((__pyx_v_dvs[__pyx_v_fit->weight_field_id]) * (__pyx_v_bv + ((__pyx_v_dd * __pyx_v_dy) * __pyx_v_fit->idbin))); + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":116 + * if fit.weight_field_id != -1: + * return dvs[fit.weight_field_id] * (bv + dd*dy*fit.idbin) + * return (bv + dd*dy*fit.idbin) # <<<<<<<<<<<<<< + * + * cdef class TransferFunctionProxy: + */ + __pyx_r = (__pyx_v_bv + ((__pyx_v_dd * __pyx_v_dy) * __pyx_v_fit->idbin)); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":121 + * cdef int n_fields + * cdef int n_field_tables + * cdef public int ns # <<<<<<<<<<<<<< + * + * # These are the field tables and their affiliated storage. + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_2ns___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_2ns___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->ns); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("yt.amr_utils.TransferFunctionProxy.ns.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_2ns___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_2ns___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + int __pyx_t_1; + __Pyx_RefNannySetupContext("__set__"); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->ns = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("yt.amr_utils.TransferFunctionProxy.ns.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":136 + * # We store a reference to the transfer function object and to the field + * # interpolation tables + * cdef public object tf_obj # <<<<<<<<<<<<<< + * cdef public object my_field_tables + * + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_6tf_obj___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_6tf_obj___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->tf_obj); + __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->tf_obj; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_6tf_obj___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_6tf_obj___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->tf_obj); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->tf_obj); + ((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->tf_obj = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_6tf_obj___del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_6tf_obj___del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->tf_obj); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->tf_obj); + ((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->tf_obj = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":137 + * # interpolation tables + * cdef public object tf_obj + * cdef public object my_field_tables # <<<<<<<<<<<<<< + * + * def __cinit__(self, tf_obj): + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_15my_field_tables___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_15my_field_tables___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->my_field_tables); + __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->my_field_tables; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_15my_field_tables___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_15my_field_tables___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->my_field_tables); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->my_field_tables); + ((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->my_field_tables = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_15my_field_tables___del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_15my_field_tables___del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->my_field_tables); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->my_field_tables); + ((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->my_field_tables = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":139 + * cdef public object my_field_tables + * + * def __cinit__(self, tf_obj): # <<<<<<<<<<<<<< + * # We have N fields. We have 6 channels. We have M field tables. + * # The idea is that we can have multiple channels corresponding to the + */ + +static int __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_tf_obj = 0; + int __pyx_v_i; + PyArrayObject *__pyx_v_temp; + Py_buffer __pyx_bstruct_temp; + Py_ssize_t __pyx_bstride_0_temp = 0; + Py_ssize_t __pyx_bshape_0_temp = 0; + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyArrayObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + __pyx_t_5numpy_float64_t __pyx_t_10; + __pyx_t_5numpy_float64_t __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + struct __pyx_opt_args_2yt_9amr_utils_FIT_initialize_table __pyx_t_15; + PyObject *__pyx_t_16 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tf_obj,0}; + __Pyx_RefNannySetupContext("__cinit__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[1] = {0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tf_obj); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_tf_obj = values[0]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_tf_obj = PyTuple_GET_ITEM(__pyx_args, 0); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.TransferFunctionProxy.__cinit__"); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_v_temp = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_bstruct_temp.buf = NULL; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":150 + * cdef FieldInterpolationTable fit + * + * self.tf_obj = tf_obj # <<<<<<<<<<<<<< + * + * self.n_field_tables = tf_obj.n_field_tables + */ + __Pyx_INCREF(__pyx_v_tf_obj); + __Pyx_GIVEREF(__pyx_v_tf_obj); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->tf_obj); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->tf_obj); + ((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->tf_obj = __pyx_v_tf_obj; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":152 + * self.tf_obj = tf_obj + * + * self.n_field_tables = tf_obj.n_field_tables # <<<<<<<<<<<<<< + * for i in range(6): self.istorage[i] = 0.0 + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__n_field_tables); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + ((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->n_field_tables = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":153 + * + * self.n_field_tables = tf_obj.n_field_tables + * for i in range(6): self.istorage[i] = 0.0 # <<<<<<<<<<<<<< + * + * self.my_field_tables = [] + */ + for (__pyx_t_2 = 0; __pyx_t_2 < 6; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; + (((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->istorage[__pyx_v_i]) = 0.0; + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":155 + * for i in range(6): self.istorage[i] = 0.0 + * + * self.my_field_tables = [] # <<<<<<<<<<<<<< + * for i in range(self.n_field_tables): + * temp = tf_obj.tables[i].y + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->my_field_tables); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->my_field_tables); + ((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->my_field_tables = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":156 + * + * self.my_field_tables = [] + * for i in range(self.n_field_tables): # <<<<<<<<<<<<<< + * temp = tf_obj.tables[i].y + * FIT_initialize_table(&self.field_tables[i], + */ + __pyx_t_2 = ((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->n_field_tables; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":157 + * self.my_field_tables = [] + * for i in range(self.n_field_tables): + * temp = tf_obj.tables[i].y # <<<<<<<<<<<<<< + * FIT_initialize_table(&self.field_tables[i], + * temp.shape[0], + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__tables); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__y); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = ((PyArrayObject *)__pyx_t_1); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_temp); + __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_temp, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_6 < 0)) { + PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_temp, (PyObject*)__pyx_v_temp, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9); + } + } + __pyx_bstride_0_temp = __pyx_bstruct_temp.strides[0]; + __pyx_bshape_0_temp = __pyx_bstruct_temp.shape[0]; + if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_temp)); + __pyx_v_temp = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":161 + * temp.shape[0], + * temp.data, + * tf_obj.tables[i].x_bounds[0], # <<<<<<<<<<<<<< + * tf_obj.tables[i].x_bounds[1], + * tf_obj.field_ids[i], tf_obj.weight_field_ids[i], + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__tables); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__x_bounds); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_10 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":162 + * temp.data, + * tf_obj.tables[i].x_bounds[0], + * tf_obj.tables[i].x_bounds[1], # <<<<<<<<<<<<<< + * tf_obj.field_ids[i], tf_obj.weight_field_ids[i], + * tf_obj.weight_table_ids[i], + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__tables); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__x_bounds); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_11 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":163 + * tf_obj.tables[i].x_bounds[0], + * tf_obj.tables[i].x_bounds[1], + * tf_obj.field_ids[i], tf_obj.weight_field_ids[i], # <<<<<<<<<<<<<< + * tf_obj.weight_table_ids[i], + * tf_obj.tables[i].pass_through) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__field_ids); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__weight_field_ids); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_12 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":164 + * tf_obj.tables[i].x_bounds[1], + * tf_obj.field_ids[i], tf_obj.weight_field_ids[i], + * tf_obj.weight_table_ids[i], # <<<<<<<<<<<<<< + * tf_obj.tables[i].pass_through) + * self.my_field_tables.append((tf_obj.tables[i], + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__weight_table_ids); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":165 + * tf_obj.field_ids[i], tf_obj.weight_field_ids[i], + * tf_obj.weight_table_ids[i], + * tf_obj.tables[i].pass_through) # <<<<<<<<<<<<<< + * self.my_field_tables.append((tf_obj.tables[i], + * tf_obj.tables[i].y)) + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__tables); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__pass_through); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_14 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_15.__pyx_n = 3; + __pyx_t_15.weight_field_id = __pyx_t_12; + __pyx_t_15.weight_table_id = __pyx_t_13; + __pyx_t_15.pass_through = __pyx_t_14; + __pyx_f_2yt_9amr_utils_FIT_initialize_table((&(((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->field_tables[__pyx_v_i])), (__pyx_v_temp->dimensions[0]), ((__pyx_t_5numpy_float64_t *)__pyx_v_temp->data), __pyx_t_10, __pyx_t_11, __pyx_t_6, &__pyx_t_15); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":166 + * tf_obj.weight_table_ids[i], + * tf_obj.tables[i].pass_through) + * self.my_field_tables.append((tf_obj.tables[i], # <<<<<<<<<<<<<< + * tf_obj.tables[i].y)) + * self.field_tables[i].field_id = tf_obj.field_ids[i] + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__tables); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":167 + * tf_obj.tables[i].pass_through) + * self.my_field_tables.append((tf_obj.tables[i], + * tf_obj.tables[i].y)) # <<<<<<<<<<<<<< + * self.field_tables[i].field_id = tf_obj.field_ids[i] + * self.field_tables[i].weight_field_id = tf_obj.weight_field_ids[i] + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__tables); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_16 = __Pyx_GetItemInt(__pyx_t_4, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_16) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_GetAttr(__pyx_t_16, __pyx_n_s__y); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_16); + PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_1 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Append(((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->my_field_tables, __pyx_t_16); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":168 + * self.my_field_tables.append((tf_obj.tables[i], + * tf_obj.tables[i].y)) + * self.field_tables[i].field_id = tf_obj.field_ids[i] # <<<<<<<<<<<<<< + * self.field_tables[i].weight_field_id = tf_obj.weight_field_ids[i] + * print "Field table", i, "corresponds to", + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__field_ids); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_16 = __Pyx_GetItemInt(__pyx_t_4, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_16) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_14 = __Pyx_PyInt_AsInt(__pyx_t_16); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + (((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->field_tables[__pyx_v_i]).field_id = __pyx_t_14; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":169 + * tf_obj.tables[i].y)) + * self.field_tables[i].field_id = tf_obj.field_ids[i] + * self.field_tables[i].weight_field_id = tf_obj.weight_field_ids[i] # <<<<<<<<<<<<<< + * print "Field table", i, "corresponds to", + * print self.field_tables[i].field_id, + */ + __pyx_t_16 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__weight_field_ids); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_16, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_t_14 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + (((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->field_tables[__pyx_v_i]).weight_field_id = __pyx_t_14; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":170 + * self.field_tables[i].field_id = tf_obj.field_ids[i] + * self.field_tables[i].weight_field_id = tf_obj.weight_field_ids[i] + * print "Field table", i, "corresponds to", # <<<<<<<<<<<<<< + * print self.field_tables[i].field_id, + * print "(Weighted with ", self.field_tables[i].weight_field_id, + */ + __pyx_t_4 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_16 = PyTuple_New(3); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_16); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_3)); + PyTuple_SET_ITEM(__pyx_t_16, 0, ((PyObject *)__pyx_kp_s_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3)); + PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_4)); + PyTuple_SET_ITEM(__pyx_t_16, 2, ((PyObject *)__pyx_kp_s_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4)); + __pyx_t_4 = 0; + if (__Pyx_Print(0, __pyx_t_16, 0) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":171 + * self.field_tables[i].weight_field_id = tf_obj.weight_field_ids[i] + * print "Field table", i, "corresponds to", + * print self.field_tables[i].field_id, # <<<<<<<<<<<<<< + * print "(Weighted with ", self.field_tables[i].weight_field_id, + * print ")" + */ + __pyx_t_16 = PyInt_FromLong((((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->field_tables[__pyx_v_i]).field_id); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_16); + __Pyx_GIVEREF(__pyx_t_16); + __pyx_t_16 = 0; + if (__Pyx_Print(0, __pyx_t_4, 0) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":172 + * print "Field table", i, "corresponds to", + * print self.field_tables[i].field_id, + * print "(Weighted with ", self.field_tables[i].weight_field_id, # <<<<<<<<<<<<<< + * print ")" + * + */ + __pyx_t_4 = PyInt_FromLong((((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->field_tables[__pyx_v_i]).weight_field_id); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_16); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_5)); + PyTuple_SET_ITEM(__pyx_t_16, 0, ((PyObject *)__pyx_kp_s_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5)); + PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + if (__Pyx_Print(0, __pyx_t_16, 0) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":173 + * print self.field_tables[i].field_id, + * print "(Weighted with ", self.field_tables[i].weight_field_id, + * print ")" # <<<<<<<<<<<<<< + * + * for i in range(6): + */ + if (__Pyx_PrintOne(0, ((PyObject *)__pyx_kp_s_6)) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":175 + * print ")" + * + * for i in range(6): # <<<<<<<<<<<<<< + * self.field_table_ids[i] = tf_obj.field_table_ids[i] + * print "Channel", i, "corresponds to", self.field_table_ids[i] + */ + for (__pyx_t_2 = 0; __pyx_t_2 < 6; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":176 + * + * for i in range(6): + * self.field_table_ids[i] = tf_obj.field_table_ids[i] # <<<<<<<<<<<<<< + * print "Channel", i, "corresponds to", self.field_table_ids[i] + * + */ + __pyx_t_16 = PyObject_GetAttr(__pyx_v_tf_obj, __pyx_n_s__field_table_ids); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_16, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + (((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->field_table_ids[__pyx_v_i]) = __pyx_t_3; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":177 + * for i in range(6): + * self.field_table_ids[i] = tf_obj.field_table_ids[i] + * print "Channel", i, "corresponds to", self.field_table_ids[i] # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + __pyx_t_4 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_16 = PyInt_FromLong((((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_self)->field_table_ids[__pyx_v_i])); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Channel)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__Channel)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Channel)); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_4)); + PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_kp_s_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4)); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_16); + __Pyx_GIVEREF(__pyx_t_16); + __pyx_t_4 = 0; + __pyx_t_16 = 0; + if (__Pyx_Print(0, __pyx_t_1, 1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_16); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_temp); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.amr_utils.TransferFunctionProxy.__cinit__"); + __pyx_r = -1; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_temp); + __pyx_L2:; + __Pyx_DECREF((PyObject *)__pyx_v_temp); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":181 + * @cython.boundscheck(False) + * @cython.wraparound(False) + * cdef void eval_transfer(self, np.float64_t dt, np.float64_t *dvs, # <<<<<<<<<<<<<< + * np.float64_t *rgba, np.float64_t *grad): + * cdef int i, fid, use + */ + +static void __pyx_f_2yt_9amr_utils_21TransferFunctionProxy_eval_transfer(struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *__pyx_v_self, __pyx_t_5numpy_float64_t __pyx_v_dt, __pyx_t_5numpy_float64_t *__pyx_v_dvs, __pyx_t_5numpy_float64_t *__pyx_v_rgba, __pyx_t_5numpy_float64_t *__pyx_v_grad) { + int __pyx_v_i; + int __pyx_v_fid; + __pyx_t_5numpy_float64_t __pyx_v_ta; + __pyx_t_5numpy_float64_t __pyx_v_trgba[6]; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + __Pyx_RefNannySetupContext("eval_transfer"); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":194 + * # use = 1 + * # break + * for i in range(self.n_field_tables): # <<<<<<<<<<<<<< + * self.istorage[i] = FIT_get_value(&self.field_tables[i], dvs) + * # We have to do this after the interpolation + */ + __pyx_t_1 = __pyx_v_self->n_field_tables; + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":195 + * # break + * for i in range(self.n_field_tables): + * self.istorage[i] = FIT_get_value(&self.field_tables[i], dvs) # <<<<<<<<<<<<<< + * # We have to do this after the interpolation + * for i in range(self.n_field_tables): + */ + (__pyx_v_self->istorage[__pyx_v_i]) = __pyx_f_2yt_9amr_utils_FIT_get_value((&(__pyx_v_self->field_tables[__pyx_v_i])), __pyx_v_dvs); + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":197 + * self.istorage[i] = FIT_get_value(&self.field_tables[i], dvs) + * # We have to do this after the interpolation + * for i in range(self.n_field_tables): # <<<<<<<<<<<<<< + * fid = self.field_tables[i].weight_table_id + * if fid != -1: self.istorage[i] *= self.istorage[fid] + */ + __pyx_t_1 = __pyx_v_self->n_field_tables; + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":198 + * # We have to do this after the interpolation + * for i in range(self.n_field_tables): + * fid = self.field_tables[i].weight_table_id # <<<<<<<<<<<<<< + * if fid != -1: self.istorage[i] *= self.istorage[fid] + * for i in range(6): + */ + __pyx_v_fid = (__pyx_v_self->field_tables[__pyx_v_i]).weight_table_id; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":199 + * for i in range(self.n_field_tables): + * fid = self.field_tables[i].weight_table_id + * if fid != -1: self.istorage[i] *= self.istorage[fid] # <<<<<<<<<<<<<< + * for i in range(6): + * trgba[i] = self.istorage[self.field_table_ids[i]] + */ + __pyx_t_3 = (__pyx_v_fid != -1); + if (__pyx_t_3) { + (__pyx_v_self->istorage[__pyx_v_i]) *= (__pyx_v_self->istorage[__pyx_v_fid]); + goto __pyx_L7; + } + __pyx_L7:; + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":200 + * fid = self.field_tables[i].weight_table_id + * if fid != -1: self.istorage[i] *= self.istorage[fid] + * for i in range(6): # <<<<<<<<<<<<<< + * trgba[i] = self.istorage[self.field_table_ids[i]] + * #print i, trgba[i], + */ + for (__pyx_t_1 = 0; __pyx_t_1 < 6; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":201 + * if fid != -1: self.istorage[i] *= self.istorage[fid] + * for i in range(6): + * trgba[i] = self.istorage[self.field_table_ids[i]] # <<<<<<<<<<<<<< + * #print i, trgba[i], + * #print + */ + (__pyx_v_trgba[__pyx_v_i]) = (__pyx_v_self->istorage[(__pyx_v_self->field_table_ids[__pyx_v_i])]); + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":211 + * # integration here: + * # I_{i+1} = ds * C_i + (1.0 - ds*alpha_i) * I_i + * for i in range(3): # <<<<<<<<<<<<<< + * # This is the new way: alpha corresponds to opacity of a given + * # slice. Previously it was ill-defined, but represented some + */ + for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":215 + * # slice. Previously it was ill-defined, but represented some + * # measure of emissivity. + * ta = fmax((1.0 - dt*trgba[i+3]), 0.0) # <<<<<<<<<<<<<< + * rgba[i ] = dt*trgba[i ] + ta * rgba[i ] + * #rgba[i+3] = dt*trgba[i+3] + ta * rgba[i+3] + */ + __pyx_v_ta = __pyx_f_2yt_9amr_utils_fmax((1.0 - (__pyx_v_dt * (__pyx_v_trgba[(__pyx_v_i + 3)]))), 0.0); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":216 + * # measure of emissivity. + * ta = fmax((1.0 - dt*trgba[i+3]), 0.0) + * rgba[i ] = dt*trgba[i ] + ta * rgba[i ] # <<<<<<<<<<<<<< + * #rgba[i+3] = dt*trgba[i+3] + ta * rgba[i+3] + * # This is the old way: + */ + (__pyx_v_rgba[__pyx_v_i]) = ((__pyx_v_dt * (__pyx_v_trgba[__pyx_v_i])) + (__pyx_v_ta * (__pyx_v_rgba[__pyx_v_i]))); + } + + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":223 + * + * cdef class VectorPlane: + * cdef public object avp_pos, avp_dir, acenter, aimage # <<<<<<<<<<<<<< + * cdef np.float64_t *vp_pos, *vp_dir, *center, *image, + * cdef np.float64_t pdx, pdy, bounds[4] + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_pos___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_pos___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_pos); + __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_pos; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_pos___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_pos___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_pos); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_pos); + ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_pos = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_pos___del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_pos___del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_pos); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_pos); + ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_pos = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_dir___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_dir___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_dir); + __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_dir; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_dir___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_dir___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_dir); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_dir); + ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_dir = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_dir___del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_dir___del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_dir); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_dir); + ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_dir = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_2yt_9amr_utils_11VectorPlane_7acenter___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_11VectorPlane_7acenter___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->acenter); + __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->acenter; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_11VectorPlane_7acenter___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_11VectorPlane_7acenter___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->acenter); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->acenter); + ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->acenter = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_11VectorPlane_7acenter___del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_11VectorPlane_7acenter___del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->acenter); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->acenter); + ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->acenter = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_2yt_9amr_utils_11VectorPlane_6aimage___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_11VectorPlane_6aimage___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->aimage); + __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->aimage; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_11VectorPlane_6aimage___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_11VectorPlane_6aimage___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->aimage); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->aimage); + ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->aimage = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_11VectorPlane_6aimage___del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_11VectorPlane_6aimage___del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->aimage); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->aimage); + ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->aimage = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":230 + * cdef int im_strides[3] + * cdef int vd_strides[3] + * cdef public object ax_vec, ay_vec # <<<<<<<<<<<<<< + * cdef np.float64_t *x_vec, *y_vec + * + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_11VectorPlane_6ax_vec___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_11VectorPlane_6ax_vec___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ax_vec); + __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ax_vec; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_11VectorPlane_6ax_vec___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_11VectorPlane_6ax_vec___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ax_vec); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ax_vec); + ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ax_vec = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_11VectorPlane_6ax_vec___del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_11VectorPlane_6ax_vec___del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ax_vec); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ax_vec); + ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ax_vec = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_2yt_9amr_utils_11VectorPlane_6ay_vec___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_11VectorPlane_6ay_vec___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ay_vec); + __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ay_vec; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_11VectorPlane_6ay_vec___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_11VectorPlane_6ay_vec___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ay_vec); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ay_vec); + ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ay_vec = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_11VectorPlane_6ay_vec___del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_11VectorPlane_6ay_vec___del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ay_vec); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ay_vec); + ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ay_vec = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":233 + * cdef np.float64_t *x_vec, *y_vec + * + * def __cinit__(self, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t, ndim=3] vp_pos, + * np.ndarray vp_dir, + */ + +static int __pyx_pf_2yt_9amr_utils_11VectorPlane___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_11VectorPlane___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_vp_pos = 0; + PyArrayObject *__pyx_v_vp_dir = 0; + PyArrayObject *__pyx_v_center = 0; + PyObject *__pyx_v_bounds = 0; + PyArrayObject *__pyx_v_image = 0; + PyArrayObject *__pyx_v_x_vec = 0; + PyArrayObject *__pyx_v_y_vec = 0; + int __pyx_v_i; + Py_buffer __pyx_bstruct_center; + Py_ssize_t __pyx_bstride_0_center = 0; + Py_ssize_t __pyx_bshape_0_center = 0; + Py_buffer __pyx_bstruct_x_vec; + Py_ssize_t __pyx_bstride_0_x_vec = 0; + Py_ssize_t __pyx_bshape_0_x_vec = 0; + Py_buffer __pyx_bstruct_y_vec; + Py_ssize_t __pyx_bstride_0_y_vec = 0; + Py_ssize_t __pyx_bshape_0_y_vec = 0; + Py_buffer __pyx_bstruct_image; + Py_ssize_t __pyx_bstride_0_image = 0; + Py_ssize_t __pyx_bstride_1_image = 0; + Py_ssize_t __pyx_bstride_2_image = 0; + Py_ssize_t __pyx_bshape_0_image = 0; + Py_ssize_t __pyx_bshape_1_image = 0; + Py_ssize_t __pyx_bshape_2_image = 0; + Py_buffer __pyx_bstruct_vp_pos; + Py_ssize_t __pyx_bstride_0_vp_pos = 0; + Py_ssize_t __pyx_bstride_1_vp_pos = 0; + Py_ssize_t __pyx_bstride_2_vp_pos = 0; + Py_ssize_t __pyx_bshape_0_vp_pos = 0; + Py_ssize_t __pyx_bshape_1_vp_pos = 0; + Py_ssize_t __pyx_bshape_2_vp_pos = 0; + int __pyx_r; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __pyx_t_5numpy_float64_t __pyx_t_3; + int __pyx_t_4; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vp_pos,&__pyx_n_s__vp_dir,&__pyx_n_s__center,&__pyx_n_s__bounds,&__pyx_n_s__image,&__pyx_n_s__x_vec,&__pyx_n_s__y_vec,0}; + __Pyx_RefNannySetupContext("__cinit__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[7] = {0,0,0,0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__vp_pos); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__vp_dir); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 7, 7, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__center); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 7, 7, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bounds); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 7, 7, 3); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__image); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 7, 7, 4); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x_vec); + if (likely(values[5])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 7, 7, 5); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 6: + values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y_vec); + if (likely(values[6])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 7, 7, 6); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_vp_pos = ((PyArrayObject *)values[0]); + __pyx_v_vp_dir = ((PyArrayObject *)values[1]); + __pyx_v_center = ((PyArrayObject *)values[2]); + __pyx_v_bounds = values[3]; + __pyx_v_image = ((PyArrayObject *)values[4]); + __pyx_v_x_vec = ((PyArrayObject *)values[5]); + __pyx_v_y_vec = ((PyArrayObject *)values[6]); + } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_vp_pos = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); + __pyx_v_vp_dir = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); + __pyx_v_center = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); + __pyx_v_bounds = PyTuple_GET_ITEM(__pyx_args, 3); + __pyx_v_image = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); + __pyx_v_x_vec = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 5)); + __pyx_v_y_vec = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 6)); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.VectorPlane.__cinit__"); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_bstruct_vp_pos.buf = NULL; + __pyx_bstruct_center.buf = NULL; + __pyx_bstruct_image.buf = NULL; + __pyx_bstruct_x_vec.buf = NULL; + __pyx_bstruct_y_vec.buf = NULL; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vp_pos), __pyx_ptype_5numpy_ndarray, 1, "vp_pos", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vp_dir), __pyx_ptype_5numpy_ndarray, 1, "vp_dir", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_center), __pyx_ptype_5numpy_ndarray, 1, "center", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_image), __pyx_ptype_5numpy_ndarray, 1, "image", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x_vec), __pyx_ptype_5numpy_ndarray, 1, "x_vec", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y_vec), __pyx_ptype_5numpy_ndarray, 1, "y_vec", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_vp_pos, (PyObject*)__pyx_v_vp_pos, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_vp_pos = __pyx_bstruct_vp_pos.strides[0]; __pyx_bstride_1_vp_pos = __pyx_bstruct_vp_pos.strides[1]; __pyx_bstride_2_vp_pos = __pyx_bstruct_vp_pos.strides[2]; + __pyx_bshape_0_vp_pos = __pyx_bstruct_vp_pos.shape[0]; __pyx_bshape_1_vp_pos = __pyx_bstruct_vp_pos.shape[1]; __pyx_bshape_2_vp_pos = __pyx_bstruct_vp_pos.shape[2]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_center, (PyObject*)__pyx_v_center, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_center = __pyx_bstruct_center.strides[0]; + __pyx_bshape_0_center = __pyx_bstruct_center.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_image, (PyObject*)__pyx_v_image, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_image = __pyx_bstruct_image.strides[0]; __pyx_bstride_1_image = __pyx_bstruct_image.strides[1]; __pyx_bstride_2_image = __pyx_bstruct_image.strides[2]; + __pyx_bshape_0_image = __pyx_bstruct_image.shape[0]; __pyx_bshape_1_image = __pyx_bstruct_image.shape[1]; __pyx_bshape_2_image = __pyx_bstruct_image.shape[2]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x_vec, (PyObject*)__pyx_v_x_vec, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_x_vec = __pyx_bstruct_x_vec.strides[0]; + __pyx_bshape_0_x_vec = __pyx_bstruct_x_vec.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_y_vec, (PyObject*)__pyx_v_y_vec, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_y_vec = __pyx_bstruct_y_vec.strides[0]; + __pyx_bshape_0_y_vec = __pyx_bstruct_y_vec.shape[0]; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":242 + * np.ndarray[np.float64_t, ndim=1] y_vec): + * cdef int i, j + * self.avp_pos = vp_pos # <<<<<<<<<<<<<< + * self.avp_dir = vp_dir + * self.acenter = center + */ + __Pyx_INCREF(((PyObject *)__pyx_v_vp_pos)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_vp_pos)); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_pos); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_pos); + ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_pos = ((PyObject *)__pyx_v_vp_pos); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":243 + * cdef int i, j + * self.avp_pos = vp_pos + * self.avp_dir = vp_dir # <<<<<<<<<<<<<< + * self.acenter = center + * self.aimage = image + */ + __Pyx_INCREF(((PyObject *)__pyx_v_vp_dir)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_vp_dir)); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_dir); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_dir); + ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->avp_dir = ((PyObject *)__pyx_v_vp_dir); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":244 + * self.avp_pos = vp_pos + * self.avp_dir = vp_dir + * self.acenter = center # <<<<<<<<<<<<<< + * self.aimage = image + * self.ax_vec = x_vec + */ + __Pyx_INCREF(((PyObject *)__pyx_v_center)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_center)); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->acenter); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->acenter); + ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->acenter = ((PyObject *)__pyx_v_center); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":245 + * self.avp_dir = vp_dir + * self.acenter = center + * self.aimage = image # <<<<<<<<<<<<<< + * self.ax_vec = x_vec + * self.ay_vec = y_vec + */ + __Pyx_INCREF(((PyObject *)__pyx_v_image)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_image)); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->aimage); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->aimage); + ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->aimage = ((PyObject *)__pyx_v_image); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":246 + * self.acenter = center + * self.aimage = image + * self.ax_vec = x_vec # <<<<<<<<<<<<<< + * self.ay_vec = y_vec + * self.vp_pos = vp_pos.data + */ + __Pyx_INCREF(((PyObject *)__pyx_v_x_vec)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_x_vec)); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ax_vec); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ax_vec); + ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ax_vec = ((PyObject *)__pyx_v_x_vec); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":247 + * self.aimage = image + * self.ax_vec = x_vec + * self.ay_vec = y_vec # <<<<<<<<<<<<<< + * self.vp_pos = vp_pos.data + * self.vp_dir = vp_dir.data + */ + __Pyx_INCREF(((PyObject *)__pyx_v_y_vec)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_y_vec)); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ay_vec); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ay_vec); + ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->ay_vec = ((PyObject *)__pyx_v_y_vec); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":248 + * self.ax_vec = x_vec + * self.ay_vec = y_vec + * self.vp_pos = vp_pos.data # <<<<<<<<<<<<<< + * self.vp_dir = vp_dir.data + * self.center = center.data + */ + ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->vp_pos = ((__pyx_t_5numpy_float64_t *)__pyx_v_vp_pos->data); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":249 + * self.ay_vec = y_vec + * self.vp_pos = vp_pos.data + * self.vp_dir = vp_dir.data # <<<<<<<<<<<<<< + * self.center = center.data + * self.image = image.data + */ + ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->vp_dir = ((__pyx_t_5numpy_float64_t *)__pyx_v_vp_dir->data); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":250 + * self.vp_pos = vp_pos.data + * self.vp_dir = vp_dir.data + * self.center = center.data # <<<<<<<<<<<<<< + * self.image = image.data + * self.x_vec = x_vec.data + */ + ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->center = ((__pyx_t_5numpy_float64_t *)__pyx_v_center->data); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":251 + * self.vp_dir = vp_dir.data + * self.center = center.data + * self.image = image.data # <<<<<<<<<<<<<< + * self.x_vec = x_vec.data + * self.y_vec = y_vec.data + */ + ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->image = ((__pyx_t_5numpy_float64_t *)__pyx_v_image->data); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":252 + * self.center = center.data + * self.image = image.data + * self.x_vec = x_vec.data # <<<<<<<<<<<<<< + * self.y_vec = y_vec.data + * self.nv[0] = vp_pos.shape[0] + */ + ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->x_vec = ((__pyx_t_5numpy_float64_t *)__pyx_v_x_vec->data); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":253 + * self.image = image.data + * self.x_vec = x_vec.data + * self.y_vec = y_vec.data # <<<<<<<<<<<<<< + * self.nv[0] = vp_pos.shape[0] + * self.nv[1] = vp_pos.shape[1] + */ + ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->y_vec = ((__pyx_t_5numpy_float64_t *)__pyx_v_y_vec->data); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":254 + * self.x_vec = x_vec.data + * self.y_vec = y_vec.data + * self.nv[0] = vp_pos.shape[0] # <<<<<<<<<<<<<< + * self.nv[1] = vp_pos.shape[1] + * for i in range(4): self.bounds[i] = bounds[i] + */ + (((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->nv[0]) = (__pyx_v_vp_pos->dimensions[0]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":255 + * self.y_vec = y_vec.data + * self.nv[0] = vp_pos.shape[0] + * self.nv[1] = vp_pos.shape[1] # <<<<<<<<<<<<<< + * for i in range(4): self.bounds[i] = bounds[i] + * self.pdx = (self.bounds[1] - self.bounds[0])/self.nv[0] + */ + (((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->nv[1]) = (__pyx_v_vp_pos->dimensions[1]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":256 + * self.nv[0] = vp_pos.shape[0] + * self.nv[1] = vp_pos.shape[1] + * for i in range(4): self.bounds[i] = bounds[i] # <<<<<<<<<<<<<< + * self.pdx = (self.bounds[1] - self.bounds[0])/self.nv[0] + * self.pdy = (self.bounds[3] - self.bounds[2])/self.nv[1] + */ + for (__pyx_t_1 = 0; __pyx_t_1 < 4; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_bounds, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + (((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->bounds[__pyx_v_i]) = __pyx_t_3; + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":257 + * self.nv[1] = vp_pos.shape[1] + * for i in range(4): self.bounds[i] = bounds[i] + * self.pdx = (self.bounds[1] - self.bounds[0])/self.nv[0] # <<<<<<<<<<<<<< + * self.pdy = (self.bounds[3] - self.bounds[2])/self.nv[1] + * for i in range(3): + */ + __pyx_t_3 = ((((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->bounds[1]) - (((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->bounds[0])); + __pyx_t_1 = (((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->nv[0]); + if (unlikely(__pyx_t_1 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->pdx = (__pyx_t_3 / __pyx_t_1); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":258 + * for i in range(4): self.bounds[i] = bounds[i] + * self.pdx = (self.bounds[1] - self.bounds[0])/self.nv[0] + * self.pdy = (self.bounds[3] - self.bounds[2])/self.nv[1] # <<<<<<<<<<<<<< + * for i in range(3): + * self.vp_strides[i] = vp_pos.strides[i] / 8 + */ + __pyx_t_3 = ((((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->bounds[3]) - (((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->bounds[2])); + __pyx_t_1 = (((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->nv[1]); + if (unlikely(__pyx_t_1 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->pdy = (__pyx_t_3 / __pyx_t_1); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":259 + * self.pdx = (self.bounds[1] - self.bounds[0])/self.nv[0] + * self.pdy = (self.bounds[3] - self.bounds[2])/self.nv[1] + * for i in range(3): # <<<<<<<<<<<<<< + * self.vp_strides[i] = vp_pos.strides[i] / 8 + * self.im_strides[i] = image.strides[i] / 8 + */ + for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":260 + * self.pdy = (self.bounds[3] - self.bounds[2])/self.nv[1] + * for i in range(3): + * self.vp_strides[i] = vp_pos.strides[i] / 8 # <<<<<<<<<<<<<< + * self.im_strides[i] = image.strides[i] / 8 + * if vp_dir.ndim > 1: + */ + (((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->vp_strides[__pyx_v_i]) = __Pyx_div_long((__pyx_v_vp_pos->strides[__pyx_v_i]), 8); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":261 + * for i in range(3): + * self.vp_strides[i] = vp_pos.strides[i] / 8 + * self.im_strides[i] = image.strides[i] / 8 # <<<<<<<<<<<<<< + * if vp_dir.ndim > 1: + * for i in range(3): + */ + (((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->im_strides[__pyx_v_i]) = __Pyx_div_long((__pyx_v_image->strides[__pyx_v_i]), 8); + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":262 + * self.vp_strides[i] = vp_pos.strides[i] / 8 + * self.im_strides[i] = image.strides[i] / 8 + * if vp_dir.ndim > 1: # <<<<<<<<<<<<<< + * for i in range(3): + * self.vd_strides[i] = vp_dir.strides[i] / 8 + */ + __pyx_t_4 = (__pyx_v_vp_dir->nd > 1); + if (__pyx_t_4) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":263 + * self.im_strides[i] = image.strides[i] / 8 + * if vp_dir.ndim > 1: + * for i in range(3): # <<<<<<<<<<<<<< + * self.vd_strides[i] = vp_dir.strides[i] / 8 + * else: + */ + for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":264 + * if vp_dir.ndim > 1: + * for i in range(3): + * self.vd_strides[i] = vp_dir.strides[i] / 8 # <<<<<<<<<<<<<< + * else: + * self.vd_strides[0] = self.vd_strides[1] = self.vd_strides[2] = -1 + */ + (((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->vd_strides[__pyx_v_i]) = __Pyx_div_long((__pyx_v_vp_dir->strides[__pyx_v_i]), 8); + } + goto __pyx_L10; + } + /*else*/ { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":266 + * self.vd_strides[i] = vp_dir.strides[i] / 8 + * else: + * self.vd_strides[0] = self.vd_strides[1] = self.vd_strides[2] = -1 # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + (((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->vd_strides[0]) = -1; + (((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->vd_strides[1]) = -1; + (((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)__pyx_v_self)->vd_strides[2]) = -1; + } + __pyx_L10:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_center); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_vec); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y_vec); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_image); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_vp_pos); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.amr_utils.VectorPlane.__cinit__"); + __pyx_r = -1; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_center); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x_vec); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y_vec); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_image); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_vp_pos); + __pyx_L2:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":270 + * @cython.boundscheck(False) + * @cython.wraparound(False) + * cdef void get_start_stop(self, np.float64_t *ex, int *rv): # <<<<<<<<<<<<<< + * # Extrema need to be re-centered + * cdef np.float64_t cx, cy + */ + +static void __pyx_f_2yt_9amr_utils_11VectorPlane_get_start_stop(struct __pyx_obj_2yt_9amr_utils_VectorPlane *__pyx_v_self, __pyx_t_5numpy_float64_t *__pyx_v_ex, int *__pyx_v_rv) { + __pyx_t_5numpy_float64_t __pyx_v_cx; + __pyx_t_5numpy_float64_t __pyx_v_cy; + int __pyx_v_i; + int __pyx_t_1; + __pyx_t_5numpy_float64_t __pyx_t_2; + __Pyx_RefNannySetupContext("get_start_stop"); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":274 + * cdef np.float64_t cx, cy + * cdef int i + * cx = cy = 0.0 # <<<<<<<<<<<<<< + * for i in range(3): + * cx += self.center[i] * self.x_vec[i] + */ + __pyx_v_cx = 0.0; + __pyx_v_cy = 0.0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":275 + * cdef int i + * cx = cy = 0.0 + * for i in range(3): # <<<<<<<<<<<<<< + * cx += self.center[i] * self.x_vec[i] + * cy += self.center[i] * self.y_vec[i] + */ + for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":276 + * cx = cy = 0.0 + * for i in range(3): + * cx += self.center[i] * self.x_vec[i] # <<<<<<<<<<<<<< + * cy += self.center[i] * self.y_vec[i] + * rv[0] = lrint((ex[0] - cx - self.bounds[0])/self.pdx) + */ + __pyx_v_cx += ((__pyx_v_self->center[__pyx_v_i]) * (__pyx_v_self->x_vec[__pyx_v_i])); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":277 + * for i in range(3): + * cx += self.center[i] * self.x_vec[i] + * cy += self.center[i] * self.y_vec[i] # <<<<<<<<<<<<<< + * rv[0] = lrint((ex[0] - cx - self.bounds[0])/self.pdx) + * rv[1] = rv[0] + lrint((ex[1] - ex[0])/self.pdx) + */ + __pyx_v_cy += ((__pyx_v_self->center[__pyx_v_i]) * (__pyx_v_self->y_vec[__pyx_v_i])); + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":278 + * cx += self.center[i] * self.x_vec[i] + * cy += self.center[i] * self.y_vec[i] + * rv[0] = lrint((ex[0] - cx - self.bounds[0])/self.pdx) # <<<<<<<<<<<<<< + * rv[1] = rv[0] + lrint((ex[1] - ex[0])/self.pdx) + * rv[2] = lrint((ex[2] - cy - self.bounds[2])/self.pdy) + */ + __pyx_t_2 = (((__pyx_v_ex[0]) - __pyx_v_cx) - (__pyx_v_self->bounds[0])); + if (unlikely(__pyx_v_self->pdx == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + (__pyx_v_rv[0]) = lrint((__pyx_t_2 / __pyx_v_self->pdx)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":279 + * cy += self.center[i] * self.y_vec[i] + * rv[0] = lrint((ex[0] - cx - self.bounds[0])/self.pdx) + * rv[1] = rv[0] + lrint((ex[1] - ex[0])/self.pdx) # <<<<<<<<<<<<<< + * rv[2] = lrint((ex[2] - cy - self.bounds[2])/self.pdy) + * rv[3] = rv[2] + lrint((ex[3] - ex[2])/self.pdy) + */ + __pyx_t_2 = ((__pyx_v_ex[1]) - (__pyx_v_ex[0])); + if (unlikely(__pyx_v_self->pdx == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + (__pyx_v_rv[1]) = ((__pyx_v_rv[0]) + lrint((__pyx_t_2 / __pyx_v_self->pdx))); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":280 + * rv[0] = lrint((ex[0] - cx - self.bounds[0])/self.pdx) + * rv[1] = rv[0] + lrint((ex[1] - ex[0])/self.pdx) + * rv[2] = lrint((ex[2] - cy - self.bounds[2])/self.pdy) # <<<<<<<<<<<<<< + * rv[3] = rv[2] + lrint((ex[3] - ex[2])/self.pdy) + * + */ + __pyx_t_2 = (((__pyx_v_ex[2]) - __pyx_v_cy) - (__pyx_v_self->bounds[2])); + if (unlikely(__pyx_v_self->pdy == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + (__pyx_v_rv[2]) = lrint((__pyx_t_2 / __pyx_v_self->pdy)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":281 + * rv[1] = rv[0] + lrint((ex[1] - ex[0])/self.pdx) + * rv[2] = lrint((ex[2] - cy - self.bounds[2])/self.pdy) + * rv[3] = rv[2] + lrint((ex[3] - ex[2])/self.pdy) # <<<<<<<<<<<<<< + * + * cdef inline void copy_into(self, np.float64_t *fv, np.float64_t *tv, + */ + __pyx_t_2 = ((__pyx_v_ex[3]) - (__pyx_v_ex[2])); + if (unlikely(__pyx_v_self->pdy == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + (__pyx_v_rv[3]) = ((__pyx_v_rv[2]) + lrint((__pyx_t_2 / __pyx_v_self->pdy))); + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_WriteUnraisable("yt.amr_utils.VectorPlane.get_start_stop"); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":283 + * rv[3] = rv[2] + lrint((ex[3] - ex[2])/self.pdy) + * + * cdef inline void copy_into(self, np.float64_t *fv, np.float64_t *tv, # <<<<<<<<<<<<<< + * int i, int j, int nk, int strides[3]): + * # We know the first two dimensions of our from-vector, and our + */ + +static CYTHON_INLINE void __pyx_f_2yt_9amr_utils_11VectorPlane_copy_into(struct __pyx_obj_2yt_9amr_utils_VectorPlane *__pyx_v_self, __pyx_t_5numpy_float64_t *__pyx_v_fv, __pyx_t_5numpy_float64_t *__pyx_v_tv, int __pyx_v_i, int __pyx_v_j, int __pyx_v_nk, int *__pyx_v_strides) { + int __pyx_v_k; + int __pyx_v_offset; + int __pyx_t_1; + int __pyx_t_2; + __Pyx_RefNannySetupContext("copy_into"); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":288 + * # to-vector is flat and 'ni' long + * cdef int k + * cdef int offset = strides[0] * i + strides[1] * j # <<<<<<<<<<<<<< + * for k in range(nk): + * tv[k] = fv[offset + k] + */ + __pyx_v_offset = (((__pyx_v_strides[0]) * __pyx_v_i) + ((__pyx_v_strides[1]) * __pyx_v_j)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":289 + * cdef int k + * cdef int offset = strides[0] * i + strides[1] * j + * for k in range(nk): # <<<<<<<<<<<<<< + * tv[k] = fv[offset + k] + * + */ + __pyx_t_1 = __pyx_v_nk; + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_k = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":290 + * cdef int offset = strides[0] * i + strides[1] * j + * for k in range(nk): + * tv[k] = fv[offset + k] # <<<<<<<<<<<<<< + * + * cdef inline void copy_back(self, np.float64_t *fv, np.float64_t *tv, + */ + (__pyx_v_tv[__pyx_v_k]) = (__pyx_v_fv[(__pyx_v_offset + __pyx_v_k)]); + } + + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":292 + * tv[k] = fv[offset + k] + * + * cdef inline void copy_back(self, np.float64_t *fv, np.float64_t *tv, # <<<<<<<<<<<<<< + * int i, int j, int nk, int strides[3]): + * cdef int k + */ + +static CYTHON_INLINE void __pyx_f_2yt_9amr_utils_11VectorPlane_copy_back(struct __pyx_obj_2yt_9amr_utils_VectorPlane *__pyx_v_self, __pyx_t_5numpy_float64_t *__pyx_v_fv, __pyx_t_5numpy_float64_t *__pyx_v_tv, int __pyx_v_i, int __pyx_v_j, int __pyx_v_nk, int *__pyx_v_strides) { + int __pyx_v_k; + int __pyx_v_offset; + int __pyx_t_1; + int __pyx_t_2; + __Pyx_RefNannySetupContext("copy_back"); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":295 + * int i, int j, int nk, int strides[3]): + * cdef int k + * cdef int offset = strides[0] * i + strides[1] * j # <<<<<<<<<<<<<< + * for k in range(nk): + * tv[offset + k] = fv[k] + */ + __pyx_v_offset = (((__pyx_v_strides[0]) * __pyx_v_i) + ((__pyx_v_strides[1]) * __pyx_v_j)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":296 + * cdef int k + * cdef int offset = strides[0] * i + strides[1] * j + * for k in range(nk): # <<<<<<<<<<<<<< + * tv[offset + k] = fv[k] + * + */ + __pyx_t_1 = __pyx_v_nk; + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_k = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":297 + * cdef int offset = strides[0] * i + strides[1] * j + * for k in range(nk): + * tv[offset + k] = fv[k] # <<<<<<<<<<<<<< + * + * cdef class PartitionedGrid: + */ + (__pyx_v_tv[(__pyx_v_offset + __pyx_v_k)]) = (__pyx_v_fv[__pyx_v_k]); + } + + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":300 + * + * cdef class PartitionedGrid: + * cdef public object my_data # <<<<<<<<<<<<<< + * cdef public object LeftEdge + * cdef public object RightEdge + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_15PartitionedGrid_7my_data___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_15PartitionedGrid_7my_data___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->my_data); + __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->my_data; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid_7my_data___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid_7my_data___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->my_data); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->my_data); + ((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->my_data = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid_7my_data___del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid_7my_data___del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->my_data); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->my_data); + ((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->my_data = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":301 + * cdef class PartitionedGrid: + * cdef public object my_data + * cdef public object LeftEdge # <<<<<<<<<<<<<< + * cdef public object RightEdge + * cdef np.float64_t *data[6] + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_15PartitionedGrid_8LeftEdge___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_15PartitionedGrid_8LeftEdge___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->LeftEdge); + __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->LeftEdge; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid_8LeftEdge___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid_8LeftEdge___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->LeftEdge); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->LeftEdge); + ((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->LeftEdge = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid_8LeftEdge___del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid_8LeftEdge___del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->LeftEdge); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->LeftEdge); + ((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->LeftEdge = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":302 + * cdef public object my_data + * cdef public object LeftEdge + * cdef public object RightEdge # <<<<<<<<<<<<<< + * cdef np.float64_t *data[6] + * cdef np.float64_t dvs[6] + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_15PartitionedGrid_9RightEdge___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_15PartitionedGrid_9RightEdge___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->RightEdge); + __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->RightEdge; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid_9RightEdge___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid_9RightEdge___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->RightEdge); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->RightEdge); + ((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->RightEdge = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid_9RightEdge___del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid_9RightEdge___del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->RightEdge); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->RightEdge); + ((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->RightEdge = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":310 + * cdef np.float64_t idds[3] + * cdef int dims[3] + * cdef public int parent_grid_id # <<<<<<<<<<<<<< + * cdef public int n_fields + * + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_15PartitionedGrid_14parent_grid_id___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_15PartitionedGrid_14parent_grid_id___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->parent_grid_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("yt.amr_utils.PartitionedGrid.parent_grid_id.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid_14parent_grid_id___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid_14parent_grid_id___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + int __pyx_t_1; + __Pyx_RefNannySetupContext("__set__"); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->parent_grid_id = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("yt.amr_utils.PartitionedGrid.parent_grid_id.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":311 + * cdef int dims[3] + * cdef public int parent_grid_id + * cdef public int n_fields # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_15PartitionedGrid_8n_fields___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_15PartitionedGrid_8n_fields___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->n_fields); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("yt.amr_utils.PartitionedGrid.n_fields.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid_8n_fields___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid_8n_fields___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + int __pyx_t_1; + __Pyx_RefNannySetupContext("__set__"); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->n_fields = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("yt.amr_utils.PartitionedGrid.n_fields.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":315 + * @cython.boundscheck(False) + * @cython.wraparound(False) + * def __cinit__(self, # <<<<<<<<<<<<<< + * int parent_grid_id, int n_fields, data, + * np.ndarray[np.float64_t, ndim=1] left_edge, + */ + +static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_15PartitionedGrid___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_parent_grid_id; + int __pyx_v_n_fields; + PyObject *__pyx_v_data = 0; + PyArrayObject *__pyx_v_left_edge = 0; + PyArrayObject *__pyx_v_right_edge = 0; + PyArrayObject *__pyx_v_dims = 0; + int __pyx_v_i; + PyArrayObject *__pyx_v_tdata; + Py_buffer __pyx_bstruct_tdata; + Py_ssize_t __pyx_bstride_0_tdata = 0; + Py_ssize_t __pyx_bstride_1_tdata = 0; + Py_ssize_t __pyx_bstride_2_tdata = 0; + Py_ssize_t __pyx_bshape_0_tdata = 0; + Py_ssize_t __pyx_bshape_1_tdata = 0; + Py_ssize_t __pyx_bshape_2_tdata = 0; + Py_buffer __pyx_bstruct_right_edge; + Py_ssize_t __pyx_bstride_0_right_edge = 0; + Py_ssize_t __pyx_bshape_0_right_edge = 0; + Py_buffer __pyx_bstruct_dims; + Py_ssize_t __pyx_bstride_0_dims = 0; + Py_ssize_t __pyx_bshape_0_dims = 0; + Py_buffer __pyx_bstruct_left_edge; + Py_ssize_t __pyx_bstride_0_left_edge = 0; + Py_ssize_t __pyx_bshape_0_left_edge = 0; + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + __pyx_t_5numpy_float64_t __pyx_t_5; + int __pyx_t_6; + __pyx_t_5numpy_int64_t __pyx_t_7; + int __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + PyArrayObject *__pyx_t_10 = NULL; + int __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__parent_grid_id,&__pyx_n_s__n_fields,&__pyx_n_s__data,&__pyx_n_s__left_edge,&__pyx_n_s__right_edge,&__pyx_n_s__dims,0}; + __Pyx_RefNannySetupContext("__cinit__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[6] = {0,0,0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parent_grid_id); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_fields); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left_edge); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 3); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right_edge); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 4); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dims); + if (likely(values[5])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, 5); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_parent_grid_id = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_parent_grid_id == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_n_fields = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_n_fields == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_data = values[2]; + __pyx_v_left_edge = ((PyArrayObject *)values[3]); + __pyx_v_right_edge = ((PyArrayObject *)values[4]); + __pyx_v_dims = ((PyArrayObject *)values[5]); + } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_parent_grid_id = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_parent_grid_id == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_n_fields = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_n_fields == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_data = PyTuple_GET_ITEM(__pyx_args, 2); + __pyx_v_left_edge = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); + __pyx_v_right_edge = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); + __pyx_v_dims = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 5)); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.PartitionedGrid.__cinit__"); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_v_tdata = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_bstruct_tdata.buf = NULL; + __pyx_bstruct_left_edge.buf = NULL; + __pyx_bstruct_right_edge.buf = NULL; + __pyx_bstruct_dims.buf = NULL; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left_edge), __pyx_ptype_5numpy_ndarray, 1, "left_edge", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right_edge), __pyx_ptype_5numpy_ndarray, 1, "right_edge", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dims), __pyx_ptype_5numpy_ndarray, 1, "dims", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_left_edge, (PyObject*)__pyx_v_left_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_left_edge = __pyx_bstruct_left_edge.strides[0]; + __pyx_bshape_0_left_edge = __pyx_bstruct_left_edge.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_right_edge, (PyObject*)__pyx_v_right_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_right_edge = __pyx_bstruct_right_edge.strides[0]; + __pyx_bshape_0_right_edge = __pyx_bstruct_right_edge.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dims, (PyObject*)__pyx_v_dims, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_dims = __pyx_bstruct_dims.strides[0]; + __pyx_bshape_0_dims = __pyx_bstruct_dims.shape[0]; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":323 + * cdef int i, j, k, size + * cdef np.ndarray[np.float64_t, ndim=3] tdata + * self.parent_grid_id = parent_grid_id # <<<<<<<<<<<<<< + * self.LeftEdge = left_edge + * self.RightEdge = right_edge + */ + ((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->parent_grid_id = __pyx_v_parent_grid_id; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":324 + * cdef np.ndarray[np.float64_t, ndim=3] tdata + * self.parent_grid_id = parent_grid_id + * self.LeftEdge = left_edge # <<<<<<<<<<<<<< + * self.RightEdge = right_edge + * for i in range(3): + */ + __Pyx_INCREF(((PyObject *)__pyx_v_left_edge)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_left_edge)); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->LeftEdge); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->LeftEdge); + ((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->LeftEdge = ((PyObject *)__pyx_v_left_edge); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":325 + * self.parent_grid_id = parent_grid_id + * self.LeftEdge = left_edge + * self.RightEdge = right_edge # <<<<<<<<<<<<<< + * for i in range(3): + * self.left_edge[i] = left_edge[i] + */ + __Pyx_INCREF(((PyObject *)__pyx_v_right_edge)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_right_edge)); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->RightEdge); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->RightEdge); + ((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->RightEdge = ((PyObject *)__pyx_v_right_edge); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":326 + * self.LeftEdge = left_edge + * self.RightEdge = right_edge + * for i in range(3): # <<<<<<<<<<<<<< + * self.left_edge[i] = left_edge[i] + * self.right_edge[i] = right_edge[i] + */ + for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":327 + * self.RightEdge = right_edge + * for i in range(3): + * self.left_edge[i] = left_edge[i] # <<<<<<<<<<<<<< + * self.right_edge[i] = right_edge[i] + * self.dims[i] = dims[i] + */ + __pyx_t_2 = __pyx_v_i; + (((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->left_edge[__pyx_v_i]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_2, __pyx_bstride_0_left_edge)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":328 + * for i in range(3): + * self.left_edge[i] = left_edge[i] + * self.right_edge[i] = right_edge[i] # <<<<<<<<<<<<<< + * self.dims[i] = dims[i] + * self.dds[i] = (self.right_edge[i] - self.left_edge[i])/dims[i] + */ + __pyx_t_3 = __pyx_v_i; + (((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->right_edge[__pyx_v_i]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_3, __pyx_bstride_0_right_edge)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":329 + * self.left_edge[i] = left_edge[i] + * self.right_edge[i] = right_edge[i] + * self.dims[i] = dims[i] # <<<<<<<<<<<<<< + * self.dds[i] = (self.right_edge[i] - self.left_edge[i])/dims[i] + * self.idds[i] = 1.0/self.dds[i] + */ + __pyx_t_4 = __pyx_v_i; + (((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->dims[__pyx_v_i]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_dims.buf, __pyx_t_4, __pyx_bstride_0_dims)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":330 + * self.right_edge[i] = right_edge[i] + * self.dims[i] = dims[i] + * self.dds[i] = (self.right_edge[i] - self.left_edge[i])/dims[i] # <<<<<<<<<<<<<< + * self.idds[i] = 1.0/self.dds[i] + * self.my_data = data + */ + __pyx_t_5 = ((((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->right_edge[__pyx_v_i]) - (((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->left_edge[__pyx_v_i])); + __pyx_t_6 = __pyx_v_i; + __pyx_t_7 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_dims.buf, __pyx_t_6, __pyx_bstride_0_dims)); + if (unlikely(__pyx_t_7 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + (((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->dds[__pyx_v_i]) = (__pyx_t_5 / __pyx_t_7); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":331 + * self.dims[i] = dims[i] + * self.dds[i] = (self.right_edge[i] - self.left_edge[i])/dims[i] + * self.idds[i] = 1.0/self.dds[i] # <<<<<<<<<<<<<< + * self.my_data = data + * self.n_fields = n_fields + */ + __pyx_t_5 = (((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->dds[__pyx_v_i]); + if (unlikely(__pyx_t_5 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + (((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->idds[__pyx_v_i]) = (1.0 / __pyx_t_5); + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":332 + * self.dds[i] = (self.right_edge[i] - self.left_edge[i])/dims[i] + * self.idds[i] = 1.0/self.dds[i] + * self.my_data = data # <<<<<<<<<<<<<< + * self.n_fields = n_fields + * for i in range(n_fields): + */ + __Pyx_INCREF(__pyx_v_data); + __Pyx_GIVEREF(__pyx_v_data); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->my_data); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->my_data); + ((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->my_data = __pyx_v_data; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":333 + * self.idds[i] = 1.0/self.dds[i] + * self.my_data = data + * self.n_fields = n_fields # <<<<<<<<<<<<<< + * for i in range(n_fields): + * tdata = data[i] + */ + ((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->n_fields = __pyx_v_n_fields; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":334 + * self.my_data = data + * self.n_fields = n_fields + * for i in range(n_fields): # <<<<<<<<<<<<<< + * tdata = data[i] + * self.data[i] = tdata.data + */ + __pyx_t_1 = __pyx_v_n_fields; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_1; __pyx_t_8+=1) { + __pyx_v_i = __pyx_t_8; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":335 + * self.n_fields = n_fields + * for i in range(n_fields): + * tdata = data[i] # <<<<<<<<<<<<<< + * self.data[i] = tdata.data + * + */ + __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_data, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = ((PyArrayObject *)__pyx_t_9); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_tdata); + __pyx_t_11 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_tdata, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack); + if (unlikely(__pyx_t_11 < 0)) { + PyErr_Fetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_tdata, (PyObject*)__pyx_v_tdata, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_12, __pyx_t_13, __pyx_t_14); + } + } + __pyx_bstride_0_tdata = __pyx_bstruct_tdata.strides[0]; __pyx_bstride_1_tdata = __pyx_bstruct_tdata.strides[1]; __pyx_bstride_2_tdata = __pyx_bstruct_tdata.strides[2]; + __pyx_bshape_0_tdata = __pyx_bstruct_tdata.shape[0]; __pyx_bshape_1_tdata = __pyx_bstruct_tdata.shape[1]; __pyx_bshape_2_tdata = __pyx_bstruct_tdata.shape[2]; + if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_tdata)); + __pyx_v_tdata = ((PyArrayObject *)__pyx_t_9); + __pyx_t_9 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":336 + * for i in range(n_fields): + * tdata = data[i] + * self.data[i] = tdata.data # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + (((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->data[__pyx_v_i]) = ((__pyx_t_5numpy_float64_t *)__pyx_v_tdata->data); + } + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_9); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_tdata); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_right_edge); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dims); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edge); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.amr_utils.PartitionedGrid.__cinit__"); + __pyx_r = -1; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_tdata); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_right_edge); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dims); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edge); + __pyx_L2:; + __Pyx_DECREF((PyObject *)__pyx_v_tdata); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":340 + * @cython.boundscheck(False) + * @cython.wraparound(False) + * def cast_plane(self, TransferFunctionProxy tf, VectorPlane vp): # <<<<<<<<<<<<<< + * # This routine will iterate over all of the vectors and cast each in + * # turn. Might benefit from a more sophisticated intersection check, + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_15PartitionedGrid_cast_plane(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_15PartitionedGrid_cast_plane(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *__pyx_v_tf = 0; + struct __pyx_obj_2yt_9amr_utils_VectorPlane *__pyx_v_vp = 0; + int __pyx_v_vi; + int __pyx_v_vj; + int __pyx_v_hit; + int __pyx_v_iter[4]; + __pyx_t_5numpy_float64_t __pyx_v_v_pos[3]; + __pyx_t_5numpy_float64_t __pyx_v_v_dir[3]; + __pyx_t_5numpy_float64_t __pyx_v_rgba[6]; + __pyx_t_5numpy_float64_t __pyx_v_extrema[4]; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tf,&__pyx_n_s__vp,0}; + __Pyx_RefNannySetupContext("cast_plane"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tf); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__vp); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("cast_plane", 1, 2, 2, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "cast_plane") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_tf = ((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)values[0]); + __pyx_v_vp = ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)values[1]); + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_tf = ((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)PyTuple_GET_ITEM(__pyx_args, 0)); + __pyx_v_vp = ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)PyTuple_GET_ITEM(__pyx_args, 1)); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("cast_plane", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.PartitionedGrid.cast_plane"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tf), __pyx_ptype_2yt_9amr_utils_TransferFunctionProxy, 1, "tf", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vp), __pyx_ptype_2yt_9amr_utils_VectorPlane, 1, "vp", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":347 + * cdef int iter[4] + * cdef np.float64_t v_pos[3], v_dir[3], rgba[6], extrema[4] + * hit = 0 # <<<<<<<<<<<<<< + * self.calculate_extent(vp, extrema) + * vp.get_start_stop(extrema, iter) + */ + __pyx_v_hit = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":348 + * cdef np.float64_t v_pos[3], v_dir[3], rgba[6], extrema[4] + * hit = 0 + * self.calculate_extent(vp, extrema) # <<<<<<<<<<<<<< + * vp.get_start_stop(extrema, iter) + * iter[0] = iclip(iter[0], 0, vp.nv[0]) + */ + ((struct __pyx_vtabstruct_2yt_9amr_utils_PartitionedGrid *)((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->__pyx_vtab)->calculate_extent(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self), __pyx_v_vp, __pyx_v_extrema); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":349 + * hit = 0 + * self.calculate_extent(vp, extrema) + * vp.get_start_stop(extrema, iter) # <<<<<<<<<<<<<< + * iter[0] = iclip(iter[0], 0, vp.nv[0]) + * iter[1] = iclip(iter[1], 0, vp.nv[0]) + */ + ((struct __pyx_vtabstruct_2yt_9amr_utils_VectorPlane *)__pyx_v_vp->__pyx_vtab)->get_start_stop(__pyx_v_vp, __pyx_v_extrema, __pyx_v_iter); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":350 + * self.calculate_extent(vp, extrema) + * vp.get_start_stop(extrema, iter) + * iter[0] = iclip(iter[0], 0, vp.nv[0]) # <<<<<<<<<<<<<< + * iter[1] = iclip(iter[1], 0, vp.nv[0]) + * iter[2] = iclip(iter[2], 0, vp.nv[1]) + */ + (__pyx_v_iter[0]) = __pyx_f_2yt_9amr_utils_iclip((__pyx_v_iter[0]), 0, (__pyx_v_vp->nv[0])); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":351 + * vp.get_start_stop(extrema, iter) + * iter[0] = iclip(iter[0], 0, vp.nv[0]) + * iter[1] = iclip(iter[1], 0, vp.nv[0]) # <<<<<<<<<<<<<< + * iter[2] = iclip(iter[2], 0, vp.nv[1]) + * iter[3] = iclip(iter[3], 0, vp.nv[1]) + */ + (__pyx_v_iter[1]) = __pyx_f_2yt_9amr_utils_iclip((__pyx_v_iter[1]), 0, (__pyx_v_vp->nv[0])); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":352 + * iter[0] = iclip(iter[0], 0, vp.nv[0]) + * iter[1] = iclip(iter[1], 0, vp.nv[0]) + * iter[2] = iclip(iter[2], 0, vp.nv[1]) # <<<<<<<<<<<<<< + * iter[3] = iclip(iter[3], 0, vp.nv[1]) + * if vp.vd_strides[0] == -1: + */ + (__pyx_v_iter[2]) = __pyx_f_2yt_9amr_utils_iclip((__pyx_v_iter[2]), 0, (__pyx_v_vp->nv[1])); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":353 + * iter[1] = iclip(iter[1], 0, vp.nv[0]) + * iter[2] = iclip(iter[2], 0, vp.nv[1]) + * iter[3] = iclip(iter[3], 0, vp.nv[1]) # <<<<<<<<<<<<<< + * if vp.vd_strides[0] == -1: + * for vi in range(iter[0], iter[1]): + */ + (__pyx_v_iter[3]) = __pyx_f_2yt_9amr_utils_iclip((__pyx_v_iter[3]), 0, (__pyx_v_vp->nv[1])); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":354 + * iter[2] = iclip(iter[2], 0, vp.nv[1]) + * iter[3] = iclip(iter[3], 0, vp.nv[1]) + * if vp.vd_strides[0] == -1: # <<<<<<<<<<<<<< + * for vi in range(iter[0], iter[1]): + * for vj in range(iter[2], iter[3]): + */ + __pyx_t_1 = ((__pyx_v_vp->vd_strides[0]) == -1); + if (__pyx_t_1) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":355 + * iter[3] = iclip(iter[3], 0, vp.nv[1]) + * if vp.vd_strides[0] == -1: + * for vi in range(iter[0], iter[1]): # <<<<<<<<<<<<<< + * for vj in range(iter[2], iter[3]): + * vp.copy_into(vp.vp_pos, v_pos, vi, vj, 3, vp.vp_strides) + */ + __pyx_t_2 = (__pyx_v_iter[1]); + for (__pyx_t_3 = (__pyx_v_iter[0]); __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_vi = __pyx_t_3; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":356 + * if vp.vd_strides[0] == -1: + * for vi in range(iter[0], iter[1]): + * for vj in range(iter[2], iter[3]): # <<<<<<<<<<<<<< + * vp.copy_into(vp.vp_pos, v_pos, vi, vj, 3, vp.vp_strides) + * vp.copy_into(vp.image, rgba, vi, vj, 3, vp.im_strides) + */ + __pyx_t_4 = (__pyx_v_iter[3]); + for (__pyx_t_5 = (__pyx_v_iter[2]); __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_vj = __pyx_t_5; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":357 + * for vi in range(iter[0], iter[1]): + * for vj in range(iter[2], iter[3]): + * vp.copy_into(vp.vp_pos, v_pos, vi, vj, 3, vp.vp_strides) # <<<<<<<<<<<<<< + * vp.copy_into(vp.image, rgba, vi, vj, 3, vp.im_strides) + * self.integrate_ray(v_pos, vp.vp_dir, rgba, tf) + */ + ((struct __pyx_vtabstruct_2yt_9amr_utils_VectorPlane *)__pyx_v_vp->__pyx_vtab)->copy_into(__pyx_v_vp, __pyx_v_vp->vp_pos, __pyx_v_v_pos, __pyx_v_vi, __pyx_v_vj, 3, __pyx_v_vp->vp_strides); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":358 + * for vj in range(iter[2], iter[3]): + * vp.copy_into(vp.vp_pos, v_pos, vi, vj, 3, vp.vp_strides) + * vp.copy_into(vp.image, rgba, vi, vj, 3, vp.im_strides) # <<<<<<<<<<<<<< + * self.integrate_ray(v_pos, vp.vp_dir, rgba, tf) + * vp.copy_back(rgba, vp.image, vi, vj, 3, vp.im_strides) + */ + ((struct __pyx_vtabstruct_2yt_9amr_utils_VectorPlane *)__pyx_v_vp->__pyx_vtab)->copy_into(__pyx_v_vp, __pyx_v_vp->image, __pyx_v_rgba, __pyx_v_vi, __pyx_v_vj, 3, __pyx_v_vp->im_strides); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":359 + * vp.copy_into(vp.vp_pos, v_pos, vi, vj, 3, vp.vp_strides) + * vp.copy_into(vp.image, rgba, vi, vj, 3, vp.im_strides) + * self.integrate_ray(v_pos, vp.vp_dir, rgba, tf) # <<<<<<<<<<<<<< + * vp.copy_back(rgba, vp.image, vi, vj, 3, vp.im_strides) + * else: + */ + ((struct __pyx_vtabstruct_2yt_9amr_utils_PartitionedGrid *)((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->__pyx_vtab)->integrate_ray(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self), __pyx_v_v_pos, __pyx_v_vp->vp_dir, __pyx_v_rgba, __pyx_v_tf); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":360 + * vp.copy_into(vp.image, rgba, vi, vj, 3, vp.im_strides) + * self.integrate_ray(v_pos, vp.vp_dir, rgba, tf) + * vp.copy_back(rgba, vp.image, vi, vj, 3, vp.im_strides) # <<<<<<<<<<<<<< + * else: + * # If we do not have an orthographic projection, we have to cast all + */ + ((struct __pyx_vtabstruct_2yt_9amr_utils_VectorPlane *)__pyx_v_vp->__pyx_vtab)->copy_back(__pyx_v_vp, __pyx_v_rgba, __pyx_v_vp->image, __pyx_v_vi, __pyx_v_vj, 3, __pyx_v_vp->im_strides); + } + } + goto __pyx_L6; + } + /*else*/ { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":364 + * # If we do not have an orthographic projection, we have to cast all + * # our rays (until we can get an extrema calculation...) + * for vi in range(vp.nv[0]): # <<<<<<<<<<<<<< + * for vj in range(vp.nv[1]): + * vp.copy_into(vp.vp_pos, v_pos, vi, vj, 3, vp.vp_strides) + */ + __pyx_t_2 = (__pyx_v_vp->nv[0]); + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_vi = __pyx_t_3; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":365 + * # our rays (until we can get an extrema calculation...) + * for vi in range(vp.nv[0]): + * for vj in range(vp.nv[1]): # <<<<<<<<<<<<<< + * vp.copy_into(vp.vp_pos, v_pos, vi, vj, 3, vp.vp_strides) + * vp.copy_into(vp.image, rgba, vi, vj, 3, vp.im_strides) + */ + __pyx_t_4 = (__pyx_v_vp->nv[1]); + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_vj = __pyx_t_5; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":366 + * for vi in range(vp.nv[0]): + * for vj in range(vp.nv[1]): + * vp.copy_into(vp.vp_pos, v_pos, vi, vj, 3, vp.vp_strides) # <<<<<<<<<<<<<< + * vp.copy_into(vp.image, rgba, vi, vj, 3, vp.im_strides) + * vp.copy_into(vp.vp_dir, v_dir, vi, vj, 3, vp.vd_strides) + */ + ((struct __pyx_vtabstruct_2yt_9amr_utils_VectorPlane *)__pyx_v_vp->__pyx_vtab)->copy_into(__pyx_v_vp, __pyx_v_vp->vp_pos, __pyx_v_v_pos, __pyx_v_vi, __pyx_v_vj, 3, __pyx_v_vp->vp_strides); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":367 + * for vj in range(vp.nv[1]): + * vp.copy_into(vp.vp_pos, v_pos, vi, vj, 3, vp.vp_strides) + * vp.copy_into(vp.image, rgba, vi, vj, 3, vp.im_strides) # <<<<<<<<<<<<<< + * vp.copy_into(vp.vp_dir, v_dir, vi, vj, 3, vp.vd_strides) + * self.integrate_ray(v_pos, v_dir, rgba, tf) + */ + ((struct __pyx_vtabstruct_2yt_9amr_utils_VectorPlane *)__pyx_v_vp->__pyx_vtab)->copy_into(__pyx_v_vp, __pyx_v_vp->image, __pyx_v_rgba, __pyx_v_vi, __pyx_v_vj, 3, __pyx_v_vp->im_strides); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":368 + * vp.copy_into(vp.vp_pos, v_pos, vi, vj, 3, vp.vp_strides) + * vp.copy_into(vp.image, rgba, vi, vj, 3, vp.im_strides) + * vp.copy_into(vp.vp_dir, v_dir, vi, vj, 3, vp.vd_strides) # <<<<<<<<<<<<<< + * self.integrate_ray(v_pos, v_dir, rgba, tf) + * vp.copy_back(rgba, vp.image, vi, vj, 3, vp.im_strides) + */ + ((struct __pyx_vtabstruct_2yt_9amr_utils_VectorPlane *)__pyx_v_vp->__pyx_vtab)->copy_into(__pyx_v_vp, __pyx_v_vp->vp_dir, __pyx_v_v_dir, __pyx_v_vi, __pyx_v_vj, 3, __pyx_v_vp->vd_strides); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":369 + * vp.copy_into(vp.image, rgba, vi, vj, 3, vp.im_strides) + * vp.copy_into(vp.vp_dir, v_dir, vi, vj, 3, vp.vd_strides) + * self.integrate_ray(v_pos, v_dir, rgba, tf) # <<<<<<<<<<<<<< + * vp.copy_back(rgba, vp.image, vi, vj, 3, vp.im_strides) + * return hit + */ + ((struct __pyx_vtabstruct_2yt_9amr_utils_PartitionedGrid *)((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self)->__pyx_vtab)->integrate_ray(((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self), __pyx_v_v_pos, __pyx_v_v_dir, __pyx_v_rgba, __pyx_v_tf); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":370 + * vp.copy_into(vp.vp_dir, v_dir, vi, vj, 3, vp.vd_strides) + * self.integrate_ray(v_pos, v_dir, rgba, tf) + * vp.copy_back(rgba, vp.image, vi, vj, 3, vp.im_strides) # <<<<<<<<<<<<<< + * return hit + * + */ + ((struct __pyx_vtabstruct_2yt_9amr_utils_VectorPlane *)__pyx_v_vp->__pyx_vtab)->copy_back(__pyx_v_vp, __pyx_v_rgba, __pyx_v_vp->image, __pyx_v_vi, __pyx_v_vj, 3, __pyx_v_vp->im_strides); + } + } + } + __pyx_L6:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":371 + * self.integrate_ray(v_pos, v_dir, rgba, tf) + * vp.copy_back(rgba, vp.image, vi, vj, 3, vp.im_strides) + * return hit # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_6 = PyInt_FromLong(__pyx_v_hit); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("yt.amr_utils.PartitionedGrid.cast_plane"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":375 + * @cython.boundscheck(False) + * @cython.wraparound(False) + * cdef void calculate_extent(self, VectorPlane vp, # <<<<<<<<<<<<<< + * np.float64_t extrema[4]): + * # We do this for all eight corners + */ + +static void __pyx_f_2yt_9amr_utils_15PartitionedGrid_calculate_extent(struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *__pyx_v_self, struct __pyx_obj_2yt_9amr_utils_VectorPlane *__pyx_v_vp, __pyx_t_5numpy_float64_t *__pyx_v_extrema) { + __pyx_t_5numpy_float64_t *__pyx_v_edges[2]; + __pyx_t_5numpy_float64_t __pyx_v_temp; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_k; + double __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + __Pyx_RefNannySetupContext("calculate_extent"); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":379 + * # We do this for all eight corners + * cdef np.float64_t *edges[2], temp + * edges[0] = self.left_edge # <<<<<<<<<<<<<< + * edges[1] = self.right_edge + * extrema[0] = extrema[2] = 1e300; extrema[1] = extrema[3] = -1e300 + */ + (__pyx_v_edges[0]) = __pyx_v_self->left_edge; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":380 + * cdef np.float64_t *edges[2], temp + * edges[0] = self.left_edge + * edges[1] = self.right_edge # <<<<<<<<<<<<<< + * extrema[0] = extrema[2] = 1e300; extrema[1] = extrema[3] = -1e300 + * cdef int i, j, k + */ + (__pyx_v_edges[1]) = __pyx_v_self->right_edge; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":381 + * edges[0] = self.left_edge + * edges[1] = self.right_edge + * extrema[0] = extrema[2] = 1e300; extrema[1] = extrema[3] = -1e300 # <<<<<<<<<<<<<< + * cdef int i, j, k + * for i in range(2): + */ + (__pyx_v_extrema[0]) = 1e300; + (__pyx_v_extrema[2]) = 1e300; + __pyx_t_1 = (-1e300); + (__pyx_v_extrema[1]) = __pyx_t_1; + (__pyx_v_extrema[3]) = __pyx_t_1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":383 + * extrema[0] = extrema[2] = 1e300; extrema[1] = extrema[3] = -1e300 + * cdef int i, j, k + * for i in range(2): # <<<<<<<<<<<<<< + * for j in range(2): + * for k in range(2): + */ + for (__pyx_t_2 = 0; __pyx_t_2 < 2; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":384 + * cdef int i, j, k + * for i in range(2): + * for j in range(2): # <<<<<<<<<<<<<< + * for k in range(2): + * # This should rotate it into the vector plane + */ + for (__pyx_t_3 = 0; __pyx_t_3 < 2; __pyx_t_3+=1) { + __pyx_v_j = __pyx_t_3; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":385 + * for i in range(2): + * for j in range(2): + * for k in range(2): # <<<<<<<<<<<<<< + * # This should rotate it into the vector plane + * temp = edges[i][0] * vp.x_vec[0] + */ + for (__pyx_t_4 = 0; __pyx_t_4 < 2; __pyx_t_4+=1) { + __pyx_v_k = __pyx_t_4; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":387 + * for k in range(2): + * # This should rotate it into the vector plane + * temp = edges[i][0] * vp.x_vec[0] # <<<<<<<<<<<<<< + * temp += edges[j][1] * vp.x_vec[1] + * temp += edges[k][2] * vp.x_vec[2] + */ + __pyx_v_temp = (((__pyx_v_edges[__pyx_v_i])[0]) * (__pyx_v_vp->x_vec[0])); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":388 + * # This should rotate it into the vector plane + * temp = edges[i][0] * vp.x_vec[0] + * temp += edges[j][1] * vp.x_vec[1] # <<<<<<<<<<<<<< + * temp += edges[k][2] * vp.x_vec[2] + * if temp < extrema[0]: extrema[0] = temp + */ + __pyx_v_temp += (((__pyx_v_edges[__pyx_v_j])[1]) * (__pyx_v_vp->x_vec[1])); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":389 + * temp = edges[i][0] * vp.x_vec[0] + * temp += edges[j][1] * vp.x_vec[1] + * temp += edges[k][2] * vp.x_vec[2] # <<<<<<<<<<<<<< + * if temp < extrema[0]: extrema[0] = temp + * if temp > extrema[1]: extrema[1] = temp + */ + __pyx_v_temp += (((__pyx_v_edges[__pyx_v_k])[2]) * (__pyx_v_vp->x_vec[2])); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":390 + * temp += edges[j][1] * vp.x_vec[1] + * temp += edges[k][2] * vp.x_vec[2] + * if temp < extrema[0]: extrema[0] = temp # <<<<<<<<<<<<<< + * if temp > extrema[1]: extrema[1] = temp + * temp = edges[i][0] * vp.y_vec[0] + */ + __pyx_t_5 = (__pyx_v_temp < (__pyx_v_extrema[0])); + if (__pyx_t_5) { + (__pyx_v_extrema[0]) = __pyx_v_temp; + goto __pyx_L9; + } + __pyx_L9:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":391 + * temp += edges[k][2] * vp.x_vec[2] + * if temp < extrema[0]: extrema[0] = temp + * if temp > extrema[1]: extrema[1] = temp # <<<<<<<<<<<<<< + * temp = edges[i][0] * vp.y_vec[0] + * temp += edges[j][1] * vp.y_vec[1] + */ + __pyx_t_5 = (__pyx_v_temp > (__pyx_v_extrema[1])); + if (__pyx_t_5) { + (__pyx_v_extrema[1]) = __pyx_v_temp; + goto __pyx_L10; + } + __pyx_L10:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":392 + * if temp < extrema[0]: extrema[0] = temp + * if temp > extrema[1]: extrema[1] = temp + * temp = edges[i][0] * vp.y_vec[0] # <<<<<<<<<<<<<< + * temp += edges[j][1] * vp.y_vec[1] + * temp += edges[k][2] * vp.y_vec[2] + */ + __pyx_v_temp = (((__pyx_v_edges[__pyx_v_i])[0]) * (__pyx_v_vp->y_vec[0])); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":393 + * if temp > extrema[1]: extrema[1] = temp + * temp = edges[i][0] * vp.y_vec[0] + * temp += edges[j][1] * vp.y_vec[1] # <<<<<<<<<<<<<< + * temp += edges[k][2] * vp.y_vec[2] + * if temp < extrema[2]: extrema[2] = temp + */ + __pyx_v_temp += (((__pyx_v_edges[__pyx_v_j])[1]) * (__pyx_v_vp->y_vec[1])); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":394 + * temp = edges[i][0] * vp.y_vec[0] + * temp += edges[j][1] * vp.y_vec[1] + * temp += edges[k][2] * vp.y_vec[2] # <<<<<<<<<<<<<< + * if temp < extrema[2]: extrema[2] = temp + * if temp > extrema[3]: extrema[3] = temp + */ + __pyx_v_temp += (((__pyx_v_edges[__pyx_v_k])[2]) * (__pyx_v_vp->y_vec[2])); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":395 + * temp += edges[j][1] * vp.y_vec[1] + * temp += edges[k][2] * vp.y_vec[2] + * if temp < extrema[2]: extrema[2] = temp # <<<<<<<<<<<<<< + * if temp > extrema[3]: extrema[3] = temp + * #print extrema[0], extrema[1], extrema[2], extrema[3] + */ + __pyx_t_5 = (__pyx_v_temp < (__pyx_v_extrema[2])); + if (__pyx_t_5) { + (__pyx_v_extrema[2]) = __pyx_v_temp; + goto __pyx_L11; + } + __pyx_L11:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":396 + * temp += edges[k][2] * vp.y_vec[2] + * if temp < extrema[2]: extrema[2] = temp + * if temp > extrema[3]: extrema[3] = temp # <<<<<<<<<<<<<< + * #print extrema[0], extrema[1], extrema[2], extrema[3] + * + */ + __pyx_t_5 = (__pyx_v_temp > (__pyx_v_extrema[3])); + if (__pyx_t_5) { + (__pyx_v_extrema[3]) = __pyx_v_temp; + goto __pyx_L12; + } + __pyx_L12:; + } + } + } + + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":401 + * @cython.boundscheck(False) + * @cython.wraparound(False) + * cdef int integrate_ray(self, np.float64_t v_pos[3], # <<<<<<<<<<<<<< + * np.float64_t v_dir[3], + * np.float64_t rgba[4], + */ + +static int __pyx_f_2yt_9amr_utils_15PartitionedGrid_integrate_ray(struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *__pyx_v_self, __pyx_t_5numpy_float64_t *__pyx_v_v_pos, __pyx_t_5numpy_float64_t *__pyx_v_v_dir, __pyx_t_5numpy_float64_t *__pyx_v_rgba, struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *__pyx_v_tf) { + int __pyx_v_cur_ind[3]; + int __pyx_v_step[3]; + int __pyx_v_x; + int __pyx_v_y; + int __pyx_v_i; + int __pyx_v_hit; + int __pyx_v_direction; + __pyx_t_5numpy_float64_t __pyx_v_intersect_t; + __pyx_t_5numpy_float64_t __pyx_v_iv_dir[3]; + __pyx_t_5numpy_float64_t __pyx_v_intersect[3]; + __pyx_t_5numpy_float64_t __pyx_v_tmax[3]; + __pyx_t_5numpy_float64_t __pyx_v_tdelta[3]; + __pyx_t_5numpy_float64_t __pyx_v_enter_t; + __pyx_t_5numpy_float64_t __pyx_v_exit_t; + __pyx_t_5numpy_float64_t __pyx_v_tr; + __pyx_t_5numpy_float64_t __pyx_v_tl; + __pyx_t_5numpy_float64_t __pyx_v_temp_x; + __pyx_t_5numpy_float64_t __pyx_v_temp_y; + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + __pyx_t_5numpy_float64_t __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + __Pyx_RefNannySetupContext("integrate_ray"); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":406 + * TransferFunctionProxy tf): + * cdef int cur_ind[3], step[3], x, y, i, n, flat_ind, hit, direction + * cdef np.float64_t intersect_t = 1.0 # <<<<<<<<<<<<<< + * cdef np.float64_t iv_dir[3] + * cdef np.float64_t intersect[3], tmax[3], tdelta[3] + */ + __pyx_v_intersect_t = 1.0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":411 + * cdef np.float64_t enter_t, dist, alpha, dt, exit_t + * cdef np.float64_t tr, tl, temp_x, temp_y, dv + * for i in range(3): # <<<<<<<<<<<<<< + * if (v_dir[i] < 0): + * step[i] = -1 + */ + for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":412 + * cdef np.float64_t tr, tl, temp_x, temp_y, dv + * for i in range(3): + * if (v_dir[i] < 0): # <<<<<<<<<<<<<< + * step[i] = -1 + * elif (v_dir[i] == 0): + */ + __pyx_t_2 = ((__pyx_v_v_dir[__pyx_v_i]) < 0.0); + if (__pyx_t_2) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":413 + * for i in range(3): + * if (v_dir[i] < 0): + * step[i] = -1 # <<<<<<<<<<<<<< + * elif (v_dir[i] == 0): + * step[i] = 1 + */ + (__pyx_v_step[__pyx_v_i]) = -1; + goto __pyx_L5; + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":414 + * if (v_dir[i] < 0): + * step[i] = -1 + * elif (v_dir[i] == 0): # <<<<<<<<<<<<<< + * step[i] = 1 + * tmax[i] = 1e60 + */ + __pyx_t_2 = ((__pyx_v_v_dir[__pyx_v_i]) == 0.0); + if (__pyx_t_2) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":415 + * step[i] = -1 + * elif (v_dir[i] == 0): + * step[i] = 1 # <<<<<<<<<<<<<< + * tmax[i] = 1e60 + * iv_dir[i] = 1e60 + */ + (__pyx_v_step[__pyx_v_i]) = 1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":416 + * elif (v_dir[i] == 0): + * step[i] = 1 + * tmax[i] = 1e60 # <<<<<<<<<<<<<< + * iv_dir[i] = 1e60 + * tdelta[i] = 1e-60 + */ + (__pyx_v_tmax[__pyx_v_i]) = 1e60; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":417 + * step[i] = 1 + * tmax[i] = 1e60 + * iv_dir[i] = 1e60 # <<<<<<<<<<<<<< + * tdelta[i] = 1e-60 + * continue + */ + (__pyx_v_iv_dir[__pyx_v_i]) = 1e60; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":418 + * tmax[i] = 1e60 + * iv_dir[i] = 1e60 + * tdelta[i] = 1e-60 # <<<<<<<<<<<<<< + * continue + * else: + */ + (__pyx_v_tdelta[__pyx_v_i]) = 1e-60; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":419 + * iv_dir[i] = 1e60 + * tdelta[i] = 1e-60 + * continue # <<<<<<<<<<<<<< + * else: + * step[i] = 1 + */ + goto __pyx_L3_continue; + goto __pyx_L5; + } + /*else*/ { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":421 + * continue + * else: + * step[i] = 1 # <<<<<<<<<<<<<< + * x = (i+1) % 3 + * y = (i+2) % 3 + */ + (__pyx_v_step[__pyx_v_i]) = 1; + } + __pyx_L5:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":422 + * else: + * step[i] = 1 + * x = (i+1) % 3 # <<<<<<<<<<<<<< + * y = (i+2) % 3 + * iv_dir[i] = 1.0/v_dir[i] + */ + __pyx_v_x = __Pyx_mod_long((__pyx_v_i + 1), 3); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":423 + * step[i] = 1 + * x = (i+1) % 3 + * y = (i+2) % 3 # <<<<<<<<<<<<<< + * iv_dir[i] = 1.0/v_dir[i] + * tl = (self.left_edge[i] - v_pos[i])*iv_dir[i] + */ + __pyx_v_y = __Pyx_mod_long((__pyx_v_i + 2), 3); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":424 + * x = (i+1) % 3 + * y = (i+2) % 3 + * iv_dir[i] = 1.0/v_dir[i] # <<<<<<<<<<<<<< + * tl = (self.left_edge[i] - v_pos[i])*iv_dir[i] + * temp_x = (v_pos[x] + tl*v_dir[x]) + */ + __pyx_t_3 = (__pyx_v_v_dir[__pyx_v_i]); + if (unlikely(__pyx_t_3 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + (__pyx_v_iv_dir[__pyx_v_i]) = (1.0 / __pyx_t_3); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":425 + * y = (i+2) % 3 + * iv_dir[i] = 1.0/v_dir[i] + * tl = (self.left_edge[i] - v_pos[i])*iv_dir[i] # <<<<<<<<<<<<<< + * temp_x = (v_pos[x] + tl*v_dir[x]) + * temp_y = (v_pos[y] + tl*v_dir[y]) + */ + __pyx_v_tl = (((__pyx_v_self->left_edge[__pyx_v_i]) - (__pyx_v_v_pos[__pyx_v_i])) * (__pyx_v_iv_dir[__pyx_v_i])); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":426 + * iv_dir[i] = 1.0/v_dir[i] + * tl = (self.left_edge[i] - v_pos[i])*iv_dir[i] + * temp_x = (v_pos[x] + tl*v_dir[x]) # <<<<<<<<<<<<<< + * temp_y = (v_pos[y] + tl*v_dir[y]) + * if self.left_edge[x] <= temp_x and temp_x <= self.right_edge[x] and \ + */ + __pyx_v_temp_x = ((__pyx_v_v_pos[__pyx_v_x]) + (__pyx_v_tl * (__pyx_v_v_dir[__pyx_v_x]))); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":427 + * tl = (self.left_edge[i] - v_pos[i])*iv_dir[i] + * temp_x = (v_pos[x] + tl*v_dir[x]) + * temp_y = (v_pos[y] + tl*v_dir[y]) # <<<<<<<<<<<<<< + * if self.left_edge[x] <= temp_x and temp_x <= self.right_edge[x] and \ + * self.left_edge[y] <= temp_y and temp_y <= self.right_edge[y] and \ + */ + __pyx_v_temp_y = ((__pyx_v_v_pos[__pyx_v_y]) + (__pyx_v_tl * (__pyx_v_v_dir[__pyx_v_y]))); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":428 + * temp_x = (v_pos[x] + tl*v_dir[x]) + * temp_y = (v_pos[y] + tl*v_dir[y]) + * if self.left_edge[x] <= temp_x and temp_x <= self.right_edge[x] and \ # <<<<<<<<<<<<<< + * self.left_edge[y] <= temp_y and temp_y <= self.right_edge[y] and \ + * 0.0 <= tl and tl < intersect_t: + */ + __pyx_t_2 = ((__pyx_v_self->left_edge[__pyx_v_x]) <= __pyx_v_temp_x); + if (__pyx_t_2) { + __pyx_t_4 = (__pyx_v_temp_x <= (__pyx_v_self->right_edge[__pyx_v_x])); + if (__pyx_t_4) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":429 + * temp_y = (v_pos[y] + tl*v_dir[y]) + * if self.left_edge[x] <= temp_x and temp_x <= self.right_edge[x] and \ + * self.left_edge[y] <= temp_y and temp_y <= self.right_edge[y] and \ # <<<<<<<<<<<<<< + * 0.0 <= tl and tl < intersect_t: + * direction = i + */ + __pyx_t_5 = ((__pyx_v_self->left_edge[__pyx_v_y]) <= __pyx_v_temp_y); + if (__pyx_t_5) { + __pyx_t_6 = (__pyx_v_temp_y <= (__pyx_v_self->right_edge[__pyx_v_y])); + if (__pyx_t_6) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":430 + * if self.left_edge[x] <= temp_x and temp_x <= self.right_edge[x] and \ + * self.left_edge[y] <= temp_y and temp_y <= self.right_edge[y] and \ + * 0.0 <= tl and tl < intersect_t: # <<<<<<<<<<<<<< + * direction = i + * intersect_t = tl + */ + __pyx_t_7 = (0.0 <= __pyx_v_tl); + if (__pyx_t_7) { + __pyx_t_8 = (__pyx_v_tl < __pyx_v_intersect_t); + __pyx_t_9 = __pyx_t_8; + } else { + __pyx_t_9 = __pyx_t_7; + } + __pyx_t_7 = __pyx_t_9; + } else { + __pyx_t_7 = __pyx_t_6; + } + __pyx_t_6 = __pyx_t_7; + } else { + __pyx_t_6 = __pyx_t_5; + } + __pyx_t_5 = __pyx_t_6; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_t_4 = __pyx_t_5; + } else { + __pyx_t_4 = __pyx_t_2; + } + if (__pyx_t_4) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":431 + * self.left_edge[y] <= temp_y and temp_y <= self.right_edge[y] and \ + * 0.0 <= tl and tl < intersect_t: + * direction = i # <<<<<<<<<<<<<< + * intersect_t = tl + * tr = (self.right_edge[i] - v_pos[i])*iv_dir[i] + */ + __pyx_v_direction = __pyx_v_i; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":432 + * 0.0 <= tl and tl < intersect_t: + * direction = i + * intersect_t = tl # <<<<<<<<<<<<<< + * tr = (self.right_edge[i] - v_pos[i])*iv_dir[i] + * temp_x = (v_pos[x] + tr*v_dir[x]) + */ + __pyx_v_intersect_t = __pyx_v_tl; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":433 + * direction = i + * intersect_t = tl + * tr = (self.right_edge[i] - v_pos[i])*iv_dir[i] # <<<<<<<<<<<<<< + * temp_x = (v_pos[x] + tr*v_dir[x]) + * temp_y = (v_pos[y] + tr*v_dir[y]) + */ + __pyx_v_tr = (((__pyx_v_self->right_edge[__pyx_v_i]) - (__pyx_v_v_pos[__pyx_v_i])) * (__pyx_v_iv_dir[__pyx_v_i])); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":434 + * intersect_t = tl + * tr = (self.right_edge[i] - v_pos[i])*iv_dir[i] + * temp_x = (v_pos[x] + tr*v_dir[x]) # <<<<<<<<<<<<<< + * temp_y = (v_pos[y] + tr*v_dir[y]) + * if self.left_edge[x] <= temp_x and temp_x <= self.right_edge[x] and \ + */ + __pyx_v_temp_x = ((__pyx_v_v_pos[__pyx_v_x]) + (__pyx_v_tr * (__pyx_v_v_dir[__pyx_v_x]))); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":435 + * tr = (self.right_edge[i] - v_pos[i])*iv_dir[i] + * temp_x = (v_pos[x] + tr*v_dir[x]) + * temp_y = (v_pos[y] + tr*v_dir[y]) # <<<<<<<<<<<<<< + * if self.left_edge[x] <= temp_x and temp_x <= self.right_edge[x] and \ + * self.left_edge[y] <= temp_y and temp_y <= self.right_edge[y] and \ + */ + __pyx_v_temp_y = ((__pyx_v_v_pos[__pyx_v_y]) + (__pyx_v_tr * (__pyx_v_v_dir[__pyx_v_y]))); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":436 + * temp_x = (v_pos[x] + tr*v_dir[x]) + * temp_y = (v_pos[y] + tr*v_dir[y]) + * if self.left_edge[x] <= temp_x and temp_x <= self.right_edge[x] and \ # <<<<<<<<<<<<<< + * self.left_edge[y] <= temp_y and temp_y <= self.right_edge[y] and \ + * 0.0 <= tr and tr < intersect_t: + */ + __pyx_t_4 = ((__pyx_v_self->left_edge[__pyx_v_x]) <= __pyx_v_temp_x); + if (__pyx_t_4) { + __pyx_t_2 = (__pyx_v_temp_x <= (__pyx_v_self->right_edge[__pyx_v_x])); + if (__pyx_t_2) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":437 + * temp_y = (v_pos[y] + tr*v_dir[y]) + * if self.left_edge[x] <= temp_x and temp_x <= self.right_edge[x] and \ + * self.left_edge[y] <= temp_y and temp_y <= self.right_edge[y] and \ # <<<<<<<<<<<<<< + * 0.0 <= tr and tr < intersect_t: + * direction = i + */ + __pyx_t_5 = ((__pyx_v_self->left_edge[__pyx_v_y]) <= __pyx_v_temp_y); + if (__pyx_t_5) { + __pyx_t_6 = (__pyx_v_temp_y <= (__pyx_v_self->right_edge[__pyx_v_y])); + if (__pyx_t_6) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":438 + * if self.left_edge[x] <= temp_x and temp_x <= self.right_edge[x] and \ + * self.left_edge[y] <= temp_y and temp_y <= self.right_edge[y] and \ + * 0.0 <= tr and tr < intersect_t: # <<<<<<<<<<<<<< + * direction = i + * intersect_t = tr + */ + __pyx_t_7 = (0.0 <= __pyx_v_tr); + if (__pyx_t_7) { + __pyx_t_9 = (__pyx_v_tr < __pyx_v_intersect_t); + __pyx_t_8 = __pyx_t_9; + } else { + __pyx_t_8 = __pyx_t_7; + } + __pyx_t_7 = __pyx_t_8; + } else { + __pyx_t_7 = __pyx_t_6; + } + __pyx_t_6 = __pyx_t_7; + } else { + __pyx_t_6 = __pyx_t_5; + } + __pyx_t_5 = __pyx_t_6; + } else { + __pyx_t_5 = __pyx_t_2; + } + __pyx_t_2 = __pyx_t_5; + } else { + __pyx_t_2 = __pyx_t_4; + } + if (__pyx_t_2) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":439 + * self.left_edge[y] <= temp_y and temp_y <= self.right_edge[y] and \ + * 0.0 <= tr and tr < intersect_t: + * direction = i # <<<<<<<<<<<<<< + * intersect_t = tr + * if self.left_edge[0] <= v_pos[0] and v_pos[0] <= self.right_edge[0] and \ + */ + __pyx_v_direction = __pyx_v_i; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":440 + * 0.0 <= tr and tr < intersect_t: + * direction = i + * intersect_t = tr # <<<<<<<<<<<<<< + * if self.left_edge[0] <= v_pos[0] and v_pos[0] <= self.right_edge[0] and \ + * self.left_edge[1] <= v_pos[1] and v_pos[1] <= self.right_edge[1] and \ + */ + __pyx_v_intersect_t = __pyx_v_tr; + goto __pyx_L7; + } + __pyx_L7:; + __pyx_L3_continue:; + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":441 + * direction = i + * intersect_t = tr + * if self.left_edge[0] <= v_pos[0] and v_pos[0] <= self.right_edge[0] and \ # <<<<<<<<<<<<<< + * self.left_edge[1] <= v_pos[1] and v_pos[1] <= self.right_edge[1] and \ + * self.left_edge[2] <= v_pos[2] and v_pos[2] <= self.right_edge[2]: + */ + __pyx_t_2 = ((__pyx_v_self->left_edge[0]) <= (__pyx_v_v_pos[0])); + if (__pyx_t_2) { + __pyx_t_4 = ((__pyx_v_v_pos[0]) <= (__pyx_v_self->right_edge[0])); + if (__pyx_t_4) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":442 + * intersect_t = tr + * if self.left_edge[0] <= v_pos[0] and v_pos[0] <= self.right_edge[0] and \ + * self.left_edge[1] <= v_pos[1] and v_pos[1] <= self.right_edge[1] and \ # <<<<<<<<<<<<<< + * self.left_edge[2] <= v_pos[2] and v_pos[2] <= self.right_edge[2]: + * intersect_t = 0.0 + */ + __pyx_t_5 = ((__pyx_v_self->left_edge[1]) <= (__pyx_v_v_pos[1])); + if (__pyx_t_5) { + __pyx_t_6 = ((__pyx_v_v_pos[1]) <= (__pyx_v_self->right_edge[1])); + if (__pyx_t_6) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":443 + * if self.left_edge[0] <= v_pos[0] and v_pos[0] <= self.right_edge[0] and \ + * self.left_edge[1] <= v_pos[1] and v_pos[1] <= self.right_edge[1] and \ + * self.left_edge[2] <= v_pos[2] and v_pos[2] <= self.right_edge[2]: # <<<<<<<<<<<<<< + * intersect_t = 0.0 + * if not ((0.0 <= intersect_t) and (intersect_t < 1.0)): return 0 + */ + __pyx_t_7 = ((__pyx_v_self->left_edge[2]) <= (__pyx_v_v_pos[2])); + if (__pyx_t_7) { + __pyx_t_8 = ((__pyx_v_v_pos[2]) <= (__pyx_v_self->right_edge[2])); + __pyx_t_9 = __pyx_t_8; + } else { + __pyx_t_9 = __pyx_t_7; + } + __pyx_t_7 = __pyx_t_9; + } else { + __pyx_t_7 = __pyx_t_6; + } + __pyx_t_6 = __pyx_t_7; + } else { + __pyx_t_6 = __pyx_t_5; + } + __pyx_t_5 = __pyx_t_6; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_t_4 = __pyx_t_5; + } else { + __pyx_t_4 = __pyx_t_2; + } + if (__pyx_t_4) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":444 + * self.left_edge[1] <= v_pos[1] and v_pos[1] <= self.right_edge[1] and \ + * self.left_edge[2] <= v_pos[2] and v_pos[2] <= self.right_edge[2]: + * intersect_t = 0.0 # <<<<<<<<<<<<<< + * if not ((0.0 <= intersect_t) and (intersect_t < 1.0)): return 0 + * for i in range(3): + */ + __pyx_v_intersect_t = 0.0; + goto __pyx_L8; + } + __pyx_L8:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":445 + * self.left_edge[2] <= v_pos[2] and v_pos[2] <= self.right_edge[2]: + * intersect_t = 0.0 + * if not ((0.0 <= intersect_t) and (intersect_t < 1.0)): return 0 # <<<<<<<<<<<<<< + * for i in range(3): + * intersect[i] = v_pos[i] + intersect_t * v_dir[i] + */ + __pyx_t_4 = (0.0 <= __pyx_v_intersect_t); + if (__pyx_t_4) { + __pyx_t_2 = (__pyx_v_intersect_t < 1.0); + __pyx_t_5 = __pyx_t_2; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_t_4 = (!__pyx_t_5); + if (__pyx_t_4) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L9; + } + __pyx_L9:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":446 + * intersect_t = 0.0 + * if not ((0.0 <= intersect_t) and (intersect_t < 1.0)): return 0 + * for i in range(3): # <<<<<<<<<<<<<< + * intersect[i] = v_pos[i] + intersect_t * v_dir[i] + * cur_ind[i] = floor((intersect[i] + + */ + for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":447 + * if not ((0.0 <= intersect_t) and (intersect_t < 1.0)): return 0 + * for i in range(3): + * intersect[i] = v_pos[i] + intersect_t * v_dir[i] # <<<<<<<<<<<<<< + * cur_ind[i] = floor((intersect[i] + + * step[i]*1e-8*self.dds[i] - + */ + (__pyx_v_intersect[__pyx_v_i]) = ((__pyx_v_v_pos[__pyx_v_i]) + (__pyx_v_intersect_t * (__pyx_v_v_dir[__pyx_v_i]))); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":448 + * for i in range(3): + * intersect[i] = v_pos[i] + intersect_t * v_dir[i] + * cur_ind[i] = floor((intersect[i] + # <<<<<<<<<<<<<< + * step[i]*1e-8*self.dds[i] - + * self.left_edge[i])*self.idds[i]) + */ + (__pyx_v_cur_ind[__pyx_v_i]) = ((int)floor(((((__pyx_v_intersect[__pyx_v_i]) + (((__pyx_v_step[__pyx_v_i]) * 1e-8) * (__pyx_v_self->dds[__pyx_v_i]))) - (__pyx_v_self->left_edge[__pyx_v_i])) * (__pyx_v_self->idds[__pyx_v_i])))); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":451 + * step[i]*1e-8*self.dds[i] - + * self.left_edge[i])*self.idds[i]) + * tmax[i] = (((cur_ind[i]+step[i])*self.dds[i])+ # <<<<<<<<<<<<<< + * self.left_edge[i]-v_pos[i])*iv_dir[i] + * # This deals with the asymmetry in having our indices refer to the + */ + (__pyx_v_tmax[__pyx_v_i]) = ((((((__pyx_v_cur_ind[__pyx_v_i]) + (__pyx_v_step[__pyx_v_i])) * (__pyx_v_self->dds[__pyx_v_i])) + (__pyx_v_self->left_edge[__pyx_v_i])) - (__pyx_v_v_pos[__pyx_v_i])) * (__pyx_v_iv_dir[__pyx_v_i])); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":456 + * # left edge of a cell, but the right edge of the brick being one + * # extra zone out. + * if cur_ind[i] == self.dims[i] and step[i] < 0: # <<<<<<<<<<<<<< + * cur_ind[i] = self.dims[i] - 1 + * if cur_ind[i] < 0 or cur_ind[i] >= self.dims[i]: return 0 + */ + __pyx_t_4 = ((__pyx_v_cur_ind[__pyx_v_i]) == (__pyx_v_self->dims[__pyx_v_i])); + if (__pyx_t_4) { + __pyx_t_5 = ((__pyx_v_step[__pyx_v_i]) < 0); + __pyx_t_2 = __pyx_t_5; + } else { + __pyx_t_2 = __pyx_t_4; + } + if (__pyx_t_2) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":457 + * # extra zone out. + * if cur_ind[i] == self.dims[i] and step[i] < 0: + * cur_ind[i] = self.dims[i] - 1 # <<<<<<<<<<<<<< + * if cur_ind[i] < 0 or cur_ind[i] >= self.dims[i]: return 0 + * if step[i] > 0: + */ + (__pyx_v_cur_ind[__pyx_v_i]) = ((__pyx_v_self->dims[__pyx_v_i]) - 1); + goto __pyx_L12; + } + __pyx_L12:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":458 + * if cur_ind[i] == self.dims[i] and step[i] < 0: + * cur_ind[i] = self.dims[i] - 1 + * if cur_ind[i] < 0 or cur_ind[i] >= self.dims[i]: return 0 # <<<<<<<<<<<<<< + * if step[i] > 0: + * tmax[i] = (((cur_ind[i]+1)*self.dds[i]) + */ + __pyx_t_2 = ((__pyx_v_cur_ind[__pyx_v_i]) < 0); + if (!__pyx_t_2) { + __pyx_t_4 = ((__pyx_v_cur_ind[__pyx_v_i]) >= (__pyx_v_self->dims[__pyx_v_i])); + __pyx_t_5 = __pyx_t_4; + } else { + __pyx_t_5 = __pyx_t_2; + } + if (__pyx_t_5) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L13; + } + __pyx_L13:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":459 + * cur_ind[i] = self.dims[i] - 1 + * if cur_ind[i] < 0 or cur_ind[i] >= self.dims[i]: return 0 + * if step[i] > 0: # <<<<<<<<<<<<<< + * tmax[i] = (((cur_ind[i]+1)*self.dds[i]) + * +self.left_edge[i]-v_pos[i])*iv_dir[i] + */ + __pyx_t_5 = ((__pyx_v_step[__pyx_v_i]) > 0); + if (__pyx_t_5) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":460 + * if cur_ind[i] < 0 or cur_ind[i] >= self.dims[i]: return 0 + * if step[i] > 0: + * tmax[i] = (((cur_ind[i]+1)*self.dds[i]) # <<<<<<<<<<<<<< + * +self.left_edge[i]-v_pos[i])*iv_dir[i] + * if step[i] < 0: + */ + (__pyx_v_tmax[__pyx_v_i]) = ((((((__pyx_v_cur_ind[__pyx_v_i]) + 1) * (__pyx_v_self->dds[__pyx_v_i])) + (__pyx_v_self->left_edge[__pyx_v_i])) - (__pyx_v_v_pos[__pyx_v_i])) * (__pyx_v_iv_dir[__pyx_v_i])); + goto __pyx_L14; + } + __pyx_L14:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":462 + * tmax[i] = (((cur_ind[i]+1)*self.dds[i]) + * +self.left_edge[i]-v_pos[i])*iv_dir[i] + * if step[i] < 0: # <<<<<<<<<<<<<< + * tmax[i] = (((cur_ind[i]+0)*self.dds[i]) + * +self.left_edge[i]-v_pos[i])*iv_dir[i] + */ + __pyx_t_5 = ((__pyx_v_step[__pyx_v_i]) < 0); + if (__pyx_t_5) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":463 + * +self.left_edge[i]-v_pos[i])*iv_dir[i] + * if step[i] < 0: + * tmax[i] = (((cur_ind[i]+0)*self.dds[i]) # <<<<<<<<<<<<<< + * +self.left_edge[i]-v_pos[i])*iv_dir[i] + * tdelta[i] = (self.dds[i]*iv_dir[i]) + */ + (__pyx_v_tmax[__pyx_v_i]) = ((((((__pyx_v_cur_ind[__pyx_v_i]) + 0) * (__pyx_v_self->dds[__pyx_v_i])) + (__pyx_v_self->left_edge[__pyx_v_i])) - (__pyx_v_v_pos[__pyx_v_i])) * (__pyx_v_iv_dir[__pyx_v_i])); + goto __pyx_L15; + } + __pyx_L15:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":465 + * tmax[i] = (((cur_ind[i]+0)*self.dds[i]) + * +self.left_edge[i]-v_pos[i])*iv_dir[i] + * tdelta[i] = (self.dds[i]*iv_dir[i]) # <<<<<<<<<<<<<< + * if tdelta[i] < 0: tdelta[i] *= -1 + * # We have to jumpstart our calculation + */ + (__pyx_v_tdelta[__pyx_v_i]) = ((__pyx_v_self->dds[__pyx_v_i]) * (__pyx_v_iv_dir[__pyx_v_i])); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":466 + * +self.left_edge[i]-v_pos[i])*iv_dir[i] + * tdelta[i] = (self.dds[i]*iv_dir[i]) + * if tdelta[i] < 0: tdelta[i] *= -1 # <<<<<<<<<<<<<< + * # We have to jumpstart our calculation + * enter_t = intersect_t + */ + __pyx_t_5 = ((__pyx_v_tdelta[__pyx_v_i]) < 0.0); + if (__pyx_t_5) { + (__pyx_v_tdelta[__pyx_v_i]) *= -1.0; + goto __pyx_L16; + } + __pyx_L16:; + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":468 + * if tdelta[i] < 0: tdelta[i] *= -1 + * # We have to jumpstart our calculation + * enter_t = intersect_t # <<<<<<<<<<<<<< + * while 1: + * # dims here is one less than the dimensions of the data, + */ + __pyx_v_enter_t = __pyx_v_intersect_t; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":469 + * # We have to jumpstart our calculation + * enter_t = intersect_t + * while 1: # <<<<<<<<<<<<<< + * # dims here is one less than the dimensions of the data, + * # but we are tracing on the grid, not on the data... + */ + while (1) { + if (!1) break; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":472 + * # dims here is one less than the dimensions of the data, + * # but we are tracing on the grid, not on the data... + * if (not (0 <= cur_ind[0] < self.dims[0])) or \ # <<<<<<<<<<<<<< + * (not (0 <= cur_ind[1] < self.dims[1])) or \ + * (not (0 <= cur_ind[2] < self.dims[2])): + */ + __pyx_t_1 = (__pyx_v_cur_ind[0]); + __pyx_t_5 = (0 <= __pyx_t_1); + if (__pyx_t_5) { + __pyx_t_5 = (__pyx_t_1 < (__pyx_v_self->dims[0])); + } + __pyx_t_2 = (!__pyx_t_5); + if (!__pyx_t_2) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":473 + * # but we are tracing on the grid, not on the data... + * if (not (0 <= cur_ind[0] < self.dims[0])) or \ + * (not (0 <= cur_ind[1] < self.dims[1])) or \ # <<<<<<<<<<<<<< + * (not (0 <= cur_ind[2] < self.dims[2])): + * break + */ + __pyx_t_1 = (__pyx_v_cur_ind[1]); + __pyx_t_5 = (0 <= __pyx_t_1); + if (__pyx_t_5) { + __pyx_t_5 = (__pyx_t_1 < (__pyx_v_self->dims[1])); + } + __pyx_t_4 = (!__pyx_t_5); + if (!__pyx_t_4) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":474 + * if (not (0 <= cur_ind[0] < self.dims[0])) or \ + * (not (0 <= cur_ind[1] < self.dims[1])) or \ + * (not (0 <= cur_ind[2] < self.dims[2])): # <<<<<<<<<<<<<< + * break + * hit += 1 + */ + __pyx_t_1 = (__pyx_v_cur_ind[2]); + __pyx_t_5 = (0 <= __pyx_t_1); + if (__pyx_t_5) { + __pyx_t_5 = (__pyx_t_1 < (__pyx_v_self->dims[2])); + } + __pyx_t_6 = (!__pyx_t_5); + __pyx_t_5 = __pyx_t_6; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_t_4 = __pyx_t_5; + } else { + __pyx_t_4 = __pyx_t_2; + } + if (__pyx_t_4) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":475 + * (not (0 <= cur_ind[1] < self.dims[1])) or \ + * (not (0 <= cur_ind[2] < self.dims[2])): + * break # <<<<<<<<<<<<<< + * hit += 1 + * if tmax[0] < tmax[1]: + */ + goto __pyx_L18_break; + goto __pyx_L19; + } + __pyx_L19:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":476 + * (not (0 <= cur_ind[2] < self.dims[2])): + * break + * hit += 1 # <<<<<<<<<<<<<< + * if tmax[0] < tmax[1]: + * if tmax[0] < tmax[2]: + */ + __pyx_v_hit += 1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":477 + * break + * hit += 1 + * if tmax[0] < tmax[1]: # <<<<<<<<<<<<<< + * if tmax[0] < tmax[2]: + * exit_t = fmin(tmax[0], 1.0) + */ + __pyx_t_4 = ((__pyx_v_tmax[0]) < (__pyx_v_tmax[1])); + if (__pyx_t_4) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":478 + * hit += 1 + * if tmax[0] < tmax[1]: + * if tmax[0] < tmax[2]: # <<<<<<<<<<<<<< + * exit_t = fmin(tmax[0], 1.0) + * self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, + */ + __pyx_t_4 = ((__pyx_v_tmax[0]) < (__pyx_v_tmax[2])); + if (__pyx_t_4) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":479 + * if tmax[0] < tmax[1]: + * if tmax[0] < tmax[2]: + * exit_t = fmin(tmax[0], 1.0) # <<<<<<<<<<<<<< + * self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, + * rgba, tf) + */ + __pyx_v_exit_t = __pyx_f_2yt_9amr_utils_fmin((__pyx_v_tmax[0]), 1.0); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":481 + * exit_t = fmin(tmax[0], 1.0) + * self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, + * rgba, tf) # <<<<<<<<<<<<<< + * cur_ind[0] += step[0] + * enter_t = tmax[0] + */ + ((struct __pyx_vtabstruct_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self->__pyx_vtab)->sample_values(__pyx_v_self, __pyx_v_v_pos, __pyx_v_v_dir, __pyx_v_enter_t, __pyx_v_exit_t, __pyx_v_cur_ind, __pyx_v_rgba, __pyx_v_tf); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":482 + * self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, + * rgba, tf) + * cur_ind[0] += step[0] # <<<<<<<<<<<<<< + * enter_t = tmax[0] + * tmax[0] += tdelta[0] + */ + (__pyx_v_cur_ind[0]) += (__pyx_v_step[0]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":483 + * rgba, tf) + * cur_ind[0] += step[0] + * enter_t = tmax[0] # <<<<<<<<<<<<<< + * tmax[0] += tdelta[0] + * else: + */ + __pyx_v_enter_t = (__pyx_v_tmax[0]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":484 + * cur_ind[0] += step[0] + * enter_t = tmax[0] + * tmax[0] += tdelta[0] # <<<<<<<<<<<<<< + * else: + * exit_t = fmin(tmax[2], 1.0) + */ + (__pyx_v_tmax[0]) += (__pyx_v_tdelta[0]); + goto __pyx_L21; + } + /*else*/ { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":486 + * tmax[0] += tdelta[0] + * else: + * exit_t = fmin(tmax[2], 1.0) # <<<<<<<<<<<<<< + * self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, + * rgba, tf) + */ + __pyx_v_exit_t = __pyx_f_2yt_9amr_utils_fmin((__pyx_v_tmax[2]), 1.0); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":488 + * exit_t = fmin(tmax[2], 1.0) + * self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, + * rgba, tf) # <<<<<<<<<<<<<< + * cur_ind[2] += step[2] + * enter_t = tmax[2] + */ + ((struct __pyx_vtabstruct_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self->__pyx_vtab)->sample_values(__pyx_v_self, __pyx_v_v_pos, __pyx_v_v_dir, __pyx_v_enter_t, __pyx_v_exit_t, __pyx_v_cur_ind, __pyx_v_rgba, __pyx_v_tf); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":489 + * self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, + * rgba, tf) + * cur_ind[2] += step[2] # <<<<<<<<<<<<<< + * enter_t = tmax[2] + * tmax[2] += tdelta[2] + */ + (__pyx_v_cur_ind[2]) += (__pyx_v_step[2]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":490 + * rgba, tf) + * cur_ind[2] += step[2] + * enter_t = tmax[2] # <<<<<<<<<<<<<< + * tmax[2] += tdelta[2] + * else: + */ + __pyx_v_enter_t = (__pyx_v_tmax[2]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":491 + * cur_ind[2] += step[2] + * enter_t = tmax[2] + * tmax[2] += tdelta[2] # <<<<<<<<<<<<<< + * else: + * if tmax[1] < tmax[2]: + */ + (__pyx_v_tmax[2]) += (__pyx_v_tdelta[2]); + } + __pyx_L21:; + goto __pyx_L20; + } + /*else*/ { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":493 + * tmax[2] += tdelta[2] + * else: + * if tmax[1] < tmax[2]: # <<<<<<<<<<<<<< + * exit_t = fmin(tmax[1], 1.0) + * self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, + */ + __pyx_t_4 = ((__pyx_v_tmax[1]) < (__pyx_v_tmax[2])); + if (__pyx_t_4) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":494 + * else: + * if tmax[1] < tmax[2]: + * exit_t = fmin(tmax[1], 1.0) # <<<<<<<<<<<<<< + * self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, + * rgba, tf) + */ + __pyx_v_exit_t = __pyx_f_2yt_9amr_utils_fmin((__pyx_v_tmax[1]), 1.0); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":496 + * exit_t = fmin(tmax[1], 1.0) + * self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, + * rgba, tf) # <<<<<<<<<<<<<< + * cur_ind[1] += step[1] + * enter_t = tmax[1] + */ + ((struct __pyx_vtabstruct_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self->__pyx_vtab)->sample_values(__pyx_v_self, __pyx_v_v_pos, __pyx_v_v_dir, __pyx_v_enter_t, __pyx_v_exit_t, __pyx_v_cur_ind, __pyx_v_rgba, __pyx_v_tf); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":497 + * self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, + * rgba, tf) + * cur_ind[1] += step[1] # <<<<<<<<<<<<<< + * enter_t = tmax[1] + * tmax[1] += tdelta[1] + */ + (__pyx_v_cur_ind[1]) += (__pyx_v_step[1]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":498 + * rgba, tf) + * cur_ind[1] += step[1] + * enter_t = tmax[1] # <<<<<<<<<<<<<< + * tmax[1] += tdelta[1] + * else: + */ + __pyx_v_enter_t = (__pyx_v_tmax[1]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":499 + * cur_ind[1] += step[1] + * enter_t = tmax[1] + * tmax[1] += tdelta[1] # <<<<<<<<<<<<<< + * else: + * exit_t = fmin(tmax[2], 1.0) + */ + (__pyx_v_tmax[1]) += (__pyx_v_tdelta[1]); + goto __pyx_L22; + } + /*else*/ { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":501 + * tmax[1] += tdelta[1] + * else: + * exit_t = fmin(tmax[2], 1.0) # <<<<<<<<<<<<<< + * self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, + * rgba, tf) + */ + __pyx_v_exit_t = __pyx_f_2yt_9amr_utils_fmin((__pyx_v_tmax[2]), 1.0); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":503 + * exit_t = fmin(tmax[2], 1.0) + * self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, + * rgba, tf) # <<<<<<<<<<<<<< + * cur_ind[2] += step[2] + * enter_t = tmax[2] + */ + ((struct __pyx_vtabstruct_2yt_9amr_utils_PartitionedGrid *)__pyx_v_self->__pyx_vtab)->sample_values(__pyx_v_self, __pyx_v_v_pos, __pyx_v_v_dir, __pyx_v_enter_t, __pyx_v_exit_t, __pyx_v_cur_ind, __pyx_v_rgba, __pyx_v_tf); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":504 + * self.sample_values(v_pos, v_dir, enter_t, exit_t, cur_ind, + * rgba, tf) + * cur_ind[2] += step[2] # <<<<<<<<<<<<<< + * enter_t = tmax[2] + * tmax[2] += tdelta[2] + */ + (__pyx_v_cur_ind[2]) += (__pyx_v_step[2]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":505 + * rgba, tf) + * cur_ind[2] += step[2] + * enter_t = tmax[2] # <<<<<<<<<<<<<< + * tmax[2] += tdelta[2] + * if enter_t > 1.0: break + */ + __pyx_v_enter_t = (__pyx_v_tmax[2]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":506 + * cur_ind[2] += step[2] + * enter_t = tmax[2] + * tmax[2] += tdelta[2] # <<<<<<<<<<<<<< + * if enter_t > 1.0: break + * return hit + */ + (__pyx_v_tmax[2]) += (__pyx_v_tdelta[2]); + } + __pyx_L22:; + } + __pyx_L20:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":507 + * enter_t = tmax[2] + * tmax[2] += tdelta[2] + * if enter_t > 1.0: break # <<<<<<<<<<<<<< + * return hit + * + */ + __pyx_t_4 = (__pyx_v_enter_t > 1.0); + if (__pyx_t_4) { + goto __pyx_L18_break; + goto __pyx_L23; + } + __pyx_L23:; + } + __pyx_L18_break:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":508 + * tmax[2] += tdelta[2] + * if enter_t > 1.0: break + * return hit # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + __pyx_r = __pyx_v_hit; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_WriteUnraisable("yt.amr_utils.PartitionedGrid.integrate_ray"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":512 + * @cython.boundscheck(False) + * @cython.wraparound(False) + * cdef void sample_values(self, # <<<<<<<<<<<<<< + * np.float64_t v_pos[3], + * np.float64_t v_dir[3], + */ + +static void __pyx_f_2yt_9amr_utils_15PartitionedGrid_sample_values(struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *__pyx_v_self, __pyx_t_5numpy_float64_t *__pyx_v_v_pos, __pyx_t_5numpy_float64_t *__pyx_v_v_dir, __pyx_t_5numpy_float64_t __pyx_v_enter_t, __pyx_t_5numpy_float64_t __pyx_v_exit_t, int *__pyx_v_ci, __pyx_t_5numpy_float64_t *__pyx_v_rgba, struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *__pyx_v_tf) { + __pyx_t_5numpy_float64_t __pyx_v_dp[3]; + __pyx_t_5numpy_float64_t __pyx_v_temp; + __pyx_t_5numpy_float64_t __pyx_v_dt; + __pyx_t_5numpy_float64_t __pyx_v_grad[3]; + __pyx_t_5numpy_float64_t __pyx_v_ds[3]; + int __pyx_v_dti; + int __pyx_v_i; + int __pyx_v_offset; + __pyx_t_5numpy_float64_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + __Pyx_RefNannySetupContext("sample_values"); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":522 + * cdef np.float64_t cp[3], dp[3], temp, dt, t, dv + * cdef np.float64_t grad[3], ds[3] + * grad[0] = grad[1] = grad[2] = 0.0 # <<<<<<<<<<<<<< + * cdef int dti, i + * dt = (exit_t - enter_t) / tf.ns # 4 samples should be dt=0.25 + */ + (__pyx_v_grad[0]) = 0.0; + (__pyx_v_grad[1]) = 0.0; + (__pyx_v_grad[2]) = 0.0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":524 + * grad[0] = grad[1] = grad[2] = 0.0 + * cdef int dti, i + * dt = (exit_t - enter_t) / tf.ns # 4 samples should be dt=0.25 # <<<<<<<<<<<<<< + * cdef int offset = ci[0] * (self.dims[1] + 1) * (self.dims[2] + 1) \ + * + ci[1] * (self.dims[2] + 1) + ci[2] + */ + __pyx_t_1 = (__pyx_v_exit_t - __pyx_v_enter_t); + if (unlikely(__pyx_v_tf->ns == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_dt = (__pyx_t_1 / __pyx_v_tf->ns); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":526 + * dt = (exit_t - enter_t) / tf.ns # 4 samples should be dt=0.25 + * cdef int offset = ci[0] * (self.dims[1] + 1) * (self.dims[2] + 1) \ + * + ci[1] * (self.dims[2] + 1) + ci[2] # <<<<<<<<<<<<<< + * for i in range(3): + * # temp is the left edge of the current cell + */ + __pyx_v_offset = (((((__pyx_v_ci[0]) * ((__pyx_v_self->dims[1]) + 1)) * ((__pyx_v_self->dims[2]) + 1)) + ((__pyx_v_ci[1]) * ((__pyx_v_self->dims[2]) + 1))) + (__pyx_v_ci[2])); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":527 + * cdef int offset = ci[0] * (self.dims[1] + 1) * (self.dims[2] + 1) \ + * + ci[1] * (self.dims[2] + 1) + ci[2] + * for i in range(3): # <<<<<<<<<<<<<< + * # temp is the left edge of the current cell + * temp = ci[i] * self.dds[i] + self.left_edge[i] + */ + for (__pyx_t_2 = 0; __pyx_t_2 < 3; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":529 + * for i in range(3): + * # temp is the left edge of the current cell + * temp = ci[i] * self.dds[i] + self.left_edge[i] # <<<<<<<<<<<<<< + * # this gets us dp as the current first sample position + * dp[i] = (enter_t + 0.5 * dt) * v_dir[i] + v_pos[i] - temp + */ + __pyx_v_temp = (((__pyx_v_ci[__pyx_v_i]) * (__pyx_v_self->dds[__pyx_v_i])) + (__pyx_v_self->left_edge[__pyx_v_i])); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":531 + * temp = ci[i] * self.dds[i] + self.left_edge[i] + * # this gets us dp as the current first sample position + * dp[i] = (enter_t + 0.5 * dt) * v_dir[i] + v_pos[i] - temp # <<<<<<<<<<<<<< + * dp[i] *= self.idds[i] + * ds[i] = v_dir[i] * self.idds[i] * dt + */ + (__pyx_v_dp[__pyx_v_i]) = ((((__pyx_v_enter_t + (0.5 * __pyx_v_dt)) * (__pyx_v_v_dir[__pyx_v_i])) + (__pyx_v_v_pos[__pyx_v_i])) - __pyx_v_temp); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":532 + * # this gets us dp as the current first sample position + * dp[i] = (enter_t + 0.5 * dt) * v_dir[i] + v_pos[i] - temp + * dp[i] *= self.idds[i] # <<<<<<<<<<<<<< + * ds[i] = v_dir[i] * self.idds[i] * dt + * for dti in range(tf.ns): + */ + (__pyx_v_dp[__pyx_v_i]) *= (__pyx_v_self->idds[__pyx_v_i]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":533 + * dp[i] = (enter_t + 0.5 * dt) * v_dir[i] + v_pos[i] - temp + * dp[i] *= self.idds[i] + * ds[i] = v_dir[i] * self.idds[i] * dt # <<<<<<<<<<<<<< + * for dti in range(tf.ns): + * for i in range(self.n_fields): + */ + (__pyx_v_ds[__pyx_v_i]) = (((__pyx_v_v_dir[__pyx_v_i]) * (__pyx_v_self->idds[__pyx_v_i])) * __pyx_v_dt); + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":534 + * dp[i] *= self.idds[i] + * ds[i] = v_dir[i] * self.idds[i] * dt + * for dti in range(tf.ns): # <<<<<<<<<<<<<< + * for i in range(self.n_fields): + * self.dvs[i] = offset_interpolate(self.dims, dp, self.data[i] + offset) + */ + __pyx_t_2 = __pyx_v_tf->ns; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_dti = __pyx_t_3; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":535 + * ds[i] = v_dir[i] * self.idds[i] * dt + * for dti in range(tf.ns): + * for i in range(self.n_fields): # <<<<<<<<<<<<<< + * self.dvs[i] = offset_interpolate(self.dims, dp, self.data[i] + offset) + * #if (dv < tf.x_bounds[0]) or (dv > tf.x_bounds[1]): + */ + __pyx_t_4 = __pyx_v_self->n_fields; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":536 + * for dti in range(tf.ns): + * for i in range(self.n_fields): + * self.dvs[i] = offset_interpolate(self.dims, dp, self.data[i] + offset) # <<<<<<<<<<<<<< + * #if (dv < tf.x_bounds[0]) or (dv > tf.x_bounds[1]): + * # continue + */ + (__pyx_v_self->dvs[__pyx_v_i]) = offset_interpolate(__pyx_v_self->dims, __pyx_v_dp, ((__pyx_v_self->data[__pyx_v_i]) + __pyx_v_offset)); + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":539 + * #if (dv < tf.x_bounds[0]) or (dv > tf.x_bounds[1]): + * # continue + * for i in range(3): # <<<<<<<<<<<<<< + * dp[i] += ds[i] + * tf.eval_transfer(dt, self.dvs, rgba, grad) + */ + for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":540 + * # continue + * for i in range(3): + * dp[i] += ds[i] # <<<<<<<<<<<<<< + * tf.eval_transfer(dt, self.dvs, rgba, grad) + * + */ + (__pyx_v_dp[__pyx_v_i]) += (__pyx_v_ds[__pyx_v_i]); + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":541 + * for i in range(3): + * dp[i] += ds[i] + * tf.eval_transfer(dt, self.dvs, rgba, grad) # <<<<<<<<<<<<<< + * + * cdef class GridFace: + */ + ((struct __pyx_vtabstruct_2yt_9amr_utils_TransferFunctionProxy *)__pyx_v_tf->__pyx_vtab)->eval_transfer(__pyx_v_tf, __pyx_v_dt, __pyx_v_self->dvs, __pyx_v_rgba, __pyx_v_grad); + } + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_WriteUnraisable("yt.amr_utils.PartitionedGrid.sample_values"); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":545 + * cdef class GridFace: + * cdef int direction + * cdef public np.float64_t coord # <<<<<<<<<<<<<< + * cdef np.float64_t left_edge[3] + * cdef np.float64_t right_edge[3] + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_8GridFace_5coord___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_8GridFace_5coord___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_2yt_9amr_utils_GridFace *)__pyx_v_self)->coord); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("yt.amr_utils.GridFace.coord.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_8GridFace_5coord___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_8GridFace_5coord___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __pyx_t_5numpy_float64_t __pyx_t_1; + __Pyx_RefNannySetupContext("__set__"); + __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_2yt_9amr_utils_GridFace *)__pyx_v_self)->coord = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("yt.amr_utils.GridFace.coord.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":551 + * @cython.boundscheck(False) + * @cython.wraparound(False) + * def __init__(self, grid, int direction, int left): # <<<<<<<<<<<<<< + * self.direction = direction + * if left == 1: + */ + +static int __pyx_pf_2yt_9amr_utils_8GridFace___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_8GridFace___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_grid = 0; + int __pyx_v_direction; + int __pyx_v_left; + int __pyx_v_i; + int __pyx_r; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __pyx_t_5numpy_float64_t __pyx_t_4; + int __pyx_t_5; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__grid,&__pyx_n_s__direction,&__pyx_n_s__left,0}; + __Pyx_RefNannySetupContext("__init__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[3] = {0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__direction); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_grid = values[0]; + __pyx_v_direction = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_direction == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_left = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_left == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_grid = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_direction = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_direction == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_left = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_left == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.GridFace.__init__"); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":552 + * @cython.wraparound(False) + * def __init__(self, grid, int direction, int left): + * self.direction = direction # <<<<<<<<<<<<<< + * if left == 1: + * self.coord = grid.LeftEdge[direction] + */ + ((struct __pyx_obj_2yt_9amr_utils_GridFace *)__pyx_v_self)->direction = __pyx_v_direction; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":553 + * def __init__(self, grid, int direction, int left): + * self.direction = direction + * if left == 1: # <<<<<<<<<<<<<< + * self.coord = grid.LeftEdge[direction] + * else: + */ + __pyx_t_1 = (__pyx_v_left == 1); + if (__pyx_t_1) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":554 + * self.direction = direction + * if left == 1: + * self.coord = grid.LeftEdge[direction] # <<<<<<<<<<<<<< + * else: + * self.coord = grid.RightEdge[direction] + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_grid, __pyx_n_s__LeftEdge); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, __pyx_v_direction, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + ((struct __pyx_obj_2yt_9amr_utils_GridFace *)__pyx_v_self)->coord = __pyx_t_4; + goto __pyx_L6; + } + /*else*/ { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":556 + * self.coord = grid.LeftEdge[direction] + * else: + * self.coord = grid.RightEdge[direction] # <<<<<<<<<<<<<< + * cdef int i + * for i in range(3): + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_grid, __pyx_n_s__RightEdge); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, __pyx_v_direction, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + ((struct __pyx_obj_2yt_9amr_utils_GridFace *)__pyx_v_self)->coord = __pyx_t_4; + } + __pyx_L6:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":558 + * self.coord = grid.RightEdge[direction] + * cdef int i + * for i in range(3): # <<<<<<<<<<<<<< + * self.left_edge[i] = grid.LeftEdge[i] + * self.right_edge[i] = grid.RightEdge[i] + */ + for (__pyx_t_5 = 0; __pyx_t_5 < 3; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":559 + * cdef int i + * for i in range(3): + * self.left_edge[i] = grid.LeftEdge[i] # <<<<<<<<<<<<<< + * self.right_edge[i] = grid.RightEdge[i] + * self.left_edge[direction] = self.right_edge[direction] = self.coord + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_grid, __pyx_n_s__LeftEdge); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + (((struct __pyx_obj_2yt_9amr_utils_GridFace *)__pyx_v_self)->left_edge[__pyx_v_i]) = __pyx_t_4; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":560 + * for i in range(3): + * self.left_edge[i] = grid.LeftEdge[i] + * self.right_edge[i] = grid.RightEdge[i] # <<<<<<<<<<<<<< + * self.left_edge[direction] = self.right_edge[direction] = self.coord + * + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_grid, __pyx_n_s__RightEdge); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + (((struct __pyx_obj_2yt_9amr_utils_GridFace *)__pyx_v_self)->right_edge[__pyx_v_i]) = __pyx_t_4; + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":561 + * self.left_edge[i] = grid.LeftEdge[i] + * self.right_edge[i] = grid.RightEdge[i] + * self.left_edge[direction] = self.right_edge[direction] = self.coord # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + (((struct __pyx_obj_2yt_9amr_utils_GridFace *)__pyx_v_self)->left_edge[__pyx_v_direction]) = ((struct __pyx_obj_2yt_9amr_utils_GridFace *)__pyx_v_self)->coord; + (((struct __pyx_obj_2yt_9amr_utils_GridFace *)__pyx_v_self)->right_edge[__pyx_v_direction]) = ((struct __pyx_obj_2yt_9amr_utils_GridFace *)__pyx_v_self)->coord; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("yt.amr_utils.GridFace.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":565 + * @cython.boundscheck(False) + * @cython.wraparound(False) + * cdef int proj_overlap(self, np.float64_t *left_edge, np.float64_t *right_edge): # <<<<<<<<<<<<<< + * cdef int xax, yax + * xax = (self.direction + 1) % 3 + */ + +static int __pyx_f_2yt_9amr_utils_8GridFace_proj_overlap(struct __pyx_obj_2yt_9amr_utils_GridFace *__pyx_v_self, __pyx_t_5numpy_float64_t *__pyx_v_left_edge, __pyx_t_5numpy_float64_t *__pyx_v_right_edge) { + int __pyx_v_xax; + int __pyx_v_yax; + int __pyx_r; + int __pyx_t_1; + __Pyx_RefNannySetupContext("proj_overlap"); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":567 + * cdef int proj_overlap(self, np.float64_t *left_edge, np.float64_t *right_edge): + * cdef int xax, yax + * xax = (self.direction + 1) % 3 # <<<<<<<<<<<<<< + * yax = (self.direction + 2) % 3 + * if left_edge[xax] >= self.right_edge[xax]: return 0 + */ + __pyx_v_xax = __Pyx_mod_long((__pyx_v_self->direction + 1), 3); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":568 + * cdef int xax, yax + * xax = (self.direction + 1) % 3 + * yax = (self.direction + 2) % 3 # <<<<<<<<<<<<<< + * if left_edge[xax] >= self.right_edge[xax]: return 0 + * if right_edge[xax] <= self.left_edge[xax]: return 0 + */ + __pyx_v_yax = __Pyx_mod_long((__pyx_v_self->direction + 2), 3); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":569 + * xax = (self.direction + 1) % 3 + * yax = (self.direction + 2) % 3 + * if left_edge[xax] >= self.right_edge[xax]: return 0 # <<<<<<<<<<<<<< + * if right_edge[xax] <= self.left_edge[xax]: return 0 + * if left_edge[yax] >= self.right_edge[yax]: return 0 + */ + __pyx_t_1 = ((__pyx_v_left_edge[__pyx_v_xax]) >= (__pyx_v_self->right_edge[__pyx_v_xax])); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":570 + * yax = (self.direction + 2) % 3 + * if left_edge[xax] >= self.right_edge[xax]: return 0 + * if right_edge[xax] <= self.left_edge[xax]: return 0 # <<<<<<<<<<<<<< + * if left_edge[yax] >= self.right_edge[yax]: return 0 + * if right_edge[yax] <= self.left_edge[yax]: return 0 + */ + __pyx_t_1 = ((__pyx_v_right_edge[__pyx_v_xax]) <= (__pyx_v_self->left_edge[__pyx_v_xax])); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":571 + * if left_edge[xax] >= self.right_edge[xax]: return 0 + * if right_edge[xax] <= self.left_edge[xax]: return 0 + * if left_edge[yax] >= self.right_edge[yax]: return 0 # <<<<<<<<<<<<<< + * if right_edge[yax] <= self.left_edge[yax]: return 0 + * return 1 + */ + __pyx_t_1 = ((__pyx_v_left_edge[__pyx_v_yax]) >= (__pyx_v_self->right_edge[__pyx_v_yax])); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":572 + * if right_edge[xax] <= self.left_edge[xax]: return 0 + * if left_edge[yax] >= self.right_edge[yax]: return 0 + * if right_edge[yax] <= self.left_edge[yax]: return 0 # <<<<<<<<<<<<<< + * return 1 + * + */ + __pyx_t_1 = ((__pyx_v_right_edge[__pyx_v_yax]) <= (__pyx_v_self->left_edge[__pyx_v_yax])); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":573 + * if left_edge[yax] >= self.right_edge[yax]: return 0 + * if right_edge[yax] <= self.left_edge[yax]: return 0 + * return 1 # <<<<<<<<<<<<<< + * + * cdef class ProtoPrism: + */ + __pyx_r = 1; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":578 + * cdef np.float64_t left_edge[3] + * cdef np.float64_t right_edge[3] + * cdef public object LeftEdge # <<<<<<<<<<<<<< + * cdef public object RightEdge + * cdef public object subgrid_faces + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_10ProtoPrism_8LeftEdge___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_10ProtoPrism_8LeftEdge___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->LeftEdge); + __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->LeftEdge; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_10ProtoPrism_8LeftEdge___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_10ProtoPrism_8LeftEdge___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->LeftEdge); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->LeftEdge); + ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->LeftEdge = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_10ProtoPrism_8LeftEdge___del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_10ProtoPrism_8LeftEdge___del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->LeftEdge); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->LeftEdge); + ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->LeftEdge = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":579 + * cdef np.float64_t right_edge[3] + * cdef public object LeftEdge + * cdef public object RightEdge # <<<<<<<<<<<<<< + * cdef public object subgrid_faces + * cdef public int parent_grid_id + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_10ProtoPrism_9RightEdge___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_10ProtoPrism_9RightEdge___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->RightEdge); + __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->RightEdge; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_10ProtoPrism_9RightEdge___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_10ProtoPrism_9RightEdge___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->RightEdge); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->RightEdge); + ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->RightEdge = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_10ProtoPrism_9RightEdge___del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_10ProtoPrism_9RightEdge___del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->RightEdge); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->RightEdge); + ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->RightEdge = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":580 + * cdef public object LeftEdge + * cdef public object RightEdge + * cdef public object subgrid_faces # <<<<<<<<<<<<<< + * cdef public int parent_grid_id + * def __cinit__(self, int parent_grid_id, + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_10ProtoPrism_13subgrid_faces___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_10ProtoPrism_13subgrid_faces___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->subgrid_faces); + __pyx_r = ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->subgrid_faces; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_10ProtoPrism_13subgrid_faces___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_10ProtoPrism_13subgrid_faces___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->subgrid_faces); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->subgrid_faces); + ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->subgrid_faces = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_10ProtoPrism_13subgrid_faces___del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_10ProtoPrism_13subgrid_faces___del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->subgrid_faces); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->subgrid_faces); + ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->subgrid_faces = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":581 + * cdef public object RightEdge + * cdef public object subgrid_faces + * cdef public int parent_grid_id # <<<<<<<<<<<<<< + * def __cinit__(self, int parent_grid_id, + * np.ndarray[np.float64_t, ndim=1] left_edge, + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_10ProtoPrism_14parent_grid_id___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_10ProtoPrism_14parent_grid_id___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->parent_grid_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("yt.amr_utils.ProtoPrism.parent_grid_id.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2yt_9amr_utils_10ProtoPrism_14parent_grid_id___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_10ProtoPrism_14parent_grid_id___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + int __pyx_t_1; + __Pyx_RefNannySetupContext("__set__"); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->parent_grid_id = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("yt.amr_utils.ProtoPrism.parent_grid_id.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":582 + * cdef public object subgrid_faces + * cdef public int parent_grid_id + * def __cinit__(self, int parent_grid_id, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t, ndim=1] left_edge, + * np.ndarray[np.float64_t, ndim=1] right_edge, + */ + +static int __pyx_pf_2yt_9amr_utils_10ProtoPrism___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_10ProtoPrism___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_parent_grid_id; + PyArrayObject *__pyx_v_left_edge = 0; + PyArrayObject *__pyx_v_right_edge = 0; + PyObject *__pyx_v_subgrid_faces = 0; + int __pyx_v_i; + Py_buffer __pyx_bstruct_right_edge; + Py_ssize_t __pyx_bstride_0_right_edge = 0; + Py_ssize_t __pyx_bshape_0_right_edge = 0; + Py_buffer __pyx_bstruct_left_edge; + Py_ssize_t __pyx_bstride_0_left_edge = 0; + Py_ssize_t __pyx_bshape_0_left_edge = 0; + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__parent_grid_id,&__pyx_n_s__left_edge,&__pyx_n_s__right_edge,&__pyx_n_s__subgrid_faces,0}; + __Pyx_RefNannySetupContext("__cinit__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[4] = {0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parent_grid_id); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left_edge); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right_edge); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__subgrid_faces); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 3); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_parent_grid_id = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_parent_grid_id == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_left_edge = ((PyArrayObject *)values[1]); + __pyx_v_right_edge = ((PyArrayObject *)values[2]); + __pyx_v_subgrid_faces = values[3]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_parent_grid_id = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_parent_grid_id == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_left_edge = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); + __pyx_v_right_edge = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); + __pyx_v_subgrid_faces = PyTuple_GET_ITEM(__pyx_args, 3); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.ProtoPrism.__cinit__"); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_bstruct_left_edge.buf = NULL; + __pyx_bstruct_right_edge.buf = NULL; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left_edge), __pyx_ptype_5numpy_ndarray, 1, "left_edge", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right_edge), __pyx_ptype_5numpy_ndarray, 1, "right_edge", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_left_edge, (PyObject*)__pyx_v_left_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_left_edge = __pyx_bstruct_left_edge.strides[0]; + __pyx_bshape_0_left_edge = __pyx_bstruct_left_edge.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_right_edge, (PyObject*)__pyx_v_right_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_right_edge = __pyx_bstruct_right_edge.strides[0]; + __pyx_bshape_0_right_edge = __pyx_bstruct_right_edge.shape[0]; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":586 + * np.ndarray[np.float64_t, ndim=1] right_edge, + * subgrid_faces): + * self.parent_grid_id = parent_grid_id # <<<<<<<<<<<<<< + * cdef int i + * self.LeftEdge = left_edge + */ + ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->parent_grid_id = __pyx_v_parent_grid_id; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":588 + * self.parent_grid_id = parent_grid_id + * cdef int i + * self.LeftEdge = left_edge # <<<<<<<<<<<<<< + * self.RightEdge = right_edge + * for i in range(3): + */ + __Pyx_INCREF(((PyObject *)__pyx_v_left_edge)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_left_edge)); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->LeftEdge); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->LeftEdge); + ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->LeftEdge = ((PyObject *)__pyx_v_left_edge); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":589 + * cdef int i + * self.LeftEdge = left_edge + * self.RightEdge = right_edge # <<<<<<<<<<<<<< + * for i in range(3): + * self.left_edge[i] = left_edge[i] + */ + __Pyx_INCREF(((PyObject *)__pyx_v_right_edge)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_right_edge)); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->RightEdge); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->RightEdge); + ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->RightEdge = ((PyObject *)__pyx_v_right_edge); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":590 + * self.LeftEdge = left_edge + * self.RightEdge = right_edge + * for i in range(3): # <<<<<<<<<<<<<< + * self.left_edge[i] = left_edge[i] + * self.right_edge[i] = right_edge[i] + */ + for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":591 + * self.RightEdge = right_edge + * for i in range(3): + * self.left_edge[i] = left_edge[i] # <<<<<<<<<<<<<< + * self.right_edge[i] = right_edge[i] + * self.subgrid_faces = subgrid_faces + */ + __pyx_t_2 = __pyx_v_i; + __pyx_t_3 = -1; + if (__pyx_t_2 < 0) { + __pyx_t_2 += __pyx_bshape_0_left_edge; + if (unlikely(__pyx_t_2 < 0)) __pyx_t_3 = 0; + } else if (unlikely(__pyx_t_2 >= __pyx_bshape_0_left_edge)) __pyx_t_3 = 0; + if (unlikely(__pyx_t_3 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_3); + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + (((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->left_edge[__pyx_v_i]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_2, __pyx_bstride_0_left_edge)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":592 + * for i in range(3): + * self.left_edge[i] = left_edge[i] + * self.right_edge[i] = right_edge[i] # <<<<<<<<<<<<<< + * self.subgrid_faces = subgrid_faces + * + */ + __pyx_t_3 = __pyx_v_i; + __pyx_t_4 = -1; + if (__pyx_t_3 < 0) { + __pyx_t_3 += __pyx_bshape_0_right_edge; + if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 0; + } else if (unlikely(__pyx_t_3 >= __pyx_bshape_0_right_edge)) __pyx_t_4 = 0; + if (unlikely(__pyx_t_4 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_4); + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + (((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->right_edge[__pyx_v_i]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_3, __pyx_bstride_0_right_edge)); + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":593 + * self.left_edge[i] = left_edge[i] + * self.right_edge[i] = right_edge[i] + * self.subgrid_faces = subgrid_faces # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + __Pyx_INCREF(__pyx_v_subgrid_faces); + __Pyx_GIVEREF(__pyx_v_subgrid_faces); + __Pyx_GOTREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->subgrid_faces); + __Pyx_DECREF(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->subgrid_faces); + ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->subgrid_faces = __pyx_v_subgrid_faces; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_right_edge); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edge); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.amr_utils.ProtoPrism.__cinit__"); + __pyx_r = -1; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_right_edge); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edge); + __pyx_L2:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":597 + * @cython.boundscheck(False) + * @cython.wraparound(False) + * def sweep(self, int direction = 0, int stack = 0): # <<<<<<<<<<<<<< + * cdef int i + * cdef GridFace face + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_10ProtoPrism_sweep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_10ProtoPrism_sweep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_direction; + int __pyx_v_stack; + int __pyx_v_i; + struct __pyx_obj_2yt_9amr_utils_GridFace *__pyx_v_face; + __pyx_t_5numpy_float64_t __pyx_v_proto_split[3]; + PyObject *__pyx_v_left; + PyObject *__pyx_v_right; + PyObject *__pyx_v_LC; + PyObject *__pyx_v_RC; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__direction,&__pyx_n_s__stack,0}; + __Pyx_RefNannySetupContext("sweep"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__direction); + if (unlikely(value)) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stack); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sweep") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + if (values[0]) { + __pyx_v_direction = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_direction == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_direction = ((int)0); + } + if (values[1]) { + __pyx_v_stack = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_stack == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_stack = ((int)0); + } + } else { + __pyx_v_direction = ((int)0); + __pyx_v_stack = ((int)0); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: __pyx_v_stack = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_stack == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 1: __pyx_v_direction = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_direction == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("sweep", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.ProtoPrism.sweep"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_face = ((struct __pyx_obj_2yt_9amr_utils_GridFace *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_left = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_right = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_LC = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_RC = Py_None; __Pyx_INCREF(Py_None); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":601 + * cdef GridFace face + * cdef np.float64_t proto_split[3] + * for i in range(3): proto_split[i] = self.right_edge[i] # <<<<<<<<<<<<<< + * for face in self.subgrid_faces[direction]: + * proto_split[direction] = face.coord + */ + for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + (__pyx_v_proto_split[__pyx_v_i]) = (((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->right_edge[__pyx_v_i]); + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":602 + * cdef np.float64_t proto_split[3] + * for i in range(3): proto_split[i] = self.right_edge[i] + * for face in self.subgrid_faces[direction]: # <<<<<<<<<<<<<< + * proto_split[direction] = face.coord + * if proto_split[direction] <= self.left_edge[direction]: + */ + __pyx_t_3 = __Pyx_GetItemInt(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->subgrid_faces, __pyx_v_direction, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { + __pyx_t_2 = 0; __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); + } else { + __pyx_t_2 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break; + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + } else if (likely(PyTuple_CheckExact(__pyx_t_4))) { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + } else { + __pyx_t_3 = PyIter_Next(__pyx_t_4); + if (!__pyx_t_3) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_3); + } + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_2yt_9amr_utils_GridFace))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_face)); + __pyx_v_face = ((struct __pyx_obj_2yt_9amr_utils_GridFace *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":603 + * for i in range(3): proto_split[i] = self.right_edge[i] + * for face in self.subgrid_faces[direction]: + * proto_split[direction] = face.coord # <<<<<<<<<<<<<< + * if proto_split[direction] <= self.left_edge[direction]: + * continue + */ + (__pyx_v_proto_split[__pyx_v_direction]) = __pyx_v_face->coord; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":604 + * for face in self.subgrid_faces[direction]: + * proto_split[direction] = face.coord + * if proto_split[direction] <= self.left_edge[direction]: # <<<<<<<<<<<<<< + * continue + * if proto_split[direction] == self.right_edge[direction]: + */ + __pyx_t_5 = ((__pyx_v_proto_split[__pyx_v_direction]) <= (((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->left_edge[__pyx_v_direction])); + if (__pyx_t_5) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":605 + * proto_split[direction] = face.coord + * if proto_split[direction] <= self.left_edge[direction]: + * continue # <<<<<<<<<<<<<< + * if proto_split[direction] == self.right_edge[direction]: + * if stack == 2: return [self] + */ + goto __pyx_L8_continue; + goto __pyx_L10; + } + __pyx_L10:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":606 + * if proto_split[direction] <= self.left_edge[direction]: + * continue + * if proto_split[direction] == self.right_edge[direction]: # <<<<<<<<<<<<<< + * if stack == 2: return [self] + * return self.sweep((direction + 1) % 3, stack + 1) + */ + __pyx_t_5 = ((__pyx_v_proto_split[__pyx_v_direction]) == (((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->right_edge[__pyx_v_direction])); + if (__pyx_t_5) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":607 + * continue + * if proto_split[direction] == self.right_edge[direction]: + * if stack == 2: return [self] # <<<<<<<<<<<<<< + * return self.sweep((direction + 1) % 3, stack + 1) + * if face.proj_overlap(self.left_edge, proto_split) == 1: + */ + __pyx_t_5 = (__pyx_v_stack == 2); + if (__pyx_t_5) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_self); + PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __pyx_r = ((PyObject *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L0; + goto __pyx_L12; + } + __pyx_L12:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":608 + * if proto_split[direction] == self.right_edge[direction]: + * if stack == 2: return [self] + * return self.sweep((direction + 1) % 3, stack + 1) # <<<<<<<<<<<<<< + * if face.proj_overlap(self.left_edge, proto_split) == 1: + * left, right = self.split(proto_split, direction) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__sweep); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = PyInt_FromLong(__Pyx_mod_long((__pyx_v_direction + 1), 3)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyInt_FromLong((__pyx_v_stack + 1)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_r = __pyx_t_7; + __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L0; + goto __pyx_L11; + } + __pyx_L11:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":609 + * if stack == 2: return [self] + * return self.sweep((direction + 1) % 3, stack + 1) + * if face.proj_overlap(self.left_edge, proto_split) == 1: # <<<<<<<<<<<<<< + * left, right = self.split(proto_split, direction) + * LC = left.sweep((direction + 1) % 3) + */ + __pyx_t_5 = (((struct __pyx_vtabstruct_2yt_9amr_utils_GridFace *)__pyx_v_face->__pyx_vtab)->proj_overlap(__pyx_v_face, ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->left_edge, __pyx_v_proto_split) == 1); + if (__pyx_t_5) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":610 + * return self.sweep((direction + 1) % 3, stack + 1) + * if face.proj_overlap(self.left_edge, proto_split) == 1: + * left, right = self.split(proto_split, direction) # <<<<<<<<<<<<<< + * LC = left.sweep((direction + 1) % 3) + * RC = right.sweep(direction) + */ + __pyx_t_7 = ((struct __pyx_vtabstruct_2yt_9amr_utils_ProtoPrism *)((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->__pyx_vtab)->split(((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self), __pyx_v_proto_split, __pyx_v_direction); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + if (PyTuple_CheckExact(__pyx_t_7) && likely(PyTuple_GET_SIZE(__pyx_t_7) == 2)) { + PyObject* tuple = __pyx_t_7; + __pyx_t_8 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_8); + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_v_left); + __pyx_v_left = __pyx_t_8; + __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_v_right); + __pyx_v_right = __pyx_t_3; + __pyx_t_3 = 0; + } else { + __pyx_t_6 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_8 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_EndUnpack(__pyx_t_6, 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_v_left); + __pyx_v_left = __pyx_t_8; + __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_v_right); + __pyx_v_right = __pyx_t_3; + __pyx_t_3 = 0; + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":611 + * if face.proj_overlap(self.left_edge, proto_split) == 1: + * left, right = self.split(proto_split, direction) + * LC = left.sweep((direction + 1) % 3) # <<<<<<<<<<<<<< + * RC = right.sweep(direction) + * return LC + RC + */ + __pyx_t_7 = PyObject_GetAttr(__pyx_v_left, __pyx_n_s__sweep); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = PyInt_FromLong(__Pyx_mod_long((__pyx_v_direction + 1), 3)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_7, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_v_LC); + __pyx_v_LC = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":612 + * left, right = self.split(proto_split, direction) + * LC = left.sweep((direction + 1) % 3) + * RC = right.sweep(direction) # <<<<<<<<<<<<<< + * return LC + RC + * raise RuntimeError + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_right, __pyx_n_s__sweep); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_8 = PyInt_FromLong(__pyx_v_direction); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_v_RC); + __pyx_v_RC = __pyx_t_8; + __pyx_t_8 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":613 + * LC = left.sweep((direction + 1) % 3) + * RC = right.sweep(direction) + * return LC + RC # <<<<<<<<<<<<<< + * raise RuntimeError + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_8 = PyNumber_Add(__pyx_v_LC, __pyx_v_RC); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_r = __pyx_t_8; + __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L0; + goto __pyx_L13; + } + __pyx_L13:; + __pyx_L8_continue:; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":614 + * RC = right.sweep(direction) + * return LC + RC + * raise RuntimeError # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + __Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0); + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("yt.amr_utils.ProtoPrism.sweep"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_face); + __Pyx_DECREF(__pyx_v_left); + __Pyx_DECREF(__pyx_v_right); + __Pyx_DECREF(__pyx_v_LC); + __Pyx_DECREF(__pyx_v_RC); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":618 + * @cython.boundscheck(False) + * @cython.wraparound(False) + * cdef object split(self, np.float64_t *sp, int direction): # <<<<<<<<<<<<<< + * cdef int i + * cdef np.ndarray split_left = self.LeftEdge.copy() + */ + +static PyObject *__pyx_f_2yt_9amr_utils_10ProtoPrism_split(struct __pyx_obj_2yt_9amr_utils_ProtoPrism *__pyx_v_self, __pyx_t_5numpy_float64_t *__pyx_v_sp, int __pyx_v_direction) { + int __pyx_v_i; + PyArrayObject *__pyx_v_split_left = 0; + PyArrayObject *__pyx_v_split_right = 0; + struct __pyx_obj_2yt_9amr_utils_ProtoPrism *__pyx_v_left; + struct __pyx_obj_2yt_9amr_utils_ProtoPrism *__pyx_v_right; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + __Pyx_RefNannySetupContext("split"); + __pyx_v_left = ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_right = ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)Py_None); __Pyx_INCREF(Py_None); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":620 + * cdef object split(self, np.float64_t *sp, int direction): + * cdef int i + * cdef np.ndarray split_left = self.LeftEdge.copy() # <<<<<<<<<<<<<< + * cdef np.ndarray split_right = self.RightEdge.copy() + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self->LeftEdge, __pyx_n_s__copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_split_left = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":621 + * cdef int i + * cdef np.ndarray split_left = self.LeftEdge.copy() + * cdef np.ndarray split_right = self.RightEdge.copy() # <<<<<<<<<<<<<< + * + * for i in range(3): split_left[i] = self.right_edge[i] + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self->RightEdge, __pyx_n_s__copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_split_right = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":623 + * cdef np.ndarray split_right = self.RightEdge.copy() + * + * for i in range(3): split_left[i] = self.right_edge[i] # <<<<<<<<<<<<<< + * split_left[direction] = sp[direction] + * left = ProtoPrism(self.parent_grid_id, self.LeftEdge, split_left, + */ + for (__pyx_t_3 = 0; __pyx_t_3 < 3; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + __pyx_t_1 = PyFloat_FromDouble((__pyx_v_self->right_edge[__pyx_v_i])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_split_left), __pyx_v_i, __pyx_t_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":624 + * + * for i in range(3): split_left[i] = self.right_edge[i] + * split_left[direction] = sp[direction] # <<<<<<<<<<<<<< + * left = ProtoPrism(self.parent_grid_id, self.LeftEdge, split_left, + * self.subgrid_faces) + */ + __pyx_t_1 = PyFloat_FromDouble((__pyx_v_sp[__pyx_v_direction])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_split_left), __pyx_v_direction, __pyx_t_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":625 + * for i in range(3): split_left[i] = self.right_edge[i] + * split_left[direction] = sp[direction] + * left = ProtoPrism(self.parent_grid_id, self.LeftEdge, split_left, # <<<<<<<<<<<<<< + * self.subgrid_faces) + * + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->parent_grid_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":626 + * split_left[direction] = sp[direction] + * left = ProtoPrism(self.parent_grid_id, self.LeftEdge, split_left, + * self.subgrid_faces) # <<<<<<<<<<<<<< + * + * for i in range(3): split_right[i] = self.left_edge[i] + */ + __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_self->LeftEdge); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_self->LeftEdge); + __Pyx_GIVEREF(__pyx_v_self->LeftEdge); + __Pyx_INCREF(((PyObject *)__pyx_v_split_left)); + PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_split_left)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_split_left)); + __Pyx_INCREF(__pyx_v_self->subgrid_faces); + PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_self->subgrid_faces); + __Pyx_GIVEREF(__pyx_v_self->subgrid_faces); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2yt_9amr_utils_ProtoPrism)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_left)); + __pyx_v_left = ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":628 + * self.subgrid_faces) + * + * for i in range(3): split_right[i] = self.left_edge[i] # <<<<<<<<<<<<<< + * split_right[direction] = sp[direction] + * right = ProtoPrism(self.parent_grid_id, split_right, self.RightEdge, + */ + for (__pyx_t_3 = 0; __pyx_t_3 < 3; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + __pyx_t_1 = PyFloat_FromDouble((__pyx_v_self->left_edge[__pyx_v_i])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_split_right), __pyx_v_i, __pyx_t_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":629 + * + * for i in range(3): split_right[i] = self.left_edge[i] + * split_right[direction] = sp[direction] # <<<<<<<<<<<<<< + * right = ProtoPrism(self.parent_grid_id, split_right, self.RightEdge, + * self.subgrid_faces) + */ + __pyx_t_1 = PyFloat_FromDouble((__pyx_v_sp[__pyx_v_direction])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_split_right), __pyx_v_direction, __pyx_t_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":630 + * for i in range(3): split_right[i] = self.left_edge[i] + * split_right[direction] = sp[direction] + * right = ProtoPrism(self.parent_grid_id, split_right, self.RightEdge, # <<<<<<<<<<<<<< + * self.subgrid_faces) + * + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->parent_grid_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":631 + * split_right[direction] = sp[direction] + * right = ProtoPrism(self.parent_grid_id, split_right, self.RightEdge, + * self.subgrid_faces) # <<<<<<<<<<<<<< + * + * return (left, right) + */ + __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_split_right)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_split_right)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_split_right)); + __Pyx_INCREF(__pyx_v_self->RightEdge); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_self->RightEdge); + __Pyx_GIVEREF(__pyx_v_self->RightEdge); + __Pyx_INCREF(__pyx_v_self->subgrid_faces); + PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_self->subgrid_faces); + __Pyx_GIVEREF(__pyx_v_self->subgrid_faces); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2yt_9amr_utils_ProtoPrism)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_right)); + __pyx_v_right = ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":633 + * self.subgrid_faces) + * + * return (left, right) # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_left)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_left)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_left)); + __Pyx_INCREF(((PyObject *)__pyx_v_right)); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_right)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_right)); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("yt.amr_utils.ProtoPrism.split"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_split_left); + __Pyx_XDECREF((PyObject *)__pyx_v_split_right); + __Pyx_DECREF((PyObject *)__pyx_v_left); + __Pyx_DECREF((PyObject *)__pyx_v_right); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":637 + * @cython.boundscheck(False) + * @cython.wraparound(False) + * def get_brick(self, np.ndarray[np.float64_t, ndim=1] grid_left_edge, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t, ndim=1] grid_dds, + * child_mask): + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_10ProtoPrism_get_brick(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_10ProtoPrism_get_brick(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_grid_left_edge = 0; + PyArrayObject *__pyx_v_grid_dds = 0; + PyObject *__pyx_v_child_mask = 0; + int __pyx_v_li[3]; + int __pyx_v_ri[3]; + int __pyx_v_idims[3]; + int __pyx_v_i; + PyArrayObject *__pyx_v_dims = 0; + Py_buffer __pyx_bstruct_grid_dds; + Py_ssize_t __pyx_bstride_0_grid_dds = 0; + Py_ssize_t __pyx_bshape_0_grid_dds = 0; + Py_buffer __pyx_bstruct_dims; + Py_ssize_t __pyx_bstride_0_dims = 0; + Py_ssize_t __pyx_bshape_0_dims = 0; + Py_buffer __pyx_bstruct_grid_left_edge; + Py_ssize_t __pyx_bstride_0_grid_left_edge = 0; + Py_ssize_t __pyx_bshape_0_grid_left_edge = 0; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + int __pyx_t_2; + __pyx_t_5numpy_float64_t __pyx_t_3; + int __pyx_t_4; + __pyx_t_5numpy_float64_t __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + int __pyx_t_12; + PyArrayObject *__pyx_t_13 = NULL; + int __pyx_t_14; + PyObject *__pyx_t_15 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__grid_left_edge,&__pyx_n_s__grid_dds,&__pyx_n_s__child_mask,0}; + __Pyx_RefNannySetupContext("get_brick"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[3] = {0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid_left_edge); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grid_dds); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("get_brick", 1, 3, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__child_mask); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("get_brick", 1, 3, 3, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "get_brick") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_grid_left_edge = ((PyArrayObject *)values[0]); + __pyx_v_grid_dds = ((PyArrayObject *)values[1]); + __pyx_v_child_mask = values[2]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_grid_left_edge = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); + __pyx_v_grid_dds = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); + __pyx_v_child_mask = PyTuple_GET_ITEM(__pyx_args, 2); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("get_brick", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.ProtoPrism.get_brick"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_bstruct_dims.buf = NULL; + __pyx_bstruct_grid_left_edge.buf = NULL; + __pyx_bstruct_grid_dds.buf = NULL; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grid_left_edge), __pyx_ptype_5numpy_ndarray, 1, "grid_left_edge", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grid_dds), __pyx_ptype_5numpy_ndarray, 1, "grid_dds", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_grid_left_edge, (PyObject*)__pyx_v_grid_left_edge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_grid_left_edge = __pyx_bstruct_grid_left_edge.strides[0]; + __pyx_bshape_0_grid_left_edge = __pyx_bstruct_grid_left_edge.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_grid_dds, (PyObject*)__pyx_v_grid_dds, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_grid_dds = __pyx_bstruct_grid_dds.strides[0]; + __pyx_bshape_0_grid_dds = __pyx_bstruct_grid_dds.shape[0]; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":644 + * cdef PartitionedGrid PG + * cdef int li[3], ri[3], idims[3], i + * for i in range(3): # <<<<<<<<<<<<<< + * li[i] = lrint((self.left_edge[i] - grid_left_edge[i])/grid_dds[i]) + * ri[i] = lrint((self.right_edge[i] - grid_left_edge[i])/grid_dds[i]) + */ + for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":645 + * cdef int li[3], ri[3], idims[3], i + * for i in range(3): + * li[i] = lrint((self.left_edge[i] - grid_left_edge[i])/grid_dds[i]) # <<<<<<<<<<<<<< + * ri[i] = lrint((self.right_edge[i] - grid_left_edge[i])/grid_dds[i]) + * idims[i] = ri[i] - li[i] + */ + __pyx_t_2 = __pyx_v_i; + __pyx_t_3 = ((((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->left_edge[__pyx_v_i]) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_grid_left_edge.buf, __pyx_t_2, __pyx_bstride_0_grid_left_edge))); + __pyx_t_4 = __pyx_v_i; + __pyx_t_5 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_grid_dds.buf, __pyx_t_4, __pyx_bstride_0_grid_dds)); + if (unlikely(__pyx_t_5 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + (__pyx_v_li[__pyx_v_i]) = lrint((__pyx_t_3 / __pyx_t_5)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":646 + * for i in range(3): + * li[i] = lrint((self.left_edge[i] - grid_left_edge[i])/grid_dds[i]) + * ri[i] = lrint((self.right_edge[i] - grid_left_edge[i])/grid_dds[i]) # <<<<<<<<<<<<<< + * idims[i] = ri[i] - li[i] + * if child_mask[li[0], li[1], li[2]] == 0: return [] + */ + __pyx_t_6 = __pyx_v_i; + __pyx_t_5 = ((((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)__pyx_v_self)->right_edge[__pyx_v_i]) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_grid_left_edge.buf, __pyx_t_6, __pyx_bstride_0_grid_left_edge))); + __pyx_t_7 = __pyx_v_i; + __pyx_t_3 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_grid_dds.buf, __pyx_t_7, __pyx_bstride_0_grid_dds)); + if (unlikely(__pyx_t_3 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + (__pyx_v_ri[__pyx_v_i]) = lrint((__pyx_t_5 / __pyx_t_3)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":647 + * li[i] = lrint((self.left_edge[i] - grid_left_edge[i])/grid_dds[i]) + * ri[i] = lrint((self.right_edge[i] - grid_left_edge[i])/grid_dds[i]) + * idims[i] = ri[i] - li[i] # <<<<<<<<<<<<<< + * if child_mask[li[0], li[1], li[2]] == 0: return [] + * cdef np.ndarray[np.int64_t, ndim=1] dims = np.empty(3, dtype='int64') + */ + (__pyx_v_idims[__pyx_v_i]) = ((__pyx_v_ri[__pyx_v_i]) - (__pyx_v_li[__pyx_v_i])); + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":648 + * ri[i] = lrint((self.right_edge[i] - grid_left_edge[i])/grid_dds[i]) + * idims[i] = ri[i] - li[i] + * if child_mask[li[0], li[1], li[2]] == 0: return [] # <<<<<<<<<<<<<< + * cdef np.ndarray[np.int64_t, ndim=1] dims = np.empty(3, dtype='int64') + * for i in range(3): + */ + __pyx_t_8 = PyInt_FromLong((__pyx_v_li[0])); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PyInt_FromLong((__pyx_v_li[1])); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = PyInt_FromLong((__pyx_v_li[2])); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_t_8 = 0; + __pyx_t_9 = 0; + __pyx_t_10 = 0; + __pyx_t_10 = PyObject_GetItem(__pyx_v_child_mask, __pyx_t_11); if (!__pyx_t_10) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = PyObject_RichCompare(__pyx_t_10, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (__pyx_t_12) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_11 = PyList_New(0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_11)); + __pyx_r = ((PyObject *)__pyx_t_11); + __pyx_t_11 = 0; + goto __pyx_L0; + goto __pyx_L8; + } + __pyx_L8:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":649 + * idims[i] = ri[i] - li[i] + * if child_mask[li[0], li[1], li[2]] == 0: return [] + * cdef np.ndarray[np.int64_t, ndim=1] dims = np.empty(3, dtype='int64') # <<<<<<<<<<<<<< + * for i in range(3): + * dims[i] = idims[i] + */ + __pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_10 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__empty); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_INCREF(__pyx_int_3); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__int64)) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyEval_CallObjectWithKeywords(__pyx_t_10, __pyx_t_11, ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = ((PyArrayObject *)__pyx_t_8); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dims, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_dims = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_dims.buf = NULL; + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_bstride_0_dims = __pyx_bstruct_dims.strides[0]; + __pyx_bshape_0_dims = __pyx_bstruct_dims.shape[0]; + } + } + __pyx_t_13 = 0; + __pyx_v_dims = ((PyArrayObject *)__pyx_t_8); + __pyx_t_8 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":650 + * if child_mask[li[0], li[1], li[2]] == 0: return [] + * cdef np.ndarray[np.int64_t, ndim=1] dims = np.empty(3, dtype='int64') + * for i in range(3): # <<<<<<<<<<<<<< + * dims[i] = idims[i] + * #cdef np.ndarray[np.float64_t, ndim=3] new_data + */ + for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":651 + * cdef np.ndarray[np.int64_t, ndim=1] dims = np.empty(3, dtype='int64') + * for i in range(3): + * dims[i] = idims[i] # <<<<<<<<<<<<<< + * #cdef np.ndarray[np.float64_t, ndim=3] new_data + * #new_data = data[li[0]:ri[0]+1,li[1]:ri[1]+1,li[2]:ri[2]+1].copy() + */ + __pyx_t_14 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_dims.buf, __pyx_t_14, __pyx_bstride_0_dims) = (__pyx_v_idims[__pyx_v_i]); + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":656 + * #PG = PartitionedGrid(self.parent_grid_id, new_data, + * # self.LeftEdge, self.RightEdge, dims) + * return ((li[0], ri[0]), (li[1], ri[1]), (li[2], ri[2]), dims) # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_8 = PyInt_FromLong((__pyx_v_li[0])); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PyInt_FromLong((__pyx_v_ri[0])); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_8 = 0; + __pyx_t_9 = 0; + __pyx_t_9 = PyInt_FromLong((__pyx_v_li[1])); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_8 = PyInt_FromLong((__pyx_v_ri[1])); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_t_9 = 0; + __pyx_t_8 = 0; + __pyx_t_8 = PyInt_FromLong((__pyx_v_li[2])); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PyInt_FromLong((__pyx_v_ri[2])); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_8 = 0; + __pyx_t_9 = 0; + __pyx_t_9 = PyTuple_New(4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_15); + __Pyx_GIVEREF(__pyx_t_15); + __Pyx_INCREF(((PyObject *)__pyx_v_dims)); + PyTuple_SET_ITEM(__pyx_t_9, 3, ((PyObject *)__pyx_v_dims)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dims)); + __pyx_t_11 = 0; + __pyx_t_10 = 0; + __pyx_t_15 = 0; + __pyx_r = __pyx_t_9; + __pyx_t_9 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_15); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_dds); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dims); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_left_edge); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.amr_utils.ProtoPrism.get_brick"); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_dds); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dims); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_left_edge); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_dims); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":28 + * @cython.boundscheck(False) + * @cython.wraparound(False) + * def CICDeposit_3(np.ndarray[np.float64_t, ndim=1] posx, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t, ndim=1] posy, + * np.ndarray[np.float64_t, ndim=1] posz, + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_CICDeposit_3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_CICDeposit_3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_posx = 0; + PyArrayObject *__pyx_v_posy = 0; + PyArrayObject *__pyx_v_posz = 0; + PyArrayObject *__pyx_v_mass = 0; + __pyx_t_5numpy_int64_t __pyx_v_npositions; + PyArrayObject *__pyx_v_field = 0; + PyArrayObject *__pyx_v_leftEdge = 0; + PyArrayObject *__pyx_v_gridDimension = 0; + __pyx_t_5numpy_float64_t __pyx_v_cellSize; + int __pyx_v_i1; + int __pyx_v_j1; + int __pyx_v_k1; + int __pyx_v_n; + double __pyx_v_xpos; + double __pyx_v_ypos; + double __pyx_v_zpos; + double __pyx_v_fact; + double __pyx_v_edge0; + double __pyx_v_edge1; + double __pyx_v_edge2; + double __pyx_v_le0; + double __pyx_v_le1; + double __pyx_v_le2; + float __pyx_v_dx; + float __pyx_v_dy; + float __pyx_v_dz; + float __pyx_v_dx2; + float __pyx_v_dy2; + float __pyx_v_dz2; + Py_buffer __pyx_bstruct_field; + Py_ssize_t __pyx_bstride_0_field = 0; + Py_ssize_t __pyx_bstride_1_field = 0; + Py_ssize_t __pyx_bstride_2_field = 0; + Py_ssize_t __pyx_bshape_0_field = 0; + Py_ssize_t __pyx_bshape_1_field = 0; + Py_ssize_t __pyx_bshape_2_field = 0; + Py_buffer __pyx_bstruct_leftEdge; + Py_ssize_t __pyx_bstride_0_leftEdge = 0; + Py_ssize_t __pyx_bshape_0_leftEdge = 0; + Py_buffer __pyx_bstruct_posz; + Py_ssize_t __pyx_bstride_0_posz = 0; + Py_ssize_t __pyx_bshape_0_posz = 0; + Py_buffer __pyx_bstruct_posx; + Py_ssize_t __pyx_bstride_0_posx = 0; + Py_ssize_t __pyx_bshape_0_posx = 0; + Py_buffer __pyx_bstruct_posy; + Py_ssize_t __pyx_bstride_0_posy = 0; + Py_ssize_t __pyx_bshape_0_posy = 0; + Py_buffer __pyx_bstruct_gridDimension; + Py_ssize_t __pyx_bstride_0_gridDimension = 0; + Py_ssize_t __pyx_bshape_0_gridDimension = 0; + Py_buffer __pyx_bstruct_mass; + Py_ssize_t __pyx_bstride_0_mass = 0; + Py_ssize_t __pyx_bshape_0_mass = 0; + PyObject *__pyx_r = NULL; + long __pyx_t_1; + long __pyx_t_2; + long __pyx_t_3; + long __pyx_t_4; + long __pyx_t_5; + long __pyx_t_6; + __pyx_t_5numpy_int64_t __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + long __pyx_t_13; + long __pyx_t_14; + long __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + long __pyx_t_18; + long __pyx_t_19; + int __pyx_t_20; + long __pyx_t_21; + int __pyx_t_22; + long __pyx_t_23; + int __pyx_t_24; + int __pyx_t_25; + int __pyx_t_26; + long __pyx_t_27; + int __pyx_t_28; + long __pyx_t_29; + long __pyx_t_30; + int __pyx_t_31; + int __pyx_t_32; + int __pyx_t_33; + long __pyx_t_34; + int __pyx_t_35; + int __pyx_t_36; + long __pyx_t_37; + int __pyx_t_38; + int __pyx_t_39; + int __pyx_t_40; + int __pyx_t_41; + int __pyx_t_42; + int __pyx_t_43; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__posx,&__pyx_n_s__posy,&__pyx_n_s__posz,&__pyx_n_s__mass,&__pyx_n_s__npositions,&__pyx_n_s__field,&__pyx_n_s__leftEdge,&__pyx_n_s__gridDimension,&__pyx_n_s__cellSize,0}; + __Pyx_RefNannySetupContext("CICDeposit_3"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__posx); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__posy); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("CICDeposit_3", 1, 9, 9, 1); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__posz); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("CICDeposit_3", 1, 9, 9, 2); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mass); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("CICDeposit_3", 1, 9, 9, 3); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__npositions); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("CICDeposit_3", 1, 9, 9, 4); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__field); + if (likely(values[5])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("CICDeposit_3", 1, 9, 9, 5); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 6: + values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__leftEdge); + if (likely(values[6])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("CICDeposit_3", 1, 9, 9, 6); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 7: + values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__gridDimension); + if (likely(values[7])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("CICDeposit_3", 1, 9, 9, 7); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 8: + values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__cellSize); + if (likely(values[8])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("CICDeposit_3", 1, 9, 9, 8); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "CICDeposit_3") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_posx = ((PyArrayObject *)values[0]); + __pyx_v_posy = ((PyArrayObject *)values[1]); + __pyx_v_posz = ((PyArrayObject *)values[2]); + __pyx_v_mass = ((PyArrayObject *)values[3]); + __pyx_v_npositions = __Pyx_PyInt_from_py_npy_int64(values[4]); if (unlikely((__pyx_v_npositions == (npy_int64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_field = ((PyArrayObject *)values[5]); + __pyx_v_leftEdge = ((PyArrayObject *)values[6]); + __pyx_v_gridDimension = ((PyArrayObject *)values[7]); + __pyx_v_cellSize = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_cellSize == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else if (PyTuple_GET_SIZE(__pyx_args) != 9) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_posx = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); + __pyx_v_posy = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); + __pyx_v_posz = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); + __pyx_v_mass = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); + __pyx_v_npositions = __Pyx_PyInt_from_py_npy_int64(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_npositions == (npy_int64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_field = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 5)); + __pyx_v_leftEdge = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 6)); + __pyx_v_gridDimension = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 7)); + __pyx_v_cellSize = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 8)); if (unlikely((__pyx_v_cellSize == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("CICDeposit_3", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.CICDeposit_3"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_bstruct_posx.buf = NULL; + __pyx_bstruct_posy.buf = NULL; + __pyx_bstruct_posz.buf = NULL; + __pyx_bstruct_mass.buf = NULL; + __pyx_bstruct_field.buf = NULL; + __pyx_bstruct_leftEdge.buf = NULL; + __pyx_bstruct_gridDimension.buf = NULL; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_posx), __pyx_ptype_5numpy_ndarray, 1, "posx", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_posy), __pyx_ptype_5numpy_ndarray, 1, "posy", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_posz), __pyx_ptype_5numpy_ndarray, 1, "posz", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mass), __pyx_ptype_5numpy_ndarray, 1, "mass", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_field), __pyx_ptype_5numpy_ndarray, 1, "field", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_leftEdge), __pyx_ptype_5numpy_ndarray, 1, "leftEdge", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gridDimension), __pyx_ptype_5numpy_ndarray, 1, "gridDimension", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_posx, (PyObject*)__pyx_v_posx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_posx = __pyx_bstruct_posx.strides[0]; + __pyx_bshape_0_posx = __pyx_bstruct_posx.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_posy, (PyObject*)__pyx_v_posy, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_posy = __pyx_bstruct_posy.strides[0]; + __pyx_bshape_0_posy = __pyx_bstruct_posy.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_posz, (PyObject*)__pyx_v_posz, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_posz = __pyx_bstruct_posz.strides[0]; + __pyx_bshape_0_posz = __pyx_bstruct_posz.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_mass, (PyObject*)__pyx_v_mass, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_mass = __pyx_bstruct_mass.strides[0]; + __pyx_bshape_0_mass = __pyx_bstruct_mass.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_field, (PyObject*)__pyx_v_field, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_field = __pyx_bstruct_field.strides[0]; __pyx_bstride_1_field = __pyx_bstruct_field.strides[1]; __pyx_bstride_2_field = __pyx_bstruct_field.strides[2]; + __pyx_bshape_0_field = __pyx_bstruct_field.shape[0]; __pyx_bshape_1_field = __pyx_bstruct_field.shape[1]; __pyx_bshape_2_field = __pyx_bstruct_field.shape[2]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_leftEdge, (PyObject*)__pyx_v_leftEdge, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_leftEdge = __pyx_bstruct_leftEdge.strides[0]; + __pyx_bshape_0_leftEdge = __pyx_bstruct_leftEdge.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_gridDimension, (PyObject*)__pyx_v_gridDimension, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_gridDimension = __pyx_bstruct_gridDimension.strides[0]; + __pyx_bshape_0_gridDimension = __pyx_bstruct_gridDimension.shape[0]; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":44 + * cdef float dx, dy, dz, dx2, dy2, dz2 + * + * edge0 = ( gridDimension[0]) - 0.5001 # <<<<<<<<<<<<<< + * edge1 = ( gridDimension[1]) - 0.5001 + * edge2 = ( gridDimension[2]) - 0.5001 + */ + __pyx_t_1 = 0; + __pyx_v_edge0 = (((float)(*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_gridDimension.buf, __pyx_t_1, __pyx_bstride_0_gridDimension))) - 0.5001); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":45 + * + * edge0 = ( gridDimension[0]) - 0.5001 + * edge1 = ( gridDimension[1]) - 0.5001 # <<<<<<<<<<<<<< + * edge2 = ( gridDimension[2]) - 0.5001 + * fact = 1.0 / cellSize + */ + __pyx_t_2 = 1; + __pyx_v_edge1 = (((float)(*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_gridDimension.buf, __pyx_t_2, __pyx_bstride_0_gridDimension))) - 0.5001); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":46 + * edge0 = ( gridDimension[0]) - 0.5001 + * edge1 = ( gridDimension[1]) - 0.5001 + * edge2 = ( gridDimension[2]) - 0.5001 # <<<<<<<<<<<<<< + * fact = 1.0 / cellSize + * + */ + __pyx_t_3 = 2; + __pyx_v_edge2 = (((float)(*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_gridDimension.buf, __pyx_t_3, __pyx_bstride_0_gridDimension))) - 0.5001); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":47 + * edge1 = ( gridDimension[1]) - 0.5001 + * edge2 = ( gridDimension[2]) - 0.5001 + * fact = 1.0 / cellSize # <<<<<<<<<<<<<< + * + * le0 = leftEdge[0] + */ + if (unlikely(__pyx_v_cellSize == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_fact = (1.0 / __pyx_v_cellSize); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":49 + * fact = 1.0 / cellSize + * + * le0 = leftEdge[0] # <<<<<<<<<<<<<< + * le1 = leftEdge[1] + * le2 = leftEdge[2] + */ + __pyx_t_4 = 0; + __pyx_v_le0 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_leftEdge.buf, __pyx_t_4, __pyx_bstride_0_leftEdge)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":50 + * + * le0 = leftEdge[0] + * le1 = leftEdge[1] # <<<<<<<<<<<<<< + * le2 = leftEdge[2] + * + */ + __pyx_t_5 = 1; + __pyx_v_le1 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_leftEdge.buf, __pyx_t_5, __pyx_bstride_0_leftEdge)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":51 + * le0 = leftEdge[0] + * le1 = leftEdge[1] + * le2 = leftEdge[2] # <<<<<<<<<<<<<< + * + * for n in range(npositions): + */ + __pyx_t_6 = 2; + __pyx_v_le2 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_leftEdge.buf, __pyx_t_6, __pyx_bstride_0_leftEdge)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":53 + * le2 = leftEdge[2] + * + * for n in range(npositions): # <<<<<<<<<<<<<< + * + * # Compute the position of the central cell + */ + __pyx_t_7 = __pyx_v_npositions; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { + __pyx_v_n = __pyx_t_8; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":56 + * + * # Compute the position of the central cell + * xpos = fmin(fmax((posx[n] - le0)*fact, 0.5001), edge0) # <<<<<<<<<<<<<< + * ypos = fmin(fmax((posy[n] - le1)*fact, 0.5001), edge1) + * zpos = fmin(fmax((posz[n] - le2)*fact, 0.5001), edge2) + */ + __pyx_t_9 = __pyx_v_n; + __pyx_v_xpos = __pyx_f_2yt_9amr_utils_fmin(__pyx_f_2yt_9amr_utils_fmax((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_posx.buf, __pyx_t_9, __pyx_bstride_0_posx)) - __pyx_v_le0) * __pyx_v_fact), 0.5001), __pyx_v_edge0); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":57 + * # Compute the position of the central cell + * xpos = fmin(fmax((posx[n] - le0)*fact, 0.5001), edge0) + * ypos = fmin(fmax((posy[n] - le1)*fact, 0.5001), edge1) # <<<<<<<<<<<<<< + * zpos = fmin(fmax((posz[n] - le2)*fact, 0.5001), edge2) + * + */ + __pyx_t_10 = __pyx_v_n; + __pyx_v_ypos = __pyx_f_2yt_9amr_utils_fmin(__pyx_f_2yt_9amr_utils_fmax((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_posy.buf, __pyx_t_10, __pyx_bstride_0_posy)) - __pyx_v_le1) * __pyx_v_fact), 0.5001), __pyx_v_edge1); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":58 + * xpos = fmin(fmax((posx[n] - le0)*fact, 0.5001), edge0) + * ypos = fmin(fmax((posy[n] - le1)*fact, 0.5001), edge1) + * zpos = fmin(fmax((posz[n] - le2)*fact, 0.5001), edge2) # <<<<<<<<<<<<<< + * + * i1 = (xpos + 0.5) + */ + __pyx_t_11 = __pyx_v_n; + __pyx_v_zpos = __pyx_f_2yt_9amr_utils_fmin(__pyx_f_2yt_9amr_utils_fmax((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_posz.buf, __pyx_t_11, __pyx_bstride_0_posz)) - __pyx_v_le2) * __pyx_v_fact), 0.5001), __pyx_v_edge2); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":60 + * zpos = fmin(fmax((posz[n] - le2)*fact, 0.5001), edge2) + * + * i1 = (xpos + 0.5) # <<<<<<<<<<<<<< + * j1 = (ypos + 0.5) + * k1 = (zpos + 0.5) + */ + __pyx_v_i1 = ((int)(__pyx_v_xpos + 0.5)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":61 + * + * i1 = (xpos + 0.5) + * j1 = (ypos + 0.5) # <<<<<<<<<<<<<< + * k1 = (zpos + 0.5) + * + */ + __pyx_v_j1 = ((int)(__pyx_v_ypos + 0.5)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":62 + * i1 = (xpos + 0.5) + * j1 = (ypos + 0.5) + * k1 = (zpos + 0.5) # <<<<<<<<<<<<<< + * + * # Compute the weights + */ + __pyx_v_k1 = ((int)(__pyx_v_zpos + 0.5)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":65 + * + * # Compute the weights + * dx = ( i1) + 0.5 - xpos # <<<<<<<<<<<<<< + * dy = ( j1) + 0.5 - ypos + * dz = ( k1) + 0.5 - zpos + */ + __pyx_v_dx = ((((float)__pyx_v_i1) + 0.5) - __pyx_v_xpos); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":66 + * # Compute the weights + * dx = ( i1) + 0.5 - xpos + * dy = ( j1) + 0.5 - ypos # <<<<<<<<<<<<<< + * dz = ( k1) + 0.5 - zpos + * dx2 = 1.0 - dx + */ + __pyx_v_dy = ((((float)__pyx_v_j1) + 0.5) - __pyx_v_ypos); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":67 + * dx = ( i1) + 0.5 - xpos + * dy = ( j1) + 0.5 - ypos + * dz = ( k1) + 0.5 - zpos # <<<<<<<<<<<<<< + * dx2 = 1.0 - dx + * dy2 = 1.0 - dy + */ + __pyx_v_dz = ((((float)__pyx_v_k1) + 0.5) - __pyx_v_zpos); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":68 + * dy = ( j1) + 0.5 - ypos + * dz = ( k1) + 0.5 - zpos + * dx2 = 1.0 - dx # <<<<<<<<<<<<<< + * dy2 = 1.0 - dy + * dz2 = 1.0 - dz + */ + __pyx_v_dx2 = (1.0 - __pyx_v_dx); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":69 + * dz = ( k1) + 0.5 - zpos + * dx2 = 1.0 - dx + * dy2 = 1.0 - dy # <<<<<<<<<<<<<< + * dz2 = 1.0 - dz + * + */ + __pyx_v_dy2 = (1.0 - __pyx_v_dy); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":70 + * dx2 = 1.0 - dx + * dy2 = 1.0 - dy + * dz2 = 1.0 - dz # <<<<<<<<<<<<<< + * + * # Interpolate from field into sumfield + */ + __pyx_v_dz2 = (1.0 - __pyx_v_dz); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":73 + * + * # Interpolate from field into sumfield + * field[i1-1,j1-1,k1-1] += mass[n] * dx * dy * dz # <<<<<<<<<<<<<< + * field[i1 ,j1-1,k1-1] += mass[n] * dx2 * dy * dz + * field[i1-1,j1 ,k1-1] += mass[n] * dx * dy2 * dz + */ + __pyx_t_12 = __pyx_v_n; + __pyx_t_13 = (__pyx_v_i1 - 1); + __pyx_t_14 = (__pyx_v_j1 - 1); + __pyx_t_15 = (__pyx_v_k1 - 1); + *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_field.buf, __pyx_t_13, __pyx_bstride_0_field, __pyx_t_14, __pyx_bstride_1_field, __pyx_t_15, __pyx_bstride_2_field) += ((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_mass.buf, __pyx_t_12, __pyx_bstride_0_mass)) * __pyx_v_dx) * __pyx_v_dy) * __pyx_v_dz); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":74 + * # Interpolate from field into sumfield + * field[i1-1,j1-1,k1-1] += mass[n] * dx * dy * dz + * field[i1 ,j1-1,k1-1] += mass[n] * dx2 * dy * dz # <<<<<<<<<<<<<< + * field[i1-1,j1 ,k1-1] += mass[n] * dx * dy2 * dz + * field[i1 ,j1 ,k1-1] += mass[n] * dx2 * dy2 * dz + */ + __pyx_t_16 = __pyx_v_n; + __pyx_t_17 = __pyx_v_i1; + __pyx_t_18 = (__pyx_v_j1 - 1); + __pyx_t_19 = (__pyx_v_k1 - 1); + *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_field.buf, __pyx_t_17, __pyx_bstride_0_field, __pyx_t_18, __pyx_bstride_1_field, __pyx_t_19, __pyx_bstride_2_field) += ((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_mass.buf, __pyx_t_16, __pyx_bstride_0_mass)) * __pyx_v_dx2) * __pyx_v_dy) * __pyx_v_dz); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":75 + * field[i1-1,j1-1,k1-1] += mass[n] * dx * dy * dz + * field[i1 ,j1-1,k1-1] += mass[n] * dx2 * dy * dz + * field[i1-1,j1 ,k1-1] += mass[n] * dx * dy2 * dz # <<<<<<<<<<<<<< + * field[i1 ,j1 ,k1-1] += mass[n] * dx2 * dy2 * dz + * field[i1-1,j1-1,k1 ] += mass[n] * dx * dy * dz2 + */ + __pyx_t_20 = __pyx_v_n; + __pyx_t_21 = (__pyx_v_i1 - 1); + __pyx_t_22 = __pyx_v_j1; + __pyx_t_23 = (__pyx_v_k1 - 1); + *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_field.buf, __pyx_t_21, __pyx_bstride_0_field, __pyx_t_22, __pyx_bstride_1_field, __pyx_t_23, __pyx_bstride_2_field) += ((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_mass.buf, __pyx_t_20, __pyx_bstride_0_mass)) * __pyx_v_dx) * __pyx_v_dy2) * __pyx_v_dz); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":76 + * field[i1 ,j1-1,k1-1] += mass[n] * dx2 * dy * dz + * field[i1-1,j1 ,k1-1] += mass[n] * dx * dy2 * dz + * field[i1 ,j1 ,k1-1] += mass[n] * dx2 * dy2 * dz # <<<<<<<<<<<<<< + * field[i1-1,j1-1,k1 ] += mass[n] * dx * dy * dz2 + * field[i1 ,j1-1,k1 ] += mass[n] * dx2 * dy * dz2 + */ + __pyx_t_24 = __pyx_v_n; + __pyx_t_25 = __pyx_v_i1; + __pyx_t_26 = __pyx_v_j1; + __pyx_t_27 = (__pyx_v_k1 - 1); + *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_field.buf, __pyx_t_25, __pyx_bstride_0_field, __pyx_t_26, __pyx_bstride_1_field, __pyx_t_27, __pyx_bstride_2_field) += ((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_mass.buf, __pyx_t_24, __pyx_bstride_0_mass)) * __pyx_v_dx2) * __pyx_v_dy2) * __pyx_v_dz); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":77 + * field[i1-1,j1 ,k1-1] += mass[n] * dx * dy2 * dz + * field[i1 ,j1 ,k1-1] += mass[n] * dx2 * dy2 * dz + * field[i1-1,j1-1,k1 ] += mass[n] * dx * dy * dz2 # <<<<<<<<<<<<<< + * field[i1 ,j1-1,k1 ] += mass[n] * dx2 * dy * dz2 + * field[i1-1,j1 ,k1 ] += mass[n] * dx * dy2 * dz2 + */ + __pyx_t_28 = __pyx_v_n; + __pyx_t_29 = (__pyx_v_i1 - 1); + __pyx_t_30 = (__pyx_v_j1 - 1); + __pyx_t_31 = __pyx_v_k1; + *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_field.buf, __pyx_t_29, __pyx_bstride_0_field, __pyx_t_30, __pyx_bstride_1_field, __pyx_t_31, __pyx_bstride_2_field) += ((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_mass.buf, __pyx_t_28, __pyx_bstride_0_mass)) * __pyx_v_dx) * __pyx_v_dy) * __pyx_v_dz2); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":78 + * field[i1 ,j1 ,k1-1] += mass[n] * dx2 * dy2 * dz + * field[i1-1,j1-1,k1 ] += mass[n] * dx * dy * dz2 + * field[i1 ,j1-1,k1 ] += mass[n] * dx2 * dy * dz2 # <<<<<<<<<<<<<< + * field[i1-1,j1 ,k1 ] += mass[n] * dx * dy2 * dz2 + * field[i1 ,j1 ,k1 ] += mass[n] * dx2 * dy2 * dz2 + */ + __pyx_t_32 = __pyx_v_n; + __pyx_t_33 = __pyx_v_i1; + __pyx_t_34 = (__pyx_v_j1 - 1); + __pyx_t_35 = __pyx_v_k1; + *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_field.buf, __pyx_t_33, __pyx_bstride_0_field, __pyx_t_34, __pyx_bstride_1_field, __pyx_t_35, __pyx_bstride_2_field) += ((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_mass.buf, __pyx_t_32, __pyx_bstride_0_mass)) * __pyx_v_dx2) * __pyx_v_dy) * __pyx_v_dz2); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":79 + * field[i1-1,j1-1,k1 ] += mass[n] * dx * dy * dz2 + * field[i1 ,j1-1,k1 ] += mass[n] * dx2 * dy * dz2 + * field[i1-1,j1 ,k1 ] += mass[n] * dx * dy2 * dz2 # <<<<<<<<<<<<<< + * field[i1 ,j1 ,k1 ] += mass[n] * dx2 * dy2 * dz2 + */ + __pyx_t_36 = __pyx_v_n; + __pyx_t_37 = (__pyx_v_i1 - 1); + __pyx_t_38 = __pyx_v_j1; + __pyx_t_39 = __pyx_v_k1; + *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_field.buf, __pyx_t_37, __pyx_bstride_0_field, __pyx_t_38, __pyx_bstride_1_field, __pyx_t_39, __pyx_bstride_2_field) += ((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_mass.buf, __pyx_t_36, __pyx_bstride_0_mass)) * __pyx_v_dx) * __pyx_v_dy2) * __pyx_v_dz2); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/CICDeposit.pyx":80 + * field[i1 ,j1-1,k1 ] += mass[n] * dx2 * dy * dz2 + * field[i1-1,j1 ,k1 ] += mass[n] * dx * dy2 * dz2 + * field[i1 ,j1 ,k1 ] += mass[n] * dx2 * dy2 * dz2 # <<<<<<<<<<<<<< + */ + __pyx_t_40 = __pyx_v_n; + __pyx_t_41 = __pyx_v_i1; + __pyx_t_42 = __pyx_v_j1; + __pyx_t_43 = __pyx_v_k1; + *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_field.buf, __pyx_t_41, __pyx_bstride_0_field, __pyx_t_42, __pyx_bstride_1_field, __pyx_t_43, __pyx_bstride_2_field) += ((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_mass.buf, __pyx_t_40, __pyx_bstride_0_mass)) * __pyx_v_dx2) * __pyx_v_dy2) * __pyx_v_dz2); + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_field); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_leftEdge); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_posz); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_posx); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_posy); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_gridDimension); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mass); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.amr_utils.CICDeposit_3"); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_field); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_leftEdge); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_posz); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_posx); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_posy); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_gridDimension); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mass); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":33 + * double fabs(double x) + * + * cdef inline np.int64_t i64max(np.int64_t i0, np.int64_t i1): # <<<<<<<<<<<<<< + * if i0 > i1: return i0 + * return i1 + */ + +static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_9amr_utils_i64max(__pyx_t_5numpy_int64_t __pyx_v_i0, __pyx_t_5numpy_int64_t __pyx_v_i1) { + __pyx_t_5numpy_int64_t __pyx_r; + int __pyx_t_1; + __Pyx_RefNannySetupContext("i64max"); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":34 + * + * cdef inline np.int64_t i64max(np.int64_t i0, np.int64_t i1): + * if i0 > i1: return i0 # <<<<<<<<<<<<<< + * return i1 + * + */ + __pyx_t_1 = (__pyx_v_i0 > __pyx_v_i1); + if (__pyx_t_1) { + __pyx_r = __pyx_v_i0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":35 + * cdef inline np.int64_t i64max(np.int64_t i0, np.int64_t i1): + * if i0 > i1: return i0 + * return i1 # <<<<<<<<<<<<<< + * + * cdef inline np.int64_t i64min(np.int64_t i0, np.int64_t i1): + */ + __pyx_r = __pyx_v_i1; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":37 + * return i1 + * + * cdef inline np.int64_t i64min(np.int64_t i0, np.int64_t i1): # <<<<<<<<<<<<<< + * if i0 < i1: return i0 + * return i1 + */ + +static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_9amr_utils_i64min(__pyx_t_5numpy_int64_t __pyx_v_i0, __pyx_t_5numpy_int64_t __pyx_v_i1) { + __pyx_t_5numpy_int64_t __pyx_r; + int __pyx_t_1; + __Pyx_RefNannySetupContext("i64min"); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":38 + * + * cdef inline np.int64_t i64min(np.int64_t i0, np.int64_t i1): + * if i0 < i1: return i0 # <<<<<<<<<<<<<< + * return i1 + * + */ + __pyx_t_1 = (__pyx_v_i0 < __pyx_v_i1); + if (__pyx_t_1) { + __pyx_r = __pyx_v_i0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":39 + * cdef inline np.int64_t i64min(np.int64_t i0, np.int64_t i1): + * if i0 < i1: return i0 + * return i1 # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + __pyx_r = __pyx_v_i1; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":42 + * + * @cython.boundscheck(False) + * def construct_boundary_relationships( # <<<<<<<<<<<<<< + * np.ndarray[dtype=np.int64_t, ndim=3] contour_ids): + * # We only look at the boundary and one cell in + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_construct_boundary_relationships(PyObject *__pyx_self, PyObject *__pyx_v_contour_ids); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_construct_boundary_relationships(PyObject *__pyx_self, PyObject *__pyx_v_contour_ids) { + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_nx; + int __pyx_v_ny; + int __pyx_v_nz; + int __pyx_v_offset_i; + int __pyx_v_offset_j; + int __pyx_v_oi; + int __pyx_v_oj; + __pyx_t_5numpy_int64_t __pyx_v_c1; + __pyx_t_5numpy_int64_t __pyx_v_c2; + PyObject *__pyx_v_tree; + Py_buffer __pyx_bstruct_contour_ids; + Py_ssize_t __pyx_bstride_0_contour_ids = 0; + Py_ssize_t __pyx_bstride_1_contour_ids = 0; + Py_ssize_t __pyx_bstride_2_contour_ids = 0; + Py_ssize_t __pyx_bshape_0_contour_ids = 0; + Py_ssize_t __pyx_bshape_1_contour_ids = 0; + Py_ssize_t __pyx_bshape_2_contour_ids = 0; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + long __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + long __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + PyObject *__pyx_t_17 = NULL; + PyObject *__pyx_t_18 = NULL; + int __pyx_t_19; + long __pyx_t_20; + int __pyx_t_21; + long __pyx_t_22; + int __pyx_t_23; + int __pyx_t_24; + int __pyx_t_25; + long __pyx_t_26; + int __pyx_t_27; + int __pyx_t_28; + long __pyx_t_29; + int __pyx_t_30; + int __pyx_t_31; + long __pyx_t_32; + int __pyx_t_33; + int __pyx_t_34; + long __pyx_t_35; + int __pyx_t_36; + int __pyx_t_37; + int __pyx_t_38; + long __pyx_t_39; + int __pyx_t_40; + int __pyx_t_41; + long __pyx_t_42; + int __pyx_t_43; + int __pyx_t_44; + long __pyx_t_45; + int __pyx_t_46; + int __pyx_t_47; + long __pyx_t_48; + int __pyx_t_49; + __Pyx_RefNannySetupContext("construct_boundary_relationships"); + __pyx_self = __pyx_self; + __pyx_v_tree = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_bstruct_contour_ids.buf = NULL; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_contour_ids), __pyx_ptype_5numpy_ndarray, 1, "contour_ids", 0))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_contour_ids, (PyObject*)__pyx_v_contour_ids, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_contour_ids = __pyx_bstruct_contour_ids.strides[0]; __pyx_bstride_1_contour_ids = __pyx_bstruct_contour_ids.strides[1]; __pyx_bstride_2_contour_ids = __pyx_bstruct_contour_ids.strides[2]; + __pyx_bshape_0_contour_ids = __pyx_bstruct_contour_ids.shape[0]; __pyx_bshape_1_contour_ids = __pyx_bstruct_contour_ids.shape[1]; __pyx_bshape_2_contour_ids = __pyx_bstruct_contour_ids.shape[2]; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":47 + * cdef int i, j, nx, ny, nz, offset_i, offset_j, oi, oj + * cdef np.int64_t c1, c2 + * tree = [] # <<<<<<<<<<<<<< + * nx = contour_ids.shape[0] + * ny = contour_ids.shape[1] + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_v_tree)); + __pyx_v_tree = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":48 + * cdef np.int64_t c1, c2 + * tree = [] + * nx = contour_ids.shape[0] # <<<<<<<<<<<<<< + * ny = contour_ids.shape[1] + * nz = contour_ids.shape[2] + */ + __pyx_v_nx = (((PyArrayObject *)__pyx_v_contour_ids)->dimensions[0]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":49 + * tree = [] + * nx = contour_ids.shape[0] + * ny = contour_ids.shape[1] # <<<<<<<<<<<<<< + * nz = contour_ids.shape[2] + * # First x-pass + */ + __pyx_v_ny = (((PyArrayObject *)__pyx_v_contour_ids)->dimensions[1]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":50 + * nx = contour_ids.shape[0] + * ny = contour_ids.shape[1] + * nz = contour_ids.shape[2] # <<<<<<<<<<<<<< + * # First x-pass + * for i in range(ny): + */ + __pyx_v_nz = (((PyArrayObject *)__pyx_v_contour_ids)->dimensions[2]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":52 + * nz = contour_ids.shape[2] + * # First x-pass + * for i in range(ny): # <<<<<<<<<<<<<< + * for j in range(nz): + * for offset_i in range(3): + */ + __pyx_t_2 = __pyx_v_ny; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":53 + * # First x-pass + * for i in range(ny): + * for j in range(nz): # <<<<<<<<<<<<<< + * for offset_i in range(3): + * oi = offset_i - 1 + */ + __pyx_t_4 = __pyx_v_nz; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_j = __pyx_t_5; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":54 + * for i in range(ny): + * for j in range(nz): + * for offset_i in range(3): # <<<<<<<<<<<<<< + * oi = offset_i - 1 + * if i == 0 and oi == -1: continue + */ + for (__pyx_t_6 = 0; __pyx_t_6 < 3; __pyx_t_6+=1) { + __pyx_v_offset_i = __pyx_t_6; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":55 + * for j in range(nz): + * for offset_i in range(3): + * oi = offset_i - 1 # <<<<<<<<<<<<<< + * if i == 0 and oi == -1: continue + * if i == ny - 1 and oj == 1: continue + */ + __pyx_v_oi = (__pyx_v_offset_i - 1); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":56 + * for offset_i in range(3): + * oi = offset_i - 1 + * if i == 0 and oi == -1: continue # <<<<<<<<<<<<<< + * if i == ny - 1 and oj == 1: continue + * for offset_j in range(3): + */ + __pyx_t_7 = (__pyx_v_i == 0); + if (__pyx_t_7) { + __pyx_t_8 = (__pyx_v_oi == -1); + __pyx_t_9 = __pyx_t_8; + } else { + __pyx_t_9 = __pyx_t_7; + } + if (__pyx_t_9) { + goto __pyx_L9_continue; + goto __pyx_L11; + } + __pyx_L11:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":57 + * oi = offset_i - 1 + * if i == 0 and oi == -1: continue + * if i == ny - 1 and oj == 1: continue # <<<<<<<<<<<<<< + * for offset_j in range(3): + * oj = offset_j - 1 + */ + __pyx_t_9 = (__pyx_v_i == (__pyx_v_ny - 1)); + if (__pyx_t_9) { + __pyx_t_7 = (__pyx_v_oj == 1); + __pyx_t_8 = __pyx_t_7; + } else { + __pyx_t_8 = __pyx_t_9; + } + if (__pyx_t_8) { + goto __pyx_L9_continue; + goto __pyx_L12; + } + __pyx_L12:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":58 + * if i == 0 and oi == -1: continue + * if i == ny - 1 and oj == 1: continue + * for offset_j in range(3): # <<<<<<<<<<<<<< + * oj = offset_j - 1 + * if j == 0 and oj == -1: continue + */ + for (__pyx_t_10 = 0; __pyx_t_10 < 3; __pyx_t_10+=1) { + __pyx_v_offset_j = __pyx_t_10; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":59 + * if i == ny - 1 and oj == 1: continue + * for offset_j in range(3): + * oj = offset_j - 1 # <<<<<<<<<<<<<< + * if j == 0 and oj == -1: continue + * if j == nz - 1 and oj == 1: continue + */ + __pyx_v_oj = (__pyx_v_offset_j - 1); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":60 + * for offset_j in range(3): + * oj = offset_j - 1 + * if j == 0 and oj == -1: continue # <<<<<<<<<<<<<< + * if j == nz - 1 and oj == 1: continue + * c1 = contour_ids[0, i, j] + */ + __pyx_t_8 = (__pyx_v_j == 0); + if (__pyx_t_8) { + __pyx_t_9 = (__pyx_v_oj == -1); + __pyx_t_7 = __pyx_t_9; + } else { + __pyx_t_7 = __pyx_t_8; + } + if (__pyx_t_7) { + goto __pyx_L13_continue; + goto __pyx_L15; + } + __pyx_L15:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":61 + * oj = offset_j - 1 + * if j == 0 and oj == -1: continue + * if j == nz - 1 and oj == 1: continue # <<<<<<<<<<<<<< + * c1 = contour_ids[0, i, j] + * c2 = contour_ids[1, i + oi, j + oj] + */ + __pyx_t_7 = (__pyx_v_j == (__pyx_v_nz - 1)); + if (__pyx_t_7) { + __pyx_t_8 = (__pyx_v_oj == 1); + __pyx_t_9 = __pyx_t_8; + } else { + __pyx_t_9 = __pyx_t_7; + } + if (__pyx_t_9) { + goto __pyx_L13_continue; + goto __pyx_L16; + } + __pyx_L16:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":62 + * if j == 0 and oj == -1: continue + * if j == nz - 1 and oj == 1: continue + * c1 = contour_ids[0, i, j] # <<<<<<<<<<<<<< + * c2 = contour_ids[1, i + oi, j + oj] + * if c1 > -1 and c2 > -1: + */ + __pyx_t_11 = 0; + __pyx_t_12 = __pyx_v_i; + __pyx_t_13 = __pyx_v_j; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_bshape_0_contour_ids; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_bshape_1_contour_ids; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_bshape_2_contour_ids; + __pyx_v_c1 = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_contour_ids.buf, __pyx_t_11, __pyx_bstride_0_contour_ids, __pyx_t_12, __pyx_bstride_1_contour_ids, __pyx_t_13, __pyx_bstride_2_contour_ids)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":63 + * if j == nz - 1 and oj == 1: continue + * c1 = contour_ids[0, i, j] + * c2 = contour_ids[1, i + oi, j + oj] # <<<<<<<<<<<<<< + * if c1 > -1 and c2 > -1: + * tree.append((i64max(c1,c2), i64min(c1,c2))) + */ + __pyx_t_14 = 1; + __pyx_t_15 = (__pyx_v_i + __pyx_v_oi); + __pyx_t_16 = (__pyx_v_j + __pyx_v_oj); + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_0_contour_ids; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_1_contour_ids; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_bshape_2_contour_ids; + __pyx_v_c2 = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_contour_ids.buf, __pyx_t_14, __pyx_bstride_0_contour_ids, __pyx_t_15, __pyx_bstride_1_contour_ids, __pyx_t_16, __pyx_bstride_2_contour_ids)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":64 + * c1 = contour_ids[0, i, j] + * c2 = contour_ids[1, i + oi, j + oj] + * if c1 > -1 and c2 > -1: # <<<<<<<<<<<<<< + * tree.append((i64max(c1,c2), i64min(c1,c2))) + * c1 = contour_ids[nx-1, i, j] + */ + __pyx_t_9 = (__pyx_v_c1 > -1); + if (__pyx_t_9) { + __pyx_t_7 = (__pyx_v_c2 > -1); + __pyx_t_8 = __pyx_t_7; + } else { + __pyx_t_8 = __pyx_t_9; + } + if (__pyx_t_8) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":65 + * c2 = contour_ids[1, i + oi, j + oj] + * if c1 > -1 and c2 > -1: + * tree.append((i64max(c1,c2), i64min(c1,c2))) # <<<<<<<<<<<<<< + * c1 = contour_ids[nx-1, i, j] + * c2 = contour_ids[nx-2, i + oi, j + oj] + */ + if (unlikely(__pyx_v_tree == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyInt_to_py_npy_int64(__pyx_f_2yt_9amr_utils_i64max(__pyx_v_c1, __pyx_v_c2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_17 = __Pyx_PyInt_to_py_npy_int64(__pyx_f_2yt_9amr_utils_i64min(__pyx_v_c1, __pyx_v_c2)); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_17); + __Pyx_GIVEREF(__pyx_t_17); + __pyx_t_1 = 0; + __pyx_t_17 = 0; + __pyx_t_19 = PyList_Append(((PyObject *)__pyx_v_tree), __pyx_t_18); if (unlikely(__pyx_t_19 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + goto __pyx_L17; + } + __pyx_L17:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":66 + * if c1 > -1 and c2 > -1: + * tree.append((i64max(c1,c2), i64min(c1,c2))) + * c1 = contour_ids[nx-1, i, j] # <<<<<<<<<<<<<< + * c2 = contour_ids[nx-2, i + oi, j + oj] + * if c1 > -1 and c2 > -1: + */ + __pyx_t_20 = (__pyx_v_nx - 1); + __pyx_t_19 = __pyx_v_i; + __pyx_t_21 = __pyx_v_j; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_bshape_0_contour_ids; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_bshape_1_contour_ids; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_bshape_2_contour_ids; + __pyx_v_c1 = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_contour_ids.buf, __pyx_t_20, __pyx_bstride_0_contour_ids, __pyx_t_19, __pyx_bstride_1_contour_ids, __pyx_t_21, __pyx_bstride_2_contour_ids)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":67 + * tree.append((i64max(c1,c2), i64min(c1,c2))) + * c1 = contour_ids[nx-1, i, j] + * c2 = contour_ids[nx-2, i + oi, j + oj] # <<<<<<<<<<<<<< + * if c1 > -1 and c2 > -1: + * tree.append((i64max(c1,c2), i64min(c1,c2))) + */ + __pyx_t_22 = (__pyx_v_nx - 2); + __pyx_t_23 = (__pyx_v_i + __pyx_v_oi); + __pyx_t_24 = (__pyx_v_j + __pyx_v_oj); + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_bshape_0_contour_ids; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_bshape_1_contour_ids; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_bshape_2_contour_ids; + __pyx_v_c2 = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_contour_ids.buf, __pyx_t_22, __pyx_bstride_0_contour_ids, __pyx_t_23, __pyx_bstride_1_contour_ids, __pyx_t_24, __pyx_bstride_2_contour_ids)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":68 + * c1 = contour_ids[nx-1, i, j] + * c2 = contour_ids[nx-2, i + oi, j + oj] + * if c1 > -1 and c2 > -1: # <<<<<<<<<<<<<< + * tree.append((i64max(c1,c2), i64min(c1,c2))) + * # Now y-pass + */ + __pyx_t_8 = (__pyx_v_c1 > -1); + if (__pyx_t_8) { + __pyx_t_9 = (__pyx_v_c2 > -1); + __pyx_t_7 = __pyx_t_9; + } else { + __pyx_t_7 = __pyx_t_8; + } + if (__pyx_t_7) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":69 + * c2 = contour_ids[nx-2, i + oi, j + oj] + * if c1 > -1 and c2 > -1: + * tree.append((i64max(c1,c2), i64min(c1,c2))) # <<<<<<<<<<<<<< + * # Now y-pass + * for i in range(nx): + */ + if (unlikely(__pyx_v_tree == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_18 = __Pyx_PyInt_to_py_npy_int64(__pyx_f_2yt_9amr_utils_i64max(__pyx_v_c1, __pyx_v_c2)); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_17 = __Pyx_PyInt_to_py_npy_int64(__pyx_f_2yt_9amr_utils_i64min(__pyx_v_c1, __pyx_v_c2)); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_18); + __Pyx_GIVEREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_17); + __Pyx_GIVEREF(__pyx_t_17); + __pyx_t_18 = 0; + __pyx_t_17 = 0; + __pyx_t_25 = PyList_Append(((PyObject *)__pyx_v_tree), __pyx_t_1); if (unlikely(__pyx_t_25 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L18; + } + __pyx_L18:; + __pyx_L13_continue:; + } + __pyx_L9_continue:; + } + } + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":71 + * tree.append((i64max(c1,c2), i64min(c1,c2))) + * # Now y-pass + * for i in range(nx): # <<<<<<<<<<<<<< + * for j in range(nz): + * for offset_i in range(3): + */ + __pyx_t_2 = __pyx_v_nx; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":72 + * # Now y-pass + * for i in range(nx): + * for j in range(nz): # <<<<<<<<<<<<<< + * for offset_i in range(3): + * oi = offset_i - 1 + */ + __pyx_t_4 = __pyx_v_nz; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_j = __pyx_t_5; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":73 + * for i in range(nx): + * for j in range(nz): + * for offset_i in range(3): # <<<<<<<<<<<<<< + * oi = offset_i - 1 + * if i == 0 and oi == -1: continue + */ + for (__pyx_t_6 = 0; __pyx_t_6 < 3; __pyx_t_6+=1) { + __pyx_v_offset_i = __pyx_t_6; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":74 + * for j in range(nz): + * for offset_i in range(3): + * oi = offset_i - 1 # <<<<<<<<<<<<<< + * if i == 0 and oi == -1: continue + * if i == nx - 1 and oj == 1: continue + */ + __pyx_v_oi = (__pyx_v_offset_i - 1); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":75 + * for offset_i in range(3): + * oi = offset_i - 1 + * if i == 0 and oi == -1: continue # <<<<<<<<<<<<<< + * if i == nx - 1 and oj == 1: continue + * for offset_j in range(3): + */ + __pyx_t_7 = (__pyx_v_i == 0); + if (__pyx_t_7) { + __pyx_t_8 = (__pyx_v_oi == -1); + __pyx_t_9 = __pyx_t_8; + } else { + __pyx_t_9 = __pyx_t_7; + } + if (__pyx_t_9) { + goto __pyx_L23_continue; + goto __pyx_L25; + } + __pyx_L25:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":76 + * oi = offset_i - 1 + * if i == 0 and oi == -1: continue + * if i == nx - 1 and oj == 1: continue # <<<<<<<<<<<<<< + * for offset_j in range(3): + * oj = offset_j - 1 + */ + __pyx_t_9 = (__pyx_v_i == (__pyx_v_nx - 1)); + if (__pyx_t_9) { + __pyx_t_7 = (__pyx_v_oj == 1); + __pyx_t_8 = __pyx_t_7; + } else { + __pyx_t_8 = __pyx_t_9; + } + if (__pyx_t_8) { + goto __pyx_L23_continue; + goto __pyx_L26; + } + __pyx_L26:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":77 + * if i == 0 and oi == -1: continue + * if i == nx - 1 and oj == 1: continue + * for offset_j in range(3): # <<<<<<<<<<<<<< + * oj = offset_j - 1 + * if j == 0 and oj == -1: continue + */ + for (__pyx_t_10 = 0; __pyx_t_10 < 3; __pyx_t_10+=1) { + __pyx_v_offset_j = __pyx_t_10; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":78 + * if i == nx - 1 and oj == 1: continue + * for offset_j in range(3): + * oj = offset_j - 1 # <<<<<<<<<<<<<< + * if j == 0 and oj == -1: continue + * if j == nz - 1 and oj == 1: continue + */ + __pyx_v_oj = (__pyx_v_offset_j - 1); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":79 + * for offset_j in range(3): + * oj = offset_j - 1 + * if j == 0 and oj == -1: continue # <<<<<<<<<<<<<< + * if j == nz - 1 and oj == 1: continue + * c1 = contour_ids[i, 0, j] + */ + __pyx_t_8 = (__pyx_v_j == 0); + if (__pyx_t_8) { + __pyx_t_9 = (__pyx_v_oj == -1); + __pyx_t_7 = __pyx_t_9; + } else { + __pyx_t_7 = __pyx_t_8; + } + if (__pyx_t_7) { + goto __pyx_L27_continue; + goto __pyx_L29; + } + __pyx_L29:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":80 + * oj = offset_j - 1 + * if j == 0 and oj == -1: continue + * if j == nz - 1 and oj == 1: continue # <<<<<<<<<<<<<< + * c1 = contour_ids[i, 0, j] + * c2 = contour_ids[i + oi, 1, j + oj] + */ + __pyx_t_7 = (__pyx_v_j == (__pyx_v_nz - 1)); + if (__pyx_t_7) { + __pyx_t_8 = (__pyx_v_oj == 1); + __pyx_t_9 = __pyx_t_8; + } else { + __pyx_t_9 = __pyx_t_7; + } + if (__pyx_t_9) { + goto __pyx_L27_continue; + goto __pyx_L30; + } + __pyx_L30:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":81 + * if j == 0 and oj == -1: continue + * if j == nz - 1 and oj == 1: continue + * c1 = contour_ids[i, 0, j] # <<<<<<<<<<<<<< + * c2 = contour_ids[i + oi, 1, j + oj] + * if c1 > -1 and c2 > -1: + */ + __pyx_t_25 = __pyx_v_i; + __pyx_t_26 = 0; + __pyx_t_27 = __pyx_v_j; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_bshape_0_contour_ids; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_bshape_1_contour_ids; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_bshape_2_contour_ids; + __pyx_v_c1 = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_contour_ids.buf, __pyx_t_25, __pyx_bstride_0_contour_ids, __pyx_t_26, __pyx_bstride_1_contour_ids, __pyx_t_27, __pyx_bstride_2_contour_ids)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":82 + * if j == nz - 1 and oj == 1: continue + * c1 = contour_ids[i, 0, j] + * c2 = contour_ids[i + oi, 1, j + oj] # <<<<<<<<<<<<<< + * if c1 > -1 and c2 > -1: + * tree.append((i64max(c1,c2), i64min(c1,c2))) + */ + __pyx_t_28 = (__pyx_v_i + __pyx_v_oi); + __pyx_t_29 = 1; + __pyx_t_30 = (__pyx_v_j + __pyx_v_oj); + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_bshape_0_contour_ids; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_bshape_1_contour_ids; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_bshape_2_contour_ids; + __pyx_v_c2 = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_contour_ids.buf, __pyx_t_28, __pyx_bstride_0_contour_ids, __pyx_t_29, __pyx_bstride_1_contour_ids, __pyx_t_30, __pyx_bstride_2_contour_ids)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":83 + * c1 = contour_ids[i, 0, j] + * c2 = contour_ids[i + oi, 1, j + oj] + * if c1 > -1 and c2 > -1: # <<<<<<<<<<<<<< + * tree.append((i64max(c1,c2), i64min(c1,c2))) + * c1 = contour_ids[i, ny-1, j] + */ + __pyx_t_9 = (__pyx_v_c1 > -1); + if (__pyx_t_9) { + __pyx_t_7 = (__pyx_v_c2 > -1); + __pyx_t_8 = __pyx_t_7; + } else { + __pyx_t_8 = __pyx_t_9; + } + if (__pyx_t_8) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":84 + * c2 = contour_ids[i + oi, 1, j + oj] + * if c1 > -1 and c2 > -1: + * tree.append((i64max(c1,c2), i64min(c1,c2))) # <<<<<<<<<<<<<< + * c1 = contour_ids[i, ny-1, j] + * c2 = contour_ids[i + oi, ny-2, j + oj] + */ + if (unlikely(__pyx_v_tree == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyInt_to_py_npy_int64(__pyx_f_2yt_9amr_utils_i64max(__pyx_v_c1, __pyx_v_c2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_17 = __Pyx_PyInt_to_py_npy_int64(__pyx_f_2yt_9amr_utils_i64min(__pyx_v_c1, __pyx_v_c2)); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_17); + __Pyx_GIVEREF(__pyx_t_17); + __pyx_t_1 = 0; + __pyx_t_17 = 0; + __pyx_t_31 = PyList_Append(((PyObject *)__pyx_v_tree), __pyx_t_18); if (unlikely(__pyx_t_31 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + goto __pyx_L31; + } + __pyx_L31:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":85 + * if c1 > -1 and c2 > -1: + * tree.append((i64max(c1,c2), i64min(c1,c2))) + * c1 = contour_ids[i, ny-1, j] # <<<<<<<<<<<<<< + * c2 = contour_ids[i + oi, ny-2, j + oj] + * if c1 > -1 and c2 > -1: + */ + __pyx_t_31 = __pyx_v_i; + __pyx_t_32 = (__pyx_v_ny - 1); + __pyx_t_33 = __pyx_v_j; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_bshape_0_contour_ids; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_bshape_1_contour_ids; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_bshape_2_contour_ids; + __pyx_v_c1 = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_contour_ids.buf, __pyx_t_31, __pyx_bstride_0_contour_ids, __pyx_t_32, __pyx_bstride_1_contour_ids, __pyx_t_33, __pyx_bstride_2_contour_ids)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":86 + * tree.append((i64max(c1,c2), i64min(c1,c2))) + * c1 = contour_ids[i, ny-1, j] + * c2 = contour_ids[i + oi, ny-2, j + oj] # <<<<<<<<<<<<<< + * if c1 > -1 and c2 > -1: + * tree.append((i64max(c1,c2), i64min(c1,c2))) + */ + __pyx_t_34 = (__pyx_v_i + __pyx_v_oi); + __pyx_t_35 = (__pyx_v_ny - 2); + __pyx_t_36 = (__pyx_v_j + __pyx_v_oj); + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_bshape_0_contour_ids; + if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_bshape_1_contour_ids; + if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_bshape_2_contour_ids; + __pyx_v_c2 = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_contour_ids.buf, __pyx_t_34, __pyx_bstride_0_contour_ids, __pyx_t_35, __pyx_bstride_1_contour_ids, __pyx_t_36, __pyx_bstride_2_contour_ids)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":87 + * c1 = contour_ids[i, ny-1, j] + * c2 = contour_ids[i + oi, ny-2, j + oj] + * if c1 > -1 and c2 > -1: # <<<<<<<<<<<<<< + * tree.append((i64max(c1,c2), i64min(c1,c2))) + * for i in range(nx): + */ + __pyx_t_8 = (__pyx_v_c1 > -1); + if (__pyx_t_8) { + __pyx_t_9 = (__pyx_v_c2 > -1); + __pyx_t_7 = __pyx_t_9; + } else { + __pyx_t_7 = __pyx_t_8; + } + if (__pyx_t_7) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":88 + * c2 = contour_ids[i + oi, ny-2, j + oj] + * if c1 > -1 and c2 > -1: + * tree.append((i64max(c1,c2), i64min(c1,c2))) # <<<<<<<<<<<<<< + * for i in range(nx): + * for j in range(ny): + */ + if (unlikely(__pyx_v_tree == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_18 = __Pyx_PyInt_to_py_npy_int64(__pyx_f_2yt_9amr_utils_i64max(__pyx_v_c1, __pyx_v_c2)); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_17 = __Pyx_PyInt_to_py_npy_int64(__pyx_f_2yt_9amr_utils_i64min(__pyx_v_c1, __pyx_v_c2)); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_18); + __Pyx_GIVEREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_17); + __Pyx_GIVEREF(__pyx_t_17); + __pyx_t_18 = 0; + __pyx_t_17 = 0; + __pyx_t_37 = PyList_Append(((PyObject *)__pyx_v_tree), __pyx_t_1); if (unlikely(__pyx_t_37 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L32; + } + __pyx_L32:; + __pyx_L27_continue:; + } + __pyx_L23_continue:; + } + } + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":89 + * if c1 > -1 and c2 > -1: + * tree.append((i64max(c1,c2), i64min(c1,c2))) + * for i in range(nx): # <<<<<<<<<<<<<< + * for j in range(ny): + * for offset_i in range(3): + */ + __pyx_t_2 = __pyx_v_nx; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":90 + * tree.append((i64max(c1,c2), i64min(c1,c2))) + * for i in range(nx): + * for j in range(ny): # <<<<<<<<<<<<<< + * for offset_i in range(3): + * oi = offset_i - 1 + */ + __pyx_t_4 = __pyx_v_ny; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_j = __pyx_t_5; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":91 + * for i in range(nx): + * for j in range(ny): + * for offset_i in range(3): # <<<<<<<<<<<<<< + * oi = offset_i - 1 + * if i == 0 and oi == -1: continue + */ + for (__pyx_t_6 = 0; __pyx_t_6 < 3; __pyx_t_6+=1) { + __pyx_v_offset_i = __pyx_t_6; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":92 + * for j in range(ny): + * for offset_i in range(3): + * oi = offset_i - 1 # <<<<<<<<<<<<<< + * if i == 0 and oi == -1: continue + * if i == nx - 1 and oj == 1: continue + */ + __pyx_v_oi = (__pyx_v_offset_i - 1); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":93 + * for offset_i in range(3): + * oi = offset_i - 1 + * if i == 0 and oi == -1: continue # <<<<<<<<<<<<<< + * if i == nx - 1 and oj == 1: continue + * for offset_j in range(3): + */ + __pyx_t_7 = (__pyx_v_i == 0); + if (__pyx_t_7) { + __pyx_t_8 = (__pyx_v_oi == -1); + __pyx_t_9 = __pyx_t_8; + } else { + __pyx_t_9 = __pyx_t_7; + } + if (__pyx_t_9) { + goto __pyx_L37_continue; + goto __pyx_L39; + } + __pyx_L39:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":94 + * oi = offset_i - 1 + * if i == 0 and oi == -1: continue + * if i == nx - 1 and oj == 1: continue # <<<<<<<<<<<<<< + * for offset_j in range(3): + * oj = offset_j - 1 + */ + __pyx_t_9 = (__pyx_v_i == (__pyx_v_nx - 1)); + if (__pyx_t_9) { + __pyx_t_7 = (__pyx_v_oj == 1); + __pyx_t_8 = __pyx_t_7; + } else { + __pyx_t_8 = __pyx_t_9; + } + if (__pyx_t_8) { + goto __pyx_L37_continue; + goto __pyx_L40; + } + __pyx_L40:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":95 + * if i == 0 and oi == -1: continue + * if i == nx - 1 and oj == 1: continue + * for offset_j in range(3): # <<<<<<<<<<<<<< + * oj = offset_j - 1 + * if j == 0 and oj == -1: continue + */ + for (__pyx_t_10 = 0; __pyx_t_10 < 3; __pyx_t_10+=1) { + __pyx_v_offset_j = __pyx_t_10; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":96 + * if i == nx - 1 and oj == 1: continue + * for offset_j in range(3): + * oj = offset_j - 1 # <<<<<<<<<<<<<< + * if j == 0 and oj == -1: continue + * if j == ny - 1 and oj == 1: continue + */ + __pyx_v_oj = (__pyx_v_offset_j - 1); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":97 + * for offset_j in range(3): + * oj = offset_j - 1 + * if j == 0 and oj == -1: continue # <<<<<<<<<<<<<< + * if j == ny - 1 and oj == 1: continue + * c1 = contour_ids[i, j, 0] + */ + __pyx_t_8 = (__pyx_v_j == 0); + if (__pyx_t_8) { + __pyx_t_9 = (__pyx_v_oj == -1); + __pyx_t_7 = __pyx_t_9; + } else { + __pyx_t_7 = __pyx_t_8; + } + if (__pyx_t_7) { + goto __pyx_L41_continue; + goto __pyx_L43; + } + __pyx_L43:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":98 + * oj = offset_j - 1 + * if j == 0 and oj == -1: continue + * if j == ny - 1 and oj == 1: continue # <<<<<<<<<<<<<< + * c1 = contour_ids[i, j, 0] + * c2 = contour_ids[i + oi, j + oj, 1] + */ + __pyx_t_7 = (__pyx_v_j == (__pyx_v_ny - 1)); + if (__pyx_t_7) { + __pyx_t_8 = (__pyx_v_oj == 1); + __pyx_t_9 = __pyx_t_8; + } else { + __pyx_t_9 = __pyx_t_7; + } + if (__pyx_t_9) { + goto __pyx_L41_continue; + goto __pyx_L44; + } + __pyx_L44:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":99 + * if j == 0 and oj == -1: continue + * if j == ny - 1 and oj == 1: continue + * c1 = contour_ids[i, j, 0] # <<<<<<<<<<<<<< + * c2 = contour_ids[i + oi, j + oj, 1] + * if c1 > -1 and c2 > -1: + */ + __pyx_t_37 = __pyx_v_i; + __pyx_t_38 = __pyx_v_j; + __pyx_t_39 = 0; + if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_bshape_0_contour_ids; + if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_bshape_1_contour_ids; + if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_bshape_2_contour_ids; + __pyx_v_c1 = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_contour_ids.buf, __pyx_t_37, __pyx_bstride_0_contour_ids, __pyx_t_38, __pyx_bstride_1_contour_ids, __pyx_t_39, __pyx_bstride_2_contour_ids)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":100 + * if j == ny - 1 and oj == 1: continue + * c1 = contour_ids[i, j, 0] + * c2 = contour_ids[i + oi, j + oj, 1] # <<<<<<<<<<<<<< + * if c1 > -1 and c2 > -1: + * tree.append((i64max(c1,c2), i64min(c1,c2))) + */ + __pyx_t_40 = (__pyx_v_i + __pyx_v_oi); + __pyx_t_41 = (__pyx_v_j + __pyx_v_oj); + __pyx_t_42 = 1; + if (__pyx_t_40 < 0) __pyx_t_40 += __pyx_bshape_0_contour_ids; + if (__pyx_t_41 < 0) __pyx_t_41 += __pyx_bshape_1_contour_ids; + if (__pyx_t_42 < 0) __pyx_t_42 += __pyx_bshape_2_contour_ids; + __pyx_v_c2 = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_contour_ids.buf, __pyx_t_40, __pyx_bstride_0_contour_ids, __pyx_t_41, __pyx_bstride_1_contour_ids, __pyx_t_42, __pyx_bstride_2_contour_ids)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":101 + * c1 = contour_ids[i, j, 0] + * c2 = contour_ids[i + oi, j + oj, 1] + * if c1 > -1 and c2 > -1: # <<<<<<<<<<<<<< + * tree.append((i64max(c1,c2), i64min(c1,c2))) + * c1 = contour_ids[i, j, nz-1] + */ + __pyx_t_9 = (__pyx_v_c1 > -1); + if (__pyx_t_9) { + __pyx_t_7 = (__pyx_v_c2 > -1); + __pyx_t_8 = __pyx_t_7; + } else { + __pyx_t_8 = __pyx_t_9; + } + if (__pyx_t_8) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":102 + * c2 = contour_ids[i + oi, j + oj, 1] + * if c1 > -1 and c2 > -1: + * tree.append((i64max(c1,c2), i64min(c1,c2))) # <<<<<<<<<<<<<< + * c1 = contour_ids[i, j, nz-1] + * c2 = contour_ids[i + oi, j + oj, nz-2] + */ + if (unlikely(__pyx_v_tree == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyInt_to_py_npy_int64(__pyx_f_2yt_9amr_utils_i64max(__pyx_v_c1, __pyx_v_c2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_17 = __Pyx_PyInt_to_py_npy_int64(__pyx_f_2yt_9amr_utils_i64min(__pyx_v_c1, __pyx_v_c2)); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_17); + __Pyx_GIVEREF(__pyx_t_17); + __pyx_t_1 = 0; + __pyx_t_17 = 0; + __pyx_t_43 = PyList_Append(((PyObject *)__pyx_v_tree), __pyx_t_18); if (unlikely(__pyx_t_43 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + goto __pyx_L45; + } + __pyx_L45:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":103 + * if c1 > -1 and c2 > -1: + * tree.append((i64max(c1,c2), i64min(c1,c2))) + * c1 = contour_ids[i, j, nz-1] # <<<<<<<<<<<<<< + * c2 = contour_ids[i + oi, j + oj, nz-2] + * if c1 > -1 and c2 > -1: + */ + __pyx_t_43 = __pyx_v_i; + __pyx_t_44 = __pyx_v_j; + __pyx_t_45 = (__pyx_v_nz - 1); + if (__pyx_t_43 < 0) __pyx_t_43 += __pyx_bshape_0_contour_ids; + if (__pyx_t_44 < 0) __pyx_t_44 += __pyx_bshape_1_contour_ids; + if (__pyx_t_45 < 0) __pyx_t_45 += __pyx_bshape_2_contour_ids; + __pyx_v_c1 = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_contour_ids.buf, __pyx_t_43, __pyx_bstride_0_contour_ids, __pyx_t_44, __pyx_bstride_1_contour_ids, __pyx_t_45, __pyx_bstride_2_contour_ids)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":104 + * tree.append((i64max(c1,c2), i64min(c1,c2))) + * c1 = contour_ids[i, j, nz-1] + * c2 = contour_ids[i + oi, j + oj, nz-2] # <<<<<<<<<<<<<< + * if c1 > -1 and c2 > -1: + * tree.append((i64max(c1,c2), i64min(c1,c2))) + */ + __pyx_t_46 = (__pyx_v_i + __pyx_v_oi); + __pyx_t_47 = (__pyx_v_j + __pyx_v_oj); + __pyx_t_48 = (__pyx_v_nz - 2); + if (__pyx_t_46 < 0) __pyx_t_46 += __pyx_bshape_0_contour_ids; + if (__pyx_t_47 < 0) __pyx_t_47 += __pyx_bshape_1_contour_ids; + if (__pyx_t_48 < 0) __pyx_t_48 += __pyx_bshape_2_contour_ids; + __pyx_v_c2 = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_contour_ids.buf, __pyx_t_46, __pyx_bstride_0_contour_ids, __pyx_t_47, __pyx_bstride_1_contour_ids, __pyx_t_48, __pyx_bstride_2_contour_ids)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":105 + * c1 = contour_ids[i, j, nz-1] + * c2 = contour_ids[i + oi, j + oj, nz-2] + * if c1 > -1 and c2 > -1: # <<<<<<<<<<<<<< + * tree.append((i64max(c1,c2), i64min(c1,c2))) + * return tree + */ + __pyx_t_8 = (__pyx_v_c1 > -1); + if (__pyx_t_8) { + __pyx_t_9 = (__pyx_v_c2 > -1); + __pyx_t_7 = __pyx_t_9; + } else { + __pyx_t_7 = __pyx_t_8; + } + if (__pyx_t_7) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":106 + * c2 = contour_ids[i + oi, j + oj, nz-2] + * if c1 > -1 and c2 > -1: + * tree.append((i64max(c1,c2), i64min(c1,c2))) # <<<<<<<<<<<<<< + * return tree + * + */ + if (unlikely(__pyx_v_tree == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_18 = __Pyx_PyInt_to_py_npy_int64(__pyx_f_2yt_9amr_utils_i64max(__pyx_v_c1, __pyx_v_c2)); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_17 = __Pyx_PyInt_to_py_npy_int64(__pyx_f_2yt_9amr_utils_i64min(__pyx_v_c1, __pyx_v_c2)); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_18); + __Pyx_GIVEREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_17); + __Pyx_GIVEREF(__pyx_t_17); + __pyx_t_18 = 0; + __pyx_t_17 = 0; + __pyx_t_49 = PyList_Append(((PyObject *)__pyx_v_tree), __pyx_t_1); if (unlikely(__pyx_t_49 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L46; + } + __pyx_L46:; + __pyx_L41_continue:; + } + __pyx_L37_continue:; + } + } + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":107 + * if c1 > -1 and c2 > -1: + * tree.append((i64max(c1,c2), i64min(c1,c2))) + * return tree # <<<<<<<<<<<<<< + * + * cdef inline int are_neighbors( + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_tree)); + __pyx_r = ((PyObject *)__pyx_v_tree); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_17); + __Pyx_XDECREF(__pyx_t_18); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_contour_ids); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.amr_utils.construct_boundary_relationships"); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_contour_ids); + __pyx_L2:; + __Pyx_DECREF(__pyx_v_tree); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":109 + * return tree + * + * cdef inline int are_neighbors( # <<<<<<<<<<<<<< + * np.float64_t x1, np.float64_t y1, np.float64_t z1, + * np.float64_t dx1, np.float64_t dy1, np.float64_t dz1, + */ + +static CYTHON_INLINE int __pyx_f_2yt_9amr_utils_are_neighbors(__pyx_t_5numpy_float64_t __pyx_v_x1, __pyx_t_5numpy_float64_t __pyx_v_y1, __pyx_t_5numpy_float64_t __pyx_v_z1, __pyx_t_5numpy_float64_t __pyx_v_dx1, __pyx_t_5numpy_float64_t __pyx_v_dy1, __pyx_t_5numpy_float64_t __pyx_v_dz1, __pyx_t_5numpy_float64_t __pyx_v_x2, __pyx_t_5numpy_float64_t __pyx_v_y2, __pyx_t_5numpy_float64_t __pyx_v_z2, __pyx_t_5numpy_float64_t __pyx_v_dx2, __pyx_t_5numpy_float64_t __pyx_v_dy2, __pyx_t_5numpy_float64_t __pyx_v_dz2) { + int __pyx_r; + int __pyx_t_1; + __Pyx_RefNannySetupContext("are_neighbors"); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":116 + * ): + * # We assume an epsilon of 1e-15 + * if fabs(x1-x2) > 0.5*(dx1+dx2): return 0 # <<<<<<<<<<<<<< + * if fabs(y1-y2) > 0.5*(dy1+dy2): return 0 + * if fabs(z1-z2) > 0.5*(dz1+dz2): return 0 + */ + __pyx_t_1 = (fabs((__pyx_v_x1 - __pyx_v_x2)) > (0.5 * (__pyx_v_dx1 + __pyx_v_dx2))); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":117 + * # We assume an epsilon of 1e-15 + * if fabs(x1-x2) > 0.5*(dx1+dx2): return 0 + * if fabs(y1-y2) > 0.5*(dy1+dy2): return 0 # <<<<<<<<<<<<<< + * if fabs(z1-z2) > 0.5*(dz1+dz2): return 0 + * return 1 + */ + __pyx_t_1 = (fabs((__pyx_v_y1 - __pyx_v_y2)) > (0.5 * (__pyx_v_dy1 + __pyx_v_dy2))); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":118 + * if fabs(x1-x2) > 0.5*(dx1+dx2): return 0 + * if fabs(y1-y2) > 0.5*(dy1+dy2): return 0 + * if fabs(z1-z2) > 0.5*(dz1+dz2): return 0 # <<<<<<<<<<<<<< + * return 1 + * + */ + __pyx_t_1 = (fabs((__pyx_v_z1 - __pyx_v_z2)) > (0.5 * (__pyx_v_dz1 + __pyx_v_dz2))); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":119 + * if fabs(y1-y2) > 0.5*(dy1+dy2): return 0 + * if fabs(z1-z2) > 0.5*(dz1+dz2): return 0 + * return 1 # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + __pyx_r = 1; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":123 + * @cython.boundscheck(False) + * @cython.wraparound(False) + * def identify_field_neighbors( # <<<<<<<<<<<<<< + * np.ndarray[dtype=np.float64_t, ndim=1] field, + * np.ndarray[dtype=np.float64_t, ndim=1] x, + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_identify_field_neighbors(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_identify_field_neighbors(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_field = 0; + PyArrayObject *__pyx_v_x = 0; + PyArrayObject *__pyx_v_y = 0; + PyArrayObject *__pyx_v_z = 0; + PyArrayObject *__pyx_v_dx = 0; + PyArrayObject *__pyx_v_dy = 0; + PyArrayObject *__pyx_v_dz = 0; + int __pyx_v_outer; + int __pyx_v_inner; + int __pyx_v_N; + int __pyx_v_added; + __pyx_t_5numpy_float64_t __pyx_v_x1; + __pyx_t_5numpy_float64_t __pyx_v_y1; + __pyx_t_5numpy_float64_t __pyx_v_z1; + __pyx_t_5numpy_float64_t __pyx_v_dx1; + __pyx_t_5numpy_float64_t __pyx_v_dy1; + __pyx_t_5numpy_float64_t __pyx_v_dz1; + PyObject *__pyx_v_joins; + PyObject *__pyx_v_this_joins; + Py_buffer __pyx_bstruct_field; + Py_ssize_t __pyx_bstride_0_field = 0; + Py_ssize_t __pyx_bshape_0_field = 0; + Py_buffer __pyx_bstruct_dz; + Py_ssize_t __pyx_bstride_0_dz = 0; + Py_ssize_t __pyx_bshape_0_dz = 0; + 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_dy; + Py_ssize_t __pyx_bstride_0_dy = 0; + Py_ssize_t __pyx_bshape_0_dy = 0; + Py_buffer __pyx_bstruct_y; + Py_ssize_t __pyx_bstride_0_y = 0; + Py_ssize_t __pyx_bshape_0_y = 0; + Py_buffer __pyx_bstruct_x; + Py_ssize_t __pyx_bstride_0_x = 0; + Py_ssize_t __pyx_bshape_0_x = 0; + Py_buffer __pyx_bstruct_z; + Py_ssize_t __pyx_bstride_0_z = 0; + Py_ssize_t __pyx_bshape_0_z = 0; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + 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; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + int __pyx_t_18; + int __pyx_t_19; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__field,&__pyx_n_s__x,&__pyx_n_s__y,&__pyx_n_s__z,&__pyx_n_s__dx,&__pyx_n_s__dy,&__pyx_n_s__dz,0}; + __Pyx_RefNannySetupContext("identify_field_neighbors"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[7] = {0,0,0,0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__field); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("identify_field_neighbors", 1, 7, 7, 1); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("identify_field_neighbors", 1, 7, 7, 2); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__z); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("identify_field_neighbors", 1, 7, 7, 3); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dx); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("identify_field_neighbors", 1, 7, 7, 4); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dy); + if (likely(values[5])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("identify_field_neighbors", 1, 7, 7, 5); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 6: + values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dz); + if (likely(values[6])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("identify_field_neighbors", 1, 7, 7, 6); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "identify_field_neighbors") < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_field = ((PyArrayObject *)values[0]); + __pyx_v_x = ((PyArrayObject *)values[1]); + __pyx_v_y = ((PyArrayObject *)values[2]); + __pyx_v_z = ((PyArrayObject *)values[3]); + __pyx_v_dx = ((PyArrayObject *)values[4]); + __pyx_v_dy = ((PyArrayObject *)values[5]); + __pyx_v_dz = ((PyArrayObject *)values[6]); + } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_field = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); + __pyx_v_x = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); + __pyx_v_y = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); + __pyx_v_z = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); + __pyx_v_dx = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); + __pyx_v_dy = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 5)); + __pyx_v_dz = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 6)); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("identify_field_neighbors", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.identify_field_neighbors"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_joins = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_this_joins = Py_None; __Pyx_INCREF(Py_None); + __pyx_bstruct_field.buf = NULL; + __pyx_bstruct_x.buf = NULL; + __pyx_bstruct_y.buf = NULL; + __pyx_bstruct_z.buf = NULL; + __pyx_bstruct_dx.buf = NULL; + __pyx_bstruct_dy.buf = NULL; + __pyx_bstruct_dz.buf = NULL; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_field), __pyx_ptype_5numpy_ndarray, 1, "field", 0))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_z), __pyx_ptype_5numpy_ndarray, 1, "z", 0))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 127; __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[6]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dy), __pyx_ptype_5numpy_ndarray, 1, "dy", 0))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dz), __pyx_ptype_5numpy_ndarray, 1, "dz", 0))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_field, (PyObject*)__pyx_v_field, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_field = __pyx_bstruct_field.strides[0]; + __pyx_bshape_0_field = __pyx_bstruct_field.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_x = __pyx_bstruct_x.strides[0]; + __pyx_bshape_0_x = __pyx_bstruct_x.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_y, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_y = __pyx_bstruct_y.strides[0]; + __pyx_bshape_0_y = __pyx_bstruct_y.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_z, (PyObject*)__pyx_v_z, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_z = __pyx_bstruct_z.strides[0]; + __pyx_bshape_0_z = __pyx_bstruct_z.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dx, (PyObject*)__pyx_v_dx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 123; __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]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dy, (PyObject*)__pyx_v_dy, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_dy = __pyx_bstruct_dy.strides[0]; + __pyx_bshape_0_dy = __pyx_bstruct_dy.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dz, (PyObject*)__pyx_v_dz, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_dz = __pyx_bstruct_dz.strides[0]; + __pyx_bshape_0_dz = __pyx_bstruct_dz.shape[0]; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":135 + * cdef int outer, inner, N, added + * cdef np.float64_t x1, y1, z1, dx1, dy1, dz1 + * N = field.shape[0] # <<<<<<<<<<<<<< + * #cdef np.ndarray[dtype=np.object_t] joins + * joins = [[] for outer in range(N)] + */ + __pyx_v_N = (__pyx_v_field->dimensions[0]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":137 + * N = field.shape[0] + * #cdef np.ndarray[dtype=np.object_t] joins + * joins = [[] for outer in range(N)] # <<<<<<<<<<<<<< + * #joins = np.empty(N, dtype='object') + * for outer in range(N): + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = __pyx_v_N; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_outer = __pyx_t_3; + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + } + __Pyx_INCREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_v_joins)); + __pyx_v_joins = __pyx_t_1; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":139 + * joins = [[] for outer in range(N)] + * #joins = np.empty(N, dtype='object') + * for outer in range(N): # <<<<<<<<<<<<<< + * if (outer % 10000) == 0: print outer, N + * x1 = x[outer] + */ + __pyx_t_2 = __pyx_v_N; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_outer = __pyx_t_3; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":140 + * #joins = np.empty(N, dtype='object') + * for outer in range(N): + * if (outer % 10000) == 0: print outer, N # <<<<<<<<<<<<<< + * x1 = x[outer] + * y1 = y[outer] + */ + __pyx_t_5 = (__Pyx_mod_long(__pyx_v_outer, 10000) == 0); + if (__pyx_t_5) { + __pyx_t_1 = PyInt_FromLong(__pyx_v_outer); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyInt_FromLong(__pyx_v_N); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_1 = 0; + __pyx_t_4 = 0; + if (__Pyx_Print(0, __pyx_t_6, 1) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + goto __pyx_L10; + } + __pyx_L10:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":141 + * for outer in range(N): + * if (outer % 10000) == 0: print outer, N + * x1 = x[outer] # <<<<<<<<<<<<<< + * y1 = y[outer] + * z1 = z[outer] + */ + __pyx_t_7 = __pyx_v_outer; + __pyx_v_x1 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x.buf, __pyx_t_7, __pyx_bstride_0_x)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":142 + * if (outer % 10000) == 0: print outer, N + * x1 = x[outer] + * y1 = y[outer] # <<<<<<<<<<<<<< + * z1 = z[outer] + * dx1 = dx[outer] + */ + __pyx_t_8 = __pyx_v_outer; + __pyx_v_y1 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y.buf, __pyx_t_8, __pyx_bstride_0_y)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":143 + * x1 = x[outer] + * y1 = y[outer] + * z1 = z[outer] # <<<<<<<<<<<<<< + * dx1 = dx[outer] + * dy1 = dy[outer] + */ + __pyx_t_9 = __pyx_v_outer; + __pyx_v_z1 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_z.buf, __pyx_t_9, __pyx_bstride_0_z)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":144 + * y1 = y[outer] + * z1 = z[outer] + * dx1 = dx[outer] # <<<<<<<<<<<<<< + * dy1 = dy[outer] + * dz1 = dz[outer] + */ + __pyx_t_10 = __pyx_v_outer; + __pyx_v_dx1 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dx.buf, __pyx_t_10, __pyx_bstride_0_dx)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":145 + * z1 = z[outer] + * dx1 = dx[outer] + * dy1 = dy[outer] # <<<<<<<<<<<<<< + * dz1 = dz[outer] + * this_joins = joins[outer] + */ + __pyx_t_11 = __pyx_v_outer; + __pyx_v_dy1 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dy.buf, __pyx_t_11, __pyx_bstride_0_dy)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":146 + * dx1 = dx[outer] + * dy1 = dy[outer] + * dz1 = dz[outer] # <<<<<<<<<<<<<< + * this_joins = joins[outer] + * added = 0 + */ + __pyx_t_12 = __pyx_v_outer; + __pyx_v_dz1 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dz.buf, __pyx_t_12, __pyx_bstride_0_dz)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":147 + * dy1 = dy[outer] + * dz1 = dz[outer] + * this_joins = joins[outer] # <<<<<<<<<<<<<< + * added = 0 + * # Go in reverse order + */ + __pyx_t_6 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_joins), __pyx_v_outer, sizeof(int), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_v_this_joins); + __pyx_v_this_joins = __pyx_t_6; + __pyx_t_6 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":148 + * dz1 = dz[outer] + * this_joins = joins[outer] + * added = 0 # <<<<<<<<<<<<<< + * # Go in reverse order + * for inner in range(outer, 0, -1): + */ + __pyx_v_added = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":150 + * added = 0 + * # Go in reverse order + * for inner in range(outer, 0, -1): # <<<<<<<<<<<<<< + * if not are_neighbors(x1, y1, z1, dx1, dy1, dz1, + * x[inner], y[inner], z[inner], + */ + for (__pyx_t_13 = __pyx_v_outer; __pyx_t_13 > 0; __pyx_t_13-=1) { + __pyx_v_inner = __pyx_t_13; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":152 + * for inner in range(outer, 0, -1): + * if not are_neighbors(x1, y1, z1, dx1, dy1, dz1, + * x[inner], y[inner], z[inner], # <<<<<<<<<<<<<< + * dx[inner], dy[inner], dz[inner]): + * continue + */ + __pyx_t_14 = __pyx_v_inner; + __pyx_t_15 = __pyx_v_inner; + __pyx_t_16 = __pyx_v_inner; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":153 + * if not are_neighbors(x1, y1, z1, dx1, dy1, dz1, + * x[inner], y[inner], z[inner], + * dx[inner], dy[inner], dz[inner]): # <<<<<<<<<<<<<< + * continue + * # Hot dog, we have a weiner! + */ + __pyx_t_17 = __pyx_v_inner; + __pyx_t_18 = __pyx_v_inner; + __pyx_t_19 = __pyx_v_inner; + __pyx_t_5 = (!__pyx_f_2yt_9amr_utils_are_neighbors(__pyx_v_x1, __pyx_v_y1, __pyx_v_z1, __pyx_v_dx1, __pyx_v_dy1, __pyx_v_dz1, (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x.buf, __pyx_t_14, __pyx_bstride_0_x)), (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y.buf, __pyx_t_15, __pyx_bstride_0_y)), (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_z.buf, __pyx_t_16, __pyx_bstride_0_z)), (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dx.buf, __pyx_t_17, __pyx_bstride_0_dx)), (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dy.buf, __pyx_t_18, __pyx_bstride_0_dy)), (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dz.buf, __pyx_t_19, __pyx_bstride_0_dz)))); + if (__pyx_t_5) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":154 + * x[inner], y[inner], z[inner], + * dx[inner], dy[inner], dz[inner]): + * continue # <<<<<<<<<<<<<< + * # Hot dog, we have a weiner! + * this_joins.append(inner) + */ + goto __pyx_L11_continue; + goto __pyx_L13; + } + __pyx_L13:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":156 + * continue + * # Hot dog, we have a weiner! + * this_joins.append(inner) # <<<<<<<<<<<<<< + * added += 1 + * if added == 26: break + */ + __pyx_t_6 = PyInt_FromLong(__pyx_v_inner); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = __Pyx_PyObject_Append(__pyx_v_this_joins, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":157 + * # Hot dog, we have a weiner! + * this_joins.append(inner) + * added += 1 # <<<<<<<<<<<<<< + * if added == 26: break + * return joins + */ + __pyx_v_added += 1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":158 + * this_joins.append(inner) + * added += 1 + * if added == 26: break # <<<<<<<<<<<<<< + * return joins + * + */ + __pyx_t_5 = (__pyx_v_added == 26); + if (__pyx_t_5) { + goto __pyx_L12_break; + goto __pyx_L14; + } + __pyx_L14:; + __pyx_L11_continue:; + } + __pyx_L12_break:; + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":159 + * added += 1 + * if added == 26: break + * return joins # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_joins)); + __pyx_r = ((PyObject *)__pyx_v_joins); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_field); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dz); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dx); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dy); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_z); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.amr_utils.identify_field_neighbors"); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_field); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dz); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dx); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dy); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_x); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_z); + __pyx_L2:; + __Pyx_DECREF(__pyx_v_joins); + __Pyx_DECREF(__pyx_v_this_joins); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":163 + * @cython.boundscheck(False) + * @cython.wraparound(False) + * def extract_identified_contours(int max_ind, joins): # <<<<<<<<<<<<<< + * cdef int i + * contours = [] + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_extract_identified_contours(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_extract_identified_contours(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_max_ind; + PyObject *__pyx_v_joins = 0; + int __pyx_v_i; + PyObject *__pyx_v_contours; + PyObject *__pyx_v_proto_contour; + PyObject *__pyx_v_j; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + long __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__max_ind,&__pyx_n_s__joins,0}; + __Pyx_RefNannySetupContext("extract_identified_contours"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_ind); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__joins); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("extract_identified_contours", 1, 2, 2, 1); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "extract_identified_contours") < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_max_ind = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_max_ind == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_joins = values[1]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_max_ind = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_max_ind == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_joins = PyTuple_GET_ITEM(__pyx_args, 1); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("extract_identified_contours", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.extract_identified_contours"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_contours = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_proto_contour = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_j = Py_None; __Pyx_INCREF(Py_None); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":165 + * def extract_identified_contours(int max_ind, joins): + * cdef int i + * contours = [] # <<<<<<<<<<<<<< + * for i in range(max_ind + 1): # +1 to get to the max_ind itself + * contours.append(set([i])) + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_v_contours)); + __pyx_v_contours = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":166 + * cdef int i + * contours = [] + * for i in range(max_ind + 1): # +1 to get to the max_ind itself # <<<<<<<<<<<<<< + * contours.append(set([i])) + * if len(joins[i]) == 0: + */ + __pyx_t_2 = (__pyx_v_max_ind + 1); + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":167 + * contours = [] + * for i in range(max_ind + 1): # +1 to get to the max_ind itself + * contours.append(set([i])) # <<<<<<<<<<<<<< + * if len(joins[i]) == 0: + * continue + */ + if (unlikely(__pyx_v_contours == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)&PySet_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = PyList_Append(((PyObject *)__pyx_v_contours), __pyx_t_4); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":168 + * for i in range(max_ind + 1): # +1 to get to the max_ind itself + * contours.append(set([i])) + * if len(joins[i]) == 0: # <<<<<<<<<<<<<< + * continue + * proto_contour = [i] + */ + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_joins, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_7 = (__pyx_t_6 == 0); + if (__pyx_t_7) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":169 + * contours.append(set([i])) + * if len(joins[i]) == 0: + * continue # <<<<<<<<<<<<<< + * proto_contour = [i] + * for j in joins[i]: + */ + goto __pyx_L6_continue; + goto __pyx_L8; + } + __pyx_L8:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":170 + * if len(joins[i]) == 0: + * continue + * proto_contour = [i] # <<<<<<<<<<<<<< + * for j in joins[i]: + * proto_contour += contours[j] + */ + __pyx_t_4 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_proto_contour); + __pyx_v_proto_contour = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":171 + * continue + * proto_contour = [i] + * for j in joins[i]: # <<<<<<<<<<<<<< + * proto_contour += contours[j] + * proto_contour = set(proto_contour) + */ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_joins, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_6 = 0; __pyx_t_4 = __pyx_t_1; __Pyx_INCREF(__pyx_t_4); + } else { + __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break; + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; + } else if (likely(PyTuple_CheckExact(__pyx_t_4))) { + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; + } else { + __pyx_t_1 = PyIter_Next(__pyx_t_4); + if (!__pyx_t_1) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_v_j); + __pyx_v_j = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":172 + * proto_contour = [i] + * for j in joins[i]: + * proto_contour += contours[j] # <<<<<<<<<<<<<< + * proto_contour = set(proto_contour) + * for j in proto_contour: + */ + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_contours), __pyx_v_j); if (!__pyx_t_1) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = PyNumber_InPlaceAdd(__pyx_v_proto_contour, __pyx_t_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_proto_contour); + __pyx_v_proto_contour = __pyx_t_8; + __pyx_t_8 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":173 + * for j in joins[i]: + * proto_contour += contours[j] + * proto_contour = set(proto_contour) # <<<<<<<<<<<<<< + * for j in proto_contour: + * contours[j] = proto_contour + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_proto_contour); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_proto_contour); + __Pyx_GIVEREF(__pyx_v_proto_contour); + __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)&PySet_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_proto_contour); + __pyx_v_proto_contour = __pyx_t_8; + __pyx_t_8 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":174 + * proto_contour += contours[j] + * proto_contour = set(proto_contour) + * for j in proto_contour: # <<<<<<<<<<<<<< + * contours[j] = proto_contour + * return contours + */ + if (PyList_CheckExact(__pyx_v_proto_contour) || PyTuple_CheckExact(__pyx_v_proto_contour)) { + __pyx_t_6 = 0; __pyx_t_8 = __pyx_v_proto_contour; __Pyx_INCREF(__pyx_t_8); + } else { + __pyx_t_6 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_proto_contour); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_8))) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_8)) break; + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; + } else if (likely(PyTuple_CheckExact(__pyx_t_8))) { + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_8)) break; + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; + } else { + __pyx_t_4 = PyIter_Next(__pyx_t_8); + if (!__pyx_t_4) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF(__pyx_v_j); + __pyx_v_j = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":175 + * proto_contour = set(proto_contour) + * for j in proto_contour: + * contours[j] = proto_contour # <<<<<<<<<<<<<< + * return contours + */ + if (PyObject_SetItem(((PyObject *)__pyx_v_contours), __pyx_v_j, __pyx_v_proto_contour) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_L6_continue:; + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":176 + * for j in proto_contour: + * contours[j] = proto_contour + * return contours # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_contours)); + __pyx_r = ((PyObject *)__pyx_v_contours); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("yt.amr_utils.extract_identified_contours"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_contours); + __Pyx_DECREF(__pyx_v_proto_contour); + __Pyx_DECREF(__pyx_v_j); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":102 + * png_structp *png_ptr_ptr, png_infop *info_ptr_ptr) + * + * def write_png(np.ndarray[np.uint8_t, ndim=3] buffer, # <<<<<<<<<<<<<< + * char *filename, int dpi=100): + * + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_write_png(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_write_png(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_buffer = 0; + char *__pyx_v_filename; + int __pyx_v_dpi; + png_byte *__pyx_v_pix_buffer; + int __pyx_v_width; + int __pyx_v_height; + FILE *__pyx_v_fileobj; + png_bytep *__pyx_v_row_pointers; + png_structp __pyx_v_png_ptr; + png_infop __pyx_v_info_ptr; + png_color_8 __pyx_v_sig_bit; + png_uint_32 __pyx_v_row; + size_t __pyx_v_dots_per_meter; + Py_buffer __pyx_bstruct_buffer; + Py_ssize_t __pyx_bstride_0_buffer = 0; + Py_ssize_t __pyx_bstride_1_buffer = 0; + Py_ssize_t __pyx_bstride_2_buffer = 0; + Py_ssize_t __pyx_bshape_0_buffer = 0; + Py_ssize_t __pyx_bshape_1_buffer = 0; + Py_ssize_t __pyx_bshape_2_buffer = 0; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + png_uint_32 __pyx_t_2; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__filename,&__pyx_n_s__dpi,0}; + __Pyx_RefNannySetupContext("write_png"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[3] = {0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("write_png", 0, 2, 3, 1); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dpi); + if (unlikely(value)) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "write_png") < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_buffer = ((PyArrayObject *)values[0]); + __pyx_v_filename = PyBytes_AsString(values[1]); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (values[2]) { + __pyx_v_dpi = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_dpi == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_dpi = ((int)100); + } + } else { + __pyx_v_dpi = ((int)100); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: + __pyx_v_dpi = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_dpi == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 2: + __pyx_v_filename = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_buffer = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("write_png", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.write_png"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_bstruct_buffer.buf = NULL; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_buffer), __pyx_ptype_5numpy_ndarray, 1, "buffer", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_buffer, (PyObject*)__pyx_v_buffer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_buffer = __pyx_bstruct_buffer.strides[0]; __pyx_bstride_1_buffer = __pyx_bstruct_buffer.strides[1]; __pyx_bstride_2_buffer = __pyx_bstruct_buffer.strides[2]; + __pyx_bshape_0_buffer = __pyx_bstruct_buffer.shape[0]; __pyx_bshape_1_buffer = __pyx_bstruct_buffer.shape[1]; __pyx_bshape_2_buffer = __pyx_bstruct_buffer.shape[2]; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":106 + * + * # This is something of a translation of the matplotlib _png module + * cdef png_byte *pix_buffer = buffer.data # <<<<<<<<<<<<<< + * cdef int width = buffer.shape[1] + * cdef int height = buffer.shape[0] + */ + __pyx_v_pix_buffer = ((png_byte *)__pyx_v_buffer->data); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":107 + * # This is something of a translation of the matplotlib _png module + * cdef png_byte *pix_buffer = buffer.data + * cdef int width = buffer.shape[1] # <<<<<<<<<<<<<< + * cdef int height = buffer.shape[0] + * + */ + __pyx_v_width = (__pyx_v_buffer->dimensions[1]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":108 + * cdef png_byte *pix_buffer = buffer.data + * cdef int width = buffer.shape[1] + * cdef int height = buffer.shape[0] # <<<<<<<<<<<<<< + * + * cdef FILE* fileobj = fopen(filename, "wb") + */ + __pyx_v_height = (__pyx_v_buffer->dimensions[0]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":110 + * cdef int height = buffer.shape[0] + * + * cdef FILE* fileobj = fopen(filename, "wb") # <<<<<<<<<<<<<< + * cdef png_bytep *row_pointers + * cdef png_structp png_ptr + */ + __pyx_v_fileobj = fopen(__pyx_v_filename, __pyx_k__wb); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":118 + * cdef png_uint_32 row + * + * row_pointers = alloca(sizeof(png_bytep) * height) # <<<<<<<<<<<<<< + * + * for row in range(height): + */ + __pyx_v_row_pointers = ((png_bytep *)alloca(((sizeof(png_bytep)) * __pyx_v_height))); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":120 + * row_pointers = alloca(sizeof(png_bytep) * height) + * + * for row in range(height): # <<<<<<<<<<<<<< + * row_pointers[row] = pix_buffer + row * width * 4 + * png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL) + */ + __pyx_t_1 = __pyx_v_height; + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_row = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":121 + * + * for row in range(height): + * row_pointers[row] = pix_buffer + row * width * 4 # <<<<<<<<<<<<<< + * png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL) + * info_ptr = png_create_info_struct(png_ptr) + */ + (__pyx_v_row_pointers[__pyx_v_row]) = (__pyx_v_pix_buffer + ((__pyx_v_row * __pyx_v_width) * 4)); + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":122 + * for row in range(height): + * row_pointers[row] = pix_buffer + row * width * 4 + * png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL) # <<<<<<<<<<<<<< + * info_ptr = png_create_info_struct(png_ptr) + * + */ + __pyx_v_png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":123 + * row_pointers[row] = pix_buffer + row * width * 4 + * png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL) + * info_ptr = png_create_info_struct(png_ptr) # <<<<<<<<<<<<<< + * + * # Um we are ignoring setjmp sorry guys + */ + __pyx_v_info_ptr = png_create_info_struct(__pyx_v_png_ptr); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":127 + * # Um we are ignoring setjmp sorry guys + * + * png_init_io(png_ptr, fileobj) # <<<<<<<<<<<<<< + * + * png_set_IHDR(png_ptr, info_ptr, width, height, 8, + */ + png_init_io(__pyx_v_png_ptr, __pyx_v_fileobj); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":131 + * png_set_IHDR(png_ptr, info_ptr, width, height, 8, + * PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE, + * PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE) # <<<<<<<<<<<<<< + * + * cdef size_t dots_per_meter = (dpi / (2.54 / 100.0)) + */ + png_set_IHDR(__pyx_v_png_ptr, __pyx_v_info_ptr, __pyx_v_width, __pyx_v_height, 8, PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":133 + * PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE) + * + * cdef size_t dots_per_meter = (dpi / (2.54 / 100.0)) # <<<<<<<<<<<<<< + * png_set_pHYs(png_ptr, info_ptr, dots_per_meter, dots_per_meter, + * PNG_RESOLUTION_METER) + */ + __pyx_v_dots_per_meter = ((size_t)(__pyx_v_dpi / (2.54 / 100.0))); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":135 + * cdef size_t dots_per_meter = (dpi / (2.54 / 100.0)) + * png_set_pHYs(png_ptr, info_ptr, dots_per_meter, dots_per_meter, + * PNG_RESOLUTION_METER) # <<<<<<<<<<<<<< + * + * sig_bit.gray = 0 + */ + png_set_pHYs(__pyx_v_png_ptr, __pyx_v_info_ptr, __pyx_v_dots_per_meter, __pyx_v_dots_per_meter, PNG_RESOLUTION_METER); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":137 + * PNG_RESOLUTION_METER) + * + * sig_bit.gray = 0 # <<<<<<<<<<<<<< + * sig_bit.red = sig_bit.green = sig_bit.blue = sig_bit.alpha = 8 + * + */ + __pyx_v_sig_bit.gray = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":138 + * + * sig_bit.gray = 0 + * sig_bit.red = sig_bit.green = sig_bit.blue = sig_bit.alpha = 8 # <<<<<<<<<<<<<< + * + * png_set_sBIT(png_ptr, info_ptr, &sig_bit) + */ + __pyx_v_sig_bit.red = 8; + __pyx_v_sig_bit.green = 8; + __pyx_v_sig_bit.blue = 8; + __pyx_v_sig_bit.alpha = 8; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":140 + * sig_bit.red = sig_bit.green = sig_bit.blue = sig_bit.alpha = 8 + * + * png_set_sBIT(png_ptr, info_ptr, &sig_bit) # <<<<<<<<<<<<<< + * + * png_write_info(png_ptr, info_ptr) + */ + png_set_sBIT(__pyx_v_png_ptr, __pyx_v_info_ptr, (&__pyx_v_sig_bit)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":142 + * png_set_sBIT(png_ptr, info_ptr, &sig_bit) + * + * png_write_info(png_ptr, info_ptr) # <<<<<<<<<<<<<< + * png_write_image(png_ptr, row_pointers) + * png_write_end(png_ptr, info_ptr) + */ + png_write_info(__pyx_v_png_ptr, __pyx_v_info_ptr); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":143 + * + * png_write_info(png_ptr, info_ptr) + * png_write_image(png_ptr, row_pointers) # <<<<<<<<<<<<<< + * png_write_end(png_ptr, info_ptr) + * + */ + png_write_image(__pyx_v_png_ptr, __pyx_v_row_pointers); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":144 + * png_write_info(png_ptr, info_ptr) + * png_write_image(png_ptr, row_pointers) + * png_write_end(png_ptr, info_ptr) # <<<<<<<<<<<<<< + * + * fclose(fileobj) + */ + png_write_end(__pyx_v_png_ptr, __pyx_v_info_ptr); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":146 + * png_write_end(png_ptr, info_ptr) + * + * fclose(fileobj) # <<<<<<<<<<<<<< + * png_destroy_write_struct(&png_ptr, &info_ptr) + * + */ + fclose(__pyx_v_fileobj); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":147 + * + * fclose(fileobj) + * png_destroy_write_struct(&png_ptr, &info_ptr) # <<<<<<<<<<<<<< + * + * def add_points_to_image( + */ + png_destroy_write_struct((&__pyx_v_png_ptr), (&__pyx_v_info_ptr)); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_buffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.amr_utils.write_png"); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_buffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":149 + * png_destroy_write_struct(&png_ptr, &info_ptr) + * + * def add_points_to_image( # <<<<<<<<<<<<<< + * np.ndarray[np.uint8_t, ndim=3] buffer, + * np.ndarray[np.float64_t, ndim=1] px, + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_add_points_to_image(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_add_points_to_image(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_buffer = 0; + PyArrayObject *__pyx_v_px = 0; + PyArrayObject *__pyx_v_py = 0; + __pyx_t_5numpy_float64_t __pyx_v_pv; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_k; + int __pyx_v_pi; + int __pyx_v_np; + int __pyx_v_xs; + int __pyx_v_ys; + int __pyx_v_v; + Py_buffer __pyx_bstruct_buffer; + Py_ssize_t __pyx_bstride_0_buffer = 0; + Py_ssize_t __pyx_bstride_1_buffer = 0; + Py_ssize_t __pyx_bstride_2_buffer = 0; + Py_ssize_t __pyx_bshape_0_buffer = 0; + Py_ssize_t __pyx_bshape_1_buffer = 0; + Py_ssize_t __pyx_bshape_2_buffer = 0; + Py_buffer __pyx_bstruct_px; + Py_ssize_t __pyx_bstride_0_px = 0; + Py_ssize_t __pyx_bshape_0_px = 0; + Py_buffer __pyx_bstruct_py; + Py_ssize_t __pyx_bstride_0_py = 0; + Py_ssize_t __pyx_bshape_0_py = 0; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + 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; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__px,&__pyx_n_s__py,&__pyx_n_s__pv,0}; + __Pyx_RefNannySetupContext("add_points_to_image"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[4] = {0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__px); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("add_points_to_image", 1, 4, 4, 1); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__py); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("add_points_to_image", 1, 4, 4, 2); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pv); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("add_points_to_image", 1, 4, 4, 3); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "add_points_to_image") < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_buffer = ((PyArrayObject *)values[0]); + __pyx_v_px = ((PyArrayObject *)values[1]); + __pyx_v_py = ((PyArrayObject *)values[2]); + __pyx_v_pv = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_pv == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_buffer = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); + __pyx_v_px = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); + __pyx_v_py = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); + __pyx_v_pv = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_pv == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("add_points_to_image", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.add_points_to_image"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_bstruct_buffer.buf = NULL; + __pyx_bstruct_px.buf = NULL; + __pyx_bstruct_py.buf = NULL; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_buffer), __pyx_ptype_5numpy_ndarray, 1, "buffer", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_px), __pyx_ptype_5numpy_ndarray, 1, "px", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_py), __pyx_ptype_5numpy_ndarray, 1, "py", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_buffer, (PyObject*)__pyx_v_buffer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_buffer = __pyx_bstruct_buffer.strides[0]; __pyx_bstride_1_buffer = __pyx_bstruct_buffer.strides[1]; __pyx_bstride_2_buffer = __pyx_bstruct_buffer.strides[2]; + __pyx_bshape_0_buffer = __pyx_bstruct_buffer.shape[0]; __pyx_bshape_1_buffer = __pyx_bstruct_buffer.shape[1]; __pyx_bshape_2_buffer = __pyx_bstruct_buffer.shape[2]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_px, (PyObject*)__pyx_v_px, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_px = __pyx_bstruct_px.strides[0]; + __pyx_bshape_0_px = __pyx_bstruct_px.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_py, (PyObject*)__pyx_v_py, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_py = __pyx_bstruct_py.strides[0]; + __pyx_bshape_0_py = __pyx_bstruct_py.shape[0]; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":155 + * np.float64_t pv): + * cdef int i, j, k, pi + * cdef int np = px.shape[0] # <<<<<<<<<<<<<< + * cdef int xs = buffer.shape[0] + * cdef int ys = buffer.shape[1] + */ + __pyx_v_np = (__pyx_v_px->dimensions[0]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":156 + * cdef int i, j, k, pi + * cdef int np = px.shape[0] + * cdef int xs = buffer.shape[0] # <<<<<<<<<<<<<< + * cdef int ys = buffer.shape[1] + * cdef int v + */ + __pyx_v_xs = (__pyx_v_buffer->dimensions[0]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":157 + * cdef int np = px.shape[0] + * cdef int xs = buffer.shape[0] + * cdef int ys = buffer.shape[1] # <<<<<<<<<<<<<< + * cdef int v + * v = iclip((pv * 255), 0, 255) + */ + __pyx_v_ys = (__pyx_v_buffer->dimensions[1]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":159 + * cdef int ys = buffer.shape[1] + * cdef int v + * v = iclip((pv * 255), 0, 255) # <<<<<<<<<<<<<< + * for pi in range(np): + * j = (xs * px[pi]) + */ + __pyx_v_v = __pyx_f_2yt_9amr_utils_iclip(((int)(__pyx_v_pv * 255.0)), 0, 255); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":160 + * cdef int v + * v = iclip((pv * 255), 0, 255) + * for pi in range(np): # <<<<<<<<<<<<<< + * j = (xs * px[pi]) + * i = (ys * py[pi]) + */ + __pyx_t_1 = __pyx_v_np; + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_pi = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":161 + * v = iclip((pv * 255), 0, 255) + * for pi in range(np): + * j = (xs * px[pi]) # <<<<<<<<<<<<<< + * i = (ys * py[pi]) + * for k in range(3): + */ + __pyx_t_3 = __pyx_v_pi; + __pyx_t_4 = -1; + if (__pyx_t_3 < 0) { + __pyx_t_3 += __pyx_bshape_0_px; + if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 0; + } else if (unlikely(__pyx_t_3 >= __pyx_bshape_0_px)) __pyx_t_4 = 0; + if (unlikely(__pyx_t_4 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_4); + {__pyx_filename = __pyx_f[7]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_j = ((int)(__pyx_v_xs * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_px.buf, __pyx_t_3, __pyx_bstride_0_px)))); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":162 + * for pi in range(np): + * j = (xs * px[pi]) + * i = (ys * py[pi]) # <<<<<<<<<<<<<< + * for k in range(3): + * buffer[i, j, k] = 0 + */ + __pyx_t_4 = __pyx_v_pi; + __pyx_t_5 = -1; + if (__pyx_t_4 < 0) { + __pyx_t_4 += __pyx_bshape_0_py; + if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0; + } else if (unlikely(__pyx_t_4 >= __pyx_bshape_0_py)) __pyx_t_5 = 0; + if (unlikely(__pyx_t_5 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_5); + {__pyx_filename = __pyx_f[7]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_i = ((int)(__pyx_v_ys * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_py.buf, __pyx_t_4, __pyx_bstride_0_py)))); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":163 + * j = (xs * px[pi]) + * i = (ys * py[pi]) + * for k in range(3): # <<<<<<<<<<<<<< + * buffer[i, j, k] = 0 + * return + */ + for (__pyx_t_5 = 0; __pyx_t_5 < 3; __pyx_t_5+=1) { + __pyx_v_k = __pyx_t_5; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":164 + * i = (ys * py[pi]) + * for k in range(3): + * buffer[i, j, k] = 0 # <<<<<<<<<<<<<< + * return + * for i in range(xs): + */ + __pyx_t_6 = __pyx_v_i; + __pyx_t_7 = __pyx_v_j; + __pyx_t_8 = __pyx_v_k; + __pyx_t_9 = -1; + if (__pyx_t_6 < 0) { + __pyx_t_6 += __pyx_bshape_0_buffer; + if (unlikely(__pyx_t_6 < 0)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_6 >= __pyx_bshape_0_buffer)) __pyx_t_9 = 0; + if (__pyx_t_7 < 0) { + __pyx_t_7 += __pyx_bshape_1_buffer; + if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 1; + } else if (unlikely(__pyx_t_7 >= __pyx_bshape_1_buffer)) __pyx_t_9 = 1; + if (__pyx_t_8 < 0) { + __pyx_t_8 += __pyx_bshape_2_buffer; + if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 2; + } else if (unlikely(__pyx_t_8 >= __pyx_bshape_2_buffer)) __pyx_t_9 = 2; + if (unlikely(__pyx_t_9 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_9); + {__pyx_filename = __pyx_f[7]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_uint8_t *, __pyx_bstruct_buffer.buf, __pyx_t_6, __pyx_bstride_0_buffer, __pyx_t_7, __pyx_bstride_1_buffer, __pyx_t_8, __pyx_bstride_2_buffer) = 0; + } + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":165 + * for k in range(3): + * buffer[i, j, k] = 0 + * return # <<<<<<<<<<<<<< + * for i in range(xs): + * for j in range(ys): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":166 + * buffer[i, j, k] = 0 + * return + * for i in range(xs): # <<<<<<<<<<<<<< + * for j in range(ys): + * for k in range(3): + */ + __pyx_t_1 = __pyx_v_xs; + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":167 + * return + * for i in range(xs): + * for j in range(ys): # <<<<<<<<<<<<<< + * for k in range(3): + * v = buffer[i, j, k] + */ + __pyx_t_5 = __pyx_v_ys; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_5; __pyx_t_9+=1) { + __pyx_v_j = __pyx_t_9; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":168 + * for i in range(xs): + * for j in range(ys): + * for k in range(3): # <<<<<<<<<<<<<< + * v = buffer[i, j, k] + * buffer[i, j, k] = iclip(v, 0, 255) + */ + for (__pyx_t_10 = 0; __pyx_t_10 < 3; __pyx_t_10+=1) { + __pyx_v_k = __pyx_t_10; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":169 + * for j in range(ys): + * for k in range(3): + * v = buffer[i, j, k] # <<<<<<<<<<<<<< + * buffer[i, j, k] = iclip(v, 0, 255) + */ + __pyx_t_11 = __pyx_v_i; + __pyx_t_12 = __pyx_v_j; + __pyx_t_13 = __pyx_v_k; + __pyx_t_14 = -1; + if (__pyx_t_11 < 0) { + __pyx_t_11 += __pyx_bshape_0_buffer; + if (unlikely(__pyx_t_11 < 0)) __pyx_t_14 = 0; + } else if (unlikely(__pyx_t_11 >= __pyx_bshape_0_buffer)) __pyx_t_14 = 0; + if (__pyx_t_12 < 0) { + __pyx_t_12 += __pyx_bshape_1_buffer; + if (unlikely(__pyx_t_12 < 0)) __pyx_t_14 = 1; + } else if (unlikely(__pyx_t_12 >= __pyx_bshape_1_buffer)) __pyx_t_14 = 1; + if (__pyx_t_13 < 0) { + __pyx_t_13 += __pyx_bshape_2_buffer; + if (unlikely(__pyx_t_13 < 0)) __pyx_t_14 = 2; + } else if (unlikely(__pyx_t_13 >= __pyx_bshape_2_buffer)) __pyx_t_14 = 2; + if (unlikely(__pyx_t_14 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_14); + {__pyx_filename = __pyx_f[7]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_v = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_uint8_t *, __pyx_bstruct_buffer.buf, __pyx_t_11, __pyx_bstride_0_buffer, __pyx_t_12, __pyx_bstride_1_buffer, __pyx_t_13, __pyx_bstride_2_buffer)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":170 + * for k in range(3): + * v = buffer[i, j, k] + * buffer[i, j, k] = iclip(v, 0, 255) # <<<<<<<<<<<<<< + */ + __pyx_t_14 = __pyx_v_i; + __pyx_t_15 = __pyx_v_j; + __pyx_t_16 = __pyx_v_k; + __pyx_t_17 = -1; + if (__pyx_t_14 < 0) { + __pyx_t_14 += __pyx_bshape_0_buffer; + if (unlikely(__pyx_t_14 < 0)) __pyx_t_17 = 0; + } else if (unlikely(__pyx_t_14 >= __pyx_bshape_0_buffer)) __pyx_t_17 = 0; + if (__pyx_t_15 < 0) { + __pyx_t_15 += __pyx_bshape_1_buffer; + if (unlikely(__pyx_t_15 < 0)) __pyx_t_17 = 1; + } else if (unlikely(__pyx_t_15 >= __pyx_bshape_1_buffer)) __pyx_t_17 = 1; + if (__pyx_t_16 < 0) { + __pyx_t_16 += __pyx_bshape_2_buffer; + if (unlikely(__pyx_t_16 < 0)) __pyx_t_17 = 2; + } else if (unlikely(__pyx_t_16 >= __pyx_bshape_2_buffer)) __pyx_t_17 = 2; + if (unlikely(__pyx_t_17 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_17); + {__pyx_filename = __pyx_f[7]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_uint8_t *, __pyx_bstruct_buffer.buf, __pyx_t_14, __pyx_bstride_0_buffer, __pyx_t_15, __pyx_bstride_1_buffer, __pyx_t_16, __pyx_bstride_2_buffer) = __pyx_f_2yt_9amr_utils_iclip(__pyx_v_v, 0, 255); + } + } + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_buffer); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_px); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_py); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.amr_utils.add_points_to_image"); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_buffer); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_px); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_py); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":42 + * @cython.boundscheck(False) + * @cython.wraparound(False) + * def read_tiger_section( # <<<<<<<<<<<<<< + * char *fn, + * np.ndarray[np.int64_t, ndim=1] slab_start, + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_read_tiger_section(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_read_tiger_section(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + char *__pyx_v_fn; + PyArrayObject *__pyx_v_slab_start = 0; + PyArrayObject *__pyx_v_slab_size = 0; + PyArrayObject *__pyx_v_root_size = 0; + int __pyx_v_offset; + int __pyx_v_strides[3]; + __pyx_t_5numpy_int64_t __pyx_v_i; + __pyx_t_5numpy_int64_t __pyx_v_j; + PyArrayObject *__pyx_v_buffer = 0; + FILE *__pyx_v_f; + __pyx_t_5numpy_int64_t __pyx_v_pos; + __pyx_t_5numpy_int64_t __pyx_v_moff; + float *__pyx_v_data; + Py_buffer __pyx_bstruct_slab_size; + Py_ssize_t __pyx_bstride_0_slab_size = 0; + Py_ssize_t __pyx_bshape_0_slab_size = 0; + Py_buffer __pyx_bstruct_slab_start; + Py_ssize_t __pyx_bstride_0_slab_start = 0; + Py_ssize_t __pyx_bshape_0_slab_start = 0; + Py_buffer __pyx_bstruct_root_size; + Py_ssize_t __pyx_bstride_0_root_size = 0; + Py_ssize_t __pyx_bshape_0_root_size = 0; + PyObject *__pyx_r = NULL; + long __pyx_t_1; + long __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + long __pyx_t_7; + __pyx_t_5numpy_int64_t __pyx_t_8; + __pyx_t_5numpy_int64_t __pyx_t_9; + long __pyx_t_10; + __pyx_t_5numpy_int64_t __pyx_t_11; + __pyx_t_5numpy_int64_t __pyx_t_12; + long __pyx_t_13; + long __pyx_t_14; + long __pyx_t_15; + long __pyx_t_16; + long __pyx_t_17; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fn,&__pyx_n_s__slab_start,&__pyx_n_s__slab_size,&__pyx_n_s__root_size,&__pyx_n_s__offset,0}; + __Pyx_RefNannySetupContext("read_tiger_section"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[5] = {0,0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fn); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__slab_start); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("read_tiger_section", 0, 4, 5, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__slab_size); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("read_tiger_section", 0, 4, 5, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__root_size); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("read_tiger_section", 0, 4, 5, 3); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__offset); + if (unlikely(value)) { values[4] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "read_tiger_section") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_fn = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_fn) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_slab_start = ((PyArrayObject *)values[1]); + __pyx_v_slab_size = ((PyArrayObject *)values[2]); + __pyx_v_root_size = ((PyArrayObject *)values[3]); + if (values[4]) { + __pyx_v_offset = __Pyx_PyInt_AsInt(values[4]); if (unlikely((__pyx_v_offset == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_offset = ((int)36); + } + } else { + __pyx_v_offset = ((int)36); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: + __pyx_v_offset = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_offset == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 4: + __pyx_v_root_size = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); + __pyx_v_slab_size = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); + __pyx_v_slab_start = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); + __pyx_v_fn = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_fn) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("read_tiger_section", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.read_tiger_section"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_bstruct_slab_start.buf = NULL; + __pyx_bstruct_slab_size.buf = NULL; + __pyx_bstruct_root_size.buf = NULL; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slab_start), __pyx_ptype_5numpy_ndarray, 1, "slab_start", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slab_size), __pyx_ptype_5numpy_ndarray, 1, "slab_size", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_root_size), __pyx_ptype_5numpy_ndarray, 1, "root_size", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_slab_start, (PyObject*)__pyx_v_slab_start, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_slab_start = __pyx_bstruct_slab_start.strides[0]; + __pyx_bshape_0_slab_start = __pyx_bstruct_slab_start.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_slab_size, (PyObject*)__pyx_v_slab_size, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_slab_size = __pyx_bstruct_slab_size.strides[0]; + __pyx_bshape_0_slab_size = __pyx_bstruct_slab_size.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_root_size, (PyObject*)__pyx_v_root_size, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_root_size = __pyx_bstruct_root_size.strides[0]; + __pyx_bshape_0_root_size = __pyx_bstruct_root_size.shape[0]; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":49 + * int offset = 36): + * cdef int strides[3] + * strides[0] = 1 # <<<<<<<<<<<<<< + * strides[1] = root_size[0] * strides[0] + * strides[2] = strides[1] * root_size[1] + 2 + */ + (__pyx_v_strides[0]) = 1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":50 + * cdef int strides[3] + * strides[0] = 1 + * strides[1] = root_size[0] * strides[0] # <<<<<<<<<<<<<< + * strides[2] = strides[1] * root_size[1] + 2 + * cdef np.int64_t i, j, k + */ + __pyx_t_1 = 0; + (__pyx_v_strides[1]) = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_root_size.buf, __pyx_t_1, __pyx_bstride_0_root_size)) * (__pyx_v_strides[0])); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":51 + * strides[0] = 1 + * strides[1] = root_size[0] * strides[0] + * strides[2] = strides[1] * root_size[1] + 2 # <<<<<<<<<<<<<< + * cdef np.int64_t i, j, k + * cdef np.ndarray buffer = np.zeros(slab_size, dtype='float32', order='F') + */ + __pyx_t_2 = 1; + (__pyx_v_strides[2]) = (((__pyx_v_strides[1]) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_root_size.buf, __pyx_t_2, __pyx_bstride_0_root_size))) + 2); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":53 + * strides[2] = strides[1] * root_size[1] + 2 + * cdef np.int64_t i, j, k + * cdef np.ndarray buffer = np.zeros(slab_size, dtype='float32', order='F') # <<<<<<<<<<<<<< + * cdef FILE *f = fopen(fn, "rb") + * #for i in range(3): offset += strides[i] * slab_start[i] + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_slab_size)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_slab_size)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_slab_size)); + __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float32)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__F)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_4, __pyx_t_3, ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_buffer = ((PyArrayObject *)__pyx_t_6); + __pyx_t_6 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":54 + * cdef np.int64_t i, j, k + * cdef np.ndarray buffer = np.zeros(slab_size, dtype='float32', order='F') + * cdef FILE *f = fopen(fn, "rb") # <<<<<<<<<<<<<< + * #for i in range(3): offset += strides[i] * slab_start[i] + * cdef np.int64_t pos = 0 + */ + __pyx_v_f = fopen(__pyx_v_fn, __pyx_k__rb); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":56 + * cdef FILE *f = fopen(fn, "rb") + * #for i in range(3): offset += strides[i] * slab_start[i] + * cdef np.int64_t pos = 0 # <<<<<<<<<<<<<< + * cdef np.int64_t moff = 0 + * cdef float *data = buffer.data + */ + __pyx_v_pos = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":57 + * #for i in range(3): offset += strides[i] * slab_start[i] + * cdef np.int64_t pos = 0 + * cdef np.int64_t moff = 0 # <<<<<<<<<<<<<< + * cdef float *data = buffer.data + * fseek(f, offset, 0) + */ + __pyx_v_moff = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":58 + * cdef np.int64_t pos = 0 + * cdef np.int64_t moff = 0 + * cdef float *data = buffer.data # <<<<<<<<<<<<<< + * fseek(f, offset, 0) + * # If anybody wants to convert this loop to a SEEK_CUR, that'd be great. + */ + __pyx_v_data = ((float *)__pyx_v_buffer->data); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":59 + * cdef np.int64_t moff = 0 + * cdef float *data = buffer.data + * fseek(f, offset, 0) # <<<<<<<<<<<<<< + * # If anybody wants to convert this loop to a SEEK_CUR, that'd be great. + * for i in range(slab_size[2]): + */ + fseek(__pyx_v_f, __pyx_v_offset, 0); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":61 + * fseek(f, offset, 0) + * # If anybody wants to convert this loop to a SEEK_CUR, that'd be great. + * for i in range(slab_size[2]): # <<<<<<<<<<<<<< + * for j in range(slab_size[1]): + * moff = (slab_start[0] ) * strides[0] \ + */ + __pyx_t_7 = 2; + __pyx_t_8 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_slab_size.buf, __pyx_t_7, __pyx_bstride_0_slab_size)); + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":62 + * # If anybody wants to convert this loop to a SEEK_CUR, that'd be great. + * for i in range(slab_size[2]): + * for j in range(slab_size[1]): # <<<<<<<<<<<<<< + * moff = (slab_start[0] ) * strides[0] \ + * + (slab_start[1] + j) * strides[1] \ + */ + __pyx_t_10 = 1; + __pyx_t_11 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_slab_size.buf, __pyx_t_10, __pyx_bstride_0_slab_size)); + for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { + __pyx_v_j = __pyx_t_12; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":63 + * for i in range(slab_size[2]): + * for j in range(slab_size[1]): + * moff = (slab_start[0] ) * strides[0] \ # <<<<<<<<<<<<<< + * + (slab_start[1] + j) * strides[1] \ + * + (slab_start[2] + i) * strides[2] + */ + __pyx_t_13 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":64 + * for j in range(slab_size[1]): + * moff = (slab_start[0] ) * strides[0] \ + * + (slab_start[1] + j) * strides[1] \ # <<<<<<<<<<<<<< + * + (slab_start[2] + i) * strides[2] + * #print offset + 4 * moff, pos + */ + __pyx_t_14 = 1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":65 + * moff = (slab_start[0] ) * strides[0] \ + * + (slab_start[1] + j) * strides[1] \ + * + (slab_start[2] + i) * strides[2] # <<<<<<<<<<<<<< + * #print offset + 4 * moff, pos + * fseek(f, offset + 4 * moff, SEEK_SET) + */ + __pyx_t_15 = 2; + __pyx_v_moff = ((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_slab_start.buf, __pyx_t_13, __pyx_bstride_0_slab_start)) * (__pyx_v_strides[0])) + (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_slab_start.buf, __pyx_t_14, __pyx_bstride_0_slab_start)) + __pyx_v_j) * (__pyx_v_strides[1]))) + (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_slab_start.buf, __pyx_t_15, __pyx_bstride_0_slab_start)) + __pyx_v_i) * (__pyx_v_strides[2]))); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":67 + * + (slab_start[2] + i) * strides[2] + * #print offset + 4 * moff, pos + * fseek(f, offset + 4 * moff, SEEK_SET) # <<<<<<<<<<<<<< + * fread( (data + pos), 4, slab_size[0], f) + * pos += slab_size[0] + */ + fseek(__pyx_v_f, (__pyx_v_offset + (4 * __pyx_v_moff)), SEEK_SET); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":68 + * #print offset + 4 * moff, pos + * fseek(f, offset + 4 * moff, SEEK_SET) + * fread( (data + pos), 4, slab_size[0], f) # <<<<<<<<<<<<<< + * pos += slab_size[0] + * return buffer + */ + __pyx_t_16 = 0; + fread(((void *)(__pyx_v_data + __pyx_v_pos)), 4, (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_slab_size.buf, __pyx_t_16, __pyx_bstride_0_slab_size)), __pyx_v_f); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":69 + * fseek(f, offset + 4 * moff, SEEK_SET) + * fread( (data + pos), 4, slab_size[0], f) + * pos += slab_size[0] # <<<<<<<<<<<<<< + * return buffer + */ + __pyx_t_17 = 0; + __pyx_v_pos += (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_slab_size.buf, __pyx_t_17, __pyx_bstride_0_slab_size)); + } + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":70 + * fread( (data + pos), 4, slab_size[0], f) + * pos += slab_size[0] + * return buffer # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_buffer)); + __pyx_r = ((PyObject *)__pyx_v_buffer); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_slab_size); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_slab_start); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_root_size); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.amr_utils.read_tiger_section"); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_slab_size); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_slab_start); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_root_size); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_buffer); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":47 + * QuadTreeNode *children[2][2] + * + * cdef void QTN_add_value(QuadTreeNode *self, # <<<<<<<<<<<<<< + * np.float64_t *val, np.float64_t weight_val): + * cdef int i + */ + +static void __pyx_f_2yt_9amr_utils_QTN_add_value(struct __pyx_t_2yt_9amr_utils_QuadTreeNode *__pyx_v_self, __pyx_t_5numpy_float64_t *__pyx_v_val, __pyx_t_5numpy_float64_t __pyx_v_weight_val) { + int __pyx_v_i; + int __pyx_t_1; + int __pyx_t_2; + __Pyx_RefNannySetupContext("QTN_add_value"); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":50 + * np.float64_t *val, np.float64_t weight_val): + * cdef int i + * for i in range(self.nvals): # <<<<<<<<<<<<<< + * self.val[i] += val[i] + * self.weight_val += weight_val + */ + __pyx_t_1 = __pyx_v_self->nvals; + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":51 + * cdef int i + * for i in range(self.nvals): + * self.val[i] += val[i] # <<<<<<<<<<<<<< + * self.weight_val += weight_val + * + */ + (__pyx_v_self->val[__pyx_v_i]) += (__pyx_v_val[__pyx_v_i]); + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":52 + * for i in range(self.nvals): + * self.val[i] += val[i] + * self.weight_val += weight_val # <<<<<<<<<<<<<< + * + * cdef void QTN_refine(QuadTreeNode *self): + */ + __pyx_v_self->weight_val += __pyx_v_weight_val; + + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":54 + * self.weight_val += weight_val + * + * cdef void QTN_refine(QuadTreeNode *self): # <<<<<<<<<<<<<< + * cdef int i, j, i1, j1 + * cdef np.int64_t npos[2] + */ + +static void __pyx_f_2yt_9amr_utils_QTN_refine(struct __pyx_t_2yt_9amr_utils_QuadTreeNode *__pyx_v_self) { + int __pyx_v_i; + int __pyx_v_j; + __pyx_t_5numpy_int64_t __pyx_v_npos[2]; + int __pyx_t_1; + int __pyx_t_2; + __Pyx_RefNannySetupContext("QTN_refine"); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":58 + * cdef np.int64_t npos[2] + * cdef QuadTreeNode *node + * for i in range(2): # <<<<<<<<<<<<<< + * npos[0] = self.pos[0] * 2 + i + * for j in range(2): + */ + for (__pyx_t_1 = 0; __pyx_t_1 < 2; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":59 + * cdef QuadTreeNode *node + * for i in range(2): + * npos[0] = self.pos[0] * 2 + i # <<<<<<<<<<<<<< + * for j in range(2): + * npos[1] = self.pos[1] * 2 + j + */ + (__pyx_v_npos[0]) = (((__pyx_v_self->pos[0]) * 2) + __pyx_v_i); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":60 + * for i in range(2): + * npos[0] = self.pos[0] * 2 + i + * for j in range(2): # <<<<<<<<<<<<<< + * npos[1] = self.pos[1] * 2 + j + * # We have to be careful with allocation... + */ + for (__pyx_t_2 = 0; __pyx_t_2 < 2; __pyx_t_2+=1) { + __pyx_v_j = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":61 + * npos[0] = self.pos[0] * 2 + i + * for j in range(2): + * npos[1] = self.pos[1] * 2 + j # <<<<<<<<<<<<<< + * # We have to be careful with allocation... + * self.children[i][j] = QTN_initialize( + */ + (__pyx_v_npos[1]) = (((__pyx_v_self->pos[1]) * 2) + __pyx_v_j); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":63 + * npos[1] = self.pos[1] * 2 + j + * # We have to be careful with allocation... + * self.children[i][j] = QTN_initialize( # <<<<<<<<<<<<<< + * npos, + * self.nvals, self.val, self.weight_val, + */ + ((__pyx_v_self->children[__pyx_v_i])[__pyx_v_j]) = __pyx_f_2yt_9amr_utils_QTN_initialize(__pyx_v_npos, __pyx_v_self->nvals, __pyx_v_self->val, __pyx_v_self->weight_val, (__pyx_v_self->level + 1)); + } + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":67 + * self.nvals, self.val, self.weight_val, + * self.level + 1) + * for i in range(self.nvals): self.val[i] = 0.0 # <<<<<<<<<<<<<< + * self.weight_val = 0.0 + * + */ + __pyx_t_1 = __pyx_v_self->nvals; + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; + (__pyx_v_self->val[__pyx_v_i]) = 0.0; + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":68 + * self.level + 1) + * for i in range(self.nvals): self.val[i] = 0.0 + * self.weight_val = 0.0 # <<<<<<<<<<<<<< + * + * cdef QuadTreeNode *QTN_initialize(np.int64_t pos[2], int nvals, + */ + __pyx_v_self->weight_val = 0.0; + + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":70 + * self.weight_val = 0.0 + * + * cdef QuadTreeNode *QTN_initialize(np.int64_t pos[2], int nvals, # <<<<<<<<<<<<<< + * np.float64_t *val, np.float64_t weight_val, + * int level): + */ + +static struct __pyx_t_2yt_9amr_utils_QuadTreeNode *__pyx_f_2yt_9amr_utils_QTN_initialize(__pyx_t_5numpy_int64_t *__pyx_v_pos, int __pyx_v_nvals, __pyx_t_5numpy_float64_t *__pyx_v_val, __pyx_t_5numpy_float64_t __pyx_v_weight_val, int __pyx_v_level) { + struct __pyx_t_2yt_9amr_utils_QuadTreeNode *__pyx_v_node; + int __pyx_v_i; + int __pyx_v_j; + struct __pyx_t_2yt_9amr_utils_QuadTreeNode *__pyx_r; + int __pyx_t_1; + int __pyx_t_2; + __Pyx_RefNannySetupContext("QTN_initialize"); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":75 + * cdef QuadTreeNode *node + * cdef int i, j + * node = malloc(sizeof(QuadTreeNode)) # <<<<<<<<<<<<<< + * node.pos[0] = pos[0] + * node.pos[1] = pos[1] + */ + __pyx_v_node = ((struct __pyx_t_2yt_9amr_utils_QuadTreeNode *)malloc((sizeof(struct __pyx_t_2yt_9amr_utils_QuadTreeNode)))); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":76 + * cdef int i, j + * node = malloc(sizeof(QuadTreeNode)) + * node.pos[0] = pos[0] # <<<<<<<<<<<<<< + * node.pos[1] = pos[1] + * node.nvals = nvals + */ + (__pyx_v_node->pos[0]) = (__pyx_v_pos[0]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":77 + * node = malloc(sizeof(QuadTreeNode)) + * node.pos[0] = pos[0] + * node.pos[1] = pos[1] # <<<<<<<<<<<<<< + * node.nvals = nvals + * node.val = malloc( + */ + (__pyx_v_node->pos[1]) = (__pyx_v_pos[1]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":78 + * node.pos[0] = pos[0] + * node.pos[1] = pos[1] + * node.nvals = nvals # <<<<<<<<<<<<<< + * node.val = malloc( + * nvals * sizeof(np.float64_t)) + */ + __pyx_v_node->nvals = __pyx_v_nvals; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":79 + * node.pos[1] = pos[1] + * node.nvals = nvals + * node.val = malloc( # <<<<<<<<<<<<<< + * nvals * sizeof(np.float64_t)) + * for i in range(nvals): + */ + __pyx_v_node->val = ((__pyx_t_5numpy_float64_t *)malloc((__pyx_v_nvals * (sizeof(__pyx_t_5numpy_float64_t))))); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":81 + * node.val = malloc( + * nvals * sizeof(np.float64_t)) + * for i in range(nvals): # <<<<<<<<<<<<<< + * node.val[i] = val[i] + * node.weight_val = weight_val + */ + __pyx_t_1 = __pyx_v_nvals; + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":82 + * nvals * sizeof(np.float64_t)) + * for i in range(nvals): + * node.val[i] = val[i] # <<<<<<<<<<<<<< + * node.weight_val = weight_val + * for i in range(2): + */ + (__pyx_v_node->val[__pyx_v_i]) = (__pyx_v_val[__pyx_v_i]); + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":83 + * for i in range(nvals): + * node.val[i] = val[i] + * node.weight_val = weight_val # <<<<<<<<<<<<<< + * for i in range(2): + * for j in range(2): + */ + __pyx_v_node->weight_val = __pyx_v_weight_val; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":84 + * node.val[i] = val[i] + * node.weight_val = weight_val + * for i in range(2): # <<<<<<<<<<<<<< + * for j in range(2): + * node.children[i][j] = NULL + */ + for (__pyx_t_1 = 0; __pyx_t_1 < 2; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":85 + * node.weight_val = weight_val + * for i in range(2): + * for j in range(2): # <<<<<<<<<<<<<< + * node.children[i][j] = NULL + * node.level = level + */ + for (__pyx_t_2 = 0; __pyx_t_2 < 2; __pyx_t_2+=1) { + __pyx_v_j = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":86 + * for i in range(2): + * for j in range(2): + * node.children[i][j] = NULL # <<<<<<<<<<<<<< + * node.level = level + * return node + */ + ((__pyx_v_node->children[__pyx_v_i])[__pyx_v_j]) = NULL; + } + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":87 + * for j in range(2): + * node.children[i][j] = NULL + * node.level = level # <<<<<<<<<<<<<< + * return node + * + */ + __pyx_v_node->level = __pyx_v_level; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":88 + * node.children[i][j] = NULL + * node.level = level + * return node # <<<<<<<<<<<<<< + * + * cdef void QTN_free(QuadTreeNode *node): + */ + __pyx_r = __pyx_v_node; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":90 + * return node + * + * cdef void QTN_free(QuadTreeNode *node): # <<<<<<<<<<<<<< + * cdef int i, j + * for i in range(2): + */ + +static void __pyx_f_2yt_9amr_utils_QTN_free(struct __pyx_t_2yt_9amr_utils_QuadTreeNode *__pyx_v_node) { + int __pyx_v_i; + int __pyx_v_j; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + __Pyx_RefNannySetupContext("QTN_free"); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":92 + * cdef void QTN_free(QuadTreeNode *node): + * cdef int i, j + * for i in range(2): # <<<<<<<<<<<<<< + * for j in range(2): + * if node.children[i][j] == NULL: continue + */ + for (__pyx_t_1 = 0; __pyx_t_1 < 2; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":93 + * cdef int i, j + * for i in range(2): + * for j in range(2): # <<<<<<<<<<<<<< + * if node.children[i][j] == NULL: continue + * QTN_free(node.children[i][j]) + */ + for (__pyx_t_2 = 0; __pyx_t_2 < 2; __pyx_t_2+=1) { + __pyx_v_j = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":94 + * for i in range(2): + * for j in range(2): + * if node.children[i][j] == NULL: continue # <<<<<<<<<<<<<< + * QTN_free(node.children[i][j]) + * free(node.val) + */ + __pyx_t_3 = (((__pyx_v_node->children[__pyx_v_i])[__pyx_v_j]) == NULL); + if (__pyx_t_3) { + goto __pyx_L5_continue; + goto __pyx_L7; + } + __pyx_L7:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":95 + * for j in range(2): + * if node.children[i][j] == NULL: continue + * QTN_free(node.children[i][j]) # <<<<<<<<<<<<<< + * free(node.val) + * free(node) + */ + __pyx_f_2yt_9amr_utils_QTN_free(((__pyx_v_node->children[__pyx_v_i])[__pyx_v_j])); + __pyx_L5_continue:; + } + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":96 + * if node.children[i][j] == NULL: continue + * QTN_free(node.children[i][j]) + * free(node.val) # <<<<<<<<<<<<<< + * free(node) + * + */ + free(__pyx_v_node->val); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":97 + * QTN_free(node.children[i][j]) + * free(node.val) + * free(node) # <<<<<<<<<<<<<< + * + * cdef class QuadTree: + */ + free(__pyx_v_node); + + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":105 + * cdef np.int64_t top_grid_dims[2] + * + * def __cinit__(self, np.ndarray[np.int64_t, ndim=1] top_grid_dims, # <<<<<<<<<<<<<< + * int nvals): + * cdef int i, j + */ + +static int __pyx_pf_2yt_9amr_utils_8QuadTree___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2yt_9amr_utils_8QuadTree___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_top_grid_dims = 0; + int __pyx_v_nvals; + int __pyx_v_i; + int __pyx_v_j; + __pyx_t_5numpy_int64_t __pyx_v_pos[2]; + __pyx_t_5numpy_float64_t *__pyx_v_vals; + __pyx_t_5numpy_float64_t __pyx_v_weight_val; + Py_buffer __pyx_bstruct_top_grid_dims; + Py_ssize_t __pyx_bstride_0_top_grid_dims = 0; + Py_ssize_t __pyx_bshape_0_top_grid_dims = 0; + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + long __pyx_t_3; + long __pyx_t_4; + long __pyx_t_5; + long __pyx_t_6; + __pyx_t_5numpy_int64_t __pyx_t_7; + long __pyx_t_8; + long __pyx_t_9; + __pyx_t_5numpy_int64_t __pyx_t_10; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__top_grid_dims,&__pyx_n_s__nvals,0}; + __Pyx_RefNannySetupContext("__cinit__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__top_grid_dims); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nvals); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_top_grid_dims = ((PyArrayObject *)values[0]); + __pyx_v_nvals = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_nvals == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_top_grid_dims = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); + __pyx_v_nvals = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_nvals == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.QuadTree.__cinit__"); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_bstruct_top_grid_dims.buf = NULL; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_top_grid_dims), __pyx_ptype_5numpy_ndarray, 1, "top_grid_dims", 0))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_top_grid_dims, (PyObject*)__pyx_v_top_grid_dims, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_top_grid_dims = __pyx_bstruct_top_grid_dims.strides[0]; + __pyx_bshape_0_top_grid_dims = __pyx_bstruct_top_grid_dims.shape[0]; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":111 + * cdef np.int64_t pos[2] + * cdef np.float64_t *vals = alloca( + * sizeof(np.float64_t)*nvals) # <<<<<<<<<<<<<< + * cdef np.float64_t weight_val = 0.0 + * self.nvals = nvals + */ + __pyx_v_vals = ((__pyx_t_5numpy_float64_t *)alloca(((sizeof(__pyx_t_5numpy_float64_t)) * __pyx_v_nvals))); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":112 + * cdef np.float64_t *vals = alloca( + * sizeof(np.float64_t)*nvals) + * cdef np.float64_t weight_val = 0.0 # <<<<<<<<<<<<<< + * self.nvals = nvals + * for i in range(nvals): vals[i] = 0.0 + */ + __pyx_v_weight_val = 0.0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":113 + * sizeof(np.float64_t)*nvals) + * cdef np.float64_t weight_val = 0.0 + * self.nvals = nvals # <<<<<<<<<<<<<< + * for i in range(nvals): vals[i] = 0.0 + * + */ + ((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->nvals = __pyx_v_nvals; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":114 + * cdef np.float64_t weight_val = 0.0 + * self.nvals = nvals + * for i in range(nvals): vals[i] = 0.0 # <<<<<<<<<<<<<< + * + * self.top_grid_dims[0] = top_grid_dims[0] + */ + __pyx_t_1 = __pyx_v_nvals; + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; + (__pyx_v_vals[__pyx_v_i]) = 0.0; + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":116 + * for i in range(nvals): vals[i] = 0.0 + * + * self.top_grid_dims[0] = top_grid_dims[0] # <<<<<<<<<<<<<< + * self.top_grid_dims[1] = top_grid_dims[1] + * + */ + __pyx_t_3 = 0; + __pyx_t_1 = -1; + if (__pyx_t_3 < 0) { + __pyx_t_3 += __pyx_bshape_0_top_grid_dims; + if (unlikely(__pyx_t_3 < 0)) __pyx_t_1 = 0; + } else if (unlikely(__pyx_t_3 >= __pyx_bshape_0_top_grid_dims)) __pyx_t_1 = 0; + if (unlikely(__pyx_t_1 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_1); + {__pyx_filename = __pyx_f[9]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + (((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->top_grid_dims[0]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_top_grid_dims.buf, __pyx_t_3, __pyx_bstride_0_top_grid_dims)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":117 + * + * self.top_grid_dims[0] = top_grid_dims[0] + * self.top_grid_dims[1] = top_grid_dims[1] # <<<<<<<<<<<<<< + * + * # This wouldn't be necessary if we did bitshifting... + */ + __pyx_t_4 = 1; + __pyx_t_1 = -1; + if (__pyx_t_4 < 0) { + __pyx_t_4 += __pyx_bshape_0_top_grid_dims; + if (unlikely(__pyx_t_4 < 0)) __pyx_t_1 = 0; + } else if (unlikely(__pyx_t_4 >= __pyx_bshape_0_top_grid_dims)) __pyx_t_1 = 0; + if (unlikely(__pyx_t_1 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_1); + {__pyx_filename = __pyx_f[9]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + (((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->top_grid_dims[1]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_top_grid_dims.buf, __pyx_t_4, __pyx_bstride_0_top_grid_dims)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":120 + * + * # This wouldn't be necessary if we did bitshifting... + * for i in range(80): # <<<<<<<<<<<<<< + * self.po2[i] = 2**i + * self.root_nodes = \ + */ + for (__pyx_t_1 = 0; __pyx_t_1 < 80; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":121 + * # This wouldn't be necessary if we did bitshifting... + * for i in range(80): + * self.po2[i] = 2**i # <<<<<<<<<<<<<< + * self.root_nodes = \ + * malloc(sizeof(QuadTreeNode **) * top_grid_dims[0]) + */ + (((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->po2[__pyx_v_i]) = __Pyx_pow_long(2, __pyx_v_i); + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":123 + * self.po2[i] = 2**i + * self.root_nodes = \ + * malloc(sizeof(QuadTreeNode **) * top_grid_dims[0]) # <<<<<<<<<<<<<< + * + * # We initialize our root values to 0.0. + */ + __pyx_t_5 = 0; + __pyx_t_1 = -1; + if (__pyx_t_5 < 0) { + __pyx_t_5 += __pyx_bshape_0_top_grid_dims; + if (unlikely(__pyx_t_5 < 0)) __pyx_t_1 = 0; + } else if (unlikely(__pyx_t_5 >= __pyx_bshape_0_top_grid_dims)) __pyx_t_1 = 0; + if (unlikely(__pyx_t_1 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_1); + {__pyx_filename = __pyx_f[9]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":122 + * for i in range(80): + * self.po2[i] = 2**i + * self.root_nodes = \ # <<<<<<<<<<<<<< + * malloc(sizeof(QuadTreeNode **) * top_grid_dims[0]) + * + */ + ((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->root_nodes = ((struct __pyx_t_2yt_9amr_utils_QuadTreeNode ***)malloc(((sizeof(struct __pyx_t_2yt_9amr_utils_QuadTreeNode **)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_top_grid_dims.buf, __pyx_t_5, __pyx_bstride_0_top_grid_dims))))); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":126 + * + * # We initialize our root values to 0.0. + * for i in range(top_grid_dims[0]): # <<<<<<<<<<<<<< + * pos[0] = i + * self.root_nodes[i] = \ + */ + __pyx_t_6 = 0; + __pyx_t_1 = -1; + if (__pyx_t_6 < 0) { + __pyx_t_6 += __pyx_bshape_0_top_grid_dims; + if (unlikely(__pyx_t_6 < 0)) __pyx_t_1 = 0; + } else if (unlikely(__pyx_t_6 >= __pyx_bshape_0_top_grid_dims)) __pyx_t_1 = 0; + if (unlikely(__pyx_t_1 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_1); + {__pyx_filename = __pyx_f[9]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_7 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_top_grid_dims.buf, __pyx_t_6, __pyx_bstride_0_top_grid_dims)); + for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_7; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":127 + * # We initialize our root values to 0.0. + * for i in range(top_grid_dims[0]): + * pos[0] = i # <<<<<<<<<<<<<< + * self.root_nodes[i] = \ + * malloc(sizeof(QuadTreeNode *) * top_grid_dims[1]) + */ + (__pyx_v_pos[0]) = __pyx_v_i; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":129 + * pos[0] = i + * self.root_nodes[i] = \ + * malloc(sizeof(QuadTreeNode *) * top_grid_dims[1]) # <<<<<<<<<<<<<< + * for j in range(top_grid_dims[1]): + * pos[1] = j + */ + __pyx_t_8 = 1; + __pyx_t_2 = -1; + if (__pyx_t_8 < 0) { + __pyx_t_8 += __pyx_bshape_0_top_grid_dims; + if (unlikely(__pyx_t_8 < 0)) __pyx_t_2 = 0; + } else if (unlikely(__pyx_t_8 >= __pyx_bshape_0_top_grid_dims)) __pyx_t_2 = 0; + if (unlikely(__pyx_t_2 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_2); + {__pyx_filename = __pyx_f[9]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":128 + * for i in range(top_grid_dims[0]): + * pos[0] = i + * self.root_nodes[i] = \ # <<<<<<<<<<<<<< + * malloc(sizeof(QuadTreeNode *) * top_grid_dims[1]) + * for j in range(top_grid_dims[1]): + */ + (((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->root_nodes[__pyx_v_i]) = ((struct __pyx_t_2yt_9amr_utils_QuadTreeNode **)malloc(((sizeof(struct __pyx_t_2yt_9amr_utils_QuadTreeNode *)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_top_grid_dims.buf, __pyx_t_8, __pyx_bstride_0_top_grid_dims))))); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":130 + * self.root_nodes[i] = \ + * malloc(sizeof(QuadTreeNode *) * top_grid_dims[1]) + * for j in range(top_grid_dims[1]): # <<<<<<<<<<<<<< + * pos[1] = j + * self.root_nodes[i][j] = QTN_initialize( + */ + __pyx_t_9 = 1; + __pyx_t_2 = -1; + if (__pyx_t_9 < 0) { + __pyx_t_9 += __pyx_bshape_0_top_grid_dims; + if (unlikely(__pyx_t_9 < 0)) __pyx_t_2 = 0; + } else if (unlikely(__pyx_t_9 >= __pyx_bshape_0_top_grid_dims)) __pyx_t_2 = 0; + if (unlikely(__pyx_t_2 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_2); + {__pyx_filename = __pyx_f[9]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_10 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_top_grid_dims.buf, __pyx_t_9, __pyx_bstride_0_top_grid_dims)); + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_10; __pyx_t_2+=1) { + __pyx_v_j = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":131 + * malloc(sizeof(QuadTreeNode *) * top_grid_dims[1]) + * for j in range(top_grid_dims[1]): + * pos[1] = j # <<<<<<<<<<<<<< + * self.root_nodes[i][j] = QTN_initialize( + * pos, nvals, vals, weight_val, 0) + */ + (__pyx_v_pos[1]) = __pyx_v_j; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":132 + * for j in range(top_grid_dims[1]): + * pos[1] = j + * self.root_nodes[i][j] = QTN_initialize( # <<<<<<<<<<<<<< + * pos, nvals, vals, weight_val, 0) + * + */ + ((((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->root_nodes[__pyx_v_i])[__pyx_v_j]) = __pyx_f_2yt_9amr_utils_QTN_initialize(__pyx_v_pos, __pyx_v_nvals, __pyx_v_vals, __pyx_v_weight_val, 0); + } + } + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_top_grid_dims); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.amr_utils.QuadTree.__cinit__"); + __pyx_r = -1; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_top_grid_dims); + __pyx_L2:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":135 + * pos, nvals, vals, weight_val, 0) + * + * cdef void add_to_position(self, # <<<<<<<<<<<<<< + * int level, np.int64_t pos[2], + * np.float64_t *val, + */ + +static void __pyx_f_2yt_9amr_utils_8QuadTree_add_to_position(struct __pyx_obj_2yt_9amr_utils_QuadTree *__pyx_v_self, int __pyx_v_level, __pyx_t_5numpy_int64_t *__pyx_v_pos, __pyx_t_5numpy_float64_t *__pyx_v_val, __pyx_t_5numpy_float64_t __pyx_v_weight_val) { + int __pyx_v_i; + int __pyx_v_j; + struct __pyx_t_2yt_9amr_utils_QuadTreeNode *__pyx_v_node; + __pyx_t_5numpy_int64_t __pyx_v_fac; + PyObject *__pyx_v_L; + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + __Pyx_RefNannySetupContext("add_to_position"); + __pyx_v_L = Py_None; __Pyx_INCREF(Py_None); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":141 + * cdef int i, j + * cdef QuadTreeNode *node + * node = self.find_on_root_level(pos, level) # <<<<<<<<<<<<<< + * cdef np.int64_t fac + * for L in range(level): + */ + __pyx_v_node = ((struct __pyx_vtabstruct_2yt_9amr_utils_QuadTree *)__pyx_v_self->__pyx_vtab)->find_on_root_level(__pyx_v_self, __pyx_v_pos, __pyx_v_level); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":143 + * node = self.find_on_root_level(pos, level) + * cdef np.int64_t fac + * for L in range(level): # <<<<<<<<<<<<<< + * if node.children[0][0] == NULL: + * QTN_refine(node) + */ + __pyx_t_2 = PyInt_FromLong(__pyx_v_level); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_1 = 0; __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); + } else { + __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break; + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++; + } else if (likely(PyTuple_CheckExact(__pyx_t_3))) { + if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++; + } else { + __pyx_t_2 = PyIter_Next(__pyx_t_3); + if (!__pyx_t_2) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_v_L); + __pyx_v_L = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":144 + * cdef np.int64_t fac + * for L in range(level): + * if node.children[0][0] == NULL: # <<<<<<<<<<<<<< + * QTN_refine(node) + * # Maybe we should use bitwise operators? + */ + __pyx_t_4 = (((__pyx_v_node->children[0])[0]) == NULL); + if (__pyx_t_4) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":145 + * for L in range(level): + * if node.children[0][0] == NULL: + * QTN_refine(node) # <<<<<<<<<<<<<< + * # Maybe we should use bitwise operators? + * fac = self.po2[level - L - 1] + */ + __pyx_f_2yt_9amr_utils_QTN_refine(__pyx_v_node); + goto __pyx_L5; + } + __pyx_L5:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":147 + * QTN_refine(node) + * # Maybe we should use bitwise operators? + * fac = self.po2[level - L - 1] # <<<<<<<<<<<<<< + * i = (pos[0] >= fac*(2*node.pos[0]+1)) + * j = (pos[1] >= fac*(2*node.pos[1]+1)) + */ + __pyx_t_2 = PyInt_FromLong(__pyx_v_level); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyNumber_Subtract(__pyx_t_2, __pyx_v_L); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Subtract(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_fac = (__pyx_v_self->po2[__pyx_t_6]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":148 + * # Maybe we should use bitwise operators? + * fac = self.po2[level - L - 1] + * i = (pos[0] >= fac*(2*node.pos[0]+1)) # <<<<<<<<<<<<<< + * j = (pos[1] >= fac*(2*node.pos[1]+1)) + * node = node.children[i][j] + */ + __pyx_v_i = ((__pyx_v_pos[0]) >= (__pyx_v_fac * ((2 * (__pyx_v_node->pos[0])) + 1))); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":149 + * fac = self.po2[level - L - 1] + * i = (pos[0] >= fac*(2*node.pos[0]+1)) + * j = (pos[1] >= fac*(2*node.pos[1]+1)) # <<<<<<<<<<<<<< + * node = node.children[i][j] + * QTN_add_value(node, val, weight_val) + */ + __pyx_v_j = ((__pyx_v_pos[1]) >= (__pyx_v_fac * ((2 * (__pyx_v_node->pos[1])) + 1))); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":150 + * i = (pos[0] >= fac*(2*node.pos[0]+1)) + * j = (pos[1] >= fac*(2*node.pos[1]+1)) + * node = node.children[i][j] # <<<<<<<<<<<<<< + * QTN_add_value(node, val, weight_val) + * + */ + __pyx_v_node = ((__pyx_v_node->children[__pyx_v_i])[__pyx_v_j]); + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":151 + * j = (pos[1] >= fac*(2*node.pos[1]+1)) + * node = node.children[i][j] + * QTN_add_value(node, val, weight_val) # <<<<<<<<<<<<<< + * + * cdef QuadTreeNode *find_on_root_level(self, np.int64_t pos[2], int level): + */ + __pyx_f_2yt_9amr_utils_QTN_add_value(__pyx_v_node, __pyx_v_val, __pyx_v_weight_val); + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_WriteUnraisable("yt.amr_utils.QuadTree.add_to_position"); + __pyx_L0:; + __Pyx_DECREF(__pyx_v_L); + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":153 + * QTN_add_value(node, val, weight_val) + * + * cdef QuadTreeNode *find_on_root_level(self, np.int64_t pos[2], int level): # <<<<<<<<<<<<<< + * # We need this because the root level won't just have four children + * # So we find on the root level, then we traverse the tree. + */ + +static struct __pyx_t_2yt_9amr_utils_QuadTreeNode *__pyx_f_2yt_9amr_utils_8QuadTree_find_on_root_level(struct __pyx_obj_2yt_9amr_utils_QuadTree *__pyx_v_self, __pyx_t_5numpy_int64_t *__pyx_v_pos, int __pyx_v_level) { + __pyx_t_5numpy_int64_t __pyx_v_i; + __pyx_t_5numpy_int64_t __pyx_v_j; + struct __pyx_t_2yt_9amr_utils_QuadTreeNode *__pyx_r; + __pyx_t_5numpy_int64_t __pyx_t_1; + __pyx_t_5numpy_int64_t __pyx_t_2; + __Pyx_RefNannySetupContext("find_on_root_level"); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":157 + * # So we find on the root level, then we traverse the tree. + * cdef np.int64_t i, j + * i = (pos[0] / self.po2[level]) # <<<<<<<<<<<<<< + * j = (pos[1] / self.po2[level]) + * return self.root_nodes[i][j] + */ + __pyx_t_1 = (__pyx_v_pos[0]); + __pyx_t_2 = (__pyx_v_self->po2[__pyx_v_level]); + if (unlikely(__pyx_t_2 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + {__pyx_filename = __pyx_f[9]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + else if (sizeof(__pyx_t_5numpy_int64_t) == sizeof(long) && unlikely(__pyx_t_2 == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_1))) { + PyErr_Format(PyExc_OverflowError, "value too large to perform division"); + {__pyx_filename = __pyx_f[9]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_i = __Pyx_div___pyx_t_5numpy_int64_t(__pyx_t_1, __pyx_t_2); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":158 + * cdef np.int64_t i, j + * i = (pos[0] / self.po2[level]) + * j = (pos[1] / self.po2[level]) # <<<<<<<<<<<<<< + * return self.root_nodes[i][j] + * + */ + __pyx_t_2 = (__pyx_v_pos[1]); + __pyx_t_1 = (__pyx_v_self->po2[__pyx_v_level]); + if (unlikely(__pyx_t_1 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + {__pyx_filename = __pyx_f[9]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + else if (sizeof(__pyx_t_5numpy_int64_t) == sizeof(long) && unlikely(__pyx_t_1 == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_2))) { + PyErr_Format(PyExc_OverflowError, "value too large to perform division"); + {__pyx_filename = __pyx_f[9]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_j = __Pyx_div___pyx_t_5numpy_int64_t(__pyx_t_2, __pyx_t_1); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":159 + * i = (pos[0] / self.po2[level]) + * j = (pos[1] / self.po2[level]) + * return self.root_nodes[i][j] # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = ((__pyx_v_self->root_nodes[__pyx_v_i])[__pyx_v_j]); + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_WriteUnraisable("yt.amr_utils.QuadTree.find_on_root_level"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":164 + * @cython.boundscheck(False) + * @cython.wraparound(False) + * def add_array_to_tree(self, int level, # <<<<<<<<<<<<<< + * np.ndarray[np.int64_t, ndim=1] pxs, + * np.ndarray[np.int64_t, ndim=1] pys, + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_8QuadTree_add_array_to_tree(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_8QuadTree_add_array_to_tree(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_level; + PyArrayObject *__pyx_v_pxs = 0; + PyArrayObject *__pyx_v_pys = 0; + PyArrayObject *__pyx_v_pvals = 0; + PyArrayObject *__pyx_v_pweight_vals = 0; + int __pyx_v_np; + int __pyx_v_p; + __pyx_t_5numpy_float64_t *__pyx_v_vals; + __pyx_t_5numpy_float64_t *__pyx_v_data; + __pyx_t_5numpy_int64_t __pyx_v_pos[2]; + Py_buffer __pyx_bstruct_pweight_vals; + Py_ssize_t __pyx_bstride_0_pweight_vals = 0; + Py_ssize_t __pyx_bshape_0_pweight_vals = 0; + Py_buffer __pyx_bstruct_pxs; + Py_ssize_t __pyx_bstride_0_pxs = 0; + Py_ssize_t __pyx_bshape_0_pxs = 0; + Py_buffer __pyx_bstruct_pvals; + Py_ssize_t __pyx_bstride_0_pvals = 0; + Py_ssize_t __pyx_bstride_1_pvals = 0; + Py_ssize_t __pyx_bshape_0_pvals = 0; + Py_ssize_t __pyx_bshape_1_pvals = 0; + Py_buffer __pyx_bstruct_pys; + Py_ssize_t __pyx_bstride_0_pys = 0; + Py_ssize_t __pyx_bshape_0_pys = 0; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__level,&__pyx_n_s__pxs,&__pyx_n_s__pys,&__pyx_n_s__pvals,&__pyx_n_s__pweight_vals,0}; + __Pyx_RefNannySetupContext("add_array_to_tree"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[5] = {0,0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__level); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pxs); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("add_array_to_tree", 1, 5, 5, 1); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pys); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("add_array_to_tree", 1, 5, 5, 2); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pvals); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("add_array_to_tree", 1, 5, 5, 3); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pweight_vals); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("add_array_to_tree", 1, 5, 5, 4); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "add_array_to_tree") < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_level = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_pxs = ((PyArrayObject *)values[1]); + __pyx_v_pys = ((PyArrayObject *)values[2]); + __pyx_v_pvals = ((PyArrayObject *)values[3]); + __pyx_v_pweight_vals = ((PyArrayObject *)values[4]); + } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_level = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_pxs = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); + __pyx_v_pys = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); + __pyx_v_pvals = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); + __pyx_v_pweight_vals = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("add_array_to_tree", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.QuadTree.add_array_to_tree"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_bstruct_pxs.buf = NULL; + __pyx_bstruct_pys.buf = NULL; + __pyx_bstruct_pvals.buf = NULL; + __pyx_bstruct_pweight_vals.buf = NULL; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pxs), __pyx_ptype_5numpy_ndarray, 1, "pxs", 0))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pys), __pyx_ptype_5numpy_ndarray, 1, "pys", 0))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pvals), __pyx_ptype_5numpy_ndarray, 1, "pvals", 0))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pweight_vals), __pyx_ptype_5numpy_ndarray, 1, "pweight_vals", 0))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_pxs, (PyObject*)__pyx_v_pxs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_pxs = __pyx_bstruct_pxs.strides[0]; + __pyx_bshape_0_pxs = __pyx_bstruct_pxs.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_pys, (PyObject*)__pyx_v_pys, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_pys = __pyx_bstruct_pys.strides[0]; + __pyx_bshape_0_pys = __pyx_bstruct_pys.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_pvals, (PyObject*)__pyx_v_pvals, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_pvals = __pyx_bstruct_pvals.strides[0]; __pyx_bstride_1_pvals = __pyx_bstruct_pvals.strides[1]; + __pyx_bshape_0_pvals = __pyx_bstruct_pvals.shape[0]; __pyx_bshape_1_pvals = __pyx_bstruct_pvals.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_pweight_vals, (PyObject*)__pyx_v_pweight_vals, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_pweight_vals = __pyx_bstruct_pweight_vals.strides[0]; + __pyx_bshape_0_pweight_vals = __pyx_bstruct_pweight_vals.shape[0]; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":169 + * np.ndarray[np.float64_t, ndim=2] pvals, + * np.ndarray[np.float64_t, ndim=1] pweight_vals): + * cdef int np = pxs.shape[0] # <<<<<<<<<<<<<< + * cdef int p + * cdef cnp.float64_t *vals + */ + __pyx_v_np = (__pyx_v_pxs->dimensions[0]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":172 + * cdef int p + * cdef cnp.float64_t *vals + * cdef cnp.float64_t *data = pvals.data # <<<<<<<<<<<<<< + * cdef cnp.int64_t pos[2] + * for p in range(np): + */ + __pyx_v_data = ((__pyx_t_5numpy_float64_t *)__pyx_v_pvals->data); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":174 + * cdef cnp.float64_t *data = pvals.data + * cdef cnp.int64_t pos[2] + * for p in range(np): # <<<<<<<<<<<<<< + * vals = data + self.nvals*p + * pos[0] = pxs[p] + */ + __pyx_t_1 = __pyx_v_np; + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_p = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":175 + * cdef cnp.int64_t pos[2] + * for p in range(np): + * vals = data + self.nvals*p # <<<<<<<<<<<<<< + * pos[0] = pxs[p] + * pos[1] = pys[p] + */ + __pyx_v_vals = (__pyx_v_data + (((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->nvals * __pyx_v_p)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":176 + * for p in range(np): + * vals = data + self.nvals*p + * pos[0] = pxs[p] # <<<<<<<<<<<<<< + * pos[1] = pys[p] + * self.add_to_position(level, pos, vals, pweight_vals[p]) + */ + __pyx_t_3 = __pyx_v_p; + (__pyx_v_pos[0]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_pxs.buf, __pyx_t_3, __pyx_bstride_0_pxs)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":177 + * vals = data + self.nvals*p + * pos[0] = pxs[p] + * pos[1] = pys[p] # <<<<<<<<<<<<<< + * self.add_to_position(level, pos, vals, pweight_vals[p]) + * + */ + __pyx_t_4 = __pyx_v_p; + (__pyx_v_pos[1]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_pys.buf, __pyx_t_4, __pyx_bstride_0_pys)); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":178 + * pos[0] = pxs[p] + * pos[1] = pys[p] + * self.add_to_position(level, pos, vals, pweight_vals[p]) # <<<<<<<<<<<<<< + * + * def add_grid_to_tree(self, int level, + */ + __pyx_t_5 = __pyx_v_p; + ((struct __pyx_vtabstruct_2yt_9amr_utils_QuadTree *)((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->__pyx_vtab)->add_to_position(((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self), __pyx_v_level, __pyx_v_pos, __pyx_v_vals, (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_pweight_vals.buf, __pyx_t_5, __pyx_bstride_0_pweight_vals))); + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_pweight_vals); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_pxs); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_pvals); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_pys); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.amr_utils.QuadTree.add_array_to_tree"); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_pweight_vals); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_pxs); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_pvals); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_pys); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":180 + * self.add_to_position(level, pos, vals, pweight_vals[p]) + * + * def add_grid_to_tree(self, int level, # <<<<<<<<<<<<<< + * np.ndarray[np.int64_t, ndim=1] start_index, + * np.ndarray[np.float64_t, ndim=2] pvals, + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_8QuadTree_add_grid_to_tree(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_8QuadTree_add_grid_to_tree(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_level; + PyArrayObject *__pyx_v_start_index = 0; + PyArrayObject *__pyx_v_pvals = 0; + PyArrayObject *__pyx_v_wvals = 0; + PyArrayObject *__pyx_v_cm = 0; + Py_buffer __pyx_bstruct_cm; + Py_ssize_t __pyx_bstride_0_cm = 0; + Py_ssize_t __pyx_bstride_1_cm = 0; + Py_ssize_t __pyx_bshape_0_cm = 0; + Py_ssize_t __pyx_bshape_1_cm = 0; + Py_buffer __pyx_bstruct_pvals; + Py_ssize_t __pyx_bstride_0_pvals = 0; + Py_ssize_t __pyx_bstride_1_pvals = 0; + Py_ssize_t __pyx_bshape_0_pvals = 0; + Py_ssize_t __pyx_bshape_1_pvals = 0; + Py_buffer __pyx_bstruct_wvals; + Py_ssize_t __pyx_bstride_0_wvals = 0; + Py_ssize_t __pyx_bstride_1_wvals = 0; + Py_ssize_t __pyx_bshape_0_wvals = 0; + Py_ssize_t __pyx_bshape_1_wvals = 0; + Py_buffer __pyx_bstruct_start_index; + Py_ssize_t __pyx_bstride_0_start_index = 0; + Py_ssize_t __pyx_bshape_0_start_index = 0; + PyObject *__pyx_r = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__level,&__pyx_n_s__start_index,&__pyx_n_s__pvals,&__pyx_n_s__wvals,&__pyx_n_s__cm,0}; + __Pyx_RefNannySetupContext("add_grid_to_tree"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[5] = {0,0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__level); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start_index); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("add_grid_to_tree", 1, 5, 5, 1); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pvals); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("add_grid_to_tree", 1, 5, 5, 2); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__wvals); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("add_grid_to_tree", 1, 5, 5, 3); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__cm); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("add_grid_to_tree", 1, 5, 5, 4); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "add_grid_to_tree") < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_level = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_start_index = ((PyArrayObject *)values[1]); + __pyx_v_pvals = ((PyArrayObject *)values[2]); + __pyx_v_wvals = ((PyArrayObject *)values[3]); + __pyx_v_cm = ((PyArrayObject *)values[4]); + } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_level = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_start_index = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); + __pyx_v_pvals = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); + __pyx_v_wvals = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); + __pyx_v_cm = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("add_grid_to_tree", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.QuadTree.add_grid_to_tree"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_bstruct_start_index.buf = NULL; + __pyx_bstruct_pvals.buf = NULL; + __pyx_bstruct_wvals.buf = NULL; + __pyx_bstruct_cm.buf = NULL; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_start_index), __pyx_ptype_5numpy_ndarray, 1, "start_index", 0))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pvals), __pyx_ptype_5numpy_ndarray, 1, "pvals", 0))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_wvals), __pyx_ptype_5numpy_ndarray, 1, "wvals", 0))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_cm), __pyx_ptype_5numpy_ndarray, 1, "cm", 0))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_start_index, (PyObject*)__pyx_v_start_index, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_start_index = __pyx_bstruct_start_index.strides[0]; + __pyx_bshape_0_start_index = __pyx_bstruct_start_index.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_pvals, (PyObject*)__pyx_v_pvals, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_pvals = __pyx_bstruct_pvals.strides[0]; __pyx_bstride_1_pvals = __pyx_bstruct_pvals.strides[1]; + __pyx_bshape_0_pvals = __pyx_bstruct_pvals.shape[0]; __pyx_bshape_1_pvals = __pyx_bstruct_pvals.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_wvals, (PyObject*)__pyx_v_wvals, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_wvals = __pyx_bstruct_wvals.strides[0]; __pyx_bstride_1_wvals = __pyx_bstruct_wvals.strides[1]; + __pyx_bshape_0_wvals = __pyx_bstruct_wvals.shape[0]; __pyx_bshape_1_wvals = __pyx_bstruct_wvals.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_cm, (PyObject*)__pyx_v_cm, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_cm = __pyx_bstruct_cm.strides[0]; __pyx_bstride_1_cm = __pyx_bstruct_cm.strides[1]; + __pyx_bshape_0_cm = __pyx_bstruct_cm.shape[0]; __pyx_bshape_1_cm = __pyx_bstruct_cm.shape[1]; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cm); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_pvals); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_wvals); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_start_index); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.amr_utils.QuadTree.add_grid_to_tree"); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cm); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_pvals); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_wvals); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_start_index); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":189 + * @cython.boundscheck(False) + * @cython.wraparound(False) + * def get_all_from_level(self, int level, int count_only = 0): # <<<<<<<<<<<<<< + * cdef int i, j + * cdef int total = 0 + */ + +static PyObject *__pyx_pf_2yt_9amr_utils_8QuadTree_get_all_from_level(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2yt_9amr_utils_8QuadTree_get_all_from_level(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_level; + int __pyx_v_count_only; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_total; + PyObject *__pyx_v_vals; + PyArrayObject *__pyx_v_npos; + PyArrayObject *__pyx_v_nvals; + PyArrayObject *__pyx_v_nwvals; + __pyx_t_5numpy_int64_t __pyx_v_curpos; + __pyx_t_5numpy_int64_t *__pyx_v_pdata; + __pyx_t_5numpy_float64_t *__pyx_v_vdata; + __pyx_t_5numpy_float64_t *__pyx_v_wdata; + Py_buffer __pyx_bstruct_nwvals; + Py_ssize_t __pyx_bstride_0_nwvals = 0; + Py_ssize_t __pyx_bshape_0_nwvals = 0; + Py_buffer __pyx_bstruct_nvals; + Py_ssize_t __pyx_bstride_0_nvals = 0; + Py_ssize_t __pyx_bstride_1_nvals = 0; + Py_ssize_t __pyx_bshape_0_nvals = 0; + Py_ssize_t __pyx_bshape_1_nvals = 0; + Py_buffer __pyx_bstruct_npos; + Py_ssize_t __pyx_bstride_0_npos = 0; + Py_ssize_t __pyx_bstride_1_npos = 0; + Py_ssize_t __pyx_bshape_0_npos = 0; + Py_ssize_t __pyx_bshape_1_npos = 0; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __pyx_t_5numpy_int64_t __pyx_t_2; + int __pyx_t_3; + __pyx_t_5numpy_int64_t __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyArrayObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyArrayObject *__pyx_t_13 = NULL; + PyArrayObject *__pyx_t_14 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__level,&__pyx_n_s__count_only,0}; + __Pyx_RefNannySetupContext("get_all_from_level"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__level); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__count_only); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "get_all_from_level") < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_level = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (values[1]) { + __pyx_v_count_only = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_count_only == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_count_only = ((int)0); + } + } else { + __pyx_v_count_only = ((int)0); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: __pyx_v_count_only = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_count_only == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 1: __pyx_v_level = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("get_all_from_level", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("yt.amr_utils.QuadTree.get_all_from_level"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_vals = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_npos = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_nvals = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_nwvals = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_bstruct_npos.buf = NULL; + __pyx_bstruct_nvals.buf = NULL; + __pyx_bstruct_nwvals.buf = NULL; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":191 + * def get_all_from_level(self, int level, int count_only = 0): + * cdef int i, j + * cdef int total = 0 # <<<<<<<<<<<<<< + * vals = [] + * for i in range(self.top_grid_dims[0]): + */ + __pyx_v_total = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":192 + * cdef int i, j + * cdef int total = 0 + * vals = [] # <<<<<<<<<<<<<< + * for i in range(self.top_grid_dims[0]): + * for j in range(self.top_grid_dims[1]): + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_v_vals)); + __pyx_v_vals = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":193 + * cdef int total = 0 + * vals = [] + * for i in range(self.top_grid_dims[0]): # <<<<<<<<<<<<<< + * for j in range(self.top_grid_dims[1]): + * total += self.count_at_level(self.root_nodes[i][j], level) + */ + __pyx_t_2 = (((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->top_grid_dims[0]); + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":194 + * vals = [] + * for i in range(self.top_grid_dims[0]): + * for j in range(self.top_grid_dims[1]): # <<<<<<<<<<<<<< + * total += self.count_at_level(self.root_nodes[i][j], level) + * if count_only: return total + */ + __pyx_t_4 = (((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->top_grid_dims[1]); + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_j = __pyx_t_5; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":195 + * for i in range(self.top_grid_dims[0]): + * for j in range(self.top_grid_dims[1]): + * total += self.count_at_level(self.root_nodes[i][j], level) # <<<<<<<<<<<<<< + * if count_only: return total + * # Allocate our array + */ + __pyx_v_total += ((struct __pyx_vtabstruct_2yt_9amr_utils_QuadTree *)((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->__pyx_vtab)->count_at_level(((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self), ((((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->root_nodes[__pyx_v_i])[__pyx_v_j]), __pyx_v_level); + } + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":196 + * for j in range(self.top_grid_dims[1]): + * total += self.count_at_level(self.root_nodes[i][j], level) + * if count_only: return total # <<<<<<<<<<<<<< + * # Allocate our array + * cdef np.ndarray[np.int64_t, ndim=2] npos + */ + if (__pyx_v_count_only) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(__pyx_v_total); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + goto __pyx_L10; + } + __pyx_L10:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":201 + * cdef np.ndarray[np.float64_t, ndim=2] nvals + * cdef np.ndarray[np.float64_t, ndim=1] nwvals + * npos = np.zeros( (total, 2), dtype='int64') # <<<<<<<<<<<<<< + * nvals = np.zeros( (total, self.nvals), dtype='float64') + * nwvals = np.zeros( total, dtype='float64') + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyInt_FromLong(__pyx_v_total); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_int_2); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_int_2); + __Pyx_GIVEREF(__pyx_int_2); + __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__int64)) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyEval_CallObjectWithKeywords(__pyx_t_6, __pyx_t_1, ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = ((PyArrayObject *)__pyx_t_8); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_npos); + __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_npos, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + if (unlikely(__pyx_t_3 < 0)) { + PyErr_Fetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_npos, (PyObject*)__pyx_v_npos, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_10, __pyx_t_11, __pyx_t_12); + } + } + __pyx_bstride_0_npos = __pyx_bstruct_npos.strides[0]; __pyx_bstride_1_npos = __pyx_bstruct_npos.strides[1]; + __pyx_bshape_0_npos = __pyx_bstruct_npos.shape[0]; __pyx_bshape_1_npos = __pyx_bstruct_npos.shape[1]; + if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_9 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_npos)); + __pyx_v_npos = ((PyArrayObject *)__pyx_t_8); + __pyx_t_8 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":202 + * cdef np.ndarray[np.float64_t, ndim=1] nwvals + * npos = np.zeros( (total, 2), dtype='int64') + * nvals = np.zeros( (total, self.nvals), dtype='float64') # <<<<<<<<<<<<<< + * nwvals = np.zeros( total, dtype='float64') + * cdef np.int64_t curpos = 0 + */ + __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__zeros); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyInt_FromLong(__pyx_v_total); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->nvals); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_8 = 0; + __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyEval_CallObjectWithKeywords(__pyx_t_7, __pyx_t_1, ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = ((PyArrayObject *)__pyx_t_8); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_nvals); + __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_nvals, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + if (unlikely(__pyx_t_3 < 0)) { + PyErr_Fetch(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_nvals, (PyObject*)__pyx_v_nvals, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_12, __pyx_t_11, __pyx_t_10); + } + } + __pyx_bstride_0_nvals = __pyx_bstruct_nvals.strides[0]; __pyx_bstride_1_nvals = __pyx_bstruct_nvals.strides[1]; + __pyx_bshape_0_nvals = __pyx_bstruct_nvals.shape[0]; __pyx_bshape_1_nvals = __pyx_bstruct_nvals.shape[1]; + if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_13 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_nvals)); + __pyx_v_nvals = ((PyArrayObject *)__pyx_t_8); + __pyx_t_8 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":203 + * npos = np.zeros( (total, 2), dtype='int64') + * nvals = np.zeros( (total, self.nvals), dtype='float64') + * nwvals = np.zeros( total, dtype='float64') # <<<<<<<<<<<<<< + * cdef np.int64_t curpos = 0 + * cdef np.int64_t *pdata = npos.data + */ + __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__zeros); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyInt_FromLong(__pyx_v_total); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_t_8 = 0; + __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__float64)) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyEval_CallObjectWithKeywords(__pyx_t_6, __pyx_t_1, ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = ((PyArrayObject *)__pyx_t_7); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_nwvals); + __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_nwvals, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_3 < 0)) { + PyErr_Fetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_nwvals, (PyObject*)__pyx_v_nwvals, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_10, __pyx_t_11, __pyx_t_12); + } + } + __pyx_bstride_0_nwvals = __pyx_bstruct_nwvals.strides[0]; + __pyx_bshape_0_nwvals = __pyx_bstruct_nwvals.shape[0]; + if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_14 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_nwvals)); + __pyx_v_nwvals = ((PyArrayObject *)__pyx_t_7); + __pyx_t_7 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":204 + * nvals = np.zeros( (total, self.nvals), dtype='float64') + * nwvals = np.zeros( total, dtype='float64') + * cdef np.int64_t curpos = 0 # <<<<<<<<<<<<<< + * cdef np.int64_t *pdata = npos.data + * cdef np.float64_t *vdata = nvals.data + */ + __pyx_v_curpos = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":205 + * nwvals = np.zeros( total, dtype='float64') + * cdef np.int64_t curpos = 0 + * cdef np.int64_t *pdata = npos.data # <<<<<<<<<<<<<< + * cdef np.float64_t *vdata = nvals.data + * cdef np.float64_t *wdata = nwvals.data + */ + __pyx_v_pdata = ((__pyx_t_5numpy_int64_t *)__pyx_v_npos->data); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":206 + * cdef np.int64_t curpos = 0 + * cdef np.int64_t *pdata = npos.data + * cdef np.float64_t *vdata = nvals.data # <<<<<<<<<<<<<< + * cdef np.float64_t *wdata = nwvals.data + * for i in range(self.top_grid_dims[0]): + */ + __pyx_v_vdata = ((__pyx_t_5numpy_float64_t *)__pyx_v_nvals->data); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":207 + * cdef np.int64_t *pdata = npos.data + * cdef np.float64_t *vdata = nvals.data + * cdef np.float64_t *wdata = nwvals.data # <<<<<<<<<<<<<< + * for i in range(self.top_grid_dims[0]): + * for j in range(self.top_grid_dims[1]): + */ + __pyx_v_wdata = ((__pyx_t_5numpy_float64_t *)__pyx_v_nwvals->data); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":208 + * cdef np.float64_t *vdata = nvals.data + * cdef np.float64_t *wdata = nwvals.data + * for i in range(self.top_grid_dims[0]): # <<<<<<<<<<<<<< + * for j in range(self.top_grid_dims[1]): + * curpos += self.fill_from_level(self.root_nodes[i][j], + */ + __pyx_t_2 = (((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->top_grid_dims[0]); + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":209 + * cdef np.float64_t *wdata = nwvals.data + * for i in range(self.top_grid_dims[0]): + * for j in range(self.top_grid_dims[1]): # <<<<<<<<<<<<<< + * curpos += self.fill_from_level(self.root_nodes[i][j], + * level, curpos, pdata, vdata, wdata) + */ + __pyx_t_4 = (((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->top_grid_dims[1]); + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_j = __pyx_t_5; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":211 + * for j in range(self.top_grid_dims[1]): + * curpos += self.fill_from_level(self.root_nodes[i][j], + * level, curpos, pdata, vdata, wdata) # <<<<<<<<<<<<<< + * return npos, nvals, nwvals + * + */ + __pyx_v_curpos += ((struct __pyx_vtabstruct_2yt_9amr_utils_QuadTree *)((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->__pyx_vtab)->fill_from_level(((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self), ((((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->root_nodes[__pyx_v_i])[__pyx_v_j]), __pyx_v_level, __pyx_v_curpos, __pyx_v_pdata, __pyx_v_vdata, __pyx_v_wdata); + } + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":212 + * curpos += self.fill_from_level(self.root_nodes[i][j], + * level, curpos, pdata, vdata, wdata) + * return npos, nvals, nwvals # <<<<<<<<<<<<<< + * + * cdef int count_at_level(self, QuadTreeNode *node, int level): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_INCREF(((PyObject *)__pyx_v_npos)); + PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_npos)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_npos)); + __Pyx_INCREF(((PyObject *)__pyx_v_nvals)); + PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_v_nvals)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_nvals)); + __Pyx_INCREF(((PyObject *)__pyx_v_nwvals)); + PyTuple_SET_ITEM(__pyx_t_7, 2, ((PyObject *)__pyx_v_nwvals)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_nwvals)); + __pyx_r = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_nwvals); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_nvals); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_npos); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("yt.amr_utils.QuadTree.get_all_from_level"); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_nwvals); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_nvals); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_npos); + __pyx_L2:; + __Pyx_DECREF(__pyx_v_vals); + __Pyx_DECREF((PyObject *)__pyx_v_npos); + __Pyx_DECREF((PyObject *)__pyx_v_nvals); + __Pyx_DECREF((PyObject *)__pyx_v_nwvals); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":214 + * return npos, nvals, nwvals + * + * cdef int count_at_level(self, QuadTreeNode *node, int level): # <<<<<<<<<<<<<< + * cdef int i, j + * # We only really return a non-zero, calculated value if we are at the + */ + +static int __pyx_f_2yt_9amr_utils_8QuadTree_count_at_level(struct __pyx_obj_2yt_9amr_utils_QuadTree *__pyx_v_self, struct __pyx_t_2yt_9amr_utils_QuadTreeNode *__pyx_v_node, int __pyx_v_level) { + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_count; + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + __Pyx_RefNannySetupContext("count_at_level"); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":218 + * # We only really return a non-zero, calculated value if we are at the + * # level in question. + * if node.level == level: # <<<<<<<<<<<<<< + * # We return 1 if there are no finer points at this level and zero + * # if there are + */ + __pyx_t_1 = (__pyx_v_node->level == __pyx_v_level); + if (__pyx_t_1) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":221 + * # We return 1 if there are no finer points at this level and zero + * # if there are + * return (node.children[0][0] == NULL) # <<<<<<<<<<<<<< + * if node.children[0][0] == NULL: return 0 + * cdef int count = 0 + */ + __pyx_r = (((__pyx_v_node->children[0])[0]) == NULL); + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":222 + * # if there are + * return (node.children[0][0] == NULL) + * if node.children[0][0] == NULL: return 0 # <<<<<<<<<<<<<< + * cdef int count = 0 + * for i in range(2): + */ + __pyx_t_1 = (((__pyx_v_node->children[0])[0]) == NULL); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":223 + * return (node.children[0][0] == NULL) + * if node.children[0][0] == NULL: return 0 + * cdef int count = 0 # <<<<<<<<<<<<<< + * for i in range(2): + * for j in range(2): + */ + __pyx_v_count = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":224 + * if node.children[0][0] == NULL: return 0 + * cdef int count = 0 + * for i in range(2): # <<<<<<<<<<<<<< + * for j in range(2): + * count += self.count_at_level(node.children[i][j], level) + */ + for (__pyx_t_2 = 0; __pyx_t_2 < 2; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":225 + * cdef int count = 0 + * for i in range(2): + * for j in range(2): # <<<<<<<<<<<<<< + * count += self.count_at_level(node.children[i][j], level) + * return count + */ + for (__pyx_t_3 = 0; __pyx_t_3 < 2; __pyx_t_3+=1) { + __pyx_v_j = __pyx_t_3; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":226 + * for i in range(2): + * for j in range(2): + * count += self.count_at_level(node.children[i][j], level) # <<<<<<<<<<<<<< + * return count + * + */ + __pyx_v_count += ((struct __pyx_vtabstruct_2yt_9amr_utils_QuadTree *)__pyx_v_self->__pyx_vtab)->count_at_level(__pyx_v_self, ((__pyx_v_node->children[__pyx_v_i])[__pyx_v_j]), __pyx_v_level); + } + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":227 + * for j in range(2): + * count += self.count_at_level(node.children[i][j], level) + * return count # <<<<<<<<<<<<<< + * + * cdef int fill_from_level(self, QuadTreeNode *node, int level, + */ + __pyx_r = __pyx_v_count; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":229 + * return count + * + * cdef int fill_from_level(self, QuadTreeNode *node, int level, # <<<<<<<<<<<<<< + * np.int64_t curpos, + * np.int64_t *pdata, + */ + +static int __pyx_f_2yt_9amr_utils_8QuadTree_fill_from_level(struct __pyx_obj_2yt_9amr_utils_QuadTree *__pyx_v_self, struct __pyx_t_2yt_9amr_utils_QuadTreeNode *__pyx_v_node, int __pyx_v_level, __pyx_t_5numpy_int64_t __pyx_v_curpos, __pyx_t_5numpy_int64_t *__pyx_v_pdata, __pyx_t_5numpy_float64_t *__pyx_v_vdata, __pyx_t_5numpy_float64_t *__pyx_v_wdata) { + int __pyx_v_i; + int __pyx_v_j; + __pyx_t_5numpy_int64_t __pyx_v_added; + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + __Pyx_RefNannySetupContext("fill_from_level"); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":235 + * np.float64_t *wdata): + * cdef int i, j + * if node.level == level: # <<<<<<<<<<<<<< + * if node.children[0][0] != NULL: return 0 + * for i in range(self.nvals): + */ + __pyx_t_1 = (__pyx_v_node->level == __pyx_v_level); + if (__pyx_t_1) { + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":236 + * cdef int i, j + * if node.level == level: + * if node.children[0][0] != NULL: return 0 # <<<<<<<<<<<<<< + * for i in range(self.nvals): + * vdata[self.nvals * curpos + i] = node.val[i] + */ + __pyx_t_1 = (((__pyx_v_node->children[0])[0]) != NULL); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":237 + * if node.level == level: + * if node.children[0][0] != NULL: return 0 + * for i in range(self.nvals): # <<<<<<<<<<<<<< + * vdata[self.nvals * curpos + i] = node.val[i] + * wdata[curpos] = node.weight_val + */ + __pyx_t_2 = __pyx_v_self->nvals; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":238 + * if node.children[0][0] != NULL: return 0 + * for i in range(self.nvals): + * vdata[self.nvals * curpos + i] = node.val[i] # <<<<<<<<<<<<<< + * wdata[curpos] = node.weight_val + * pdata[curpos * 2] = node.pos[0] + */ + (__pyx_v_vdata[((__pyx_v_self->nvals * __pyx_v_curpos) + __pyx_v_i)]) = (__pyx_v_node->val[__pyx_v_i]); + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":239 + * for i in range(self.nvals): + * vdata[self.nvals * curpos + i] = node.val[i] + * wdata[curpos] = node.weight_val # <<<<<<<<<<<<<< + * pdata[curpos * 2] = node.pos[0] + * pdata[curpos * 2 + 1] = node.pos[1] + */ + (__pyx_v_wdata[__pyx_v_curpos]) = __pyx_v_node->weight_val; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":240 + * vdata[self.nvals * curpos + i] = node.val[i] + * wdata[curpos] = node.weight_val + * pdata[curpos * 2] = node.pos[0] # <<<<<<<<<<<<<< + * pdata[curpos * 2 + 1] = node.pos[1] + * return 1 + */ + (__pyx_v_pdata[(__pyx_v_curpos * 2)]) = (__pyx_v_node->pos[0]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":241 + * wdata[curpos] = node.weight_val + * pdata[curpos * 2] = node.pos[0] + * pdata[curpos * 2 + 1] = node.pos[1] # <<<<<<<<<<<<<< + * return 1 + * if node.children[0][0] == NULL: return 0 + */ + (__pyx_v_pdata[((__pyx_v_curpos * 2) + 1)]) = (__pyx_v_node->pos[1]); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":242 + * pdata[curpos * 2] = node.pos[0] + * pdata[curpos * 2 + 1] = node.pos[1] + * return 1 # <<<<<<<<<<<<<< + * if node.children[0][0] == NULL: return 0 + * cdef np.int64_t added = 0 + */ + __pyx_r = 1; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":243 + * pdata[curpos * 2 + 1] = node.pos[1] + * return 1 + * if node.children[0][0] == NULL: return 0 # <<<<<<<<<<<<<< + * cdef np.int64_t added = 0 + * for i in range(2): + */ + __pyx_t_1 = (((__pyx_v_node->children[0])[0]) == NULL); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L7; + } + __pyx_L7:; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":244 + * return 1 + * if node.children[0][0] == NULL: return 0 + * cdef np.int64_t added = 0 # <<<<<<<<<<<<<< + * for i in range(2): + * for j in range(2): + */ + __pyx_v_added = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":245 + * if node.children[0][0] == NULL: return 0 + * cdef np.int64_t added = 0 + * for i in range(2): # <<<<<<<<<<<<<< + * for j in range(2): + * added += self.fill_from_level(node.children[i][j], + */ + for (__pyx_t_2 = 0; __pyx_t_2 < 2; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":246 + * cdef np.int64_t added = 0 + * for i in range(2): + * for j in range(2): # <<<<<<<<<<<<<< + * added += self.fill_from_level(node.children[i][j], + * level, curpos + added, pdata, vdata, wdata) + */ + for (__pyx_t_3 = 0; __pyx_t_3 < 2; __pyx_t_3+=1) { + __pyx_v_j = __pyx_t_3; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":248 + * for j in range(2): + * added += self.fill_from_level(node.children[i][j], + * level, curpos + added, pdata, vdata, wdata) # <<<<<<<<<<<<<< + * return added + * + */ + __pyx_v_added += ((struct __pyx_vtabstruct_2yt_9amr_utils_QuadTree *)__pyx_v_self->__pyx_vtab)->fill_from_level(__pyx_v_self, ((__pyx_v_node->children[__pyx_v_i])[__pyx_v_j]), __pyx_v_level, (__pyx_v_curpos + __pyx_v_added), __pyx_v_pdata, __pyx_v_vdata, __pyx_v_wdata); + } + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":249 + * added += self.fill_from_level(node.children[i][j], + * level, curpos + added, pdata, vdata, wdata) + * return added # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + __pyx_r = __pyx_v_added; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":251 + * return added + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * cdef int i, j + * for i in range(self.top_grid_dims[0]): + */ + +static void __pyx_pf_2yt_9amr_utils_8QuadTree___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pf_2yt_9amr_utils_8QuadTree___dealloc__(PyObject *__pyx_v_self) { + int __pyx_v_i; + int __pyx_v_j; + __pyx_t_5numpy_int64_t __pyx_t_1; + int __pyx_t_2; + __pyx_t_5numpy_int64_t __pyx_t_3; + int __pyx_t_4; + __Pyx_RefNannySetupContext("__dealloc__"); + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":253 + * def __dealloc__(self): + * cdef int i, j + * for i in range(self.top_grid_dims[0]): # <<<<<<<<<<<<<< + * for j in range(self.top_grid_dims[1]): + * QTN_free(self.root_nodes[i][j]) + */ + __pyx_t_1 = (((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->top_grid_dims[0]); + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":254 + * cdef int i, j + * for i in range(self.top_grid_dims[0]): + * for j in range(self.top_grid_dims[1]): # <<<<<<<<<<<<<< + * QTN_free(self.root_nodes[i][j]) + * free(self.root_nodes[i]) + */ + __pyx_t_3 = (((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->top_grid_dims[1]); + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_j = __pyx_t_4; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":255 + * for i in range(self.top_grid_dims[0]): + * for j in range(self.top_grid_dims[1]): + * QTN_free(self.root_nodes[i][j]) # <<<<<<<<<<<<<< + * free(self.root_nodes[i]) + * free(self.root_nodes) + */ + __pyx_f_2yt_9amr_utils_QTN_free(((((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->root_nodes[__pyx_v_i])[__pyx_v_j])); + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":256 + * for j in range(self.top_grid_dims[1]): + * QTN_free(self.root_nodes[i][j]) + * free(self.root_nodes[i]) # <<<<<<<<<<<<<< + * free(self.root_nodes) + */ + free((((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->root_nodes[__pyx_v_i])); + } + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":257 + * QTN_free(self.root_nodes[i][j]) + * free(self.root_nodes[i]) + * free(self.root_nodes) # <<<<<<<<<<<<<< + */ + free(((struct __pyx_obj_2yt_9amr_utils_QuadTree *)__pyx_v_self)->root_nodes); + + __Pyx_RefNannyFinishContext(); +} + +/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":188 + * # experimental exception made for __getbuffer__ and __releasebuffer__ + * # -- the details of this may change. + * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< + * # This implementation of getbuffer is geared towards Cython + * # requirements, and does not yet fullfill the PEP. + */ + +static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_v_copy_shape; + int __pyx_v_i; + int __pyx_v_ndim; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + int __pyx_v_t; + char *__pyx_v_f; + PyArray_Descr *__pyx_v_descr = 0; + int __pyx_v_offset; + int __pyx_v_hasfields; + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + char *__pyx_t_9; + __Pyx_RefNannySetupContext("__getbuffer__"); + if (__pyx_v_info == NULL) return 0; + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":194 + * # of flags + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + */ + __pyx_v_endian_detector = 1; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":195 + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * + * ndim = PyArray_NDIM(self) + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":197 + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":199 + * ndim = PyArray_NDIM(self) + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * copy_shape = 1 + * else: + */ + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":200 + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * copy_shape = 1 # <<<<<<<<<<<<<< + * else: + * copy_shape = 0 + */ + __pyx_v_copy_shape = 1; + goto __pyx_L5; + } + /*else*/ { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":202 + * copy_shape = 1 + * else: + * copy_shape = 0 # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + */ + __pyx_v_copy_shape = 0; + } + __pyx_L5:; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":204 + * copy_shape = 0 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") + */ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); + if (__pyx_t_1) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":205 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not C contiguous") + * + */ + __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":206 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_7)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_7)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[10]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":208 + * raise ValueError(u"ndarray is not C contiguous") + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") + */ + __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); + if (__pyx_t_3) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":209 + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not Fortran contiguous") + * + */ + __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = __pyx_t_3; + } + if (__pyx_t_2) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":210 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_8)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8)); + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[10]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":212 + * raise ValueError(u"ndarray is not Fortran contiguous") + * + * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< + * info.ndim = ndim + * if copy_shape: + */ + __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":213 + * + * info.buf = PyArray_DATA(self) + * info.ndim = ndim # <<<<<<<<<<<<<< + * if copy_shape: + * # Allocate new buffer for strides and shape info. This is allocated + */ + __pyx_v_info->ndim = __pyx_v_ndim; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":214 + * info.buf = PyArray_DATA(self) + * info.ndim = ndim + * if copy_shape: # <<<<<<<<<<<<<< + * # Allocate new buffer for strides and shape info. This is allocated + * # as one block, strides first. + */ + if (__pyx_v_copy_shape) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":217 + * # Allocate new buffer for strides and shape info. This is allocated + * # as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< + * info.shape = info.strides + ndim + * for i in range(ndim): + */ + __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2))); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":218 + * # as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + * info.shape = info.strides + ndim # <<<<<<<<<<<<<< + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] + */ + __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":219 + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + * info.shape = info.strides + ndim + * for i in range(ndim): # <<<<<<<<<<<<<< + * info.strides[i] = PyArray_STRIDES(self)[i] + * info.shape[i] = PyArray_DIMS(self)[i] + */ + __pyx_t_6 = __pyx_v_ndim; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":220 + * info.shape = info.strides + ndim + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< + * info.shape[i] = PyArray_DIMS(self)[i] + * else: + */ + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":221 + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] + * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< + * else: + * info.strides = PyArray_STRIDES(self) + */ + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + } + goto __pyx_L8; + } + /*else*/ { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":223 + * info.shape[i] = PyArray_DIMS(self)[i] + * else: + * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL + */ + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":224 + * else: + * info.strides = PyArray_STRIDES(self) + * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) + */ + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); + } + __pyx_L8:; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":225 + * info.strides = PyArray_STRIDES(self) + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * info.itemsize = PyArray_ITEMSIZE(self) + * info.readonly = not PyArray_ISWRITEABLE(self) + */ + __pyx_v_info->suboffsets = NULL; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":226 + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< + * info.readonly = not PyArray_ISWRITEABLE(self) + * + */ + __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":227 + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) + * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< + * + * cdef int t + */ + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":230 + * + * cdef int t + * cdef char* f = NULL # <<<<<<<<<<<<<< + * cdef dtype descr = self.descr + * cdef list stack + */ + __pyx_v_f = NULL; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":231 + * cdef int t + * cdef char* f = NULL + * cdef dtype descr = self.descr # <<<<<<<<<<<<<< + * cdef list stack + * cdef int offset + */ + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); + __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":235 + * cdef int offset + * + * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< + * + * if not hasfields and not copy_shape: + */ + __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":237 + * cdef bint hasfields = PyDataType_HASFIELDS(descr) + * + * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< + * # do not call releasebuffer + * info.obj = None + */ + __pyx_t_2 = (!__pyx_v_hasfields); + if (__pyx_t_2) { + __pyx_t_3 = (!__pyx_v_copy_shape); + __pyx_t_1 = __pyx_t_3; + } else { + __pyx_t_1 = __pyx_t_2; + } + if (__pyx_t_1) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":239 + * if not hasfields and not copy_shape: + * # do not call releasebuffer + * info.obj = None # <<<<<<<<<<<<<< + * else: + * # need to call releasebuffer + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = Py_None; + goto __pyx_L11; + } + /*else*/ { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":242 + * else: + * # need to call releasebuffer + * info.obj = self # <<<<<<<<<<<<<< + * + * if not hasfields: + */ + __Pyx_INCREF(__pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = __pyx_v_self; + } + __pyx_L11:; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":244 + * info.obj = self + * + * if not hasfields: # <<<<<<<<<<<<<< + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or + */ + __pyx_t_1 = (!__pyx_v_hasfields); + if (__pyx_t_1) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":245 + * + * if not hasfields: + * t = descr.type_num # <<<<<<<<<<<<<< + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + */ + __pyx_v_t = __pyx_v_descr->type_num; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":246 + * if not hasfields: + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_little_endian; + } else { + __pyx_t_2 = __pyx_t_1; + } + if (!__pyx_t_2) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":247 + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); + if (__pyx_t_1) { + __pyx_t_3 = (!__pyx_v_little_endian); + __pyx_t_8 = __pyx_t_3; + } else { + __pyx_t_8 = __pyx_t_1; + } + __pyx_t_1 = __pyx_t_8; + } else { + __pyx_t_1 = __pyx_t_2; + } + if (__pyx_t_1) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":248 + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_9)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_9)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[10]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L13; + } + __pyx_L13:; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":249 + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + */ + __pyx_t_1 = (__pyx_v_t == NPY_BYTE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__b; + goto __pyx_L14; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":250 + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" + */ + __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__B; + goto __pyx_L14; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":251 + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" + */ + __pyx_t_1 = (__pyx_v_t == NPY_SHORT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__h; + goto __pyx_L14; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":252 + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" + */ + __pyx_t_1 = (__pyx_v_t == NPY_USHORT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__H; + goto __pyx_L14; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":253 + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" + */ + __pyx_t_1 = (__pyx_v_t == NPY_INT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__i; + goto __pyx_L14; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":254 + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" + */ + __pyx_t_1 = (__pyx_v_t == NPY_UINT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__I; + goto __pyx_L14; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":255 + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" + */ + __pyx_t_1 = (__pyx_v_t == NPY_LONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__l; + goto __pyx_L14; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":256 + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" + */ + __pyx_t_1 = (__pyx_v_t == NPY_ULONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__L; + goto __pyx_L14; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":257 + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" + */ + __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__q; + goto __pyx_L14; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":258 + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" + */ + __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Q; + goto __pyx_L14; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":259 + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" + */ + __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__f; + goto __pyx_L14; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":260 + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" + */ + __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__d; + goto __pyx_L14; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":261 + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" + */ + __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__g; + goto __pyx_L14; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":262 + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + */ + __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zf; + goto __pyx_L14; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":263 + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" + */ + __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zd; + goto __pyx_L14; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":264 + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f = "O" + * else: + */ + __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zg; + goto __pyx_L14; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":265 + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__O; + goto __pyx_L14; + } + /*else*/ { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":267 + * elif t == NPY_OBJECT: f = "O" + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * info.format = f + * return + */ + __pyx_t_5 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_10), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[10]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L14:; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":268 + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * info.format = f # <<<<<<<<<<<<<< + * return + * else: + */ + __pyx_v_info->format = __pyx_v_f; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":269 + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * info.format = f + * return # <<<<<<<<<<<<<< + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L12; + } + /*else*/ { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":271 + * return + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< + * info.format[0] = '^' # Native data types, manual alignment + * offset = 0 + */ + __pyx_v_info->format = ((char *)malloc(255)); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":272 + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * offset = 0 + * f = _util_dtypestring(descr, info.format + 1, + */ + (__pyx_v_info->format[0]) = '^'; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":273 + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = '^' # Native data types, manual alignment + * offset = 0 # <<<<<<<<<<<<<< + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + */ + __pyx_v_offset = 0; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":276 + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + * &offset) # <<<<<<<<<<<<<< + * f[0] = 0 # Terminate format string + * + */ + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_9; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":277 + * info.format + _buffer_format_string_len, + * &offset) + * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * + * def __releasebuffer__(ndarray self, Py_buffer* info): + */ + (__pyx_v_f[0]) = 0; + } + __pyx_L12:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("numpy.ndarray.__getbuffer__"); + __pyx_r = -1; + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(Py_None); + __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; + } + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_descr); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":279 + * f[0] = 0 # Terminate format string + * + * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + */ + +static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + int __pyx_t_1; + __Pyx_RefNannySetupContext("__releasebuffer__"); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":280 + * + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); + if (__pyx_t_1) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":281 + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) # <<<<<<<<<<<<<< + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) + */ + free(__pyx_v_info->format); + goto __pyx_L5; + } + __pyx_L5:; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":282 + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * stdlib.free(info.strides) + * # info.shape was stored after info.strides in the same block + */ + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":283 + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) # <<<<<<<<<<<<<< + * # info.shape was stored after info.strides in the same block + * + */ + free(__pyx_v_info->strides); + goto __pyx_L6; + } + __pyx_L6:; + + __Pyx_RefNannyFinishContext(); +} + +/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":756 + * ctypedef npy_cdouble complex_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":757 + * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":759 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":760 + * + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":762 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":763 + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":765 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":766 + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":768 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":769 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":771 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< + * # Recursive utility function used in __getbuffer__ to get format + * # string. The new location in the format string is returned. + */ + +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { + PyArray_Descr *__pyx_v_child; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + PyObject *__pyx_v_fields; + PyObject *__pyx_v_childname; + PyObject *__pyx_v_new_offset; + PyObject *__pyx_v_t; + char *__pyx_r; + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + char *__pyx_t_10; + __Pyx_RefNannySetupContext("_util_dtypestring"); + __pyx_v_child = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_fields = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_childname = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_t = Py_None; __Pyx_INCREF(Py_None); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":778 + * cdef int delta_offset + * cdef tuple i + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * cdef tuple fields + */ + __pyx_v_endian_detector = 1; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":779 + * cdef tuple i + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * cdef tuple fields + * + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":782 + * cdef tuple fields + * + * for childname in descr.names: # <<<<<<<<<<<<<< + * fields = descr.fields[childname] + * child, new_offset = fields + */ + if (likely(((PyObject *)__pyx_v_descr->names) != Py_None)) { + __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_2); + } else { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[10]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + for (;;) { + if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; + __Pyx_DECREF(__pyx_v_childname); + __pyx_v_childname = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":783 + * + * for childname in descr.names: + * fields = descr.fields[childname] # <<<<<<<<<<<<<< + * child, new_offset = fields + * + */ + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_fields)); + __pyx_v_fields = ((PyObject *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":784 + * for childname in descr.names: + * fields = descr.fields[childname] + * child, new_offset = fields # <<<<<<<<<<<<<< + * + * if (end - f) - (new_offset - offset[0]) < 15: + */ + if (likely(((PyObject *)__pyx_v_fields) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_fields)) == 2)) { + PyObject* tuple = ((PyObject *)__pyx_v_fields); + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_new_offset); + __pyx_v_new_offset = __pyx_t_4; + __pyx_t_4 = 0; + } else { + __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); + {__pyx_filename = __pyx_f[10]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":786 + * child, new_offset = fields + * + * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + */ + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":787 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == '>' and little_endian) or + */ + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_11)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[10]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":789 + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_6 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_6) { + __pyx_t_7 = __pyx_v_little_endian; + } else { + __pyx_t_7 = __pyx_t_6; + } + if (!__pyx_t_7) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":790 + * + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * # One could encode it in the format string and have Cython + */ + __pyx_t_6 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_6) { + __pyx_t_8 = (!__pyx_v_little_endian); + __pyx_t_9 = __pyx_t_8; + } else { + __pyx_t_9 = __pyx_t_6; + } + __pyx_t_6 = __pyx_t_9; + } else { + __pyx_t_6 = __pyx_t_7; + } + if (__pyx_t_6) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":791 + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_9)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_9)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[10]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":801 + * + * # Output padding bytes + * while offset[0] < new_offset: # <<<<<<<<<<<<<< + * f[0] = 120 # "x"; pad byte + * f += 1 + */ + while (1) { + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_6) break; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":802 + * # Output padding bytes + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< + * f += 1 + * offset[0] += 1 + */ + (__pyx_v_f[0]) = 120; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":803 + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte + * f += 1 # <<<<<<<<<<<<<< + * offset[0] += 1 + * + */ + __pyx_v_f += 1; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":804 + * f[0] = 120 # "x"; pad byte + * f += 1 + * offset[0] += 1 # <<<<<<<<<<<<<< + * + * offset[0] += child.itemsize + */ + (__pyx_v_offset[0]) += 1; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":806 + * offset[0] += 1 + * + * offset[0] += child.itemsize # <<<<<<<<<<<<<< + * + * if not PyDataType_HASFIELDS(child): + */ + (__pyx_v_offset[0]) += __pyx_v_child->elsize; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":808 + * offset[0] += child.itemsize + * + * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< + * t = child.type_num + * if end - f < 5: + */ + __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_6) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":809 + * + * if not PyDataType_HASFIELDS(child): + * t = child.type_num # <<<<<<<<<<<<<< + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") + */ + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_t); + __pyx_v_t = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":810 + * if not PyDataType_HASFIELDS(child): + * t = child.type_num + * if end - f < 5: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short.") + * + */ + __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_6) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":811 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_12)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_12)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_12)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[10]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + __pyx_L10:; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":814 + * + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + */ + __pyx_t_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 98; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":815 + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + */ + __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 66; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":816 + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + */ + __pyx_t_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 104; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":817 + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + */ + __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 72; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":818 + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + */ + __pyx_t_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 105; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":819 + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + */ + __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 73; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":820 + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + */ + __pyx_t_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 108; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":821 + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + */ + __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 76; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":822 + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + */ + __pyx_t_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 113; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":823 + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + */ + __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 81; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":824 + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + */ + __pyx_t_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 102; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":825 + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + */ + __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 100; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":826 + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + */ + __pyx_t_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 103; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":827 + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + */ + __pyx_t_3 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 102; + __pyx_v_f += 1; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":828 + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" + */ + __pyx_t_5 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 100; + __pyx_v_f += 1; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":829 + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + */ + __pyx_t_3 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 103; + __pyx_v_f += 1; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":830 + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + __pyx_t_5 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 79; + goto __pyx_L11; + } + /*else*/ { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":832 + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * f += 1 + * else: + */ + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_10), __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[10]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L11:; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":833 + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * f += 1 # <<<<<<<<<<<<<< + * else: + * # Cython ignores struct boundary information ("T{...}"), + */ + __pyx_v_f += 1; + goto __pyx_L9; + } + /*else*/ { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":837 + * # Cython ignores struct boundary information ("T{...}"), + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< + * return f + * + */ + __pyx_t_10 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_10; + } + __pyx_L9:; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":838 + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) + * return f # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_f; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("numpy._util_dtypestring"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_child); + __Pyx_DECREF(__pyx_v_fields); + __Pyx_DECREF(__pyx_v_childname); + __Pyx_DECREF(__pyx_v_new_offset); + __Pyx_DECREF(__pyx_v_t); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":953 + * + * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * cdef PyObject* baseptr + * if base is None: + */ + +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + PyObject *__pyx_v_baseptr; + int __pyx_t_1; + __Pyx_RefNannySetupContext("set_array_base"); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":955 + * cdef inline void set_array_base(ndarray arr, object base): + * cdef PyObject* baseptr + * if base is None: # <<<<<<<<<<<<<< + * baseptr = NULL + * else: + */ + __pyx_t_1 = (__pyx_v_base == Py_None); + if (__pyx_t_1) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":956 + * cdef PyObject* baseptr + * if base is None: + * baseptr = NULL # <<<<<<<<<<<<<< + * else: + * Py_INCREF(base) # important to do this before decref below! + */ + __pyx_v_baseptr = NULL; + goto __pyx_L3; + } + /*else*/ { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":958 + * baseptr = NULL + * else: + * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< + * baseptr = base + * Py_XDECREF(arr.base) + */ + Py_INCREF(__pyx_v_base); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":959 + * else: + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base # <<<<<<<<<<<<<< + * Py_XDECREF(arr.base) + * arr.base = baseptr + */ + __pyx_v_baseptr = ((PyObject *)__pyx_v_base); + } + __pyx_L3:; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":960 + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base + * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< + * arr.base = baseptr + * + */ + Py_XDECREF(__pyx_v_arr->base); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":961 + * baseptr = base + * Py_XDECREF(arr.base) + * arr.base = baseptr # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): + */ + __pyx_v_arr->base = __pyx_v_baseptr; + + __Pyx_RefNannyFinishContext(); +} + +/* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":963 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base"); + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":964 + * + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: # <<<<<<<<<<<<<< + * return None + * else: + */ + __pyx_t_1 = (__pyx_v_arr->base == NULL); + if (__pyx_t_1) { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":965 + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: + * return None # <<<<<<<<<<<<<< + * else: + * return arr.base + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":967 + * return None + * else: + * return arr.base # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); + __pyx_r = ((PyObject *)__pyx_v_arr->base); + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_tp_new_2yt_9amr_utils_position(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + if (__pyx_pf_2yt_9amr_utils_8position___cinit__(o, __pyx_empty_tuple, NULL) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_2yt_9amr_utils_position(PyObject *o) { + (*Py_TYPE(o)->tp_free)(o); +} + +static PyObject *__pyx_getprop_2yt_9amr_utils_8position_output_pos(PyObject *o, void *x) { + return __pyx_pf_2yt_9amr_utils_8position_10output_pos___get__(o); +} + +static int __pyx_setprop_2yt_9amr_utils_8position_output_pos(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2yt_9amr_utils_8position_10output_pos___set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_2yt_9amr_utils_8position_refined_pos(PyObject *o, void *x) { + return __pyx_pf_2yt_9amr_utils_8position_11refined_pos___get__(o); +} + +static int __pyx_setprop_2yt_9amr_utils_8position_refined_pos(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2yt_9amr_utils_8position_11refined_pos___set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyMethodDef __pyx_methods_2yt_9amr_utils_position[] = { + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_2yt_9amr_utils_position[] = { + {(char *)"output_pos", __pyx_getprop_2yt_9amr_utils_8position_output_pos, __pyx_setprop_2yt_9amr_utils_8position_output_pos, 0, 0}, + {(char *)"refined_pos", __pyx_getprop_2yt_9amr_utils_8position_refined_pos, __pyx_setprop_2yt_9amr_utils_8position_refined_pos, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_position = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*reserved*/ + #else + 0, /*nb_long*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_position = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_position = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_position = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +PyTypeObject __pyx_type_2yt_9amr_utils_position = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("yt.amr_utils.position"), /*tp_name*/ + sizeof(struct __pyx_obj_2yt_9amr_utils_position), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2yt_9amr_utils_position, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*reserved*/ + #else + 0, /*tp_compare*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_position, /*tp_as_number*/ + &__pyx_tp_as_sequence_position, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_position, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_position, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2yt_9amr_utils_position, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_2yt_9amr_utils_position, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2yt_9amr_utils_position, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_2yt_9amr_utils_OctreeGrid(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2yt_9amr_utils_OctreeGrid *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)o); + p->child_indices = Py_None; Py_INCREF(Py_None); + p->fields = Py_None; Py_INCREF(Py_None); + p->left_edges = Py_None; Py_INCREF(Py_None); + p->dimensions = Py_None; Py_INCREF(Py_None); + p->dx = Py_None; Py_INCREF(Py_None); + if (__pyx_pf_2yt_9amr_utils_10OctreeGrid___cinit__(o, a, k) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_2yt_9amr_utils_OctreeGrid(PyObject *o) { + struct __pyx_obj_2yt_9amr_utils_OctreeGrid *p = (struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)o; + Py_XDECREF(p->child_indices); + Py_XDECREF(p->fields); + Py_XDECREF(p->left_edges); + Py_XDECREF(p->dimensions); + Py_XDECREF(p->dx); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_2yt_9amr_utils_OctreeGrid(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_2yt_9amr_utils_OctreeGrid *p = (struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)o; + if (p->child_indices) { + e = (*v)(p->child_indices, a); if (e) return e; + } + if (p->fields) { + e = (*v)(p->fields, a); if (e) return e; + } + if (p->left_edges) { + e = (*v)(p->left_edges, a); if (e) return e; + } + if (p->dimensions) { + e = (*v)(p->dimensions, a); if (e) return e; + } + if (p->dx) { + e = (*v)(p->dx, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_2yt_9amr_utils_OctreeGrid(PyObject *o) { + struct __pyx_obj_2yt_9amr_utils_OctreeGrid *p = (struct __pyx_obj_2yt_9amr_utils_OctreeGrid *)o; + PyObject* tmp; + tmp = ((PyObject*)p->child_indices); + p->child_indices = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->fields); + p->fields = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->left_edges); + p->left_edges = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->dimensions); + p->dimensions = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->dx); + p->dx = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_2yt_9amr_utils_10OctreeGrid_child_indices(PyObject *o, void *x) { + return __pyx_pf_2yt_9amr_utils_10OctreeGrid_13child_indices___get__(o); +} + +static int __pyx_setprop_2yt_9amr_utils_10OctreeGrid_child_indices(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2yt_9amr_utils_10OctreeGrid_13child_indices___set__(o, v); + } + else { + return __pyx_pf_2yt_9amr_utils_10OctreeGrid_13child_indices___del__(o); + } +} + +static PyObject *__pyx_getprop_2yt_9amr_utils_10OctreeGrid_fields(PyObject *o, void *x) { + return __pyx_pf_2yt_9amr_utils_10OctreeGrid_6fields___get__(o); +} + +static int __pyx_setprop_2yt_9amr_utils_10OctreeGrid_fields(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2yt_9amr_utils_10OctreeGrid_6fields___set__(o, v); + } + else { + return __pyx_pf_2yt_9amr_utils_10OctreeGrid_6fields___del__(o); + } +} + +static PyObject *__pyx_getprop_2yt_9amr_utils_10OctreeGrid_left_edges(PyObject *o, void *x) { + return __pyx_pf_2yt_9amr_utils_10OctreeGrid_10left_edges___get__(o); +} + +static int __pyx_setprop_2yt_9amr_utils_10OctreeGrid_left_edges(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2yt_9amr_utils_10OctreeGrid_10left_edges___set__(o, v); + } + else { + return __pyx_pf_2yt_9amr_utils_10OctreeGrid_10left_edges___del__(o); + } +} + +static PyObject *__pyx_getprop_2yt_9amr_utils_10OctreeGrid_dimensions(PyObject *o, void *x) { + return __pyx_pf_2yt_9amr_utils_10OctreeGrid_10dimensions___get__(o); +} + +static int __pyx_setprop_2yt_9amr_utils_10OctreeGrid_dimensions(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2yt_9amr_utils_10OctreeGrid_10dimensions___set__(o, v); + } + else { + return __pyx_pf_2yt_9amr_utils_10OctreeGrid_10dimensions___del__(o); + } +} + +static PyObject *__pyx_getprop_2yt_9amr_utils_10OctreeGrid_dx(PyObject *o, void *x) { + return __pyx_pf_2yt_9amr_utils_10OctreeGrid_2dx___get__(o); +} + +static int __pyx_setprop_2yt_9amr_utils_10OctreeGrid_dx(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2yt_9amr_utils_10OctreeGrid_2dx___set__(o, v); + } + else { + return __pyx_pf_2yt_9amr_utils_10OctreeGrid_2dx___del__(o); + } +} + +static PyObject *__pyx_getprop_2yt_9amr_utils_10OctreeGrid_level(PyObject *o, void *x) { + return __pyx_pf_2yt_9amr_utils_10OctreeGrid_5level___get__(o); +} + +static int __pyx_setprop_2yt_9amr_utils_10OctreeGrid_level(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2yt_9amr_utils_10OctreeGrid_5level___set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyMethodDef __pyx_methods_2yt_9amr_utils_OctreeGrid[] = { + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_2yt_9amr_utils_OctreeGrid[] = { + {(char *)"child_indices", __pyx_getprop_2yt_9amr_utils_10OctreeGrid_child_indices, __pyx_setprop_2yt_9amr_utils_10OctreeGrid_child_indices, 0, 0}, + {(char *)"fields", __pyx_getprop_2yt_9amr_utils_10OctreeGrid_fields, __pyx_setprop_2yt_9amr_utils_10OctreeGrid_fields, 0, 0}, + {(char *)"left_edges", __pyx_getprop_2yt_9amr_utils_10OctreeGrid_left_edges, __pyx_setprop_2yt_9amr_utils_10OctreeGrid_left_edges, 0, 0}, + {(char *)"dimensions", __pyx_getprop_2yt_9amr_utils_10OctreeGrid_dimensions, __pyx_setprop_2yt_9amr_utils_10OctreeGrid_dimensions, 0, 0}, + {(char *)"dx", __pyx_getprop_2yt_9amr_utils_10OctreeGrid_dx, __pyx_setprop_2yt_9amr_utils_10OctreeGrid_dx, 0, 0}, + {(char *)"level", __pyx_getprop_2yt_9amr_utils_10OctreeGrid_level, __pyx_setprop_2yt_9amr_utils_10OctreeGrid_level, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_OctreeGrid = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*reserved*/ + #else + 0, /*nb_long*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_OctreeGrid = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_OctreeGrid = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_OctreeGrid = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +PyTypeObject __pyx_type_2yt_9amr_utils_OctreeGrid = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("yt.amr_utils.OctreeGrid"), /*tp_name*/ + sizeof(struct __pyx_obj_2yt_9amr_utils_OctreeGrid), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2yt_9amr_utils_OctreeGrid, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*reserved*/ + #else + 0, /*tp_compare*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_OctreeGrid, /*tp_as_number*/ + &__pyx_tp_as_sequence_OctreeGrid, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_OctreeGrid, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_OctreeGrid, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_2yt_9amr_utils_OctreeGrid, /*tp_traverse*/ + __pyx_tp_clear_2yt_9amr_utils_OctreeGrid, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2yt_9amr_utils_OctreeGrid, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_2yt_9amr_utils_OctreeGrid, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2yt_9amr_utils_OctreeGrid, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_2yt_9amr_utils_OctreeGridList(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2yt_9amr_utils_OctreeGridList *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)o); + p->grids = Py_None; Py_INCREF(Py_None); + if (__pyx_pf_2yt_9amr_utils_14OctreeGridList___cinit__(o, a, k) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_2yt_9amr_utils_OctreeGridList(PyObject *o) { + struct __pyx_obj_2yt_9amr_utils_OctreeGridList *p = (struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)o; + Py_XDECREF(p->grids); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_2yt_9amr_utils_OctreeGridList(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_2yt_9amr_utils_OctreeGridList *p = (struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)o; + if (p->grids) { + e = (*v)(p->grids, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_2yt_9amr_utils_OctreeGridList(PyObject *o) { + struct __pyx_obj_2yt_9amr_utils_OctreeGridList *p = (struct __pyx_obj_2yt_9amr_utils_OctreeGridList *)o; + PyObject* tmp; + tmp = ((PyObject*)p->grids); + p->grids = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} +static PyObject *__pyx_sq_item_2yt_9amr_utils_OctreeGridList(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; +} + +static PyObject *__pyx_getprop_2yt_9amr_utils_14OctreeGridList_grids(PyObject *o, void *x) { + return __pyx_pf_2yt_9amr_utils_14OctreeGridList_5grids___get__(o); +} + +static int __pyx_setprop_2yt_9amr_utils_14OctreeGridList_grids(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2yt_9amr_utils_14OctreeGridList_5grids___set__(o, v); + } + else { + return __pyx_pf_2yt_9amr_utils_14OctreeGridList_5grids___del__(o); + } +} + +static PyMethodDef __pyx_methods_2yt_9amr_utils_OctreeGridList[] = { + {__Pyx_NAMESTR("__getitem__"), (PyCFunction)__pyx_pf_2yt_9amr_utils_14OctreeGridList___getitem__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_2yt_9amr_utils_OctreeGridList[] = { + {(char *)"grids", __pyx_getprop_2yt_9amr_utils_14OctreeGridList_grids, __pyx_setprop_2yt_9amr_utils_14OctreeGridList_grids, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_OctreeGridList = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*reserved*/ + #else + 0, /*nb_long*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_OctreeGridList = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_2yt_9amr_utils_OctreeGridList, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_OctreeGridList = { + 0, /*mp_length*/ + __pyx_pf_2yt_9amr_utils_14OctreeGridList___getitem__, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_OctreeGridList = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +PyTypeObject __pyx_type_2yt_9amr_utils_OctreeGridList = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("yt.amr_utils.OctreeGridList"), /*tp_name*/ + sizeof(struct __pyx_obj_2yt_9amr_utils_OctreeGridList), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2yt_9amr_utils_OctreeGridList, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*reserved*/ + #else + 0, /*tp_compare*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_OctreeGridList, /*tp_as_number*/ + &__pyx_tp_as_sequence_OctreeGridList, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_OctreeGridList, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_OctreeGridList, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_2yt_9amr_utils_OctreeGridList, /*tp_traverse*/ + __pyx_tp_clear_2yt_9amr_utils_OctreeGridList, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2yt_9amr_utils_OctreeGridList, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_2yt_9amr_utils_OctreeGridList, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2yt_9amr_utils_OctreeGridList, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_2yt_9amr_utils_VectorPlane __pyx_vtable_2yt_9amr_utils_VectorPlane; + +static PyObject *__pyx_tp_new_2yt_9amr_utils_VectorPlane(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2yt_9amr_utils_VectorPlane *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_2yt_9amr_utils_VectorPlane *)o); + p->__pyx_vtab = __pyx_vtabptr_2yt_9amr_utils_VectorPlane; + p->avp_pos = Py_None; Py_INCREF(Py_None); + p->avp_dir = Py_None; Py_INCREF(Py_None); + p->acenter = Py_None; Py_INCREF(Py_None); + p->aimage = Py_None; Py_INCREF(Py_None); + p->ax_vec = Py_None; Py_INCREF(Py_None); + p->ay_vec = Py_None; Py_INCREF(Py_None); + if (__pyx_pf_2yt_9amr_utils_11VectorPlane___cinit__(o, a, k) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_2yt_9amr_utils_VectorPlane(PyObject *o) { + struct __pyx_obj_2yt_9amr_utils_VectorPlane *p = (struct __pyx_obj_2yt_9amr_utils_VectorPlane *)o; + Py_XDECREF(p->avp_pos); + Py_XDECREF(p->avp_dir); + Py_XDECREF(p->acenter); + Py_XDECREF(p->aimage); + Py_XDECREF(p->ax_vec); + Py_XDECREF(p->ay_vec); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_2yt_9amr_utils_VectorPlane(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_2yt_9amr_utils_VectorPlane *p = (struct __pyx_obj_2yt_9amr_utils_VectorPlane *)o; + if (p->avp_pos) { + e = (*v)(p->avp_pos, a); if (e) return e; + } + if (p->avp_dir) { + e = (*v)(p->avp_dir, a); if (e) return e; + } + if (p->acenter) { + e = (*v)(p->acenter, a); if (e) return e; + } + if (p->aimage) { + e = (*v)(p->aimage, a); if (e) return e; + } + if (p->ax_vec) { + e = (*v)(p->ax_vec, a); if (e) return e; + } + if (p->ay_vec) { + e = (*v)(p->ay_vec, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_2yt_9amr_utils_VectorPlane(PyObject *o) { + struct __pyx_obj_2yt_9amr_utils_VectorPlane *p = (struct __pyx_obj_2yt_9amr_utils_VectorPlane *)o; + PyObject* tmp; + tmp = ((PyObject*)p->avp_pos); + p->avp_pos = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->avp_dir); + p->avp_dir = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->acenter); + p->acenter = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->aimage); + p->aimage = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->ax_vec); + p->ax_vec = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->ay_vec); + p->ay_vec = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_2yt_9amr_utils_11VectorPlane_avp_pos(PyObject *o, void *x) { + return __pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_pos___get__(o); +} + +static int __pyx_setprop_2yt_9amr_utils_11VectorPlane_avp_pos(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_pos___set__(o, v); + } + else { + return __pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_pos___del__(o); + } +} + +static PyObject *__pyx_getprop_2yt_9amr_utils_11VectorPlane_avp_dir(PyObject *o, void *x) { + return __pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_dir___get__(o); +} + +static int __pyx_setprop_2yt_9amr_utils_11VectorPlane_avp_dir(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_dir___set__(o, v); + } + else { + return __pyx_pf_2yt_9amr_utils_11VectorPlane_7avp_dir___del__(o); + } +} + +static PyObject *__pyx_getprop_2yt_9amr_utils_11VectorPlane_acenter(PyObject *o, void *x) { + return __pyx_pf_2yt_9amr_utils_11VectorPlane_7acenter___get__(o); +} + +static int __pyx_setprop_2yt_9amr_utils_11VectorPlane_acenter(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2yt_9amr_utils_11VectorPlane_7acenter___set__(o, v); + } + else { + return __pyx_pf_2yt_9amr_utils_11VectorPlane_7acenter___del__(o); + } +} + +static PyObject *__pyx_getprop_2yt_9amr_utils_11VectorPlane_aimage(PyObject *o, void *x) { + return __pyx_pf_2yt_9amr_utils_11VectorPlane_6aimage___get__(o); +} + +static int __pyx_setprop_2yt_9amr_utils_11VectorPlane_aimage(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2yt_9amr_utils_11VectorPlane_6aimage___set__(o, v); + } + else { + return __pyx_pf_2yt_9amr_utils_11VectorPlane_6aimage___del__(o); + } +} + +static PyObject *__pyx_getprop_2yt_9amr_utils_11VectorPlane_ax_vec(PyObject *o, void *x) { + return __pyx_pf_2yt_9amr_utils_11VectorPlane_6ax_vec___get__(o); +} + +static int __pyx_setprop_2yt_9amr_utils_11VectorPlane_ax_vec(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2yt_9amr_utils_11VectorPlane_6ax_vec___set__(o, v); + } + else { + return __pyx_pf_2yt_9amr_utils_11VectorPlane_6ax_vec___del__(o); + } +} + +static PyObject *__pyx_getprop_2yt_9amr_utils_11VectorPlane_ay_vec(PyObject *o, void *x) { + return __pyx_pf_2yt_9amr_utils_11VectorPlane_6ay_vec___get__(o); +} + +static int __pyx_setprop_2yt_9amr_utils_11VectorPlane_ay_vec(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2yt_9amr_utils_11VectorPlane_6ay_vec___set__(o, v); + } + else { + return __pyx_pf_2yt_9amr_utils_11VectorPlane_6ay_vec___del__(o); + } +} + +static PyMethodDef __pyx_methods_2yt_9amr_utils_VectorPlane[] = { + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_2yt_9amr_utils_VectorPlane[] = { + {(char *)"avp_pos", __pyx_getprop_2yt_9amr_utils_11VectorPlane_avp_pos, __pyx_setprop_2yt_9amr_utils_11VectorPlane_avp_pos, 0, 0}, + {(char *)"avp_dir", __pyx_getprop_2yt_9amr_utils_11VectorPlane_avp_dir, __pyx_setprop_2yt_9amr_utils_11VectorPlane_avp_dir, 0, 0}, + {(char *)"acenter", __pyx_getprop_2yt_9amr_utils_11VectorPlane_acenter, __pyx_setprop_2yt_9amr_utils_11VectorPlane_acenter, 0, 0}, + {(char *)"aimage", __pyx_getprop_2yt_9amr_utils_11VectorPlane_aimage, __pyx_setprop_2yt_9amr_utils_11VectorPlane_aimage, 0, 0}, + {(char *)"ax_vec", __pyx_getprop_2yt_9amr_utils_11VectorPlane_ax_vec, __pyx_setprop_2yt_9amr_utils_11VectorPlane_ax_vec, 0, 0}, + {(char *)"ay_vec", __pyx_getprop_2yt_9amr_utils_11VectorPlane_ay_vec, __pyx_setprop_2yt_9amr_utils_11VectorPlane_ay_vec, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_VectorPlane = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*reserved*/ + #else + 0, /*nb_long*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_VectorPlane = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_VectorPlane = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_VectorPlane = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +PyTypeObject __pyx_type_2yt_9amr_utils_VectorPlane = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("yt.amr_utils.VectorPlane"), /*tp_name*/ + sizeof(struct __pyx_obj_2yt_9amr_utils_VectorPlane), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2yt_9amr_utils_VectorPlane, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*reserved*/ + #else + 0, /*tp_compare*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_VectorPlane, /*tp_as_number*/ + &__pyx_tp_as_sequence_VectorPlane, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_VectorPlane, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_VectorPlane, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_2yt_9amr_utils_VectorPlane, /*tp_traverse*/ + __pyx_tp_clear_2yt_9amr_utils_VectorPlane, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2yt_9amr_utils_VectorPlane, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_2yt_9amr_utils_VectorPlane, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2yt_9amr_utils_VectorPlane, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_2yt_9amr_utils_TransferFunctionProxy __pyx_vtable_2yt_9amr_utils_TransferFunctionProxy; + +static PyObject *__pyx_tp_new_2yt_9amr_utils_TransferFunctionProxy(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)o); + p->__pyx_vtab = __pyx_vtabptr_2yt_9amr_utils_TransferFunctionProxy; + p->tf_obj = Py_None; Py_INCREF(Py_None); + p->my_field_tables = Py_None; Py_INCREF(Py_None); + if (__pyx_pf_2yt_9amr_utils_21TransferFunctionProxy___cinit__(o, a, k) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_2yt_9amr_utils_TransferFunctionProxy(PyObject *o) { + struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *p = (struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)o; + Py_XDECREF(p->tf_obj); + Py_XDECREF(p->my_field_tables); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_2yt_9amr_utils_TransferFunctionProxy(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *p = (struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)o; + if (p->tf_obj) { + e = (*v)(p->tf_obj, a); if (e) return e; + } + if (p->my_field_tables) { + e = (*v)(p->my_field_tables, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_2yt_9amr_utils_TransferFunctionProxy(PyObject *o) { + struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *p = (struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *)o; + PyObject* tmp; + tmp = ((PyObject*)p->tf_obj); + p->tf_obj = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->my_field_tables); + p->my_field_tables = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_2yt_9amr_utils_21TransferFunctionProxy_ns(PyObject *o, void *x) { + return __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_2ns___get__(o); +} + +static int __pyx_setprop_2yt_9amr_utils_21TransferFunctionProxy_ns(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_2ns___set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_2yt_9amr_utils_21TransferFunctionProxy_tf_obj(PyObject *o, void *x) { + return __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_6tf_obj___get__(o); +} + +static int __pyx_setprop_2yt_9amr_utils_21TransferFunctionProxy_tf_obj(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_6tf_obj___set__(o, v); + } + else { + return __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_6tf_obj___del__(o); + } +} + +static PyObject *__pyx_getprop_2yt_9amr_utils_21TransferFunctionProxy_my_field_tables(PyObject *o, void *x) { + return __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_15my_field_tables___get__(o); +} + +static int __pyx_setprop_2yt_9amr_utils_21TransferFunctionProxy_my_field_tables(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_15my_field_tables___set__(o, v); + } + else { + return __pyx_pf_2yt_9amr_utils_21TransferFunctionProxy_15my_field_tables___del__(o); + } +} + +static PyMethodDef __pyx_methods_2yt_9amr_utils_TransferFunctionProxy[] = { + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_2yt_9amr_utils_TransferFunctionProxy[] = { + {(char *)"ns", __pyx_getprop_2yt_9amr_utils_21TransferFunctionProxy_ns, __pyx_setprop_2yt_9amr_utils_21TransferFunctionProxy_ns, 0, 0}, + {(char *)"tf_obj", __pyx_getprop_2yt_9amr_utils_21TransferFunctionProxy_tf_obj, __pyx_setprop_2yt_9amr_utils_21TransferFunctionProxy_tf_obj, 0, 0}, + {(char *)"my_field_tables", __pyx_getprop_2yt_9amr_utils_21TransferFunctionProxy_my_field_tables, __pyx_setprop_2yt_9amr_utils_21TransferFunctionProxy_my_field_tables, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_TransferFunctionProxy = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*reserved*/ + #else + 0, /*nb_long*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_TransferFunctionProxy = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_TransferFunctionProxy = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_TransferFunctionProxy = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +PyTypeObject __pyx_type_2yt_9amr_utils_TransferFunctionProxy = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("yt.amr_utils.TransferFunctionProxy"), /*tp_name*/ + sizeof(struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2yt_9amr_utils_TransferFunctionProxy, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*reserved*/ + #else + 0, /*tp_compare*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_TransferFunctionProxy, /*tp_as_number*/ + &__pyx_tp_as_sequence_TransferFunctionProxy, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_TransferFunctionProxy, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_TransferFunctionProxy, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_2yt_9amr_utils_TransferFunctionProxy, /*tp_traverse*/ + __pyx_tp_clear_2yt_9amr_utils_TransferFunctionProxy, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2yt_9amr_utils_TransferFunctionProxy, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_2yt_9amr_utils_TransferFunctionProxy, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2yt_9amr_utils_TransferFunctionProxy, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_2yt_9amr_utils_PartitionedGrid __pyx_vtable_2yt_9amr_utils_PartitionedGrid; + +static PyObject *__pyx_tp_new_2yt_9amr_utils_PartitionedGrid(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)o); + p->__pyx_vtab = __pyx_vtabptr_2yt_9amr_utils_PartitionedGrid; + p->my_data = Py_None; Py_INCREF(Py_None); + p->LeftEdge = Py_None; Py_INCREF(Py_None); + p->RightEdge = Py_None; Py_INCREF(Py_None); + if (__pyx_pf_2yt_9amr_utils_15PartitionedGrid___cinit__(o, a, k) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_2yt_9amr_utils_PartitionedGrid(PyObject *o) { + struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *p = (struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)o; + Py_XDECREF(p->my_data); + Py_XDECREF(p->LeftEdge); + Py_XDECREF(p->RightEdge); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_2yt_9amr_utils_PartitionedGrid(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *p = (struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)o; + if (p->my_data) { + e = (*v)(p->my_data, a); if (e) return e; + } + if (p->LeftEdge) { + e = (*v)(p->LeftEdge, a); if (e) return e; + } + if (p->RightEdge) { + e = (*v)(p->RightEdge, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_2yt_9amr_utils_PartitionedGrid(PyObject *o) { + struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *p = (struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *)o; + PyObject* tmp; + tmp = ((PyObject*)p->my_data); + p->my_data = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->LeftEdge); + p->LeftEdge = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->RightEdge); + p->RightEdge = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_2yt_9amr_utils_15PartitionedGrid_my_data(PyObject *o, void *x) { + return __pyx_pf_2yt_9amr_utils_15PartitionedGrid_7my_data___get__(o); +} + +static int __pyx_setprop_2yt_9amr_utils_15PartitionedGrid_my_data(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2yt_9amr_utils_15PartitionedGrid_7my_data___set__(o, v); + } + else { + return __pyx_pf_2yt_9amr_utils_15PartitionedGrid_7my_data___del__(o); + } +} + +static PyObject *__pyx_getprop_2yt_9amr_utils_15PartitionedGrid_LeftEdge(PyObject *o, void *x) { + return __pyx_pf_2yt_9amr_utils_15PartitionedGrid_8LeftEdge___get__(o); +} + +static int __pyx_setprop_2yt_9amr_utils_15PartitionedGrid_LeftEdge(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2yt_9amr_utils_15PartitionedGrid_8LeftEdge___set__(o, v); + } + else { + return __pyx_pf_2yt_9amr_utils_15PartitionedGrid_8LeftEdge___del__(o); + } +} + +static PyObject *__pyx_getprop_2yt_9amr_utils_15PartitionedGrid_RightEdge(PyObject *o, void *x) { + return __pyx_pf_2yt_9amr_utils_15PartitionedGrid_9RightEdge___get__(o); +} + +static int __pyx_setprop_2yt_9amr_utils_15PartitionedGrid_RightEdge(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2yt_9amr_utils_15PartitionedGrid_9RightEdge___set__(o, v); + } + else { + return __pyx_pf_2yt_9amr_utils_15PartitionedGrid_9RightEdge___del__(o); + } +} + +static PyObject *__pyx_getprop_2yt_9amr_utils_15PartitionedGrid_parent_grid_id(PyObject *o, void *x) { + return __pyx_pf_2yt_9amr_utils_15PartitionedGrid_14parent_grid_id___get__(o); +} + +static int __pyx_setprop_2yt_9amr_utils_15PartitionedGrid_parent_grid_id(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2yt_9amr_utils_15PartitionedGrid_14parent_grid_id___set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_2yt_9amr_utils_15PartitionedGrid_n_fields(PyObject *o, void *x) { + return __pyx_pf_2yt_9amr_utils_15PartitionedGrid_8n_fields___get__(o); +} + +static int __pyx_setprop_2yt_9amr_utils_15PartitionedGrid_n_fields(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2yt_9amr_utils_15PartitionedGrid_8n_fields___set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyMethodDef __pyx_methods_2yt_9amr_utils_PartitionedGrid[] = { + {__Pyx_NAMESTR("cast_plane"), (PyCFunction)__pyx_pf_2yt_9amr_utils_15PartitionedGrid_cast_plane, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_2yt_9amr_utils_PartitionedGrid[] = { + {(char *)"my_data", __pyx_getprop_2yt_9amr_utils_15PartitionedGrid_my_data, __pyx_setprop_2yt_9amr_utils_15PartitionedGrid_my_data, 0, 0}, + {(char *)"LeftEdge", __pyx_getprop_2yt_9amr_utils_15PartitionedGrid_LeftEdge, __pyx_setprop_2yt_9amr_utils_15PartitionedGrid_LeftEdge, 0, 0}, + {(char *)"RightEdge", __pyx_getprop_2yt_9amr_utils_15PartitionedGrid_RightEdge, __pyx_setprop_2yt_9amr_utils_15PartitionedGrid_RightEdge, 0, 0}, + {(char *)"parent_grid_id", __pyx_getprop_2yt_9amr_utils_15PartitionedGrid_parent_grid_id, __pyx_setprop_2yt_9amr_utils_15PartitionedGrid_parent_grid_id, 0, 0}, + {(char *)"n_fields", __pyx_getprop_2yt_9amr_utils_15PartitionedGrid_n_fields, __pyx_setprop_2yt_9amr_utils_15PartitionedGrid_n_fields, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_PartitionedGrid = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*reserved*/ + #else + 0, /*nb_long*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_PartitionedGrid = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_PartitionedGrid = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_PartitionedGrid = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +PyTypeObject __pyx_type_2yt_9amr_utils_PartitionedGrid = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("yt.amr_utils.PartitionedGrid"), /*tp_name*/ + sizeof(struct __pyx_obj_2yt_9amr_utils_PartitionedGrid), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2yt_9amr_utils_PartitionedGrid, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*reserved*/ + #else + 0, /*tp_compare*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_PartitionedGrid, /*tp_as_number*/ + &__pyx_tp_as_sequence_PartitionedGrid, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_PartitionedGrid, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_PartitionedGrid, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_2yt_9amr_utils_PartitionedGrid, /*tp_traverse*/ + __pyx_tp_clear_2yt_9amr_utils_PartitionedGrid, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2yt_9amr_utils_PartitionedGrid, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_2yt_9amr_utils_PartitionedGrid, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2yt_9amr_utils_PartitionedGrid, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_2yt_9amr_utils_GridFace __pyx_vtable_2yt_9amr_utils_GridFace; + +static PyObject *__pyx_tp_new_2yt_9amr_utils_GridFace(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2yt_9amr_utils_GridFace *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_2yt_9amr_utils_GridFace *)o); + p->__pyx_vtab = __pyx_vtabptr_2yt_9amr_utils_GridFace; + return o; +} + +static void __pyx_tp_dealloc_2yt_9amr_utils_GridFace(PyObject *o) { + (*Py_TYPE(o)->tp_free)(o); +} + +static PyObject *__pyx_getprop_2yt_9amr_utils_8GridFace_coord(PyObject *o, void *x) { + return __pyx_pf_2yt_9amr_utils_8GridFace_5coord___get__(o); +} + +static int __pyx_setprop_2yt_9amr_utils_8GridFace_coord(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2yt_9amr_utils_8GridFace_5coord___set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyMethodDef __pyx_methods_2yt_9amr_utils_GridFace[] = { + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_2yt_9amr_utils_GridFace[] = { + {(char *)"coord", __pyx_getprop_2yt_9amr_utils_8GridFace_coord, __pyx_setprop_2yt_9amr_utils_8GridFace_coord, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_GridFace = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*reserved*/ + #else + 0, /*nb_long*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_GridFace = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_GridFace = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_GridFace = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +PyTypeObject __pyx_type_2yt_9amr_utils_GridFace = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("yt.amr_utils.GridFace"), /*tp_name*/ + sizeof(struct __pyx_obj_2yt_9amr_utils_GridFace), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2yt_9amr_utils_GridFace, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*reserved*/ + #else + 0, /*tp_compare*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_GridFace, /*tp_as_number*/ + &__pyx_tp_as_sequence_GridFace, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_GridFace, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_GridFace, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2yt_9amr_utils_GridFace, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_2yt_9amr_utils_GridFace, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_2yt_9amr_utils_8GridFace___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2yt_9amr_utils_GridFace, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_2yt_9amr_utils_ProtoPrism __pyx_vtable_2yt_9amr_utils_ProtoPrism; + +static PyObject *__pyx_tp_new_2yt_9amr_utils_ProtoPrism(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2yt_9amr_utils_ProtoPrism *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)o); + p->__pyx_vtab = __pyx_vtabptr_2yt_9amr_utils_ProtoPrism; + p->LeftEdge = Py_None; Py_INCREF(Py_None); + p->RightEdge = Py_None; Py_INCREF(Py_None); + p->subgrid_faces = Py_None; Py_INCREF(Py_None); + if (__pyx_pf_2yt_9amr_utils_10ProtoPrism___cinit__(o, a, k) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_2yt_9amr_utils_ProtoPrism(PyObject *o) { + struct __pyx_obj_2yt_9amr_utils_ProtoPrism *p = (struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)o; + Py_XDECREF(p->LeftEdge); + Py_XDECREF(p->RightEdge); + Py_XDECREF(p->subgrid_faces); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_2yt_9amr_utils_ProtoPrism(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_2yt_9amr_utils_ProtoPrism *p = (struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)o; + if (p->LeftEdge) { + e = (*v)(p->LeftEdge, a); if (e) return e; + } + if (p->RightEdge) { + e = (*v)(p->RightEdge, a); if (e) return e; + } + if (p->subgrid_faces) { + e = (*v)(p->subgrid_faces, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_2yt_9amr_utils_ProtoPrism(PyObject *o) { + struct __pyx_obj_2yt_9amr_utils_ProtoPrism *p = (struct __pyx_obj_2yt_9amr_utils_ProtoPrism *)o; + PyObject* tmp; + tmp = ((PyObject*)p->LeftEdge); + p->LeftEdge = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->RightEdge); + p->RightEdge = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->subgrid_faces); + p->subgrid_faces = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_2yt_9amr_utils_10ProtoPrism_LeftEdge(PyObject *o, void *x) { + return __pyx_pf_2yt_9amr_utils_10ProtoPrism_8LeftEdge___get__(o); +} + +static int __pyx_setprop_2yt_9amr_utils_10ProtoPrism_LeftEdge(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2yt_9amr_utils_10ProtoPrism_8LeftEdge___set__(o, v); + } + else { + return __pyx_pf_2yt_9amr_utils_10ProtoPrism_8LeftEdge___del__(o); + } +} + +static PyObject *__pyx_getprop_2yt_9amr_utils_10ProtoPrism_RightEdge(PyObject *o, void *x) { + return __pyx_pf_2yt_9amr_utils_10ProtoPrism_9RightEdge___get__(o); +} + +static int __pyx_setprop_2yt_9amr_utils_10ProtoPrism_RightEdge(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2yt_9amr_utils_10ProtoPrism_9RightEdge___set__(o, v); + } + else { + return __pyx_pf_2yt_9amr_utils_10ProtoPrism_9RightEdge___del__(o); + } +} + +static PyObject *__pyx_getprop_2yt_9amr_utils_10ProtoPrism_subgrid_faces(PyObject *o, void *x) { + return __pyx_pf_2yt_9amr_utils_10ProtoPrism_13subgrid_faces___get__(o); +} + +static int __pyx_setprop_2yt_9amr_utils_10ProtoPrism_subgrid_faces(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2yt_9amr_utils_10ProtoPrism_13subgrid_faces___set__(o, v); + } + else { + return __pyx_pf_2yt_9amr_utils_10ProtoPrism_13subgrid_faces___del__(o); + } +} + +static PyObject *__pyx_getprop_2yt_9amr_utils_10ProtoPrism_parent_grid_id(PyObject *o, void *x) { + return __pyx_pf_2yt_9amr_utils_10ProtoPrism_14parent_grid_id___get__(o); +} + +static int __pyx_setprop_2yt_9amr_utils_10ProtoPrism_parent_grid_id(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2yt_9amr_utils_10ProtoPrism_14parent_grid_id___set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyMethodDef __pyx_methods_2yt_9amr_utils_ProtoPrism[] = { + {__Pyx_NAMESTR("sweep"), (PyCFunction)__pyx_pf_2yt_9amr_utils_10ProtoPrism_sweep, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_brick"), (PyCFunction)__pyx_pf_2yt_9amr_utils_10ProtoPrism_get_brick, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_2yt_9amr_utils_ProtoPrism[] = { + {(char *)"LeftEdge", __pyx_getprop_2yt_9amr_utils_10ProtoPrism_LeftEdge, __pyx_setprop_2yt_9amr_utils_10ProtoPrism_LeftEdge, 0, 0}, + {(char *)"RightEdge", __pyx_getprop_2yt_9amr_utils_10ProtoPrism_RightEdge, __pyx_setprop_2yt_9amr_utils_10ProtoPrism_RightEdge, 0, 0}, + {(char *)"subgrid_faces", __pyx_getprop_2yt_9amr_utils_10ProtoPrism_subgrid_faces, __pyx_setprop_2yt_9amr_utils_10ProtoPrism_subgrid_faces, 0, 0}, + {(char *)"parent_grid_id", __pyx_getprop_2yt_9amr_utils_10ProtoPrism_parent_grid_id, __pyx_setprop_2yt_9amr_utils_10ProtoPrism_parent_grid_id, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_ProtoPrism = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*reserved*/ + #else + 0, /*nb_long*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_ProtoPrism = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_ProtoPrism = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_ProtoPrism = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +PyTypeObject __pyx_type_2yt_9amr_utils_ProtoPrism = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("yt.amr_utils.ProtoPrism"), /*tp_name*/ + sizeof(struct __pyx_obj_2yt_9amr_utils_ProtoPrism), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2yt_9amr_utils_ProtoPrism, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*reserved*/ + #else + 0, /*tp_compare*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_ProtoPrism, /*tp_as_number*/ + &__pyx_tp_as_sequence_ProtoPrism, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_ProtoPrism, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_ProtoPrism, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_2yt_9amr_utils_ProtoPrism, /*tp_traverse*/ + __pyx_tp_clear_2yt_9amr_utils_ProtoPrism, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2yt_9amr_utils_ProtoPrism, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_2yt_9amr_utils_ProtoPrism, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2yt_9amr_utils_ProtoPrism, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_2yt_9amr_utils_QuadTree __pyx_vtable_2yt_9amr_utils_QuadTree; + +static PyObject *__pyx_tp_new_2yt_9amr_utils_QuadTree(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2yt_9amr_utils_QuadTree *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_2yt_9amr_utils_QuadTree *)o); + p->__pyx_vtab = __pyx_vtabptr_2yt_9amr_utils_QuadTree; + if (__pyx_pf_2yt_9amr_utils_8QuadTree___cinit__(o, a, k) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_2yt_9amr_utils_QuadTree(PyObject *o) { + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pf_2yt_9amr_utils_8QuadTree___dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + (*Py_TYPE(o)->tp_free)(o); +} + +static PyMethodDef __pyx_methods_2yt_9amr_utils_QuadTree[] = { + {__Pyx_NAMESTR("add_array_to_tree"), (PyCFunction)__pyx_pf_2yt_9amr_utils_8QuadTree_add_array_to_tree, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("add_grid_to_tree"), (PyCFunction)__pyx_pf_2yt_9amr_utils_8QuadTree_add_grid_to_tree, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_all_from_level"), (PyCFunction)__pyx_pf_2yt_9amr_utils_8QuadTree_get_all_from_level, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_QuadTree = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*reserved*/ + #else + 0, /*nb_long*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX) + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_QuadTree = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_QuadTree = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_QuadTree = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +PyTypeObject __pyx_type_2yt_9amr_utils_QuadTree = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("yt.amr_utils.QuadTree"), /*tp_name*/ + sizeof(struct __pyx_obj_2yt_9amr_utils_QuadTree), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2yt_9amr_utils_QuadTree, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*reserved*/ + #else + 0, /*tp_compare*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_QuadTree, /*tp_as_number*/ + &__pyx_tp_as_sequence_QuadTree, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_QuadTree, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_QuadTree, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2yt_9amr_utils_QuadTree, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2yt_9amr_utils_QuadTree, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyMethodDef __pyx_methods[] = { + {__Pyx_NAMESTR("RecurseOctreeDepthFirst"), (PyCFunction)__pyx_pf_2yt_9amr_utils_RecurseOctreeDepthFirst, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("RecurseOctreeByLevels"), (PyCFunction)__pyx_pf_2yt_9amr_utils_RecurseOctreeByLevels, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("UnilinearlyInterpolate"), (PyCFunction)__pyx_pf_2yt_9amr_utils_UnilinearlyInterpolate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("BilinearlyInterpolate"), (PyCFunction)__pyx_pf_2yt_9amr_utils_BilinearlyInterpolate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("TrilinearlyInterpolate"), (PyCFunction)__pyx_pf_2yt_9amr_utils_TrilinearlyInterpolate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("planar_points_in_volume"), (PyCFunction)__pyx_pf_2yt_9amr_utils_planar_points_in_volume, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("grid_points_in_volume"), (PyCFunction)__pyx_pf_2yt_9amr_utils_grid_points_in_volume, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("find_grids_in_inclined_box"), (PyCFunction)__pyx_pf_2yt_9amr_utils_find_grids_in_inclined_box, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("Transfer3D"), (PyCFunction)__pyx_pf_2yt_9amr_utils_Transfer3D, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2yt_9amr_utils_Transfer3D)}, + {__Pyx_NAMESTR("TransferShells"), (PyCFunction)__pyx_pf_2yt_9amr_utils_TransferShells, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2yt_9amr_utils_TransferShells)}, + {__Pyx_NAMESTR("Transfer1D"), (PyCFunction)__pyx_pf_2yt_9amr_utils_Transfer1D, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("VoxelTraversal"), (PyCFunction)__pyx_pf_2yt_9amr_utils_VoxelTraversal, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("PlaneVoxelIntegration"), (PyCFunction)__pyx_pf_2yt_9amr_utils_PlaneVoxelIntegration, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("integrate_ray"), (PyCFunction)__pyx_pf_2yt_9amr_utils_integrate_ray, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("CICDeposit_3"), (PyCFunction)__pyx_pf_2yt_9amr_utils_CICDeposit_3, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("construct_boundary_relationships"), (PyCFunction)__pyx_pf_2yt_9amr_utils_construct_boundary_relationships, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("identify_field_neighbors"), (PyCFunction)__pyx_pf_2yt_9amr_utils_identify_field_neighbors, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("extract_identified_contours"), (PyCFunction)__pyx_pf_2yt_9amr_utils_extract_identified_contours, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("write_png"), (PyCFunction)__pyx_pf_2yt_9amr_utils_write_png, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("add_points_to_image"), (PyCFunction)__pyx_pf_2yt_9amr_utils_add_points_to_image, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("read_tiger_section"), (PyCFunction)__pyx_pf_2yt_9amr_utils_read_tiger_section, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("amr_utils"), + __Pyx_DOCSTR(__pyx_k_13), /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_n_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 1}, + {&__pyx_kp_u_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 1, 0, 0}, + {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0}, + {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0, 0}, + {&__pyx_kp_u_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 1, 0, 0}, + {&__pyx_kp_u_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 1, 0, 0}, + {&__pyx_n_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 1}, + {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, + {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, + {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0}, + {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0}, + {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, + {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0}, + {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0}, + {&__pyx_n_s__Channel, __pyx_k__Channel, sizeof(__pyx_k__Channel), 0, 0, 1, 1}, + {&__pyx_n_s__F, __pyx_k__F, sizeof(__pyx_k__F), 0, 0, 1, 1}, + {&__pyx_n_s__LeftEdge, __pyx_k__LeftEdge, sizeof(__pyx_k__LeftEdge), 0, 0, 1, 1}, + {&__pyx_n_s__RightEdge, __pyx_k__RightEdge, sizeof(__pyx_k__RightEdge), 0, 0, 1, 1}, + {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, + {&__pyx_n_s__Transfer3D, __pyx_k__Transfer3D, sizeof(__pyx_k__Transfer3D), 0, 0, 1, 1}, + {&__pyx_n_s__TransferShells, __pyx_k__TransferShells, sizeof(__pyx_k__TransferShells), 0, 0, 1, 1}, + {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s__a, __pyx_k__a, sizeof(__pyx_k__a), 0, 0, 1, 1}, + {&__pyx_n_s__acenter, __pyx_k__acenter, sizeof(__pyx_k__acenter), 0, 0, 1, 1}, + {&__pyx_n_s__add_to_position, __pyx_k__add_to_position, sizeof(__pyx_k__add_to_position), 0, 0, 1, 1}, + {&__pyx_n_s__aimage, __pyx_k__aimage, sizeof(__pyx_k__aimage), 0, 0, 1, 1}, + {&__pyx_n_s__alpha, __pyx_k__alpha, sizeof(__pyx_k__alpha), 0, 0, 1, 1}, + {&__pyx_n_s__avp_dir, __pyx_k__avp_dir, sizeof(__pyx_k__avp_dir), 0, 0, 1, 1}, + {&__pyx_n_s__avp_pos, __pyx_k__avp_pos, sizeof(__pyx_k__avp_pos), 0, 0, 1, 1}, + {&__pyx_n_s__ax_vec, __pyx_k__ax_vec, sizeof(__pyx_k__ax_vec), 0, 0, 1, 1}, + {&__pyx_n_s__ay_vec, __pyx_k__ay_vec, sizeof(__pyx_k__ay_vec), 0, 0, 1, 1}, + {&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1}, + {&__pyx_n_s__blue, __pyx_k__blue, sizeof(__pyx_k__blue), 0, 0, 1, 1}, + {&__pyx_n_s__bounds, __pyx_k__bounds, sizeof(__pyx_k__bounds), 0, 0, 1, 1}, + {&__pyx_n_s__box_center, __pyx_k__box_center, sizeof(__pyx_k__box_center), 0, 0, 1, 1}, + {&__pyx_n_s__box_lengths, __pyx_k__box_lengths, sizeof(__pyx_k__box_lengths), 0, 0, 1, 1}, + {&__pyx_n_s__box_origin, __pyx_k__box_origin, sizeof(__pyx_k__box_origin), 0, 0, 1, 1}, + {&__pyx_n_s__box_vectors, __pyx_k__box_vectors, sizeof(__pyx_k__box_vectors), 0, 0, 1, 1}, + {&__pyx_n_s__break_first, __pyx_k__break_first, sizeof(__pyx_k__break_first), 0, 0, 1, 1}, + {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1}, + {&__pyx_n_s__buffer, __pyx_k__buffer, sizeof(__pyx_k__buffer), 0, 0, 1, 1}, + {&__pyx_n_s__byteorder, __pyx_k__byteorder, sizeof(__pyx_k__byteorder), 0, 0, 1, 1}, + {&__pyx_n_s__calculate_extent, __pyx_k__calculate_extent, sizeof(__pyx_k__calculate_extent), 0, 0, 1, 1}, + {&__pyx_n_s__cellSize, __pyx_k__cellSize, sizeof(__pyx_k__cellSize), 0, 0, 1, 1}, + {&__pyx_n_s__center, __pyx_k__center, sizeof(__pyx_k__center), 0, 0, 1, 1}, + {&__pyx_n_s__child_indices, __pyx_k__child_indices, sizeof(__pyx_k__child_indices), 0, 0, 1, 1}, + {&__pyx_n_s__child_mask, __pyx_k__child_mask, sizeof(__pyx_k__child_mask), 0, 0, 1, 1}, + {&__pyx_n_s__children, __pyx_k__children, sizeof(__pyx_k__children), 0, 0, 1, 1}, + {&__pyx_n_s__cm, __pyx_k__cm, sizeof(__pyx_k__cm), 0, 0, 1, 1}, + {&__pyx_n_s__coord, __pyx_k__coord, sizeof(__pyx_k__coord), 0, 0, 1, 1}, + {&__pyx_n_s__copy, __pyx_k__copy, sizeof(__pyx_k__copy), 0, 0, 1, 1}, + {&__pyx_n_s__copy_back, __pyx_k__copy_back, sizeof(__pyx_k__copy_back), 0, 0, 1, 1}, + {&__pyx_n_s__copy_into, __pyx_k__copy_into, sizeof(__pyx_k__copy_into), 0, 0, 1, 1}, + {&__pyx_n_s__corners, __pyx_k__corners, sizeof(__pyx_k__corners), 0, 0, 1, 1}, + {&__pyx_n_s__count_at_level, __pyx_k__count_at_level, sizeof(__pyx_k__count_at_level), 0, 0, 1, 1}, + {&__pyx_n_s__count_only, __pyx_k__count_only, sizeof(__pyx_k__count_only), 0, 0, 1, 1}, + {&__pyx_n_s__curpos, __pyx_k__curpos, sizeof(__pyx_k__curpos), 0, 0, 1, 1}, + {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1}, + {&__pyx_n_s__dbin, __pyx_k__dbin, sizeof(__pyx_k__dbin), 0, 0, 1, 1}, + {&__pyx_n_s__dds, __pyx_k__dds, sizeof(__pyx_k__dds), 0, 0, 1, 1}, + {&__pyx_n_s__descr, __pyx_k__descr, sizeof(__pyx_k__descr), 0, 0, 1, 1}, + {&__pyx_n_s__dimensions, __pyx_k__dimensions, sizeof(__pyx_k__dimensions), 0, 0, 1, 1}, + {&__pyx_n_s__dims, __pyx_k__dims, sizeof(__pyx_k__dims), 0, 0, 1, 1}, + {&__pyx_n_s__direction, __pyx_k__direction, sizeof(__pyx_k__direction), 0, 0, 1, 1}, + {&__pyx_n_s__dpi, __pyx_k__dpi, sizeof(__pyx_k__dpi), 0, 0, 1, 1}, + {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, + {&__pyx_n_s__dvs, __pyx_k__dvs, sizeof(__pyx_k__dvs), 0, 0, 1, 1}, + {&__pyx_n_s__dx, __pyx_k__dx, sizeof(__pyx_k__dx), 0, 0, 1, 1}, + {&__pyx_n_s__dy, __pyx_k__dy, sizeof(__pyx_k__dy), 0, 0, 1, 1}, + {&__pyx_n_s__dz, __pyx_k__dz, sizeof(__pyx_k__dz), 0, 0, 1, 1}, + {&__pyx_n_s__e, __pyx_k__e, sizeof(__pyx_k__e), 0, 0, 1, 1}, + {&__pyx_n_s__empty, __pyx_k__empty, sizeof(__pyx_k__empty), 0, 0, 1, 1}, + {&__pyx_n_s__eval_transfer, __pyx_k__eval_transfer, sizeof(__pyx_k__eval_transfer), 0, 0, 1, 1}, + {&__pyx_n_s__field, __pyx_k__field, sizeof(__pyx_k__field), 0, 0, 1, 1}, + {&__pyx_n_s__field_id, __pyx_k__field_id, sizeof(__pyx_k__field_id), 0, 0, 1, 1}, + {&__pyx_n_s__field_ids, __pyx_k__field_ids, sizeof(__pyx_k__field_ids), 0, 0, 1, 1}, + {&__pyx_n_s__field_table_ids, __pyx_k__field_table_ids, sizeof(__pyx_k__field_table_ids), 0, 0, 1, 1}, + {&__pyx_n_s__field_tables, __pyx_k__field_tables, sizeof(__pyx_k__field_tables), 0, 0, 1, 1}, + {&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1}, + {&__pyx_n_s__filename, __pyx_k__filename, sizeof(__pyx_k__filename), 0, 0, 1, 1}, + {&__pyx_n_s__fill_from_level, __pyx_k__fill_from_level, sizeof(__pyx_k__fill_from_level), 0, 0, 1, 1}, + {&__pyx_n_s__find_on_root_level, __pyx_k__find_on_root_level, sizeof(__pyx_k__find_on_root_level), 0, 0, 1, 1}, + {&__pyx_n_s__float32, __pyx_k__float32, sizeof(__pyx_k__float32), 0, 0, 1, 1}, + {&__pyx_n_s__float64, __pyx_k__float64, sizeof(__pyx_k__float64), 0, 0, 1, 1}, + {&__pyx_n_s__floor, __pyx_k__floor, sizeof(__pyx_k__floor), 0, 0, 1, 1}, + {&__pyx_n_s__fn, __pyx_k__fn, sizeof(__pyx_k__fn), 0, 0, 1, 1}, + {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1}, + {&__pyx_n_s__genealogy, __pyx_k__genealogy, sizeof(__pyx_k__genealogy), 0, 0, 1, 1}, + {&__pyx_n_s__get_start_stop, __pyx_k__get_start_stop, sizeof(__pyx_k__get_start_stop), 0, 0, 1, 1}, + {&__pyx_n_s__gi, __pyx_k__gi, sizeof(__pyx_k__gi), 0, 0, 1, 1}, + {&__pyx_n_s__gray, __pyx_k__gray, sizeof(__pyx_k__gray), 0, 0, 1, 1}, + {&__pyx_n_s__green, __pyx_k__green, sizeof(__pyx_k__green), 0, 0, 1, 1}, + {&__pyx_n_s__grid, __pyx_k__grid, sizeof(__pyx_k__grid), 0, 0, 1, 1}, + {&__pyx_n_s__gridDimension, __pyx_k__gridDimension, sizeof(__pyx_k__gridDimension), 0, 0, 1, 1}, + {&__pyx_n_s__grid_dds, __pyx_k__grid_dds, sizeof(__pyx_k__grid_dds), 0, 0, 1, 1}, + {&__pyx_n_s__grid_dt, __pyx_k__grid_dt, sizeof(__pyx_k__grid_dt), 0, 0, 1, 1}, + {&__pyx_n_s__grid_left_edge, __pyx_k__grid_left_edge, sizeof(__pyx_k__grid_left_edge), 0, 0, 1, 1}, + {&__pyx_n_s__grid_left_edges, __pyx_k__grid_left_edges, sizeof(__pyx_k__grid_left_edges), 0, 0, 1, 1}, + {&__pyx_n_s__grid_mask, __pyx_k__grid_mask, sizeof(__pyx_k__grid_mask), 0, 0, 1, 1}, + {&__pyx_n_s__grid_right_edge, __pyx_k__grid_right_edge, sizeof(__pyx_k__grid_right_edge), 0, 0, 1, 1}, + {&__pyx_n_s__grid_right_edges, __pyx_k__grid_right_edges, sizeof(__pyx_k__grid_right_edges), 0, 0, 1, 1}, + {&__pyx_n_s__grid_t, __pyx_k__grid_t, sizeof(__pyx_k__grid_t), 0, 0, 1, 1}, + {&__pyx_n_s__grids, __pyx_k__grids, sizeof(__pyx_k__grids), 0, 0, 1, 1}, + {&__pyx_n_s__i_f, __pyx_k__i_f, sizeof(__pyx_k__i_f), 0, 0, 1, 1}, + {&__pyx_n_s__i_i, __pyx_k__i_i, sizeof(__pyx_k__i_i), 0, 0, 1, 1}, + {&__pyx_n_s__i_s, __pyx_k__i_s, sizeof(__pyx_k__i_s), 0, 0, 1, 1}, + {&__pyx_n_s__idbin, __pyx_k__idbin, sizeof(__pyx_k__idbin), 0, 0, 1, 1}, + {&__pyx_n_s__idds, __pyx_k__idds, sizeof(__pyx_k__idds), 0, 0, 1, 1}, + {&__pyx_n_s__im_strides, __pyx_k__im_strides, sizeof(__pyx_k__im_strides), 0, 0, 1, 1}, + {&__pyx_n_s__image, __pyx_k__image, sizeof(__pyx_k__image), 0, 0, 1, 1}, + {&__pyx_n_s__imax, __pyx_k__imax, sizeof(__pyx_k__imax), 0, 0, 1, 1}, + {&__pyx_n_s__imin, __pyx_k__imin, sizeof(__pyx_k__imin), 0, 0, 1, 1}, + {&__pyx_n_s__ind, __pyx_k__ind, sizeof(__pyx_k__ind), 0, 0, 1, 1}, + {&__pyx_n_s__int32, __pyx_k__int32, sizeof(__pyx_k__int32), 0, 0, 1, 1}, + {&__pyx_n_s__int64, __pyx_k__int64, sizeof(__pyx_k__int64), 0, 0, 1, 1}, + {&__pyx_n_s__int8, __pyx_k__int8, sizeof(__pyx_k__int8), 0, 0, 1, 1}, + {&__pyx_n_s__integrate_ray, __pyx_k__integrate_ray, sizeof(__pyx_k__integrate_ray), 0, 0, 1, 1}, + {&__pyx_n_s__istorage, __pyx_k__istorage, sizeof(__pyx_k__istorage), 0, 0, 1, 1}, + {&__pyx_n_s__istride, __pyx_k__istride, sizeof(__pyx_k__istride), 0, 0, 1, 1}, + {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1}, + {&__pyx_n_s__j_f, __pyx_k__j_f, sizeof(__pyx_k__j_f), 0, 0, 1, 1}, + {&__pyx_n_s__j_i, __pyx_k__j_i, sizeof(__pyx_k__j_i), 0, 0, 1, 1}, + {&__pyx_n_s__jmax, __pyx_k__jmax, sizeof(__pyx_k__jmax), 0, 0, 1, 1}, + {&__pyx_n_s__jmin, __pyx_k__jmin, sizeof(__pyx_k__jmin), 0, 0, 1, 1}, + {&__pyx_n_s__joins, __pyx_k__joins, sizeof(__pyx_k__joins), 0, 0, 1, 1}, + {&__pyx_n_s__jstride, __pyx_k__jstride, sizeof(__pyx_k__jstride), 0, 0, 1, 1}, + {&__pyx_n_s__k_f, __pyx_k__k_f, sizeof(__pyx_k__k_f), 0, 0, 1, 1}, + {&__pyx_n_s__k_i, __pyx_k__k_i, sizeof(__pyx_k__k_i), 0, 0, 1, 1}, + {&__pyx_n_s__kmax, __pyx_k__kmax, sizeof(__pyx_k__kmax), 0, 0, 1, 1}, + {&__pyx_n_s__kmin, __pyx_k__kmin, sizeof(__pyx_k__kmin), 0, 0, 1, 1}, + {&__pyx_n_s__left, __pyx_k__left, sizeof(__pyx_k__left), 0, 0, 1, 1}, + {&__pyx_n_s__leftEdge, __pyx_k__leftEdge, sizeof(__pyx_k__leftEdge), 0, 0, 1, 1}, + {&__pyx_n_s__left_edge, __pyx_k__left_edge, sizeof(__pyx_k__left_edge), 0, 0, 1, 1}, + {&__pyx_n_s__left_edges, __pyx_k__left_edges, sizeof(__pyx_k__left_edges), 0, 0, 1, 1}, + {&__pyx_n_s__level, __pyx_k__level, sizeof(__pyx_k__level), 0, 0, 1, 1}, + {&__pyx_n_s__mask, __pyx_k__mask, sizeof(__pyx_k__mask), 0, 0, 1, 1}, + {&__pyx_n_s__mass, __pyx_k__mass, sizeof(__pyx_k__mass), 0, 0, 1, 1}, + {&__pyx_n_s__max_ind, __pyx_k__max_ind, sizeof(__pyx_k__max_ind), 0, 0, 1, 1}, + {&__pyx_n_s__my_data, __pyx_k__my_data, sizeof(__pyx_k__my_data), 0, 0, 1, 1}, + {&__pyx_n_s__my_field_tables, __pyx_k__my_field_tables, sizeof(__pyx_k__my_field_tables), 0, 0, 1, 1}, + {&__pyx_n_s__n_field_tables, __pyx_k__n_field_tables, sizeof(__pyx_k__n_field_tables), 0, 0, 1, 1}, + {&__pyx_n_s__n_fields, __pyx_k__n_fields, sizeof(__pyx_k__n_fields), 0, 0, 1, 1}, + {&__pyx_n_s__names, __pyx_k__names, sizeof(__pyx_k__names), 0, 0, 1, 1}, + {&__pyx_n_s__nbins, __pyx_k__nbins, sizeof(__pyx_k__nbins), 0, 0, 1, 1}, + {&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1}, + {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, + {&__pyx_n_s__npositions, __pyx_k__npositions, sizeof(__pyx_k__npositions), 0, 0, 1, 1}, + {&__pyx_n_s__ns, __pyx_k__ns, sizeof(__pyx_k__ns), 0, 0, 1, 1}, + {&__pyx_n_s__nshells, __pyx_k__nshells, sizeof(__pyx_k__nshells), 0, 0, 1, 1}, + {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, + {&__pyx_n_s__nv, __pyx_k__nv, sizeof(__pyx_k__nv), 0, 0, 1, 1}, + {&__pyx_n_s__nvals, __pyx_k__nvals, sizeof(__pyx_k__nvals), 0, 0, 1, 1}, + {&__pyx_n_s__o_s, __pyx_k__o_s, sizeof(__pyx_k__o_s), 0, 0, 1, 1}, + {&__pyx_n_s__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1}, + {&__pyx_n_s__offset, __pyx_k__offset, sizeof(__pyx_k__offset), 0, 0, 1, 1}, + {&__pyx_n_s__order, __pyx_k__order, sizeof(__pyx_k__order), 0, 0, 1, 1}, + {&__pyx_n_s__output, __pyx_k__output, sizeof(__pyx_k__output), 0, 0, 1, 1}, + {&__pyx_n_s__output_pos, __pyx_k__output_pos, sizeof(__pyx_k__output_pos), 0, 0, 1, 1}, + {&__pyx_n_s__parent_grid_id, __pyx_k__parent_grid_id, sizeof(__pyx_k__parent_grid_id), 0, 0, 1, 1}, + {&__pyx_n_s__pass_through, __pyx_k__pass_through, sizeof(__pyx_k__pass_through), 0, 0, 1, 1}, + {&__pyx_n_s__pdx, __pyx_k__pdx, sizeof(__pyx_k__pdx), 0, 0, 1, 1}, + {&__pyx_n_s__pdy, __pyx_k__pdy, sizeof(__pyx_k__pdy), 0, 0, 1, 1}, + {&__pyx_n_s__pmask, __pyx_k__pmask, sizeof(__pyx_k__pmask), 0, 0, 1, 1}, + {&__pyx_n_s__po2, __pyx_k__po2, sizeof(__pyx_k__po2), 0, 0, 1, 1}, + {&__pyx_n_s__points, __pyx_k__points, sizeof(__pyx_k__points), 0, 0, 1, 1}, + {&__pyx_n_s__pos, __pyx_k__pos, sizeof(__pyx_k__pos), 0, 0, 1, 1}, + {&__pyx_n_s__posx, __pyx_k__posx, sizeof(__pyx_k__posx), 0, 0, 1, 1}, + {&__pyx_n_s__posy, __pyx_k__posy, sizeof(__pyx_k__posy), 0, 0, 1, 1}, + {&__pyx_n_s__posz, __pyx_k__posz, sizeof(__pyx_k__posz), 0, 0, 1, 1}, + {&__pyx_n_s__proj_overlap, __pyx_k__proj_overlap, sizeof(__pyx_k__proj_overlap), 0, 0, 1, 1}, + {&__pyx_n_s__pv, __pyx_k__pv, sizeof(__pyx_k__pv), 0, 0, 1, 1}, + {&__pyx_n_s__pvals, __pyx_k__pvals, sizeof(__pyx_k__pvals), 0, 0, 1, 1}, + {&__pyx_n_s__pweight_vals, __pyx_k__pweight_vals, sizeof(__pyx_k__pweight_vals), 0, 0, 1, 1}, + {&__pyx_n_s__px, __pyx_k__px, sizeof(__pyx_k__px), 0, 0, 1, 1}, + {&__pyx_n_s__pxs, __pyx_k__pxs, sizeof(__pyx_k__pxs), 0, 0, 1, 1}, + {&__pyx_n_s__py, __pyx_k__py, sizeof(__pyx_k__py), 0, 0, 1, 1}, + {&__pyx_n_s__pys, __pyx_k__pys, sizeof(__pyx_k__pys), 0, 0, 1, 1}, + {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, + {&__pyx_n_s__readonly, __pyx_k__readonly, sizeof(__pyx_k__readonly), 0, 0, 1, 1}, + {&__pyx_n_s__red, __pyx_k__red, sizeof(__pyx_k__red), 0, 0, 1, 1}, + {&__pyx_n_s__refined, __pyx_k__refined, sizeof(__pyx_k__refined), 0, 0, 1, 1}, + {&__pyx_n_s__refined_pos, __pyx_k__refined_pos, sizeof(__pyx_k__refined_pos), 0, 0, 1, 1}, + {&__pyx_n_s__right_edge, __pyx_k__right_edge, sizeof(__pyx_k__right_edge), 0, 0, 1, 1}, + {&__pyx_n_s__root_nodes, __pyx_k__root_nodes, sizeof(__pyx_k__root_nodes), 0, 0, 1, 1}, + {&__pyx_n_s__root_size, __pyx_k__root_size, sizeof(__pyx_k__root_size), 0, 0, 1, 1}, + {&__pyx_n_s__rot_mat, __pyx_k__rot_mat, sizeof(__pyx_k__rot_mat), 0, 0, 1, 1}, + {&__pyx_n_s__sample_values, __pyx_k__sample_values, sizeof(__pyx_k__sample_values), 0, 0, 1, 1}, + {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, + {&__pyx_n_s__shells, __pyx_k__shells, sizeof(__pyx_k__shells), 0, 0, 1, 1}, + {&__pyx_n_s__slab_size, __pyx_k__slab_size, sizeof(__pyx_k__slab_size), 0, 0, 1, 1}, + {&__pyx_n_s__slab_start, __pyx_k__slab_start, sizeof(__pyx_k__slab_start), 0, 0, 1, 1}, + {&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 0, 0, 1, 1}, + {&__pyx_n_s__stack, __pyx_k__stack, sizeof(__pyx_k__stack), 0, 0, 1, 1}, + {&__pyx_n_s__start_index, __pyx_k__start_index, sizeof(__pyx_k__start_index), 0, 0, 1, 1}, + {&__pyx_n_s__strides, __pyx_k__strides, sizeof(__pyx_k__strides), 0, 0, 1, 1}, + {&__pyx_n_s__subgrid_faces, __pyx_k__subgrid_faces, sizeof(__pyx_k__subgrid_faces), 0, 0, 1, 1}, + {&__pyx_n_s__suboffsets, __pyx_k__suboffsets, sizeof(__pyx_k__suboffsets), 0, 0, 1, 1}, + {&__pyx_n_s__sweep, __pyx_k__sweep, sizeof(__pyx_k__sweep), 0, 0, 1, 1}, + {&__pyx_n_s__table, __pyx_k__table, sizeof(__pyx_k__table), 0, 0, 1, 1}, + {&__pyx_n_s__tables, __pyx_k__tables, sizeof(__pyx_k__tables), 0, 0, 1, 1}, + {&__pyx_n_s__tf, __pyx_k__tf, sizeof(__pyx_k__tf), 0, 0, 1, 1}, + {&__pyx_n_s__tf_obj, __pyx_k__tf_obj, sizeof(__pyx_k__tf_obj), 0, 0, 1, 1}, + {&__pyx_n_s__top_grid_dims, __pyx_k__top_grid_dims, sizeof(__pyx_k__top_grid_dims), 0, 0, 1, 1}, + {&__pyx_n_s__type_num, __pyx_k__type_num, sizeof(__pyx_k__type_num), 0, 0, 1, 1}, + {&__pyx_n_s__u, __pyx_k__u, sizeof(__pyx_k__u), 0, 0, 1, 1}, + {&__pyx_n_s__ug, __pyx_k__ug, sizeof(__pyx_k__ug), 0, 0, 1, 1}, + {&__pyx_n_s__v, __pyx_k__v, sizeof(__pyx_k__v), 0, 0, 1, 1}, + {&__pyx_n_s__val, __pyx_k__val, sizeof(__pyx_k__val), 0, 0, 1, 1}, + {&__pyx_n_s__values, __pyx_k__values, sizeof(__pyx_k__values), 0, 0, 1, 1}, + {&__pyx_n_s__vd_strides, __pyx_k__vd_strides, sizeof(__pyx_k__vd_strides), 0, 0, 1, 1}, + {&__pyx_n_s__vp, __pyx_k__vp, sizeof(__pyx_k__vp), 0, 0, 1, 1}, + {&__pyx_n_s__vp_dir, __pyx_k__vp_dir, sizeof(__pyx_k__vp_dir), 0, 0, 1, 1}, + {&__pyx_n_s__vp_pos, __pyx_k__vp_pos, sizeof(__pyx_k__vp_pos), 0, 0, 1, 1}, + {&__pyx_n_s__vp_strides, __pyx_k__vp_strides, sizeof(__pyx_k__vp_strides), 0, 0, 1, 1}, + {&__pyx_n_s__weight_field_id, __pyx_k__weight_field_id, sizeof(__pyx_k__weight_field_id), 0, 0, 1, 1}, + {&__pyx_n_s__weight_field_ids, __pyx_k__weight_field_ids, sizeof(__pyx_k__weight_field_ids), 0, 0, 1, 1}, + {&__pyx_n_s__weight_table_id, __pyx_k__weight_table_id, sizeof(__pyx_k__weight_table_id), 0, 0, 1, 1}, + {&__pyx_n_s__weight_table_ids, __pyx_k__weight_table_ids, sizeof(__pyx_k__weight_table_ids), 0, 0, 1, 1}, + {&__pyx_n_s__weight_val, __pyx_k__weight_val, sizeof(__pyx_k__weight_val), 0, 0, 1, 1}, + {&__pyx_n_s__wvals, __pyx_k__wvals, sizeof(__pyx_k__wvals), 0, 0, 1, 1}, + {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1}, + {&__pyx_n_s__x_bins, __pyx_k__x_bins, sizeof(__pyx_k__x_bins), 0, 0, 1, 1}, + {&__pyx_n_s__x_bounds, __pyx_k__x_bounds, sizeof(__pyx_k__x_bounds), 0, 0, 1, 1}, + {&__pyx_n_s__x_is, __pyx_k__x_is, sizeof(__pyx_k__x_is), 0, 0, 1, 1}, + {&__pyx_n_s__x_vals, __pyx_k__x_vals, sizeof(__pyx_k__x_vals), 0, 0, 1, 1}, + {&__pyx_n_s__x_vec, __pyx_k__x_vec, sizeof(__pyx_k__x_vec), 0, 0, 1, 1}, + {&__pyx_n_s__xrange, __pyx_k__xrange, sizeof(__pyx_k__xrange), 0, 0, 1, 1}, + {&__pyx_n_s__y, __pyx_k__y, sizeof(__pyx_k__y), 0, 0, 1, 1}, + {&__pyx_n_s__y_bins, __pyx_k__y_bins, sizeof(__pyx_k__y_bins), 0, 0, 1, 1}, + {&__pyx_n_s__y_is, __pyx_k__y_is, sizeof(__pyx_k__y_is), 0, 0, 1, 1}, + {&__pyx_n_s__y_vals, __pyx_k__y_vals, sizeof(__pyx_k__y_vals), 0, 0, 1, 1}, + {&__pyx_n_s__y_vec, __pyx_k__y_vec, sizeof(__pyx_k__y_vec), 0, 0, 1, 1}, + {&__pyx_n_s__z, __pyx_k__z, sizeof(__pyx_k__z), 0, 0, 1, 1}, + {&__pyx_n_s__z_bins, __pyx_k__z_bins, sizeof(__pyx_k__z_bins), 0, 0, 1, 1}, + {&__pyx_n_s__z_is, __pyx_k__z_is, sizeof(__pyx_k__z_is), 0, 0, 1, 1}, + {&__pyx_n_s__z_vals, __pyx_k__z_vals, sizeof(__pyx_k__z_vals), 0, 0, 1, 1}, + {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION >= 3 + __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitGlobals(void) { + #if PY_VERSION_HEX < 0x02040000 + if (unlikely(__Pyx_Py23SetsImport() < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[11]; __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[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC initamr_utils(void); /*proto*/ +PyMODINIT_FUNC initamr_utils(void) +#else +PyMODINIT_FUNC PyInit_amr_utils(void); /*proto*/ +PyMODINIT_FUNC PyInit_amr_utils(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + #if CYTHON_REFNANNY + void* __pyx_refnanny = NULL; + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_amr_utils(void)", __LINE__, __FILE__); + #endif + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __pyx_binding_PyCFunctionType_USED + if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("amr_utils"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_13), 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_yt__amr_utils) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + if (PyType_Ready(&__pyx_type_2yt_9amr_utils_position) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "position", (PyObject *)&__pyx_type_2yt_9amr_utils_position) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2yt_9amr_utils_position = &__pyx_type_2yt_9amr_utils_position; + if (PyType_Ready(&__pyx_type_2yt_9amr_utils_OctreeGrid) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "OctreeGrid", (PyObject *)&__pyx_type_2yt_9amr_utils_OctreeGrid) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2yt_9amr_utils_OctreeGrid = &__pyx_type_2yt_9amr_utils_OctreeGrid; + if (PyType_Ready(&__pyx_type_2yt_9amr_utils_OctreeGridList) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "OctreeGridList", (PyObject *)&__pyx_type_2yt_9amr_utils_OctreeGridList) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2yt_9amr_utils_OctreeGridList = &__pyx_type_2yt_9amr_utils_OctreeGridList; + __pyx_vtabptr_2yt_9amr_utils_VectorPlane = &__pyx_vtable_2yt_9amr_utils_VectorPlane; + #if PY_MAJOR_VERSION >= 3 + __pyx_vtable_2yt_9amr_utils_VectorPlane.get_start_stop = (void (*)(struct __pyx_obj_2yt_9amr_utils_VectorPlane *, __pyx_t_5numpy_float64_t *, int *))__pyx_f_2yt_9amr_utils_11VectorPlane_get_start_stop; + __pyx_vtable_2yt_9amr_utils_VectorPlane.copy_into = (void (*)(struct __pyx_obj_2yt_9amr_utils_VectorPlane *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, int, int, int, int *))__pyx_f_2yt_9amr_utils_11VectorPlane_copy_into; + __pyx_vtable_2yt_9amr_utils_VectorPlane.copy_back = (void (*)(struct __pyx_obj_2yt_9amr_utils_VectorPlane *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, int, int, int, int *))__pyx_f_2yt_9amr_utils_11VectorPlane_copy_back; + #else + *(void(**)(void))&__pyx_vtable_2yt_9amr_utils_VectorPlane.get_start_stop = (void(*)(void))__pyx_f_2yt_9amr_utils_11VectorPlane_get_start_stop; + *(void(**)(void))&__pyx_vtable_2yt_9amr_utils_VectorPlane.copy_into = (void(*)(void))__pyx_f_2yt_9amr_utils_11VectorPlane_copy_into; + *(void(**)(void))&__pyx_vtable_2yt_9amr_utils_VectorPlane.copy_back = (void(*)(void))__pyx_f_2yt_9amr_utils_11VectorPlane_copy_back; + #endif + if (PyType_Ready(&__pyx_type_2yt_9amr_utils_VectorPlane) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_2yt_9amr_utils_VectorPlane.tp_dict, __pyx_vtabptr_2yt_9amr_utils_VectorPlane) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "VectorPlane", (PyObject *)&__pyx_type_2yt_9amr_utils_VectorPlane) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2yt_9amr_utils_VectorPlane = &__pyx_type_2yt_9amr_utils_VectorPlane; + __pyx_vtabptr_2yt_9amr_utils_TransferFunctionProxy = &__pyx_vtable_2yt_9amr_utils_TransferFunctionProxy; + #if PY_MAJOR_VERSION >= 3 + __pyx_vtable_2yt_9amr_utils_TransferFunctionProxy.eval_transfer = (void (*)(struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *))__pyx_f_2yt_9amr_utils_21TransferFunctionProxy_eval_transfer; + #else + *(void(**)(void))&__pyx_vtable_2yt_9amr_utils_TransferFunctionProxy.eval_transfer = (void(*)(void))__pyx_f_2yt_9amr_utils_21TransferFunctionProxy_eval_transfer; + #endif + if (PyType_Ready(&__pyx_type_2yt_9amr_utils_TransferFunctionProxy) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_2yt_9amr_utils_TransferFunctionProxy.tp_dict, __pyx_vtabptr_2yt_9amr_utils_TransferFunctionProxy) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "TransferFunctionProxy", (PyObject *)&__pyx_type_2yt_9amr_utils_TransferFunctionProxy) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2yt_9amr_utils_TransferFunctionProxy = &__pyx_type_2yt_9amr_utils_TransferFunctionProxy; + __pyx_vtabptr_2yt_9amr_utils_PartitionedGrid = &__pyx_vtable_2yt_9amr_utils_PartitionedGrid; + #if PY_MAJOR_VERSION >= 3 + __pyx_vtable_2yt_9amr_utils_PartitionedGrid.calculate_extent = (void (*)(struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *, struct __pyx_obj_2yt_9amr_utils_VectorPlane *, __pyx_t_5numpy_float64_t *))__pyx_f_2yt_9amr_utils_15PartitionedGrid_calculate_extent; + __pyx_vtable_2yt_9amr_utils_PartitionedGrid.integrate_ray = (int (*)(struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *))__pyx_f_2yt_9amr_utils_15PartitionedGrid_integrate_ray; + __pyx_vtable_2yt_9amr_utils_PartitionedGrid.sample_values = (void (*)(struct __pyx_obj_2yt_9amr_utils_PartitionedGrid *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, int *, __pyx_t_5numpy_float64_t *, struct __pyx_obj_2yt_9amr_utils_TransferFunctionProxy *))__pyx_f_2yt_9amr_utils_15PartitionedGrid_sample_values; + #else + *(void(**)(void))&__pyx_vtable_2yt_9amr_utils_PartitionedGrid.calculate_extent = (void(*)(void))__pyx_f_2yt_9amr_utils_15PartitionedGrid_calculate_extent; + *(void(**)(void))&__pyx_vtable_2yt_9amr_utils_PartitionedGrid.integrate_ray = (void(*)(void))__pyx_f_2yt_9amr_utils_15PartitionedGrid_integrate_ray; + *(void(**)(void))&__pyx_vtable_2yt_9amr_utils_PartitionedGrid.sample_values = (void(*)(void))__pyx_f_2yt_9amr_utils_15PartitionedGrid_sample_values; + #endif + if (PyType_Ready(&__pyx_type_2yt_9amr_utils_PartitionedGrid) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_2yt_9amr_utils_PartitionedGrid.tp_dict, __pyx_vtabptr_2yt_9amr_utils_PartitionedGrid) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "PartitionedGrid", (PyObject *)&__pyx_type_2yt_9amr_utils_PartitionedGrid) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2yt_9amr_utils_PartitionedGrid = &__pyx_type_2yt_9amr_utils_PartitionedGrid; + __pyx_vtabptr_2yt_9amr_utils_GridFace = &__pyx_vtable_2yt_9amr_utils_GridFace; + #if PY_MAJOR_VERSION >= 3 + __pyx_vtable_2yt_9amr_utils_GridFace.proj_overlap = (int (*)(struct __pyx_obj_2yt_9amr_utils_GridFace *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *))__pyx_f_2yt_9amr_utils_8GridFace_proj_overlap; + #else + *(void(**)(void))&__pyx_vtable_2yt_9amr_utils_GridFace.proj_overlap = (void(*)(void))__pyx_f_2yt_9amr_utils_8GridFace_proj_overlap; + #endif + if (PyType_Ready(&__pyx_type_2yt_9amr_utils_GridFace) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_2yt_9amr_utils_GridFace.tp_dict, __pyx_vtabptr_2yt_9amr_utils_GridFace) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "GridFace", (PyObject *)&__pyx_type_2yt_9amr_utils_GridFace) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2yt_9amr_utils_GridFace = &__pyx_type_2yt_9amr_utils_GridFace; + __pyx_vtabptr_2yt_9amr_utils_ProtoPrism = &__pyx_vtable_2yt_9amr_utils_ProtoPrism; + #if PY_MAJOR_VERSION >= 3 + __pyx_vtable_2yt_9amr_utils_ProtoPrism.split = (PyObject *(*)(struct __pyx_obj_2yt_9amr_utils_ProtoPrism *, __pyx_t_5numpy_float64_t *, int))__pyx_f_2yt_9amr_utils_10ProtoPrism_split; + #else + *(void(**)(void))&__pyx_vtable_2yt_9amr_utils_ProtoPrism.split = (void(*)(void))__pyx_f_2yt_9amr_utils_10ProtoPrism_split; + #endif + if (PyType_Ready(&__pyx_type_2yt_9amr_utils_ProtoPrism) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_2yt_9amr_utils_ProtoPrism.tp_dict, __pyx_vtabptr_2yt_9amr_utils_ProtoPrism) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "ProtoPrism", (PyObject *)&__pyx_type_2yt_9amr_utils_ProtoPrism) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2yt_9amr_utils_ProtoPrism = &__pyx_type_2yt_9amr_utils_ProtoPrism; + __pyx_vtabptr_2yt_9amr_utils_QuadTree = &__pyx_vtable_2yt_9amr_utils_QuadTree; + #if PY_MAJOR_VERSION >= 3 + __pyx_vtable_2yt_9amr_utils_QuadTree.add_to_position = (void (*)(struct __pyx_obj_2yt_9amr_utils_QuadTree *, int, __pyx_t_5numpy_int64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t))__pyx_f_2yt_9amr_utils_8QuadTree_add_to_position; + __pyx_vtable_2yt_9amr_utils_QuadTree.find_on_root_level = (struct __pyx_t_2yt_9amr_utils_QuadTreeNode *(*)(struct __pyx_obj_2yt_9amr_utils_QuadTree *, __pyx_t_5numpy_int64_t *, int))__pyx_f_2yt_9amr_utils_8QuadTree_find_on_root_level; + __pyx_vtable_2yt_9amr_utils_QuadTree.count_at_level = (int (*)(struct __pyx_obj_2yt_9amr_utils_QuadTree *, struct __pyx_t_2yt_9amr_utils_QuadTreeNode *, int))__pyx_f_2yt_9amr_utils_8QuadTree_count_at_level; + __pyx_vtable_2yt_9amr_utils_QuadTree.fill_from_level = (int (*)(struct __pyx_obj_2yt_9amr_utils_QuadTree *, struct __pyx_t_2yt_9amr_utils_QuadTreeNode *, int, __pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *))__pyx_f_2yt_9amr_utils_8QuadTree_fill_from_level; + #else + *(void(**)(void))&__pyx_vtable_2yt_9amr_utils_QuadTree.add_to_position = (void(*)(void))__pyx_f_2yt_9amr_utils_8QuadTree_add_to_position; + *(void(**)(void))&__pyx_vtable_2yt_9amr_utils_QuadTree.find_on_root_level = (void(*)(void))__pyx_f_2yt_9amr_utils_8QuadTree_find_on_root_level; + *(void(**)(void))&__pyx_vtable_2yt_9amr_utils_QuadTree.count_at_level = (void(*)(void))__pyx_f_2yt_9amr_utils_8QuadTree_count_at_level; + *(void(**)(void))&__pyx_vtable_2yt_9amr_utils_QuadTree.fill_from_level = (void(*)(void))__pyx_f_2yt_9amr_utils_8QuadTree_fill_from_level; + #endif + if (PyType_Ready(&__pyx_type_2yt_9amr_utils_QuadTree) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_2yt_9amr_utils_QuadTree.tp_dict, __pyx_vtabptr_2yt_9amr_utils_QuadTree) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "QuadTree", (PyObject *)&__pyx_type_2yt_9amr_utils_QuadTree) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2yt_9amr_utils_QuadTree = &__pyx_type_2yt_9amr_utils_QuadTree; + /*--- Type import code ---*/ + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "/Users/matthewturk/yt/yt/yt/amr_utils.pyx":32 + * + * # Set up some imports + * import numpy as np # <<<<<<<<<<<<<< + * cimport numpy as np + * cimport cython + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/DepthFirstOctree.pyx":26 + * """ + * + * import numpy as np # <<<<<<<<<<<<<< + * cimport numpy as np + * cimport cython + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/Interpolators.pyx":1 + * """ # <<<<<<<<<<<<<< + * Simple interpolators + * + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/PointsInVolume.pyx":27 + * + * + * import numpy as np # <<<<<<<<<<<<<< + * cimport numpy as np + * cimport cython + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/RayIntegrators.pyx":26 + * """ + * + * import numpy as np # <<<<<<<<<<<<<< + * cimport numpy as np + * cimport cython + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":1 + * """ # <<<<<<<<<<<<<< + * Simple integrators for the radiative transfer equation + * + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/ContourFinding.pyx":26 + * """ + * + * import numpy as np # <<<<<<<<<<<<<< + * cimport numpy as np + * cimport cython + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/png_writer.pyx":1 + * """ # <<<<<<<<<<<<<< + * A light interface to libpng + * + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/fortran_reader.pyx":26 + * """ + * + * import numpy as np # <<<<<<<<<<<<<< + * cimport numpy as np + * cimport cython + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/_amr_utils/QuadTree.pyx":27 + * + * + * import numpy as np # <<<<<<<<<<<<<< + * cimport numpy as np + * # Double up here for def'd functions + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/matthewturk/yt/yt/yt/amr_utils.pyx":1 + * """ # <<<<<<<<<<<<<< + * Container file to hold all our Cython routines. This is to avoid problems with + * static linking. + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__Transfer3D); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_14), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_GetAttr(__pyx_m, __pyx_n_s__TransferShells); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_15), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":963 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + if (__pyx_m) { + __Pyx_AddTraceback("init yt.amr_utils"); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init yt.amr_utils"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ + +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_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *number, *more_or_less; + + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + number = (num_expected == 1) ? "" : "s"; + PyErr_Format(PyExc_TypeError, + #if PY_VERSION_HEX < 0x02050000 + "%s() takes %s %d positional argument%s (%d given)", + #else + "%s() takes %s %zd positional argument%s (%zd given)", + #endif + func_name, more_or_less, num_expected, number, num_found); +} + +static CYTHON_INLINE 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_CheckExact(key)) && unlikely(!PyString_Check(key))) + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) + #endif + goto invalid_keyword_type; + } + if ((!kw_allowed) && unlikely(key)) + goto invalid_keyword; + return 1; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + return 0; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif + return 0; +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + /* unexpected keyword found */ + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact) +{ + if (!type) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (none_allowed && obj == Py_None) return 1; + else if (exact) { + if (Py_TYPE(obj) == type) return 1; + } + else { + if (PyObject_TypeCheck(obj, type)) return 1; + } + PyErr_Format(PyExc_TypeError, + "Argument '%s' has incorrect type (expected %s, got %s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); + return 0; +} + +static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { + unsigned int n = 1; + return *(unsigned char*)(&n) != 0; +} + +typedef struct { + __Pyx_StructField root; + __Pyx_BufFmt_StackElem* head; + size_t fmt_offset; + int new_count, enc_count; + int is_complex; + char enc_type; + char packmode; +} __Pyx_BufFmt_Context; + +static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, + __Pyx_BufFmt_StackElem* stack, + __Pyx_TypeInfo* type) { + stack[0].field = &ctx->root; + stack[0].parent_offset = 0; + ctx->root.type = type; + ctx->root.name = "buffer dtype"; + ctx->root.offset = 0; + ctx->head = stack; + ctx->head->field = &ctx->root; + ctx->fmt_offset = 0; + ctx->head->parent_offset = 0; + ctx->packmode = '@'; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ctx->is_complex = 0; + while (type->typegroup == 'S') { + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = 0; + type = type->fields->type; + } +} + +static int __Pyx_BufFmt_ParseNumber(const char** ts) { + int count; + const char* t = *ts; + if (*t < '0' || *t > '9') { + return -1; + } else { + count = *t++ - '0'; + while (*t >= '0' && *t < '9') { + count *= 10; + count += *t++ - '0'; + } + } + *ts = t; + return count; +} + +static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { + char msg[] = {ch, 0}; + PyErr_Format(PyExc_ValueError, "Unexpected format string character: '%s'", msg); +} + +static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { + switch (ch) { + case 'b': return "'char'"; + case 'B': return "'unsigned char'"; + case 'h': return "'short'"; + case 'H': return "'unsigned short'"; + case 'i': return "'int'"; + case 'I': return "'unsigned int'"; + case 'l': return "'long'"; + case 'L': return "'unsigned long'"; + case 'q': return "'long long'"; + case 'Q': return "'unsigned long long'"; + case 'f': return (is_complex ? "'complex float'" : "'float'"); + case 'd': return (is_complex ? "'complex double'" : "'double'"); + case 'g': return (is_complex ? "'complex long double'" : "'long double'"); + case 'T': return "a struct"; + case 'O': return "Python object"; + case 'P': return "a pointer"; + case 0: return "end"; + default: return "unparseable format string"; + } +} + +static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': return 1; + case 'h': case 'H': return 2; + case 'i': case 'I': case 'l': case 'L': return 4; + case 'q': case 'Q': return 8; + case 'f': return (is_complex ? 8 : 4); + case 'd': return (is_complex ? 16 : 8); + case 'g': { + PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); + return 0; + } + case 'O': case 'P': return sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} + +static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { + switch (ch) { + case 'c': case 'b': case 'B': return 1; + case 'h': case 'H': return sizeof(short); + case 'i': case 'I': return sizeof(int); + case 'l': case 'L': return sizeof(long); + #ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(PY_LONG_LONG); + #endif + case 'f': return sizeof(float) * (is_complex ? 2 : 1); + case 'd': return sizeof(double) * (is_complex ? 2 : 1); + case 'g': return sizeof(long double) * (is_complex ? 2 : 1); + case 'O': case 'P': return sizeof(void*); + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } + } +} + +typedef struct { char c; short x; } __Pyx_st_short; +typedef struct { char c; int x; } __Pyx_st_int; +typedef struct { char c; long x; } __Pyx_st_long; +typedef struct { char c; float x; } __Pyx_st_float; +typedef struct { char c; double x; } __Pyx_st_double; +typedef struct { char c; long double x; } __Pyx_st_longdouble; +typedef struct { char c; void *x; } __Pyx_st_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { char c; PY_LONG_LONG x; } __Pyx_s_long_long; +#endif + +static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': return 1; + case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_s_long_long) - sizeof(PY_LONG_LONG); +#endif + case 'f': return sizeof(__Pyx_st_float) - sizeof(float); + case 'd': return sizeof(__Pyx_st_double) - sizeof(double); + case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} + +static size_t __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { + switch (ch) { + case 'c': case 'b': case 'h': case 'i': case 'l': case 'q': return 'I'; + case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U'; + case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R'); + case 'O': return 'O'; + case 'P': return 'P'; + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } + } +} + +static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { + if (ctx->head == NULL || ctx->head->field == &ctx->root) { + const char* expected; + const char* quote; + if (ctx->head == NULL) { + expected = "end"; + quote = ""; + } else { + expected = ctx->head->field->type->name; + quote = "'"; + } + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected %s%s%s but got %s", + quote, expected, quote, + __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); + } else { + __Pyx_StructField* field = ctx->head->field; + __Pyx_StructField* parent = (ctx->head - 1)->field; + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", + field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), + parent->type->name, field->name); + } +} + +static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { + char group; + size_t size, offset; + if (ctx->enc_type == 0) return 0; + group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); + do { + __Pyx_StructField* field = ctx->head->field; + __Pyx_TypeInfo* type = field->type; + + if (ctx->packmode == '@' || ctx->packmode == '^') { + size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); + } else { + size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); + } + if (ctx->packmode == '@') { + int align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); + int align_mod_offset; + if (align_at == 0) return -1; + align_mod_offset = ctx->fmt_offset % align_at; + if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; + } + + if (type->size != size || type->typegroup != group) { + if (type->typegroup == 'C' && type->fields != NULL) { + /* special case -- treat as struct rather than complex number */ + size_t parent_offset = ctx->head->parent_offset + field->offset; + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = parent_offset; + continue; + } + + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } + + offset = ctx->head->parent_offset + field->offset; + if (ctx->fmt_offset != offset) { + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch; next field is at offset %"PY_FORMAT_SIZE_T"d " + "but %"PY_FORMAT_SIZE_T"d expected", ctx->fmt_offset, offset); + return -1; + } + + ctx->fmt_offset += size; + + --ctx->enc_count; /* Consume from buffer string */ + + /* Done checking, move to next field, pushing or popping struct stack if needed */ + while (1) { + if (field == &ctx->root) { + ctx->head = NULL; + if (ctx->enc_count != 0) { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } + break; /* breaks both loops as ctx->enc_count == 0 */ + } + ctx->head->field = ++field; + if (field->type == NULL) { + --ctx->head; + field = ctx->head->field; + continue; + } else if (field->type->typegroup == 'S') { + size_t parent_offset = ctx->head->parent_offset + field->offset; + if (field->type->fields->type == NULL) continue; /* empty struct */ + field = field->type->fields; + ++ctx->head; + ctx->head->field = field; + ctx->head->parent_offset = parent_offset; + break; + } else { + break; + } + } + } while (ctx->enc_count); + ctx->enc_type = 0; + ctx->is_complex = 0; + return 0; +} + +static int __Pyx_BufFmt_FirstPack(__Pyx_BufFmt_Context* ctx) { + if (ctx->enc_type != 0 || ctx->packmode != '@') { + PyErr_SetString(PyExc_ValueError, "Buffer packing mode currently only allowed at beginning of format string (this is a defect)"); + return -1; + } + return 0; +} + +static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { + int got_Z = 0; + while (1) { + switch(*ts) { + case 0: + if (ctx->enc_type != 0 && ctx->head == NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + if (ctx->head != NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + return ts; + case ' ': + case 10: + case 13: + ++ts; + break; + case '<': + if (!__Pyx_IsLittleEndian()) { + PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); + return NULL; + } + if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL; + ctx->packmode = '='; + ++ts; + break; + case '>': + case '!': + if (__Pyx_IsLittleEndian()) { + PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); + return NULL; + } + if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL; + ctx->packmode = '='; + ++ts; + break; + case '=': + case '@': + case '^': + if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL; + ctx->packmode = *ts++; + break; + case 'T': /* substruct */ + { + int i; + const char* ts_after_sub; + int struct_count = ctx->new_count; + ctx->new_count = 1; + ++ts; + if (*ts != '{') { + PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); + return NULL; + } + ++ts; + ts_after_sub = ts; + for (i = 0; i != struct_count; ++i) { + ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); + if (!ts_after_sub) return NULL; + } + ts = ts_after_sub; + } + break; + case '}': /* end of substruct; either repeat or move on */ + ++ts; + return ts; + case 'x': + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->fmt_offset += ctx->new_count; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ++ts; + break; + case 'Z': + got_Z = 1; + ++ts; + if (*ts != 'f' && *ts != 'd' && *ts != 'g') { + __Pyx_BufFmt_RaiseUnexpectedChar('Z'); + return NULL; + } /* fall through */ + case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': + case 'l': case 'L': case 'q': case 'Q': + case 'f': case 'd': case 'g': + case 'O': + if (ctx->enc_type == *ts && got_Z == ctx->is_complex) { + /* Continue pooling same type */ + ctx->enc_count += ctx->new_count; + } else { + /* New type */ + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_count = ctx->new_count; + ctx->enc_type = *ts; + ctx->is_complex = got_Z; + } + ++ts; + ctx->new_count = 1; + got_Z = 0; + break; + default: + { + ctx->new_count = __Pyx_BufFmt_ParseNumber(&ts); + if (ctx->new_count == -1) { /* First char was not a digit */ + char msg[2] = { *ts, 0 }; + PyErr_Format(PyExc_ValueError, + "Does not understand character buffer dtype format string ('%s')", msg); + return NULL; + } + } + + } + } +} + +static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { + buf->buf = NULL; + buf->obj = NULL; + buf->strides = __Pyx_zeros; + buf->shape = __Pyx_zeros; + buf->suboffsets = __Pyx_minusones; +} + +static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) { + if (obj == Py_None) { + __Pyx_ZeroBuffer(buf); + return 0; + } + buf->buf = NULL; + if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail; + if (buf->ndim != nd) { + PyErr_Format(PyExc_ValueError, + "Buffer has wrong number of dimensions (expected %d, got %d)", + nd, buf->ndim); + goto fail; + } + if (!cast) { + __Pyx_BufFmt_Context ctx; + __Pyx_BufFmt_Init(&ctx, stack, dtype); + if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; + } + if ((unsigned)buf->itemsize != dtype->size) { + PyErr_Format(PyExc_ValueError, + "Item size of buffer (%"PY_FORMAT_SIZE_T"d byte%s) does not match size of '%s' (%"PY_FORMAT_SIZE_T"d byte%s)", + buf->itemsize, (buf->itemsize > 1) ? "s" : "", + dtype->name, + dtype->size, (dtype->size > 1) ? "s" : ""); + goto fail; + } + if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; + return 0; +fail:; + __Pyx_ZeroBuffer(buf); + return -1; +} + +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { + if (info->buf == NULL) return; + if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; + __Pyx_ReleaseBuffer(info); +} + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} + + + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (unlikely(!type)) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(PyObject_TypeCheck(obj, type))) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} + +static void __Pyx_RaiseBufferFallbackError(void) { + PyErr_Format(PyExc_ValueError, + "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!"); +} + +static void __Pyx_RaiseBufferIndexError(int axis) { + PyErr_Format(PyExc_IndexError, + "Out of bounds on buffer access (axis %d)", axis); +} + + +static CYTHON_INLINE long __Pyx_mod_long(long a, long b) { + long r = a % b; + r += ((r != 0) & ((r ^ b) < 0)) * b; + return r; +} + +static CYTHON_INLINE long __Pyx_div_long(long a, long b) { + long q = a / b; + long r = a - q*b; + q -= ((r != 0) & ((r ^ b) < 0)); + return q; +} + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + #if PY_VERSION_HEX < 0x02050000 + "need more than %d value%s to unpack", (int)index, + #else + "need more than %zd value%s to unpack", index, + #endif + (index == 1) ? "" : "s"); +} + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + #if PY_VERSION_HEX < 0x02050000 + "too many values to unpack (expected %d)", (int)expected); + #else + "too many values to unpack (expected %zd)", expected); + #endif +} + +static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { + PyObject *item; + if (!(item = PyIter_Next(iter))) { + if (!PyErr_Occurred()) { + __Pyx_RaiseNeedMoreValuesError(index); + } + } + return item; +} + +static int __Pyx_EndUnpack(PyObject *iter, Py_ssize_t expected) { + PyObject *item; + if ((item = PyIter_Next(iter))) { + Py_DECREF(item); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } + else if (!PyErr_Occurred()) + return 0; + else + return -1; +} + + +static CYTHON_INLINE __pyx_t_5numpy_int64_t __Pyx_div___pyx_t_5numpy_int64_t(__pyx_t_5numpy_int64_t a, __pyx_t_5numpy_int64_t b) { + __pyx_t_5numpy_int64_t q = a / b; + __pyx_t_5numpy_int64_t r = a - q*b; + q -= ((r != 0) & ((r ^ b) < 0)); + return q; +} + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { + if (t == Py_None) { + __Pyx_RaiseNoneNotIterableError(); + } else if (PyTuple_GET_SIZE(t) < index) { + __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); + } else { + __Pyx_RaiseTooManyValuesError(index); + } +} + +#if PY_MAJOR_VERSION < 3 +static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { + #if PY_VERSION_HEX >= 0x02060000 + if (Py_TYPE(obj)->tp_flags & Py_TPFLAGS_HAVE_NEWBUFFER) + return PyObject_GetBuffer(obj, view, flags); + #endif + if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pf_5numpy_7ndarray___getbuffer__(obj, view, flags); + else { + PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); + return -1; + } +} + +static void __Pyx_ReleaseBuffer(Py_buffer *view) { + PyObject* obj = view->obj; + if (obj) { +if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pf_5numpy_7ndarray___releasebuffer__(obj, view); + Py_DECREF(obj); + view->obj = NULL; + } +} + +#endif + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { + PyObject *py_import = 0; + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!py_import) + goto bad; + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, NULL); +bad: + Py_XDECREF(empty_list); + Py_XDECREF(py_import); + Py_XDECREF(empty_dict); + return module; +} + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp val) { + const npy_intp neg_one = (npy_intp)-1, const_zero = (npy_intp)0; + const int is_unsigned = const_zero < neg_one; + if ((sizeof(npy_intp) == sizeof(char)) || + (sizeof(npy_intp) == sizeof(short))) { + return PyInt_FromLong((long)val); + } else if ((sizeof(npy_intp) == sizeof(int)) || + (sizeof(npy_intp) == sizeof(long))) { + if (is_unsigned) + return PyLong_FromUnsignedLong((unsigned long)val); + else + return PyInt_FromLong((long)val); + } else if (sizeof(npy_intp) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); + else + return PyLong_FromLongLong((PY_LONG_LONG)val); + } else { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + return _PyLong_FromByteArray(bytes, sizeof(npy_intp), + little, !is_unsigned); + } +} + +static CYTHON_INLINE npy_int32 __Pyx_PyInt_from_py_npy_int32(PyObject* x) { + const npy_int32 neg_one = (npy_int32)-1, const_zero = (npy_int32)0; + const int is_unsigned = const_zero < neg_one; + if (sizeof(npy_int32) == sizeof(char)) { + if (is_unsigned) + return (npy_int32)__Pyx_PyInt_AsUnsignedChar(x); + else + return (npy_int32)__Pyx_PyInt_AsSignedChar(x); + } else if (sizeof(npy_int32) == sizeof(short)) { + if (is_unsigned) + return (npy_int32)__Pyx_PyInt_AsUnsignedShort(x); + else + return (npy_int32)__Pyx_PyInt_AsSignedShort(x); + } else if (sizeof(npy_int32) == sizeof(int)) { + if (is_unsigned) + return (npy_int32)__Pyx_PyInt_AsUnsignedInt(x); + else + return (npy_int32)__Pyx_PyInt_AsSignedInt(x); + } else if (sizeof(npy_int32) == sizeof(long)) { + if (is_unsigned) + return (npy_int32)__Pyx_PyInt_AsUnsignedLong(x); + else + return (npy_int32)__Pyx_PyInt_AsSignedLong(x); + } else if (sizeof(npy_int32) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return (npy_int32)__Pyx_PyInt_AsUnsignedLongLong(x); + else + return (npy_int32)__Pyx_PyInt_AsSignedLongLong(x); + } else { + npy_int32 val; + PyObject *v = __Pyx_PyNumber_Int(x); + #if PY_VERSION_HEX < 0x03000000 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } + return (npy_int32)-1; + } +} + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int32(npy_int32 val) { + const npy_int32 neg_one = (npy_int32)-1, const_zero = (npy_int32)0; + const int is_unsigned = const_zero < neg_one; + if ((sizeof(npy_int32) == sizeof(char)) || + (sizeof(npy_int32) == sizeof(short))) { + return PyInt_FromLong((long)val); + } else if ((sizeof(npy_int32) == sizeof(int)) || + (sizeof(npy_int32) == sizeof(long))) { + if (is_unsigned) + return PyLong_FromUnsignedLong((unsigned long)val); + else + return PyInt_FromLong((long)val); + } else if (sizeof(npy_int32) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); + else + return PyLong_FromLongLong((PY_LONG_LONG)val); + } else { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + return _PyLong_FromByteArray(bytes, sizeof(npy_int32), + little, !is_unsigned); + } +} + +#if PY_MAJOR_VERSION < 3 +static PyObject *__Pyx_GetStdout(void) { + PyObject *f = PySys_GetObject((char *)"stdout"); + if (!f) { + PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout"); + } + return f; +} + +static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) { + PyObject* v; + int i; + + if (!f) { + if (!(f = __Pyx_GetStdout())) + return -1; + } + for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) { + if (PyFile_SoftSpace(f, 1)) { + if (PyFile_WriteString(" ", f) < 0) + return -1; + } + v = PyTuple_GET_ITEM(arg_tuple, i); + if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0) + return -1; + if (PyString_Check(v)) { + char *s = PyString_AsString(v); + Py_ssize_t len = PyString_Size(v); + if (len > 0 && + isspace(Py_CHARMASK(s[len-1])) && + s[len-1] != ' ') + PyFile_SoftSpace(f, 0); + } + } + if (newline) { + if (PyFile_WriteString("\n", f) < 0) + return -1; + PyFile_SoftSpace(f, 0); + } + return 0; +} + +#else /* Python 3 has a print function */ + +static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { + PyObject* kwargs = 0; + PyObject* result = 0; + PyObject* end_string; + if (unlikely(!__pyx_print)) { + __pyx_print = __Pyx_GetAttrString(__pyx_b, "print"); + if (!__pyx_print) + return -1; + } + if (stream) { + kwargs = PyDict_New(); + if (unlikely(!kwargs)) + return -1; + if (unlikely(PyDict_SetItemString(kwargs, "file", stream) < 0)) + goto bad; + if (!newline) { + end_string = PyUnicode_FromStringAndSize(" ", 1); + if (unlikely(!end_string)) + goto bad; + if (PyDict_SetItemString(kwargs, "end", end_string) < 0) { + Py_DECREF(end_string); + goto bad; + } + Py_DECREF(end_string); + } + } else if (!newline) { + if (unlikely(!__pyx_print_kwargs)) { + __pyx_print_kwargs = PyDict_New(); + if (unlikely(!__pyx_print_kwargs)) + return -1; + end_string = PyUnicode_FromStringAndSize(" ", 1); + if (unlikely(!end_string)) + return -1; + if (PyDict_SetItemString(__pyx_print_kwargs, "end", end_string) < 0) { + Py_DECREF(end_string); + return -1; + } + Py_DECREF(end_string); + } + kwargs = __pyx_print_kwargs; + } + result = PyObject_Call(__pyx_print, arg_tuple, kwargs); + if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs)) + Py_DECREF(kwargs); + if (!result) + return -1; + Py_DECREF(result); + return 0; +bad: + if (kwargs != __pyx_print_kwargs) + Py_XDECREF(kwargs); + return -1; +} + +#endif + +static CYTHON_INLINE npy_int64 __Pyx_PyInt_from_py_npy_int64(PyObject* x) { + const npy_int64 neg_one = (npy_int64)-1, const_zero = (npy_int64)0; + const int is_unsigned = const_zero < neg_one; + if (sizeof(npy_int64) == sizeof(char)) { + if (is_unsigned) + return (npy_int64)__Pyx_PyInt_AsUnsignedChar(x); + else + return (npy_int64)__Pyx_PyInt_AsSignedChar(x); + } else if (sizeof(npy_int64) == sizeof(short)) { + if (is_unsigned) + return (npy_int64)__Pyx_PyInt_AsUnsignedShort(x); + else + return (npy_int64)__Pyx_PyInt_AsSignedShort(x); + } else if (sizeof(npy_int64) == sizeof(int)) { + if (is_unsigned) + return (npy_int64)__Pyx_PyInt_AsUnsignedInt(x); + else + return (npy_int64)__Pyx_PyInt_AsSignedInt(x); + } else if (sizeof(npy_int64) == sizeof(long)) { + if (is_unsigned) + return (npy_int64)__Pyx_PyInt_AsUnsignedLong(x); + else + return (npy_int64)__Pyx_PyInt_AsSignedLong(x); + } else if (sizeof(npy_int64) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return (npy_int64)__Pyx_PyInt_AsUnsignedLongLong(x); + else + return (npy_int64)__Pyx_PyInt_AsSignedLongLong(x); + } else { + npy_int64 val; + PyObject *v = __Pyx_PyNumber_Int(x); + #if PY_VERSION_HEX < 0x03000000 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } + return (npy_int64)-1; + } +} + +#if PY_MAJOR_VERSION < 3 + +static int __Pyx_PrintOne(PyObject* f, PyObject *o) { + if (!f) { + if (!(f = __Pyx_GetStdout())) + return -1; + } + if (PyFile_SoftSpace(f, 0)) { + if (PyFile_WriteString(" ", f) < 0) + return -1; + } + if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0) + return -1; + if (PyFile_WriteString("\n", f) < 0) + return -1; + return 0; + /* the line below is just to avoid compiler + * compiler warnings about unused functions */ + return __Pyx_Print(f, NULL, 0); +} + +#else /* Python 3 has a print function */ + +static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { + int res; + PyObject* arg_tuple = PyTuple_New(1); + if (unlikely(!arg_tuple)) + return -1; + Py_INCREF(o); + PyTuple_SET_ITEM(arg_tuple, 0, o); + res = __Pyx_Print(stream, arg_tuple, 1); + Py_DECREF(arg_tuple); + return res; +} + +#endif + +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { + Py_XINCREF(type); + Py_XINCREF(value); + Py_XINCREF(tb); + /* First, check the traceback argument, replacing None with NULL. */ + if (tb == Py_None) { + Py_DECREF(tb); + tb = 0; + } + else if (tb != NULL && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + /* Next, replace a missing value with None */ + if (value == NULL) { + value = Py_None; + Py_INCREF(value); + } + #if PY_VERSION_HEX < 0x02050000 + if (!PyClass_Check(type)) + #else + if (!PyType_Check(type)) + #endif + { + /* Raising an instance. The value should be a dummy. */ + if (value != Py_None) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + /* Normalize to raise , */ + Py_DECREF(value); + value = type; + #if PY_VERSION_HEX < 0x02050000 + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } + else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } + #else + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + #endif + } + + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} + +#else /* Python 3+ */ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (!PyExceptionClass_Check(type)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + + PyErr_SetObject(type, value); + + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } + +bad: + return; +} +#endif + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int64(npy_int64 val) { + const npy_int64 neg_one = (npy_int64)-1, const_zero = (npy_int64)0; + const int is_unsigned = const_zero < neg_one; + if ((sizeof(npy_int64) == sizeof(char)) || + (sizeof(npy_int64) == sizeof(short))) { + return PyInt_FromLong((long)val); + } else if ((sizeof(npy_int64) == sizeof(int)) || + (sizeof(npy_int64) == sizeof(long))) { + if (is_unsigned) + return PyLong_FromUnsignedLong((unsigned long)val); + else + return PyInt_FromLong((long)val); + } else if (sizeof(npy_int64) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); + else + return PyLong_FromLongLong((PY_LONG_LONG)val); + } else { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + return _PyLong_FromByteArray(bytes, sizeof(npy_int64), + little, !is_unsigned); + } +} + +static CYTHON_INLINE png_uint_32 __Pyx_PyInt_from_py_png_uint_32(PyObject* x) { + const png_uint_32 neg_one = (png_uint_32)-1, const_zero = (png_uint_32)0; + const int is_unsigned = const_zero < neg_one; + if (sizeof(png_uint_32) == sizeof(char)) { + if (is_unsigned) + return (png_uint_32)__Pyx_PyInt_AsUnsignedChar(x); + else + return (png_uint_32)__Pyx_PyInt_AsSignedChar(x); + } else if (sizeof(png_uint_32) == sizeof(short)) { + if (is_unsigned) + return (png_uint_32)__Pyx_PyInt_AsUnsignedShort(x); + else + return (png_uint_32)__Pyx_PyInt_AsSignedShort(x); + } else if (sizeof(png_uint_32) == sizeof(int)) { + if (is_unsigned) + return (png_uint_32)__Pyx_PyInt_AsUnsignedInt(x); + else + return (png_uint_32)__Pyx_PyInt_AsSignedInt(x); + } else if (sizeof(png_uint_32) == sizeof(long)) { + if (is_unsigned) + return (png_uint_32)__Pyx_PyInt_AsUnsignedLong(x); + else + return (png_uint_32)__Pyx_PyInt_AsSignedLong(x); + } else if (sizeof(png_uint_32) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return (png_uint_32)__Pyx_PyInt_AsUnsignedLongLong(x); + else + return (png_uint_32)__Pyx_PyInt_AsSignedLongLong(x); + } else { + png_uint_32 val; + PyObject *v = __Pyx_PyNumber_Int(x); + #if PY_VERSION_HEX < 0x03000000 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } + return (png_uint_32)-1; + } +} + +static CYTHON_INLINE long __Pyx_pow_long(long b, long e) { + long t = b; + switch (e) { + case 3: + t *= b; + case 2: + t *= b; + case 1: + return t; + case 0: + return 1; + } + if (unlikely(e<0)) return 0; + t = 1; + while (likely(e)) { + t *= (b * (e&1)) | ((~e)&1); /* 1 or b */ + b *= b; + e >>= 1; + } + return t; +} + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return ::std::complex< float >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } +/* + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { +#if HAVE_HYPOT + return hypotf(z.real, z.imag); +#else + return sqrtf(z.real*z.real + z.imag*z.imag); +#endif + } +*/ +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return ::std::complex< double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } +/* + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { +#if HAVE_HYPOT + return hypot(z.real, z.imag); +#else + return sqrt(z.real*z.real + z.imag*z.imag); +#endif + } +*/ +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static void __Pyx_WriteUnraisable(const char *name) { + PyObject *old_exc, *old_val, *old_tb; + PyObject *ctx; + __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); + #if PY_MAJOR_VERSION < 3 + ctx = PyString_FromString(name); + #else + ctx = PyUnicode_FromString(name); + #endif + __Pyx_ErrRestore(old_exc, old_val, old_tb); + if (!ctx) { + PyErr_WriteUnraisable(Py_None); + } else { + PyErr_WriteUnraisable(ctx); + Py_DECREF(ctx); + } +} + +static int __Pyx_SetVtable(PyObject *dict, void *vtable) { +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + PyObject *ob = PyCapsule_New(vtable, 0, 0); +#else + PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); +#endif + if (!ob) + goto bad; + if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0) + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +#ifndef __PYX_HAVE_RT_ImportType +#define __PYX_HAVE_RT_ImportType +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, + long size, int strict) +{ + PyObject *py_module = 0; + PyObject *result = 0; + PyObject *py_name = 0; + char warning[200]; + + py_module = __Pyx_ImportModule(module_name); + if (!py_module) + goto bad; + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(class_name); + #else + py_name = PyUnicode_FromString(class_name); + #endif + if (!py_name) + goto bad; + result = PyObject_GetAttr(py_module, py_name); + Py_DECREF(py_name); + py_name = 0; + Py_DECREF(py_module); + py_module = 0; + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%s.%s is not a type object", + module_name, class_name); + goto bad; + } + if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility", + module_name, class_name); + #if PY_VERSION_HEX < 0x02050000 + PyErr_Warn(NULL, warning); + #else + PyErr_WarnEx(NULL, warning, 0); + #endif + } + else if (((PyTypeObject *)result)->tp_basicsize != size) { + PyErr_Format(PyExc_ValueError, + "%s.%s has the wrong size, try recompiling", + module_name, class_name); + goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(py_module); + Py_XDECREF(result); + return 0; +} +#endif + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(name); + #else + py_name = PyUnicode_FromString(name); + #endif + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(__pyx_filename); + #else + py_srcfile = PyUnicode_FromString(__pyx_filename); + #endif + if (!py_srcfile) goto bad; + if (__pyx_clineno) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + __pyx_lineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + if (!py_code) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +/* Type Conversion Functions */ + +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} + +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/utilities/amr_utils.pyx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yt/utilities/amr_utils.pyx Thu Aug 26 10:24:41 2010 -0600 @@ -0,0 +1,47 @@ +""" +Container file to hold all our Cython routines. This is to avoid problems with +static linking. + +Author: Matthew Turk +Affiliation: KIPAC/SLAC/Stanford +Homepage: http://yt.enzotools.org/ +License: + Copyright (C) 2008 Matthew Turk. All Rights Reserved. + + This file is part of yt. + + yt is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +#cython embedsignature=True +#cython cdivision=True +#cython always_allow_keywords=True + +# Set up some imports +import numpy as np +cimport numpy as np +cimport cython + +# We include all of our files + +include "_amr_utils/DepthFirstOctree.pyx" +include "_amr_utils/Interpolators.pyx" +include "_amr_utils/PointsInVolume.pyx" +include "_amr_utils/RayIntegrators.pyx" +include "_amr_utils/VolumeIntegrator.pyx" +include "_amr_utils/CICDeposit.pyx" +include "_amr_utils/ContourFinding.pyx" +include "_amr_utils/png_writer.pyx" +include "_amr_utils/fortran_reader.pyx" +include "_amr_utils/QuadTree.pyx" diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/utilities/exceptions.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yt/utilities/exceptions.py Thu Aug 26 10:24:41 2010 -0600 @@ -0,0 +1,43 @@ +""" +This is a library of yt-defined exceptions + +Author: Matthew Turk +Affiliation: KIPAC/SLAC/Stanford +Homepage: http://yt.enzotools.org/ +License: + Copyright (C) 2009 Matthew Turk. All Rights Reserved. + + This file is part of yt. + + yt is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +# We don't need to import 'exceptions' +#import exceptions + +class YTException(Exception): + def __init__(self, pf = None): + Exception.__init__(self) + self.pf = pf + +# Data access exceptions: + +class YTSphereTooSmall(YTException): + def __init__(self, pf, radius, smallest_cell): + YTException.__init__(self, pf) + self.radius = radius + self.smallest_cell = smallest_cell + + def __str__(self): + return "%0.5e < %0.5e" % (self.radius, self.smallest_cell) diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/utilities/logger.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yt/utilities/logger.py Thu Aug 26 10:24:41 2010 -0600 @@ -0,0 +1,108 @@ +""" +Logging facility for yt +Will initialize everything, and associate one with each module + +Author: Matthew Turk +Affiliation: KIPAC/SLAC/Stanford +Homepage: http://yt.enzotools.org/ +License: + Copyright (C) 2007-2009 Matthew Turk. All Rights Reserved. + + This file is part of yt. + + yt is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +import logging, os +import logging.handlers as handlers +from yt.config import ytcfg + +# This next bit is grabbed from: +# http://stackoverflow.com/questions/384076/how-can-i-make-the-python-logging-output-to-be-colored +def add_coloring_to_emit_ansi(fn): + # add methods we need to the class + def new(*args): + levelno = args[1].levelno + if(levelno>=50): + color = '\x1b[31m' # red + elif(levelno>=40): + color = '\x1b[31m' # red + elif(levelno>=30): + color = '\x1b[33m' # yellow + elif(levelno>=20): + color = '\x1b[32m' # green + elif(levelno>=10): + color = '\x1b[35m' # pink + else: + color = '\x1b[0m' # normal + args[1].msg = color + args[1].msg + '\x1b[0m' # normal + #print "after" + return fn(*args) + return new + +if ytcfg.getboolean("yt","coloredlogs"): + logging.StreamHandler.emit = add_coloring_to_emit_ansi(logging.StreamHandler.emit) + +level = min(max(ytcfg.getint("yt", "loglevel"), 0), 50) +fstring = "%(name)-10s %(levelname)-10s %(asctime)s %(message)s" +logging.basicConfig( + format=fstring, + level=level +) + +f = logging.Formatter("%(levelname)-10s %(asctime)s %(message)s") + +rootLogger = logging.getLogger() + +ytLogger = logging.getLogger("yt") +ytLogger.debug("Set log level to %s", level) + +fidoLogger = logging.getLogger("yt.fido") +ravenLogger = logging.getLogger("yt.raven") +lagosLogger = logging.getLogger("yt.lagos") +enkiLogger = logging.getLogger("yt.enki") +deliveratorLogger = logging.getLogger("yt.deliverator") +reasonLogger = logging.getLogger("yt.reason") + +# Maybe some day we'll make this more configurable... unfortunately, for now, +# we preserve thread-safety by opening in the current directory. + +mb = 10*1024*1024 +bc = 10 + +loggers = [] +file_handlers = [] + +if ytcfg.getboolean("yt","logfile") and os.access(".", os.W_OK): + log_file_name = ytcfg.get("yt","LogFileName") + ytFileHandler = handlers.RotatingFileHandler(log_file_name, + maxBytes=mb, backupCount=bc) + k = logging.Formatter(fstring) + ytFileHandler.setFormatter(k) + ytLogger.addHandler(ytFileHandler) + loggers.append(ytLogger) + file_handlers.append(ytFileHandler) + +def disable_stream_logging(): + # We just remove the root logger's handlers + for handler in rootLogger.handlers: + if isinstance(handler, logging.StreamHandler): + rootLogger.removeHandler(handler) + +def disable_file_logging(): + for logger, handler in zip(loggers, file_handlers): + logger.removeHandler(handler) + +if ytcfg.getboolean("yt","suppressStreamLogging"): + disable_stream_logging() diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/utilities/parallel_tools/__init__.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yt/utilities/parallel_tools/__init__.py Thu Aug 26 10:24:41 2010 -0600 @@ -0,0 +1,27 @@ +""" +Tools for parallelism. + +Author: Matthew Turk +Affiliation: KIPAC/SLAC/Stanford +Homepage: http://yt.enzotools.org/ +License: + Copyright (C) 2010 Matthew Turk. All Rights Reserved. + + This file is part of yt. + + yt is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +from yt.lagos.ParallelTools import ParallelAnalysisInterface +from distributed_object_collection import DistributedObjectCollection diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/utilities/parallel_tools/distributed_object_collection.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yt/utilities/parallel_tools/distributed_object_collection.py Thu Aug 26 10:24:41 2010 -0600 @@ -0,0 +1,135 @@ +""" +A simple distributed object mechanism, for storing array-heavy objects. +Meant to be subclassed. + +Author: Matthew Turk +Affiliation: KIPAC/SLAC/Stanford +Homepage: http://yt.enzotools.org/ +License: + Copyright (C) 2010 Matthew Turk. All Rights Reserved. + + This file is part of yt. + + yt is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +import numpy as na +from yt.funcs import * +from yt.parallel_tools import ParallelAnalysisInterface +from itertools import izip + +class DistributedObjectCollection(ParallelAnalysisInterface): + valid = True + + def _get_object_info(self): + pass + + def _set_object_info(self): + pass + + def join_lists(self): + info_dict = self._get_object_info() + info_dict = self._mpi_catdict(info_dict) + self._set_object_info(info_dict) + + def _collect_objects(self, desired_indices): + # We figure out which indices belong to which processor, + # then we pack them up, and we send a list to each processor. + request_count = [] + owners = self._object_owners[desired_indices] + mylog.debug("Owner list: %s", na.unique1d(owners)) + # Even if we have a million bricks, this should not take long. + s = self._mpi_get_size() + m = self._mpi_get_rank() + requests = dict( ( (i, []) for i in xrange(s) ) ) + for i, p in izip(desired_indices, owners): + requests[p].append(i) + for p in sorted(requests): + requests[p] = na.array(requests[p], dtype='int64') + request_count.append(len(requests[p])) + size = len(request_count) + mylog.debug("Requesting: %s", request_count) + request_count = na.array(request_count, dtype='int64') + # Now we distribute our requests to all the processors. + # This is two-pass. One to get the length of the arrays. The second + # pass is to get the actual indices themselves. + request_count = self._mpi_joindict({m : request_count}) + # Now we have our final array of requests, with arrangement + # (Nproc,Nproc). First index corresponds to requesting proc, second to + # sending. So [them,us] = 5 means we owe 5, whereas [us, them] means + # we are owed. + send_hooks = [] + dsend_buffers, dsend_hooks = [], [] + recv_hooks, recv_buffers = [], [] + drecv_buffers, drecv_hooks = [], [] + # We post our index-list and data receives from each processor. + mylog.debug("Posting data buffer receives") + proc_hooks = {} + for p, request_from in request_count.items(): + if p == m: continue + size = request_from[m] + #if size == 0: continue + # We post receives of the grids we *asked* for. + # Note that indices into this are not necessarily processor ids. + # So we store. This has to go before the appends or it's an + # off-by-one. + mylog.debug("Setting up index buffer of size %s for receive from %s", + size, p) + proc_hooks[len(drecv_buffers)] = p + drecv_buffers.append(self._create_buffer(requests[p])) + drecv_hooks.append(self._mpi_Irecv_double(drecv_buffers[-1], p, 1)) + recv_buffers.append(na.zeros(size, dtype='int64')) + # Our index list goes on 0, our buffer goes on 1. We know how big + # the index list will be, now. + recv_hooks.append(self._mpi_Irecv_long(recv_buffers[-1], p, 0)) + # Send our index lists into hte waiting buffers + mylog.debug("Sending index lists") + for p, ind_list in requests.items(): + if p == m: continue + if len(ind_list) == 0: continue + # Now, we actually send our index lists. + send_hooks.append(self._mpi_Isend_long(ind_list, p, 0)) + # Now we post receives for all of the data buffers. + mylog.debug("Sending data") + for i in self._mpi_Request_Waititer(recv_hooks): + # We get back the index, which here is identical to the processor + # number doing the send. At this point, we can post our receives. + p = proc_hooks[i] + mylog.debug("Processing from %s", p) + ind_list = recv_buffers[i] + dsend_buffers.append(self._create_buffer(ind_list)) + self._pack_buffer(ind_list, dsend_buffers[-1]) + dsend_hooks.append(self._mpi_Isend_double( + dsend_buffers[-1], p, 1)) + mylog.debug("Waiting on data receives: %s", len(drecv_hooks)) + for i in self._mpi_Request_Waititer(drecv_hooks): + mylog.debug("Unpacking from %s", proc_hooks[i]) + # Now we have to unpack our buffers + # Our key into this is actually the request for the processor + # number. + p = proc_hooks[i] + self._unpack_buffer(requests[p], drecv_buffers[i]) + mylog.debug("Finalizing sends: %s", len(dsend_hooks)) + for i in self._mpi_Request_Waititer(dsend_hooks): + continue + + def _create_buffer(self, ind_list): + pass + + def _pack_buffer(self, ind_list): + pass + + def _unpack_buffer(self, ind_list, my_buffer): + pass + diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/utilities/physical_constants.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yt/utilities/physical_constants.py Thu Aug 26 10:24:41 2010 -0600 @@ -0,0 +1,53 @@ +# +# Physical Constants and Units Conversion Factors +# + +# Masses +mass_hydrogen_cgs = 1.67e-24 # g +mass_electron_cgs = 9.11e-28 # g +# Velocities +speed_of_light_cgs = 2.99792458e10 # cm/s, exact + +# Cross Sections +cross_section_thompson_cgs = 6.65e-25 # cm^2 + +# Physical Constants +boltzmann_constant_cgs = 1.3806504e-16 # erg K^-1 +gravitational_constant_cgs = 6.67428e-8 # cm^3 g^-1 s^-2 +planck_constant_cgs = 6.62606896e-27 # erg s +rho_crit_now = 1.8788e-29 # g times h^2 (critical mass for closure, Cosmology) + +# Misc. Approximations +mass_mean_atomic_cosmology = 1.22 +mass_mean_atomic_galactic = 2.3 + +# Conversion Factors: X au * mpc_per_au = Y au +# length +mpc_per_mpc = 1 +mpc_per_kpc = 1e-3 +mpc_per_pc = 1e-6 +mpc_per_au = 4.847e-12 +mpc_per_rsun = 2.253e-14 +mpc_per_miles = 5.216e-20 +mpc_per_cm = 3.24e-25 +km_per_pc = 1.3806504e13 +km_per_m = 1e-3 +km_per_cm = 1e-5 + +m_per_fpc = 0.0324077649 + +au_per_mpc = 2.063e11 +rsun_per_mpc = 4.43664e13 +miles_per_mpc = 1.917e19 +cm_per_mpc = 3.0857e24 +cm_per_km = 1e5 +pc_per_km = 3.24e-14 +pc_per_cm = 3.24e-19 +#Short cuts +G = gravitational_constant_cgs +me = mass_electron_cgs +mp = mass_hydrogen_cgs +clight = speed_of_light_cgs +kboltz = boltzmann_constant_cgs +hcgs = planck_constant_cgs +sigma_thompson = cross_section_thompson_cgs diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/utilities/setup.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yt/utilities/setup.py Thu Aug 26 10:24:41 2010 -0600 @@ -0,0 +1,12 @@ +#!/usr/bin/env python +import setuptools +import os, sys, os.path + +import os.path + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + config = Configuration('utilities',parent_package,top_path) + config.make_config_py() # installs __config__.py + config.make_svn_version_py() + return config diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/visualization/image_panner/setup.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yt/visualization/image_panner/setup.py Thu Aug 26 10:24:41 2010 -0600 @@ -0,0 +1,12 @@ +#!/usr/bin/env python +import setuptools +import os, sys, os.path + +import os.path + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + config = Configuration('image_panner',parent_package,top_path) + config.make_config_py() # installs __config__.py + config.make_svn_version_py() + return config diff -r 87b5d03be7855cb99e3919d1de934110b0e49fc9 -r c6b41bae4551bcbca86efa061d317ca63baea751 yt/visualization/opengl_widgets/setup.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yt/visualization/opengl_widgets/setup.py Thu Aug 26 10:24:41 2010 -0600 @@ -0,0 +1,12 @@ +#!/usr/bin/env python +import setuptools +import os, sys, os.path + +import os.path + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + config = Configuration('opengl_widgets',parent_package,top_path) + config.make_config_py() # installs __config__.py + config.make_svn_version_py() + return config