# HG changeset patch # User Matthew Turk # Date 1247465112 25200 # Branch hierarchy-opt # Node ID 7fd89683add68d5819acc3332ef40daa53ebd8b1 # Parent 90e2530efb3dc383cfb70f9600290fc7a4bcd71a # Parent 0e20534ae393978f24f981fd63cb1b85bc5ca1bf Merging back in changes from main yt branch diff -r 90e2530efb3dc383cfb70f9600290fc7a4bcd71a -r 7fd89683add68d5819acc3332ef40daa53ebd8b1 doc/install_script.sh --- a/doc/install_script.sh Tue Jun 23 22:26:09 2009 -0700 +++ b/doc/install_script.sh Sun Jul 12 23:05:12 2009 -0700 @@ -33,7 +33,7 @@ # the system zlib, which is compiled statically. # If need be, you can turn this off. INST_TRAITS=1 # Experimental TraitsUI installation -INST_HG=0 # Install Mercurial or not? +INST_HG=1 # Install Mercurial or not? # If you've got YT some other place, set this to point to it. YT_DIR="" diff -r 90e2530efb3dc383cfb70f9600290fc7a4bcd71a -r 7fd89683add68d5819acc3332ef40daa53ebd8b1 doc/install_script_osx.sh --- a/doc/install_script_osx.sh Tue Jun 23 22:26:09 2009 -0700 +++ b/doc/install_script_osx.sh Sun Jul 12 23:05:12 2009 -0700 @@ -23,7 +23,7 @@ # and install it on its own #HDF5_DIR= -INST_HG=0 # Install Mercurial or not? +INST_HG=1 # Install Mercurial or not? # If you've got YT some other place, set this to point to it. YT_DIR="" diff -r 90e2530efb3dc383cfb70f9600290fc7a4bcd71a -r 7fd89683add68d5819acc3332ef40daa53ebd8b1 examples/cookbook_mass_sum.py --- a/examples/cookbook_mass_sum.py Tue Jun 23 22:26:09 2009 -0700 +++ b/examples/cookbook_mass_sum.py Sun Jul 12 23:05:12 2009 -0700 @@ -4,7 +4,7 @@ sp = pf.h.all_data() baryon_mass = sp["CellMassMsun"].sum() -particle_mass = sphere["ParticleMassMsun"].sum() +particle_mass = sp["ParticleMassMsun"].sum() print "Total mass in grids in %s is %0.5e (gas = %0.5e / particles = %0.5e)" % \ (pf, baryon_mass + particle_mass, baryon_mass, particle_mass) diff -r 90e2530efb3dc383cfb70f9600290fc7a4bcd71a -r 7fd89683add68d5819acc3332ef40daa53ebd8b1 yt/commands.py --- a/yt/commands.py Tue Jun 23 22:26:09 2009 -0700 +++ b/yt/commands.py Sun Jul 12 23:05:12 2009 -0700 @@ -38,6 +38,10 @@ action="store_true", dest="takelog", default=True, help="Take the log of the field?"), + text = dict(short="-t", long="--text", + action="store", type="string", + dest="text", default=None, + help="Textual annotation"), field = dict(short="-f", long="--field", action="store", type="string", dest="field", default="Density", @@ -55,6 +59,11 @@ dest="zlim", default=None, nargs=2, help="Color limits (min, max)"), + dex = dict(short="", long="--dex", + action="store", type="float", + dest="dex", default=None, + nargs=1, + help="Number of dex above min to display"), width = dict(short="-w", long="--width", action="store", type="float", dest="width", default=1.0, @@ -248,7 +257,8 @@ hp.makeProjections() @add_cmd_options(["maxw", "minw", "proj", "axis", "field", "weight", - "zlim", "nframes", "output", "cmap", "uboxes"]) + "zlim", "nframes", "output", "cmap", "uboxes", "dex", + "text"]) def do_zoomin(self, subcmd, opts, arg): """ Create a set of zoomin frames @@ -263,11 +273,14 @@ axes = [opts.axis] pc = PlotCollection(pf) for ax in axes: - if opts.projection: pc.add_projection(opts.field, ax, + if opts.projection: p = pc.add_projection(opts.field, ax, weight_field=opts.weight) - else: pc.add_slice(opts.field, ax) - if opts.unit_boxes: pc.plots[-1].add_callback( - UnitBoundaryCallback(factor=8)) + else: p = pc.add_slice(opts.field, ax) + if opts.unit_boxes: p.modify["units"](factor=8) + if opts.text is not None: + p.modify["text"]( + (0.02, 0.05), opts.text.replace(r"\n", "\n"), + text_args=dict(size="medium", color="w")) pc.set_width(opts.max_width,'1') # Check the output directory if not os.path.isdir(opts.output): @@ -284,10 +297,13 @@ mylog.info("Setting width to %0.3e", w) mylog.info("Saving frame %06i",i) pc.set_width(w,"1") - if opts.zlim: pc.set_zlim(*opts.zlim) + if opts.zlim: + pc.set_zlim(*opts.zlim) + if opts.dex: + pc.set_zlim('min', None, opts.dex) pc.set_cmap(opts.cmap) pc.save(os.path.join(opts.output,"%s_frame%06i" % (pf,i))) - w *= factor + w = factor**i @add_cmd_options(["width", "unit", "bn", "proj", "center", "zlim", "axis", "field", "weight", "skip", diff -r 90e2530efb3dc383cfb70f9600290fc7a4bcd71a -r 7fd89683add68d5819acc3332ef40daa53ebd8b1 yt/extensions/HaloProfiler.py --- a/yt/extensions/HaloProfiler.py Tue Jun 23 22:26:09 2009 -0700 +++ b/yt/extensions/HaloProfiler.py Sun Jul 12 23:05:12 2009 -0700 @@ -120,20 +120,20 @@ for q,halo in enumerate(self._get_objs('hopHalos', round_robin=True)): filename = "%s/Halo_%04d_profile.dat" % (outputDir,halo['id']) - + # Read profile from file if it already exists. # If not, profile will be None. profile = self._ReadProfile(filename) - + # Make profile if necessary. newProfile = profile is None if profile is None: - + r_min = 2*self.pf.h.get_smallest_dx() * self.pf['mpc'] if (halo['r_max'] / r_min < PROFILE_RADIUS_THRESHOLD): mylog.error("Skipping halo with r_max / r_min = %f." % (halo['r_max']/r_min)) continue - + sphere = self.pf.h.sphere(halo['center'],halo['r_max']/self.pf.units['mpc']) if len(sphere._grids) == 0: continue @@ -150,7 +150,7 @@ sphere.set_field_parameter('bulk_velocity',[max_grid['x-velocity'][max_cell], max_grid['y-velocity'][max_cell], max_grid['z-velocity'][max_cell]]) - + profile = lagos.BinnedProfile1D(sphere,self.haloProfilerParameters['n_bins'],"RadiusMpc", r_min,halo['r_max'], log_space=True, lazy_reader=False) @@ -163,7 +163,7 @@ virial = self._CalculateVirialQuantities(profile) virial['center'] = halo['center'] virial['id'] = halo['id'] - + if (virial['TotalMassMsun'] >= self.haloProfilerParameters['VirialMassCutoff']): self.virialQuantities.append(virial) if newProfile: @@ -195,7 +195,6 @@ def makeProjections(self,save_images=True,save_cube=True,**kwargs): "Make projections of all halos using specified fields." - # Get virial quantities. self._LoadVirialData() @@ -252,8 +251,9 @@ y_axis = coords[1] for field in self.projectionFields.keys(): - pc.add_projection(field,w,weight_field=self.projectionFields[field],source=region,lazy_reader=False,**kwargs) - + pc.add_projection(field,w,weight_field=self.projectionFields[field],source=region,lazy_reader=False, + serialize=False,**kwargs) + # Set x and y limits, shift image if it overlaps domain boundary. if need_per: pw = self.haloProfilerParameters['ProjectionWidth']/self.pf.units['mpc'] @@ -281,16 +281,16 @@ frb = raven.FixedResolutionBuffer(pc.plots[e].data,(proj_left[0],proj_right[0],proj_left[1],proj_right[1]), (projectionResolution,projectionResolution), antialias=False) - output.create_dataset("/%s_%s" % (field,self.projectionFields[field]),data=frb[field]) + dataset_name = "%s_%s" % (field,self.projectionFields[field]) + if dataset_name in output.listnames(): del output[dataset_name] + output.create_dataset(dataset_name,data=frb[field]) output.close() if save_images: - pc.save("%s/Halo_%04d" % (outputDir,halo['id'])) + pc.save("%s/Halo_%04d" % (outputDir,halo['id']),force_save=True) pc.clear_plots() - del region - del pc @lagos.parallel_root_only diff -r 90e2530efb3dc383cfb70f9600290fc7a4bcd71a -r 7fd89683add68d5819acc3332ef40daa53ebd8b1 yt/extensions/lightcone/LightCone.py --- a/yt/extensions/lightcone/LightCone.py Tue Jun 23 22:26:09 2009 -0700 +++ b/yt/extensions/lightcone/LightCone.py Sun Jul 12 23:05:12 2009 -0700 @@ -33,6 +33,7 @@ import os import numpy as na import random as rand +import yt.lagos.Cosmology as cosmo class LightCone(object): def __init__(self,EnzoParameterFile,LightConeParameterFile,verbose=True): @@ -79,8 +80,10 @@ # Calculate redshifts for dt data dumps. if (self.enzoParameters.has_key('dtDataDump')): - self._CalculateTimeDumpRedshifts() - + if self.lightConeParameters['dtSplit'] is None: + self._CalculateTimeDumpRedshifts() + else: + self._CalculateSplitTimeDumpRedshifts(self.lightConeParameters['dtSplit'],self.lightConeParameters['dt_new']) # Combine all data dumps. self._CombineDataOutputs() @@ -250,7 +253,7 @@ del haloMaskCube def ProjectLightCone(self,field,weight_field=None,apply_halo_mask=False,node=None, - save_stack=True,save_slice_images=False,flatten_stack=False,**kwargs): + save_stack=True,save_slice_images=False,flatten_stack=False,photon_field=False,**kwargs): "Create projections for light cone, then add them together." # Clear projection stack. @@ -273,6 +276,19 @@ frb = LightConeProjection(output,field,self.pixels,weight_field=weight_field, save_image=save_slice_images, name=name,node=node,**kwargs) + if ytcfg.getint("yt","__parallel_rank") == 0: + if photon_field: + #need to decrement the flux by the luminosity distance. Assume field in frb is in erg/s/cm^2/Hz + co = lagos.Cosmology(HubbleConstantNow = (100.0 * self.enzoParameters['CosmologyHubbleConstantNow']), + OmegaMatterNow = self.enzoParameters['CosmologyOmegaMatterNow'], + OmegaLambdaNow = self.enzoParameters['CosmologyOmegaLambdaNow']) + dL = co.LuminosityDistance(self.lightConeParameters['ObserverRedshift'],output['redshift']) #in Mpc + boxSizeProper = self.enzoParameters['CosmologyComovingBoxSize'] / (self.enzoParameters['CosmologyHubbleConstantNow'] * + (1.0 + output['redshift'])) + pixelarea = (boxSizeProper/self.pixels)**2 #in proper cm^2 + factor = pixelarea/(4.0*na.pi*dL**2) + mylog.info("Distance to slice = %e" % dL) + frb[field] *= factor #in erg/s/cm^2/Hz on observer's image plane. if ytcfg.getint("yt","__parallel_rank") == 0: if (weight_field is not None): @@ -334,7 +350,7 @@ self.lightConeSolution[-1]['object'].parameters['DomainRightEdge'][w]) for w in range(self.lightConeSolution[-1]['object'].parameters['TopGridRank'])] pc = raven.PlotCollection(self.lightConeSolution[-1]['object'],center=center) - pc.add_fixed_resolution_plot(frb,field) + pc.add_fixed_resolution_plot(frb,field,**kwargs) pc.save(filename) # Return the plot collection so the user can remake the plot if they want. @@ -582,6 +598,35 @@ self.timeOutputs.append({'index':index,'redshift':z,'filename':filename}) index += 1 + def _CalculateSplitTimeDumpRedshifts(self,break_index,new_dt): + "Calculates redshift values for the dt data dumps." + ec = lagos.EnzoCosmology(HubbleConstantNow = \ + (100.0 * self.enzoParameters['CosmologyHubbleConstantNow']), + OmegaMatterNow = self.enzoParameters['CosmologyOmegaMatterNow'], + OmegaLambdaNow = self.enzoParameters['CosmologyOmegaLambdaNow'], + InitialRedshift = self.enzoParameters['CosmologyInitialRedshift']) + + z_Tolerance = 1e-3 + z = self.enzoParameters['CosmologyInitialRedshift'] + index = 0 + while ((z > self.enzoParameters['CosmologyFinalRedshift']) and + (na.fabs(z-self.enzoParameters['CosmologyFinalRedshift']) > z_Tolerance)): + if index <= break_index: + t = ec.InitialTime + (self.enzoParameters['dtDataDump'] * ec.TimeUnits * index) + z = ec.ComputeRedshiftFromTime(t) + else: + t = ec.InitialTime + (self.enzoParameters['dtDataDump'] * ec.TimeUnits * (break_index)) + t += (new_dt * ec.TimeUnits * (index-break_index)) + z = ec.ComputeRedshiftFromTime(t) + filename = "%s/%s%04d/%s%04d" % (self.enzoParameters['GlobalDir'], + self.enzoParameters['DataDumpDir'], + index, + self.enzoParameters['DataDumpDir'], + index) + self.timeOutputs.append({'index':index,'redshift':z,'filename':filename}) + index += 1 + + def _CombineDataOutputs(self): "Combines redshift and time data into one sorted list." self.allOutputs = self.redshiftOutputs + self.timeOutputs @@ -686,6 +731,7 @@ if node_exists: if over_write: mylog.info("Dataset, %s, already exists, overwriting." % field_node) + write_data = True del output[field_node] else: mylog.info("Dataset, %s, already exists in %s, not saving." % (field_node,filename)) @@ -726,7 +772,7 @@ def _SetParameterDefaults(self): "Set some default parameters to avoid problems if they are not in the parameter file." - self.enzoParameters['GlobalDir'] = "" + self.enzoParameters['GlobalDir'] = "./" self.enzoParameters['RedshiftDumpName'] = "RD" self.enzoParameters['RedshiftDumpDir'] = "RD" self.enzoParameters['DataDumpName'] = "DD" @@ -737,6 +783,8 @@ self.lightConeParameters['ObserverRedshift'] = 0.0 self.lightConeParameters['OutputDir'] = "./" self.lightConeParameters['OutputPrefix'] = "LightCone" + self.lightConeParameters['dtSplit'] = None + self.lightConeParameters['dt_new'] = 0.0 EnzoParameterDict = {"CosmologyCurrentRedshift": float, "CosmologyComovingBoxSize": float, @@ -762,4 +810,6 @@ "MinimumCoherentBoxFraction": float, "MinimumSliceDeltaz": float, "OutputDir": str, - "OutputPrefix": str} + "OutputPrefix": str, + "dtSplit": float, + "dt_new": float} diff -r 90e2530efb3dc383cfb70f9600290fc7a4bcd71a -r 7fd89683add68d5819acc3332ef40daa53ebd8b1 yt/lagos/BaseDataTypes.py --- a/yt/lagos/BaseDataTypes.py Tue Jun 23 22:26:09 2009 -0700 +++ b/yt/lagos/BaseDataTypes.py Sun Jul 12 23:05:12 2009 -0700 @@ -376,7 +376,7 @@ continue mylog.info("Getting field %s from %s", field, len(self._grids)) if field not in self.hierarchy.field_list and not in_grids: - if self._generate_field(field): + if field != "dts" and self._generate_field(field): continue # True means we already assigned it self[field] = na.concatenate( [self._get_data_from_grid(grid, field) @@ -439,11 +439,13 @@ """ mylog.warning("This code is poorly tested. It may give bad data!") AMR1DData.__init__(self, pf, fields, **kwargs) - self.start_point = na.array(start_point) - self.end_point = na.array(end_point) + self.start_point = na.array(start_point, dtype='float64') + self.end_point = na.array(end_point, dtype='float64') self.vec = self.end_point - self.start_point + #self.vec /= na.sqrt(na.dot(self.vec, self.vec)) self.center = self.start_point self.set_field_parameter('center', self.start_point) + self._dts = {} #self._refresh_data() def _get_list_of_grids(self): @@ -476,14 +478,17 @@ def _get_data_from_grid(self, grid, field): mask = na.logical_and(self._get_cut_mask(grid), grid.child_mask) + if field == 'dts': return self._dts[grid.id][mask] return grid[field][mask] @cache_mask def _get_cut_mask(self, grid): mask = na.zeros(grid.ActiveDimensions, dtype='int') + dts = na.zeros(grid.ActiveDimensions, dtype='float64') import RTIntegrator as RT - RT.VoxelTraversal(mask, grid.LeftEdge, grid.RightEdge, + RT.VoxelTraversal(mask, dts, grid.LeftEdge, grid.RightEdge, grid.dds, self.center, self.vec) + self._dts[grid.id] = na.abs(dts) return mask class AMR2DData(AMRData, GridPropertiesMixin, ParallelAnalysisInterface): @@ -908,7 +913,8 @@ _con_args = ('axis', 'field', 'weight_field') def __init__(self, axis, field, weight_field = None, max_level = None, center = None, pf = None, - source=None, node_name = None, field_cuts = None, **kwargs): + source=None, node_name = None, field_cuts = None, + serialize=True,**kwargs): """ AMRProj is a projection of a *field* along an *axis*. The field can have an associated *weight_field*, in which case the values are @@ -917,6 +923,7 @@ """ AMR2DData.__init__(self, axis, field, pf, node_name = None, **kwargs) self._field_cuts = field_cuts + self.serialize = serialize self.center = center if center is not None: self.set_field_parameter('center',center) self._node_name = node_name @@ -936,7 +943,7 @@ self._temp = {} self._deserialize(node_name) self._refresh_data() - if self._okay_to_serialize: self._serialize(node_name=self._node_name) + if self._okay_to_serialize and self.serialize: self._serialize(node_name=self._node_name) def _convert_field_name(self, field): if field == "weight_field": return "weight_field_%s" % self._weight @@ -1150,7 +1157,7 @@ field_data = na.vsplit(data.pop('fields'), len(fields)) for fi, field in enumerate(fields): self[field] = field_data[fi].ravel() - self._store_fields(field, self._node_name) + if self.serialize: self._store_fields(field, self._node_name) for i in data.keys(): self[i] = data.pop(i) def add_fields(self, fields, weight = "CellMassMsun"): @@ -1212,11 +1219,11 @@ return "%s/%s" % \ (self._top_node, self.axis) -class AMRFixedResProjection(AMR2DData): +class AMRFixedResProjectionBase(AMR2DData): _top_node = "/Projections" _type_name = "fixed_res_proj" _con_args = ('axis', 'field', 'weight_field') - def __init__(self, axis, left_edge, right_edge, depth=None, + def __init__(self, axis, level, left_edge, dims, fields = None, pf=None, **kwargs): """ A projection that provides fixed resolution output, @@ -1224,13 +1231,86 @@ """ AMR2DData.__init__(self, axis, fields, pf, **kwargs) self.left_edge = na.array(left_edge) - self.right_edge = na.array(right_edge) - if depth is None: - depth = 0.5*(self.right_edge - self.left_edge).sum() - self.depth = depth + self.level = level + self.dds = self.pf.h.select_grids(self.level)[0].dds.copy() + self.dims = na.array([dims]*2) + self.ActiveDimensions = na.array([dims]*3, dtype='int32') + self.right_edge = self.left_edge + self.ActiveDimensions*self.dds + self.global_startindex = na.rint(self.left_edge/self.dds).astype('int64') + self._dls = {} + self.domain_width = na.rint((self.pf["DomainRightEdge"] - + self.pf["DomainLeftEdge"])/self.dds).astype('int64') def _get_list_of_grids(self): - pass + if self._grids is not None: return + if na.any(self.left_edge < self.pf["DomainLeftEdge"]) or \ + na.any(self.right_edge > self.pf["DomainRightEdge"]): + grids,ind = self.pf.hierarchy.get_periodic_box_grids( + self.left_edge, self.right_edge) + ind = slice(None) + else: + grids,ind = self.pf.hierarchy.get_box_grids( + self.left_edge, self.right_edge) + level_ind = (self.pf.hierarchy.gridLevels.ravel()[ind] <= self.level) + sort_ind = na.argsort(self.pf.h.gridLevels.ravel()[ind][level_ind]) + self._grids = self.pf.hierarchy.grids[ind][level_ind][(sort_ind,)][::-1] + + def _generate_coords(self): + xi, yi, zi = self.left_edge + self.dds*0.5 + xf, yf, zf = self.left_edge + self.dds*(self.ActiveDimensions-0.5) + coords = na.mgrid[xi:xf:self.ActiveDimensions[0]*1j, + yi:yf:self.ActiveDimensions[1]*1j, + zi:zf:self.ActiveDimensions[2]*1j] + xax = x_dict[self.axis] + yax = y_dict[self.axis] + self['px'] = coords[xax] + self['py'] = coords[yax] + self['pdx'] = self.dds[xax] + self['pdy'] = self.dds[yax] + + #@time_execution + def get_data(self, fields = None): + """ + Iterates over the list of fields and generates/reads them all. + """ + self._get_list_of_grids() + if not self.has_key('pdx'): + self._generate_coords() + if fields == None: + fields_to_get = self.fields[:] + else: + fields_to_get = ensure_list(fields) + temp_data = {} + for field in fields_to_get: + self[field] = na.zeros(self.dims, dtype='float64') + dls = self.__setup_dls(fields_to_get) + for grid in self._get_grids(): + self._get_data_from_grid(grid, fields_to_get, dls) + for field in fields_to_get: + self[field] = self._mpi_allsum(self[field]) + conv = self.pf.units[self.pf.field_info[field].projection_conversion] + self[field] *= conv + + def __setup_dls(self, fields): + dls = {} + for level in range(self.level+1): + dls[level] = [] + grid = self.select_grids(level)[0] + for field in fields: + if field is None: continue + dls[level].append(float(just_one(grid['d%s' % axis_names[self.axis]]))) + return dls + + def _get_data_from_grid(self, grid, fields, dls): + g_fields = [grid[field] for field in fields] + c_fields = [self[field] for field in fields] + ref_ratio = self.pf["RefineBy"]**(self.level - grid.Level) + PointCombine.FillBuffer(ref_ratio, + grid.get_global_startindex(), self.global_startindex, + c_fields, g_fields, + self.ActiveDimensions, grid.ActiveDimensions, + grid.child_mask, self.domain_width, dls[grid.Level], + self.axis) class AMR3DData(AMRData, GridPropertiesMixin): _key_fields = ['x','y','z','dx','dy','dz'] diff -r 90e2530efb3dc383cfb70f9600290fc7a4bcd71a -r 7fd89683add68d5819acc3332ef40daa53ebd8b1 yt/lagos/EnzoFields.py --- a/yt/lagos/EnzoFields.py Tue Jun 23 22:26:09 2009 -0700 +++ b/yt/lagos/EnzoFields.py Sun Jul 12 23:05:12 2009 -0700 @@ -59,7 +59,7 @@ return data["Total_Energy"] else: if data.pf["DualEnergyFormalism"]: - return data["Gas_Energy"] + return data["GasEnergy"] else: return data["Total_Energy"] - 0.5*( data["x-velocity"]**2.0 diff -r 90e2530efb3dc383cfb70f9600290fc7a4bcd71a -r 7fd89683add68d5819acc3332ef40daa53ebd8b1 yt/lagos/HierarchyType.py --- a/yt/lagos/HierarchyType.py Tue Jun 23 22:26:09 2009 -0700 +++ b/yt/lagos/HierarchyType.py Sun Jul 12 23:05:12 2009 -0700 @@ -181,6 +181,12 @@ del self._data_file self._data_file = h5py.File(self.__data_filename, self._data_mode) + def _reset_save_data(self,round_robin=False): + if round_robin: + self.save_data = self._save_data + else: + self.save_data = parallel_splitter(self._save_data, self._reload_data_file) + save_data = parallel_splitter(_save_data, _reload_data_file) def save_object(self, obj, name): @@ -205,10 +211,18 @@ if self._data_file == None: return None if node[0] != "/": node = "/%s" % node + + myGroup = self._data_file['/'] + for group in node.split('/'): + if group: + if group not in myGroup.listnames(): + return None + myGroup = myGroup[group] + if name not in myGroup.listnames(): + return None + full_name = "%s/%s" % (node, name) - if full_name not in self._data_file: - return None - return self._data_file["%s/%s" % (node, name)] + return self._data_file[full_name] def _close_data_file(self): if self._data_file: @@ -238,6 +252,8 @@ AMRSmoothedCoveringGridBase, dd) self._add_object_class('new_covering_grid', "AMRNewCoveringGrid", AMRNewCoveringGridBase, dd) + self._add_object_class('fixed_res_proj', "AMRFixedResProjection", + AMRFixedResProjectionBase, dd) self._add_object_class('sphere', "AMRSphere", AMRSphereBase, dd) self._add_object_class('cutting', "AMRCuttingPlane", AMRCuttingPlaneBase, dd) self._add_object_class('ray', "AMRRay", AMRRayBase, dd) diff -r 90e2530efb3dc383cfb70f9600290fc7a4bcd71a -r 7fd89683add68d5819acc3332ef40daa53ebd8b1 yt/lagos/PointCombine.c --- a/yt/lagos/PointCombine.c Tue Jun 23 22:26:09 2009 -0700 +++ b/yt/lagos/PointCombine.c Sun Jul 12 23:05:12 2009 -0700 @@ -1066,6 +1066,221 @@ return NULL; } +static PyObject *Py_FillBuffer(PyObject *obj, PyObject *args) +{ + PyObject *oc_data, *og_data, + *oc_start, *og_start, + *oc_dims, *og_dims, *omask, *odls; + PyObject *tg_data, *tc_data, *dw_data; + oc_data = og_data = oc_start = og_start = oc_dims = og_dims = omask = NULL; + tg_data = tc_data = dw_data = odls = NULL; + PyArrayObject **g_data, **c_data, *mask, + *g_start, *c_start, *c_dims, *g_dims, *dwa; + mask = g_start = c_start = c_dims = g_dims = NULL; + double *dls = NULL; + int refratio, ll, direction, n; + npy_int64 gxs, gys, gzs, gxe, gye, gze; + npy_int64 cxs, cys, czs, cxe, cye, cze; + npy_int64 ixs, iys, izs, ixe, iye, ize; + npy_int64 gxi, gyi, gzi, cxi, cyi, czi; + npy_int64 cdx, cdy, cdz; + npy_int64 dw[3]; + int i, axis; + int ci, cj, ck, ri, rj, rk; + int total = 0; + + if (!PyArg_ParseTuple(args, "iOOOOOOOOOi", + &refratio, &og_start, &oc_start, + &oc_data, &og_data, + &oc_dims, &og_dims, &omask, &dw_data, &odls, &axis)) + return PyErr_Format(_dataCubeError, + "DataCubeGeneric: Invalid parameters."); + + g_start = (PyArrayObject *) PyArray_FromAny(og_start, + PyArray_DescrFromType(NPY_INT64), 1, 1, 0, NULL); + if(g_start == NULL){ + PyErr_Format(_dataCubeError, "FillRegion: g_start invalid."); + goto _fail; + } + + c_start = (PyArrayObject *) PyArray_FromAny(oc_start, + PyArray_DescrFromType(NPY_INT64), 1, 1, 0, NULL); + if(c_start == NULL){ + PyErr_Format(_dataCubeError, "FillRegion: c_start invalid."); + goto _fail; + } + + g_dims = (PyArrayObject *) PyArray_FromAny(og_dims, + PyArray_DescrFromType(NPY_INT32), 1, 1, 0, NULL); + if(g_dims == NULL){ + PyErr_Format(_dataCubeError, "FillRegion: g_dims invalid."); + goto _fail; + } + + c_dims = (PyArrayObject *) PyArray_FromAny(oc_dims, + PyArray_DescrFromType(NPY_INT32), 1, 1, 0, NULL); + if(c_dims == NULL){ + PyErr_Format(_dataCubeError, "FillRegion: c_dims invalid."); + goto _fail; + } + + mask = (PyArrayObject *) PyArray_FromAny(omask, + PyArray_DescrFromType(NPY_INT32), 3, 3, 0, NULL); + if(mask == NULL){ + PyErr_Format(_dataCubeError, "FillRegion: mask invalid."); + goto _fail; + } + + dwa = (PyArrayObject *) PyArray_FromAny(dw_data, + PyArray_DescrFromType(NPY_INT64), 1, 1, 0, NULL); + if(dwa == NULL){ + PyErr_Format(_dataCubeError, "FillRegion: domain width invalid."); + goto _fail; + } + for (i=0;i<3;i++)dw[i] = *(npy_int64*) PyArray_GETPTR1(dwa, i); + + int n_fields = PyList_Size(oc_data); + if(n_fields == 0) { + PyErr_Format(_dataCubeError, + "CombineGrids: Length zero for c_data is invalid."); + goto _fail; + } + if (!PyList_Check(og_data) || (PyList_Size(og_data) != n_fields)){ + PyErr_Format(_dataCubeError, + "CombineGrids: g_data must be a list of arrays same length as c_data!"); + goto _fail; + } + if (!PyList_Check(odls) || (PyList_Size(odls) != n_fields)){ + PyErr_Format(_dataCubeError, + "CombineGrids: dls must be a list of arrays same length as c_data!"); + goto _fail; + } + + c_data = (PyArrayObject**) + malloc(sizeof(PyArrayObject*)*n_fields); + g_data = (PyArrayObject**) + malloc(sizeof(PyArrayObject*)*n_fields); + dls = (double *) malloc(sizeof(double) * n_fields); + PyObject *temp = NULL; + for (n=0;nnd != 3)) { + PyErr_Format(_dataCubeError, + "CombineGrids: Three dimensions required for g_data[%i].",n); + goto _fail; + } + tc_data = (PyObject *) PyList_GetItem(oc_data, n); + c_data[n] = (PyArrayObject *) PyArray_FromAny(tc_data, + PyArray_DescrFromType(NPY_FLOAT64), 2, 2, + NPY_UPDATEIFCOPY, NULL); + if((c_data[n]==NULL) || (c_data[n]->nd != 2)) { + PyErr_Format(_dataCubeError, + "CombineGrids: Two dimensions required for c_data[%i].",n); + goto _fail; + } + } + + /* g[xyz][se] are the start and end index in integers + of the grid, at its refinement level */ + gxs = *(npy_int64 *) PyArray_GETPTR1(og_start, 0); + gys = *(npy_int64 *) PyArray_GETPTR1(og_start, 1); + gzs = *(npy_int64 *) PyArray_GETPTR1(og_start, 2); + gxe = gxs + *(npy_int32 *) PyArray_GETPTR1(og_dims, 0); + gye = gys + *(npy_int32 *) PyArray_GETPTR1(og_dims, 1); + gze = gzs + *(npy_int32 *) PyArray_GETPTR1(og_dims, 2); + + /* c[xyz][se] are the start and end index in integers + of the covering grid, at its refinement level */ + cxs = *(npy_int64 *) PyArray_GETPTR1(oc_start, 0); + cys = *(npy_int64 *) PyArray_GETPTR1(oc_start, 1); + czs = *(npy_int64 *) PyArray_GETPTR1(oc_start, 2); + + /* cd[xyz] are the dimensions of the covering grid */ + cdx = (*(npy_int32 *) PyArray_GETPTR1(oc_dims, 0)); + cdy = (*(npy_int32 *) PyArray_GETPTR1(oc_dims, 1)); + cdz = (*(npy_int32 *) PyArray_GETPTR1(oc_dims, 2)); + cxe = (cxs + cdx - 1); + cye = (cys + cdy - 1); + cze = (czs + cdz - 1); + + /* It turns out that C89 doesn't define a mechanism for choosing the sign + of the remainder. + */ + int x_loc, y_loc; // For access into the buffer + for(cxi=cxs;cxi<=cxe;cxi++) { + ci = (cxi % dw[0]); + ci = (ci < 0) ? ci + dw[0] : ci; + if ( ci < gxs*refratio || ci >= gxe*refratio) continue; + gxi = floor(ci / refratio) - gxs; + for(cyi=cys;cyi<=cye;cyi++) { + cj = cyi % dw[1]; + cj = (cj < 0) ? cj + dw[1] : cj; + if ( cj < gys*refratio || cj >= gye*refratio) continue; + gyi = floor(cj / refratio) - gys; + for(czi=czs;czi<=cze;czi++) { + ck = czi % dw[2]; + ck = (ck < 0) ? ck + dw[2] : ck; + if ( ck < gzs*refratio || ck >= gze*refratio) continue; + gzi = floor(ck / refratio) - gzs; + if (*(npy_int32*)PyArray_GETPTR3(mask, gxi,gyi,gzi) > 0) + { + switch (axis) { + case 0: x_loc = cyi-cys; y_loc = czi-czs; break; + case 1: x_loc = cxi-cxs; y_loc = czi-czs; break; + case 2: x_loc = cxi-cys; y_loc = cyi-cys; break; + } + for(n=0;n= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyString_Type PyBytes_Type + #define PyString_CheckExact PyBytes_CheckExact #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) @@ -94,9 +103,28 @@ #ifndef __cdecl #define __cdecl #endif + #ifndef __fastcall + #define __fastcall + #endif #else #define _USE_MATH_DEFINES #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 @@ -104,7 +132,9 @@ #endif #include #define __PYX_HAVE_API__yt__lagos__RTIntegrator +#include "stdlib.h" #include "numpy/arrayobject.h" +#define __PYX_USE_C99_COMPLEX defined(_Complex_I) #ifdef __GNUC__ @@ -125,33 +155,54 @@ /* Type Conversion Predeclarations */ #if PY_MAJOR_VERSION < 3 -#define __Pyx_PyBytes_FromString PyString_FromString -#define __Pyx_PyBytes_AsString PyString_AsString +#define __Pyx_PyBytes_FromString PyString_FromString +#define __Pyx_PyBytes_FromStringAndSize PyString_FromStringAndSize +#define __Pyx_PyBytes_AsString PyString_AsString #else -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_AsString PyBytes_AsString +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +#define __Pyx_PyBytes_AsString PyBytes_AsString #endif #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) -static INLINE int __Pyx_PyObject_IsTrue(PyObject* x); -static INLINE PY_LONG_LONG __pyx_PyInt_AsLongLong(PyObject* x); -static INLINE unsigned PY_LONG_LONG __pyx_PyInt_AsUnsignedLongLong(PyObject* x); -static INLINE Py_ssize_t __pyx_PyIndex_AsSsize_t(PyObject* b); - -#define __pyx_PyInt_AsLong(x) (PyInt_CheckExact(x) ? PyInt_AS_LONG(x) : PyInt_AsLong(x)) +static INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +#if !defined(T_PYSSIZET) +#if PY_VERSION_HEX < 0x02050000 +#define T_PYSSIZET T_INT +#elif !defined(T_LONGLONG) +#define T_PYSSIZET \ + ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ + ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1)) +#else +#define T_PYSSIZET \ + ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ + ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : \ + ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))) +#endif +#endif + +#if !defined(T_SIZET) +#if !defined(T_ULONGLONG) +#define T_SIZET \ + ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1)) +#else +#define T_SIZET \ + ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : \ + ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))) +#endif +#endif + +static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) -static INLINE unsigned char __pyx_PyInt_unsigned_char(PyObject* x); -static INLINE unsigned short __pyx_PyInt_unsigned_short(PyObject* x); -static INLINE char __pyx_PyInt_char(PyObject* x); -static INLINE short __pyx_PyInt_short(PyObject* x); -static INLINE int __pyx_PyInt_int(PyObject* x); -static INLINE long __pyx_PyInt_long(PyObject* x); -static INLINE signed char __pyx_PyInt_signed_char(PyObject* x); -static INLINE signed short __pyx_PyInt_signed_short(PyObject* x); -static INLINE signed int __pyx_PyInt_signed_int(PyObject* x); -static INLINE signed long __pyx_PyInt_signed_long(PyObject* x); -static INLINE long double __pyx_PyInt_long_double(PyObject* x); + #ifdef __GNUC__ /* Test for GCC > 2.95 */ #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) @@ -176,91 +227,448 @@ static const char **__pyx_f; static char __pyx_mdoc[] = "\nSimle integrators for the radiative transfer equation\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 INLINE void __Pyx_SafeReleaseBuffer(PyObject* obj, Py_buffer* info); -static INLINE void __Pyx_ZeroBuffer(Py_buffer* buf); /*proto*/ -static INLINE const char* __Pyx_ConsumeWhitespace(const char* ts); /*proto*/ -static INLINE const char* __Pyx_BufferTypestringCheckEndian(const char* ts); /*proto*/ -static void __Pyx_BufferNdimError(Py_buffer* buffer, int expected_ndim); /*proto*/ -static const char* __Pyx_BufferTypestringCheck_item_nn___pyx_t_5numpy_float_t(const char* ts); /*proto*/ - -static int __Pyx_GetBuffer_nn___pyx_t_5numpy_float_t(PyObject* obj, Py_buffer* buf, int flags, int nd); /*proto*/ -#define __Pyx_BufPtrStrided2d(buf, i0, s0, i1, s1) ((char*)buf + i0 * s0 + i1 * s1) -#define __Pyx_BufPtrStrided3d(buf, i0, s0, i1, s1, i2, s2) ((char*)buf + i0 * s0 + i1 * s1 + i2 * s2) -#define __Pyx_BufPtrStrided1d(buf, i0, s0) ((char*)buf + i0 * s0) -static const char* __Pyx_BufferTypestringCheck_item_nn___pyx_t_5numpy_int_t(const char* ts); /*proto*/ - -static int __Pyx_GetBuffer_nn___pyx_t_5numpy_int_t(PyObject* obj, Py_buffer* buf, int flags, int nd); /*proto*/ -static const char* __Pyx_BufferTypestringCheck_item_nn___pyx_t_5numpy_float64_t(const char* ts); /*proto*/ - -static int __Pyx_GetBuffer_nn___pyx_t_5numpy_float64_t(PyObject* obj, Py_buffer* buf, int flags, int nd); /*proto*/ - -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name, int exact); /*proto*/ - -static INLINE void __Pyx_RaiseArgtupleTooLong(Py_ssize_t num_expected, Py_ssize_t num_found); /*proto*/ -#if (PY_MAJOR_VERSION < 3) && !(Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_NEWBUFFER) -static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); -static void __Pyx_ReleaseBuffer(PyObject *obj, Py_buffer *view); + + +#ifdef 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* (*NewContext)(const char*, int, const char*); + void (*FinishContext)(void**); +} __Pyx_RefnannyAPIStruct; +static __Pyx_RefnannyAPIStruct *__Pyx_Refnanny = NULL; +#define __Pyx_ImportRefcountAPI(name) (__Pyx_RefnannyAPIStruct *) PyCObject_Import((char *)name, (char *)"RefnannyAPI") +#define __Pyx_INCREF(r) __Pyx_Refnanny->INCREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_DECREF(r) __Pyx_Refnanny->DECREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_GOTREF(r) __Pyx_Refnanny->GOTREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_GIVEREF(r) __Pyx_Refnanny->GIVEREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_XDECREF(r) if((r) == NULL) ; else __Pyx_DECREF(r) +#define __Pyx_SetupRefcountContext(name) void* __pyx_refchk = __Pyx_Refnanny->NewContext((name), __LINE__, __FILE__) +#define __Pyx_FinishRefcountContext() __Pyx_Refnanny->FinishContext(&__pyx_refchk) #else -#define __Pyx_GetBuffer PyObject_GetBuffer -#define __Pyx_ReleaseBuffer PyObject_ReleaseBuffer -#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 PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ +#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) +#define __Pyx_SetupRefcountContext(name) +#define __Pyx_FinishRefcountContext() +#endif /* CYTHON_REFNANNY */ +#define __Pyx_XGIVEREF(r) if((r) == NULL) ; else __Pyx_GIVEREF(r) +#define __Pyx_XGOTREF(r) if((r) == NULL) ; else __Pyx_GOTREF(r) + +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*/ + +/* 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 INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); +static int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); +#define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1) +#define __Pyx_BufPtrStrided3d(type, buf, i0, s0, i1, s1, i2, s2) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2) + +static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ +#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ -static INLINE int __Pyx_SetItemInt(PyObject *o, Py_ssize_t i, PyObject *v, int is_unsigned) { +#define __Pyx_SetItemInt(o, i, v, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ + __Pyx_SetItemInt_Fast(o, i, v, size <= sizeof(long)) : \ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) + +static INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { int r; - if (PyList_CheckExact(o) && 0 <= i && i < PyList_GET_SIZE(o)) { + if (!j) return -1; + r = PyObject_SetItem(o, j, v); + Py_DECREF(j); + return r; +} + +static INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int fits_long) { + if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { + Py_INCREF(v); Py_DECREF(PyList_GET_ITEM(o, i)); - Py_INCREF(v); 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) || !is_unsigned)) - r = PySequence_SetItem(o, i, v); + 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 = (likely(i >= 0) || !is_unsigned) ? PyInt_FromLong(i) : PyLong_FromUnsignedLongLong((sizeof(unsigned long long) > sizeof(Py_ssize_t) ? (1ULL << (sizeof(Py_ssize_t)*8)) : 0) + i); - if (!j) - return -1; - r = PyObject_SetItem(o, j, v); - Py_DECREF(j); + PyObject *j = fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i); + return __Pyx_SetItemInt_Generic(o, j, v); + } +} + + +static 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, size <= sizeof(long)) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int fits_long) { + 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, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i)); +} + +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i, size <= sizeof(long)) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int fits_long) { + 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, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i)); +} + + +#define __Pyx_GetItemInt(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i, size <= sizeof(long)) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) { + 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, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i)); } return r; } -static INLINE PyObject *__Pyx_GetItemInt(PyObject *o, Py_ssize_t i, int is_unsigned) { - PyObject *r; - if (PyList_CheckExact(o) && 0 <= i && i < PyList_GET_SIZE(o)) { - r = PyList_GET_ITEM(o, i); - Py_INCREF(r); +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); /*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 PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +#if __PYX_USE_C99_COMPLEX + #define __Pyx_REAL_PART(z) __real__(z) + #define __Pyx_IMAG_PART(z) __imag__(z) +#else + #define __Pyx_REAL_PART(z) ((z).real) + #define __Pyx_IMAG_PART(z) ((z).imag) +#endif + +#define __pyx_PyObject_from_complex(z) PyComplex_FromDoubles((double)__Pyx_REAL_PART(z), (double)__Pyx_IMAG_PART(z)) + +#if __PYX_USE_C99_COMPLEX + + typedef float _Complex __pyx_t_float_complex; + static INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; } - else if (PyTuple_CheckExact(o) && 0 <= i && i < PyTuple_GET_SIZE(o)) { - r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); + + #define __pyx_t_float_complex_is_zero(a) ((a) == 0) + #define __pyx_t_float_complex_eq(a, b) ((a) == (b)) + #define __pyx_t_float_complex_add(a, b) ((a)+(b)) + #define __pyx_t_float_complex_sub(a, b) ((a)-(b)) + #define __pyx_t_float_complex_mul(a, b) ((a)*(b)) + #define __pyx_t_float_complex_div(a, b) ((a)/(b)) + #define __pyx_t_float_complex_neg(a) (-(a)) + +#else + + typedef struct { float real, imag; } __pyx_t_float_complex; + static INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex c; c.real = x; c.imag = y; return c; } - else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0) || !is_unsigned)) - r = PySequence_GetItem(o, i); - else { - PyObject *j = (likely(i >= 0) || !is_unsigned) ? PyInt_FromLong(i) : PyLong_FromUnsignedLongLong((sizeof(unsigned long long) > sizeof(Py_ssize_t) ? (1ULL << (sizeof(Py_ssize_t)*8)) : 0) + i); - if (!j) - return 0; - r = PyObject_GetItem(o, j); - Py_DECREF(j); + + static INLINE int __pyx_t_float_complex_is_zero(__pyx_t_float_complex a) { + return (a.real == 0) & (a.imag == 0); } - return r; -} + + static INLINE int __pyx_t_float_complex_eq(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) & (a.imag == b.imag); + } + + static INLINE __pyx_t_float_complex __pyx_t_float_complex_add(__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 INLINE __pyx_t_float_complex __pyx_t_float_complex_sub(__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 INLINE __pyx_t_float_complex __pyx_t_float_complex_mul(__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 INLINE __pyx_t_float_complex __pyx_t_float_complex_div(__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 INLINE __pyx_t_float_complex __pyx_t_float_complex_neg(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + +#endif + +#if __PYX_USE_C99_COMPLEX + + typedef double _Complex __pyx_t_double_complex; + static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + + #define __pyx_t_double_complex_is_zero(a) ((a) == 0) + #define __pyx_t_double_complex_eq(a, b) ((a) == (b)) + #define __pyx_t_double_complex_add(a, b) ((a)+(b)) + #define __pyx_t_double_complex_sub(a, b) ((a)-(b)) + #define __pyx_t_double_complex_mul(a, b) ((a)*(b)) + #define __pyx_t_double_complex_div(a, b) ((a)/(b)) + #define __pyx_t_double_complex_neg(a) (-(a)) + +#else + + typedef struct { double real, imag; } __pyx_t_double_complex; + static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex c; c.real = x; c.imag = y; return c; + } + + static INLINE int __pyx_t_double_complex_is_zero(__pyx_t_double_complex a) { + return (a.real == 0) & (a.imag == 0); + } + + static INLINE int __pyx_t_double_complex_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) & (a.imag == b.imag); + } + + static INLINE __pyx_t_double_complex __pyx_t_double_complex_add(__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 INLINE __pyx_t_double_complex __pyx_t_double_complex_sub(__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 INLINE __pyx_t_double_complex __pyx_t_double_complex_mul(__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 INLINE __pyx_t_double_complex __pyx_t_double_complex_div(__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 INLINE __pyx_t_double_complex __pyx_t_double_complex_neg(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + +#endif + +#if __PYX_USE_C99_COMPLEX + + typedef long double _Complex __pyx_t_long__double_complex; + static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_from_parts(long double x, long double y) { + return x + y*(__pyx_t_long__double_complex)_Complex_I; + } + + #define __pyx_t_long__double_complex_is_zero(a) ((a) == 0) + #define __pyx_t_long__double_complex_eq(a, b) ((a) == (b)) + #define __pyx_t_long__double_complex_add(a, b) ((a)+(b)) + #define __pyx_t_long__double_complex_sub(a, b) ((a)-(b)) + #define __pyx_t_long__double_complex_mul(a, b) ((a)*(b)) + #define __pyx_t_long__double_complex_div(a, b) ((a)/(b)) + #define __pyx_t_long__double_complex_neg(a) (-(a)) + +#else + + typedef struct { long double real, imag; } __pyx_t_long__double_complex; + static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_from_parts(long double x, long double y) { + __pyx_t_long__double_complex c; c.real = x; c.imag = y; return c; + } + + static INLINE int __pyx_t_long__double_complex_is_zero(__pyx_t_long__double_complex a) { + return (a.real == 0) & (a.imag == 0); + } + + static INLINE int __pyx_t_long__double_complex_eq(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) { + return (a.real == b.real) & (a.imag == b.imag); + } + + static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_add(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) { + __pyx_t_long__double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + + static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_sub(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) { + __pyx_t_long__double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + + static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_mul(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) { + __pyx_t_long__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 INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_div(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) { + __pyx_t_long__double_complex z; + long 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 INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_neg(__pyx_t_long__double_complex a) { + __pyx_t_long__double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + +#endif static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, long size); /*proto*/ - -static PyObject *__Pyx_ImportModule(char *name); /*proto*/ +static INLINE int __Pyx_StrEq(const char *, const char *); /*proto*/ + +static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size); /*proto*/ + +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ static void __Pyx_AddTraceback(const char *funcname); /*proto*/ @@ -288,6 +696,10 @@ typedef npy_float64 __pyx_t_5numpy_float64_t; +typedef npy_complex64 __pyx_t_5numpy_complex64_t; + +typedef npy_complex128 __pyx_t_5numpy_complex128_t; + typedef npy_long __pyx_t_5numpy_int_t; typedef npy_longlong __pyx_t_5numpy_long_t; @@ -301,64 +713,162 @@ typedef npy_double __pyx_t_5numpy_double_t; typedef npy_longdouble __pyx_t_5numpy_longdouble_t; + +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; +/* Module declarations from python_buffer */ + +/* Module declarations from stdlib */ + /* Module declarations from numpy */ /* Module declarations from numpy */ +static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; +static INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ /* Module declarations from cython */ /* Module declarations from yt.lagos.RTIntegrator */ - +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float_t = { "numpy.float_t", NULL, sizeof(__pyx_t_5numpy_float_t), 'R' }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int_t = { "numpy.int_t", NULL, sizeof(__pyx_t_5numpy_int_t), 'I' }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t = { "numpy.float64_t", NULL, sizeof(__pyx_t_5numpy_float64_t), 'R' }; +#define __Pyx_MODULE_NAME "yt.lagos.RTIntegrator" +int __pyx_module_is_main_yt__lagos__RTIntegrator = 0; /* Implementation of yt.lagos.RTIntegrator */ static PyObject *__pyx_int_3; static PyObject *__pyx_int_neg_1; static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; +static char __pyx_k___main__[] = "__main__"; +static PyObject *__pyx_kp___main__; +static char __pyx_k_i_s[] = "i_s"; +static PyObject *__pyx_kp_i_s; +static char __pyx_k_o_s[] = "o_s"; +static PyObject *__pyx_kp_o_s; +static char __pyx_k_e[] = "e"; +static PyObject *__pyx_kp_e; +static char __pyx_k_a[] = "a"; +static PyObject *__pyx_kp_a; +static char __pyx_k_imin[] = "imin"; +static PyObject *__pyx_kp_imin; +static char __pyx_k_imax[] = "imax"; +static PyObject *__pyx_kp_imax; +static char __pyx_k_jmin[] = "jmin"; +static PyObject *__pyx_kp_jmin; +static char __pyx_k_jmax[] = "jmax"; +static PyObject *__pyx_kp_jmax; +static char __pyx_k_kmin[] = "kmin"; +static PyObject *__pyx_kp_kmin; +static char __pyx_k_kmax[] = "kmax"; +static PyObject *__pyx_kp_kmax; +static char __pyx_k_istride[] = "istride"; +static PyObject *__pyx_kp_istride; +static char __pyx_k_jstride[] = "jstride"; +static PyObject *__pyx_kp_jstride; +static char __pyx_k_dx[] = "dx"; +static PyObject *__pyx_kp_dx; +static char __pyx_k_grid_mask[] = "grid_mask"; +static PyObject *__pyx_kp_grid_mask; +static char __pyx_k_grid_t[] = "grid_t"; +static PyObject *__pyx_kp_grid_t; +static char __pyx_k_left_edge[] = "left_edge"; +static PyObject *__pyx_kp_left_edge; +static char __pyx_k_right_edge[] = "right_edge"; +static PyObject *__pyx_kp_right_edge; +static char __pyx_k_u[] = "u"; +static PyObject *__pyx_kp_u; +static char __pyx_k_v[] = "v"; +static PyObject *__pyx_kp_v; static char __pyx_k_numpy[] = "numpy"; static PyObject *__pyx_kp_numpy; static char __pyx_k_np[] = "np"; static PyObject *__pyx_kp_np; +static char __pyx_k_range[] = "range"; +static PyObject *__pyx_kp_range; static char __pyx_k_ones[] = "ones"; static PyObject *__pyx_kp_ones; static char __pyx_k_dtype[] = "dtype"; static PyObject *__pyx_kp_dtype; -static char __pyx_k_17[] = "float64"; -static PyObject *__pyx_kp_17; +static char __pyx_k_31[] = "float64"; +static PyObject *__pyx_kp_31; static char __pyx_k_zeros[] = "zeros"; static PyObject *__pyx_kp_zeros; -static char __pyx_k_18[] = "int64"; -static PyObject *__pyx_kp_18; +static char __pyx_k_32[] = "int64"; +static PyObject *__pyx_kp_32; static char __pyx_k_floor[] = "floor"; static PyObject *__pyx_kp_floor; +static PyObject *__pyx_builtin_range; +static PyObject *__pyx_int_15; static char __pyx_k___getbuffer__[] = "__getbuffer__"; static PyObject *__pyx_kp___getbuffer__; +static char __pyx_k___releasebuffer__[] = "__releasebuffer__"; +static PyObject *__pyx_kp___releasebuffer__; +static char __pyx_k_info[] = "info"; +static PyObject *__pyx_kp_info; +static char __pyx_k_flags[] = "flags"; +static PyObject *__pyx_kp_flags; +static char __pyx_k_ValueError[] = "ValueError"; +static PyObject *__pyx_kp_ValueError; +static char __pyx_k_itervalues[] = "itervalues"; +static PyObject *__pyx_kp_itervalues; static char __pyx_k_RuntimeError[] = "RuntimeError"; static PyObject *__pyx_kp_RuntimeError; -static char __pyx_k_ValueError[] = "ValueError"; -static PyObject *__pyx_kp_ValueError; static PyObject *__pyx_kp_1; -static PyObject *__pyx_kp_16; +static PyObject *__pyx_kp_2; +static PyObject *__pyx_kp_5; +static PyObject *__pyx_kp_23; +static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_RuntimeError; -static PyObject *__pyx_builtin_ValueError; -static char __pyx_k_1[] = "Py_intptr_t and Py_ssize_t differs in size, numpy.pxd does not support this"; -static char __pyx_k_2[] = "b"; -static char __pyx_k_3[] = "B"; -static char __pyx_k_4[] = "h"; -static char __pyx_k_5[] = "H"; -static char __pyx_k_6[] = "i"; -static char __pyx_k_7[] = "I"; -static char __pyx_k_8[] = "l"; -static char __pyx_k_9[] = "L"; -static char __pyx_k_10[] = "q"; -static char __pyx_k_11[] = "Q"; -static char __pyx_k_12[] = "f"; -static char __pyx_k_13[] = "d"; -static char __pyx_k_14[] = "g"; -static char __pyx_k_15[] = "O"; -static char __pyx_k_16[] = "only objects, int and float dtypes supported for ndarray buffer access so far (dtype is %d)"; +static char __pyx_k_1[] = "ndarray is not C contiguous"; +static char __pyx_k_2[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_3[] = ">"; +static char __pyx_k_4[] = "<"; +static char __pyx_k_5[] = "Non-native byte order not supported"; +static char __pyx_k_6[] = "b"; +static char __pyx_k_7[] = "B"; +static char __pyx_k_8[] = "h"; +static char __pyx_k_9[] = "H"; +static char __pyx_k_10[] = "i"; +static char __pyx_k_11[] = "I"; +static char __pyx_k_12[] = "l"; +static char __pyx_k_13[] = "L"; +static char __pyx_k_14[] = "q"; +static char __pyx_k_15[] = "Q"; +static char __pyx_k_16[] = "f"; +static char __pyx_k_17[] = "d"; +static char __pyx_k_18[] = "g"; +static char __pyx_k_19[] = "Zf"; +static char __pyx_k_20[] = "Zd"; +static char __pyx_k_21[] = "Zg"; +static char __pyx_k_22[] = "O"; +static char __pyx_k_23[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_24[] = "^"; +static PyObject *__pyx_kp_25; +static PyObject *__pyx_kp_28; +static PyObject *__pyx_kp_29; +static PyObject *__pyx_kp_30; +static char __pyx_k_25[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_26[] = ">"; +static char __pyx_k_27[] = "<"; +static char __pyx_k_28[] = "Non-native byte order not supported"; +static char __pyx_k_29[] = "Format string allocated too short."; +static char __pyx_k_30[] = "unknown dtype code in numpy.pxd (%d)"; + +/* "yt/lagos/RTIntegrator.pyx":31 + * + * @cython.boundscheck(False) + * def Transfer3D(np.ndarray[np.float_t, ndim=2] i_s, # <<<<<<<<<<<<<< + * np.ndarray[np.float_t, ndim=3] o_s, + * np.ndarray[np.float_t, ndim=3] e, + */ static PyObject *__pyx_pf_2yt_5lagos_12RTIntegrator_Transfer3D(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_2yt_5lagos_12RTIntegrator_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 "; @@ -408,12 +918,7 @@ Py_ssize_t __pyx_bstride_1_i_s = 0; Py_ssize_t __pyx_bshape_0_i_s = 0; Py_ssize_t __pyx_bshape_1_i_s = 0; - PyObject *__pyx_r; - int __pyx_1; - int __pyx_2; - __pyx_t_5numpy_float_t __pyx_3; - int __pyx_4; - __pyx_t_5numpy_float_t __pyx_5; + PyObject *__pyx_r = NULL; int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; @@ -430,121 +935,333 @@ int __pyx_t_14; int __pyx_t_15; int __pyx_t_16; - static char *__pyx_argnames[] = {"i_s","o_s","e","a","imin","imax","jmin","jmax","kmin","kmax","istride","jstride","dx",0}; + int __pyx_t_17; + int __pyx_t_18; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_i_s,&__pyx_kp_o_s,&__pyx_kp_e,&__pyx_kp_a,&__pyx_kp_imin,&__pyx_kp_imax,&__pyx_kp_jmin,&__pyx_kp_jmax,&__pyx_kp_kmin,&__pyx_kp_kmax,&__pyx_kp_istride,&__pyx_kp_jstride,&__pyx_kp_dx,0}; + __Pyx_SetupRefcountContext("Transfer3D"); __pyx_self = __pyx_self; - if (likely(!__pyx_kwds) && likely(PyTuple_GET_SIZE(__pyx_args) == 13)) { + 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_kp_i_s); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_o_s); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_e); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_kp_a); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_kp_imin); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + values[5] = PyDict_GetItem(__pyx_kwds, __pyx_kp_imax); + if (likely(values[5])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 6: + values[6] = PyDict_GetItem(__pyx_kwds, __pyx_kp_jmin); + if (likely(values[6])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 7: + values[7] = PyDict_GetItem(__pyx_kwds, __pyx_kp_jmax); + if (likely(values[7])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 8: + values[8] = PyDict_GetItem(__pyx_kwds, __pyx_kp_kmin); + if (likely(values[8])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 9: + values[9] = PyDict_GetItem(__pyx_kwds, __pyx_kp_kmax); + if (likely(values[9])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 10: + values[10] = PyDict_GetItem(__pyx_kwds, __pyx_kp_istride); + if (likely(values[10])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 10); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 11: + values[11] = PyDict_GetItem(__pyx_kwds, __pyx_kp_jstride); + if (likely(values[11])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 11); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 12: + values[12] = PyDict_GetItem(__pyx_kwds, __pyx_kp_dx); + if (likely(values[12])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer3D", 1, 13, 13, 12); {__pyx_filename = __pyx_f[0]; __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), "Transfer3D") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __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[0]; __pyx_lineno = 35; __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[0]; __pyx_lineno = 35; __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[0]; __pyx_lineno = 35; __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[0]; __pyx_lineno = 35; __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[0]; __pyx_lineno = 36; __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[0]; __pyx_lineno = 36; __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[0]; __pyx_lineno = 36; __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[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_dx = __pyx_PyFloat_AsDouble(values[12]); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __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_int(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_imin == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_imax = __pyx_PyInt_int(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_imax == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_jmin = __pyx_PyInt_int(PyTuple_GET_ITEM(__pyx_args, 6)); if (unlikely((__pyx_v_jmin == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_jmax = __pyx_PyInt_int(PyTuple_GET_ITEM(__pyx_args, 7)); if (unlikely((__pyx_v_jmax == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_kmin = __pyx_PyInt_int(PyTuple_GET_ITEM(__pyx_args, 8)); if (unlikely((__pyx_v_kmin == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_kmax = __pyx_PyInt_int(PyTuple_GET_ITEM(__pyx_args, 9)); if (unlikely((__pyx_v_kmax == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_istride = __pyx_PyInt_int(PyTuple_GET_ITEM(__pyx_args, 10)); if (unlikely((__pyx_v_istride == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_jstride = __pyx_PyInt_int(PyTuple_GET_ITEM(__pyx_args, 11)); if (unlikely((__pyx_v_jstride == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __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[0]; __pyx_lineno = 35; __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[0]; __pyx_lineno = 35; __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[0]; __pyx_lineno = 35; __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[0]; __pyx_lineno = 35; __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[0]; __pyx_lineno = 36; __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[0]; __pyx_lineno = 36; __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[0]; __pyx_lineno = 36; __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[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_dx = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 12)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - else { - if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOOOiiiiiiiif", __pyx_argnames, &__pyx_v_i_s, &__pyx_v_o_s, &__pyx_v_e, &__pyx_v_a, &__pyx_v_imin, &__pyx_v_imax, &__pyx_v_jmin, &__pyx_v_jmax, &__pyx_v_kmin, &__pyx_v_kmax, &__pyx_v_istride, &__pyx_v_jstride, &__pyx_v_dx))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4; + 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[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("yt.lagos.RTIntegrator.Transfer3D"); return NULL; - __pyx_L4:; + __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[0]; __pyx_lineno = 31; __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[0]; __pyx_lineno = 32; __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[0]; __pyx_lineno = 33; __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[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_float_t((PyObject*)__pyx_v_i_s, &__pyx_bstruct_i_s, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __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_float_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __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_bshape_0_i_s = __pyx_bstruct_i_s.shape[0]; __pyx_bshape_1_i_s = __pyx_bstruct_i_s.shape[1]; - if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_float_t((PyObject*)__pyx_v_o_s, &__pyx_bstruct_o_s, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __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, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __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_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]; - if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_float_t((PyObject*)__pyx_v_e, &__pyx_bstruct_e, PyBUF_FORMAT| PyBUF_STRIDES, 3) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __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, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __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_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]; - if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_float_t((PyObject*)__pyx_v_a, &__pyx_bstruct_a, PyBUF_FORMAT| PyBUF_STRIDES, 3) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __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, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __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_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_1 = ((__pyx_v_imax - __pyx_v_imin) * __pyx_v_istride); - for (__pyx_v_i = 0; __pyx_v_i < __pyx_1; __pyx_v_i+=1) { + + /* "yt/lagos/RTIntegrator.pyx":50 + * cdef int k, kk + * cdef float temp + * for i in range((imax-imin)*istride): # <<<<<<<<<<<<<< + * ii = i + imin*istride + * for j in range((jmax-jmin)*jstride): + */ + for (__pyx_t_1 = 0; __pyx_t_1 < ((__pyx_v_imax - __pyx_v_imin) * __pyx_v_istride); __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "yt/lagos/RTIntegrator.pyx":51 + * cdef float temp + * 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)); - __pyx_2 = ((__pyx_v_jmax - __pyx_v_jmin) * __pyx_v_jstride); - for (__pyx_v_j = 0; __pyx_v_j < __pyx_2; __pyx_v_j+=1) { + + /* "yt/lagos/RTIntegrator.pyx":52 + * for i in range((imax-imin)*istride): + * ii = i + imin*istride + * for j in range((jmax-jmin)*jstride): # <<<<<<<<<<<<<< + * jj = j + jmin*jstride + * temp = i_s[ii,jj] + */ + for (__pyx_t_2 = 0; __pyx_t_2 < ((__pyx_v_jmax - __pyx_v_jmin) * __pyx_v_jstride); __pyx_t_2+=1) { + __pyx_v_j = __pyx_t_2; + + /* "yt/lagos/RTIntegrator.pyx":53 + * ii = i + imin*istride + * for j in range((jmax-jmin)*jstride): + * jj = j + jmin*jstride # <<<<<<<<<<<<<< + * temp = i_s[ii,jj] + * for k in range(kmax-kmin): + */ __pyx_v_jj = (__pyx_v_j + (__pyx_v_jmin * __pyx_v_jstride)); - __pyx_t_1 = __pyx_v_ii; - __pyx_t_2 = __pyx_v_jj; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_bshape_0_i_s; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_bshape_1_i_s; - __pyx_3 = *((__pyx_t_5numpy_float_t *)((__pyx_t_5numpy_float_t *)__Pyx_BufPtrStrided2d(__pyx_bstruct_i_s.buf, __pyx_t_1, __pyx_bstride_0_i_s, __pyx_t_2, __pyx_bstride_1_i_s))); - __pyx_v_temp = __pyx_3; - __pyx_4 = (__pyx_v_kmax - __pyx_v_kmin); - for (__pyx_v_k = 0; __pyx_v_k < __pyx_4; __pyx_v_k+=1) { - __pyx_t_3 = __pyx_v_i; - __pyx_t_4 = __pyx_v_j; - __pyx_t_5 = __pyx_v_k; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_bshape_0_e; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_bshape_1_e; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_bshape_2_e; - __pyx_3 = *((__pyx_t_5numpy_float_t *)((__pyx_t_5numpy_float_t *)__Pyx_BufPtrStrided3d(__pyx_bstruct_e.buf, __pyx_t_3, __pyx_bstride_0_e, __pyx_t_4, __pyx_bstride_1_e, __pyx_t_5, __pyx_bstride_2_e))); + + /* "yt/lagos/RTIntegrator.pyx":54 + * for j in range((jmax-jmin)*jstride): + * jj = j + jmin*jstride + * temp = i_s[ii,jj] # <<<<<<<<<<<<<< + * for k in range(kmax-kmin): + * o_s[i,j,k] = temp + dx*(e[i,j,k] - temp*a[i,j,k]) + */ + __pyx_t_3 = __pyx_v_ii; + __pyx_t_4 = __pyx_v_jj; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_bshape_0_i_s; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_bshape_1_i_s; + __pyx_v_temp = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_i_s.buf, __pyx_t_3, __pyx_bstride_0_i_s, __pyx_t_4, __pyx_bstride_1_i_s)); + + /* "yt/lagos/RTIntegrator.pyx":55 + * jj = j + jmin*jstride + * temp = i_s[ii,jj] + * for k in range(kmax-kmin): # <<<<<<<<<<<<<< + * o_s[i,j,k] = temp + dx*(e[i,j,k] - temp*a[i,j,k]) + * temp = o_s[i,j,k] + */ + for (__pyx_t_5 = 0; __pyx_t_5 < (__pyx_v_kmax - __pyx_v_kmin); __pyx_t_5+=1) { + __pyx_v_k = __pyx_t_5; + + /* "yt/lagos/RTIntegrator.pyx":56 + * temp = i_s[ii,jj] + * for k in range(kmax-kmin): + * o_s[i,j,k] = temp + dx*(e[i,j,k] - temp*a[i,j,k]) # <<<<<<<<<<<<<< + * temp = o_s[i,j,k] + * i_s[ii,jj] = temp + */ __pyx_t_6 = __pyx_v_i; __pyx_t_7 = __pyx_v_j; __pyx_t_8 = __pyx_v_k; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_bshape_0_a; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_bshape_1_a; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_bshape_2_a; - __pyx_5 = *((__pyx_t_5numpy_float_t *)((__pyx_t_5numpy_float_t *)__Pyx_BufPtrStrided3d(__pyx_bstruct_a.buf, __pyx_t_6, __pyx_bstride_0_a, __pyx_t_7, __pyx_bstride_1_a, __pyx_t_8, __pyx_bstride_2_a))); + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_bshape_0_e; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_bshape_1_e; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_bshape_2_e; __pyx_t_9 = __pyx_v_i; __pyx_t_10 = __pyx_v_j; __pyx_t_11 = __pyx_v_k; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_bshape_0_o_s; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_bshape_1_o_s; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_bshape_2_o_s; - *((__pyx_t_5numpy_float_t *)__Pyx_BufPtrStrided3d(__pyx_bstruct_o_s.buf, __pyx_t_9, __pyx_bstride_0_o_s, __pyx_t_10, __pyx_bstride_1_o_s, __pyx_t_11, __pyx_bstride_2_o_s)) = (__pyx_v_temp + (__pyx_v_dx * (__pyx_3 - (__pyx_v_temp * __pyx_5)))); + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_bshape_0_a; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_bshape_1_a; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_bshape_2_a; __pyx_t_12 = __pyx_v_i; __pyx_t_13 = __pyx_v_j; __pyx_t_14 = __pyx_v_k; if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_bshape_0_o_s; if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_bshape_1_o_s; if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_2_o_s; - __pyx_3 = *((__pyx_t_5numpy_float_t *)((__pyx_t_5numpy_float_t *)__Pyx_BufPtrStrided3d(__pyx_bstruct_o_s.buf, __pyx_t_12, __pyx_bstride_0_o_s, __pyx_t_13, __pyx_bstride_1_o_s, __pyx_t_14, __pyx_bstride_2_o_s))); - __pyx_v_temp = __pyx_3; + *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float_t *, __pyx_bstruct_o_s.buf, __pyx_t_12, __pyx_bstride_0_o_s, __pyx_t_13, __pyx_bstride_1_o_s, __pyx_t_14, __pyx_bstride_2_o_s) = (__pyx_v_temp + (__pyx_v_dx * ((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float_t *, __pyx_bstruct_e.buf, __pyx_t_6, __pyx_bstride_0_e, __pyx_t_7, __pyx_bstride_1_e, __pyx_t_8, __pyx_bstride_2_e)) - (__pyx_v_temp * (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float_t *, __pyx_bstruct_a.buf, __pyx_t_9, __pyx_bstride_0_a, __pyx_t_10, __pyx_bstride_1_a, __pyx_t_11, __pyx_bstride_2_a)))))); + + /* "yt/lagos/RTIntegrator.pyx":57 + * for k in range(kmax-kmin): + * o_s[i,j,k] = temp + dx*(e[i,j,k] - temp*a[i,j,k]) + * temp = o_s[i,j,k] # <<<<<<<<<<<<<< + * i_s[ii,jj] = temp + * + */ + __pyx_t_15 = __pyx_v_i; + __pyx_t_16 = __pyx_v_j; + __pyx_t_17 = __pyx_v_k; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_0_o_s; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_bshape_1_o_s; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_bshape_2_o_s; + __pyx_v_temp = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float_t *, __pyx_bstruct_o_s.buf, __pyx_t_15, __pyx_bstride_0_o_s, __pyx_t_16, __pyx_bstride_1_o_s, __pyx_t_17, __pyx_bstride_2_o_s)); } - __pyx_t_15 = __pyx_v_ii; - __pyx_t_16 = __pyx_v_jj; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_0_i_s; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_bshape_1_i_s; - *((__pyx_t_5numpy_float_t *)__Pyx_BufPtrStrided2d(__pyx_bstruct_i_s.buf, __pyx_t_15, __pyx_bstride_0_i_s, __pyx_t_16, __pyx_bstride_1_i_s)) = __pyx_v_temp; + + /* "yt/lagos/RTIntegrator.pyx":58 + * o_s[i,j,k] = temp + dx*(e[i,j,k] - temp*a[i,j,k]) + * temp = o_s[i,j,k] + * i_s[ii,jj] = temp # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + __pyx_t_5 = __pyx_v_ii; + __pyx_t_18 = __pyx_v_jj; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_bshape_0_i_s; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_bshape_1_i_s; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_i_s.buf, __pyx_t_5, __pyx_bstride_0_i_s, __pyx_t_18, __pyx_bstride_1_i_s) = __pyx_v_temp; } } - __pyx_r = Py_None; Py_INCREF(Py_None); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - PyErr_Fetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_a, &__pyx_bstruct_a); - __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_e, &__pyx_bstruct_e); - __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_o_s, &__pyx_bstruct_o_s); - __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_i_s, &__pyx_bstruct_i_s); - PyErr_Restore(__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_i_s); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("yt.lagos.RTIntegrator.Transfer3D"); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_a, &__pyx_bstruct_a); - __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_e, &__pyx_bstruct_e); - __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_o_s, &__pyx_bstruct_o_s); - __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_i_s, &__pyx_bstruct_i_s); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_a); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_e); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_o_s); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_i_s); __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_FinishRefcountContext(); return __pyx_r; } +/* "yt/lagos/RTIntegrator.pyx":61 + * + * @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_5lagos_12RTIntegrator_Transfer1D(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_pf_2yt_5lagos_12RTIntegrator_Transfer1D(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { float __pyx_v_i_s; @@ -567,100 +1284,224 @@ Py_buffer __pyx_bstruct_dx; Py_ssize_t __pyx_bstride_0_dx = 0; Py_ssize_t __pyx_bshape_0_dx = 0; - PyObject *__pyx_r; - __pyx_t_5numpy_float_t __pyx_1; - __pyx_t_5numpy_float_t __pyx_2; - __pyx_t_5numpy_float_t __pyx_3; - PyObject *__pyx_4 = 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 char *__pyx_argnames[] = {"i_s","o_s","e","a","dx","imin","imax",0}; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_i_s,&__pyx_kp_o_s,&__pyx_kp_e,&__pyx_kp_a,&__pyx_kp_dx,&__pyx_kp_imin,&__pyx_kp_imax,0}; + __Pyx_SetupRefcountContext("Transfer1D"); __pyx_self = __pyx_self; - if (likely(!__pyx_kwds) && likely(PyTuple_GET_SIZE(__pyx_args) == 7)) { + 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_kp_i_s); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_o_s); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer1D", 1, 7, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_e); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer1D", 1, 7, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_kp_a); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer1D", 1, 7, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_kp_dx); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer1D", 1, 7, 7, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + values[5] = PyDict_GetItem(__pyx_kwds, __pyx_kp_imin); + if (likely(values[5])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer1D", 1, 7, 7, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 6: + values[6] = PyDict_GetItem(__pyx_kwds, __pyx_kp_imax); + if (likely(values[6])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Transfer1D", 1, 7, 7, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __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[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_i_s = __pyx_PyFloat_AsDouble(values[0]); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __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[0]; __pyx_lineno = 66; __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[0]; __pyx_lineno = 66; __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(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __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_int(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_imin == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_imax = __pyx_PyInt_int(PyTuple_GET_ITEM(__pyx_args, 6)); if (unlikely((__pyx_v_imax == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __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[0]; __pyx_lineno = 66; __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[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - else { - if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "fOOOOii", __pyx_argnames, &__pyx_v_i_s, &__pyx_v_o_s, &__pyx_v_e, &__pyx_v_a, &__pyx_v_dx, &__pyx_v_imin, &__pyx_v_imax))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4; + 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[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("yt.lagos.RTIntegrator.Transfer1D"); return NULL; - __pyx_L4:; + __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[0]; __pyx_lineno = 62; __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[0]; __pyx_lineno = 63; __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[0]; __pyx_lineno = 64; __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 = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_float_t((PyObject*)__pyx_v_o_s, &__pyx_bstruct_o_s, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __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[0]; __pyx_lineno = 61; __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]; - if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_float_t((PyObject*)__pyx_v_e, &__pyx_bstruct_e, PyBUF_FORMAT| PyBUF_STRIDES, 1) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __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[0]; __pyx_lineno = 61; __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]; - if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_float_t((PyObject*)__pyx_v_a, &__pyx_bstruct_a, PyBUF_FORMAT| PyBUF_STRIDES, 1) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __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[0]; __pyx_lineno = 61; __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]; - if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_float_t((PyObject*)__pyx_v_dx, &__pyx_bstruct_dx, PyBUF_FORMAT| PyBUF_STRIDES, 1) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __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[0]; __pyx_lineno = 61; __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]; - for (__pyx_v_i = __pyx_v_imin; __pyx_v_i < __pyx_v_imax; __pyx_v_i+=1) { - __pyx_t_1 = __pyx_v_i; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_bshape_0_dx; - __pyx_1 = *((__pyx_t_5numpy_float_t *)((__pyx_t_5numpy_float_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_dx.buf, __pyx_t_1, __pyx_bstride_0_dx))); + + /* "yt/lagos/RTIntegrator.pyx":68 + * 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] + */ + for (__pyx_t_1 = __pyx_v_imin; __pyx_t_1 < __pyx_v_imax; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "yt/lagos/RTIntegrator.pyx":69 + * 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_2 = __pyx_v_i; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_bshape_0_e; - __pyx_2 = *((__pyx_t_5numpy_float_t *)((__pyx_t_5numpy_float_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_e.buf, __pyx_t_2, __pyx_bstride_0_e))); + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_bshape_0_dx; __pyx_t_3 = __pyx_v_i; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_bshape_0_a; - __pyx_3 = *((__pyx_t_5numpy_float_t *)((__pyx_t_5numpy_float_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_a.buf, __pyx_t_3, __pyx_bstride_0_a))); + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_bshape_0_e; __pyx_t_4 = __pyx_v_i; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_bshape_0_o_s; - *((__pyx_t_5numpy_float_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_o_s.buf, __pyx_t_4, __pyx_bstride_0_o_s)) = (__pyx_v_i_s + (__pyx_1 * (__pyx_2 - (__pyx_v_i_s * __pyx_3)))); + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_bshape_0_a; __pyx_t_5 = __pyx_v_i; if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_bshape_0_o_s; - __pyx_1 = *((__pyx_t_5numpy_float_t *)((__pyx_t_5numpy_float_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_o_s.buf, __pyx_t_5, __pyx_bstride_0_o_s))); - __pyx_v_i_s = __pyx_1; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float_t *, __pyx_bstruct_o_s.buf, __pyx_t_5, __pyx_bstride_0_o_s) = (__pyx_v_i_s + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float_t *, __pyx_bstruct_dx.buf, __pyx_t_2, __pyx_bstride_0_dx)) * ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float_t *, __pyx_bstruct_e.buf, __pyx_t_3, __pyx_bstride_0_e)) - (__pyx_v_i_s * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float_t *, __pyx_bstruct_a.buf, __pyx_t_4, __pyx_bstride_0_a)))))); + + /* "yt/lagos/RTIntegrator.pyx":70 + * 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_6 = __pyx_v_i; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_bshape_0_o_s; + __pyx_v_i_s = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float_t *, __pyx_bstruct_o_s.buf, __pyx_t_6, __pyx_bstride_0_o_s)); } - __pyx_4 = PyFloat_FromDouble(__pyx_v_i_s); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_4; - __pyx_4 = 0; + + /* "yt/lagos/RTIntegrator.pyx":71 + * o_s[i] = i_s + dx[i]*(e[i] - i_s*a[i]) + * i_s = o_s[i] + * return i_s # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_7 = PyFloat_FromDouble(__pyx_v_i_s); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_r = __pyx_t_7; + __pyx_t_7 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(Py_None); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_4); + __Pyx_XDECREF(__pyx_t_7); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - PyErr_Fetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_a, &__pyx_bstruct_a); - __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_e, &__pyx_bstruct_e); - __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_o_s, &__pyx_bstruct_o_s); - __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_dx, &__pyx_bstruct_dx); - PyErr_Restore(__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.lagos.RTIntegrator.Transfer1D"); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_a, &__pyx_bstruct_a); - __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_e, &__pyx_bstruct_e); - __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_o_s, &__pyx_bstruct_o_s); - __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_dx, &__pyx_bstruct_dx); + __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_FinishRefcountContext(); return __pyx_r; } +/* "yt/lagos/RTIntegrator.pyx":74 + * + * @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=1] left_edge, + */ + static PyObject *__pyx_pf_2yt_5lagos_12RTIntegrator_VoxelTraversal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_pf_2yt_5lagos_12RTIntegrator_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_left_edge = 0; PyArrayObject *__pyx_v_right_edge = 0; PyArrayObject *__pyx_v_dx = 0; @@ -672,11 +1513,12 @@ double __pyx_v_tl; double __pyx_v_tr; double __pyx_v_intersect_t; - double __pyx_v_intersect; + double __pyx_v_enter_t; 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; int __pyx_v_in_cells; Py_buffer __pyx_bstruct_right_edge; Py_ssize_t __pyx_bstride_0_right_edge = 0; @@ -700,21 +1542,20 @@ Py_buffer __pyx_bstruct_left_edge; Py_ssize_t __pyx_bstride_0_left_edge = 0; Py_ssize_t __pyx_bshape_0_left_edge = 0; - PyObject *__pyx_r; + 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; + PyObject *__pyx_r = NULL; PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; - PyObject *__pyx_4 = 0; - PyObject *__pyx_5 = 0; - __pyx_t_5numpy_float64_t __pyx_6; - int __pyx_7; - __pyx_t_5numpy_float64_t __pyx_8; - __pyx_t_5numpy_float64_t __pyx_9; - double __pyx_10; - long __pyx_11; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; int __pyx_t_4; int __pyx_t_5; int __pyx_t_6; @@ -727,7 +1568,7 @@ int __pyx_t_13; int __pyx_t_14; int __pyx_t_15; - int __pyx_t_16; + __pyx_t_5numpy_float64_t __pyx_t_16; int __pyx_t_17; int __pyx_t_18; int __pyx_t_19; @@ -735,698 +1576,3077 @@ int __pyx_t_21; int __pyx_t_22; int __pyx_t_23; - long __pyx_t_24; - long __pyx_t_25; - long __pyx_t_26; - long __pyx_t_27; - long __pyx_t_28; - long __pyx_t_29; - long __pyx_t_30; - long __pyx_t_31; - long __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; - static char *__pyx_argnames[] = {"grid_mask","left_edge","right_edge","dx","u","v",0}; + 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; + long __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; + int __pyx_t_42; + int __pyx_t_43; + PyObject *__pyx_t_44 = NULL; + int __pyx_t_45; + int __pyx_t_46; + int __pyx_t_47; + int __pyx_t_48; + int __pyx_t_49; + int __pyx_t_50; + double __pyx_t_51; + static PyObject **__pyx_pyargnames[] = {&__pyx_kp_grid_mask,&__pyx_kp_grid_t,&__pyx_kp_left_edge,&__pyx_kp_right_edge,&__pyx_kp_dx,&__pyx_kp_u,&__pyx_kp_v,0}; + __Pyx_SetupRefcountContext("VoxelTraversal"); __pyx_self = __pyx_self; - if (likely(!__pyx_kwds) && likely(PyTuple_GET_SIZE(__pyx_args) == 6)) { + 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_kp_grid_mask); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_grid_t); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("VoxelTraversal", 1, 7, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_left_edge); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("VoxelTraversal", 1, 7, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_kp_right_edge); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("VoxelTraversal", 1, 7, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_kp_dx); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("VoxelTraversal", 1, 7, 7, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + values[5] = PyDict_GetItem(__pyx_kwds, __pyx_kp_u); + if (likely(values[5])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("VoxelTraversal", 1, 7, 7, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 6: + values[6] = PyDict_GetItem(__pyx_kwds, __pyx_kp_v); + if (likely(values[6])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("VoxelTraversal", 1, 7, 7, 6); {__pyx_filename = __pyx_f[0]; __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), "VoxelTraversal") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_grid_mask = ((PyArrayObject *)values[0]); + __pyx_v_grid_t = ((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_u = ((PyArrayObject *)values[5]); + __pyx_v_v = ((PyArrayObject *)values[6]); + } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { + goto __pyx_L5_argtuple_error; + } else { __pyx_v_grid_mask = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_left_edge = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_right_edge = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_dx = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); - __pyx_v_u = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); - __pyx_v_v = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 5)); + __pyx_v_grid_t = ((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_u = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 5)); + __pyx_v_v = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 6)); } - else { - if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOOOOO", __pyx_argnames, &__pyx_v_grid_mask, &__pyx_v_left_edge, &__pyx_v_right_edge, &__pyx_v_dx, &__pyx_v_u, &__pyx_v_v))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4; + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("VoxelTraversal", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("yt.lagos.RTIntegrator.VoxelTraversal"); return NULL; - __pyx_L4:; + __pyx_L4_argument_unpacking_done:; + __pyx_bstruct_grid_mask.buf = NULL; + __pyx_bstruct_grid_t.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[0]; __pyx_lineno = 74; __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[0]; __pyx_lineno = 75; __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[0]; __pyx_lineno = 76; __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 = 77; __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[0]; __pyx_lineno = 78; __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[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_int_t((PyObject*)__pyx_v_grid_mask, &__pyx_bstruct_grid_mask, PyBUF_FORMAT| PyBUF_STRIDES, 3) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __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[0]; __pyx_lineno = 75; __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[0]; __pyx_lineno = 76; __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[0]; __pyx_lineno = 77; __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 = 78; __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[0]; __pyx_lineno = 79; __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[0]; __pyx_lineno = 80; __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, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __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]; - if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_float64_t((PyObject*)__pyx_v_left_edge, &__pyx_bstruct_left_edge, PyBUF_FORMAT| PyBUF_STRIDES, 1) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __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, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __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_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[0]; __pyx_lineno = 74; __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]; - if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_float64_t((PyObject*)__pyx_v_right_edge, &__pyx_bstruct_right_edge, PyBUF_FORMAT| PyBUF_STRIDES, 1) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __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[0]; __pyx_lineno = 74; __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]; - if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_float64_t((PyObject*)__pyx_v_dx, &__pyx_bstruct_dx, PyBUF_FORMAT| PyBUF_STRIDES, 1) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __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 = 74; __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]; - if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_float64_t((PyObject*)__pyx_v_u, &__pyx_bstruct_u, PyBUF_FORMAT| PyBUF_STRIDES, 1) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __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[0]; __pyx_lineno = 74; __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]; - if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_float64_t((PyObject*)__pyx_v_v, &__pyx_bstruct_v, PyBUF_FORMAT| PyBUF_STRIDES, 1) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __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[0]; __pyx_lineno = 74; __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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_ones); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_int_3); - __pyx_3 = PyDict_New(); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_kp_17); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - if (PyDict_SetItem(__pyx_3, __pyx_kp_dtype, __pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_4 = PyEval_CallObjectWithKeywords(__pyx_2, ((PyObject *)__pyx_1), ((PyObject *)__pyx_3)); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - if (!(__Pyx_TypeTest(__pyx_4, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_step = ((PyArrayObject *)__pyx_4); - __pyx_4 = 0; - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_5, __pyx_kp_zeros); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_int_3); - __pyx_3 = PyDict_New(); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_kp_18); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - if (PyDict_SetItem(__pyx_3, __pyx_kp_dtype, __pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_4 = PyEval_CallObjectWithKeywords(__pyx_2, ((PyObject *)__pyx_1), ((PyObject *)__pyx_3)); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - if (!(__Pyx_TypeTest(__pyx_4, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_cur_ind = ((PyArrayObject *)__pyx_4); - __pyx_4 = 0; - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_5, __pyx_kp_zeros); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_int_3); - __pyx_3 = PyDict_New(); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_kp_17); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - if (PyDict_SetItem(__pyx_3, __pyx_kp_dtype, __pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_4 = PyEval_CallObjectWithKeywords(__pyx_2, ((PyObject *)__pyx_1), ((PyObject *)__pyx_3)); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - if (!(__Pyx_TypeTest(__pyx_4, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_tdelta = ((PyArrayObject *)__pyx_4); - __pyx_4 = 0; - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_5, __pyx_kp_zeros); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_int_3); - __pyx_3 = PyDict_New(); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_kp_17); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - if (PyDict_SetItem(__pyx_3, __pyx_kp_dtype, __pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_4 = PyEval_CallObjectWithKeywords(__pyx_2, ((PyObject *)__pyx_1), ((PyObject *)__pyx_3)); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - if (!(__Pyx_TypeTest(__pyx_4, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_tmax = ((PyArrayObject *)__pyx_4); - __pyx_4 = 0; - __pyx_v_intersect_t = 1e30; - for (__pyx_v_i = 0; __pyx_v_i < 3; __pyx_v_i+=1) { - __pyx_t_1 = __pyx_v_i; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_bshape_0_v; - __pyx_6 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_v.buf, __pyx_t_1, __pyx_bstride_0_v))); - __pyx_7 = (__pyx_6 < 0); - if (__pyx_7) { - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_step), __pyx_v_i, __pyx_int_neg_1, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; - } - __pyx_L7:; - __pyx_v_x = ((__pyx_v_i + 1) % 3); - __pyx_v_y = ((__pyx_v_i + 2) % 3); - __pyx_t_2 = __pyx_v_i; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_bshape_0_left_edge; - __pyx_6 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_left_edge.buf, __pyx_t_2, __pyx_bstride_0_left_edge))); - __pyx_t_3 = __pyx_v_i; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_bshape_0_u; - __pyx_8 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_u.buf, __pyx_t_3, __pyx_bstride_0_u))); - __pyx_t_4 = __pyx_v_i; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_bshape_0_v; - __pyx_9 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_v.buf, __pyx_t_4, __pyx_bstride_0_v))); - __pyx_v_tl = ((__pyx_6 - __pyx_8) / __pyx_9); + + /* "yt/lagos/RTIntegrator.pyx":86 + * cdef int i, x, y + * cdef double tl, tr, intersect_t, enter_t, exit_t + * cdef np.ndarray step = np.ones(3, dtype=np.float64) # maybe just ints? # <<<<<<<<<<<<<< + * cdef np.ndarray cur_ind = np.zeros(3, dtype=np.int64) # maybe just ints? + * cdef np.ndarray tdelta = np.zeros(3, dtype=np.float64) + */ + __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_ones); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_3); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_2, __pyx_kp_31); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + if (PyDict_SetItem(__pyx_1, __pyx_kp_dtype, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; + if (!(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_step = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "yt/lagos/RTIntegrator.pyx":87 + * cdef double tl, tr, intersect_t, enter_t, exit_t + * cdef np.ndarray step = np.ones(3, dtype=np.float64) # maybe just ints? + * cdef np.ndarray cur_ind = np.zeros(3, dtype=np.int64) # maybe just ints? # <<<<<<<<<<<<<< + * cdef np.ndarray tdelta = np.zeros(3, dtype=np.float64) + * cdef np.ndarray tmax = np.zeros(3, dtype=np.float64) + */ + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_2, __pyx_kp_zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_3); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_1 = PyObject_GetAttr(__pyx_2, __pyx_kp_32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + if (PyDict_SetItem(__pyx_1, __pyx_kp_dtype, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; + if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_cur_ind = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "yt/lagos/RTIntegrator.pyx":88 + * cdef np.ndarray step = np.ones(3, dtype=np.float64) # maybe just ints? + * cdef np.ndarray cur_ind = np.zeros(3, dtype=np.int64) # maybe just ints? + * cdef np.ndarray tdelta = np.zeros(3, dtype=np.float64) # <<<<<<<<<<<<<< + * cdef np.ndarray tmax = np.zeros(3, dtype=np.float64) + * cdef np.ndarray intersect = np.zeros(3, dtype=np.float64) + */ + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_1 = PyObject_GetAttr(__pyx_2, __pyx_kp_zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_3); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_2, __pyx_kp_31); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + if (PyDict_SetItem(__pyx_1, __pyx_kp_dtype, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; + if (!(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_tdelta = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "yt/lagos/RTIntegrator.pyx":89 + * cdef np.ndarray cur_ind = np.zeros(3, dtype=np.int64) # maybe just ints? + * cdef np.ndarray tdelta = np.zeros(3, dtype=np.float64) + * cdef np.ndarray tmax = np.zeros(3, dtype=np.float64) # <<<<<<<<<<<<<< + * cdef np.ndarray intersect = np.zeros(3, dtype=np.float64) + * intersect_t = 1 + */ + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_2, __pyx_kp_zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_3); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_1 = PyObject_GetAttr(__pyx_2, __pyx_kp_31); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + if (PyDict_SetItem(__pyx_1, __pyx_kp_dtype, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; + if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_tmax = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "yt/lagos/RTIntegrator.pyx":90 + * cdef np.ndarray tdelta = np.zeros(3, dtype=np.float64) + * cdef np.ndarray tmax = np.zeros(3, dtype=np.float64) + * cdef np.ndarray intersect = np.zeros(3, dtype=np.float64) # <<<<<<<<<<<<<< + * intersect_t = 1 + * # recall p = v * t + u + */ + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_1 = PyObject_GetAttr(__pyx_2, __pyx_kp_zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_3); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_1)); + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_2, __pyx_kp_31); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + if (PyDict_SetItem(__pyx_1, __pyx_kp_dtype, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; + if (!(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_intersect = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "yt/lagos/RTIntegrator.pyx":91 + * cdef np.ndarray tmax = np.zeros(3, dtype=np.float64) + * cdef np.ndarray intersect = np.zeros(3, dtype=np.float64) + * intersect_t = 1 # <<<<<<<<<<<<<< + * # recall p = v * t + u + * # where p is position, v is our vector, u is the start point + */ + __pyx_v_intersect_t = 1; + + /* "yt/lagos/RTIntegrator.pyx":94 + * # 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_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "yt/lagos/RTIntegrator.pyx":96 + * for i in range(3): + * # As long as we're iterating, set some other stuff, too + * if (v[i] < 0): step[i] = -1 # <<<<<<<<<<<<<< + * x = (i+1)%3 + * y = (i+2)%3 + */ __pyx_t_5 = __pyx_v_i; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_bshape_0_right_edge; - __pyx_6 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_right_edge.buf, __pyx_t_5, __pyx_bstride_0_right_edge))); - __pyx_t_6 = __pyx_v_i; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_bshape_0_u; - __pyx_8 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_u.buf, __pyx_t_6, __pyx_bstride_0_u))); - __pyx_t_7 = __pyx_v_i; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_bshape_0_v; - __pyx_9 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_v.buf, __pyx_t_7, __pyx_bstride_0_v))); - __pyx_v_tr = ((__pyx_6 - __pyx_8) / __pyx_9); - __pyx_t_8 = __pyx_v_x; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_bshape_0_left_edge; - __pyx_6 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_left_edge.buf, __pyx_t_8, __pyx_bstride_0_left_edge))); - __pyx_t_9 = __pyx_v_x; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_bshape_0_u; - __pyx_8 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_u.buf, __pyx_t_9, __pyx_bstride_0_u))); - __pyx_t_10 = __pyx_v_x; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_bshape_0_v; - __pyx_9 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_v.buf, __pyx_t_10, __pyx_bstride_0_v))); - __pyx_10 = (__pyx_8 + (__pyx_v_tl * __pyx_9)); - __pyx_7 = (__pyx_6 <= __pyx_10); - if (__pyx_7) { - __pyx_t_11 = __pyx_v_x; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_bshape_0_right_edge; - __pyx_8 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_right_edge.buf, __pyx_t_11, __pyx_bstride_0_right_edge))); - __pyx_7 = (__pyx_10 < __pyx_8); - } - if (__pyx_7) { - __pyx_t_12 = __pyx_v_y; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_bshape_0_left_edge; - __pyx_9 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_left_edge.buf, __pyx_t_12, __pyx_bstride_0_left_edge))); - __pyx_t_13 = __pyx_v_y; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_bshape_0_u; - __pyx_6 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_u.buf, __pyx_t_13, __pyx_bstride_0_u))); - __pyx_t_14 = __pyx_v_y; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_0_v; - __pyx_8 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_v.buf, __pyx_t_14, __pyx_bstride_0_v))); - __pyx_10 = (__pyx_6 + (__pyx_v_tl * __pyx_8)); - __pyx_7 = (__pyx_9 <= __pyx_10); - if (__pyx_7) { - __pyx_t_15 = __pyx_v_y; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_0_right_edge; - __pyx_6 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_right_edge.buf, __pyx_t_15, __pyx_bstride_0_right_edge))); - __pyx_7 = (__pyx_10 < __pyx_6); - } - if (__pyx_7) { - __pyx_7 = (0 <= __pyx_v_tl); - if (__pyx_7) { - __pyx_7 = (__pyx_v_tl < __pyx_v_intersect_t); - } - } - } - if (__pyx_7) { - __pyx_v_intersect_t = __pyx_v_tl; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_bshape_0_v; + __pyx_t_6 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_5, __pyx_bstride_0_v)) < 0); + if (__pyx_t_6) { + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_step), __pyx_v_i, __pyx_int_neg_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L8; } __pyx_L8:; - __pyx_t_16 = __pyx_v_x; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_bshape_0_left_edge; - __pyx_8 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_left_edge.buf, __pyx_t_16, __pyx_bstride_0_left_edge))); - __pyx_t_17 = __pyx_v_x; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_bshape_0_u; - __pyx_9 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_u.buf, __pyx_t_17, __pyx_bstride_0_u))); - __pyx_t_18 = __pyx_v_x; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_bshape_0_v; - __pyx_6 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_v.buf, __pyx_t_18, __pyx_bstride_0_v))); - __pyx_10 = (__pyx_9 + (__pyx_v_tr * __pyx_6)); - __pyx_7 = (__pyx_8 <= __pyx_10); - if (__pyx_7) { - __pyx_t_19 = __pyx_v_x; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_bshape_0_right_edge; - __pyx_9 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_right_edge.buf, __pyx_t_19, __pyx_bstride_0_right_edge))); - __pyx_7 = (__pyx_10 < __pyx_9); + + /* "yt/lagos/RTIntegrator.pyx":97 + * # As long as we're iterating, set some other stuff, too + * if (v[i] < 0): step[i] = -1 + * x = (i+1)%3 # <<<<<<<<<<<<<< + * y = (i+2)%3 + * tl = (left_edge[i] - u[i])/v[i] + */ + __pyx_v_x = ((__pyx_v_i + 1) % 3); + + /* "yt/lagos/RTIntegrator.pyx":98 + * if (v[i] < 0): 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_v_i + 2) % 3); + + /* "yt/lagos/RTIntegrator.pyx":99 + * 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_7 = __pyx_v_i; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_bshape_0_left_edge; + __pyx_t_8 = __pyx_v_i; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_bshape_0_u; + __pyx_t_9 = __pyx_v_i; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_bshape_0_v; + __pyx_v_tl = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_7, __pyx_bstride_0_left_edge)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_8, __pyx_bstride_0_u))) / (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_9, __pyx_bstride_0_v))); + + /* "yt/lagos/RTIntegrator.pyx":100 + * 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_10 = __pyx_v_i; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_bshape_0_right_edge; + __pyx_t_11 = __pyx_v_i; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_bshape_0_u; + __pyx_t_12 = __pyx_v_i; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_bshape_0_v; + __pyx_v_tr = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_10, __pyx_bstride_0_right_edge)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_11, __pyx_bstride_0_u))) / (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_12, __pyx_bstride_0_v))); + + /* "yt/lagos/RTIntegrator.pyx":101 + * 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 <= tl < intersect_t): + */ + __pyx_t_13 = __pyx_v_x; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_bshape_0_left_edge; + __pyx_t_14 = __pyx_v_x; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_0_u; + __pyx_t_15 = __pyx_v_x; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_0_v; + __pyx_t_16 = ((*__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)))); + __pyx_t_6 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_13, __pyx_bstride_0_left_edge)) <= __pyx_t_16); + if (__pyx_t_6) { + __pyx_t_17 = __pyx_v_x; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_bshape_0_right_edge; + __pyx_t_6 = (__pyx_t_16 <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_17, __pyx_bstride_0_right_edge))); } - if (__pyx_7) { + if (__pyx_t_6) { + + /* "yt/lagos/RTIntegrator.pyx":102 + * 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 <= tl < intersect_t): + * intersect_t = tl + */ + __pyx_t_18 = __pyx_v_y; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_bshape_0_left_edge; + __pyx_t_19 = __pyx_v_y; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_bshape_0_u; __pyx_t_20 = __pyx_v_y; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_bshape_0_left_edge; - __pyx_6 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_left_edge.buf, __pyx_t_20, __pyx_bstride_0_left_edge))); - __pyx_t_21 = __pyx_v_y; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_bshape_0_u; - __pyx_8 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_u.buf, __pyx_t_21, __pyx_bstride_0_u))); - __pyx_t_22 = __pyx_v_y; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_bshape_0_v; - __pyx_9 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_v.buf, __pyx_t_22, __pyx_bstride_0_v))); - __pyx_10 = (__pyx_8 + (__pyx_v_tr * __pyx_9)); - __pyx_7 = (__pyx_6 <= __pyx_10); - if (__pyx_7) { - __pyx_t_23 = __pyx_v_y; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_bshape_0_right_edge; - __pyx_8 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_right_edge.buf, __pyx_t_23, __pyx_bstride_0_right_edge))); - __pyx_7 = (__pyx_10 < __pyx_8); + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_bshape_0_v; + __pyx_t_16 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_19, __pyx_bstride_0_u)) + (__pyx_v_tl * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_20, __pyx_bstride_0_v)))); + __pyx_t_21 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_18, __pyx_bstride_0_left_edge)) <= __pyx_t_16); + if (__pyx_t_21) { + __pyx_t_22 = __pyx_v_y; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_bshape_0_right_edge; + __pyx_t_21 = (__pyx_t_16 <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_22, __pyx_bstride_0_right_edge))); } - if (__pyx_7) { - __pyx_7 = (0 <= __pyx_v_tr); - if (__pyx_7) { - __pyx_7 = (__pyx_v_tr < __pyx_v_intersect_t); + if (__pyx_t_21) { + + /* "yt/lagos/RTIntegrator.pyx":103 + * 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 <= tl < intersect_t): # <<<<<<<<<<<<<< + * intersect_t = tl + * if (left_edge[x] <= (u[x] + tr*v[x]) <= right_edge[x]) and \ + */ + __pyx_t_23 = (0 <= __pyx_v_tl); + if (__pyx_t_23) { + __pyx_t_23 = (__pyx_v_tl < __pyx_v_intersect_t); } + __pyx_t_24 = __pyx_t_23; + } else { + __pyx_t_24 = __pyx_t_21; } + __pyx_t_21 = __pyx_t_24; + } else { + __pyx_t_21 = __pyx_t_6; } - if (__pyx_7) { - __pyx_v_intersect_t = __pyx_v_tr; + if (__pyx_t_21) { + + /* "yt/lagos/RTIntegrator.pyx":104 + * (left_edge[y] <= (u[y] + tl*v[y]) <= right_edge[y]) and \ + * (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:; + + /* "yt/lagos/RTIntegrator.pyx":105 + * (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 <= tr < intersect_t): + */ + __pyx_t_25 = __pyx_v_x; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_bshape_0_left_edge; + __pyx_t_26 = __pyx_v_x; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_bshape_0_u; + __pyx_t_27 = __pyx_v_x; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_bshape_0_v; + __pyx_t_16 = ((*__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)))); + __pyx_t_21 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_25, __pyx_bstride_0_left_edge)) <= __pyx_t_16); + if (__pyx_t_21) { + __pyx_t_28 = __pyx_v_x; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_bshape_0_right_edge; + __pyx_t_21 = (__pyx_t_16 <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_28, __pyx_bstride_0_right_edge))); + } + if (__pyx_t_21) { + + /* "yt/lagos/RTIntegrator.pyx":106 + * 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 <= tr < intersect_t): + * intersect_t = tr + */ + __pyx_t_29 = __pyx_v_y; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_bshape_0_left_edge; + __pyx_t_30 = __pyx_v_y; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_bshape_0_u; + __pyx_t_31 = __pyx_v_y; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_bshape_0_v; + __pyx_t_16 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_30, __pyx_bstride_0_u)) + (__pyx_v_tr * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_31, __pyx_bstride_0_v)))); + __pyx_t_6 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_29, __pyx_bstride_0_left_edge)) <= __pyx_t_16); + if (__pyx_t_6) { + __pyx_t_32 = __pyx_v_y; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_bshape_0_right_edge; + __pyx_t_6 = (__pyx_t_16 <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_32, __pyx_bstride_0_right_edge))); + } + if (__pyx_t_6) { + + /* "yt/lagos/RTIntegrator.pyx":107 + * 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 <= tr < intersect_t): # <<<<<<<<<<<<<< + * intersect_t = tr + * # if fully enclosed + */ + __pyx_t_24 = (0 <= __pyx_v_tr); + if (__pyx_t_24) { + __pyx_t_24 = (__pyx_v_tr < __pyx_v_intersect_t); + } + __pyx_t_23 = __pyx_t_24; + } else { + __pyx_t_23 = __pyx_t_6; + } + __pyx_t_6 = __pyx_t_23; + } else { + __pyx_t_6 = __pyx_t_21; + } + if (__pyx_t_6) { + + /* "yt/lagos/RTIntegrator.pyx":108 + * (left_edge[y] <= (u[y] + tr*v[y]) <= right_edge[y]) and \ + * (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:; } - __pyx_t_24 = 0; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_bshape_0_left_edge; - __pyx_9 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_left_edge.buf, __pyx_t_24, __pyx_bstride_0_left_edge))); - __pyx_t_25 = 0; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_bshape_0_u; - __pyx_6 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_u.buf, __pyx_t_25, __pyx_bstride_0_u))); - __pyx_7 = (__pyx_9 <= __pyx_6); - if (__pyx_7) { - __pyx_t_26 = 0; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_bshape_0_right_edge; - __pyx_8 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_right_edge.buf, __pyx_t_26, __pyx_bstride_0_right_edge))); - __pyx_7 = (__pyx_6 <= __pyx_8); + + /* "yt/lagos/RTIntegrator.pyx":110 + * 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_33 = 0; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_bshape_0_left_edge; + __pyx_t_34 = 0; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_bshape_0_u; + __pyx_t_16 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_34, __pyx_bstride_0_u)); + __pyx_t_6 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_33, __pyx_bstride_0_left_edge)) <= __pyx_t_16); + if (__pyx_t_6) { + __pyx_t_35 = 0; + if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_bshape_0_right_edge; + __pyx_t_6 = (__pyx_t_16 <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_35, __pyx_bstride_0_right_edge))); } - if (__pyx_7) { - __pyx_t_27 = 1; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_bshape_0_left_edge; - __pyx_9 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_left_edge.buf, __pyx_t_27, __pyx_bstride_0_left_edge))); - __pyx_t_28 = 1; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_bshape_0_u; - __pyx_6 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_u.buf, __pyx_t_28, __pyx_bstride_0_u))); - __pyx_7 = (__pyx_9 <= __pyx_6); - if (__pyx_7) { - __pyx_t_29 = 1; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_bshape_0_right_edge; - __pyx_8 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_right_edge.buf, __pyx_t_29, __pyx_bstride_0_right_edge))); - __pyx_7 = (__pyx_6 <= __pyx_8); + if (__pyx_t_6) { + + /* "yt/lagos/RTIntegrator.pyx":111 + * # 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 + */ + __pyx_t_36 = 1; + if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_bshape_0_left_edge; + __pyx_t_37 = 1; + if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_bshape_0_u; + __pyx_t_16 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_37, __pyx_bstride_0_u)); + __pyx_t_21 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_36, __pyx_bstride_0_left_edge)) <= __pyx_t_16); + if (__pyx_t_21) { + __pyx_t_38 = 1; + if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_bshape_0_right_edge; + __pyx_t_21 = (__pyx_t_16 <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_38, __pyx_bstride_0_right_edge))); } - if (__pyx_7) { - __pyx_t_30 = 2; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_bshape_0_left_edge; - __pyx_9 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_left_edge.buf, __pyx_t_30, __pyx_bstride_0_left_edge))); - __pyx_t_31 = 2; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_bshape_0_u; - __pyx_6 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_u.buf, __pyx_t_31, __pyx_bstride_0_u))); - __pyx_7 = (__pyx_9 <= __pyx_6); - if (__pyx_7) { - __pyx_t_32 = 2; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_bshape_0_right_edge; - __pyx_8 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_right_edge.buf, __pyx_t_32, __pyx_bstride_0_right_edge))); - __pyx_7 = (__pyx_6 <= __pyx_8); + if (__pyx_t_21) { + + /* "yt/lagos/RTIntegrator.pyx":112 + * 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 + * if intersect_t > 1: return + */ + __pyx_t_39 = 2; + if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_bshape_0_left_edge; + __pyx_t_40 = 2; + if (__pyx_t_40 < 0) __pyx_t_40 += __pyx_bshape_0_u; + __pyx_t_16 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_40, __pyx_bstride_0_u)); + __pyx_t_23 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_39, __pyx_bstride_0_left_edge)) <= __pyx_t_16); + if (__pyx_t_23) { + __pyx_t_41 = 2; + if (__pyx_t_41 < 0) __pyx_t_41 += __pyx_bshape_0_right_edge; + __pyx_t_23 = (__pyx_t_16 <= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_right_edge.buf, __pyx_t_41, __pyx_bstride_0_right_edge))); } + __pyx_t_24 = __pyx_t_23; + } else { + __pyx_t_24 = __pyx_t_21; } + __pyx_t_21 = __pyx_t_24; + } else { + __pyx_t_21 = __pyx_t_6; } - if (__pyx_7) { + if (__pyx_t_21) { + + /* "yt/lagos/RTIntegrator.pyx":113 + * (left_edge[1] <= u[1] <= right_edge[1]) and \ + * (left_edge[2] <= u[2] <= right_edge[2]): + * intersect_t = 0 # <<<<<<<<<<<<<< + * if intersect_t > 1: return + * # Now get the indices of the intersection + */ __pyx_v_intersect_t = 0; - goto __pyx_L10; - } - __pyx_L10:; - __pyx_7 = (__pyx_v_intersect_t > 1e29); - if (__pyx_7) { - __pyx_r = Py_None; Py_INCREF(Py_None); - goto __pyx_L0; goto __pyx_L11; } __pyx_L11:; - for (__pyx_v_i = 0; __pyx_v_i < 3; __pyx_v_i+=1) { - __pyx_t_33 = __pyx_v_i; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_bshape_0_u; - __pyx_9 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_u.buf, __pyx_t_33, __pyx_bstride_0_u))); - __pyx_t_34 = __pyx_v_i; - if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_bshape_0_v; - __pyx_6 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_v.buf, __pyx_t_34, __pyx_bstride_0_v))); - __pyx_v_intersect = (__pyx_9 + (__pyx_v_intersect_t * __pyx_6)); - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_5, __pyx_kp_floor); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_t_35 = __pyx_v_i; - if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_bshape_0_left_edge; - __pyx_8 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_left_edge.buf, __pyx_t_35, __pyx_bstride_0_left_edge))); - __pyx_t_36 = __pyx_v_i; - if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_bshape_0_dx; - __pyx_9 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_dx.buf, __pyx_t_36, __pyx_bstride_0_dx))); - __pyx_1 = PyFloat_FromDouble(((__pyx_v_intersect - __pyx_8) / __pyx_9)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1); - __pyx_1 = 0; - __pyx_4 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_cur_ind), __pyx_v_i, __pyx_4, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_step), __pyx_v_i, 0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyObject_RichCompare(__pyx_5, __pyx_int_0, Py_GT); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_7 = __Pyx_PyObject_IsTrue(__pyx_1); if (unlikely(__pyx_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - if (__pyx_7) { - __pyx_2 = PyFloat_FromDouble(__pyx_v_intersect); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), __pyx_v_i, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_4 = PyNumber_Add(__pyx_3, __pyx_int_1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_t_37 = __pyx_v_i; - if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_bshape_0_dx; - __pyx_6 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_dx.buf, __pyx_t_37, __pyx_bstride_0_dx))); - __pyx_5 = PyFloat_FromDouble(__pyx_6); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyNumber_Multiply(__pyx_4, __pyx_5); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_3 = PyNumber_Subtract(__pyx_2, __pyx_1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_1); __pyx_1 = 0; - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_tdelta), __pyx_v_i, __pyx_3, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - goto __pyx_L14; - } - __pyx_L14:; - __pyx_4 = __Pyx_GetItemInt(((PyObject *)__pyx_v_step), __pyx_v_i, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = PyObject_RichCompare(__pyx_4, __pyx_int_0, Py_LT); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_7 = __Pyx_PyObject_IsTrue(__pyx_5); if (unlikely(__pyx_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - if (__pyx_7) { - __pyx_2 = PyFloat_FromDouble(__pyx_v_intersect); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), __pyx_v_i, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_38 = __pyx_v_i; - if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_bshape_0_dx; - __pyx_8 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_dx.buf, __pyx_t_38, __pyx_bstride_0_dx))); - __pyx_3 = PyFloat_FromDouble(__pyx_8); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_4 = PyNumber_Multiply(__pyx_1, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_5 = PyNumber_Subtract(__pyx_2, __pyx_4); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_4); __pyx_4 = 0; - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_tdelta), __pyx_v_i, __pyx_5, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; + + /* "yt/lagos/RTIntegrator.pyx":114 + * (left_edge[2] <= u[2] <= right_edge[2]): + * intersect_t = 0 + * if intersect_t > 1: return # <<<<<<<<<<<<<< + * # Now get the indices of the intersection + * intersect = u + intersect_t * v + */ + __pyx_t_21 = (__pyx_v_intersect_t > 1); + if (__pyx_t_21) { + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L12; + } + __pyx_L12:; + + /* "yt/lagos/RTIntegrator.pyx":116 + * if 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] - left_edge[i])/dx[i]) + */ + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_intersect_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, ((PyObject *)__pyx_v_v)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Add(((PyObject *)__pyx_v_u), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_intersect)); + __pyx_v_intersect = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "yt/lagos/RTIntegrator.pyx":117 + * # Now get the indices of the intersection + * intersect = u + intersect_t * v + * for i in range(3): # <<<<<<<<<<<<<< + * cur_ind[i] = np.floor((intersect[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_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "yt/lagos/RTIntegrator.pyx":118 + * intersect = u + intersect_t * v + * for i in range(3): + * cur_ind[i] = np.floor((intersect[i] - left_edge[i])/dx[i]) # <<<<<<<<<<<<<< + * tmax[i] = (((cur_ind[i]+step[i])*dx[i])+left_edge[i]-u[i])/v[i] + * if step[i] < 0: cur_ind[i] -= 1 + */ + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_2, __pyx_kp_floor); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_intersect), __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_42 = __pyx_v_i; + if (__pyx_t_42 < 0) __pyx_t_42 += __pyx_bshape_0_left_edge; + __pyx_t_2 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_42, __pyx_bstride_0_left_edge))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyNumber_Subtract(__pyx_1, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_43 = __pyx_v_i; + if (__pyx_t_43 < 0) __pyx_t_43 += __pyx_bshape_0_dx; + __pyx_t_2 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dx.buf, __pyx_t_43, __pyx_bstride_0_dx))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_44 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_44); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_44); + __Pyx_GIVEREF(__pyx_t_44); + __pyx_t_44 = 0; + __pyx_t_44 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_44); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_cur_ind), __pyx_v_i, __pyx_t_44, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_44); __pyx_t_44 = 0; + + /* "yt/lagos/RTIntegrator.pyx":119 + * for i in range(3): + * cur_ind[i] = np.floor((intersect[i] - left_edge[i])/dx[i]) + * tmax[i] = (((cur_ind[i]+step[i])*dx[i])+left_edge[i]-u[i])/v[i] # <<<<<<<<<<<<<< + * if step[i] < 0: cur_ind[i] -= 1 + * tdelta[i] = abs(dx[i]/v[i]) + */ + __pyx_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_step), __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_44 = PyNumber_Add(__pyx_2, __pyx_1); if (unlikely(!__pyx_t_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_44); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_45 = __pyx_v_i; + if (__pyx_t_45 < 0) __pyx_t_45 += __pyx_bshape_0_dx; + __pyx_t_2 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dx.buf, __pyx_t_45, __pyx_bstride_0_dx))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Multiply(__pyx_t_44, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_44); __pyx_t_44 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_46 = __pyx_v_i; + if (__pyx_t_46 < 0) __pyx_t_46 += __pyx_bshape_0_left_edge; + __pyx_t_2 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_left_edge.buf, __pyx_t_46, __pyx_bstride_0_left_edge))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_44 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_44); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_47 = __pyx_v_i; + if (__pyx_t_47 < 0) __pyx_t_47 += __pyx_bshape_0_u; + __pyx_t_2 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_u.buf, __pyx_t_47, __pyx_bstride_0_u))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Subtract(__pyx_t_44, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_44); __pyx_t_44 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_48 = __pyx_v_i; + if (__pyx_t_48 < 0) __pyx_t_48 += __pyx_bshape_0_v; + __pyx_t_2 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_48, __pyx_bstride_0_v))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_44 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_44); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_tmax), __pyx_v_i, __pyx_t_44, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_44); __pyx_t_44 = 0; + + /* "yt/lagos/RTIntegrator.pyx":120 + * cur_ind[i] = np.floor((intersect[i] - left_edge[i])/dx[i]) + * tmax[i] = (((cur_ind[i]+step[i])*dx[i])+left_edge[i]-u[i])/v[i] + * if step[i] < 0: cur_ind[i] -= 1 # <<<<<<<<<<<<<< + * tdelta[i] = abs(dx[i]/v[i]) + * # The variable intersect contains the point we first pierce the grid + */ + __pyx_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_step), __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_44 = PyObject_RichCompare(__pyx_2, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_44); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_t_44); if (unlikely(__pyx_t_21 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_44); __pyx_t_44 = 0; + if (__pyx_t_21) { + __pyx_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_1 = PyNumber_InPlaceSubtract(__pyx_2, __pyx_int_1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_cur_ind), __pyx_v_i, __pyx_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; goto __pyx_L15; } __pyx_L15:; - __pyx_t_39 = __pyx_v_i; - if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_bshape_0_dx; - __pyx_9 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_dx.buf, __pyx_t_39, __pyx_bstride_0_dx))); - __pyx_t_40 = __pyx_v_i; - if (__pyx_t_40 < 0) __pyx_t_40 += __pyx_bshape_0_v; - __pyx_6 = *((__pyx_t_5numpy_float64_t *)((__pyx_t_5numpy_float64_t *)__Pyx_BufPtrStrided1d(__pyx_bstruct_v.buf, __pyx_t_40, __pyx_bstride_0_v))); - __pyx_1 = PyFloat_FromDouble((__pyx_9 / __pyx_6)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_tmax), __pyx_v_i, __pyx_1, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + + /* "yt/lagos/RTIntegrator.pyx":121 + * tmax[i] = (((cur_ind[i]+step[i])*dx[i])+left_edge[i]-u[i])/v[i] + * if step[i] < 0: cur_ind[i] -= 1 + * tdelta[i] = abs(dx[i]/v[i]) # <<<<<<<<<<<<<< + * # The variable intersect contains the point we first pierce the grid + * enter_t = intersect_t + */ + __pyx_t_49 = __pyx_v_i; + if (__pyx_t_49 < 0) __pyx_t_49 += __pyx_bshape_0_dx; + __pyx_t_50 = __pyx_v_i; + if (__pyx_t_50 < 0) __pyx_t_50 += __pyx_bshape_0_v; + __pyx_t_44 = PyFloat_FromDouble(((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_dx.buf, __pyx_t_49, __pyx_bstride_0_dx)) / (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_v.buf, __pyx_t_50, __pyx_bstride_0_v)))); if (unlikely(!__pyx_t_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_44); + __pyx_t_2 = PyNumber_Absolute(__pyx_t_44); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_44); __pyx_t_44 = 0; + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_tdelta), __pyx_v_i, __pyx_t_2, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } + + /* "yt/lagos/RTIntegrator.pyx":123 + * tdelta[i] = abs(dx[i]/v[i]) + * # The variable intersect contains the point we first pierce the grid + * enter_t = intersect_t # <<<<<<<<<<<<<< + * cdef int in_cells = 1 + * while 1: + */ + __pyx_v_enter_t = __pyx_v_intersect_t; + + /* "yt/lagos/RTIntegrator.pyx":124 + * # The variable intersect contains the point we first pierce the grid + * enter_t = intersect_t + * cdef int in_cells = 1 # <<<<<<<<<<<<<< + * while 1: + * if not (0 <= cur_ind[0] < grid_mask.shape[0]) or \ + */ __pyx_v_in_cells = 1; + + /* "yt/lagos/RTIntegrator.pyx":125 + * enter_t = intersect_t + * cdef int in_cells = 1 + * 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) { - __pyx_11 = 1; - if (!__pyx_11) break; - __pyx_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), 0, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_4 = PyInt_FromLong((__pyx_v_grid_mask->dimensions[0])); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyObject_RichCompare(__pyx_2, __pyx_4, Py_GE); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_7 = __Pyx_PyObject_IsTrue(__pyx_3); if (unlikely(__pyx_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (!__pyx_7) { - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), 1, 0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyInt_FromLong((__pyx_v_grid_mask->dimensions[1])); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyObject_RichCompare(__pyx_5, __pyx_1, Py_GE); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_7 = __Pyx_PyObject_IsTrue(__pyx_3); if (unlikely(__pyx_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (!__pyx_7) { - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), 2, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_4 = PyInt_FromLong((__pyx_v_grid_mask->dimensions[2])); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyObject_RichCompare(__pyx_2, __pyx_4, Py_GE); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_4); __pyx_4 = 0; + __pyx_t_21 = 1; + if (!__pyx_t_21) break; + + /* "yt/lagos/RTIntegrator.pyx":126 + * cdef int in_cells = 1 + * 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_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), 0, sizeof(long), PyInt_FromLong); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_2 = PyObject_RichCompare(__pyx_int_0, __pyx_2, Py_LE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_PyObject_IsTrue(__pyx_t_2)) { + __Pyx_DECREF(__pyx_t_2); + __pyx_t_44 = PyInt_FromLong((__pyx_v_grid_mask->dimensions[0])); if (unlikely(!__pyx_t_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_44); + __pyx_t_2 = PyObject_RichCompare(__pyx_2, __pyx_t_44, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_44); __pyx_t_44 = 0; + } + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_21 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(!__pyx_t_21)) { + + /* "yt/lagos/RTIntegrator.pyx":127 + * 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_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), 1, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_2 = PyObject_RichCompare(__pyx_int_0, __pyx_1, Py_LE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_PyObject_IsTrue(__pyx_t_2)) { + __Pyx_DECREF(__pyx_t_2); + __pyx_t_44 = PyInt_FromLong((__pyx_v_grid_mask->dimensions[1])); if (unlikely(!__pyx_t_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_44); + __pyx_t_2 = PyObject_RichCompare(__pyx_1, __pyx_t_44, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_44); __pyx_t_44 = 0; } + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(!__pyx_t_6)) { + + /* "yt/lagos/RTIntegrator.pyx":128 + * 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 + * else: + */ + __pyx_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), 2, sizeof(long), PyInt_FromLong); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_2 = PyObject_RichCompare(__pyx_int_0, __pyx_2, Py_LE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_PyObject_IsTrue(__pyx_t_2)) { + __Pyx_DECREF(__pyx_t_2); + __pyx_t_44 = PyInt_FromLong((__pyx_v_grid_mask->dimensions[2])); if (unlikely(!__pyx_t_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_44); + __pyx_t_2 = PyObject_RichCompare(__pyx_2, __pyx_t_44, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_44); __pyx_t_44 = 0; + } + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_24 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_24 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_23 = (!__pyx_t_24); + } else { + __pyx_t_23 = (!__pyx_t_6); + } + __pyx_t_6 = __pyx_t_23; + } else { + __pyx_t_6 = (!__pyx_t_21); } - __pyx_7 = __Pyx_PyObject_IsTrue(__pyx_3); if (unlikely(__pyx_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - if (__pyx_7) { - goto __pyx_L17; + if (__pyx_t_6) { + + /* "yt/lagos/RTIntegrator.pyx":129 + * not (0 <= cur_ind[1] < grid_mask.shape[1]) or \ + * not (0 <= cur_ind[2] < grid_mask.shape[2]): + * break # <<<<<<<<<<<<<< + * else: + * grid_mask[cur_ind[0], cur_ind[1], cur_ind[2]] = 1 + */ + goto __pyx_L17_break; goto __pyx_L18; } /*else*/ { - __pyx_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), 0, 0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), 1, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), 2, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_4 = PyTuple_New(3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_4, 0, __pyx_5); - PyTuple_SET_ITEM(__pyx_4, 1, __pyx_1); - PyTuple_SET_ITEM(__pyx_4, 2, __pyx_2); - __pyx_5 = 0; + + /* "yt/lagos/RTIntegrator.pyx":131 + * break + * else: + * grid_mask[cur_ind[0], cur_ind[1], cur_ind[2]] = 1 # <<<<<<<<<<<<<< + * # Note that we are calculating t on the fly, but we get *negative* t + * # values from what they should be. + */ + __pyx_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), 0, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), 1, sizeof(long), PyInt_FromLong); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), 2, sizeof(long), PyInt_FromLong); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_2); + __Pyx_GIVEREF(__pyx_2); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_3); + __Pyx_GIVEREF(__pyx_3); __pyx_1 = 0; __pyx_2 = 0; - if (PyObject_SetItem(((PyObject *)__pyx_v_grid_mask), ((PyObject *)__pyx_4), __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; + __pyx_3 = 0; + if (PyObject_SetItem(((PyObject *)__pyx_v_grid_mask), ((PyObject *)__pyx_t_2), __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; } __pyx_L18:; - __pyx_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tmax), 0, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tmax), 1, 0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyObject_RichCompare(__pyx_3, __pyx_5, Py_LT); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_7 = __Pyx_PyObject_IsTrue(__pyx_1); if (unlikely(__pyx_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - if (__pyx_7) { - __pyx_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tmax), 0, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_4 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tmax), 2, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyObject_RichCompare(__pyx_2, __pyx_4, Py_LT); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_7 = __Pyx_PyObject_IsTrue(__pyx_3); if (unlikely(__pyx_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - if (__pyx_7) { - __pyx_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_step), 0, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), 0, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = PyNumber_InPlaceAdd(__pyx_2, __pyx_1); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_cur_ind), 0, __pyx_5, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tdelta), 0, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tmax), 0, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_4 = PyNumber_InPlaceAdd(__pyx_1, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_1); __pyx_1 = 0; - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_tmax), 0, __pyx_4, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - goto __pyx_L20; + + /* "yt/lagos/RTIntegrator.pyx":135 + * # values from what they should be. + * # If we've reached t = 1, we are done. + * if tmax[0] > 1 and tmax[1] > 1 and tmax[2] > 1: # <<<<<<<<<<<<<< + * break + * if tmax[0] < tmax[1]: + */ + __pyx_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tmax), 0, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_2 = PyObject_RichCompare(__pyx_1, __pyx_int_1, Py_GT); 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_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_6) { + __pyx_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tmax), 1, sizeof(long), PyInt_FromLong); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_2 = PyObject_RichCompare(__pyx_2, __pyx_int_1, Py_GT); 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_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_21 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_21) { + __pyx_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tmax), 2, sizeof(long), PyInt_FromLong); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_t_2 = PyObject_RichCompare(__pyx_3, __pyx_int_1, Py_GT); 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_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_t_23 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_23 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_24 = __pyx_t_23; + } else { + __pyx_t_24 = __pyx_t_21; } - /*else*/ { - __pyx_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_step), 2, 0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), 2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyNumber_InPlaceAdd(__pyx_3, __pyx_5); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_cur_ind), 2, __pyx_2, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_4 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tdelta), 2, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tmax), 2, 0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyNumber_InPlaceAdd(__pyx_5, __pyx_4); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - Py_DECREF(__pyx_5); __pyx_5 = 0; - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_tmax), 2, __pyx_1, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - } - __pyx_L20:; + __pyx_t_21 = __pyx_t_24; + } else { + __pyx_t_21 = __pyx_t_6; + } + if (__pyx_t_21) { + + /* "yt/lagos/RTIntegrator.pyx":136 + * # If we've reached t = 1, we are done. + * if tmax[0] > 1 and tmax[1] > 1 and tmax[2] > 1: + * break # <<<<<<<<<<<<<< + * if tmax[0] < tmax[1]: + * if tmax[0] < tmax[2]: + */ + goto __pyx_L17_break; goto __pyx_L19; } - /*else*/ { - __pyx_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tmax), 1, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tmax), 2, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_4 = PyObject_RichCompare(__pyx_3, __pyx_2, Py_LT); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_7 = __Pyx_PyObject_IsTrue(__pyx_4); if (unlikely(__pyx_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - if (__pyx_7) { - __pyx_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_step), 1, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), 1, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = PyNumber_InPlaceAdd(__pyx_3, __pyx_1); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_cur_ind), 1, __pyx_5, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_4 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tdelta), 1, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tmax), 1, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyNumber_InPlaceAdd(__pyx_1, __pyx_4); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - Py_DECREF(__pyx_1); __pyx_1 = 0; - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_tmax), 1, __pyx_2, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_L19:; + + /* "yt/lagos/RTIntegrator.pyx":137 + * if tmax[0] > 1 and tmax[1] > 1 and tmax[2] > 1: + * break + * if tmax[0] < tmax[1]: # <<<<<<<<<<<<<< + * if tmax[0] < tmax[2]: + * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[0] - enter_t + */ + __pyx_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tmax), 0, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tmax), 1, sizeof(long), PyInt_FromLong); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_2 = PyObject_RichCompare(__pyx_1, __pyx_2, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_21 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_21) { + + /* "yt/lagos/RTIntegrator.pyx":138 + * break + * if tmax[0] < tmax[1]: + * if tmax[0] < tmax[2]: # <<<<<<<<<<<<<< + * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[0] - enter_t + * enter_t = tmax[0] + */ + __pyx_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tmax), 0, sizeof(long), PyInt_FromLong); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tmax), 2, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_2 = PyObject_RichCompare(__pyx_3, __pyx_1, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_21 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_21) { + + /* "yt/lagos/RTIntegrator.pyx":139 + * if tmax[0] < tmax[1]: + * if tmax[0] < tmax[2]: + * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[0] - enter_t # <<<<<<<<<<<<<< + * enter_t = tmax[0] + * tmax[0] += tdelta[0] + */ + __pyx_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tmax), 0, sizeof(long), PyInt_FromLong); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_enter_t); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_44 = PyNumber_Subtract(__pyx_2, __pyx_t_2); if (unlikely(!__pyx_t_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_44); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), 0, sizeof(long), PyInt_FromLong); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), 1, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), 2, sizeof(long), PyInt_FromLong); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_3); + __Pyx_GIVEREF(__pyx_3); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_2); + __Pyx_GIVEREF(__pyx_2); + __pyx_3 = 0; + __pyx_1 = 0; + __pyx_2 = 0; + if (PyObject_SetItem(((PyObject *)__pyx_v_grid_t), ((PyObject *)__pyx_t_2), __pyx_t_44) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_44); __pyx_t_44 = 0; + + /* "yt/lagos/RTIntegrator.pyx":140 + * if tmax[0] < tmax[2]: + * grid_t[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_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tmax), 0, sizeof(long), PyInt_FromLong); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_t_51 = __pyx_PyFloat_AsDouble(__pyx_3); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_v_enter_t = __pyx_t_51; + + /* "yt/lagos/RTIntegrator.pyx":141 + * grid_t[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_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tdelta), 0, sizeof(long), PyInt_FromLong); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tmax), 0, sizeof(long), PyInt_FromLong); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_1 = PyNumber_InPlaceAdd(__pyx_3, __pyx_2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_tmax), 0, __pyx_1, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + + /* "yt/lagos/RTIntegrator.pyx":142 + * 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]] = tmax[2] - enter_t + */ + __pyx_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_step), 0, sizeof(long), PyInt_FromLong); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), 0, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_2 = PyNumber_InPlaceAdd(__pyx_1, __pyx_3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_cur_ind), 0, __pyx_2, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; goto __pyx_L21; } /*else*/ { - __pyx_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_step), 2, 0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_4 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), 2, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyNumber_InPlaceAdd(__pyx_4, __pyx_5); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - Py_DECREF(__pyx_4); __pyx_4 = 0; - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_cur_ind), 2, __pyx_3, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tdelta), 2, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tmax), 2, 0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyNumber_InPlaceAdd(__pyx_5, __pyx_2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_5); __pyx_5 = 0; - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_tmax), 2, __pyx_1, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + + /* "yt/lagos/RTIntegrator.pyx":144 + * cur_ind[0] += step[0] + * else: + * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[2] - enter_t # <<<<<<<<<<<<<< + * enter_t = tmax[2] + * tmax[2] += tdelta[2] + */ + __pyx_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tmax), 2, sizeof(long), PyInt_FromLong); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_t_44 = PyFloat_FromDouble(__pyx_v_enter_t); if (unlikely(!__pyx_t_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_44); + __pyx_t_2 = PyNumber_Subtract(__pyx_3, __pyx_t_44); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(__pyx_t_44); __pyx_t_44 = 0; + __pyx_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), 0, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), 1, sizeof(long), PyInt_FromLong); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), 2, sizeof(long), PyInt_FromLong); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_t_44 = PyTuple_New(3); if (unlikely(!__pyx_t_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_44)); + PyTuple_SET_ITEM(__pyx_t_44, 0, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + PyTuple_SET_ITEM(__pyx_t_44, 1, __pyx_2); + __Pyx_GIVEREF(__pyx_2); + PyTuple_SET_ITEM(__pyx_t_44, 2, __pyx_3); + __Pyx_GIVEREF(__pyx_3); + __pyx_1 = 0; + __pyx_2 = 0; + __pyx_3 = 0; + if (PyObject_SetItem(((PyObject *)__pyx_v_grid_t), ((PyObject *)__pyx_t_44), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_44)); __pyx_t_44 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "yt/lagos/RTIntegrator.pyx":145 + * else: + * grid_t[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_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tmax), 2, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_51 = __pyx_PyFloat_AsDouble(__pyx_1); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_v_enter_t = __pyx_t_51; + + /* "yt/lagos/RTIntegrator.pyx":146 + * grid_t[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_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tdelta), 2, sizeof(long), PyInt_FromLong); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tmax), 2, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_2 = PyNumber_InPlaceAdd(__pyx_1, __pyx_3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_tmax), 2, __pyx_2, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + + /* "yt/lagos/RTIntegrator.pyx":147 + * enter_t = tmax[2] + * tmax[2] += tdelta[2] + * cur_ind[2] += step[2] # <<<<<<<<<<<<<< + * else: + * if tmax[1] < tmax[2]: + */ + __pyx_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_step), 2, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), 2, sizeof(long), PyInt_FromLong); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = PyNumber_InPlaceAdd(__pyx_2, __pyx_1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_cur_ind), 2, __pyx_3, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; } __pyx_L21:; + goto __pyx_L20; } - __pyx_L19:; + /*else*/ { + + /* "yt/lagos/RTIntegrator.pyx":149 + * cur_ind[2] += step[2] + * else: + * if tmax[1] < tmax[2]: # <<<<<<<<<<<<<< + * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[1] - enter_t + * enter_t = tmax[1] + */ + __pyx_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tmax), 1, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tmax), 2, sizeof(long), PyInt_FromLong); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_2 = PyObject_RichCompare(__pyx_1, __pyx_2, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_21 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_21) { + + /* "yt/lagos/RTIntegrator.pyx":150 + * else: + * if tmax[1] < tmax[2]: + * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[1] - enter_t # <<<<<<<<<<<<<< + * enter_t = tmax[1] + * tmax[1] += tdelta[1] + */ + __pyx_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tmax), 1, sizeof(long), PyInt_FromLong); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_enter_t); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_44 = PyNumber_Subtract(__pyx_3, __pyx_t_2); if (unlikely(!__pyx_t_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_44); + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), 0, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), 1, sizeof(long), PyInt_FromLong); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), 2, sizeof(long), PyInt_FromLong); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_2); + __Pyx_GIVEREF(__pyx_2); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_3); + __Pyx_GIVEREF(__pyx_3); + __pyx_1 = 0; + __pyx_2 = 0; + __pyx_3 = 0; + if (PyObject_SetItem(((PyObject *)__pyx_v_grid_t), ((PyObject *)__pyx_t_2), __pyx_t_44) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_44); __pyx_t_44 = 0; + + /* "yt/lagos/RTIntegrator.pyx":151 + * if tmax[1] < tmax[2]: + * grid_t[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_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tmax), 1, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_51 = __pyx_PyFloat_AsDouble(__pyx_1); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_v_enter_t = __pyx_t_51; + + /* "yt/lagos/RTIntegrator.pyx":152 + * grid_t[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_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tdelta), 1, sizeof(long), PyInt_FromLong); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tmax), 1, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_2 = PyNumber_InPlaceAdd(__pyx_1, __pyx_3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_tmax), 1, __pyx_2, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + + /* "yt/lagos/RTIntegrator.pyx":153 + * 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]] = tmax[2] - enter_t + */ + __pyx_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_step), 1, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), 1, sizeof(long), PyInt_FromLong); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = PyNumber_InPlaceAdd(__pyx_2, __pyx_1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_cur_ind), 1, __pyx_3, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + goto __pyx_L22; + } + /*else*/ { + + /* "yt/lagos/RTIntegrator.pyx":155 + * cur_ind[1] += step[1] + * else: + * grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[2] - enter_t # <<<<<<<<<<<<<< + * enter_t = tmax[2] + * tmax[2] += tdelta[2] + */ + __pyx_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tmax), 2, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_44 = PyFloat_FromDouble(__pyx_v_enter_t); if (unlikely(!__pyx_t_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_44); + __pyx_t_2 = PyNumber_Subtract(__pyx_1, __pyx_t_44); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_t_44); __pyx_t_44 = 0; + __pyx_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), 0, sizeof(long), PyInt_FromLong); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), 1, sizeof(long), PyInt_FromLong); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), 2, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_t_44 = PyTuple_New(3); if (unlikely(!__pyx_t_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_44)); + PyTuple_SET_ITEM(__pyx_t_44, 0, __pyx_2); + __Pyx_GIVEREF(__pyx_2); + PyTuple_SET_ITEM(__pyx_t_44, 1, __pyx_3); + __Pyx_GIVEREF(__pyx_3); + PyTuple_SET_ITEM(__pyx_t_44, 2, __pyx_1); + __Pyx_GIVEREF(__pyx_1); + __pyx_2 = 0; + __pyx_3 = 0; + __pyx_1 = 0; + if (PyObject_SetItem(((PyObject *)__pyx_v_grid_t), ((PyObject *)__pyx_t_44), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_44)); __pyx_t_44 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "yt/lagos/RTIntegrator.pyx":156 + * else: + * grid_t[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_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tmax), 2, sizeof(long), PyInt_FromLong); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_t_51 = __pyx_PyFloat_AsDouble(__pyx_2); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_v_enter_t = __pyx_t_51; + + /* "yt/lagos/RTIntegrator.pyx":157 + * grid_t[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_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tdelta), 2, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __pyx_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_tmax), 2, sizeof(long), PyInt_FromLong); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = PyNumber_InPlaceAdd(__pyx_2, __pyx_1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_tmax), 2, __pyx_3, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + + /* "yt/lagos/RTIntegrator.pyx":158 + * enter_t = tmax[2] + * tmax[2] += tdelta[2] + * cur_ind[2] += step[2] # <<<<<<<<<<<<<< + * return + */ + __pyx_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_step), 2, sizeof(long), PyInt_FromLong); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_2); + __pyx_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_cur_ind), 2, sizeof(long), PyInt_FromLong); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_3); + __pyx_1 = PyNumber_InPlaceAdd(__pyx_3, __pyx_2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_cur_ind), 2, __pyx_1, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + } + __pyx_L22:; + } + __pyx_L20:; } - __pyx_L17:; - __pyx_r = Py_None; Py_INCREF(Py_None); + __pyx_L17_break:; + + /* "yt/lagos/RTIntegrator.pyx":159 + * tmax[2] += tdelta[2] + * cur_ind[2] += step[2] + * return # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(Py_None); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_1); - Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_3); - Py_XDECREF(__pyx_4); - Py_XDECREF(__pyx_5); + __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_3); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_44); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - PyErr_Fetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_right_edge, &__pyx_bstruct_right_edge); - __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_grid_mask, &__pyx_bstruct_grid_mask); - __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_u, &__pyx_bstruct_u); - __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_dx, &__pyx_bstruct_dx); - __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_v, &__pyx_bstruct_v); - __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_left_edge, &__pyx_bstruct_left_edge); - PyErr_Restore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_right_edge); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_mask); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_u); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dx); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_v); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edge); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_t); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("yt.lagos.RTIntegrator.VoxelTraversal"); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_right_edge, &__pyx_bstruct_right_edge); - __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_grid_mask, &__pyx_bstruct_grid_mask); - __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_u, &__pyx_bstruct_u); - __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_dx, &__pyx_bstruct_dx); - __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_v, &__pyx_bstruct_v); - __Pyx_SafeReleaseBuffer((PyObject*)__pyx_v_left_edge, &__pyx_bstruct_left_edge); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_right_edge); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_mask); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_u); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dx); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_v); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_left_edge); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_grid_t); __pyx_L2:; - Py_XDECREF(__pyx_v_step); - Py_XDECREF(__pyx_v_cur_ind); - Py_XDECREF(__pyx_v_tdelta); - Py_XDECREF(__pyx_v_tmax); + __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_FinishRefcountContext(); return __pyx_r; } +/* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":65 + * # 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 int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_v_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_1; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - __pyx_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); - if (__pyx_1) { - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_kp_1); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_kp_1); - __pyx_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - __Pyx_Raise(__pyx_3, 0, 0); - Py_DECREF(__pyx_3); __pyx_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + char *__pyx_t_7; + __Pyx_SetupRefcountContext("__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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":71 + * # 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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":72 + * 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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":74 + * 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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":76 + * 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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":77 + * + * 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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":79 + * 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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":81 + * copy_shape = 0 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError("ndarray is not C contiguous") + */ + if (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS)) { + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":82 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError("ndarray is not C contiguous") + * + */ + __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + } else { + __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); + } + if (__pyx_t_1) { + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":83 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError("ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_kp_1); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_1); + __Pyx_GIVEREF(__pyx_kp_1); + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":85 + * raise ValueError("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("ndarray is not Fortran contiguous") + */ + if (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS)) { + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":86 + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError("ndarray is not Fortran contiguous") + * + */ + __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + } else { + __pyx_t_1 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); + } + if (__pyx_t_1) { + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":87 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError("ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_kp_2); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_2); + __Pyx_GIVEREF(__pyx_kp_2); + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":89 + * raise ValueError("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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":90 + * + * 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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":91 + * 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. + */ + __pyx_t_4 = __pyx_v_copy_shape; + if (__pyx_t_4) { + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":94 + * # 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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":95 + * # 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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":96 + * 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] + */ + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_v_ndim; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":97 + * 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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":98 + * 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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":100 + * 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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":101 + * 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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":102 + * 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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":103 + * 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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":104 + * 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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":107 + * + * 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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":108 + * 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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":112 + * 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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":114 + * cdef bint hasfields = PyDataType_HASFIELDS(descr) + * + * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< + * # do not call releasebuffer + * info.obj = None + */ + if ((!__pyx_v_hasfields)) { + __pyx_t_1 = (!__pyx_v_copy_shape); + } else { + __pyx_t_1 = (!__pyx_v_hasfields); + } + if (__pyx_t_1) { + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":116 + * 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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":119 + * 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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":121 + * 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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":122 + * + * 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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":123 + * if not hasfields: + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError("Non-native byte order not supported") + */ + if ((__pyx_v_descr->byteorder == '>')) { + __pyx_t_1 = __pyx_v_little_endian; + } else { + __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); + } + if (!__pyx_t_1) { + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":124 + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError("Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + */ + if ((__pyx_v_descr->byteorder == '<')) { + __pyx_t_5 = (!__pyx_v_little_endian); + } else { + __pyx_t_5 = (__pyx_v_descr->byteorder == '<'); + } + __pyx_t_6 = __pyx_t_5; + } else { + __pyx_t_6 = __pyx_t_1; + } + if (__pyx_t_6) { + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":125 + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError("Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_kp_5); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_5); + __Pyx_GIVEREF(__pyx_kp_5); + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L13; + } + __pyx_L13:; + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":126 + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError("Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + */ + switch (__pyx_v_t) { + case NPY_BYTE: + __pyx_v_f = __pyx_k_6; + break; + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":127 + * raise ValueError("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" + */ + case NPY_UBYTE: + __pyx_v_f = __pyx_k_7; + break; + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":128 + * 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" + */ + case NPY_SHORT: + __pyx_v_f = __pyx_k_8; + break; + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":129 + * 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" + */ + case NPY_USHORT: + __pyx_v_f = __pyx_k_9; + break; + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":130 + * 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" + */ + case NPY_INT: + __pyx_v_f = __pyx_k_10; + break; + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":131 + * 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" + */ + case NPY_UINT: + __pyx_v_f = __pyx_k_11; + break; + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":132 + * 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" + */ + case NPY_LONG: + __pyx_v_f = __pyx_k_12; + break; + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":133 + * 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" + */ + case NPY_ULONG: + __pyx_v_f = __pyx_k_13; + break; + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":134 + * 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" + */ + case NPY_LONGLONG: + __pyx_v_f = __pyx_k_14; + break; + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":135 + * 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" + */ + case NPY_ULONGLONG: + __pyx_v_f = __pyx_k_15; + break; + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":136 + * 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" + */ + case NPY_FLOAT: + __pyx_v_f = __pyx_k_16; + break; + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":137 + * 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" + */ + case NPY_DOUBLE: + __pyx_v_f = __pyx_k_17; + break; + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":138 + * 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" + */ + case NPY_LONGDOUBLE: + __pyx_v_f = __pyx_k_18; + break; + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":139 + * 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" + */ + case NPY_CFLOAT: + __pyx_v_f = __pyx_k_19; + break; + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":140 + * 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" + */ + case NPY_CDOUBLE: + __pyx_v_f = __pyx_k_20; + break; + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":141 + * 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: + */ + case NPY_CLONGDOUBLE: + __pyx_v_f = __pyx_k_21; + break; + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":142 + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< + * else: + * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + */ + case NPY_OBJECT: + __pyx_v_f = __pyx_k_22; + break; + default: + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":144 + * elif t == NPY_OBJECT: f = "O" + * else: + * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * info.format = f + * return + */ + __pyx_t_3 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyNumber_Remainder(__pyx_kp_23, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__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_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":145 + * else: + * raise ValueError("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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":146 + * raise ValueError("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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":148 + * 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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":149 + * 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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":150 + * 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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":153 + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + * &offset) # <<<<<<<<<<<<<< + * f[0] = 0 # Terminate format string + * + */ + __pyx_t_7 = __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_7 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_7; + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":154 + * 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_2); + __Pyx_XDECREF(__pyx_t_3); + __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_FinishRefcountContext(); + return __pyx_r; +} + +/* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":156 + * f[0] = 0 # Terminate format string + * + * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + */ + +static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + int __pyx_t_1; + int __pyx_t_2; + __Pyx_SetupRefcountContext("__releasebuffer__"); + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":157 + * + * 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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":158 + * 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:; - __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); - __pyx_v_info->ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); - __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); - __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); - __pyx_v_info->suboffsets = NULL; - __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); - __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); - __pyx_v_t = PyArray_TYPE(((PyArrayObject *)__pyx_v_self)); - __pyx_v_f = NULL; - switch (__pyx_v_t) { - case NPY_BYTE: - __pyx_v_f = __pyx_k_2; - break; - case NPY_UBYTE: - __pyx_v_f = __pyx_k_3; - break; - case NPY_SHORT: - __pyx_v_f = __pyx_k_4; - break; - case NPY_USHORT: - __pyx_v_f = __pyx_k_5; - break; - case NPY_INT: - __pyx_v_f = __pyx_k_6; - break; - case NPY_UINT: - __pyx_v_f = __pyx_k_7; - break; - case NPY_LONG: - __pyx_v_f = __pyx_k_8; - break; - case NPY_ULONG: - __pyx_v_f = __pyx_k_9; - break; - case NPY_LONGLONG: - __pyx_v_f = __pyx_k_10; - break; - case NPY_ULONGLONG: - __pyx_v_f = __pyx_k_11; - break; - case NPY_FLOAT: - __pyx_v_f = __pyx_k_12; - break; - case NPY_DOUBLE: - __pyx_v_f = __pyx_k_13; - break; - case NPY_LONGDOUBLE: - __pyx_v_f = __pyx_k_14; - break; - case NPY_OBJECT: - __pyx_v_f = __pyx_k_15; - break; - } - __pyx_1 = (__pyx_v_f == NULL); - if (__pyx_1) { - __pyx_2 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyNumber_Remainder(__pyx_kp_16, __pyx_2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_3); - __pyx_3 = 0; - __pyx_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - __Pyx_Raise(__pyx_3, 0, 0); - Py_DECREF(__pyx_3); __pyx_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":159 + * 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_2 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_2) { + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":160 + * 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_v_info->format = __pyx_v_f; + + __Pyx_FinishRefcountContext(); +} + +/* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":277 + * ctypedef npy_cdouble complex_t + * + * 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 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; + PyObject *__pyx_v_i; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + PyObject *__pyx_v_new_offset; + PyObject *__pyx_v_t; + char *__pyx_r; + PyObject *__pyx_1 = 0; + 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; + char *__pyx_t_9; + __Pyx_SetupRefcountContext("_util_dtypestring"); + __pyx_v_child = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_i = ((PyObject *)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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":284 + * cdef int delta_offset + * cdef tuple i + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + */ + __pyx_v_endian_detector = 1; + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":285 + * cdef tuple i + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * + * for i in descr.fields.itervalues(): + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":287 + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + * for i in descr.fields.itervalues(): # <<<<<<<<<<<<<< + * child = i[0] + * new_offset = i[1] + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_descr->fields, __pyx_kp_itervalues); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { + __pyx_t_1 = 0; __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); + } else { + __pyx_t_1 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break; + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; + } else if (likely(PyTuple_CheckExact(__pyx_t_2))) { + 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++; + } else { + __pyx_t_3 = PyIter_Next(__pyx_t_2); + if (!__pyx_t_3) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_3); + } + if (!(likely(PyTuple_CheckExact(__pyx_t_3)) || (__pyx_t_3) == Py_None || (PyErr_Format(PyExc_TypeError, "Expected tuple, got %s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_i)); + __pyx_v_i = ((PyObject *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":288 + * + * for i in descr.fields.itervalues(): + * child = i[0] # <<<<<<<<<<<<<< + * new_offset = i[1] + * + */ + __pyx_1 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_i), 0, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + if (!(__Pyx_TypeTest(__pyx_1, __pyx_ptype_5numpy_dtype))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((PyArray_Descr *)__pyx_1); + __pyx_1 = 0; + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":289 + * for i in descr.fields.itervalues(): + * child = i[0] + * new_offset = i[1] # <<<<<<<<<<<<<< + * + * if (end - f) - (new_offset - offset[0]) < 15: + */ + __pyx_1 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_i), 1, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_v_new_offset); + __pyx_v_new_offset = __pyx_1; + __pyx_1 = 0; + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":291 + * new_offset = i[1] + * + * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< + * raise RuntimeError("Format string allocated too short, see comment in numpy.pxd") + * + */ + __pyx_t_3 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Subtract(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 291; __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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":292 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError("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 = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_kp_25); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_25); + __Pyx_GIVEREF(__pyx_kp_25); + __pyx_t_4 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__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 = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":294 + * raise RuntimeError("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("Non-native byte order not supported") + */ + if ((__pyx_v_child->byteorder == '>')) { + __pyx_t_6 = __pyx_v_little_endian; + } else { + __pyx_t_6 = (__pyx_v_child->byteorder == '>'); + } + if (!__pyx_t_6) { + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":295 + * + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError("Non-native byte order not supported") + * # One could encode it in the format string and have Cython + */ + if ((__pyx_v_child->byteorder == '<')) { + __pyx_t_7 = (!__pyx_v_little_endian); + } else { + __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + } + __pyx_t_8 = __pyx_t_7; + } else { + __pyx_t_8 = __pyx_t_6; + } + if (__pyx_t_8) { + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":296 + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): + * raise ValueError("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_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_kp_28); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_28); + __Pyx_GIVEREF(__pyx_kp_28); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__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 = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":306 + * + * # 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 = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!__pyx_t_8) break; + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":307 + * # 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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":308 + * 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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":309 + * 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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":311 + * 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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":313 + * offset[0] += child.itemsize + * + * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< + * t = child.type_num + * if end - f < 5: + */ + __pyx_t_8 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_8) { + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":314 + * + * if not PyDataType_HASFIELDS(child): + * t = child.type_num # <<<<<<<<<<<<<< + * if end - f < 5: + * raise RuntimeError("Format string allocated too short.") + */ + __pyx_t_4 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_t); + __pyx_v_t = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":315 + * if not PyDataType_HASFIELDS(child): + * t = child.type_num + * if end - f < 5: # <<<<<<<<<<<<<< + * raise RuntimeError("Format string allocated too short.") + * + */ + __pyx_t_8 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_8) { + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":316 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError("Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_kp_29); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_29); + __Pyx_GIVEREF(__pyx_kp_29); + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__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 = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + __pyx_L10:; + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":319 + * + * # 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 = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 98; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":320 + * # 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_4 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 66; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":321 + * 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 = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 104; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":322 + * 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_4 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 72; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":323 + * 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 = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 105; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":324 + * 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_4 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 73; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":325 + * 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 = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 108; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":326 + * 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_4 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 76; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":327 + * 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 = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 113; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":328 + * 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_4 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 81; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":329 + * 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 = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 102; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":330 + * 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_4 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 100; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":331 + * 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 = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 103; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":332 + * 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_4 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 102; + __pyx_v_f += 1; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":333 + * 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 = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 100; + __pyx_v_f += 1; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":334 + * 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_4 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 103; + __pyx_v_f += 1; + goto __pyx_L11; + } + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":335 + * 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("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 = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_8) { + (__pyx_v_f[0]) = 79; + goto __pyx_L11; + } + /*else*/ { + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":337 + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * f += 1 + * else: + */ + __pyx_t_4 = PyNumber_Remainder(__pyx_kp_30, __pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__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 = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L11:; + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":338 + * else: + * raise ValueError("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.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":342 + * # Cython ignores struct boundary information ("T{...}"), + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< + * return f + * + */ + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_9; + } + __pyx_L9:; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/numpy.pxd":343 + * # 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:; - Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_3); - __Pyx_AddTraceback("numpy.ndarray.__getbuffer__"); - __pyx_r = -1; + __Pyx_XDECREF(__pyx_1); + __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_i); + __Pyx_DECREF(__pyx_v_new_offset); + __Pyx_DECREF(__pyx_v_t); + __Pyx_FinishRefcountContext(); return __pyx_r; } static struct PyMethodDef __pyx_methods[] = { - {"Transfer3D", (PyCFunction)__pyx_pf_2yt_5lagos_12RTIntegrator_Transfer3D, METH_VARARGS|METH_KEYWORDS, __pyx_doc_2yt_5lagos_12RTIntegrator_Transfer3D}, - {"Transfer1D", (PyCFunction)__pyx_pf_2yt_5lagos_12RTIntegrator_Transfer1D, METH_VARARGS|METH_KEYWORDS, 0}, - {"VoxelTraversal", (PyCFunction)__pyx_pf_2yt_5lagos_12RTIntegrator_VoxelTraversal, METH_VARARGS|METH_KEYWORDS, 0}, + {__Pyx_NAMESTR("Transfer3D"), (PyCFunction)__pyx_pf_2yt_5lagos_12RTIntegrator_Transfer3D, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2yt_5lagos_12RTIntegrator_Transfer3D)}, + {__Pyx_NAMESTR("Transfer1D"), (PyCFunction)__pyx_pf_2yt_5lagos_12RTIntegrator_Transfer1D, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("VoxelTraversal"), (PyCFunction)__pyx_pf_2yt_5lagos_12RTIntegrator_VoxelTraversal, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; @@ -1435,8 +4655,8 @@ #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, - "RTIntegrator", - __pyx_mdoc, /* m_doc */ + __Pyx_NAMESTR("RTIntegrator"), + __Pyx_DOCSTR(__pyx_mdoc), /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ @@ -1447,24 +4667,56 @@ #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp___main__, __pyx_k___main__, sizeof(__pyx_k___main__), 1, 1, 1}, + {&__pyx_kp_i_s, __pyx_k_i_s, sizeof(__pyx_k_i_s), 1, 1, 1}, + {&__pyx_kp_o_s, __pyx_k_o_s, sizeof(__pyx_k_o_s), 1, 1, 1}, + {&__pyx_kp_e, __pyx_k_e, sizeof(__pyx_k_e), 1, 1, 1}, + {&__pyx_kp_a, __pyx_k_a, sizeof(__pyx_k_a), 1, 1, 1}, + {&__pyx_kp_imin, __pyx_k_imin, sizeof(__pyx_k_imin), 1, 1, 1}, + {&__pyx_kp_imax, __pyx_k_imax, sizeof(__pyx_k_imax), 1, 1, 1}, + {&__pyx_kp_jmin, __pyx_k_jmin, sizeof(__pyx_k_jmin), 1, 1, 1}, + {&__pyx_kp_jmax, __pyx_k_jmax, sizeof(__pyx_k_jmax), 1, 1, 1}, + {&__pyx_kp_kmin, __pyx_k_kmin, sizeof(__pyx_k_kmin), 1, 1, 1}, + {&__pyx_kp_kmax, __pyx_k_kmax, sizeof(__pyx_k_kmax), 1, 1, 1}, + {&__pyx_kp_istride, __pyx_k_istride, sizeof(__pyx_k_istride), 1, 1, 1}, + {&__pyx_kp_jstride, __pyx_k_jstride, sizeof(__pyx_k_jstride), 1, 1, 1}, + {&__pyx_kp_dx, __pyx_k_dx, sizeof(__pyx_k_dx), 1, 1, 1}, + {&__pyx_kp_grid_mask, __pyx_k_grid_mask, sizeof(__pyx_k_grid_mask), 1, 1, 1}, + {&__pyx_kp_grid_t, __pyx_k_grid_t, sizeof(__pyx_k_grid_t), 1, 1, 1}, + {&__pyx_kp_left_edge, __pyx_k_left_edge, sizeof(__pyx_k_left_edge), 1, 1, 1}, + {&__pyx_kp_right_edge, __pyx_k_right_edge, sizeof(__pyx_k_right_edge), 1, 1, 1}, + {&__pyx_kp_u, __pyx_k_u, sizeof(__pyx_k_u), 1, 1, 1}, + {&__pyx_kp_v, __pyx_k_v, sizeof(__pyx_k_v), 1, 1, 1}, {&__pyx_kp_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 1, 1, 1}, {&__pyx_kp_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 1, 1}, + {&__pyx_kp_range, __pyx_k_range, sizeof(__pyx_k_range), 1, 1, 1}, {&__pyx_kp_ones, __pyx_k_ones, sizeof(__pyx_k_ones), 1, 1, 1}, {&__pyx_kp_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 1, 1, 1}, - {&__pyx_kp_17, __pyx_k_17, sizeof(__pyx_k_17), 1, 1, 1}, + {&__pyx_kp_31, __pyx_k_31, sizeof(__pyx_k_31), 1, 1, 1}, {&__pyx_kp_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 1, 1, 1}, - {&__pyx_kp_18, __pyx_k_18, sizeof(__pyx_k_18), 1, 1, 1}, + {&__pyx_kp_32, __pyx_k_32, sizeof(__pyx_k_32), 1, 1, 1}, {&__pyx_kp_floor, __pyx_k_floor, sizeof(__pyx_k_floor), 1, 1, 1}, - {&__pyx_kp___getbuffer__, __pyx_k___getbuffer__, sizeof(__pyx_k___getbuffer__), 0, 1, 1}, + {&__pyx_kp___getbuffer__, __pyx_k___getbuffer__, sizeof(__pyx_k___getbuffer__), 1, 1, 1}, + {&__pyx_kp___releasebuffer__, __pyx_k___releasebuffer__, sizeof(__pyx_k___releasebuffer__), 1, 1, 1}, + {&__pyx_kp_info, __pyx_k_info, sizeof(__pyx_k_info), 1, 1, 1}, + {&__pyx_kp_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 1, 1, 1}, + {&__pyx_kp_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 1, 1, 1}, + {&__pyx_kp_itervalues, __pyx_k_itervalues, sizeof(__pyx_k_itervalues), 1, 1, 1}, {&__pyx_kp_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 1, 1, 1}, - {&__pyx_kp_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 1, 1, 1}, {&__pyx_kp_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 0}, - {&__pyx_kp_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 0}, + {&__pyx_kp_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 0}, + {&__pyx_kp_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 0}, + {&__pyx_kp_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 0}, + {&__pyx_kp_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 0}, + {&__pyx_kp_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 0}, + {&__pyx_kp_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 0}, + {&__pyx_kp_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 0}, {0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_kp_RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_kp_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_kp_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_kp_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_kp_RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -1475,6 +4727,7 @@ __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_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_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_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;}; if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; @@ -1490,14 +4743,31 @@ #endif { PyObject *__pyx_1 = 0; + #ifdef CYTHON_REFNANNY + void* __pyx_refchk = NULL; + __Pyx_Refnanny = __Pyx_ImportRefcountAPI("refnanny"); + if (!__Pyx_Refnanny) { + PyErr_Clear(); + __Pyx_Refnanny = __Pyx_ImportRefcountAPI("Cython.Runtime.refnanny"); + if (!__Pyx_Refnanny) + Py_FatalError("failed to import refnanny module"); + } + __pyx_refchk = __Pyx_Refnanny->NewContext("PyMODINIT_FUNC PyInit_RTIntegrator(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;} - /*--- Libary function declarations ---*/ + /*--- Library function declarations ---*/ __pyx_init_filenames(); + /*--- 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 /*--- 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;} /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("RTIntegrator", __pyx_methods, __pyx_mdoc, 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("RTIntegrator"), __pyx_methods, __pyx_mdoc, 0, PYTHON_API_VERSION); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif @@ -1505,9 +4775,12 @@ #if PY_MAJOR_VERSION < 3 Py_INCREF(__pyx_m); #endif - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); + __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 (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__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;}; + if (__pyx_module_is_main_yt__lagos__RTIntegrator) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_kp___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;} __pyx_skip_dispatch = 0; @@ -1515,23 +4788,41 @@ /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject)); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr)); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject)); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Function import code ---*/ /*--- Execution code ---*/ + + /* "yt/lagos/RTIntegrator.pyx":26 + * """ + * + * import numpy as np # <<<<<<<<<<<<<< + * cimport numpy as np + * cimport cython + */ __pyx_1 = __Pyx_Import(__pyx_kp_numpy, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_1); if (PyObject_SetAttr(__pyx_m, __pyx_kp_np, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + + /* "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Cython-0.11.2-py2.5-macosx-10.3-ppc.egg/Cython/Includes/stdlib.pxd":2 + * + * cdef extern from "stdlib.h" nogil: # <<<<<<<<<<<<<< + * void free(void *ptr) + * void *malloc(size_t size) + */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_1); + __Pyx_AddTraceback("yt.lagos.RTIntegrator"); + Py_DECREF(__pyx_m); __pyx_m = 0; + __pyx_L0:; + __Pyx_FinishRefcountContext(); #if PY_MAJOR_VERSION < 3 return; #else return __pyx_m; #endif - __pyx_L1_error:; - Py_XDECREF(__pyx_1); - __Pyx_AddTraceback("yt.lagos.RTIntegrator"); - #if PY_MAJOR_VERSION >= 3 - return NULL; - #endif } static const char *__pyx_filenames[] = { @@ -1545,81 +4836,534 @@ __pyx_f = __pyx_filenames; } -static INLINE void __Pyx_SafeReleaseBuffer(PyObject* obj, Py_buffer* info) { - if (info->buf == NULL) return; - if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; - __Pyx_ReleaseBuffer(obj, info); +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 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 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 INLINE const char* __Pyx_ConsumeWhitespace(const char* ts) { - while (1) { - switch (*ts) { - case 10: - case 13: - case ' ': - ++ts; - default: - return ts; - } - } -} - -static INLINE const char* __Pyx_BufferTypestringCheckEndian(const char* ts) { - int num = 1; - int little_endian = ((char*)&num)[0]; - int ok = 1; - switch (*ts) { - case '@': - case '=': - ++ts; break; - case '<': - if (little_endian) ++ts; - else ok = 0; - break; - case '>': - case '!': - if (!little_endian) ++ts; - else ok = 0; - break; - } - if (!ok) { - PyErr_Format(PyExc_ValueError, "Buffer has wrong endianness (rejecting on '%s')", ts); - return NULL; - } - return ts; -} - -static void __Pyx_BufferNdimError(Py_buffer* buffer, int expected_ndim) { - PyErr_Format(PyExc_ValueError, - "Buffer has wrong number of dimensions (expected %d, got %d)", - expected_ndim, buffer->ndim); -} - - -static const char* __Pyx_BufferTypestringCheck_item_nn___pyx_t_5numpy_float_t(const char* ts) { - int ok; - if (*ts == '1') ++ts; - switch (*ts) { - case 'f': ok = (sizeof(__pyx_t_5numpy_float_t) == sizeof(float) && (__pyx_t_5numpy_float_t)-1 < 0); break; - case 'd': ok = (sizeof(__pyx_t_5numpy_float_t) == sizeof(double) && (__pyx_t_5numpy_float_t)-1 < 0); break; - case 'g': ok = (sizeof(__pyx_t_5numpy_float_t) == sizeof(long double) && (__pyx_t_5numpy_float_t)-1 < 0); break; default: ok = 0; - } - if (!ok) { - PyErr_Format(PyExc_ValueError, "Buffer datatype mismatch (rejecting on '%s')", ts); - return NULL; - } else return ts + 1; - -} - -static int __Pyx_GetBuffer_nn___pyx_t_5numpy_float_t(PyObject* obj, Py_buffer* buf, int flags, int nd) { - const char* ts; +static 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; @@ -1627,20 +5371,22 @@ buf->buf = NULL; if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail; if (buf->ndim != nd) { - __Pyx_BufferNdimError(buf, nd); + PyErr_Format(PyExc_ValueError, + "Buffer has wrong number of dimensions (expected %d, got %d)", + nd, buf->ndim); goto fail; } - ts = buf->format; - ts = __Pyx_ConsumeWhitespace(ts); - ts = __Pyx_BufferTypestringCheckEndian(ts); - if (!ts) goto fail; - ts = __Pyx_ConsumeWhitespace(ts); - ts = __Pyx_BufferTypestringCheck_item_nn___pyx_t_5numpy_float_t(ts); - if (!ts) goto fail; - ts = __Pyx_ConsumeWhitespace(ts); - if (*ts != 0) { + 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, - "Expected non-struct buffer data type (expected end, got '%s')", ts); + "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; @@ -1649,101 +5395,74 @@ __Pyx_ZeroBuffer(buf); return -1; } -static const char* __Pyx_BufferTypestringCheck_item_nn___pyx_t_5numpy_int_t(const char* ts) { - int ok; - if (*ts == '1') ++ts; - switch (*ts) { - case 'b': ok = (sizeof(__pyx_t_5numpy_int_t) == sizeof(char) && (__pyx_t_5numpy_int_t)-1 < 0); break; - case 'h': ok = (sizeof(__pyx_t_5numpy_int_t) == sizeof(short) && (__pyx_t_5numpy_int_t)-1 < 0); break; - case 'i': ok = (sizeof(__pyx_t_5numpy_int_t) == sizeof(int) && (__pyx_t_5numpy_int_t)-1 < 0); break; - case 'l': ok = (sizeof(__pyx_t_5numpy_int_t) == sizeof(long) && (__pyx_t_5numpy_int_t)-1 < 0); break; - case 'q': ok = (sizeof(__pyx_t_5numpy_int_t) == sizeof(long long) && (__pyx_t_5numpy_int_t)-1 < 0); break; default: ok = 0; - } - if (!ok) { - PyErr_Format(PyExc_ValueError, "Buffer datatype mismatch (rejecting on '%s')", ts); - return NULL; - } else return ts + 1; - + +static INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { + if (info->buf == NULL) return; + if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; + __Pyx_ReleaseBuffer(info); } -static int __Pyx_GetBuffer_nn___pyx_t_5numpy_int_t(PyObject* obj, Py_buffer* buf, int flags, int nd) { - const char* ts; - if (obj == Py_None) { - __Pyx_ZeroBuffer(buf); +static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + +#if PY_MAJOR_VERSION >= 3 + /* Note: this is a temporary work-around to prevent crashes in Python 3.0 */ + if ((tstate->exc_type != NULL) & (tstate->exc_type != Py_None)) { + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + PyErr_NormalizeException(&type, &value, &tb); + PyErr_NormalizeException(&tmp_type, &tmp_value, &tmp_tb); + tstate->exc_type = 0; + tstate->exc_value = 0; + tstate->exc_traceback = 0; + PyException_SetContext(value, tmp_value); + Py_DECREF(tmp_type); + Py_XDECREF(tmp_tb); + } +#endif + + 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 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 int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (!type) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (obj == Py_None || PyObject_TypeCheck(obj, type)) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %s to %s", + Py_TYPE(obj)->tp_name, type->tp_name); return 0; - } - buf->buf = NULL; - if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail; - if (buf->ndim != nd) { - __Pyx_BufferNdimError(buf, nd); - goto fail; - } - ts = buf->format; - ts = __Pyx_ConsumeWhitespace(ts); - ts = __Pyx_BufferTypestringCheckEndian(ts); - if (!ts) goto fail; - ts = __Pyx_ConsumeWhitespace(ts); - ts = __Pyx_BufferTypestringCheck_item_nn___pyx_t_5numpy_int_t(ts); - if (!ts) goto fail; - ts = __Pyx_ConsumeWhitespace(ts); - if (*ts != 0) { - PyErr_Format(PyExc_ValueError, - "Expected non-struct buffer data type (expected end, got '%s')", ts); - goto fail; - } - if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; - return 0; -fail:; - __Pyx_ZeroBuffer(buf); - return -1; } -static const char* __Pyx_BufferTypestringCheck_item_nn___pyx_t_5numpy_float64_t(const char* ts) { - int ok; - if (*ts == '1') ++ts; - switch (*ts) { - case 'f': ok = (sizeof(__pyx_t_5numpy_float64_t) == sizeof(float) && (__pyx_t_5numpy_float64_t)-1 < 0); break; - case 'd': ok = (sizeof(__pyx_t_5numpy_float64_t) == sizeof(double) && (__pyx_t_5numpy_float64_t)-1 < 0); break; - case 'g': ok = (sizeof(__pyx_t_5numpy_float64_t) == sizeof(long double) && (__pyx_t_5numpy_float64_t)-1 < 0); break; default: ok = 0; - } - if (!ok) { - PyErr_Format(PyExc_ValueError, "Buffer datatype mismatch (rejecting on '%s')", ts); - return NULL; - } else return ts + 1; - -} - -static int __Pyx_GetBuffer_nn___pyx_t_5numpy_float64_t(PyObject* obj, Py_buffer* buf, int flags, int nd) { - const char* ts; - 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) { - __Pyx_BufferNdimError(buf, nd); - goto fail; - } - ts = buf->format; - ts = __Pyx_ConsumeWhitespace(ts); - ts = __Pyx_BufferTypestringCheckEndian(ts); - if (!ts) goto fail; - ts = __Pyx_ConsumeWhitespace(ts); - ts = __Pyx_BufferTypestringCheck_item_nn___pyx_t_5numpy_float64_t(ts); - if (!ts) goto fail; - ts = __Pyx_ConsumeWhitespace(ts); - if (*ts != 0) { - PyErr_Format(PyExc_ValueError, - "Expected non-struct buffer data type (expected end, got '%s')", ts); - goto fail; - } - if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; - return 0; -fail:; - __Pyx_ZeroBuffer(buf); - return -1; -} -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name, int exact) { + + + +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; @@ -1761,21 +5480,12 @@ return 0; } -static INLINE void __Pyx_RaiseArgtupleTooLong( - Py_ssize_t num_expected, - Py_ssize_t num_found) -{ - const char* error_message = - #if PY_VERSION_HEX < 0x02050000 - "function takes at most %d positional arguments (%d given)"; - #else - "function takes at most %zd positional arguments (%zd given)"; - #endif - PyErr_Format(PyExc_TypeError, error_message, num_expected, num_found); -} - -#if (PY_MAJOR_VERSION < 3) && !(Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_NEWBUFFER) +#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); @@ -1783,8 +5493,13 @@ } } -static void __Pyx_ReleaseBuffer(PyObject *obj, Py_buffer *view) { - +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 @@ -1796,7 +5511,7 @@ PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; - __import__ = PyObject_GetAttrString(__pyx_b, "__import__"); + __import__ = __Pyx_GetAttrString(__pyx_b, "__import__"); if (!__import__) goto bad; if (from_list) @@ -1813,8 +5528,8 @@ empty_dict = PyDict_New(); if (!empty_dict) goto bad; - module = PyObject_CallFunction(__import__, "OOOO", - name, global_dict, empty_dict, list); + module = PyObject_CallFunctionObjArgs(__import__, + name, global_dict, empty_dict, list, NULL); bad: Py_XDECREF(empty_list); Py_XDECREF(__import__); @@ -1830,20 +5545,6 @@ return result; } -static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (!type) { - PyErr_Format(PyExc_SystemError, "Missing type object"); - return 0; - } - if (obj == Py_None || PyObject_TypeCheck(obj, type)) - return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %s to %s", - Py_TYPE(obj)->tp_name, type->tp_name); - return 0; -} - - - static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { Py_XINCREF(type); Py_XINCREF(value); @@ -1899,7 +5600,7 @@ } #endif } - PyErr_Restore(type, value, tb); + __Pyx_ErrRestore(type, value, tb); return; raise_error: Py_XDECREF(value); @@ -1908,27 +5609,319 @@ return; } +static INLINE int __Pyx_StrEq(const char *s1, const char *s2) { + while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } + return *s1 == *s2; +} + +static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + 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())) + return (unsigned char)-1; + if (unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned char"); + return (unsigned char)-1; + } + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to unsigned char"); + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + 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())) + return (unsigned short)-1; + if (unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned short"); + return (unsigned short)-1; + } + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to unsigned short"); + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + 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())) + return (unsigned int)-1; + if (unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned int"); + return (unsigned int)-1; + } + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to unsigned int"); + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (unlikely(val == -1 && PyErr_Occurred())) + return (char)-1; + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to char"); + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (unlikely(val == -1 && PyErr_Occurred())) + return (short)-1; + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to short"); + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (unlikely(val == -1 && PyErr_Occurred())) + return (int)-1; + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to int"); + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + 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())) + return (signed char)-1; + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to signed char"); + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + 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())) + return (signed short)-1; + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to signed short"); + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + 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())) + return (signed int)-1; + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to signed int"); + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (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_CheckExact(x) || PyLong_Check(x))) { + 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 { + 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 INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (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_CheckExact(x) || PyLong_Check(x))) { + 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 { + 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 INLINE long __Pyx_PyInt_AsLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + return (long)val; + } else +#endif + if (likely(PyLong_CheckExact(x) || PyLong_Check(x))) { + 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 INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_CheckExact(x) || PyLong_Check(x))) { + 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 INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + return (signed long)val; + } else +#endif + if (likely(PyLong_CheckExact(x) || PyLong_Check(x))) { + 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 INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_CheckExact(x) || PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_CheckExact(x) || PyLong_Check(x))) { + 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(char *module_name, char *class_name, +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; + py_module = __Pyx_ImportModule(module_name); + if (!py_module) + goto bad; #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(module_name); + py_name = PyString_FromString(class_name); #else - py_name = PyUnicode_FromString(module_name); + py_name = PyUnicode_FromString(class_name); #endif if (!py_name) goto bad; - - py_module = __Pyx_ImportModule(module_name); - if (!py_module) - goto bad; - result = PyObject_GetAttrString(py_module, class_name); + 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)) { @@ -1945,7 +5938,7 @@ } return (PyTypeObject *)result; bad: - Py_XDECREF(py_name); + Py_XDECREF(py_module); Py_XDECREF(result); return 0; } @@ -1953,7 +5946,7 @@ #ifndef __PYX_HAVE_RT_ImportModule #define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(char *name) { +static PyObject *__Pyx_ImportModule(const char *name) { PyObject *py_name = 0; PyObject *py_module = 0; @@ -2035,7 +6028,7 @@ ); if (!py_code) goto bad; py_frame = PyFrame_New( - PyThreadState_Get(), /*PyThreadState *tstate,*/ + PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ py_globals, /*PyObject *globals,*/ 0 /*PyObject *locals*/ @@ -2079,7 +6072,59 @@ /* Type Conversion Functions */ -static INLINE Py_ssize_t __pyx_PyIndex_AsSsize_t(PyObject* b) { +static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + if (x == Py_True) return 1; + else if ((x == Py_False) | (x == Py_None)) return 0; + else return PyObject_IsTrue(x); +} + +static 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 INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); if (!x) return -1; @@ -2088,212 +6133,30 @@ return ival; } -static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { - if (x == Py_True) return 1; - else if (x == Py_False) return 0; - else return PyObject_IsTrue(x); +static 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 INLINE PY_LONG_LONG __pyx_PyInt_AsLongLong(PyObject* x) { - if (PyInt_CheckExact(x)) { - return PyInt_AS_LONG(x); - } - else if (PyLong_CheckExact(x)) { - return PyLong_AsLongLong(x); - } - else { - PY_LONG_LONG val; - PyObject* tmp = PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; - val = __pyx_PyInt_AsLongLong(tmp); - Py_DECREF(tmp); - return val; - } +static 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; } -static INLINE unsigned PY_LONG_LONG __pyx_PyInt_AsUnsignedLongLong(PyObject* x) { - if (PyInt_CheckExact(x)) { - long val = PyInt_AS_LONG(x); - if (unlikely(val < 0)) { - PyErr_SetString(PyExc_TypeError, "Negative assignment to unsigned type."); - return (unsigned PY_LONG_LONG)-1; - } - return val; - } - else if (PyLong_CheckExact(x)) { - return PyLong_AsUnsignedLongLong(x); - } - else { - PY_LONG_LONG val; - PyObject* tmp = PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; - val = __pyx_PyInt_AsUnsignedLongLong(tmp); - Py_DECREF(tmp); - return val; - } -} - - -static INLINE unsigned char __pyx_PyInt_unsigned_char(PyObject* x) { - if (sizeof(unsigned char) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - unsigned char val = (unsigned char)long_val; - if (unlikely((val != long_val) || (long_val < 0))) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to unsigned char"); - return (unsigned char)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE unsigned short __pyx_PyInt_unsigned_short(PyObject* x) { - if (sizeof(unsigned short) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - unsigned short val = (unsigned short)long_val; - if (unlikely((val != long_val) || (long_val < 0))) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to unsigned short"); - return (unsigned short)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE char __pyx_PyInt_char(PyObject* x) { - if (sizeof(char) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - char val = (char)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to char"); - return (char)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE short __pyx_PyInt_short(PyObject* x) { - if (sizeof(short) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - short val = (short)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to short"); - return (short)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE int __pyx_PyInt_int(PyObject* x) { - if (sizeof(int) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - int val = (int)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to int"); - return (int)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE long __pyx_PyInt_long(PyObject* x) { - if (sizeof(long) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - long val = (long)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to long"); - return (long)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE signed char __pyx_PyInt_signed_char(PyObject* x) { - if (sizeof(signed char) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - signed char val = (signed char)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed char"); - return (signed char)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE signed short __pyx_PyInt_signed_short(PyObject* x) { - if (sizeof(signed short) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - signed short val = (signed short)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed short"); - return (signed short)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE signed int __pyx_PyInt_signed_int(PyObject* x) { - if (sizeof(signed int) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - signed int val = (signed int)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed int"); - return (signed int)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE signed long __pyx_PyInt_signed_long(PyObject* x) { - if (sizeof(signed long) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - signed long val = (signed long)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed long"); - return (signed long)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE long double __pyx_PyInt_long_double(PyObject* x) { - if (sizeof(long double) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - long double val = (long double)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to long double"); - return (long double)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - + diff -r 90e2530efb3dc383cfb70f9600290fc7a4bcd71a -r 7fd89683add68d5819acc3332ef40daa53ebd8b1 yt/lagos/RTIntegrator.pyx --- a/yt/lagos/RTIntegrator.pyx Tue Jun 23 22:26:09 2009 -0700 +++ b/yt/lagos/RTIntegrator.pyx Sun Jul 12 23:05:12 2009 -0700 @@ -72,6 +72,7 @@ @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=1] left_edge, np.ndarray[np.float64_t, ndim=1] right_edge, np.ndarray[np.float64_t, ndim=1] dx, @@ -81,12 +82,15 @@ # 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 double tl, tr, intersect_t, intersect + cdef double tl, tr, intersect_t, enter_t, exit_t cdef np.ndarray step = np.ones(3, dtype=np.float64) # maybe just ints? cdef np.ndarray cur_ind = np.zeros(3, dtype=np.int64) # maybe just ints? cdef np.ndarray tdelta = np.zeros(3, dtype=np.float64) cdef np.ndarray tmax = np.zeros(3, dtype=np.float64) - intersect_t = 1e30 + cdef np.ndarray intersect = np.zeros(3, dtype=np.float64) + intersect_t = 1 + # 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 @@ -94,47 +98,62 @@ 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 \ + 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 <= 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 \ + 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 <= 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 - if intersect_t > 1e29: return + if intersect_t > 1: return # Now get the indices of the intersection + intersect = u + intersect_t * v for i in range(3): - intersect = u[i] + intersect_t * v[i] - cur_ind[i] = np.floor((intersect - left_edge[i])/dx[i]) - if step[i] > 0: tdelta[i] = intersect - ((cur_ind[i]+1) * dx[i]) - if step[i] < 0: tdelta[i] = intersect - (cur_ind[i] * dx[i]) - tmax[i] = dx[i]/v[i] - # We now know where we have pierced the grid initially. + cur_ind[i] = np.floor((intersect[i] - left_edge[i])/dx[i]) + tmax[i] = (((cur_ind[i]+step[i])*dx[i])+left_edge[i]-u[i])/v[i] + if step[i] < 0: cur_ind[i] -= 1 + tdelta[i] = abs(dx[i]/v[i]) + # The variable intersect contains the point we first pierce the grid + enter_t = intersect_t cdef int in_cells = 1 while 1: - if cur_ind[0] >= grid_mask.shape[0] or \ - cur_ind[1] >= grid_mask.shape[1] or \ - cur_ind[2] >= grid_mask.shape[2]: + 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 else: grid_mask[cur_ind[0], cur_ind[1], cur_ind[2]] = 1 + # 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. + if tmax[0] > 1 and tmax[1] > 1 and tmax[2] > 1: + break if tmax[0] < tmax[1]: if tmax[0] < tmax[2]: + grid_t[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] - tmax[0] += tdelta[0] else: + grid_t[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] - tmax[2] += tdelta[2] else: if tmax[1] < tmax[2]: + grid_t[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] - tmax[1] += tdelta[1] else: + grid_t[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] - tmax[2] += tdelta[2] return diff -r 90e2530efb3dc383cfb70f9600290fc7a4bcd71a -r 7fd89683add68d5819acc3332ef40daa53ebd8b1 yt/lagos/UniversalFields.py --- a/yt/lagos/UniversalFields.py Tue Jun 23 22:26:09 2009 -0700 +++ b/yt/lagos/UniversalFields.py Sun Jul 12 23:05:12 2009 -0700 @@ -356,6 +356,10 @@ function=_TotalMass, convert_function=_convertCellMassMsun) +def _Matter_Density(field,data): + return (data['Density'] + data['Dark_Matter_Density']) +add_field("Matter_Density",function=_Matter_Density,units=r"\rm{g}/\rm{cm^3}") + def _CellVolume(field, data): if data['dx'].size == 1: try: diff -r 90e2530efb3dc383cfb70f9600290fc7a4bcd71a -r 7fd89683add68d5819acc3332ef40daa53ebd8b1 yt/lagos/__init__.py --- a/yt/lagos/__init__.py Tue Jun 23 22:26:09 2009 -0700 +++ b/yt/lagos/__init__.py Sun Jul 12 23:05:12 2009 -0700 @@ -38,6 +38,8 @@ import warnings try: import h5py + if not hasattr(h5py.h5, "ArgsError"): + h5py.h5.ArgsError = h5py.h5.H5Error except ImportError: ytcfg["lagos", "serialization"] = "False" mylog.warning("No h5py. Data serialization disabled.") diff -r 90e2530efb3dc383cfb70f9600290fc7a4bcd71a -r 7fd89683add68d5819acc3332ef40daa53ebd8b1 yt/raven/PlotCollection.py --- a/yt/raven/PlotCollection.py Tue Jun 23 22:26:09 2009 -0700 +++ b/yt/raven/PlotCollection.py Sun Jul 12 23:05:12 2009 -0700 @@ -67,7 +67,7 @@ for p in self.plots: yield p - def save(self, basename, format="png", override=False): + def save(self, basename, format="png", override=False, force_save=False): """ Same plots with automatically generated names, prefixed with *basename* (including directory path) unless *override* is specified, and in @@ -77,7 +77,7 @@ for plot in self.plots: fn.append(plot.save_image(basename, \ format=format, submit=self._run_id, - override=override)) + override=override, force_save=force_save)) if self.submit: im = plot.im.copy() im["Filename"] = self._http_prefix + "/" \ diff -r 90e2530efb3dc383cfb70f9600290fc7a4bcd71a -r 7fd89683add68d5819acc3332ef40daa53ebd8b1 yt/raven/PlotTypes.py --- a/yt/raven/PlotTypes.py Tue Jun 23 22:26:09 2009 -0700 +++ b/yt/raven/PlotTypes.py Sun Jul 12 23:05:12 2009 -0700 @@ -101,7 +101,7 @@ def __getitem__(self, item): return self.data[item] # Should be returned in CGS - def save_image(self, prefix, format="png", submit=None, override=True): + def save_image(self, prefix, format="png", submit=None, override=True, force_save=False): """ Save this plot image. Will generate a filename based on the *prefix*, *format*. *submit* will govern the submission to the Deliverator and @@ -115,7 +115,10 @@ my_prefix = prefix fn = ".".join([my_prefix, format]) canvas = engineVals["canvas"](self._figure) - only_on_root(canvas.print_figure, fn) + if force_save: + canvas.print_figure(fn) + else: + only_on_root(canvas.print_figure, fn) self["Type"] = self._type_name self["GeneratedAt"] = self.data.pf["CurrentTimeIdentifier"] return fn